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,776 +1,641 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Ai as ServerSettingsError, Bs as DEFAULT_GIT_TEXT_GENERATION_MODEL_BY_PROVIDER, Ic as NodeE2eeAdmissionPolicy, Ks as ProviderDriverKind, Li as StorageError, Ti as DEFAULT_SERVER_SETTINGS, Us as MODEL_SLUG_ALIASES_BY_PROVIDER, Vs as DEFAULT_GIT_TEXT_GENERATION_OPTIONS_BY_PROVIDER, Ys as isProviderDriverKind, do as PROJECT_RELOCATION_PENDING_MESSAGE, ki as ServerSettings, qs as ProviderInstanceId } from "./src-VTj60bUm.mjs";
|
|
4
4
|
import { r as fromLenientJson } from "./schemaJson-CaG1bOvo.mjs";
|
|
5
5
|
import { n as runProcess } from "./processRunner-DnndFd2A.mjs";
|
|
6
6
|
import { Cache, Cause, Context, Data, DateTime, Deferred, Duration, Effect, Equal, Exit, FileSystem, Layer, Metric, Path, Predicate, PubSub, Ref, Schema, SchemaIssue, Scope, Semaphore, Stream } from "effect";
|
|
7
|
-
import * as P from "effect/Predicate";
|
|
8
7
|
import path, { join } from "node:path";
|
|
9
8
|
import * as Crypto from "node:crypto";
|
|
10
9
|
import { createHash, timingSafeEqual } from "node:crypto";
|
|
10
|
+
import * as P from "effect/Predicate";
|
|
11
11
|
import { constants } from "node:fs";
|
|
12
12
|
import { homedir } from "node:os";
|
|
13
13
|
import fs$1, { access, lstat, realpath } from "node:fs/promises";
|
|
14
14
|
import * as Semaphore$1 from "effect/Semaphore";
|
|
15
15
|
import "effect/PlatformError";
|
|
16
16
|
import { dual } from "effect/Function";
|
|
17
|
-
//#region ../../
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/is.js
|
|
18
|
+
const objectTypeNames = [
|
|
19
|
+
"Object",
|
|
20
|
+
"RegExp",
|
|
21
|
+
"Date",
|
|
22
|
+
"Error",
|
|
23
|
+
"Map",
|
|
24
|
+
"Set",
|
|
25
|
+
"WeakMap",
|
|
26
|
+
"WeakSet",
|
|
27
|
+
"ArrayBuffer",
|
|
28
|
+
"SharedArrayBuffer",
|
|
29
|
+
"DataView",
|
|
30
|
+
"Promise",
|
|
31
|
+
"URL",
|
|
32
|
+
"HTMLElement",
|
|
33
|
+
"Int8Array",
|
|
34
|
+
"Uint8ClampedArray",
|
|
35
|
+
"Int16Array",
|
|
36
|
+
"Uint16Array",
|
|
37
|
+
"Int32Array",
|
|
38
|
+
"Uint32Array",
|
|
39
|
+
"Float32Array",
|
|
40
|
+
"Float64Array",
|
|
41
|
+
"BigInt64Array",
|
|
42
|
+
"BigUint64Array",
|
|
43
|
+
"Tagged"
|
|
44
|
+
];
|
|
31
45
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* friendly name; the routing slug remains the deterministic final fallback.
|
|
46
|
+
* @param {any} value
|
|
47
|
+
* @returns {string}
|
|
35
48
|
*/
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return { optionDescriptors: input.optionDescriptors.map(cloneDescriptor) };
|
|
50
|
-
}
|
|
51
|
-
function getRawSelectionValueById(selections, id) {
|
|
52
|
-
return (selections?.find((candidate) => candidate.id === id))?.value;
|
|
53
|
-
}
|
|
54
|
-
function getProviderOptionSelectionValue(selections, id) {
|
|
55
|
-
return getRawSelectionValueById(selections, id);
|
|
56
|
-
}
|
|
57
|
-
function getProviderOptionStringSelectionValue(selections, id) {
|
|
58
|
-
const value = getProviderOptionSelectionValue(selections, id);
|
|
59
|
-
return typeof value === "string" ? value : void 0;
|
|
60
|
-
}
|
|
61
|
-
function getProviderOptionBooleanSelectionValue(selections, id) {
|
|
62
|
-
const value = getProviderOptionSelectionValue(selections, id);
|
|
63
|
-
return typeof value === "boolean" ? value : void 0;
|
|
64
|
-
}
|
|
65
|
-
function getModelSelectionStringOptionValue(modelSelection, id) {
|
|
66
|
-
return getProviderOptionStringSelectionValue(modelSelection?.options, id);
|
|
67
|
-
}
|
|
68
|
-
function getModelSelectionBooleanOptionValue(modelSelection, id) {
|
|
69
|
-
return getProviderOptionBooleanSelectionValue(modelSelection?.options, id);
|
|
70
|
-
}
|
|
71
|
-
function resolveDescriptorChoiceValue(descriptor, raw) {
|
|
72
|
-
const trimmed = trimOrNull(raw);
|
|
73
|
-
if (!trimmed) return descriptor.currentValue ?? descriptor.options.find((option) => option.isDefault)?.id;
|
|
74
|
-
if (descriptor.options.length === 0) return trimmed;
|
|
75
|
-
if (descriptor.promptInjectedValues?.includes(trimmed) && descriptor.options.some((option) => option.id === trimmed)) return descriptor.options.find((option) => option.isDefault)?.id;
|
|
76
|
-
if (descriptor.options.some((option) => option.id === trimmed)) return trimmed;
|
|
77
|
-
return descriptor.currentValue ?? descriptor.options.find((option) => option.isDefault)?.id;
|
|
78
|
-
}
|
|
79
|
-
function cloneDescriptor(descriptor) {
|
|
80
|
-
return descriptor.type === "select" ? {
|
|
81
|
-
...descriptor,
|
|
82
|
-
options: [...descriptor.options],
|
|
83
|
-
...descriptor.promptInjectedValues ? { promptInjectedValues: [...descriptor.promptInjectedValues] } : {}
|
|
84
|
-
} : { ...descriptor };
|
|
49
|
+
function is(value) {
|
|
50
|
+
if (value === null) return "null";
|
|
51
|
+
if (value === void 0) return "undefined";
|
|
52
|
+
if (value === true || value === false) return "boolean";
|
|
53
|
+
const typeOf = typeof value;
|
|
54
|
+
if (typeOf === "string" || typeOf === "number" || typeOf === "bigint" || typeOf === "symbol") return typeOf;
|
|
55
|
+
if (typeOf === "function") return "Function";
|
|
56
|
+
if (Array.isArray(value)) return "Array";
|
|
57
|
+
if (value instanceof Uint8Array) return "Uint8Array";
|
|
58
|
+
if (value.constructor === Object) return "Object";
|
|
59
|
+
const objectType = getObjectType(value);
|
|
60
|
+
if (objectType) return objectType;
|
|
61
|
+
return "Object";
|
|
85
62
|
}
|
|
86
|
-
|
|
87
|
-
|
|
63
|
+
/**
|
|
64
|
+
* @param {any} value
|
|
65
|
+
* @returns {string|undefined}
|
|
66
|
+
*/
|
|
67
|
+
function getObjectType(value) {
|
|
68
|
+
const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);
|
|
69
|
+
if (objectTypeNames.includes(objectTypeName)) return objectTypeName;
|
|
88
70
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/token.js
|
|
73
|
+
var Type = class {
|
|
74
|
+
/**
|
|
75
|
+
* @param {number} major
|
|
76
|
+
* @param {string} name
|
|
77
|
+
* @param {boolean} terminal
|
|
78
|
+
*/
|
|
79
|
+
constructor(major, name, terminal) {
|
|
80
|
+
this.major = major;
|
|
81
|
+
this.majorEncoded = major << 5;
|
|
82
|
+
this.name = name;
|
|
83
|
+
this.terminal = terminal;
|
|
96
84
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const { currentValue: _unusedCurrentValue, ...rest } = descriptor;
|
|
100
|
-
return rest;
|
|
85
|
+
toString() {
|
|
86
|
+
return `Type[${this.major}].${this.name}`;
|
|
101
87
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
88
|
+
/**
|
|
89
|
+
* @param {Type} typ
|
|
90
|
+
* @returns {number}
|
|
91
|
+
*/
|
|
92
|
+
compare(typ) {
|
|
93
|
+
return this.major < typ.major ? -1 : this.major > typ.major ? 1 : 0;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Check equality between two Type instances. Safe to use across different
|
|
97
|
+
* copies of the Type class (e.g., when bundlers duplicate the module).
|
|
98
|
+
* (major, name) uniquely identifies a Type; terminal is implied by these.
|
|
99
|
+
* @param {Type} a
|
|
100
|
+
* @param {Type} b
|
|
101
|
+
* @returns {boolean}
|
|
102
|
+
*/
|
|
103
|
+
static equals(a, b) {
|
|
104
|
+
return a === b || a.major === b.major && a.name === b.name;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
Type.uint = new Type(0, "uint", true);
|
|
108
|
+
Type.negint = new Type(1, "negint", true);
|
|
109
|
+
Type.bytes = new Type(2, "bytes", true);
|
|
110
|
+
Type.string = new Type(3, "string", true);
|
|
111
|
+
Type.array = new Type(4, "array", false);
|
|
112
|
+
Type.map = new Type(5, "map", false);
|
|
113
|
+
Type.tag = new Type(6, "tag", false);
|
|
114
|
+
Type.float = new Type(7, "float", true);
|
|
115
|
+
Type.false = new Type(7, "false", true);
|
|
116
|
+
Type.true = new Type(7, "true", true);
|
|
117
|
+
Type.null = new Type(7, "null", true);
|
|
118
|
+
Type.undefined = new Type(7, "undefined", true);
|
|
119
|
+
Type.break = new Type(7, "break", true);
|
|
120
|
+
var Token = class {
|
|
121
|
+
/**
|
|
122
|
+
* @param {Type} type
|
|
123
|
+
* @param {any} [value]
|
|
124
|
+
* @param {number} [encodedLength]
|
|
125
|
+
*/
|
|
126
|
+
constructor(type, value, encodedLength) {
|
|
127
|
+
this.type = type;
|
|
128
|
+
this.value = value;
|
|
129
|
+
this.encodedLength = encodedLength;
|
|
130
|
+
/** @type {Uint8Array|undefined} */
|
|
131
|
+
this.encodedBytes = void 0;
|
|
132
|
+
/** @type {Uint8Array|undefined} */
|
|
133
|
+
this.byteValue = void 0;
|
|
134
|
+
}
|
|
135
|
+
toString() {
|
|
136
|
+
return `Token[${this.type}].${this.value}`;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/byte-utils.js
|
|
141
|
+
const useBuffer = globalThis.process && !globalThis.process.browser && globalThis.Buffer && typeof globalThis.Buffer.isBuffer === "function";
|
|
142
|
+
const textEncoder$1 = new TextEncoder();
|
|
144
143
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
144
|
+
* @typedef {import('../interface.js').ByteView} ByteView
|
|
145
|
+
* @typedef {import('../interface.js').AllocatedByteView} AllocatedByteView
|
|
147
146
|
*/
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
/**
|
|
148
|
+
* @param {Uint8Array} buf
|
|
149
|
+
* @returns {boolean}
|
|
150
|
+
*/
|
|
151
|
+
function isBuffer(buf) {
|
|
152
|
+
return useBuffer && globalThis.Buffer.isBuffer(buf);
|
|
150
153
|
}
|
|
151
154
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* Unlike a single `find`, this checks every descriptor so that the
|
|
156
|
-
* correct descriptor's `promptInjectedValues` list is consulted even when
|
|
157
|
-
* multiple select descriptors exist.
|
|
155
|
+
* @param {ByteView|number[]} buf
|
|
156
|
+
* @returns {ByteView}
|
|
158
157
|
*/
|
|
159
|
-
function
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const descriptors = getProviderOptionDescriptors({ caps });
|
|
163
|
-
for (const descriptor of descriptors) if (descriptor.type === "select" && descriptor.promptInjectedValues?.includes(trimmed)) return trimmed;
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
166
|
-
function applyClaudePromptEffortPrefix(text, effort) {
|
|
167
|
-
const trimmed = text.trim();
|
|
168
|
-
if (!trimmed) return trimmed;
|
|
169
|
-
if (effort !== "ultrathink") return trimmed;
|
|
170
|
-
if (trimmed.startsWith("Ultrathink:")) return trimmed;
|
|
171
|
-
return `Ultrathink:\n${trimmed}`;
|
|
172
|
-
}
|
|
173
|
-
//#endregion
|
|
174
|
-
//#region ../../packages/shared/src/serverSettings.ts
|
|
175
|
-
const ServerSettingsJson$1 = fromLenientJson(ServerSettings);
|
|
176
|
-
function normalizePersistedServerSettingString(value) {
|
|
177
|
-
const trimmed = value?.trim();
|
|
178
|
-
return trimmed && trimmed.length > 0 ? trimmed : void 0;
|
|
179
|
-
}
|
|
180
|
-
function extractPersistedServerObservabilitySettings(input) {
|
|
181
|
-
return {
|
|
182
|
-
otlpTracesUrl: normalizePersistedServerSettingString(input.observability?.otlpTracesUrl),
|
|
183
|
-
otlpMetricsUrl: normalizePersistedServerSettingString(input.observability?.otlpMetricsUrl)
|
|
184
|
-
};
|
|
158
|
+
function asU8A(buf) {
|
|
159
|
+
if (!(buf instanceof Uint8Array)) return Uint8Array.from(buf);
|
|
160
|
+
return isBuffer(buf) ? new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength) : buf;
|
|
185
161
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
162
|
+
const FROM_STRING_THRESHOLD_BUFFER = 24;
|
|
163
|
+
const FROM_STRING_THRESHOLD_TEXTENCODER = 200;
|
|
164
|
+
const fromString = useBuffer ? (string) => {
|
|
165
|
+
return string.length >= FROM_STRING_THRESHOLD_BUFFER ? globalThis.Buffer.from(string) : utf8ToBytes(string);
|
|
166
|
+
} :
|
|
167
|
+
/**
|
|
168
|
+
* @param {string} string
|
|
169
|
+
*/
|
|
170
|
+
(string) => {
|
|
171
|
+
return string.length >= FROM_STRING_THRESHOLD_TEXTENCODER ? textEncoder$1.encode(string) : utf8ToBytes(string);
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Buffer variant not fast enough for what we need
|
|
175
|
+
* @param {number[]} arr
|
|
176
|
+
* @returns {AllocatedByteView}
|
|
177
|
+
*/
|
|
178
|
+
const fromArray = (arr) => {
|
|
179
|
+
return Uint8Array.from(arr);
|
|
180
|
+
};
|
|
181
|
+
const slice = useBuffer ? (bytes, start, end) => {
|
|
182
|
+
if (isBuffer(bytes)) return new Uint8Array(bytes.subarray(start, end));
|
|
183
|
+
return bytes.slice(start, end);
|
|
184
|
+
} :
|
|
185
|
+
/**
|
|
186
|
+
* @param {Uint8Array} bytes
|
|
187
|
+
* @param {number} start
|
|
188
|
+
* @param {number} end
|
|
189
|
+
*/
|
|
190
|
+
(bytes, start, end) => {
|
|
191
|
+
return bytes.slice(start, end);
|
|
192
|
+
};
|
|
193
|
+
const concat = useBuffer ? (chunks, length) => {
|
|
194
|
+
chunks = chunks.map((c) => c instanceof Uint8Array ? c : globalThis.Buffer.from(c));
|
|
195
|
+
return asU8A(globalThis.Buffer.concat(chunks, length));
|
|
196
|
+
} :
|
|
197
|
+
/**
|
|
198
|
+
* @param {ByteView[]} chunks
|
|
199
|
+
* @param {number} length
|
|
200
|
+
* @returns {AllocatedByteView}
|
|
201
|
+
*/
|
|
202
|
+
(chunks, length) => {
|
|
203
|
+
const out = new Uint8Array(length);
|
|
204
|
+
let off = 0;
|
|
205
|
+
for (let b of chunks) {
|
|
206
|
+
if (off + b.length > out.length) b = b.subarray(0, out.length - off);
|
|
207
|
+
out.set(b, off);
|
|
208
|
+
off += b.length;
|
|
194
209
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
210
|
+
return out;
|
|
211
|
+
};
|
|
212
|
+
const alloc = useBuffer ? (size) => {
|
|
213
|
+
return globalThis.Buffer.allocUnsafe(size);
|
|
214
|
+
} :
|
|
215
|
+
/**
|
|
216
|
+
* @param {number} size
|
|
217
|
+
* @returns {AllocatedByteView}
|
|
218
|
+
*/
|
|
219
|
+
(size) => {
|
|
220
|
+
return new Uint8Array(size);
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* @param {Uint8Array} b1
|
|
224
|
+
* @param {Uint8Array} b2
|
|
225
|
+
* @returns {number}
|
|
226
|
+
*/
|
|
227
|
+
function compare(b1, b2) {
|
|
228
|
+
if (isBuffer(b1) && isBuffer(b2)) return b1.compare(b2);
|
|
229
|
+
for (let i = 0; i < b1.length; i++) {
|
|
230
|
+
if (b1[i] === b2[i]) continue;
|
|
231
|
+
return b1[i] < b2[i] ? -1 : 1;
|
|
232
|
+
}
|
|
233
|
+
return 0;
|
|
208
234
|
}
|
|
209
235
|
/**
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* surviving a reset patch that intentionally omits options.
|
|
236
|
+
* @param {string} str
|
|
237
|
+
* @returns {number[]}
|
|
213
238
|
*/
|
|
214
|
-
function
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
for (
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
239
|
+
function utf8ToBytes(str) {
|
|
240
|
+
const out = [];
|
|
241
|
+
let p = 0;
|
|
242
|
+
for (let i = 0; i < str.length; i++) {
|
|
243
|
+
let c = str.charCodeAt(i);
|
|
244
|
+
if (c < 128) out[p++] = c;
|
|
245
|
+
else if (c < 2048) {
|
|
246
|
+
out[p++] = c >> 6 | 192;
|
|
247
|
+
out[p++] = c & 63 | 128;
|
|
248
|
+
} else if ((c & 64512) === 55296 && i + 1 < str.length && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
249
|
+
c = 65536 + ((c & 1023) << 10) + (str.charCodeAt(++i) & 1023);
|
|
250
|
+
out[p++] = c >> 18 | 240;
|
|
251
|
+
out[p++] = c >> 12 & 63 | 128;
|
|
252
|
+
out[p++] = c >> 6 & 63 | 128;
|
|
253
|
+
out[p++] = c & 63 | 128;
|
|
254
|
+
} else {
|
|
255
|
+
if (c >= 55296 && c <= 57343) c = 65533;
|
|
256
|
+
out[p++] = c >> 12 | 224;
|
|
257
|
+
out[p++] = c >> 6 & 63 | 128;
|
|
258
|
+
out[p++] = c & 63 | 128;
|
|
222
259
|
}
|
|
223
260
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
261
|
+
return out;
|
|
262
|
+
}
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/bl.js
|
|
265
|
+
/**
|
|
266
|
+
* Bl is a list of byte chunks, similar to https://github.com/rvagg/bl but for
|
|
267
|
+
* writing rather than reading.
|
|
268
|
+
* A Bl object accepts set() operations for individual bytes and copyTo() for
|
|
269
|
+
* inserting byte arrays. These write operations don't automatically increment
|
|
270
|
+
* the internal cursor so its "length" won't be changed. Instead, increment()
|
|
271
|
+
* must be called to extend its length to cover the inserted data.
|
|
272
|
+
* The toBytes() call will convert all internal memory to a single Uint8Array of
|
|
273
|
+
* the correct length, truncating any data that is stored but hasn't been
|
|
274
|
+
* included by an increment().
|
|
275
|
+
* get() can retrieve a single byte.
|
|
276
|
+
* All operations (except toBytes()) take an "offset" argument that will perform
|
|
277
|
+
* the write at the offset _from the current cursor_. For most operations this
|
|
278
|
+
* will be `0` to write at the current cursor position but it can be ahead of
|
|
279
|
+
* the current cursor. Negative offsets probably work but are untested.
|
|
280
|
+
*/
|
|
281
|
+
/**
|
|
282
|
+
* @typedef {import('../interface.js').ByteView} ByteView
|
|
283
|
+
* @typedef {import('../interface.js').AllocatedByteView} AllocatedByteView
|
|
284
|
+
*/
|
|
285
|
+
const defaultChunkSize = 256;
|
|
286
|
+
var Bl = class {
|
|
287
|
+
/**
|
|
288
|
+
* @param {number} [chunkSize]
|
|
289
|
+
*/
|
|
290
|
+
constructor(chunkSize = defaultChunkSize) {
|
|
291
|
+
this.chunkSize = chunkSize;
|
|
292
|
+
/** @type {number} */
|
|
293
|
+
this.cursor = 0;
|
|
294
|
+
/** @type {number} */
|
|
295
|
+
this.maxCursor = -1;
|
|
296
|
+
/** @type {(ByteView|number[])[]} */
|
|
297
|
+
this.chunks = [];
|
|
298
|
+
/** @type {ByteView|number[]|null} */
|
|
299
|
+
this._initReuseChunk = null;
|
|
300
|
+
}
|
|
301
|
+
reset() {
|
|
302
|
+
this.cursor = 0;
|
|
303
|
+
this.maxCursor = -1;
|
|
304
|
+
if (this.chunks.length) this.chunks = [];
|
|
305
|
+
if (this._initReuseChunk !== null) {
|
|
306
|
+
this.chunks.push(this._initReuseChunk);
|
|
307
|
+
this.maxCursor = this._initReuseChunk.length - 1;
|
|
242
308
|
}
|
|
243
|
-
next = {
|
|
244
|
-
...next,
|
|
245
|
-
projectPreferences: Object.fromEntries(projects)
|
|
246
|
-
};
|
|
247
309
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
310
|
+
/**
|
|
311
|
+
* @param {number} byte
|
|
312
|
+
*/
|
|
313
|
+
pushByte(byte) {
|
|
314
|
+
let topChunk = this.chunks[this.chunks.length - 1];
|
|
315
|
+
if (this.cursor > this.maxCursor) {
|
|
316
|
+
topChunk = alloc(this.chunkSize);
|
|
317
|
+
this.chunks.push(topChunk);
|
|
318
|
+
this.maxCursor += topChunk.length;
|
|
319
|
+
if (this._initReuseChunk === null) this._initReuseChunk = topChunk;
|
|
320
|
+
}
|
|
321
|
+
const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
|
|
322
|
+
topChunk[chunkPos] = byte;
|
|
323
|
+
this.cursor++;
|
|
256
324
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
325
|
+
/**
|
|
326
|
+
* @param {ByteView|number[]} bytes
|
|
327
|
+
*/
|
|
328
|
+
push(bytes) {
|
|
329
|
+
let topChunk = this.chunks[this.chunks.length - 1];
|
|
330
|
+
if (this.cursor + bytes.length <= this.maxCursor + 1) {
|
|
331
|
+
const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
|
|
332
|
+
topChunk.set(bytes, chunkPos);
|
|
333
|
+
} else {
|
|
334
|
+
if (topChunk) {
|
|
335
|
+
const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
|
|
336
|
+
if (chunkPos < topChunk.length) {
|
|
337
|
+
this.chunks[this.chunks.length - 1] = topChunk.subarray(0, chunkPos);
|
|
338
|
+
this.maxCursor = this.cursor - 1;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
if (bytes.length < 64 && bytes.length < this.chunkSize) {
|
|
342
|
+
topChunk = alloc(this.chunkSize);
|
|
343
|
+
this.chunks.push(topChunk);
|
|
344
|
+
this.maxCursor += topChunk.length;
|
|
345
|
+
if (this._initReuseChunk === null) this._initReuseChunk = topChunk;
|
|
346
|
+
topChunk.set(bytes, 0);
|
|
347
|
+
} else {
|
|
348
|
+
this.chunks.push(bytes);
|
|
349
|
+
this.maxCursor += bytes.length;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
this.cursor += bytes.length;
|
|
265
353
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
354
|
+
/**
|
|
355
|
+
* @param {boolean} [reset]
|
|
356
|
+
* @returns {AllocatedByteView}
|
|
357
|
+
*/
|
|
358
|
+
toBytes(reset = false) {
|
|
359
|
+
let byts;
|
|
360
|
+
if (this.chunks.length === 1) {
|
|
361
|
+
const chunk = this.chunks[0];
|
|
362
|
+
if (reset && this.cursor > chunk.length / 2) {
|
|
363
|
+
byts = this.cursor === chunk.length ? chunk : chunk.subarray(0, this.cursor);
|
|
364
|
+
this._initReuseChunk = null;
|
|
365
|
+
this.chunks = [];
|
|
366
|
+
} else byts = slice(chunk, 0, this.cursor);
|
|
367
|
+
} else byts = concat(this.chunks, this.cursor);
|
|
368
|
+
if (reset) this.reset();
|
|
369
|
+
return byts;
|
|
274
370
|
}
|
|
275
|
-
|
|
276
|
-
...next,
|
|
277
|
-
providerInstances: patch.providerInstances
|
|
278
|
-
} : next;
|
|
279
|
-
if (!selectionPatch) return nextWithReplacements;
|
|
280
|
-
const instanceId = selectionPatch.instanceId ?? current.textGenerationModelSelection.instanceId;
|
|
281
|
-
const model = selectionPatch.model ?? current.textGenerationModelSelection.model;
|
|
282
|
-
const options = shouldReplaceTextGenerationModelSelection(selectionPatch) ? selectionPatch.options : mergeModelSelectionOptionsById({
|
|
283
|
-
current: current.textGenerationModelSelection.options,
|
|
284
|
-
patch: selectionPatch.options
|
|
285
|
-
});
|
|
286
|
-
return {
|
|
287
|
-
...nextWithReplacements,
|
|
288
|
-
textGenerationModelSelection: createModelSelection(instanceId, model, options)
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
//#endregion
|
|
292
|
-
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/is.js
|
|
293
|
-
const objectTypeNames = [
|
|
294
|
-
"Object",
|
|
295
|
-
"RegExp",
|
|
296
|
-
"Date",
|
|
297
|
-
"Error",
|
|
298
|
-
"Map",
|
|
299
|
-
"Set",
|
|
300
|
-
"WeakMap",
|
|
301
|
-
"WeakSet",
|
|
302
|
-
"ArrayBuffer",
|
|
303
|
-
"SharedArrayBuffer",
|
|
304
|
-
"DataView",
|
|
305
|
-
"Promise",
|
|
306
|
-
"URL",
|
|
307
|
-
"HTMLElement",
|
|
308
|
-
"Int8Array",
|
|
309
|
-
"Uint8ClampedArray",
|
|
310
|
-
"Int16Array",
|
|
311
|
-
"Uint16Array",
|
|
312
|
-
"Int32Array",
|
|
313
|
-
"Uint32Array",
|
|
314
|
-
"Float32Array",
|
|
315
|
-
"Float64Array",
|
|
316
|
-
"BigInt64Array",
|
|
317
|
-
"BigUint64Array",
|
|
318
|
-
"Tagged"
|
|
319
|
-
];
|
|
320
|
-
/**
|
|
321
|
-
* @param {any} value
|
|
322
|
-
* @returns {string}
|
|
323
|
-
*/
|
|
324
|
-
function is(value) {
|
|
325
|
-
if (value === null) return "null";
|
|
326
|
-
if (value === void 0) return "undefined";
|
|
327
|
-
if (value === true || value === false) return "boolean";
|
|
328
|
-
const typeOf = typeof value;
|
|
329
|
-
if (typeOf === "string" || typeOf === "number" || typeOf === "bigint" || typeOf === "symbol") return typeOf;
|
|
330
|
-
if (typeOf === "function") return "Function";
|
|
331
|
-
if (Array.isArray(value)) return "Array";
|
|
332
|
-
if (value instanceof Uint8Array) return "Uint8Array";
|
|
333
|
-
if (value.constructor === Object) return "Object";
|
|
334
|
-
const objectType = getObjectType(value);
|
|
335
|
-
if (objectType) return objectType;
|
|
336
|
-
return "Object";
|
|
337
|
-
}
|
|
371
|
+
};
|
|
338
372
|
/**
|
|
339
|
-
*
|
|
340
|
-
*
|
|
373
|
+
* U8Bl is a buffer list that writes directly to a user-provided Uint8Array.
|
|
374
|
+
* It provides the same interface as Bl but writes to a fixed destination.
|
|
375
|
+
* @template {ArrayBufferLike} T
|
|
341
376
|
*/
|
|
342
|
-
|
|
343
|
-
const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);
|
|
344
|
-
if (objectTypeNames.includes(objectTypeName)) return objectTypeName;
|
|
345
|
-
}
|
|
346
|
-
//#endregion
|
|
347
|
-
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/token.js
|
|
348
|
-
var Type = class {
|
|
377
|
+
var U8Bl = class {
|
|
349
378
|
/**
|
|
350
|
-
* @param {
|
|
351
|
-
* @param {string} name
|
|
352
|
-
* @param {boolean} terminal
|
|
379
|
+
* @param {Uint8Array<T>} dest
|
|
353
380
|
*/
|
|
354
|
-
constructor(
|
|
355
|
-
this.
|
|
356
|
-
|
|
357
|
-
this.
|
|
358
|
-
|
|
381
|
+
constructor(dest) {
|
|
382
|
+
this.dest = dest;
|
|
383
|
+
/** @type {number} */
|
|
384
|
+
this.cursor = 0;
|
|
385
|
+
/** @type {Array<Uint8Array<T>>} */
|
|
386
|
+
this.chunks = [dest];
|
|
359
387
|
}
|
|
360
|
-
|
|
361
|
-
|
|
388
|
+
reset() {
|
|
389
|
+
this.cursor = 0;
|
|
362
390
|
}
|
|
363
391
|
/**
|
|
364
|
-
* @param {
|
|
365
|
-
* @returns {number}
|
|
392
|
+
* @param {number} byte
|
|
366
393
|
*/
|
|
367
|
-
|
|
368
|
-
|
|
394
|
+
pushByte(byte) {
|
|
395
|
+
if (this.cursor >= this.dest.length) throw new Error("write out of bounds, destination buffer is too small");
|
|
396
|
+
this.dest[this.cursor++] = byte;
|
|
369
397
|
}
|
|
370
398
|
/**
|
|
371
|
-
*
|
|
372
|
-
* copies of the Type class (e.g., when bundlers duplicate the module).
|
|
373
|
-
* (major, name) uniquely identifies a Type; terminal is implied by these.
|
|
374
|
-
* @param {Type} a
|
|
375
|
-
* @param {Type} b
|
|
376
|
-
* @returns {boolean}
|
|
399
|
+
* @param {ByteView|number[]} bytes
|
|
377
400
|
*/
|
|
378
|
-
|
|
379
|
-
|
|
401
|
+
push(bytes) {
|
|
402
|
+
if (this.cursor + bytes.length > this.dest.length) throw new Error("write out of bounds, destination buffer is too small");
|
|
403
|
+
this.dest.set(bytes, this.cursor);
|
|
404
|
+
this.cursor += bytes.length;
|
|
380
405
|
}
|
|
381
|
-
};
|
|
382
|
-
Type.uint = new Type(0, "uint", true);
|
|
383
|
-
Type.negint = new Type(1, "negint", true);
|
|
384
|
-
Type.bytes = new Type(2, "bytes", true);
|
|
385
|
-
Type.string = new Type(3, "string", true);
|
|
386
|
-
Type.array = new Type(4, "array", false);
|
|
387
|
-
Type.map = new Type(5, "map", false);
|
|
388
|
-
Type.tag = new Type(6, "tag", false);
|
|
389
|
-
Type.float = new Type(7, "float", true);
|
|
390
|
-
Type.false = new Type(7, "false", true);
|
|
391
|
-
Type.true = new Type(7, "true", true);
|
|
392
|
-
Type.null = new Type(7, "null", true);
|
|
393
|
-
Type.undefined = new Type(7, "undefined", true);
|
|
394
|
-
Type.break = new Type(7, "break", true);
|
|
395
|
-
var Token = class {
|
|
396
406
|
/**
|
|
397
|
-
* @param {
|
|
398
|
-
* @
|
|
399
|
-
* @param {number} [encodedLength]
|
|
407
|
+
* @param {boolean} [reset]
|
|
408
|
+
* @returns {Uint8Array<T>}
|
|
400
409
|
*/
|
|
401
|
-
|
|
402
|
-
this.
|
|
403
|
-
this.
|
|
404
|
-
|
|
405
|
-
/** @type {Uint8Array|undefined} */
|
|
406
|
-
this.encodedBytes = void 0;
|
|
407
|
-
/** @type {Uint8Array|undefined} */
|
|
408
|
-
this.byteValue = void 0;
|
|
409
|
-
}
|
|
410
|
-
toString() {
|
|
411
|
-
return `Token[${this.type}].${this.value}`;
|
|
410
|
+
toBytes(reset = false) {
|
|
411
|
+
const byts = this.dest.subarray(0, this.cursor);
|
|
412
|
+
if (reset) this.reset();
|
|
413
|
+
return byts;
|
|
412
414
|
}
|
|
413
415
|
};
|
|
414
416
|
//#endregion
|
|
415
|
-
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/
|
|
416
|
-
const
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
417
|
+
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/common.js
|
|
418
|
+
const decodeErrPrefix = "CBOR decode error:";
|
|
419
|
+
const encodeErrPrefix = "CBOR encode error:";
|
|
420
|
+
const uintMinorPrefixBytes = [];
|
|
421
|
+
uintMinorPrefixBytes[23] = 1;
|
|
422
|
+
uintMinorPrefixBytes[24] = 2;
|
|
423
|
+
uintMinorPrefixBytes[25] = 3;
|
|
424
|
+
uintMinorPrefixBytes[26] = 5;
|
|
425
|
+
uintMinorPrefixBytes[27] = 9;
|
|
422
426
|
/**
|
|
423
|
-
* @param {Uint8Array}
|
|
424
|
-
* @
|
|
427
|
+
* @param {Uint8Array} data
|
|
428
|
+
* @param {number} pos
|
|
429
|
+
* @param {number} need
|
|
425
430
|
*/
|
|
426
|
-
function
|
|
427
|
-
|
|
431
|
+
function assertEnoughData(data, pos, need) {
|
|
432
|
+
if (data.length - pos < need) throw new Error(`${decodeErrPrefix} not enough data for type`);
|
|
428
433
|
}
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/0uint.js
|
|
436
|
+
const uintBoundaries = [
|
|
437
|
+
24,
|
|
438
|
+
256,
|
|
439
|
+
65536,
|
|
440
|
+
4294967296,
|
|
441
|
+
BigInt("18446744073709551616")
|
|
442
|
+
];
|
|
429
443
|
/**
|
|
430
|
-
* @
|
|
431
|
-
* @
|
|
444
|
+
* @typedef {import('../interface.js').ByteWriter} ByteWriter
|
|
445
|
+
* @typedef {import('../interface.js').DecodeOptions} DecodeOptions
|
|
432
446
|
*/
|
|
433
|
-
function asU8A(buf) {
|
|
434
|
-
if (!(buf instanceof Uint8Array)) return Uint8Array.from(buf);
|
|
435
|
-
return isBuffer(buf) ? new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength) : buf;
|
|
436
|
-
}
|
|
437
|
-
const FROM_STRING_THRESHOLD_BUFFER = 24;
|
|
438
|
-
const FROM_STRING_THRESHOLD_TEXTENCODER = 200;
|
|
439
|
-
const fromString = useBuffer ? (string) => {
|
|
440
|
-
return string.length >= FROM_STRING_THRESHOLD_BUFFER ? globalThis.Buffer.from(string) : utf8ToBytes(string);
|
|
441
|
-
} :
|
|
442
447
|
/**
|
|
443
|
-
* @param {
|
|
448
|
+
* @param {Uint8Array} data
|
|
449
|
+
* @param {number} offset
|
|
450
|
+
* @param {DecodeOptions} options
|
|
451
|
+
* @returns {number}
|
|
444
452
|
*/
|
|
445
|
-
(
|
|
446
|
-
|
|
447
|
-
|
|
453
|
+
function readUint8(data, offset, options) {
|
|
454
|
+
assertEnoughData(data, offset, 1);
|
|
455
|
+
const value = data[offset];
|
|
456
|
+
if (options.strict === true && value < uintBoundaries[0]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
|
|
457
|
+
return value;
|
|
458
|
+
}
|
|
448
459
|
/**
|
|
449
|
-
*
|
|
450
|
-
* @param {number
|
|
451
|
-
* @
|
|
460
|
+
* @param {Uint8Array} data
|
|
461
|
+
* @param {number} offset
|
|
462
|
+
* @param {DecodeOptions} options
|
|
463
|
+
* @returns {number}
|
|
452
464
|
*/
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
} :
|
|
465
|
+
function readUint16(data, offset, options) {
|
|
466
|
+
assertEnoughData(data, offset, 2);
|
|
467
|
+
const value = data[offset] << 8 | data[offset + 1];
|
|
468
|
+
if (options.strict === true && value < uintBoundaries[1]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
|
|
469
|
+
return value;
|
|
470
|
+
}
|
|
460
471
|
/**
|
|
461
|
-
* @param {Uint8Array}
|
|
462
|
-
* @param {number}
|
|
463
|
-
* @param {
|
|
472
|
+
* @param {Uint8Array} data
|
|
473
|
+
* @param {number} offset
|
|
474
|
+
* @param {DecodeOptions} options
|
|
475
|
+
* @returns {number}
|
|
464
476
|
*/
|
|
465
|
-
(
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
} :
|
|
477
|
+
function readUint32(data, offset, options) {
|
|
478
|
+
assertEnoughData(data, offset, 4);
|
|
479
|
+
const value = data[offset] * 16777216 + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
|
|
480
|
+
if (options.strict === true && value < uintBoundaries[2]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
|
|
481
|
+
return value;
|
|
482
|
+
}
|
|
472
483
|
/**
|
|
473
|
-
* @param {
|
|
474
|
-
* @param {number}
|
|
475
|
-
* @
|
|
484
|
+
* @param {Uint8Array} data
|
|
485
|
+
* @param {number} offset
|
|
486
|
+
* @param {DecodeOptions} options
|
|
487
|
+
* @returns {number|bigint}
|
|
476
488
|
*/
|
|
477
|
-
(
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
}
|
|
487
|
-
const alloc = useBuffer ? (size) => {
|
|
488
|
-
return globalThis.Buffer.allocUnsafe(size);
|
|
489
|
-
} :
|
|
489
|
+
function readUint64(data, offset, options) {
|
|
490
|
+
assertEnoughData(data, offset, 8);
|
|
491
|
+
const hi = data[offset] * 16777216 + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
|
|
492
|
+
const lo = data[offset + 4] * 16777216 + (data[offset + 5] << 16) + (data[offset + 6] << 8) + data[offset + 7];
|
|
493
|
+
const value = (BigInt(hi) << BigInt(32)) + BigInt(lo);
|
|
494
|
+
if (options.strict === true && value < uintBoundaries[3]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
|
|
495
|
+
if (value <= Number.MAX_SAFE_INTEGER) return Number(value);
|
|
496
|
+
if (options.allowBigInt === true) return value;
|
|
497
|
+
throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);
|
|
498
|
+
}
|
|
490
499
|
/**
|
|
491
|
-
* @param {
|
|
492
|
-
* @
|
|
500
|
+
* @param {Uint8Array} data
|
|
501
|
+
* @param {number} pos
|
|
502
|
+
* @param {number} _minor
|
|
503
|
+
* @param {DecodeOptions} options
|
|
504
|
+
* @returns {Token}
|
|
493
505
|
*/
|
|
494
|
-
(
|
|
495
|
-
return new
|
|
496
|
-
}
|
|
506
|
+
function decodeUint8(data, pos, _minor, options) {
|
|
507
|
+
return new Token(Type.uint, readUint8(data, pos + 1, options), 2);
|
|
508
|
+
}
|
|
497
509
|
/**
|
|
498
|
-
* @param {Uint8Array}
|
|
499
|
-
* @param {
|
|
500
|
-
* @
|
|
510
|
+
* @param {Uint8Array} data
|
|
511
|
+
* @param {number} pos
|
|
512
|
+
* @param {number} _minor
|
|
513
|
+
* @param {DecodeOptions} options
|
|
514
|
+
* @returns {Token}
|
|
501
515
|
*/
|
|
502
|
-
function
|
|
503
|
-
|
|
504
|
-
for (let i = 0; i < b1.length; i++) {
|
|
505
|
-
if (b1[i] === b2[i]) continue;
|
|
506
|
-
return b1[i] < b2[i] ? -1 : 1;
|
|
507
|
-
}
|
|
508
|
-
return 0;
|
|
516
|
+
function decodeUint16(data, pos, _minor, options) {
|
|
517
|
+
return new Token(Type.uint, readUint16(data, pos + 1, options), 3);
|
|
509
518
|
}
|
|
510
519
|
/**
|
|
511
|
-
* @param {
|
|
512
|
-
* @
|
|
520
|
+
* @param {Uint8Array} data
|
|
521
|
+
* @param {number} pos
|
|
522
|
+
* @param {number} _minor
|
|
523
|
+
* @param {DecodeOptions} options
|
|
524
|
+
* @returns {Token}
|
|
513
525
|
*/
|
|
514
|
-
function
|
|
515
|
-
|
|
516
|
-
let p = 0;
|
|
517
|
-
for (let i = 0; i < str.length; i++) {
|
|
518
|
-
let c = str.charCodeAt(i);
|
|
519
|
-
if (c < 128) out[p++] = c;
|
|
520
|
-
else if (c < 2048) {
|
|
521
|
-
out[p++] = c >> 6 | 192;
|
|
522
|
-
out[p++] = c & 63 | 128;
|
|
523
|
-
} else if ((c & 64512) === 55296 && i + 1 < str.length && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
524
|
-
c = 65536 + ((c & 1023) << 10) + (str.charCodeAt(++i) & 1023);
|
|
525
|
-
out[p++] = c >> 18 | 240;
|
|
526
|
-
out[p++] = c >> 12 & 63 | 128;
|
|
527
|
-
out[p++] = c >> 6 & 63 | 128;
|
|
528
|
-
out[p++] = c & 63 | 128;
|
|
529
|
-
} else {
|
|
530
|
-
if (c >= 55296 && c <= 57343) c = 65533;
|
|
531
|
-
out[p++] = c >> 12 | 224;
|
|
532
|
-
out[p++] = c >> 6 & 63 | 128;
|
|
533
|
-
out[p++] = c & 63 | 128;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
return out;
|
|
526
|
+
function decodeUint32(data, pos, _minor, options) {
|
|
527
|
+
return new Token(Type.uint, readUint32(data, pos + 1, options), 5);
|
|
537
528
|
}
|
|
538
|
-
//#endregion
|
|
539
|
-
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/bl.js
|
|
540
529
|
/**
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
* must be called to extend its length to cover the inserted data.
|
|
547
|
-
* The toBytes() call will convert all internal memory to a single Uint8Array of
|
|
548
|
-
* the correct length, truncating any data that is stored but hasn't been
|
|
549
|
-
* included by an increment().
|
|
550
|
-
* get() can retrieve a single byte.
|
|
551
|
-
* All operations (except toBytes()) take an "offset" argument that will perform
|
|
552
|
-
* the write at the offset _from the current cursor_. For most operations this
|
|
553
|
-
* will be `0` to write at the current cursor position but it can be ahead of
|
|
554
|
-
* the current cursor. Negative offsets probably work but are untested.
|
|
530
|
+
* @param {Uint8Array} data
|
|
531
|
+
* @param {number} pos
|
|
532
|
+
* @param {number} _minor
|
|
533
|
+
* @param {DecodeOptions} options
|
|
534
|
+
* @returns {Token}
|
|
555
535
|
*/
|
|
536
|
+
function decodeUint64(data, pos, _minor, options) {
|
|
537
|
+
return new Token(Type.uint, readUint64(data, pos + 1, options), 9);
|
|
538
|
+
}
|
|
556
539
|
/**
|
|
557
|
-
* @
|
|
558
|
-
* @
|
|
540
|
+
* @param {ByteWriter} writer
|
|
541
|
+
* @param {Token} token
|
|
559
542
|
*/
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
543
|
+
function encodeUint(writer, token) {
|
|
544
|
+
return encodeUintValue(writer, 0, token.value);
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* @param {ByteWriter} writer
|
|
548
|
+
* @param {number} major
|
|
549
|
+
* @param {number|bigint} uint
|
|
550
|
+
*/
|
|
551
|
+
function encodeUintValue(writer, major, uint) {
|
|
552
|
+
if (uint < uintBoundaries[0]) {
|
|
553
|
+
const nuint = Number(uint);
|
|
554
|
+
writer.pushByte(major | nuint);
|
|
555
|
+
} else if (uint < uintBoundaries[1]) {
|
|
556
|
+
const nuint = Number(uint);
|
|
557
|
+
writer.push([major | 24, nuint]);
|
|
558
|
+
} else if (uint < uintBoundaries[2]) {
|
|
559
|
+
const nuint = Number(uint);
|
|
560
|
+
writer.push([
|
|
561
|
+
major | 25,
|
|
562
|
+
nuint >>> 8,
|
|
563
|
+
nuint & 255
|
|
564
|
+
]);
|
|
565
|
+
} else if (uint < uintBoundaries[3]) {
|
|
566
|
+
const nuint = Number(uint);
|
|
567
|
+
writer.push([
|
|
568
|
+
major | 26,
|
|
569
|
+
nuint >>> 24 & 255,
|
|
570
|
+
nuint >>> 16 & 255,
|
|
571
|
+
nuint >>> 8 & 255,
|
|
572
|
+
nuint & 255
|
|
573
|
+
]);
|
|
574
|
+
} else {
|
|
575
|
+
const buint = BigInt(uint);
|
|
576
|
+
if (buint < uintBoundaries[4]) {
|
|
577
|
+
const set = [
|
|
578
|
+
major | 27,
|
|
579
|
+
0,
|
|
580
|
+
0,
|
|
581
|
+
0,
|
|
582
|
+
0,
|
|
583
|
+
0,
|
|
584
|
+
0,
|
|
585
|
+
0
|
|
586
|
+
];
|
|
587
|
+
let lo = Number(buint & BigInt(4294967295));
|
|
588
|
+
let hi = Number(buint >> BigInt(32) & BigInt(4294967295));
|
|
589
|
+
set[8] = lo & 255;
|
|
590
|
+
lo = lo >> 8;
|
|
591
|
+
set[7] = lo & 255;
|
|
592
|
+
lo = lo >> 8;
|
|
593
|
+
set[6] = lo & 255;
|
|
594
|
+
lo = lo >> 8;
|
|
595
|
+
set[5] = lo & 255;
|
|
596
|
+
set[4] = hi & 255;
|
|
597
|
+
hi = hi >> 8;
|
|
598
|
+
set[3] = hi & 255;
|
|
599
|
+
hi = hi >> 8;
|
|
600
|
+
set[2] = hi & 255;
|
|
601
|
+
hi = hi >> 8;
|
|
602
|
+
set[1] = hi & 255;
|
|
603
|
+
writer.push(set);
|
|
604
|
+
} else throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`);
|
|
575
605
|
}
|
|
576
|
-
reset() {
|
|
577
|
-
this.cursor = 0;
|
|
578
|
-
this.maxCursor = -1;
|
|
579
|
-
if (this.chunks.length) this.chunks = [];
|
|
580
|
-
if (this._initReuseChunk !== null) {
|
|
581
|
-
this.chunks.push(this._initReuseChunk);
|
|
582
|
-
this.maxCursor = this._initReuseChunk.length - 1;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* @param {number} byte
|
|
587
|
-
*/
|
|
588
|
-
pushByte(byte) {
|
|
589
|
-
let topChunk = this.chunks[this.chunks.length - 1];
|
|
590
|
-
if (this.cursor > this.maxCursor) {
|
|
591
|
-
topChunk = alloc(this.chunkSize);
|
|
592
|
-
this.chunks.push(topChunk);
|
|
593
|
-
this.maxCursor += topChunk.length;
|
|
594
|
-
if (this._initReuseChunk === null) this._initReuseChunk = topChunk;
|
|
595
|
-
}
|
|
596
|
-
const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
|
|
597
|
-
topChunk[chunkPos] = byte;
|
|
598
|
-
this.cursor++;
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* @param {ByteView|number[]} bytes
|
|
602
|
-
*/
|
|
603
|
-
push(bytes) {
|
|
604
|
-
let topChunk = this.chunks[this.chunks.length - 1];
|
|
605
|
-
if (this.cursor + bytes.length <= this.maxCursor + 1) {
|
|
606
|
-
const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
|
|
607
|
-
topChunk.set(bytes, chunkPos);
|
|
608
|
-
} else {
|
|
609
|
-
if (topChunk) {
|
|
610
|
-
const chunkPos = topChunk.length - (this.maxCursor - this.cursor) - 1;
|
|
611
|
-
if (chunkPos < topChunk.length) {
|
|
612
|
-
this.chunks[this.chunks.length - 1] = topChunk.subarray(0, chunkPos);
|
|
613
|
-
this.maxCursor = this.cursor - 1;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
if (bytes.length < 64 && bytes.length < this.chunkSize) {
|
|
617
|
-
topChunk = alloc(this.chunkSize);
|
|
618
|
-
this.chunks.push(topChunk);
|
|
619
|
-
this.maxCursor += topChunk.length;
|
|
620
|
-
if (this._initReuseChunk === null) this._initReuseChunk = topChunk;
|
|
621
|
-
topChunk.set(bytes, 0);
|
|
622
|
-
} else {
|
|
623
|
-
this.chunks.push(bytes);
|
|
624
|
-
this.maxCursor += bytes.length;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
this.cursor += bytes.length;
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* @param {boolean} [reset]
|
|
631
|
-
* @returns {AllocatedByteView}
|
|
632
|
-
*/
|
|
633
|
-
toBytes(reset = false) {
|
|
634
|
-
let byts;
|
|
635
|
-
if (this.chunks.length === 1) {
|
|
636
|
-
const chunk = this.chunks[0];
|
|
637
|
-
if (reset && this.cursor > chunk.length / 2) {
|
|
638
|
-
byts = this.cursor === chunk.length ? chunk : chunk.subarray(0, this.cursor);
|
|
639
|
-
this._initReuseChunk = null;
|
|
640
|
-
this.chunks = [];
|
|
641
|
-
} else byts = slice(chunk, 0, this.cursor);
|
|
642
|
-
} else byts = concat(this.chunks, this.cursor);
|
|
643
|
-
if (reset) this.reset();
|
|
644
|
-
return byts;
|
|
645
|
-
}
|
|
646
|
-
};
|
|
647
|
-
/**
|
|
648
|
-
* U8Bl is a buffer list that writes directly to a user-provided Uint8Array.
|
|
649
|
-
* It provides the same interface as Bl but writes to a fixed destination.
|
|
650
|
-
* @template {ArrayBufferLike} T
|
|
651
|
-
*/
|
|
652
|
-
var U8Bl = class {
|
|
653
|
-
/**
|
|
654
|
-
* @param {Uint8Array<T>} dest
|
|
655
|
-
*/
|
|
656
|
-
constructor(dest) {
|
|
657
|
-
this.dest = dest;
|
|
658
|
-
/** @type {number} */
|
|
659
|
-
this.cursor = 0;
|
|
660
|
-
/** @type {Array<Uint8Array<T>>} */
|
|
661
|
-
this.chunks = [dest];
|
|
662
|
-
}
|
|
663
|
-
reset() {
|
|
664
|
-
this.cursor = 0;
|
|
665
|
-
}
|
|
666
|
-
/**
|
|
667
|
-
* @param {number} byte
|
|
668
|
-
*/
|
|
669
|
-
pushByte(byte) {
|
|
670
|
-
if (this.cursor >= this.dest.length) throw new Error("write out of bounds, destination buffer is too small");
|
|
671
|
-
this.dest[this.cursor++] = byte;
|
|
672
|
-
}
|
|
673
|
-
/**
|
|
674
|
-
* @param {ByteView|number[]} bytes
|
|
675
|
-
*/
|
|
676
|
-
push(bytes) {
|
|
677
|
-
if (this.cursor + bytes.length > this.dest.length) throw new Error("write out of bounds, destination buffer is too small");
|
|
678
|
-
this.dest.set(bytes, this.cursor);
|
|
679
|
-
this.cursor += bytes.length;
|
|
680
|
-
}
|
|
681
|
-
/**
|
|
682
|
-
* @param {boolean} [reset]
|
|
683
|
-
* @returns {Uint8Array<T>}
|
|
684
|
-
*/
|
|
685
|
-
toBytes(reset = false) {
|
|
686
|
-
const byts = this.dest.subarray(0, this.cursor);
|
|
687
|
-
if (reset) this.reset();
|
|
688
|
-
return byts;
|
|
689
|
-
}
|
|
690
|
-
};
|
|
691
|
-
//#endregion
|
|
692
|
-
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/common.js
|
|
693
|
-
const decodeErrPrefix = "CBOR decode error:";
|
|
694
|
-
const encodeErrPrefix = "CBOR encode error:";
|
|
695
|
-
const uintMinorPrefixBytes = [];
|
|
696
|
-
uintMinorPrefixBytes[23] = 1;
|
|
697
|
-
uintMinorPrefixBytes[24] = 2;
|
|
698
|
-
uintMinorPrefixBytes[25] = 3;
|
|
699
|
-
uintMinorPrefixBytes[26] = 5;
|
|
700
|
-
uintMinorPrefixBytes[27] = 9;
|
|
701
|
-
/**
|
|
702
|
-
* @param {Uint8Array} data
|
|
703
|
-
* @param {number} pos
|
|
704
|
-
* @param {number} need
|
|
705
|
-
*/
|
|
706
|
-
function assertEnoughData(data, pos, need) {
|
|
707
|
-
if (data.length - pos < need) throw new Error(`${decodeErrPrefix} not enough data for type`);
|
|
708
606
|
}
|
|
709
|
-
//#endregion
|
|
710
|
-
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/0uint.js
|
|
711
|
-
const uintBoundaries = [
|
|
712
|
-
24,
|
|
713
|
-
256,
|
|
714
|
-
65536,
|
|
715
|
-
4294967296,
|
|
716
|
-
BigInt("18446744073709551616")
|
|
717
|
-
];
|
|
718
|
-
/**
|
|
719
|
-
* @typedef {import('../interface.js').ByteWriter} ByteWriter
|
|
720
|
-
* @typedef {import('../interface.js').DecodeOptions} DecodeOptions
|
|
721
|
-
*/
|
|
722
607
|
/**
|
|
723
|
-
* @param {
|
|
724
|
-
* @param {number} offset
|
|
725
|
-
* @param {DecodeOptions} options
|
|
608
|
+
* @param {Token} token
|
|
726
609
|
* @returns {number}
|
|
727
610
|
*/
|
|
728
|
-
function
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
if (options.strict === true && value < uintBoundaries[0]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
|
|
732
|
-
return value;
|
|
733
|
-
}
|
|
611
|
+
encodeUint.encodedSize = function encodedSize(token) {
|
|
612
|
+
return encodeUintValue.encodedSize(token.value);
|
|
613
|
+
};
|
|
734
614
|
/**
|
|
735
|
-
* @param {
|
|
736
|
-
* @param {number} offset
|
|
737
|
-
* @param {DecodeOptions} options
|
|
615
|
+
* @param {number} uint
|
|
738
616
|
* @returns {number}
|
|
739
617
|
*/
|
|
740
|
-
function
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
if (
|
|
744
|
-
return
|
|
745
|
-
|
|
618
|
+
encodeUintValue.encodedSize = function encodedSize(uint) {
|
|
619
|
+
if (uint < uintBoundaries[0]) return 1;
|
|
620
|
+
if (uint < uintBoundaries[1]) return 2;
|
|
621
|
+
if (uint < uintBoundaries[2]) return 3;
|
|
622
|
+
if (uint < uintBoundaries[3]) return 5;
|
|
623
|
+
return 9;
|
|
624
|
+
};
|
|
746
625
|
/**
|
|
747
|
-
* @param {
|
|
748
|
-
* @param {
|
|
749
|
-
* @param {DecodeOptions} options
|
|
626
|
+
* @param {Token} tok1
|
|
627
|
+
* @param {Token} tok2
|
|
750
628
|
* @returns {number}
|
|
751
629
|
*/
|
|
752
|
-
function
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}
|
|
630
|
+
encodeUint.compareTokens = function compareTokens(tok1, tok2) {
|
|
631
|
+
return tok1.value < tok2.value ? -1 : tok1.value > tok2.value ? 1 : 0;
|
|
632
|
+
};
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/1negint.js
|
|
758
635
|
/**
|
|
759
|
-
* @
|
|
760
|
-
* @
|
|
761
|
-
* @param {DecodeOptions} options
|
|
762
|
-
* @returns {number|bigint}
|
|
636
|
+
* @typedef {import('../interface.js').ByteWriter} ByteWriter
|
|
637
|
+
* @typedef {import('../interface.js').DecodeOptions} DecodeOptions
|
|
763
638
|
*/
|
|
764
|
-
function readUint64(data, offset, options) {
|
|
765
|
-
assertEnoughData(data, offset, 8);
|
|
766
|
-
const hi = data[offset] * 16777216 + (data[offset + 1] << 16) + (data[offset + 2] << 8) + data[offset + 3];
|
|
767
|
-
const lo = data[offset + 4] * 16777216 + (data[offset + 5] << 16) + (data[offset + 6] << 8) + data[offset + 7];
|
|
768
|
-
const value = (BigInt(hi) << BigInt(32)) + BigInt(lo);
|
|
769
|
-
if (options.strict === true && value < uintBoundaries[3]) throw new Error(`${decodeErrPrefix} integer encoded in more bytes than necessary (strict decode)`);
|
|
770
|
-
if (value <= Number.MAX_SAFE_INTEGER) return Number(value);
|
|
771
|
-
if (options.allowBigInt === true) return value;
|
|
772
|
-
throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);
|
|
773
|
-
}
|
|
774
639
|
/**
|
|
775
640
|
* @param {Uint8Array} data
|
|
776
641
|
* @param {number} pos
|
|
@@ -778,8 +643,8 @@ function readUint64(data, offset, options) {
|
|
|
778
643
|
* @param {DecodeOptions} options
|
|
779
644
|
* @returns {Token}
|
|
780
645
|
*/
|
|
781
|
-
function
|
|
782
|
-
return new Token(Type.
|
|
646
|
+
function decodeNegint8(data, pos, _minor, options) {
|
|
647
|
+
return new Token(Type.negint, -1 - readUint8(data, pos + 1, options), 2);
|
|
783
648
|
}
|
|
784
649
|
/**
|
|
785
650
|
* @param {Uint8Array} data
|
|
@@ -788,8 +653,8 @@ function decodeUint8(data, pos, _minor, options) {
|
|
|
788
653
|
* @param {DecodeOptions} options
|
|
789
654
|
* @returns {Token}
|
|
790
655
|
*/
|
|
791
|
-
function
|
|
792
|
-
return new Token(Type.
|
|
656
|
+
function decodeNegint16(data, pos, _minor, options) {
|
|
657
|
+
return new Token(Type.negint, -1 - readUint16(data, pos + 1, options), 3);
|
|
793
658
|
}
|
|
794
659
|
/**
|
|
795
660
|
* @param {Uint8Array} data
|
|
@@ -798,9 +663,11 @@ function decodeUint16(data, pos, _minor, options) {
|
|
|
798
663
|
* @param {DecodeOptions} options
|
|
799
664
|
* @returns {Token}
|
|
800
665
|
*/
|
|
801
|
-
function
|
|
802
|
-
return new Token(Type.
|
|
666
|
+
function decodeNegint32(data, pos, _minor, options) {
|
|
667
|
+
return new Token(Type.negint, -1 - readUint32(data, pos + 1, options), 5);
|
|
803
668
|
}
|
|
669
|
+
const neg1b$1 = BigInt(-1);
|
|
670
|
+
const pos1b$1 = BigInt(1);
|
|
804
671
|
/**
|
|
805
672
|
* @param {Uint8Array} data
|
|
806
673
|
* @param {number} pos
|
|
@@ -808,169 +675,27 @@ function decodeUint32(data, pos, _minor, options) {
|
|
|
808
675
|
* @param {DecodeOptions} options
|
|
809
676
|
* @returns {Token}
|
|
810
677
|
*/
|
|
811
|
-
function
|
|
812
|
-
|
|
678
|
+
function decodeNegint64(data, pos, _minor, options) {
|
|
679
|
+
const int = readUint64(data, pos + 1, options);
|
|
680
|
+
if (typeof int !== "bigint") {
|
|
681
|
+
const value = -1 - int;
|
|
682
|
+
if (value >= Number.MIN_SAFE_INTEGER) return new Token(Type.negint, value, 9);
|
|
683
|
+
}
|
|
684
|
+
if (options.allowBigInt !== true) throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);
|
|
685
|
+
return new Token(Type.negint, neg1b$1 - BigInt(int), 9);
|
|
813
686
|
}
|
|
814
687
|
/**
|
|
815
688
|
* @param {ByteWriter} writer
|
|
816
689
|
* @param {Token} token
|
|
817
690
|
*/
|
|
818
|
-
function
|
|
819
|
-
|
|
691
|
+
function encodeNegint(writer, token) {
|
|
692
|
+
const negint = token.value;
|
|
693
|
+
const unsigned = typeof negint === "bigint" ? negint * neg1b$1 - pos1b$1 : negint * -1 - 1;
|
|
694
|
+
encodeUintValue(writer, token.type.majorEncoded, unsigned);
|
|
820
695
|
}
|
|
821
696
|
/**
|
|
822
|
-
* @param {
|
|
823
|
-
* @
|
|
824
|
-
* @param {number|bigint} uint
|
|
825
|
-
*/
|
|
826
|
-
function encodeUintValue(writer, major, uint) {
|
|
827
|
-
if (uint < uintBoundaries[0]) {
|
|
828
|
-
const nuint = Number(uint);
|
|
829
|
-
writer.pushByte(major | nuint);
|
|
830
|
-
} else if (uint < uintBoundaries[1]) {
|
|
831
|
-
const nuint = Number(uint);
|
|
832
|
-
writer.push([major | 24, nuint]);
|
|
833
|
-
} else if (uint < uintBoundaries[2]) {
|
|
834
|
-
const nuint = Number(uint);
|
|
835
|
-
writer.push([
|
|
836
|
-
major | 25,
|
|
837
|
-
nuint >>> 8,
|
|
838
|
-
nuint & 255
|
|
839
|
-
]);
|
|
840
|
-
} else if (uint < uintBoundaries[3]) {
|
|
841
|
-
const nuint = Number(uint);
|
|
842
|
-
writer.push([
|
|
843
|
-
major | 26,
|
|
844
|
-
nuint >>> 24 & 255,
|
|
845
|
-
nuint >>> 16 & 255,
|
|
846
|
-
nuint >>> 8 & 255,
|
|
847
|
-
nuint & 255
|
|
848
|
-
]);
|
|
849
|
-
} else {
|
|
850
|
-
const buint = BigInt(uint);
|
|
851
|
-
if (buint < uintBoundaries[4]) {
|
|
852
|
-
const set = [
|
|
853
|
-
major | 27,
|
|
854
|
-
0,
|
|
855
|
-
0,
|
|
856
|
-
0,
|
|
857
|
-
0,
|
|
858
|
-
0,
|
|
859
|
-
0,
|
|
860
|
-
0
|
|
861
|
-
];
|
|
862
|
-
let lo = Number(buint & BigInt(4294967295));
|
|
863
|
-
let hi = Number(buint >> BigInt(32) & BigInt(4294967295));
|
|
864
|
-
set[8] = lo & 255;
|
|
865
|
-
lo = lo >> 8;
|
|
866
|
-
set[7] = lo & 255;
|
|
867
|
-
lo = lo >> 8;
|
|
868
|
-
set[6] = lo & 255;
|
|
869
|
-
lo = lo >> 8;
|
|
870
|
-
set[5] = lo & 255;
|
|
871
|
-
set[4] = hi & 255;
|
|
872
|
-
hi = hi >> 8;
|
|
873
|
-
set[3] = hi & 255;
|
|
874
|
-
hi = hi >> 8;
|
|
875
|
-
set[2] = hi & 255;
|
|
876
|
-
hi = hi >> 8;
|
|
877
|
-
set[1] = hi & 255;
|
|
878
|
-
writer.push(set);
|
|
879
|
-
} else throw new Error(`${decodeErrPrefix} encountered BigInt larger than allowable range`);
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
/**
|
|
883
|
-
* @param {Token} token
|
|
884
|
-
* @returns {number}
|
|
885
|
-
*/
|
|
886
|
-
encodeUint.encodedSize = function encodedSize(token) {
|
|
887
|
-
return encodeUintValue.encodedSize(token.value);
|
|
888
|
-
};
|
|
889
|
-
/**
|
|
890
|
-
* @param {number} uint
|
|
891
|
-
* @returns {number}
|
|
892
|
-
*/
|
|
893
|
-
encodeUintValue.encodedSize = function encodedSize(uint) {
|
|
894
|
-
if (uint < uintBoundaries[0]) return 1;
|
|
895
|
-
if (uint < uintBoundaries[1]) return 2;
|
|
896
|
-
if (uint < uintBoundaries[2]) return 3;
|
|
897
|
-
if (uint < uintBoundaries[3]) return 5;
|
|
898
|
-
return 9;
|
|
899
|
-
};
|
|
900
|
-
/**
|
|
901
|
-
* @param {Token} tok1
|
|
902
|
-
* @param {Token} tok2
|
|
903
|
-
* @returns {number}
|
|
904
|
-
*/
|
|
905
|
-
encodeUint.compareTokens = function compareTokens(tok1, tok2) {
|
|
906
|
-
return tok1.value < tok2.value ? -1 : tok1.value > tok2.value ? 1 : 0;
|
|
907
|
-
};
|
|
908
|
-
//#endregion
|
|
909
|
-
//#region ../../node_modules/.bun/cborg@6.1.2/node_modules/cborg/lib/1negint.js
|
|
910
|
-
/**
|
|
911
|
-
* @typedef {import('../interface.js').ByteWriter} ByteWriter
|
|
912
|
-
* @typedef {import('../interface.js').DecodeOptions} DecodeOptions
|
|
913
|
-
*/
|
|
914
|
-
/**
|
|
915
|
-
* @param {Uint8Array} data
|
|
916
|
-
* @param {number} pos
|
|
917
|
-
* @param {number} _minor
|
|
918
|
-
* @param {DecodeOptions} options
|
|
919
|
-
* @returns {Token}
|
|
920
|
-
*/
|
|
921
|
-
function decodeNegint8(data, pos, _minor, options) {
|
|
922
|
-
return new Token(Type.negint, -1 - readUint8(data, pos + 1, options), 2);
|
|
923
|
-
}
|
|
924
|
-
/**
|
|
925
|
-
* @param {Uint8Array} data
|
|
926
|
-
* @param {number} pos
|
|
927
|
-
* @param {number} _minor
|
|
928
|
-
* @param {DecodeOptions} options
|
|
929
|
-
* @returns {Token}
|
|
930
|
-
*/
|
|
931
|
-
function decodeNegint16(data, pos, _minor, options) {
|
|
932
|
-
return new Token(Type.negint, -1 - readUint16(data, pos + 1, options), 3);
|
|
933
|
-
}
|
|
934
|
-
/**
|
|
935
|
-
* @param {Uint8Array} data
|
|
936
|
-
* @param {number} pos
|
|
937
|
-
* @param {number} _minor
|
|
938
|
-
* @param {DecodeOptions} options
|
|
939
|
-
* @returns {Token}
|
|
940
|
-
*/
|
|
941
|
-
function decodeNegint32(data, pos, _minor, options) {
|
|
942
|
-
return new Token(Type.negint, -1 - readUint32(data, pos + 1, options), 5);
|
|
943
|
-
}
|
|
944
|
-
const neg1b$1 = BigInt(-1);
|
|
945
|
-
const pos1b$1 = BigInt(1);
|
|
946
|
-
/**
|
|
947
|
-
* @param {Uint8Array} data
|
|
948
|
-
* @param {number} pos
|
|
949
|
-
* @param {number} _minor
|
|
950
|
-
* @param {DecodeOptions} options
|
|
951
|
-
* @returns {Token}
|
|
952
|
-
*/
|
|
953
|
-
function decodeNegint64(data, pos, _minor, options) {
|
|
954
|
-
const int = readUint64(data, pos + 1, options);
|
|
955
|
-
if (typeof int !== "bigint") {
|
|
956
|
-
const value = -1 - int;
|
|
957
|
-
if (value >= Number.MIN_SAFE_INTEGER) return new Token(Type.negint, value, 9);
|
|
958
|
-
}
|
|
959
|
-
if (options.allowBigInt !== true) throw new Error(`${decodeErrPrefix} integers outside of the safe integer range are not supported`);
|
|
960
|
-
return new Token(Type.negint, neg1b$1 - BigInt(int), 9);
|
|
961
|
-
}
|
|
962
|
-
/**
|
|
963
|
-
* @param {ByteWriter} writer
|
|
964
|
-
* @param {Token} token
|
|
965
|
-
*/
|
|
966
|
-
function encodeNegint(writer, token) {
|
|
967
|
-
const negint = token.value;
|
|
968
|
-
const unsigned = typeof negint === "bigint" ? negint * neg1b$1 - pos1b$1 : negint * -1 - 1;
|
|
969
|
-
encodeUintValue(writer, token.type.majorEncoded, unsigned);
|
|
970
|
-
}
|
|
971
|
-
/**
|
|
972
|
-
* @param {Token} token
|
|
973
|
-
* @returns {number}
|
|
697
|
+
* @param {Token} token
|
|
698
|
+
* @returns {number}
|
|
974
699
|
*/
|
|
975
700
|
encodeNegint.encodedSize = function encodedSize(token) {
|
|
976
701
|
const negint = token.value;
|
|
@@ -2495,325 +2220,624 @@ function tokenToMap(token, tokeniser, options) {
|
|
|
2495
2220
|
}
|
|
2496
2221
|
return useMaps ? m : obj;
|
|
2497
2222
|
}
|
|
2498
|
-
/**
|
|
2499
|
-
* Generator that yields [key, value] entries from a CBOR map token.
|
|
2500
|
-
* Used by tag decoders that need to preserve key types (e.g., Tag 259 Map).
|
|
2501
|
-
* @param {Token} token - The map token
|
|
2502
|
-
* @param {DecodeTokenizer} tokeniser
|
|
2503
|
-
* @param {DecodeOptions} options
|
|
2504
|
-
* @returns {Generator<[any, any], void, unknown>}
|
|
2505
|
-
*/
|
|
2506
|
-
function* tokenToMapEntries(token, tokeniser, options) {
|
|
2507
|
-
for (let i = 0; i < token.value; i++) {
|
|
2508
|
-
const key = tokensToObject(tokeniser, options);
|
|
2509
|
-
if (key === BREAK) {
|
|
2510
|
-
if (token.value === Infinity) break;
|
|
2511
|
-
throw new Error(`${decodeErrPrefix} got unexpected break to lengthed map`);
|
|
2512
|
-
}
|
|
2513
|
-
if (key === DONE) throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no key], expected ${token.value})`);
|
|
2514
|
-
const value = tokensToObject(tokeniser, options);
|
|
2515
|
-
if (value === DONE) throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no value], expected ${token.value})`);
|
|
2516
|
-
yield [key, value];
|
|
2517
|
-
}
|
|
2223
|
+
/**
|
|
2224
|
+
* Generator that yields [key, value] entries from a CBOR map token.
|
|
2225
|
+
* Used by tag decoders that need to preserve key types (e.g., Tag 259 Map).
|
|
2226
|
+
* @param {Token} token - The map token
|
|
2227
|
+
* @param {DecodeTokenizer} tokeniser
|
|
2228
|
+
* @param {DecodeOptions} options
|
|
2229
|
+
* @returns {Generator<[any, any], void, unknown>}
|
|
2230
|
+
*/
|
|
2231
|
+
function* tokenToMapEntries(token, tokeniser, options) {
|
|
2232
|
+
for (let i = 0; i < token.value; i++) {
|
|
2233
|
+
const key = tokensToObject(tokeniser, options);
|
|
2234
|
+
if (key === BREAK) {
|
|
2235
|
+
if (token.value === Infinity) break;
|
|
2236
|
+
throw new Error(`${decodeErrPrefix} got unexpected break to lengthed map`);
|
|
2237
|
+
}
|
|
2238
|
+
if (key === DONE) throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no key], expected ${token.value})`);
|
|
2239
|
+
const value = tokensToObject(tokeniser, options);
|
|
2240
|
+
if (value === DONE) throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no value], expected ${token.value})`);
|
|
2241
|
+
yield [key, value];
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
/**
|
|
2245
|
+
* Creates a TagDecodeControl object for tag decoders.
|
|
2246
|
+
* @param {DecodeTokenizer} tokeniser
|
|
2247
|
+
* @param {DecodeOptions} options
|
|
2248
|
+
* @returns {TagDecodeControl}
|
|
2249
|
+
*/
|
|
2250
|
+
function createTagDecodeControl(tokeniser, options) {
|
|
2251
|
+
/** @type {TagDecodeControl & {_called: boolean}} */
|
|
2252
|
+
const decode = function() {
|
|
2253
|
+
if (decode._called) throw new Error(`${decodeErrPrefix} tag decode() may only be called once`);
|
|
2254
|
+
decode._called = true;
|
|
2255
|
+
const value = tokensToObject(tokeniser, options);
|
|
2256
|
+
if (value === DONE) throw new Error(`${decodeErrPrefix} tag content missing`);
|
|
2257
|
+
if (value === BREAK) throw new Error(`${decodeErrPrefix} got unexpected break in tag content`);
|
|
2258
|
+
return value;
|
|
2259
|
+
};
|
|
2260
|
+
decode.entries = function() {
|
|
2261
|
+
if (decode._called) throw new Error(`${decodeErrPrefix} tag decode() may only be called once`);
|
|
2262
|
+
decode._called = true;
|
|
2263
|
+
const token = tokeniser.next();
|
|
2264
|
+
if (!Type.equals(token.type, Type.map)) throw new Error(`${decodeErrPrefix} entries() requires map content, got ${token.type.name}`);
|
|
2265
|
+
const entries = [];
|
|
2266
|
+
for (const entry of tokenToMapEntries(token, tokeniser, options)) entries.push(entry);
|
|
2267
|
+
return entries;
|
|
2268
|
+
};
|
|
2269
|
+
decode._called = false;
|
|
2270
|
+
return decode;
|
|
2271
|
+
}
|
|
2272
|
+
/**
|
|
2273
|
+
* @param {DecodeTokenizer} tokeniser
|
|
2274
|
+
* @param {DecodeOptions} options
|
|
2275
|
+
* @returns {any|typeof BREAK|typeof DONE}
|
|
2276
|
+
*/
|
|
2277
|
+
function tokensToObject(tokeniser, options) {
|
|
2278
|
+
if (tokeniser.done()) return DONE;
|
|
2279
|
+
const token = tokeniser.next();
|
|
2280
|
+
if (Type.equals(token.type, Type.break)) return BREAK;
|
|
2281
|
+
if (token.type.terminal) return token.value;
|
|
2282
|
+
if (Type.equals(token.type, Type.array)) return tokenToArray(token, tokeniser, options);
|
|
2283
|
+
if (Type.equals(token.type, Type.map)) return tokenToMap(token, tokeniser, options);
|
|
2284
|
+
if (Type.equals(token.type, Type.tag)) {
|
|
2285
|
+
if (options.tags && typeof options.tags[token.value] === "function") {
|
|
2286
|
+
const decodeControl = createTagDecodeControl(tokeniser, options);
|
|
2287
|
+
const result = options.tags[token.value](decodeControl);
|
|
2288
|
+
if (!decodeControl._called) throw new Error(`${decodeErrPrefix} tag decoder must call decode() or entries()`);
|
|
2289
|
+
return result;
|
|
2290
|
+
}
|
|
2291
|
+
throw new Error(`${decodeErrPrefix} tag not supported (${token.value})`);
|
|
2292
|
+
}
|
|
2293
|
+
throw new Error("unsupported");
|
|
2294
|
+
}
|
|
2295
|
+
/**
|
|
2296
|
+
* @param {Uint8Array} data
|
|
2297
|
+
* @param {DecodeOptions} [options]
|
|
2298
|
+
* @returns {[any, Uint8Array]}
|
|
2299
|
+
*/
|
|
2300
|
+
function decodeFirst(data, options) {
|
|
2301
|
+
if (!(data instanceof Uint8Array)) throw new Error(`${decodeErrPrefix} data to decode must be a Uint8Array`);
|
|
2302
|
+
options = Object.assign({}, defaultDecodeOptions, options);
|
|
2303
|
+
const u8aData = asU8A(data);
|
|
2304
|
+
const tokeniser = options.tokenizer || new Tokeniser(u8aData, options);
|
|
2305
|
+
const decoded = tokensToObject(tokeniser, options);
|
|
2306
|
+
if (decoded === DONE) throw new Error(`${decodeErrPrefix} did not find any content to decode`);
|
|
2307
|
+
if (decoded === BREAK) throw new Error(`${decodeErrPrefix} got unexpected break`);
|
|
2308
|
+
return [decoded, data.subarray(tokeniser.pos())];
|
|
2309
|
+
}
|
|
2310
|
+
/**
|
|
2311
|
+
* @param {Uint8Array} data
|
|
2312
|
+
* @param {DecodeOptions} [options]
|
|
2313
|
+
* @returns {any}
|
|
2314
|
+
*/
|
|
2315
|
+
function decode(data, options) {
|
|
2316
|
+
const [decoded, remainder] = decodeFirst(data, options);
|
|
2317
|
+
if (remainder.length > 0) throw new Error(`${decodeErrPrefix} too many terminals, data makes no sense`);
|
|
2318
|
+
return decoded;
|
|
2319
|
+
}
|
|
2320
|
+
Object.defineProperty(class Tagged {
|
|
2321
|
+
/**
|
|
2322
|
+
* @param {number} tag - CBOR tag number, a non-negative integer
|
|
2323
|
+
* @param {any} value - The value to be tagged; encoded recursively
|
|
2324
|
+
*/
|
|
2325
|
+
constructor(tag, value) {
|
|
2326
|
+
if (typeof tag !== "number" || !Number.isInteger(tag) || tag < 0) throw new TypeError("Tagged: tag must be a non-negative integer");
|
|
2327
|
+
this.tag = tag;
|
|
2328
|
+
this.value = value;
|
|
2329
|
+
}
|
|
2330
|
+
/**
|
|
2331
|
+
* Build a tag decoder for use in `decode()`'s `tags` option that returns the
|
|
2332
|
+
* decoded content wrapped in a `Tagged` instance, preserving the tag number
|
|
2333
|
+
* for the caller to inspect.
|
|
2334
|
+
*
|
|
2335
|
+
* @param {number} tag - The CBOR tag number this decoder will be registered for
|
|
2336
|
+
* @returns {TaggedTagDecoder}
|
|
2337
|
+
*
|
|
2338
|
+
* @example
|
|
2339
|
+
* import { decode, Tagged } from 'cborg'
|
|
2340
|
+
* const value = decode(bytes, { tags: { 16: Tagged.decoder(16) } })
|
|
2341
|
+
* // value instanceof Tagged; value.tag === 16
|
|
2342
|
+
*/
|
|
2343
|
+
static decoder(tag) {
|
|
2344
|
+
return (decode) => new Tagged(tag, decode());
|
|
2345
|
+
}
|
|
2346
|
+
/**
|
|
2347
|
+
* Build a `tags` option for `decode()` that wraps each listed tag number in
|
|
2348
|
+
* a `Tagged` instance, preserving those tags through decode without
|
|
2349
|
+
* registering a dedicated decoder per tag.
|
|
2350
|
+
*
|
|
2351
|
+
* @param {...number} tagNumbers - One or more CBOR tag numbers to preserve
|
|
2352
|
+
* @returns {{[tagNumber: number]: TaggedTagDecoder}}
|
|
2353
|
+
*
|
|
2354
|
+
* @example
|
|
2355
|
+
* import { decode, Tagged } from 'cborg'
|
|
2356
|
+
* const value = decode(bytes, { tags: Tagged.preserve(16, 96) })
|
|
2357
|
+
*/
|
|
2358
|
+
static preserve(...tagNumbers) {
|
|
2359
|
+
/** @type {{[tagNumber: number]: TaggedTagDecoder}} */
|
|
2360
|
+
const tags = {};
|
|
2361
|
+
for (const tag of tagNumbers) tags[tag] = Tagged.decoder(tag);
|
|
2362
|
+
return tags;
|
|
2363
|
+
}
|
|
2364
|
+
}.prototype, Symbol.toStringTag, { value: "Tagged" });
|
|
2365
|
+
//#endregion
|
|
2366
|
+
//#region ../../packages/shared/src/nodeIdentity.ts
|
|
2367
|
+
const NODE_AUTH_TRANSCRIPT_DOMAIN = "ryco.node-auth.proof.v1";
|
|
2368
|
+
const NODE_KEY_FINGERPRINT_DOMAIN = "ryco.node-key.v1";
|
|
2369
|
+
const NODE_KEY_ROTATION_TRANSCRIPT_DOMAIN = "ryco.node-key-rotation.proof.v1";
|
|
2370
|
+
const NATIVE_NODE_CLAIM_TRANSCRIPT_DOMAIN = "ryco.native-node-claim.proof.v1";
|
|
2371
|
+
var NodeIdentityValidationError = class extends Error {
|
|
2372
|
+
code = "invalid_node_identity_input";
|
|
2373
|
+
constructor() {
|
|
2374
|
+
super("Node identity input is invalid.");
|
|
2375
|
+
this.name = "NodeIdentityValidationError";
|
|
2376
|
+
}
|
|
2377
|
+
};
|
|
2378
|
+
const ID_SUFFIX = "[A-Za-z0-9_-]{22}";
|
|
2379
|
+
const NODE_ID = new RegExp(`^node_${ID_SUFFIX}$`);
|
|
2380
|
+
const NODE_KEY_ID = new RegExp(`^nkey_${ID_SUFFIX}$`);
|
|
2381
|
+
const ROTATION_REQUEST_ID = new RegExp(`^nrot_${ID_SUFFIX}$`);
|
|
2382
|
+
const PUBLIC_ID_SUFFIX = "[A-Za-z0-9_-]{22,43}";
|
|
2383
|
+
const ACCOUNT_ID = new RegExp(`^acct_${PUBLIC_ID_SUFFIX}$`);
|
|
2384
|
+
const SPACE_ID = new RegExp(`^space_${PUBLIC_ID_SUFFIX}$`);
|
|
2385
|
+
const SESSION_ID = new RegExp(`^sess_${PUBLIC_ID_SUFFIX}$`);
|
|
2386
|
+
const NATIVE_NODE_CLAIM_ID = new RegExp(`^nclaim_${PUBLIC_ID_SUFFIX}$`);
|
|
2387
|
+
const DESKTOP_INSTALLATION_ID = new RegExp(`^install_${PUBLIC_ID_SUFFIX}$`);
|
|
2388
|
+
const ENVIRONMENT_ID = /^env_[A-Za-z0-9_-]{22}$/;
|
|
2389
|
+
const LOOPBACK_HOSTS = /* @__PURE__ */ new Set([
|
|
2390
|
+
"localhost",
|
|
2391
|
+
"127.0.0.1",
|
|
2392
|
+
"[::1]"
|
|
2393
|
+
]);
|
|
2394
|
+
function invalid() {
|
|
2395
|
+
throw new NodeIdentityValidationError();
|
|
2396
|
+
}
|
|
2397
|
+
function assertUnsignedSafeInteger(value) {
|
|
2398
|
+
if (!Number.isSafeInteger(value) || value < 0) invalid();
|
|
2399
|
+
}
|
|
2400
|
+
function assertProtocolVersion(value) {
|
|
2401
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > 65535) invalid();
|
|
2402
|
+
}
|
|
2403
|
+
function assertIdentifier(value, pattern) {
|
|
2404
|
+
if (!pattern.test(value)) invalid();
|
|
2405
|
+
}
|
|
2406
|
+
function copyBytes(value, expectedLengths) {
|
|
2407
|
+
if (!(value instanceof Uint8Array) || !expectedLengths.includes(value.byteLength)) invalid();
|
|
2408
|
+
return Uint8Array.from(value);
|
|
2409
|
+
}
|
|
2410
|
+
function canonicalizeHubOrigin(value) {
|
|
2411
|
+
if (typeof value !== "string" || value.length === 0 || value.length > 512) invalid();
|
|
2412
|
+
let url;
|
|
2413
|
+
try {
|
|
2414
|
+
url = new URL(value);
|
|
2415
|
+
} catch {
|
|
2416
|
+
return invalid();
|
|
2417
|
+
}
|
|
2418
|
+
const isLoopbackHttp = url.protocol === "http:" && LOOPBACK_HOSTS.has(url.hostname);
|
|
2419
|
+
if (url.protocol !== "https:" && !isLoopbackHttp || url.username !== "" || url.password !== "" || url.pathname !== "/" || url.search !== "" || url.hash !== "" || value !== url.origin) invalid();
|
|
2420
|
+
return url.origin;
|
|
2421
|
+
}
|
|
2422
|
+
function normalizeHubNodeName(value) {
|
|
2423
|
+
if (typeof value !== "string") invalid();
|
|
2424
|
+
const normalized = value.trim();
|
|
2425
|
+
if (normalized.length === 0 || normalized.length > 100) invalid();
|
|
2426
|
+
return normalized;
|
|
2427
|
+
}
|
|
2428
|
+
function validateNodePublicKey(descriptor) {
|
|
2429
|
+
if (descriptor.algorithm === "ed25519") return {
|
|
2430
|
+
algorithm: descriptor.algorithm,
|
|
2431
|
+
publicKey: copyBytes(descriptor.publicKey, [32])
|
|
2432
|
+
};
|
|
2433
|
+
if (descriptor.algorithm === "p256") {
|
|
2434
|
+
const publicKey = copyBytes(descriptor.publicKey, [33, 65]);
|
|
2435
|
+
const prefix = publicKey[0];
|
|
2436
|
+
if (publicKey.byteLength === 33 && prefix !== 2 && prefix !== 3 || publicKey.byteLength === 65 && prefix !== 4) invalid();
|
|
2437
|
+
return {
|
|
2438
|
+
algorithm: descriptor.algorithm,
|
|
2439
|
+
publicKey
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
return invalid();
|
|
2443
|
+
}
|
|
2444
|
+
function fingerprintNodePublicKey(descriptor) {
|
|
2445
|
+
const key = validateNodePublicKey(descriptor);
|
|
2446
|
+
const canonical = encode([
|
|
2447
|
+
NODE_KEY_FINGERPRINT_DOMAIN,
|
|
2448
|
+
key.algorithm,
|
|
2449
|
+
key.publicKey
|
|
2450
|
+
], rfc8949EncodeOptions);
|
|
2451
|
+
return Uint8Array.from(createHash("sha256").update(canonical).digest());
|
|
2452
|
+
}
|
|
2453
|
+
function formatNodePublicKeyFingerprint(fingerprint) {
|
|
2454
|
+
const bytes = copyBytes(fingerprint, [32]);
|
|
2455
|
+
return `SHA256:${Buffer.from(bytes).toString("base64url")}`;
|
|
2456
|
+
}
|
|
2457
|
+
function encodeNodeAuthenticationTranscript(input) {
|
|
2458
|
+
const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
|
|
2459
|
+
assertProtocolVersion(input.protocolMajor);
|
|
2460
|
+
assertProtocolVersion(input.protocolMinor);
|
|
2461
|
+
assertIdentifier(input.nodeId, NODE_ID);
|
|
2462
|
+
assertIdentifier(input.activeKeyId, NODE_KEY_ID);
|
|
2463
|
+
assertUnsignedSafeInteger(input.challengeExpiresAt);
|
|
2464
|
+
const challenge = copyBytes(input.challenge, [32]);
|
|
2465
|
+
return Uint8Array.from(encode([
|
|
2466
|
+
NODE_AUTH_TRANSCRIPT_DOMAIN,
|
|
2467
|
+
hubOrigin,
|
|
2468
|
+
input.protocolMajor,
|
|
2469
|
+
input.protocolMinor,
|
|
2470
|
+
input.nodeId,
|
|
2471
|
+
input.activeKeyId,
|
|
2472
|
+
input.challengeExpiresAt,
|
|
2473
|
+
challenge
|
|
2474
|
+
], rfc8949EncodeOptions));
|
|
2475
|
+
}
|
|
2476
|
+
function encodeNodeKeyRotationTranscript(input) {
|
|
2477
|
+
const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
|
|
2478
|
+
assertProtocolVersion(input.protocolMajor);
|
|
2479
|
+
assertProtocolVersion(input.protocolMinor);
|
|
2480
|
+
assertIdentifier(input.rotationRequestId, ROTATION_REQUEST_ID);
|
|
2481
|
+
assertIdentifier(input.nodeId, NODE_ID);
|
|
2482
|
+
assertIdentifier(input.oldActiveKeyId, NODE_KEY_ID);
|
|
2483
|
+
assertIdentifier(input.newKeyId, NODE_KEY_ID);
|
|
2484
|
+
assertUnsignedSafeInteger(input.challengeExpiresAt);
|
|
2485
|
+
const newKey = validateNodePublicKey(input.newKey);
|
|
2486
|
+
const fingerprint = fingerprintNodePublicKey(newKey);
|
|
2487
|
+
const challenge = copyBytes(input.challenge, [32]);
|
|
2488
|
+
return Uint8Array.from(encode([
|
|
2489
|
+
NODE_KEY_ROTATION_TRANSCRIPT_DOMAIN,
|
|
2490
|
+
hubOrigin,
|
|
2491
|
+
input.protocolMajor,
|
|
2492
|
+
input.protocolMinor,
|
|
2493
|
+
input.rotationRequestId,
|
|
2494
|
+
input.nodeId,
|
|
2495
|
+
input.oldActiveKeyId,
|
|
2496
|
+
input.newKeyId,
|
|
2497
|
+
newKey.algorithm,
|
|
2498
|
+
newKey.publicKey,
|
|
2499
|
+
fingerprint,
|
|
2500
|
+
input.challengeExpiresAt,
|
|
2501
|
+
challenge
|
|
2502
|
+
], rfc8949EncodeOptions));
|
|
2503
|
+
}
|
|
2504
|
+
function encodeNativeNodeClaimTranscript(input) {
|
|
2505
|
+
const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
|
|
2506
|
+
assertProtocolVersion(input.protocolVersion);
|
|
2507
|
+
assertProtocolVersion(input.transcriptVersion);
|
|
2508
|
+
assertIdentifier(input.claimId, NATIVE_NODE_CLAIM_ID);
|
|
2509
|
+
assertIdentifier(input.accountId, ACCOUNT_ID);
|
|
2510
|
+
assertIdentifier(input.spaceId, SPACE_ID);
|
|
2511
|
+
assertIdentifier(input.sessionId, SESSION_ID);
|
|
2512
|
+
const dpopKeyThumbprint = copyBytes(input.dpopKeyThumbprint, [32]);
|
|
2513
|
+
assertIdentifier(input.installationId, DESKTOP_INSTALLATION_ID);
|
|
2514
|
+
assertIdentifier(input.environmentId, ENVIRONMENT_ID);
|
|
2515
|
+
const nodeKey = validateNodePublicKey(input.nodeKey);
|
|
2516
|
+
const nodeFingerprint = fingerprintNodePublicKey(nodeKey);
|
|
2517
|
+
assertUnsignedSafeInteger(input.claimExpiresAt);
|
|
2518
|
+
const challenge = copyBytes(input.challenge, [32]);
|
|
2519
|
+
return Uint8Array.from(encode([
|
|
2520
|
+
NATIVE_NODE_CLAIM_TRANSCRIPT_DOMAIN,
|
|
2521
|
+
hubOrigin,
|
|
2522
|
+
input.protocolVersion,
|
|
2523
|
+
input.transcriptVersion,
|
|
2524
|
+
input.claimId,
|
|
2525
|
+
input.accountId,
|
|
2526
|
+
input.spaceId,
|
|
2527
|
+
input.sessionId,
|
|
2528
|
+
dpopKeyThumbprint,
|
|
2529
|
+
input.installationId,
|
|
2530
|
+
input.environmentId,
|
|
2531
|
+
nodeKey.algorithm,
|
|
2532
|
+
nodeKey.publicKey,
|
|
2533
|
+
nodeFingerprint,
|
|
2534
|
+
input.claimExpiresAt,
|
|
2535
|
+
challenge
|
|
2536
|
+
], rfc8949EncodeOptions));
|
|
2537
|
+
}
|
|
2538
|
+
function equalNodeIdentityBytes(left, right) {
|
|
2539
|
+
if (!(left instanceof Uint8Array) || !(right instanceof Uint8Array)) return false;
|
|
2540
|
+
if (left.byteLength !== right.byteLength) return false;
|
|
2541
|
+
return timingSafeEqual(left, right);
|
|
2542
|
+
}
|
|
2543
|
+
//#endregion
|
|
2544
|
+
//#region ../../packages/shared/src/Struct.ts
|
|
2545
|
+
function deepMerge(current, patch) {
|
|
2546
|
+
if (!P.isObject(current) || !P.isObject(patch)) return patch;
|
|
2547
|
+
const next = { ...current };
|
|
2548
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
2549
|
+
if (value === void 0) continue;
|
|
2550
|
+
const existing = next[key];
|
|
2551
|
+
next[key] = P.isObject(existing) && P.isObject(value) ? deepMerge(existing, value) : value;
|
|
2552
|
+
}
|
|
2553
|
+
return next;
|
|
2554
|
+
}
|
|
2555
|
+
//#endregion
|
|
2556
|
+
//#region ../../packages/shared/src/model.ts
|
|
2557
|
+
const DEFAULT_PROVIDER_DRIVER_KIND = ProviderDriverKind.make("codex");
|
|
2558
|
+
/**
|
|
2559
|
+
* Resolve the human-readable model title used by picker surfaces and durable
|
|
2560
|
+
* handoff presentation. Provider catalogs are authoritative when they carry a
|
|
2561
|
+
* friendly name; the routing slug remains the deterministic final fallback.
|
|
2562
|
+
*/
|
|
2563
|
+
function getModelDisplayName(model, options) {
|
|
2564
|
+
const shortName = trimOrNull(model.shortName);
|
|
2565
|
+
const name = trimOrNull(model.name);
|
|
2566
|
+
const slug = trimOrNull(model.slug) ?? model.slug;
|
|
2567
|
+
return options?.preferShortName ? shortName ?? name ?? slug : name ?? shortName ?? slug;
|
|
2568
|
+
}
|
|
2569
|
+
/** Compose the optional sub-provider prefix exactly as the picker trigger does. */
|
|
2570
|
+
function getModelDisplayLabel(model, options) {
|
|
2571
|
+
const title = getModelDisplayName(model, options);
|
|
2572
|
+
const subProvider = trimOrNull(model.subProvider);
|
|
2573
|
+
return subProvider ? `${subProvider} · ${title}` : title;
|
|
2574
|
+
}
|
|
2575
|
+
function createModelCapabilities(input) {
|
|
2576
|
+
return { optionDescriptors: input.optionDescriptors.map(cloneDescriptor) };
|
|
2577
|
+
}
|
|
2578
|
+
function getRawSelectionValueById(selections, id) {
|
|
2579
|
+
return (selections?.find((candidate) => candidate.id === id))?.value;
|
|
2580
|
+
}
|
|
2581
|
+
function getProviderOptionSelectionValue(selections, id) {
|
|
2582
|
+
return getRawSelectionValueById(selections, id);
|
|
2583
|
+
}
|
|
2584
|
+
function getProviderOptionStringSelectionValue(selections, id) {
|
|
2585
|
+
const value = getProviderOptionSelectionValue(selections, id);
|
|
2586
|
+
return typeof value === "string" ? value : void 0;
|
|
2587
|
+
}
|
|
2588
|
+
function getProviderOptionBooleanSelectionValue(selections, id) {
|
|
2589
|
+
const value = getProviderOptionSelectionValue(selections, id);
|
|
2590
|
+
return typeof value === "boolean" ? value : void 0;
|
|
2591
|
+
}
|
|
2592
|
+
function getModelSelectionStringOptionValue(modelSelection, id) {
|
|
2593
|
+
return getProviderOptionStringSelectionValue(modelSelection?.options, id);
|
|
2594
|
+
}
|
|
2595
|
+
function getModelSelectionBooleanOptionValue(modelSelection, id) {
|
|
2596
|
+
return getProviderOptionBooleanSelectionValue(modelSelection?.options, id);
|
|
2597
|
+
}
|
|
2598
|
+
function resolveDescriptorChoiceValue(descriptor, raw) {
|
|
2599
|
+
const trimmed = trimOrNull(raw);
|
|
2600
|
+
if (!trimmed) return descriptor.currentValue ?? descriptor.options.find((option) => option.isDefault)?.id;
|
|
2601
|
+
if (descriptor.options.length === 0) return trimmed;
|
|
2602
|
+
if (descriptor.promptInjectedValues?.includes(trimmed) && descriptor.options.some((option) => option.id === trimmed)) return descriptor.options.find((option) => option.isDefault)?.id;
|
|
2603
|
+
if (descriptor.options.some((option) => option.id === trimmed)) return trimmed;
|
|
2604
|
+
return descriptor.currentValue ?? descriptor.options.find((option) => option.isDefault)?.id;
|
|
2605
|
+
}
|
|
2606
|
+
function cloneDescriptor(descriptor) {
|
|
2607
|
+
return descriptor.type === "select" ? {
|
|
2608
|
+
...descriptor,
|
|
2609
|
+
options: [...descriptor.options],
|
|
2610
|
+
...descriptor.promptInjectedValues ? { promptInjectedValues: [...descriptor.promptInjectedValues] } : {}
|
|
2611
|
+
} : { ...descriptor };
|
|
2612
|
+
}
|
|
2613
|
+
function cloneSelection(selection) {
|
|
2614
|
+
return { ...selection };
|
|
2518
2615
|
}
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
const
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2616
|
+
function withDescriptorCurrentValue(descriptor, rawCurrentValue) {
|
|
2617
|
+
if (descriptor.type === "boolean") {
|
|
2618
|
+
if (typeof rawCurrentValue === "boolean") return {
|
|
2619
|
+
...descriptor,
|
|
2620
|
+
currentValue: rawCurrentValue
|
|
2621
|
+
};
|
|
2622
|
+
return descriptor;
|
|
2623
|
+
}
|
|
2624
|
+
const currentValue = typeof rawCurrentValue === "string" ? resolveDescriptorChoiceValue(descriptor, rawCurrentValue) : resolveDescriptorChoiceValue(descriptor, descriptor.currentValue);
|
|
2625
|
+
if (!currentValue) {
|
|
2626
|
+
const { currentValue: _unusedCurrentValue, ...rest } = descriptor;
|
|
2627
|
+
return rest;
|
|
2628
|
+
}
|
|
2629
|
+
return {
|
|
2630
|
+
...descriptor,
|
|
2631
|
+
currentValue
|
|
2534
2632
|
};
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2633
|
+
}
|
|
2634
|
+
function getProviderOptionDescriptors(input) {
|
|
2635
|
+
const { caps, selections } = input;
|
|
2636
|
+
return (caps.optionDescriptors ?? []).map(cloneDescriptor).map((descriptor) => withDescriptorCurrentValue(descriptor, getRawSelectionValueById(selections, descriptor.id) ?? descriptor.currentValue));
|
|
2637
|
+
}
|
|
2638
|
+
function getProviderOptionCurrentValue(descriptor) {
|
|
2639
|
+
if (!descriptor) return;
|
|
2640
|
+
if (descriptor.type === "boolean") return descriptor.currentValue;
|
|
2641
|
+
if (descriptor.currentValue) return descriptor.currentValue;
|
|
2642
|
+
return descriptor.options.find((option) => option.isDefault)?.id;
|
|
2643
|
+
}
|
|
2644
|
+
function normalizeModelSlug(model, provider = DEFAULT_PROVIDER_DRIVER_KIND) {
|
|
2645
|
+
if (typeof model !== "string") return null;
|
|
2646
|
+
const trimmed = model.trim();
|
|
2647
|
+
if (!trimmed) return null;
|
|
2648
|
+
const aliases = MODEL_SLUG_ALIASES_BY_PROVIDER[provider] ?? {};
|
|
2649
|
+
const aliased = Object.prototype.hasOwnProperty.call(aliases, trimmed) ? aliases[trimmed] : void 0;
|
|
2650
|
+
return typeof aliased === "string" ? aliased : trimmed;
|
|
2651
|
+
}
|
|
2652
|
+
/** Trim a string, returning null for empty/missing values. */
|
|
2653
|
+
function trimOrNull(value) {
|
|
2654
|
+
if (typeof value !== "string") return null;
|
|
2655
|
+
return value.trim() || null;
|
|
2656
|
+
}
|
|
2657
|
+
function cloneSelections(selections) {
|
|
2658
|
+
return selections.map(cloneSelection);
|
|
2659
|
+
}
|
|
2660
|
+
function createModelSelection(instanceId, model, options) {
|
|
2661
|
+
const selections = options ? cloneSelections(options) : [];
|
|
2662
|
+
const base = {
|
|
2663
|
+
instanceId,
|
|
2664
|
+
model
|
|
2543
2665
|
};
|
|
2544
|
-
|
|
2545
|
-
|
|
2666
|
+
return selections.length > 0 ? {
|
|
2667
|
+
...base,
|
|
2668
|
+
options: selections
|
|
2669
|
+
} : base;
|
|
2670
|
+
}
|
|
2671
|
+
function canonicalOptionKeys(options) {
|
|
2672
|
+
return (options ?? []).map((option) => JSON.stringify([option.id, option.value])).toSorted((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
2546
2673
|
}
|
|
2547
2674
|
/**
|
|
2548
|
-
*
|
|
2549
|
-
*
|
|
2550
|
-
*
|
|
2675
|
+
* Semantic equality of two model selections: same instance and model, and the
|
|
2676
|
+
* same options regardless of their order (absent options equal an empty list).
|
|
2677
|
+
* Key order never matters, so a selection round-tripped through JSON and schema
|
|
2678
|
+
* decode equals the hydrated one.
|
|
2551
2679
|
*/
|
|
2552
|
-
function
|
|
2553
|
-
if (
|
|
2554
|
-
const
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
if (Type.equals(token.type, Type.array)) return tokenToArray(token, tokeniser, options);
|
|
2558
|
-
if (Type.equals(token.type, Type.map)) return tokenToMap(token, tokeniser, options);
|
|
2559
|
-
if (Type.equals(token.type, Type.tag)) {
|
|
2560
|
-
if (options.tags && typeof options.tags[token.value] === "function") {
|
|
2561
|
-
const decodeControl = createTagDecodeControl(tokeniser, options);
|
|
2562
|
-
const result = options.tags[token.value](decodeControl);
|
|
2563
|
-
if (!decodeControl._called) throw new Error(`${decodeErrPrefix} tag decoder must call decode() or entries()`);
|
|
2564
|
-
return result;
|
|
2565
|
-
}
|
|
2566
|
-
throw new Error(`${decodeErrPrefix} tag not supported (${token.value})`);
|
|
2567
|
-
}
|
|
2568
|
-
throw new Error("unsupported");
|
|
2680
|
+
function sameModelSelection(left, right) {
|
|
2681
|
+
if (left.instanceId !== right.instanceId || left.model !== right.model) return false;
|
|
2682
|
+
const leftOptions = canonicalOptionKeys(left.options);
|
|
2683
|
+
const rightOptions = canonicalOptionKeys(right.options);
|
|
2684
|
+
return leftOptions.length === rightOptions.length && leftOptions.every((key, index) => rightOptions[index] === key);
|
|
2569
2685
|
}
|
|
2570
2686
|
/**
|
|
2571
|
-
*
|
|
2572
|
-
*
|
|
2573
|
-
* @returns {[any, Uint8Array]}
|
|
2687
|
+
* Context handoff is a provider-instance boundary. Model and option changes
|
|
2688
|
+
* within one configured instance remain on that provider's normal turn path.
|
|
2574
2689
|
*/
|
|
2575
|
-
function
|
|
2576
|
-
|
|
2577
|
-
options = Object.assign({}, defaultDecodeOptions, options);
|
|
2578
|
-
const u8aData = asU8A(data);
|
|
2579
|
-
const tokeniser = options.tokenizer || new Tokeniser(u8aData, options);
|
|
2580
|
-
const decoded = tokensToObject(tokeniser, options);
|
|
2581
|
-
if (decoded === DONE) throw new Error(`${decodeErrPrefix} did not find any content to decode`);
|
|
2582
|
-
if (decoded === BREAK) throw new Error(`${decodeErrPrefix} got unexpected break`);
|
|
2583
|
-
return [decoded, data.subarray(tokeniser.pos())];
|
|
2690
|
+
function modelSelectionRequiresContextHandoff(input) {
|
|
2691
|
+
return input.canonicalSelection.instanceId !== input.targetSelection.instanceId;
|
|
2584
2692
|
}
|
|
2585
2693
|
/**
|
|
2586
|
-
*
|
|
2587
|
-
*
|
|
2588
|
-
*
|
|
2694
|
+
* Returns the effort value if it is a prompt-injected value according to
|
|
2695
|
+
* any select descriptor in the given capabilities, or null otherwise.
|
|
2696
|
+
*
|
|
2697
|
+
* Unlike a single `find`, this checks every descriptor so that the
|
|
2698
|
+
* correct descriptor's `promptInjectedValues` list is consulted even when
|
|
2699
|
+
* multiple select descriptors exist.
|
|
2589
2700
|
*/
|
|
2590
|
-
function
|
|
2591
|
-
const
|
|
2592
|
-
if (
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
/**
|
|
2597
|
-
* @param {number} tag - CBOR tag number, a non-negative integer
|
|
2598
|
-
* @param {any} value - The value to be tagged; encoded recursively
|
|
2599
|
-
*/
|
|
2600
|
-
constructor(tag, value) {
|
|
2601
|
-
if (typeof tag !== "number" || !Number.isInteger(tag) || tag < 0) throw new TypeError("Tagged: tag must be a non-negative integer");
|
|
2602
|
-
this.tag = tag;
|
|
2603
|
-
this.value = value;
|
|
2604
|
-
}
|
|
2605
|
-
/**
|
|
2606
|
-
* Build a tag decoder for use in `decode()`'s `tags` option that returns the
|
|
2607
|
-
* decoded content wrapped in a `Tagged` instance, preserving the tag number
|
|
2608
|
-
* for the caller to inspect.
|
|
2609
|
-
*
|
|
2610
|
-
* @param {number} tag - The CBOR tag number this decoder will be registered for
|
|
2611
|
-
* @returns {TaggedTagDecoder}
|
|
2612
|
-
*
|
|
2613
|
-
* @example
|
|
2614
|
-
* import { decode, Tagged } from 'cborg'
|
|
2615
|
-
* const value = decode(bytes, { tags: { 16: Tagged.decoder(16) } })
|
|
2616
|
-
* // value instanceof Tagged; value.tag === 16
|
|
2617
|
-
*/
|
|
2618
|
-
static decoder(tag) {
|
|
2619
|
-
return (decode) => new Tagged(tag, decode());
|
|
2620
|
-
}
|
|
2621
|
-
/**
|
|
2622
|
-
* Build a `tags` option for `decode()` that wraps each listed tag number in
|
|
2623
|
-
* a `Tagged` instance, preserving those tags through decode without
|
|
2624
|
-
* registering a dedicated decoder per tag.
|
|
2625
|
-
*
|
|
2626
|
-
* @param {...number} tagNumbers - One or more CBOR tag numbers to preserve
|
|
2627
|
-
* @returns {{[tagNumber: number]: TaggedTagDecoder}}
|
|
2628
|
-
*
|
|
2629
|
-
* @example
|
|
2630
|
-
* import { decode, Tagged } from 'cborg'
|
|
2631
|
-
* const value = decode(bytes, { tags: Tagged.preserve(16, 96) })
|
|
2632
|
-
*/
|
|
2633
|
-
static preserve(...tagNumbers) {
|
|
2634
|
-
/** @type {{[tagNumber: number]: TaggedTagDecoder}} */
|
|
2635
|
-
const tags = {};
|
|
2636
|
-
for (const tag of tagNumbers) tags[tag] = Tagged.decoder(tag);
|
|
2637
|
-
return tags;
|
|
2638
|
-
}
|
|
2639
|
-
}.prototype, Symbol.toStringTag, { value: "Tagged" });
|
|
2640
|
-
//#endregion
|
|
2641
|
-
//#region ../../packages/shared/src/nodeIdentity.ts
|
|
2642
|
-
const NODE_AUTH_TRANSCRIPT_DOMAIN = "ryco.node-auth.proof.v1";
|
|
2643
|
-
const NODE_KEY_FINGERPRINT_DOMAIN = "ryco.node-key.v1";
|
|
2644
|
-
const NODE_KEY_ROTATION_TRANSCRIPT_DOMAIN = "ryco.node-key-rotation.proof.v1";
|
|
2645
|
-
const NATIVE_NODE_CLAIM_TRANSCRIPT_DOMAIN = "ryco.native-node-claim.proof.v1";
|
|
2646
|
-
var NodeIdentityValidationError = class extends Error {
|
|
2647
|
-
code = "invalid_node_identity_input";
|
|
2648
|
-
constructor() {
|
|
2649
|
-
super("Node identity input is invalid.");
|
|
2650
|
-
this.name = "NodeIdentityValidationError";
|
|
2651
|
-
}
|
|
2652
|
-
};
|
|
2653
|
-
const ID_SUFFIX = "[A-Za-z0-9_-]{22}";
|
|
2654
|
-
const NODE_ID = new RegExp(`^node_${ID_SUFFIX}$`);
|
|
2655
|
-
const NODE_KEY_ID = new RegExp(`^nkey_${ID_SUFFIX}$`);
|
|
2656
|
-
const ROTATION_REQUEST_ID = new RegExp(`^nrot_${ID_SUFFIX}$`);
|
|
2657
|
-
const PUBLIC_ID_SUFFIX = "[A-Za-z0-9_-]{22,43}";
|
|
2658
|
-
const ACCOUNT_ID = new RegExp(`^acct_${PUBLIC_ID_SUFFIX}$`);
|
|
2659
|
-
const SPACE_ID = new RegExp(`^space_${PUBLIC_ID_SUFFIX}$`);
|
|
2660
|
-
const SESSION_ID = new RegExp(`^sess_${PUBLIC_ID_SUFFIX}$`);
|
|
2661
|
-
const NATIVE_NODE_CLAIM_ID = new RegExp(`^nclaim_${PUBLIC_ID_SUFFIX}$`);
|
|
2662
|
-
const DESKTOP_INSTALLATION_ID = new RegExp(`^install_${PUBLIC_ID_SUFFIX}$`);
|
|
2663
|
-
const ENVIRONMENT_ID = /^env_[A-Za-z0-9_-]{22}$/;
|
|
2664
|
-
const LOOPBACK_HOSTS = /* @__PURE__ */ new Set([
|
|
2665
|
-
"localhost",
|
|
2666
|
-
"127.0.0.1",
|
|
2667
|
-
"[::1]"
|
|
2668
|
-
]);
|
|
2669
|
-
function invalid() {
|
|
2670
|
-
throw new NodeIdentityValidationError();
|
|
2671
|
-
}
|
|
2672
|
-
function assertUnsignedSafeInteger(value) {
|
|
2673
|
-
if (!Number.isSafeInteger(value) || value < 0) invalid();
|
|
2701
|
+
function resolvePromptInjectedEffort(caps, rawEffort) {
|
|
2702
|
+
const trimmed = trimOrNull(rawEffort);
|
|
2703
|
+
if (!trimmed) return null;
|
|
2704
|
+
const descriptors = getProviderOptionDescriptors({ caps });
|
|
2705
|
+
for (const descriptor of descriptors) if (descriptor.type === "select" && descriptor.promptInjectedValues?.includes(trimmed)) return trimmed;
|
|
2706
|
+
return null;
|
|
2674
2707
|
}
|
|
2675
|
-
function
|
|
2676
|
-
|
|
2708
|
+
function applyClaudePromptEffortPrefix(text, effort) {
|
|
2709
|
+
const trimmed = text.trim();
|
|
2710
|
+
if (!trimmed) return trimmed;
|
|
2711
|
+
if (effort !== "ultrathink") return trimmed;
|
|
2712
|
+
if (trimmed.startsWith("Ultrathink:")) return trimmed;
|
|
2713
|
+
return `Ultrathink:\n${trimmed}`;
|
|
2677
2714
|
}
|
|
2678
|
-
|
|
2679
|
-
|
|
2715
|
+
//#endregion
|
|
2716
|
+
//#region ../../packages/shared/src/serverSettings.ts
|
|
2717
|
+
const ServerSettingsJson$1 = fromLenientJson(ServerSettings);
|
|
2718
|
+
function normalizePersistedServerSettingString(value) {
|
|
2719
|
+
const trimmed = value?.trim();
|
|
2720
|
+
return trimmed && trimmed.length > 0 ? trimmed : void 0;
|
|
2680
2721
|
}
|
|
2681
|
-
function
|
|
2682
|
-
|
|
2683
|
-
|
|
2722
|
+
function extractPersistedServerObservabilitySettings(input) {
|
|
2723
|
+
return {
|
|
2724
|
+
otlpTracesUrl: normalizePersistedServerSettingString(input.observability?.otlpTracesUrl),
|
|
2725
|
+
otlpMetricsUrl: normalizePersistedServerSettingString(input.observability?.otlpMetricsUrl)
|
|
2726
|
+
};
|
|
2684
2727
|
}
|
|
2685
|
-
function
|
|
2686
|
-
if (typeof value !== "string" || value.length === 0 || value.length > 512) invalid();
|
|
2687
|
-
let url;
|
|
2728
|
+
function parsePersistedServerObservabilitySettings(raw) {
|
|
2688
2729
|
try {
|
|
2689
|
-
|
|
2730
|
+
return extractPersistedServerObservabilitySettings(Schema.decodeUnknownSync(ServerSettingsJson$1)(raw));
|
|
2690
2731
|
} catch {
|
|
2691
|
-
return invalid();
|
|
2692
|
-
}
|
|
2693
|
-
const isLoopbackHttp = url.protocol === "http:" && LOOPBACK_HOSTS.has(url.hostname);
|
|
2694
|
-
if (url.protocol !== "https:" && !isLoopbackHttp || url.username !== "" || url.password !== "" || url.pathname !== "/" || url.search !== "" || url.hash !== "" || value !== url.origin) invalid();
|
|
2695
|
-
return url.origin;
|
|
2696
|
-
}
|
|
2697
|
-
function normalizeHubNodeName(value) {
|
|
2698
|
-
if (typeof value !== "string") invalid();
|
|
2699
|
-
const normalized = value.trim();
|
|
2700
|
-
if (normalized.length === 0 || normalized.length > 100) invalid();
|
|
2701
|
-
return normalized;
|
|
2702
|
-
}
|
|
2703
|
-
function validateNodePublicKey(descriptor) {
|
|
2704
|
-
if (descriptor.algorithm === "ed25519") return {
|
|
2705
|
-
algorithm: descriptor.algorithm,
|
|
2706
|
-
publicKey: copyBytes(descriptor.publicKey, [32])
|
|
2707
|
-
};
|
|
2708
|
-
if (descriptor.algorithm === "p256") {
|
|
2709
|
-
const publicKey = copyBytes(descriptor.publicKey, [33, 65]);
|
|
2710
|
-
const prefix = publicKey[0];
|
|
2711
|
-
if (publicKey.byteLength === 33 && prefix !== 2 && prefix !== 3 || publicKey.byteLength === 65 && prefix !== 4) invalid();
|
|
2712
2732
|
return {
|
|
2713
|
-
|
|
2714
|
-
|
|
2733
|
+
otlpTracesUrl: void 0,
|
|
2734
|
+
otlpMetricsUrl: void 0
|
|
2715
2735
|
};
|
|
2716
2736
|
}
|
|
2717
|
-
return invalid();
|
|
2718
|
-
}
|
|
2719
|
-
function fingerprintNodePublicKey(descriptor) {
|
|
2720
|
-
const key = validateNodePublicKey(descriptor);
|
|
2721
|
-
const canonical = encode([
|
|
2722
|
-
NODE_KEY_FINGERPRINT_DOMAIN,
|
|
2723
|
-
key.algorithm,
|
|
2724
|
-
key.publicKey
|
|
2725
|
-
], rfc8949EncodeOptions);
|
|
2726
|
-
return Uint8Array.from(createHash("sha256").update(canonical).digest());
|
|
2727
|
-
}
|
|
2728
|
-
function formatNodePublicKeyFingerprint(fingerprint) {
|
|
2729
|
-
const bytes = copyBytes(fingerprint, [32]);
|
|
2730
|
-
return `SHA256:${Buffer.from(bytes).toString("base64url")}`;
|
|
2731
|
-
}
|
|
2732
|
-
function encodeNodeAuthenticationTranscript(input) {
|
|
2733
|
-
const hubOrigin = canonicalizeHubOrigin(input.hubOrigin);
|
|
2734
|
-
assertProtocolVersion(input.protocolMajor);
|
|
2735
|
-
assertProtocolVersion(input.protocolMinor);
|
|
2736
|
-
assertIdentifier(input.nodeId, NODE_ID);
|
|
2737
|
-
assertIdentifier(input.activeKeyId, NODE_KEY_ID);
|
|
2738
|
-
assertUnsignedSafeInteger(input.challengeExpiresAt);
|
|
2739
|
-
const challenge = copyBytes(input.challenge, [32]);
|
|
2740
|
-
return Uint8Array.from(encode([
|
|
2741
|
-
NODE_AUTH_TRANSCRIPT_DOMAIN,
|
|
2742
|
-
hubOrigin,
|
|
2743
|
-
input.protocolMajor,
|
|
2744
|
-
input.protocolMinor,
|
|
2745
|
-
input.nodeId,
|
|
2746
|
-
input.activeKeyId,
|
|
2747
|
-
input.challengeExpiresAt,
|
|
2748
|
-
challenge
|
|
2749
|
-
], rfc8949EncodeOptions));
|
|
2750
2737
|
}
|
|
2751
|
-
function
|
|
2752
|
-
|
|
2753
|
-
assertProtocolVersion(input.protocolMajor);
|
|
2754
|
-
assertProtocolVersion(input.protocolMinor);
|
|
2755
|
-
assertIdentifier(input.rotationRequestId, ROTATION_REQUEST_ID);
|
|
2756
|
-
assertIdentifier(input.nodeId, NODE_ID);
|
|
2757
|
-
assertIdentifier(input.oldActiveKeyId, NODE_KEY_ID);
|
|
2758
|
-
assertIdentifier(input.newKeyId, NODE_KEY_ID);
|
|
2759
|
-
assertUnsignedSafeInteger(input.challengeExpiresAt);
|
|
2760
|
-
const newKey = validateNodePublicKey(input.newKey);
|
|
2761
|
-
const fingerprint = fingerprintNodePublicKey(newKey);
|
|
2762
|
-
const challenge = copyBytes(input.challenge, [32]);
|
|
2763
|
-
return Uint8Array.from(encode([
|
|
2764
|
-
NODE_KEY_ROTATION_TRANSCRIPT_DOMAIN,
|
|
2765
|
-
hubOrigin,
|
|
2766
|
-
input.protocolMajor,
|
|
2767
|
-
input.protocolMinor,
|
|
2768
|
-
input.rotationRequestId,
|
|
2769
|
-
input.nodeId,
|
|
2770
|
-
input.oldActiveKeyId,
|
|
2771
|
-
input.newKeyId,
|
|
2772
|
-
newKey.algorithm,
|
|
2773
|
-
newKey.publicKey,
|
|
2774
|
-
fingerprint,
|
|
2775
|
-
input.challengeExpiresAt,
|
|
2776
|
-
challenge
|
|
2777
|
-
], rfc8949EncodeOptions));
|
|
2738
|
+
function shouldReplaceTextGenerationModelSelection(patch) {
|
|
2739
|
+
return Boolean(patch && (patch.instanceId !== void 0 || patch.model !== void 0));
|
|
2778
2740
|
}
|
|
2779
|
-
function
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
assertIdentifier(input.installationId, DESKTOP_INSTALLATION_ID);
|
|
2789
|
-
assertIdentifier(input.environmentId, ENVIRONMENT_ID);
|
|
2790
|
-
const nodeKey = validateNodePublicKey(input.nodeKey);
|
|
2791
|
-
const nodeFingerprint = fingerprintNodePublicKey(nodeKey);
|
|
2792
|
-
assertUnsignedSafeInteger(input.claimExpiresAt);
|
|
2793
|
-
const challenge = copyBytes(input.challenge, [32]);
|
|
2794
|
-
return Uint8Array.from(encode([
|
|
2795
|
-
NATIVE_NODE_CLAIM_TRANSCRIPT_DOMAIN,
|
|
2796
|
-
hubOrigin,
|
|
2797
|
-
input.protocolVersion,
|
|
2798
|
-
input.transcriptVersion,
|
|
2799
|
-
input.claimId,
|
|
2800
|
-
input.accountId,
|
|
2801
|
-
input.spaceId,
|
|
2802
|
-
input.sessionId,
|
|
2803
|
-
dpopKeyThumbprint,
|
|
2804
|
-
input.installationId,
|
|
2805
|
-
input.environmentId,
|
|
2806
|
-
nodeKey.algorithm,
|
|
2807
|
-
nodeKey.publicKey,
|
|
2808
|
-
nodeFingerprint,
|
|
2809
|
-
input.claimExpiresAt,
|
|
2810
|
-
challenge
|
|
2811
|
-
], rfc8949EncodeOptions));
|
|
2741
|
+
function mergeModelSelectionOptionsById(input) {
|
|
2742
|
+
if (input.patch === void 0) return input.current ? [...input.current] : void 0;
|
|
2743
|
+
if (input.patch.length === 0) return;
|
|
2744
|
+
const merged = new Map((input.current ?? []).map((selection) => [selection.id, selection.value]));
|
|
2745
|
+
for (const selection of input.patch) merged.set(selection.id, selection.value);
|
|
2746
|
+
return [...merged.entries()].map(([id, value]) => ({
|
|
2747
|
+
id,
|
|
2748
|
+
value
|
|
2749
|
+
}));
|
|
2812
2750
|
}
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2751
|
+
/**
|
|
2752
|
+
* Applies a server settings patch while treating textGenerationModelSelection as
|
|
2753
|
+
* replace-on-provider/model updates. This prevents stale nested options from
|
|
2754
|
+
* surviving a reset patch that intentionally omits options.
|
|
2755
|
+
*/
|
|
2756
|
+
function applyServerSettingsPatch(current, patch) {
|
|
2757
|
+
const selectionPatch = patch.textGenerationModelSelection;
|
|
2758
|
+
for (const [field, value] of Object.entries(patch.expectedNodePreferences ?? {})) if (!Equal.equals(current[field] ?? null, value)) throw new Error("Node preferences changed elsewhere. Reload before saving.");
|
|
2759
|
+
for (const [projectId, expected] of Object.entries(patch.expectedProjectPreferences ?? {})) {
|
|
2760
|
+
const currentPreferences = current.projectPreferences[projectId] ?? {};
|
|
2761
|
+
for (const [field, value] of Object.entries(expected)) {
|
|
2762
|
+
const actual = field === "initialModelSelection" && !Object.hasOwn(currentPreferences, field) ? "absent" : currentPreferences[field] ?? null;
|
|
2763
|
+
if (!Equal.equals(actual, value)) throw new Error("Project preferences changed elsewhere. Reload before saving.");
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
const { expectedProjectPreferences: _expected, expectedNodePreferences: _expectedNode, projectPreferences: _projects, ...persistedPatch } = patch;
|
|
2767
|
+
let next = deepMerge(current, persistedPatch);
|
|
2768
|
+
if (patch.initialModelSelection !== void 0) next = {
|
|
2769
|
+
...next,
|
|
2770
|
+
initialModelSelection: patch.initialModelSelection
|
|
2771
|
+
};
|
|
2772
|
+
if (patch.projectPreferences !== void 0) {
|
|
2773
|
+
const projects = new Map(Object.entries(current.projectPreferences));
|
|
2774
|
+
for (const [projectId, preferencesPatch] of Object.entries(patch.projectPreferences)) {
|
|
2775
|
+
if (preferencesPatch === null) {
|
|
2776
|
+
projects.delete(projectId);
|
|
2777
|
+
continue;
|
|
2778
|
+
}
|
|
2779
|
+
const preferences = { ...projects.get(projectId) };
|
|
2780
|
+
for (const [field, value] of Object.entries(preferencesPatch)) if (value === null && field !== "initialModelSelection") delete preferences[field];
|
|
2781
|
+
else Object.assign(preferences, { [field]: value });
|
|
2782
|
+
if (Object.keys(preferences).length) projects.set(projectId, preferences);
|
|
2783
|
+
else projects.delete(projectId);
|
|
2784
|
+
}
|
|
2785
|
+
next = {
|
|
2786
|
+
...next,
|
|
2787
|
+
projectPreferences: Object.fromEntries(projects)
|
|
2788
|
+
};
|
|
2789
|
+
}
|
|
2790
|
+
if (patch.projectWorktreeSubmodules !== void 0) {
|
|
2791
|
+
const modes = new Map(Object.entries(current.projectWorktreeSubmodules));
|
|
2792
|
+
for (const [projectId, mode] of Object.entries(patch.projectWorktreeSubmodules)) if (mode === null) modes.delete(projectId);
|
|
2793
|
+
else modes.set(projectId, mode);
|
|
2794
|
+
next = {
|
|
2795
|
+
...next,
|
|
2796
|
+
projectWorktreeSubmodules: Object.fromEntries(modes)
|
|
2797
|
+
};
|
|
2798
|
+
}
|
|
2799
|
+
if (patch.projectWorktreeRoots !== void 0) {
|
|
2800
|
+
const roots = new Map(Object.entries(current.projectWorktreeRoots));
|
|
2801
|
+
for (const [projectId, root] of Object.entries(patch.projectWorktreeRoots)) if (root === null || root === "") roots.delete(projectId);
|
|
2802
|
+
else roots.set(projectId, root);
|
|
2803
|
+
next = {
|
|
2804
|
+
...next,
|
|
2805
|
+
projectWorktreeRoots: Object.fromEntries(roots)
|
|
2806
|
+
};
|
|
2807
|
+
}
|
|
2808
|
+
if (patch.projectStorageRetention !== void 0) {
|
|
2809
|
+
const policies = new Map(Object.entries(current.projectStorageRetention));
|
|
2810
|
+
for (const [projectId, policy] of Object.entries(patch.projectStorageRetention)) if (policy === null) policies.delete(projectId);
|
|
2811
|
+
else policies.set(projectId, policy);
|
|
2812
|
+
next = {
|
|
2813
|
+
...next,
|
|
2814
|
+
projectStorageRetention: Object.fromEntries(policies)
|
|
2815
|
+
};
|
|
2816
|
+
}
|
|
2817
|
+
if (patch.projectLifecycleSuggestions !== void 0) {
|
|
2818
|
+
const policies = new Map(Object.entries(current.projectLifecycleSuggestions));
|
|
2819
|
+
for (const [projectId, policy] of Object.entries(patch.projectLifecycleSuggestions)) if (policy === null) policies.delete(projectId);
|
|
2820
|
+
else policies.set(projectId, policy);
|
|
2821
|
+
next = {
|
|
2822
|
+
...next,
|
|
2823
|
+
projectLifecycleSuggestions: Object.fromEntries(policies)
|
|
2824
|
+
};
|
|
2825
|
+
}
|
|
2826
|
+
const nextWithReplacements = patch.providerInstances !== void 0 ? {
|
|
2827
|
+
...next,
|
|
2828
|
+
providerInstances: patch.providerInstances
|
|
2829
|
+
} : next;
|
|
2830
|
+
if (!selectionPatch) return nextWithReplacements;
|
|
2831
|
+
const instanceId = selectionPatch.instanceId ?? current.textGenerationModelSelection.instanceId;
|
|
2832
|
+
const model = selectionPatch.model ?? current.textGenerationModelSelection.model;
|
|
2833
|
+
const options = shouldReplaceTextGenerationModelSelection(selectionPatch) ? selectionPatch.options : mergeModelSelectionOptionsById({
|
|
2834
|
+
current: current.textGenerationModelSelection.options,
|
|
2835
|
+
patch: selectionPatch.options
|
|
2836
|
+
});
|
|
2837
|
+
return {
|
|
2838
|
+
...nextWithReplacements,
|
|
2839
|
+
textGenerationModelSelection: createModelSelection(instanceId, model, options)
|
|
2840
|
+
};
|
|
2817
2841
|
}
|
|
2818
2842
|
//#endregion
|
|
2819
2843
|
//#region src/config.ts
|
|
@@ -2890,6 +2914,7 @@ function resolveHubConnectorConfig(raw) {
|
|
|
2890
2914
|
};
|
|
2891
2915
|
}
|
|
2892
2916
|
const DEFAULT_NODE_E2EE_POLICY_CONFIG = {
|
|
2917
|
+
mode: void 0,
|
|
2893
2918
|
requireE2EE: void 0,
|
|
2894
2919
|
requireApprovedClientE2EE: void 0,
|
|
2895
2920
|
configurationIssue: void 0
|
|
@@ -2916,15 +2941,21 @@ const parseTriStateBoolean = (value) => {
|
|
|
2916
2941
|
function resolveNodeE2eePolicyConfig(raw) {
|
|
2917
2942
|
const requireE2EE = parseTriStateBoolean(raw.requireE2EE);
|
|
2918
2943
|
const requireApprovedClientE2EE = parseTriStateBoolean(raw.requireApprovedClientE2EE);
|
|
2944
|
+
const mode = raw.mode === void 0 ? void 0 : Schema.is(NodeE2eeAdmissionPolicy)(raw.mode) ? raw.mode : null;
|
|
2919
2945
|
return {
|
|
2946
|
+
mode: mode ?? void 0,
|
|
2920
2947
|
requireE2EE: typeof requireE2EE === "boolean" ? requireE2EE : void 0,
|
|
2921
2948
|
requireApprovedClientE2EE: typeof requireApprovedClientE2EE === "boolean" ? requireApprovedClientE2EE : void 0,
|
|
2922
|
-
configurationIssue: requireE2EE === void 0 || requireApprovedClientE2EE === void 0 ? "configuration_invalid" : void 0
|
|
2949
|
+
configurationIssue: requireE2EE === void 0 || requireApprovedClientE2EE === void 0 || mode === null ? "configuration_invalid" : void 0
|
|
2923
2950
|
};
|
|
2924
2951
|
}
|
|
2925
2952
|
function resolveManagedWorktreesRoot(config) {
|
|
2926
2953
|
return config.workspaceAccessRoot === void 0 ? config.worktreesDir : path.join(config.workspaceAccessRoot, ".ryco", "worktrees");
|
|
2927
2954
|
}
|
|
2955
|
+
/** The chats root used when the `chatsRoot` setting is empty. */
|
|
2956
|
+
function resolveManagedChatsRoot(config) {
|
|
2957
|
+
return config.workspaceAccessRoot === void 0 ? config.chatsDir : path.join(config.workspaceAccessRoot, ".ryco", "chats");
|
|
2958
|
+
}
|
|
2928
2959
|
const deriveServerPaths = Effect.fn(function* (baseDir, devUrl) {
|
|
2929
2960
|
const { join } = yield* Path.Path;
|
|
2930
2961
|
const stateDir = join(baseDir, devUrl !== void 0 ? "dev" : "userdata");
|
|
@@ -2940,6 +2971,7 @@ const deriveServerPaths = Effect.fn(function* (baseDir, devUrl) {
|
|
|
2940
2971
|
settingsPath: join(stateDir, "settings.json"),
|
|
2941
2972
|
providerStatusCacheDir,
|
|
2942
2973
|
worktreesDir: join(baseDir, "worktrees"),
|
|
2974
|
+
chatsDir: join(baseDir, "chats"),
|
|
2943
2975
|
attachmentsDir,
|
|
2944
2976
|
logsDir,
|
|
2945
2977
|
serverLogPath: join(logsDir, "server.log"),
|
|
@@ -3447,6 +3479,11 @@ async function removeVerifiedWorktree(repository, candidate, cleanup) {
|
|
|
3447
3479
|
//#region src/storage/lifecycle.ts
|
|
3448
3480
|
const storageLifecycleLock = Semaphore.makeUnsafe(1);
|
|
3449
3481
|
const creations = /* @__PURE__ */ new Map();
|
|
3482
|
+
let activityVersion = 0;
|
|
3483
|
+
const noteStorageActivity = () => {
|
|
3484
|
+
activityVersion++;
|
|
3485
|
+
};
|
|
3486
|
+
const storageActivityVersion = () => activityVersion;
|
|
3450
3487
|
const overlaps = (a, b, platform = process.platform) => {
|
|
3451
3488
|
if (platform === "darwin" || platform === "win32") {
|
|
3452
3489
|
a = a.toLowerCase();
|
|
@@ -3455,6 +3492,12 @@ const overlaps = (a, b, platform = process.platform) => {
|
|
|
3455
3492
|
const boundary = (root) => root.endsWith(path.sep) ? root : root + path.sep;
|
|
3456
3493
|
return a === b || a.startsWith(boundary(b)) || b.startsWith(boundary(a));
|
|
3457
3494
|
};
|
|
3495
|
+
/** `candidate` is `root` or below it. */
|
|
3496
|
+
const contains = (root, candidate, platform) => {
|
|
3497
|
+
const a = platform === "darwin" || platform === "win32" ? root.toLowerCase() : root;
|
|
3498
|
+
const b = platform === "darwin" || platform === "win32" ? candidate.toLowerCase() : candidate;
|
|
3499
|
+
return a === b || b.startsWith(a.endsWith(path.sep) ? a : a + path.sep);
|
|
3500
|
+
};
|
|
3458
3501
|
const removingPaths = (row) => {
|
|
3459
3502
|
let identity;
|
|
3460
3503
|
try {
|
|
@@ -3485,6 +3528,7 @@ async function canonicalStoragePath(candidate) {
|
|
|
3485
3528
|
function acquireWorktreeCreationLease(sql, candidate) {
|
|
3486
3529
|
return storageLifecycleLock.withPermit(Effect.gen(function* () {
|
|
3487
3530
|
const canonical = yield* Effect.tryPromise(() => canonicalStoragePath(candidate));
|
|
3531
|
+
if (yield* isWorktreeRelocationBlocked(sql, canonical)) return yield* new StorageError({ detail: "Checkout relocation is pending or this is a retired checkout path. Reload the workspace." });
|
|
3488
3532
|
const pending = yield* sql`SELECT path, identity_json FROM storage_owned_entries WHERE state = 'removing' LIMIT 257`;
|
|
3489
3533
|
if (pending.length > 256) return yield* new StorageError({ detail: "Too many interrupted cleanups to establish safe creation admission. Inspect pending cleanup records." });
|
|
3490
3534
|
if (pending.some((row) => removingPaths(row).some((root) => overlaps(root, canonical)))) return yield* new StorageError({ detail: "Checkout cleanup is pending. Creation cannot replace an in-flight removal." });
|
|
@@ -3493,6 +3537,7 @@ function acquireWorktreeCreationLease(sql, candidate) {
|
|
|
3493
3537
|
const remaining = (creations.get(canonical) ?? 1) - 1;
|
|
3494
3538
|
if (remaining > 0) creations.set(canonical, remaining);
|
|
3495
3539
|
else creations.delete(canonical);
|
|
3540
|
+
noteStorageActivity();
|
|
3496
3541
|
});
|
|
3497
3542
|
}));
|
|
3498
3543
|
}
|
|
@@ -3500,12 +3545,14 @@ function acquireWorktreeCreationLease(sql, candidate) {
|
|
|
3500
3545
|
function acquireStoragePathUseLease(sql, candidate) {
|
|
3501
3546
|
return storageLifecycleLock.withPermit(Effect.gen(function* () {
|
|
3502
3547
|
const canonical = yield* Effect.tryPromise(() => canonicalStoragePath(candidate));
|
|
3503
|
-
|
|
3548
|
+
const blocker = yield* storagePathBlocker(sql, canonical);
|
|
3549
|
+
if (blocker !== null) return yield* new StorageError({ detail: blocker === "project-relocation" ? PROJECT_RELOCATION_PENDING_MESSAGE : "Checkout cleanup is pending or complete. Restore/recreate it before provider recovery." });
|
|
3504
3550
|
creations.set(canonical, (creations.get(canonical) ?? 0) + 1);
|
|
3505
3551
|
return Effect.sync(() => {
|
|
3506
3552
|
const remaining = (creations.get(canonical) ?? 1) - 1;
|
|
3507
3553
|
if (remaining > 0) creations.set(canonical, remaining);
|
|
3508
3554
|
else creations.delete(canonical);
|
|
3555
|
+
noteStorageActivity();
|
|
3509
3556
|
});
|
|
3510
3557
|
}));
|
|
3511
3558
|
}
|
|
@@ -3533,8 +3580,22 @@ function recordCreatedWorktree(sql, repository, candidate) {
|
|
|
3533
3580
|
WHERE storage_owned_entries.state != 'removing' RETURNING id`).length !== 1) return yield* new StorageError({ detail: "Ownership capture refused to replace a pending cleanup. The creation outcome remains protected." });
|
|
3534
3581
|
});
|
|
3535
3582
|
}
|
|
3536
|
-
/**
|
|
3537
|
-
|
|
3583
|
+
/**
|
|
3584
|
+
* Storage admission for a path: refused while a chat's folder moves or checkout lifecycle work
|
|
3585
|
+
* fences it. Persistent tombstones prevent restart/resume from granting authority to a removed
|
|
3586
|
+
* checkout.
|
|
3587
|
+
*/
|
|
3588
|
+
function isStoragePathBlocked(sql, candidate, platform = process.platform, ignoredRelocationId) {
|
|
3589
|
+
return storagePathBlocker(sql, candidate, platform, ignoredRelocationId).pipe(Effect.map((blocker) => blocker !== null));
|
|
3590
|
+
}
|
|
3591
|
+
/** {@link isStoragePathBlocked}, with the reason, so admission can tell a retryable move apart. */
|
|
3592
|
+
function storagePathBlocker(sql, candidate, platform = process.platform, ignoredRelocationId) {
|
|
3593
|
+
return Effect.gen(function* () {
|
|
3594
|
+
if (yield* isProjectRelocationBlocked(sql, candidate, platform)) return "project-relocation";
|
|
3595
|
+
return (yield* isCheckoutPathBlocked(sql, candidate, platform, ignoredRelocationId)) ? "checkout" : null;
|
|
3596
|
+
});
|
|
3597
|
+
}
|
|
3598
|
+
function isCheckoutPathBlocked(sql, candidate, platform, ignoredRelocationId) {
|
|
3538
3599
|
const ancestors = [];
|
|
3539
3600
|
let current = path.resolve(candidate);
|
|
3540
3601
|
for (;;) {
|
|
@@ -3545,11 +3606,42 @@ function isStoragePathBlocked(sql, candidate, platform = process.platform) {
|
|
|
3545
3606
|
}
|
|
3546
3607
|
const matching = platform === "darwin" || platform === "win32" ? sql`path COLLATE NOCASE IN ${sql.in(ancestors)}` : sql.in("path", ancestors);
|
|
3547
3608
|
return Effect.gen(function* () {
|
|
3609
|
+
if (yield* isWorktreeRelocationBlocked(sql, candidate, platform, ignoredRelocationId)) return true;
|
|
3548
3610
|
if ((yield* sql`SELECT path FROM storage_owned_entries WHERE state IN ('removing', 'removed') AND ${matching} LIMIT 1`).length) return true;
|
|
3549
3611
|
const pending = yield* sql`SELECT path, identity_json FROM storage_owned_entries WHERE state = 'removing' LIMIT 257`;
|
|
3550
3612
|
return pending.length > 256 || pending.some((row) => removingPaths(row).some((root) => overlaps(root, path.resolve(candidate), platform)));
|
|
3551
3613
|
});
|
|
3552
3614
|
}
|
|
3615
|
+
/** Active moves fence both paths; completed moves permanently fence the old path. */
|
|
3616
|
+
function isWorktreeRelocationBlocked(sql, candidate, platform = process.platform, ignoredRelocationId) {
|
|
3617
|
+
return Effect.gen(function* () {
|
|
3618
|
+
if (!(yield* sql`SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'managed_worktree_relocations'`).length) return false;
|
|
3619
|
+
const rows = yield* sql`
|
|
3620
|
+
SELECT source_path, destination_path, state FROM managed_worktree_relocations
|
|
3621
|
+
WHERE state IN ('moving', 'moved', 'attention', 'complete')
|
|
3622
|
+
AND worktree_id != ${ignoredRelocationId ?? ""}`;
|
|
3623
|
+
const resolved = path.resolve(candidate);
|
|
3624
|
+
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));
|
|
3625
|
+
});
|
|
3626
|
+
}
|
|
3627
|
+
/**
|
|
3628
|
+
* An unsettled chat promotion (`project_relocations` row `pending` or `moved`, see
|
|
3629
|
+
* `project/chatPromotion.ts`) fences everything at or below both of its paths, so no turn, provider
|
|
3630
|
+
* session or terminal starts in a folder that is moving. Promotion writes the row before it stops
|
|
3631
|
+
* sessions and closes terminals. Unlike a checkout move, ancestors stay usable: a project that
|
|
3632
|
+
* merely contains the chats folder is unrelated, and a write into a moving copy fails its
|
|
3633
|
+
* verification. Settled moves lift the fence; the project then points at its new root.
|
|
3634
|
+
*/
|
|
3635
|
+
function isProjectRelocationBlocked(sql, candidate, platform = process.platform) {
|
|
3636
|
+
return Effect.gen(function* () {
|
|
3637
|
+
if (!(yield* sql`SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'project_relocations'`).length) return false;
|
|
3638
|
+
const rows = yield* sql`
|
|
3639
|
+
SELECT source_path, destination_path FROM project_relocations
|
|
3640
|
+
WHERE state IN ('pending', 'moved')`;
|
|
3641
|
+
const resolved = path.resolve(candidate);
|
|
3642
|
+
return rows.some((row) => contains(row.source_path, resolved, platform) || contains(row.destination_path, resolved, platform));
|
|
3643
|
+
});
|
|
3644
|
+
}
|
|
3553
3645
|
//#endregion
|
|
3554
3646
|
//#region src/atomicWrite.ts
|
|
3555
3647
|
const writeFileStringAtomically = (input) => Effect.scoped(Effect.gen(function* () {
|
|
@@ -3660,7 +3752,11 @@ function expandHomePath(value) {
|
|
|
3660
3752
|
}
|
|
3661
3753
|
//#endregion
|
|
3662
3754
|
//#region src/project/worktreeRoot.ts
|
|
3663
|
-
var WorktreeRootError = class extends Schema.TaggedError()("WorktreeRootError", {
|
|
3755
|
+
var WorktreeRootError = class extends Schema.TaggedError()("WorktreeRootError", {
|
|
3756
|
+
detail: Schema.String,
|
|
3757
|
+
/** `restricted`: the workspace access policy rejected it; `unusable`: the path itself is. */
|
|
3758
|
+
reason: Schema.optional(Schema.Literals(["unusable", "restricted"]))
|
|
3759
|
+
}) {
|
|
3664
3760
|
get message() {
|
|
3665
3761
|
return this.detail;
|
|
3666
3762
|
}
|
|
@@ -3690,6 +3786,8 @@ async function resolveWorktreePath(candidate) {
|
|
|
3690
3786
|
ancestor = parent;
|
|
3691
3787
|
}
|
|
3692
3788
|
}
|
|
3789
|
+
/** The canonical nearest existing ancestor; probes that need a real cwd run there. */
|
|
3790
|
+
const resolveExistingAncestor = async (candidate) => (await resolveWorktreePath(candidate)).existingAncestor;
|
|
3693
3791
|
/** One identity for existing and missing worktree paths; no writable-access requirement.
|
|
3694
3792
|
* Shared by destination locks, journal lookup and Git-registration comparisons.
|
|
3695
3793
|
*/
|
|
@@ -3700,23 +3798,37 @@ async function canonicalizeWorktreeDirectory(candidate) {
|
|
|
3700
3798
|
await access(resolved.existingAncestor, constants.W_OK | constants.X_OK);
|
|
3701
3799
|
return resolved.canonicalPath;
|
|
3702
3800
|
}
|
|
3703
|
-
|
|
3801
|
+
/**
|
|
3802
|
+
* Validate a node-local root setting (worktree root, chats folder). `label` names the setting in
|
|
3803
|
+
* user-facing errors.
|
|
3804
|
+
*/
|
|
3805
|
+
const validateWorktreeRoot = (value, policy, label = "Worktree root") => Effect.gen(function* () {
|
|
3704
3806
|
const trimmed = value.trim();
|
|
3705
3807
|
const expanded = expandHomePath(trimmed);
|
|
3706
|
-
if (!trimmed || /[\x00-\x1f\x7f]/.test(trimmed) || !path.isAbsolute(expanded) || process.platform === "win32" && !/^(?:[A-Za-z]:[\\/]|\\\\[^\\]+\\[^\\]+)/.test(expanded)) return yield* new WorktreeRootError({
|
|
3707
|
-
|
|
3808
|
+
if (!trimmed || /[\x00-\x1f\x7f]/.test(trimmed) || !path.isAbsolute(expanded) || process.platform === "win32" && !/^(?:[A-Za-z]:[\\/]|\\\\[^\\]+\\[^\\]+)/.test(expanded)) return yield* new WorktreeRootError({
|
|
3809
|
+
detail: `${label} must be an absolute directory on this node or start with ~/.`,
|
|
3810
|
+
reason: "unusable"
|
|
3811
|
+
});
|
|
3812
|
+
const operation = label.toLowerCase();
|
|
3813
|
+
const restricted = (cause) => new WorktreeRootError({
|
|
3814
|
+
detail: cause.message,
|
|
3815
|
+
reason: "restricted"
|
|
3816
|
+
});
|
|
3708
3817
|
const authorized = yield* policy.assertPath({
|
|
3709
3818
|
path: path.normalize(expanded),
|
|
3710
3819
|
operation
|
|
3711
|
-
}).pipe(Effect.mapError(
|
|
3820
|
+
}).pipe(Effect.mapError(restricted));
|
|
3712
3821
|
const canonical = yield* Effect.tryPromise({
|
|
3713
3822
|
try: () => canonicalizeWorktreeDirectory(authorized),
|
|
3714
|
-
catch: () => new WorktreeRootError({
|
|
3823
|
+
catch: () => new WorktreeRootError({
|
|
3824
|
+
detail: `${label} must resolve to a writable directory (or have a writable existing parent), without broken symlinks.`,
|
|
3825
|
+
reason: "unusable"
|
|
3826
|
+
})
|
|
3715
3827
|
});
|
|
3716
3828
|
return yield* policy.assertPath({
|
|
3717
3829
|
path: canonical,
|
|
3718
3830
|
operation
|
|
3719
|
-
}).pipe(Effect.mapError(
|
|
3831
|
+
}).pipe(Effect.mapError(restricted));
|
|
3720
3832
|
});
|
|
3721
3833
|
/** Storage selection only: this never grants access to the selected directory's contents. */
|
|
3722
3834
|
const selectConfiguredWorktreeRoot = (input) => (input.projectId && Object.hasOwn(input.settings.projectWorktreeRoots, input.projectId) ? input.settings.projectWorktreeRoots[input.projectId] : null) || input.settings.worktreeRoot || resolveManagedWorktreesRoot(input.config);
|
|
@@ -4086,12 +4198,13 @@ const makeServerSettings = Effect.gen(function* () {
|
|
|
4086
4198
|
updateSettings: (patch) => writeSemaphore.withPermits(1)(Effect.gen(function* () {
|
|
4087
4199
|
const current = yield* getSettingsFromCache;
|
|
4088
4200
|
const normalizedPatch = { ...patch };
|
|
4089
|
-
const validateRoot = (root) => validateWorktreeRoot(root, worktreeAccessPolicy).pipe(Effect.mapError((cause) => new ServerSettingsError({
|
|
4201
|
+
const validateRoot = (root, label) => validateWorktreeRoot(root, worktreeAccessPolicy, label).pipe(Effect.mapError((cause) => new ServerSettingsError({
|
|
4090
4202
|
settingsPath,
|
|
4091
4203
|
detail: cause.message,
|
|
4092
4204
|
cause
|
|
4093
4205
|
})));
|
|
4094
4206
|
if (patch.worktreeRoot) normalizedPatch.worktreeRoot = yield* validateRoot(patch.worktreeRoot);
|
|
4207
|
+
if (patch.chatsRoot) normalizedPatch.chatsRoot = yield* validateRoot(patch.chatsRoot, "Chats folder");
|
|
4095
4208
|
if (patch.projectWorktreeRoots !== void 0) {
|
|
4096
4209
|
const roots = [];
|
|
4097
4210
|
for (const [id, root] of Object.entries(patch.projectWorktreeRoots)) roots.push([id, root ? yield* validateRoot(root) : null]);
|
|
@@ -4414,4 +4527,4 @@ const providerTurnMetricAttributes = (input) => {
|
|
|
4414
4527
|
});
|
|
4415
4528
|
};
|
|
4416
4529
|
//#endregion
|
|
4417
|
-
export { makeWorkspaceAccessPolicy as $,
|
|
4530
|
+
export { makeWorkspaceAccessPolicy as $, resolvePromptInjectedEffort as $t, runtimeQueueBlockedDuration as A, DEFAULT_HUB_CONNECTOR_CONFIG as At, startupCommandGateQueueHighWater as B, resolveStaticDir as Bt, providerStartupQueueHighWater as C, captureWorktreeIdentity as Ct, providerTurnsTotal as D, mintStorageCleanupClaim as Dt, providerTurnMetricAttributes as E, removeVerifiedWorktree as Et, runtimeQueueHighWater as F, ensureServerDirectories as Ft, LocalDiagnosticsMetrics as G, getModelSelectionBooleanOptionValue as Gt, terminalRestartsTotal as H, applyClaudePromptEffortPrefix as Ht, runtimeQueueOverflowsTotal as I, resolveHubConnectorConfig as It, outcomeFromExit as J, getProviderOptionCurrentValue as Jt, LocalDiagnosticsMetricsLive as K, getModelSelectionStringOptionValue as Kt, runtimeQueueRecoveriesTotal as L, resolveManagedChatsRoot as Lt, runtimeQueueDepth as M, RuntimeMode as Mt, runtimeQueueDequeuesTotal as N, ServerConfig as Nt, rpcRequestDuration as O, acquireStorageSettingsLease as Ot, runtimeQueueEnqueuesTotal as P, deriveServerPaths as Pt, WorkspaceAccessPolicyLive as Q, normalizeModelSlug as Qt, startupCommandGateEnqueuesTotal as R, resolveManagedWorktreesRoot as Rt, providerStartupQueueDepth as S, assertCleanWorktree as St, providerTurnDuration as T, removeQuarantinedTemporaryDirectory as Tt, terminalSessionsTotal as U, createModelCapabilities as Ut, startupCommandGateQueueWaitDuration as V, parsePersistedServerObservabilitySettings as Vt, withMetrics as W, getModelDisplayLabel as Wt, ServerSettingsService as X, getProviderOptionStringSelectionValue as Xt, ServerSettingsLive as Y, getProviderOptionDescriptors as Yt, redactServerSettingsForClient as Z, modelSelectionRequiresContextHandoff as Zt, providerRuntimeEventsTotal as _, recordCreatedWorktree as _t, contextHandoffsTotal as a, equalNodeIdentityBytes as an, validateWorktreeRoot as at, providerStaleStopTimeoutsTotal as b, storagePathBlocker as bt, increment as c, normalizeHubNodeName as cn, ServerSecretStore as ct, orchestrationCommandAckDuration as d, encode as dn, acquireWorktreeCreationLease as dt, sameModelSelection as en, WorkspaceAccessPolicy as et, orchestrationCommandDuration as f, rfc8949EncodeOptions as fn, canonicalStoragePath as ft, providerMetricAttributes as g, noteStorageActivity as gt, providerEventLogRecordsDroppedTotal as h, isWorktreeRelocationBlocked as ht, contextHandoffPreparationDuration as i, encodeNodeKeyRotationTranscript as in, selectConfiguredWorktreeRoot as it, runtimeQueueCoalescedTotal as j, DEFAULT_PORT as jt, rpcRequestsTotal as k, hasStorageSettingsUpdateLease as kt, metricAttributes as l, Tokeniser as ln, writeFileStringAtomically as lt, orchestrationEventsProcessedTotal as m, isStoragePathBlocked as mt, contextHandoffContextEntriesTotal as n, encodeNativeNodeClaimTranscript as nn, resolveConfiguredWorktreeRoot as nt, gitCommandDuration as o, fingerprintNodePublicKey as on, expandHomePath as ot, orchestrationCommandsTotal as p, Type as pn, hasWorktreeCreationLease as pt, compactTraceAttributes as q, getProviderOptionBooleanSelectionValue as qt, contextHandoffDispatchDuration as r, encodeNodeAuthenticationTranscript as rn, resolveExistingAncestor as rt, gitCommandsTotal as s, formatNodePublicKeyFingerprint as sn, ServerSecretStoreLive as st, contextHandoffContextBytesTotal as t, canonicalizeHubOrigin as tn, canonicalizeWorktreePath as tt, metricNames as u, decode as un, acquireStoragePathUseLease as ut, providerRuntimeStaleEventsTotal as v, storageActivityVersion as vt, providerStartupQueueWaitDuration as w, measureDirectory as wt, providerStartupAdmissionTotal as x, assertCanonicalPath as xt, providerSessionsTotal as y, storageLifecycleLock as yt, startupCommandGateQueueDepth as z, resolveNodeE2eePolicyConfig as zt };
|