@ensocode/server 0.3.15-beta.239 → 0.3.15-beta.241
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/out/phone/assets/{EditDiff-CZAwhdT_.js → EditDiff-CSimrAEO.js} +1 -1
- package/out/phone/assets/{ReadFileView-mh_jsUup.js → ReadFileView-Jn3R6r7-.js} +1 -1
- package/out/phone/assets/{abnfDiagram-VCTEODGH-DtD268_6.js → abnfDiagram-VCTEODGH-fmoMWTbJ.js} +1 -1
- package/out/phone/assets/architecture-7GRP2DOG-sqU8jFuM.js +1 -0
- package/out/phone/assets/{architectureDiagram-5GKGNRK7-B-aYOAqp.js → architectureDiagram-5GKGNRK7-BVfM9qLh.js} +1 -1
- package/out/phone/assets/{blockDiagram-I7D4REHJ-CHvgs9_4.js → blockDiagram-I7D4REHJ-DVsjIiEb.js} +1 -1
- package/out/phone/assets/{c4Diagram-7LVT6UL2-DQZM5IBy.js → c4Diagram-7LVT6UL2-VdOATGT-.js} +1 -1
- package/out/phone/assets/channel-CbOf5_bF.js +1 -0
- package/out/phone/assets/{chunk-4HAMMTFA-C4MaRcS_.js → chunk-4HAMMTFA-BlmRWgVl.js} +1 -1
- package/out/phone/assets/{chunk-75Z2AOVW-CUJqmHkI.js → chunk-75Z2AOVW-B1Xx4VYV.js} +1 -1
- package/out/phone/assets/{chunk-DU6HZSFF-DtNotje4.js → chunk-DU6HZSFF-jZXKN9D0.js} +1 -1
- package/out/phone/assets/{chunk-F27PBJKO-C3VQP_G-.js → chunk-F27PBJKO-pe6xAY-J.js} +1 -1
- package/out/phone/assets/{chunk-GMAD6QVW-BAx6DPiq.js → chunk-GMAD6QVW-DwzdtwGU.js} +1 -1
- package/out/phone/assets/{chunk-GVQU2GXP-BOcjR7pN.js → chunk-GVQU2GXP-CCk8aXOq.js} +1 -1
- package/out/phone/assets/{chunk-IMKFNOWR-Ca86q7OY.js → chunk-IMKFNOWR-bNUmZDqg.js} +1 -1
- package/out/phone/assets/{chunk-L3NEJ4N5-CfYUzC3j.js → chunk-L3NEJ4N5-CUdCK-p_.js} +1 -1
- package/out/phone/assets/{chunk-OSK3NFVY-CNP8QwPS.js → chunk-OSK3NFVY-BTXa5Alc.js} +1 -1
- package/out/phone/assets/{chunk-P2QGCYS3-P5bFoLeX.js → chunk-P2QGCYS3-CF2JAuy1.js} +1 -1
- package/out/phone/assets/{chunk-POPQ4Y6H-CJomhwpw.js → chunk-POPQ4Y6H-BAnwlIFk.js} +1 -1
- package/out/phone/assets/{chunk-PWAF6VOD-DyMTCGaK.js → chunk-PWAF6VOD-BlFR6i6J.js} +1 -1
- package/out/phone/assets/{chunk-SHT3W25Y-mJ2zPnam.js → chunk-SHT3W25Y-DtR-NqyN.js} +1 -1
- package/out/phone/assets/{chunk-SVP7TREG-CdYqcKmY.js → chunk-SVP7TREG-DuaEOvLw.js} +1 -1
- package/out/phone/assets/{chunk-TICWLB2K-z-k2311x.js → chunk-TICWLB2K-BG4Kei8c.js} +1 -1
- package/out/phone/assets/classDiagram-ZZMXUADV-CIWF3pyh.js +1 -0
- package/out/phone/assets/classDiagram-v2-VYDZK3BY-CIWF3pyh.js +1 -0
- package/out/phone/assets/{codeHighlighter-ofRh4xLX.js → codeHighlighter-KH77fp0H.js} +1 -1
- package/out/phone/assets/{cynefin-OW5HDTMX-B8wb0nU4.js → cynefin-OW5HDTMX-n2BfpVsu.js} +1 -1
- package/out/phone/assets/{cynefinDiagram-5FMLGOSQ-BtGcxp6l.js → cynefinDiagram-5FMLGOSQ-DZqrq3oc.js} +1 -1
- package/out/phone/assets/{dagre-GXQ25YYZ-C2lcoUd4.js → dagre-GXQ25YYZ-HVsu_rPg.js} +1 -1
- package/out/phone/assets/{desk-CS8nrm0j.js → desk-z_cqgI4L.js} +2 -2
- package/out/phone/assets/{diagram-S7CK7UJ4-DEbZ0g_a.js → diagram-S7CK7UJ4-BZMmnDF5.js} +1 -1
- package/out/phone/assets/{diagram-UQ7AKVKN-CIRb6Yut.js → diagram-UQ7AKVKN-D8T63tql.js} +1 -1
- package/out/phone/assets/{diagram-VSXAHHWV-q1goodaw.js → diagram-VSXAHHWV-qPVtZ3Wt.js} +1 -1
- package/out/phone/assets/{diagram-VX7I27RA-B_haM3ye.js → diagram-VX7I27RA-CyEJ3aas.js} +1 -1
- package/out/phone/assets/{diagram-Z3DM3KII-DGxZgza1.js → diagram-Z3DM3KII-O3aOm1L8.js} +1 -1
- package/out/phone/assets/{ebnfDiagram-PWID7BFC-Dz-a1GEk.js → ebnfDiagram-PWID7BFC-Csdlx5oS.js} +1 -1
- package/out/phone/assets/{erDiagram-RLTQ6QDP-C3Q1YeMJ.js → erDiagram-RLTQ6QDP-DcUkeTEM.js} +1 -1
- package/out/phone/assets/eventmodeling-NTZA5JFV-jAd-hKjz.js +1 -0
- package/out/phone/assets/flowDiagram-HODETNUW-CcxYFoAM.js +1 -0
- package/out/phone/assets/{ganttDiagram-EL5Y4UJY-B-KFaZt7.js → ganttDiagram-EL5Y4UJY-BsohogYF.js} +1 -1
- package/out/phone/assets/{gitGraph-4MIJSDKK-6p4ChxFy.js → gitGraph-4MIJSDKK-bJ82NwBa.js} +1 -1
- package/out/phone/assets/{gitGraphDiagram-WWUBYQGX-0xHp9wXD.js → gitGraphDiagram-WWUBYQGX-B4kVWOxs.js} +1 -1
- package/out/phone/assets/{info-A6RAGUB7-D1A4c4Sg.js → info-A6RAGUB7-CtAEx6Uj.js} +1 -1
- package/out/phone/assets/{infoDiagram-27XIBGKW-DoeS9mLn.js → infoDiagram-27XIBGKW-NWXJXWIa.js} +1 -1
- package/out/phone/assets/{ishikawaDiagram-5VMMS53U-Ch3u7Wz6.js → ishikawaDiagram-5VMMS53U-DNZOHXyU.js} +1 -1
- package/out/phone/assets/{journeyDiagram-3NMN7TZE-CULvGf6o.js → journeyDiagram-3NMN7TZE-BILq8KCa.js} +1 -1
- package/out/phone/assets/{kanban-definition-UXKFOSKX-S1gQlAUD.js → kanban-definition-UXKFOSKX-DdZ5jVxU.js} +1 -1
- package/out/phone/assets/{line-Cm7lFbjW.js → line-Bo8uZJ4I.js} +1 -1
- package/out/phone/assets/{main-DdEaoHYI.js → main-C6jVGXbp.js} +5 -5
- package/out/phone/assets/{mermaid-parser.core-gQDTUPnF.js → mermaid-parser.core-B1syl2rc.js} +3 -3
- package/out/phone/assets/{mermaid.core-CYOjADrb.js → mermaid.core-96kZPVvg.js} +4 -4
- package/out/phone/assets/{mindmap-definition-YA3MSWOX-CN7sy__W.js → mindmap-definition-YA3MSWOX-CLzIHVmQ.js} +1 -1
- package/out/phone/assets/{packet-AYTQ26CC-DmgSr7TL.js → packet-AYTQ26CC-BBgqe8hX.js} +1 -1
- package/out/phone/assets/{pegDiagram-XKGWAZYB-B02NL9ni.js → pegDiagram-XKGWAZYB-CY_VEopq.js} +1 -1
- package/out/phone/assets/{pie-WAS4IAKB-5pPjCq92.js → pie-WAS4IAKB-of52Xr-X.js} +1 -1
- package/out/phone/assets/{pieDiagram-E7YTZNPT-DutkXKUS.js → pieDiagram-E7YTZNPT-mIG2cHsC.js} +1 -1
- package/out/phone/assets/{quadrantDiagram-AXDQQJYC-DUDIkWVS.js → quadrantDiagram-AXDQQJYC-ZC2ztpMA.js} +1 -1
- package/out/phone/assets/{radar-RG4KPBEZ-DC-CtYET.js → radar-RG4KPBEZ-BXO_8eMD.js} +1 -1
- package/out/phone/assets/{railroad-74A4TZTK-Bhfj7gvp.js → railroad-74A4TZTK-DSFZE_CO.js} +1 -1
- package/out/phone/assets/railroad-abnf-HS5TGJTU-Ch8xudvg.js +1 -0
- package/out/phone/assets/railroad-ebnf-LZEXJU2U-C3gTYu9G.js +1 -0
- package/out/phone/assets/railroad-peg-WCYAUIDC-r4pSaJqV.js +1 -0
- package/out/phone/assets/{railroadDiagram-O6MQD6OU-DlFKdEYr.js → railroadDiagram-O6MQD6OU-BhKGjvYs.js} +1 -1
- package/out/phone/assets/{requirementDiagram-BXWQKSXE-DgHN5by1.js → requirementDiagram-BXWQKSXE-DhYI3BgP.js} +1 -1
- package/out/phone/assets/{sankeyDiagram-P5KCCOFB-CgipqlWt.js → sankeyDiagram-P5KCCOFB-DUXZpMXR.js} +1 -1
- package/out/phone/assets/{sequenceDiagram-WJ2MYXX4-UgZtILgO.js → sequenceDiagram-WJ2MYXX4-BK3O5pAz.js} +1 -1
- package/out/phone/assets/{shellUpdate-CyY9ugiN.js → shellUpdate-DrB0t4Vm.js} +1 -1
- package/out/phone/assets/{stateDiagram-D77RDMKH-B3x2H6vo.js → stateDiagram-D77RDMKH-DrRcKs0R.js} +1 -1
- package/out/phone/assets/stateDiagram-v2-MP3YSRHH-DBTJhEN5.js +1 -0
- package/out/phone/assets/{swimlanes-42K2YHIH-DzeY11R8.js → swimlanes-42K2YHIH-BCd-QVVh.js} +1 -1
- package/out/phone/assets/swimlanesDiagram-VR7AAH4N-CY5PGCyR.js +8 -0
- package/out/phone/assets/{timeline-definition-24CTP7MA-0wZixfql.js → timeline-definition-24CTP7MA-DXe2OX47.js} +1 -1
- package/out/phone/assets/{treeView-Q6P3EWNA-w394XCr0.js → treeView-Q6P3EWNA-BRe0XDzs.js} +1 -1
- package/out/phone/assets/{treemap-WGGIJYW6-D2Zai2pY.js → treemap-WGGIJYW6-s1q2y2HB.js} +1 -1
- package/out/phone/assets/{vennDiagram-4TSXK5OY-JvkpTZVg.js → vennDiagram-4TSXK5OY-BGrxD8PX.js} +1 -1
- package/out/phone/assets/{wardley-WFR3VGLG-CnIC0T3M.js → wardley-WFR3VGLG-DO2WbZKB.js} +1 -1
- package/out/phone/assets/{wardleyDiagram-VM6X3IG4-Irrj8RCE.js → wardleyDiagram-VM6X3IG4-BBOgHvB9.js} +1 -1
- package/out/phone/assets/{xychartDiagram-S5SC5T6Z-BmtiUEnA.js → xychartDiagram-S5SC5T6Z-CWe0eCMj.js} +1 -1
- package/out/phone/desk.html +3 -3
- package/out/phone/index.html +3 -3
- package/out/phone/sw.js +2 -2
- package/out/renderer/assets/{EditDiff-DqoogY4S.js → EditDiff-Bd8hj9gf.js} +1 -1
- package/out/renderer/assets/{ReadFileView-uORu2Gdg.js → ReadFileView-Bbb7V3MH.js} +1 -1
- package/out/renderer/assets/{SidePanel-Dnt_MZWO.js → SidePanel-DML0yRbK.js} +1 -1
- package/out/renderer/assets/{abnfDiagram-VCTEODGH-BPj3_SYP.js → abnfDiagram-VCTEODGH-BLYUgV98.js} +1 -1
- package/out/renderer/assets/{arc-Bm9xu1Wo.js → arc-CDA8kxTv.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-5GKGNRK7-BfOWydj9.js → architectureDiagram-5GKGNRK7-D-JOyWkI.js} +1 -1
- package/out/renderer/assets/{blockDiagram-I7D4REHJ-7iL_f9Py.js → blockDiagram-I7D4REHJ-BZq1xS_g.js} +1 -1
- package/out/renderer/assets/{c4Diagram-7LVT6UL2-C-e_tKvj.js → c4Diagram-7LVT6UL2-DlrUI2mr.js} +1 -1
- package/out/renderer/assets/channel-BNg-RaaW.js +1 -0
- package/out/renderer/assets/{chunk-2Q5K7J3B-D4GmLDBL.js → chunk-2Q5K7J3B-Ecw5ByAe.js} +1 -1
- package/out/renderer/assets/{chunk-5VM5RSS4-ukWkkavu.js → chunk-5VM5RSS4-Bp_nwDzN.js} +1 -1
- package/out/renderer/assets/{chunk-F27PBJKO-72i3iG2c.js → chunk-F27PBJKO-B4M0cyLW.js} +1 -1
- package/out/renderer/assets/{chunk-IMKFNOWR-C1LBOV6P.js → chunk-IMKFNOWR-D3R3u0O-.js} +1 -1
- package/out/renderer/assets/{chunk-JWPE2WC7-D0xDlqyh.js → chunk-JWPE2WC7-B09_gtdy.js} +1 -1
- package/out/renderer/assets/{chunk-POPQ4Y6H-Qv-ey-sB.js → chunk-POPQ4Y6H-BvmgIk3A.js} +1 -1
- package/out/renderer/assets/{chunk-SVP7TREG-DcXPcP-s.js → chunk-SVP7TREG-DTaIzWhf.js} +1 -1
- package/out/renderer/assets/{chunk-TICWLB2K-LPyGLuzJ.js → chunk-TICWLB2K-u974J_2J.js} +1 -1
- package/out/renderer/assets/{chunk-XXDRQBXY-BIVCIrOg.js → chunk-XXDRQBXY-Bb-N5juq.js} +1 -1
- package/out/renderer/assets/classDiagram-ZZMXUADV-BpOHaGYe.js +1 -0
- package/out/renderer/assets/classDiagram-v2-VYDZK3BY-BpOHaGYe.js +1 -0
- package/out/renderer/assets/{cose-bilkent-JH36ORCC-DXibAGYE.js → cose-bilkent-JH36ORCC-_0KSMiyp.js} +1 -1
- package/out/renderer/assets/{cynefin-OW5HDTMX-Dt-aNI5c.js → cynefin-OW5HDTMX-DlJWTqrV.js} +1 -1
- package/out/renderer/assets/{cynefinDiagram-5FMLGOSQ-BXDhU25n.js → cynefinDiagram-5FMLGOSQ-YX_IQLVF.js} +1 -1
- package/out/renderer/assets/{dagre-GXQ25YYZ-H3A9EYBH.js → dagre-GXQ25YYZ-BacZro1G.js} +1 -1
- package/out/renderer/assets/{diagram-S7CK7UJ4-BkztC9a5.js → diagram-S7CK7UJ4-BdZsvDfO.js} +1 -1
- package/out/renderer/assets/{diagram-UQ7AKVKN-CSwMNUis.js → diagram-UQ7AKVKN-Bx7HSPaR.js} +1 -1
- package/out/renderer/assets/{diagram-VSXAHHWV-DKWQNU_X.js → diagram-VSXAHHWV-DRNaDs0S.js} +1 -1
- package/out/renderer/assets/{diagram-VX7I27RA-Bh8kGb8g.js → diagram-VX7I27RA-ykxcOFfg.js} +1 -1
- package/out/renderer/assets/{diagram-Z3DM3KII-Cumr98es.js → diagram-Z3DM3KII-C8r2pseZ.js} +1 -1
- package/out/renderer/assets/{ebnfDiagram-PWID7BFC-BTCksl6M.js → ebnfDiagram-PWID7BFC-XQ7lDc9Y.js} +1 -1
- package/out/renderer/assets/{erDiagram-RLTQ6QDP-DpjAcDW9.js → erDiagram-RLTQ6QDP-vKyTFhvS.js} +1 -1
- package/out/renderer/assets/{flowDiagram-HODETNUW-BUfu9Ylq.js → flowDiagram-HODETNUW-CfrgUHAS.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-EL5Y4UJY-DqB0xT46.js → ganttDiagram-EL5Y4UJY-kLRdxejO.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-WWUBYQGX-DWO9mHhX.js → gitGraphDiagram-WWUBYQGX-CORDJ_Ay.js} +1 -1
- package/out/renderer/assets/{index-oBYEGVaR.js → index-ZFFgI5ss.js} +147 -147
- package/out/renderer/assets/{infoDiagram-27XIBGKW-wvKtGi6y.js → infoDiagram-27XIBGKW-Cw6TRc_C.js} +1 -1
- package/out/renderer/assets/{ishikawaDiagram-5VMMS53U-DIJf-gVZ.js → ishikawaDiagram-5VMMS53U-SOVuP3c1.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-3NMN7TZE-D3Bjz_Oq.js → journeyDiagram-3NMN7TZE-3HTZmvUQ.js} +1 -1
- package/out/renderer/assets/{kanban-definition-UXKFOSKX-u9-8jhJ4.js → kanban-definition-UXKFOSKX-DpYipMmA.js} +1 -1
- package/out/renderer/assets/{layout-_p9_2zXV.js → layout-BwXeh9aP.js} +1 -1
- package/out/renderer/assets/{linear-Csj9U5Dq.js → linear-CR8355iJ.js} +1 -1
- package/out/renderer/assets/{mermaid.core-DYNgKgJW.js → mermaid.core-0Y0k-IR7.js} +5 -5
- package/out/renderer/assets/{mindmap-definition-YA3MSWOX-8HK_f66l.js → mindmap-definition-YA3MSWOX-FWFQgIj6.js} +1 -1
- package/out/renderer/assets/{pegDiagram-XKGWAZYB-D2vT8SZy.js → pegDiagram-XKGWAZYB-DM8j81UL.js} +1 -1
- package/out/renderer/assets/{pieDiagram-E7YTZNPT-DpU7X7GB.js → pieDiagram-E7YTZNPT-XB2jUWtG.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-AXDQQJYC-yVodPLsI.js → quadrantDiagram-AXDQQJYC-D9zVY5gu.js} +1 -1
- package/out/renderer/assets/{railroadDiagram-O6MQD6OU-C681oxL1.js → railroadDiagram-O6MQD6OU-BREkmdyd.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-BXWQKSXE-D7ywrtKP.js → requirementDiagram-BXWQKSXE-c-zsytxs.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-P5KCCOFB-C5F8hszf.js → sankeyDiagram-P5KCCOFB-B5k-1ijv.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-WJ2MYXX4-BQVLxqgL.js → sequenceDiagram-WJ2MYXX4-CSN_Fh8d.js} +1 -1
- package/out/renderer/assets/{sessionChanges-XLrYNBd5.js → sessionChanges-BEUiNgR0.js} +1 -1
- package/out/renderer/assets/{sizeCapture-INFHLROL-CQjsSghu.js → sizeCapture-INFHLROL-BKTOVTma.js} +1 -1
- package/out/renderer/assets/{stateDiagram-D77RDMKH-l8OzK7i6.js → stateDiagram-D77RDMKH-D9ZZYX6G.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-BRGfinuA.js +1 -0
- package/out/renderer/assets/{swimlanes-42K2YHIH-iFNrwywV.js → swimlanes-42K2YHIH-DP7c5A76.js} +1 -1
- package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-CffafTS2.js +8 -0
- package/out/renderer/assets/{timeline-definition-24CTP7MA-kv12syCn.js → timeline-definition-24CTP7MA-C0HwGCXi.js} +1 -1
- package/out/renderer/assets/{vennDiagram-4TSXK5OY-MQl2bz96.js → vennDiagram-4TSXK5OY-DRKPfvIL.js} +1 -1
- package/out/renderer/assets/{wardleyDiagram-VM6X3IG4-RABSCw_U.js → wardleyDiagram-VM6X3IG4-DU1_TBlT.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-S5SC5T6Z-B5-5ToKY.js → xychartDiagram-S5SC5T6Z-cRKyBsyE.js} +1 -1
- package/out/renderer/index.html +1 -1
- package/out/server/agent.js +4 -4
- package/out/server/chunks/{builtinOccupancy-nunr72_1.js → builtinOccupancy-K9RUDw3l.js} +3 -3
- package/out/server/chunks/{dispatchModel-Dx6bj4GE.js → dispatchModel-JnEtucdi.js} +2 -2
- package/out/server/chunks/{loadProvider-CGBwuI_o.js → loadProvider-B5WmMMag.js} +2 -2
- package/out/server/chunks/{menuSkills-CtGB8_pv.js → menuSkills-C-pqhzrG.js} +3 -3
- package/out/server/chunks/{projectCode-XQKRRChV.js → projectCode-CCHyotEp.js} +2 -2
- package/out/server/chunks/{web-ComQU7PG.js → web-B6yI7DUY.js} +2 -2
- package/out/server/chunks/{workflowPresets-c1VnWNBg.js → workflowPresets-_DQtzohi.js} +334 -222
- package/out/server/index.js +447 -264
- package/package.json +1 -1
- package/out/phone/assets/architecture-7GRP2DOG-DwD9pWke.js +0 -1
- package/out/phone/assets/channel-lquKKS5w.js +0 -1
- package/out/phone/assets/classDiagram-ZZMXUADV-CLQrkAdv.js +0 -1
- package/out/phone/assets/classDiagram-v2-VYDZK3BY-CLQrkAdv.js +0 -1
- package/out/phone/assets/eventmodeling-NTZA5JFV-FosgawEZ.js +0 -1
- package/out/phone/assets/flowDiagram-HODETNUW-BklgCWjp.js +0 -1
- package/out/phone/assets/railroad-abnf-HS5TGJTU-DqHhYDlp.js +0 -1
- package/out/phone/assets/railroad-ebnf-LZEXJU2U-DHa2oESM.js +0 -1
- package/out/phone/assets/railroad-peg-WCYAUIDC-CmnmPChu.js +0 -1
- package/out/phone/assets/stateDiagram-v2-MP3YSRHH-D-IWJhTN.js +0 -1
- package/out/phone/assets/swimlanesDiagram-VR7AAH4N-DE_9MT5v.js +0 -8
- package/out/renderer/assets/channel-BXUzcBZ2.js +0 -1
- package/out/renderer/assets/classDiagram-ZZMXUADV-Ov66-2se.js +0 -1
- package/out/renderer/assets/classDiagram-v2-VYDZK3BY-Ov66-2se.js +0 -1
- package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-DCF99maM.js +0 -1
- package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-CKuCgjAl.js +0 -8
package/out/server/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { createDecipheriv, randomBytes, createCipheriv, randomUUID, createHash,
|
|
|
7
7
|
import { EventEmitter, addAbortListener } from "node:events";
|
|
8
8
|
import os, { homedir, tmpdir, userInfo } from "node:os";
|
|
9
9
|
import { G as providerProxyFetch, J as isValidProxyUrl, a as parseProviderProxy, L as resolveDisabledBuiltinTools, N as projectDisabledBuiltinTools, O as wrapPluginDelivery, P as persistedSettingsState, Q as proxyEnvPatchFromEnv, U as parseWebSearchChain, V as isMediaId, w as wrapUntrusted, W as readableText, X as chunkMessageText, Y as projectReadableMessages, S as SEND_IMAGE_CAPTION_MAX, s as sendImageItems, Z as effectiveSubagentAllowedModes, _ as isUnitType, C as CRYSTAL_MIN_SOURCES, $ as sameProviderProxy, a0 as proxyUrlHasCredentials, a1 as redactProxyUrlCredentials, a2 as normalizeProxyMode, a3 as parseResolveProxy, a4 as mergeNoProxy, a5 as DEFAULT_NO_PROXY, a6 as proxyEnvPatch, a7 as redactSecrets$2, a8 as unescapeUntrusted } from "./chunks/sendImage-BmenO8Vx.js";
|
|
10
|
-
import { bY as parseChildConversationMetadata, bZ as isVirtualRef, bJ as isClassifierOnlyProvider, bK as isOauthAccountPool, b_ as eligibleOauthPoolAccountKeys, b$ as findVirtualModel, a8 as isCodexAccountKey, ao as takeSnapshotTail,
|
|
10
|
+
import { bY as parseChildConversationMetadata, bZ as isVirtualRef, bJ as isClassifierOnlyProvider, bK as isOauthAccountPool, b_ as eligibleOauthPoolAccountKeys, b$ as findVirtualModel, c0 as createEventStream, c1 as startOauthCallbackServer, c2 as waitForOauthCallbackCode, a8 as isCodexAccountKey, ao as takeSnapshotTail, c3 as OVERVIEW_TAIL_MESSAGES, c4 as OVERVIEW_BYTE_BUDGET, c5 as syncAccountProviders, c6 as expandOauthCatalog, c7 as supportsMultipleAccounts, c8 as parseCodexAuthJson, c9 as CODEX_PROVIDER_ID, ca as nextAccountKey, cb as sanitizeUpstreamBody, bF as installCodexLinkedRefresh, cc as defaultCodexAuthPath, by as ANTIGRAVITY_PROVIDER_ID, bz as antigravityProviderConfig, bA as DEVIN_PROVIDER_ID, bB as devinProviderConfig, bC as QODER_PROVIDER_ID, bD as qoderProviderConfig, bE as QODER_CN_PROVIDER_ID, aV as providerIdOfAccountKey, cd as ordinalOfAccountKey, aa as ensureAccountProvider, ce as sanitizeOauthLabel, cf as parseAntigravityApiKey, cg as fetchAntigravityUsage, ch as fetchDevinUsage, J as parseProviderHeaders, M as MODEL_API_KINDS, ci as DEFAULT_PERSONA_PROMPT, cj as isAppLoggingEnabled, aU as setAppLoggingEnabled, ck as normalizeSshTimeoutSeconds, bM as resolveEditMode, cl as isEditMode, A as AGENT_WORKER_CRASH_FILE, cm as parseAgentWorkerCrash, a as appendCappedLog, cn as AGENT_WORKER_EXIT_LOG, bu as WORKSPACE_WRITE_TOOL_ID, co as activeDcgExemptions, cp as listActiveDcgExemptions, cq as dcgRuleState, cr as parseDcgRuleMemory, cs as emptyDcgRuleMemory, ct as removeDcgExemption, cu as addDcgExemption, cv as recordDcgRuleAllow, au as ELEVATE_TIMEOUT_MS, s as shellQuote, av as ELEVATE_UNAVAILABLE_MARKER, at as ELEVATE_TIMED_OUT_MARKER, as as ELEVATE_DECLINED_MARKER, cw as elevatedCommandOf, bG as isHeadlessRun, cx as parseRestartCheckpoint, a2 as mcpOAuthFingerprint, a1 as MCP_OAUTH_REFRESH_SKEW_MS, H as readModelsDevCache, cy as MODELS_DEV_URL, cz as writeModelsDevCache, cA as parseModelsDevPayload, cB as MODELS_DEV_CACHE_NAME, cC as modelsDevIsFresh, K as parseModelDirectorySnapshot, cD as withModelsDevOauthModels, bT as PRIVACY_MASK_ENTRY, cE as parsePrivacyMaskRecord, ai as rootIdOfReminder, aQ as toReminderSummary, aP as REMINDERS_FILE, af as parseReminderFile, cF as remindersOf, cG as hasProviderCredentials, T as MODEL_REASONING_OVERRIDES, U as MODEL_THINKING_LEVEL_OVERRIDES, cH as appUserImageDirs, bU as APP_LOGGING_ENV, bW as RESTART_CHECKPOINT_ENV, aq as ELEVATE_ASKPASS_ENV, cI as parseAgentWorkerEvent, cJ as describeAgentWorkerExit, bm as RESTART_CHECKPOINT_FILE, cK as SECRETARY_FORCED_DISABLED_TOOLS, cL as parseWindowsLocalShell, aY as resolveCompactStrategy, cM as parseSmartCompactMode, cN as SECRETARY_ALWAYS_ENABLED_TOOLS, ap as childProfileShell, cO as sweepOrphanMcpServers, aR as MCP_SERVER_REGISTRY_DIR, cP as resolveImageGenerationConfig, cQ as normalizeMaxActiveCoworkers, cR as normalizeAutoRetryLimit, cS as parsePrivacyMaskSettings, cT as reminderReviveDelay, cU as directMemberRef, p as parseApprovalAllowThreshold, cV as DEFAULT_APPROVAL_ALLOW_THRESHOLD, bX as parseAgentCommand, cW as resolveShellLimits, cX as materializeProviders, k as providerKeyFor, cY as parseVirtualModels, V as VIRTUAL_PROVIDER_ID, cZ as classifierProviderFor, c_ as classifierBaseUrlFor, c$ as childProfileToolIds, d0 as pickModelCapabilityOverrides, d1 as canBeVirtualMember, d2 as mcpTimeoutsForSpawn, bg as parseJsonFromAssistant, bh as validateAgainstSchema, d3 as AGENT_TASK_MAX_RESUMES, d4 as AGENT_WAIT_DEFAULT_MS, d5 as AGENT_WAIT_MAX_MS, ba as classifyUpstreamError, b0 as HUMAN_REQUEST_TIMEOUT_MS, a7 as projectMessage, d6 as sessionEntryToContextMessages, d7 as withPrivacyMask, d8 as withUserEntryIds, d9 as LOCAL_IMAGE_SCHEME, da as REMOTE_FETCH_HOST, db as BOT_AVATAR_HOST, dc as SECRETARY_AVATAR_HOST, dd as PLUGIN_ASSET_HOST, de as SECRETARY_REPORT_HOST, df as mediaExtension, dg as localImageUrlToPath, dh as isMediaPath, di as isVideoPath, dj as IMAGE_EXTENSIONS$1, dk as isDeliveryId, dl as SNAPSHOT_TAIL_MESSAGES, dm as splitUnattendedPrefix, dn as userTextWithoutSkills, dp as withoutQuoteBlocks, dq as quotesAsMarkdown, dr as splitPlanPrefix, ds as parseGoalResultView, dt as parseSecretarySkillDraft, du as parseSecretaryToolDraft, dv as hasNeedsUser, dw as shownNeedsUser, dx as stripGoalResultNeedsUser, dy as nextPendingReminder, dz as needsUserItems, az as resolveRoots, dA as defaultImageRoots, ay as readImageView, dB as classifyCommand, dC as formatGoalResultClaims, dD as parseGoalUpstreamRetry, dE as formatGoalResultChecks, dF as escalateGoalResultNeedsUser, dG as answerGoalResultNeedsUser, dH as nextPendingRetryDelayMs, aE as SECRETARY_ATTACHMENT_PATH_MAX, aH as SECRETARY_ATTACHMENT_MAX, aF as SECRETARY_SEND_MODES, aC as SECRETARY_ID_MAX, aG as SECRETARY_SESSION_MESSAGE_MAX, dI as probeImageView, dJ as isSecretarySlug, dK as secretaryToolScriptFile, dL as parseSecretaryToolFile, dM as renderSecretaryToolFile, dN as secretaryToolDescriptor, dO as TOOL_TIMEOUT_DEFAULT, dP as TOOL_OUTPUT_MAX, dQ as inImageViewScope, dR as IMAGE_VIEW_MAX_BYTES, aA as systemImageRoots, dS as isSecretarySkillName, aD as SECRETARY_CONTACT_CAPTION_MAX, dT as validateScopedFile, dU as readImageFacts, dV as removeSessionTempDir, dW as resolveSshTarget, dX as nextUpstreamRetryAt, dY as checkPassed, dZ as checkFailureText, d_ as parseVirtualClassifier, d$ as VIRTUAL_CLASSIFIER_DEFAULT_TIMEOUT_MS, bp as buildInitialTitleUserText, br as TITLE_SYSTEM_PROMPT, bc as buildTurnDigest, bq as ROLLING_TITLE_SYSTEM_PROMPT, bo as buildRollingTitleUserText, bv as titleSummaryTimeoutMs, bs as extractTitle, bt as titleRejectReason, e0 as parseCreateConversationAuthorityRequest, e1 as parseConversationAuthorityRequest, e2 as parseUpdateConversationSelectionRequest, e3 as parseTitleSummaryInput, e4 as parseParentSourceBindingRequest, e5 as parseParentModelSelectionRequest, e6 as parseAgentDispatchRequest, e7 as isApprovalDecision, e8 as TASK_KEEP_REASON_MAX, e9 as EnsoSafeJournal, aX as STALE_SESSION_ERROR, ea as isSecretFilePath, eb as isUnderSecretDirectory, ec as cleanToolBatchLabel, ed as toolBatchLabelPrompt, ee as TOOL_BATCH_LABEL_SYSTEM_PROMPT, h as estimateSkillTokens, j as estimateInstructionTokens, ef as estimateToolsTotal, $ as assignMcpToolNames, a0 as createStdioTransport, b3 as listWorkflowPresets, b2 as workflowPresetRoots, eg as listCustomWorkflowPresets, eh as listBuiltinWorkflowPresets, ei as readCustomWorkflowPreset, ej as parseWorkflowPresetDraft, ek as saveCustomWorkflowPreset, el as deleteCustomWorkflowPreset, em as parseBtwPromptRequest, en as btwModelCandidates, eo as TITLE_SUMMARY_MAX_CANDIDATES, ep as parseBtwAbortRequest, eq as parseBtwSpawnRequest, er as BTW_DISABLED_TOOLS, es as parseBtwDisposeRequest, et as isDcgRuleId, aZ as createSshExecutor, eu as isHumanRequestTimeout, ev as buildSshExecArgs, ew as buildRemoteCommand, bQ as sshPasswordEnv, ex as listProjectCodeSources, ey as parseCreateProjectAuthorityRequest, ez as parseSelectProjectAuthorityRequest, eA as parseRemoveProjectAuthorityRequest, eB as withVersionSegment, eC as DEFAULT_BASE_URLS, eD as positiveFiniteNumber, a5 as isXaiChatModelId, eE as mergeFetchedOauthModels, eF as catalogModelLookup, Q as mergeCatalogEntry, eG as supportedProjectThinkingLevels, eH as upstreamContinuationText, eI as needsUserTriageDeadline, eJ as shouldSilenceTurn, eK as sessionIdsInUpdates, eL as messageText$1, eM as isPureSessionUpdate, eN as formatRetryClock, eO as hasPendingReminder, eP as formatReminderClock, eQ as buildSshPtyArgs, bP as resolveSshControlPath, I as version$1, eR as ENSO_HEADLESS_RUN_ENV } from "./chunks/workflowPresets-_DQtzohi.js";
|
|
11
11
|
import { f as isSameChildSessionIdentity, n as isReservedAgentTypeName, o as BUILTIN_AGENT_TYPES, q as PLUGIN_HOST_APIS, m as pluginToolName, r as PLUGIN_INJECT_MAX_CHARS, s as PLUGIN_AGENT_RUN_ID, t as PLUGIN_AGENT_PROMPT_MAX_CHARS, u as PLUGIN_AGENT_SYSTEM_MAX_CHARS, v as PLUGIN_AGENT_DEFAULT_TIMEOUT_MS, w as PLUGIN_AGENT_MAX_TIMEOUT_MS, x as parsePluginInjectImages, b as parsePluginInjectSender, y as isHostPluginEvent, z as parsePluginToolName, D as initialInterceptState, c as isChildInterceptEvent, E as CHILD_INTERCEPT_TOTAL_TIMEOUT_MS, I as INTERCEPT_TOTAL_TIMEOUT_MS, F as CHILD_INTERCEPT_TIMEOUT_MS, G as INTERCEPT_TIMEOUT_MS, H as applyInterceptResult, J as failClosedResult, l as pluginFailureLogLevel, O as OBSERVE_TIMEOUT_MS, K as BEFORE_COMPACT_TIMEOUT_MS, L as PLUGIN_PROGRESS_MAX_CHARS, M as MCP_TRANSPORTS, N as parseDisabledWorkflowPresets, Q as visibleMemberAgentTypes, R as buildAgentTypeRegistrySnapshot, S as DEFAULT_PRESET_ID, T as PLUGIN_INJECT_WIRE_MAX_CHARS, p as parseChildSessionIdentity, i as isUuid } from "./chunks/killTree-T-p6Lr3w.js";
|
|
12
12
|
import { T as THINKING_LEVELS, A as APPROVAL_MODES$1, a as TURN_REPORT_MAX_CHARS } from "./chunks/agentConstants-D4t7d6iS.js";
|
|
13
13
|
import { b as SECRETARY_IMAGES_REL, d as SECRETARY_REPORTS_REL, e as chromiumRole, A as AGENT_SERVICE_NAME, f as descendantPids, g as commandLabel, h as parseWinProcesses, i as parsePsArgs, j as parsePs, k as cpuPercent, l as isCleanableStorageCategory, m as parseSessionCleanRequest } from "./chunks/resources-BfbTkFP0.js";
|
|
@@ -889,6 +889,31 @@ const zhTranslations = {
|
|
|
889
889
|
"Log out": "退出登录",
|
|
890
890
|
"Starting login...": "正在启动登录…",
|
|
891
891
|
"Complete authorization in your browser": "请在浏览器中完成授权",
|
|
892
|
+
"Sign in to Devin in your browser.": "请在浏览器中登录 Devin。",
|
|
893
|
+
"Waiting for browser authentication...": "正在等待浏览器完成授权…",
|
|
894
|
+
"Exchanging authorization code for tokens...": "正在用授权码换取令牌…",
|
|
895
|
+
"After you authorize, the browser opens a localhost page that will not load. Paste the full address from the address bar here.": "授权完成后,浏览器会跳到打不开的 localhost 页面。把地址栏里的完整链接粘贴到这里。",
|
|
896
|
+
"The link does not match this authorization. Copy the latest address again.": "链接与本次授权不匹配,请重新复制最新的地址",
|
|
897
|
+
"That input has no authorization code. Paste the full localhost address from the address bar.": "这里没有授权码。请粘贴地址栏里的完整 localhost 链接。",
|
|
898
|
+
"That is not an authorization callback address.": "这不是授权回调地址",
|
|
899
|
+
"Paste a Qoder Personal Access Token (pt-...), or leave empty for browser login": "粘贴 Qoder 个人访问令牌(pt-...),或留空走浏览器登录",
|
|
900
|
+
"Paste a Qoder CN Personal Access Token, or leave empty to cancel": "粘贴 Qoder CN 个人访问令牌,或留空取消",
|
|
901
|
+
"Paste your Qoder Personal Access Token (pt-...)": "请粘贴 Qoder 个人访问令牌(pt-...)",
|
|
902
|
+
"Paste your Qoder CN Personal Access Token": "请粘贴 Qoder CN 个人访问令牌",
|
|
903
|
+
"Please complete login in your browser...": "请在浏览器中完成登录…",
|
|
904
|
+
"Click to sign in with your Qoder account in the browser.": "点此在浏览器中使用 Qoder 账号登录。",
|
|
905
|
+
"Exchanging access token...": "正在交换访问令牌…",
|
|
906
|
+
"Fetching user profile...": "正在获取用户资料…",
|
|
907
|
+
"Login successful!": "登录成功",
|
|
908
|
+
"Login cancelled": "登录已取消",
|
|
909
|
+
"No Personal Access Token provided": "未提供个人访问令牌",
|
|
910
|
+
"Qoder device login network error": "Qoder 设备登录网络出错",
|
|
911
|
+
"Authorization timed out": "授权超时",
|
|
912
|
+
"Device token poll returned invalid response": "设备登录返回了无效响应",
|
|
913
|
+
"Device token poll returned empty access token": "设备登录没有返回访问令牌",
|
|
914
|
+
"OAuth login ended unexpectedly": "登录意外结束",
|
|
915
|
+
"Verify OAuth": "验证用 OAuth",
|
|
916
|
+
"Verify Device": "验证用设备码",
|
|
892
917
|
"Open authorization page": "打开授权页面",
|
|
893
918
|
"Enter code": "输入代码",
|
|
894
919
|
"Verifying...": "正在验证…",
|
|
@@ -957,7 +982,7 @@ const zhTranslations = {
|
|
|
957
982
|
Exit: "退出",
|
|
958
983
|
// 统一的供应商设置、默认模型与 Enso
|
|
959
984
|
"Add a provider subscription or API Key, or import providers from local AI apps": "添加服务商订阅或 API Key,也可从本地 AI 应用导入服务商",
|
|
960
|
-
"Add model or provider": "
|
|
985
|
+
"Add model or provider": "添加模型或服务商",
|
|
961
986
|
"Import providers from local apps or use the unified setup to get started": "从本地应用导入服务商,或使用统一向导开始配置",
|
|
962
987
|
"Choose a provider first. You will select subscription or API Key next.": "请先选择服务商,下一步再选择订阅或 API Key。",
|
|
963
988
|
"Choose how to connect": "选择连接方式",
|
|
@@ -3968,18 +3993,18 @@ const EMBEDDING_MODEL_PATTERN = /embed|bge|m3e|voyage|jina|nomic|mxbai|stella|co
|
|
|
3968
3993
|
function isLikelyEmbeddingModelId(id) {
|
|
3969
3994
|
return EMBEDDING_MODEL_PATTERN.test(id);
|
|
3970
3995
|
}
|
|
3971
|
-
function embeddingModelsOf(
|
|
3972
|
-
return Array.isArray(
|
|
3996
|
+
function embeddingModelsOf(provider2) {
|
|
3997
|
+
return Array.isArray(provider2.models) ? provider2.models.filter((m) => typeof m?.id === "string" && isLikelyEmbeddingModelId(m.id)) : [];
|
|
3973
3998
|
}
|
|
3974
3999
|
function remoteEmbeddingIssue(input) {
|
|
3975
|
-
const { providerId, provider, modelId } = input;
|
|
4000
|
+
const { providerId, provider: provider2, modelId } = input;
|
|
3976
4001
|
if (!providerId) return "no-provider";
|
|
3977
|
-
if (!
|
|
3978
|
-
if (!
|
|
3979
|
-
if (typeof
|
|
4002
|
+
if (!provider2) return "provider-missing";
|
|
4003
|
+
if (!provider2.apiKey) return "no-api-key";
|
|
4004
|
+
if (typeof provider2.baseUrl !== "string" || !provider2.baseUrl.trim()) return "no-base-url";
|
|
3980
4005
|
if (!modelId || modelId === REMOTE_EMBEDDING_SENTINEL_MODEL) return "no-model";
|
|
3981
4006
|
if (isLikelyEmbeddingModelId(modelId)) return null;
|
|
3982
|
-
return embeddingModelsOf(
|
|
4007
|
+
return embeddingModelsOf(provider2).length > 0 ? "not-embedding-model" : "no-embedding-models";
|
|
3983
4008
|
}
|
|
3984
4009
|
const ISSUE_KEYS = {
|
|
3985
4010
|
"no-provider": "No remote embedding provider is selected. Choose a provider with an API key, or switch to a local embedding model.",
|
|
@@ -6325,38 +6350,38 @@ function modelUsability(selection, providers2, credentials, virtualModels) {
|
|
|
6325
6350
|
if (!entry.enabled) return "model-disabled";
|
|
6326
6351
|
return modelUsability(entry.primary, providers2, credentials);
|
|
6327
6352
|
}
|
|
6328
|
-
const
|
|
6329
|
-
if (!
|
|
6330
|
-
if (!
|
|
6331
|
-
if (isClassifierOnlyProvider(
|
|
6332
|
-
const model =
|
|
6353
|
+
const provider2 = providers2.find((entry) => entry.id === selection.providerId);
|
|
6354
|
+
if (!provider2) return "provider-missing";
|
|
6355
|
+
if (!provider2.enabled) return "provider-disabled";
|
|
6356
|
+
if (isClassifierOnlyProvider(provider2)) return "classifier-only";
|
|
6357
|
+
const model = provider2.models.find((entry) => entry.id === selection.modelId);
|
|
6333
6358
|
if (!model) return "model-missing";
|
|
6334
6359
|
if (model.enabled === false) return "model-disabled";
|
|
6335
|
-
if (
|
|
6360
|
+
if (provider2.oauthAccountPool !== void 0 && !isOauthAccountPool(provider2))
|
|
6336
6361
|
return "oauth-account-missing";
|
|
6337
|
-
if (!
|
|
6362
|
+
if (!provider2.oauthAccountKey) return provider2.apiKey ? "usable" : "api-key-missing";
|
|
6338
6363
|
if (credentials.oauthCredentials.status !== "ready") {
|
|
6339
6364
|
return oauthCredentialBlock(credentials)?.reason ?? "oauth-credentials-error";
|
|
6340
6365
|
}
|
|
6341
|
-
if (isOauthAccountPool(
|
|
6366
|
+
if (isOauthAccountPool(provider2)) {
|
|
6342
6367
|
return eligibleOauthPoolAccountKeys(
|
|
6343
|
-
|
|
6368
|
+
provider2,
|
|
6344
6369
|
selection.modelId,
|
|
6345
6370
|
providers2,
|
|
6346
6371
|
credentials.oauthCredentials.authenticatedAccountKeys
|
|
6347
6372
|
).length > 0 ? "usable" : "oauth-account-missing";
|
|
6348
6373
|
}
|
|
6349
|
-
return credentials.oauthCredentials.authenticatedAccountKeys.has(
|
|
6374
|
+
return credentials.oauthCredentials.authenticatedAccountKeys.has(provider2.oauthAccountKey) ? "usable" : "oauth-account-missing";
|
|
6350
6375
|
}
|
|
6351
6376
|
function isUsableModel(selection, providers2, credentials, virtualModels) {
|
|
6352
6377
|
return modelUsability(selection, providers2, credentials, virtualModels) === "usable";
|
|
6353
6378
|
}
|
|
6354
6379
|
function isUsableApprovalClassifier(selection, providers2) {
|
|
6355
6380
|
if (!selection) return false;
|
|
6356
|
-
const
|
|
6357
|
-
if (!
|
|
6358
|
-
if (!
|
|
6359
|
-
const model =
|
|
6381
|
+
const provider2 = providers2.find((entry) => entry.id === selection.providerId);
|
|
6382
|
+
if (!provider2?.enabled || !isClassifierOnlyProvider(provider2)) return false;
|
|
6383
|
+
if (!provider2.apiKey || provider2.oauthAccountKey) return false;
|
|
6384
|
+
const model = provider2.models.find((entry) => entry.id === selection.modelId);
|
|
6360
6385
|
return Boolean(model && model.enabled !== false);
|
|
6361
6386
|
}
|
|
6362
6387
|
function isUsableApprovalReviewer(reviewer, providers2, credentials) {
|
|
@@ -6887,6 +6912,153 @@ function kimiCodingBearerToken(headers) {
|
|
|
6887
6912
|
const match = /^Bearer\s+(\S+)/i.exec(raw.trim());
|
|
6888
6913
|
return match?.[1];
|
|
6889
6914
|
}
|
|
6915
|
+
const VERIFY_OAUTH_PROVIDER_ID = "__verify__";
|
|
6916
|
+
const VERIFY_DEVICE_PROVIDER_ID = "__verify-device__";
|
|
6917
|
+
const VERIFY_DEVICE_USER_CODE = "WXYZ-1234";
|
|
6918
|
+
const VERIFY_API = "verify-oauth";
|
|
6919
|
+
const VERIFY_MODEL = {
|
|
6920
|
+
id: "verify-stub",
|
|
6921
|
+
name: "Verify Stub",
|
|
6922
|
+
reasoning: false,
|
|
6923
|
+
input: ["text"],
|
|
6924
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
6925
|
+
contextWindow: 8e3,
|
|
6926
|
+
maxTokens: 1024
|
|
6927
|
+
};
|
|
6928
|
+
function verifyOauthBase() {
|
|
6929
|
+
const raw = process.env.ENSO_VERIFY_OAUTH_BASE?.trim();
|
|
6930
|
+
if (!raw) throw new Error("ENSO_VERIFY_OAUTH_BASE is not set");
|
|
6931
|
+
return raw.replace(/\/+$/, "");
|
|
6932
|
+
}
|
|
6933
|
+
function verifyOauthEnabled(isPackaged) {
|
|
6934
|
+
return process.env.ENSO_VERIFY === "1" && !isPackaged;
|
|
6935
|
+
}
|
|
6936
|
+
async function exchangeVerifyCode(base, code, state, signal) {
|
|
6937
|
+
const response = await fetch(`${base}/token`, {
|
|
6938
|
+
method: "POST",
|
|
6939
|
+
headers: { "Content-Type": "application/json" },
|
|
6940
|
+
body: JSON.stringify({ code, state }),
|
|
6941
|
+
signal
|
|
6942
|
+
});
|
|
6943
|
+
if (!response.ok) throw new Error(`verify oauth token endpoint returned ${response.status}`);
|
|
6944
|
+
const data = await response.json();
|
|
6945
|
+
if (typeof data.access_token !== "string" || !data.access_token) {
|
|
6946
|
+
throw new Error("verify oauth token endpoint returned no access token");
|
|
6947
|
+
}
|
|
6948
|
+
if (typeof data.refresh_token !== "string" || !data.refresh_token) {
|
|
6949
|
+
throw new Error("verify oauth token endpoint returned no refresh token");
|
|
6950
|
+
}
|
|
6951
|
+
const expiresIn = typeof data.expires_in === "number" && Number.isFinite(data.expires_in) ? data.expires_in : 3600;
|
|
6952
|
+
return {
|
|
6953
|
+
access: data.access_token,
|
|
6954
|
+
refresh: data.refresh_token,
|
|
6955
|
+
expires: Date.now() + expiresIn * 1e3
|
|
6956
|
+
};
|
|
6957
|
+
}
|
|
6958
|
+
async function loginWithCallback(callbacks) {
|
|
6959
|
+
const base = verifyOauthBase();
|
|
6960
|
+
const state = randomBytes(16).toString("hex");
|
|
6961
|
+
const server2 = await startOauthCallbackServer({
|
|
6962
|
+
preferredPort: 0,
|
|
6963
|
+
callbackPath: "/callback",
|
|
6964
|
+
expectedState: state,
|
|
6965
|
+
signal: callbacks.signal,
|
|
6966
|
+
onProgress: callbacks.onProgress
|
|
6967
|
+
});
|
|
6968
|
+
try {
|
|
6969
|
+
const params = new URLSearchParams({
|
|
6970
|
+
client_id: "enso-verify",
|
|
6971
|
+
response_type: "code",
|
|
6972
|
+
redirect_uri: server2.redirectUri,
|
|
6973
|
+
state
|
|
6974
|
+
});
|
|
6975
|
+
callbacks.onAuth({
|
|
6976
|
+
url: `${base}/authorize?${params.toString()}`,
|
|
6977
|
+
instructions: "Complete authorization in your browser"
|
|
6978
|
+
});
|
|
6979
|
+
callbacks.onProgress?.("Waiting for browser authentication...");
|
|
6980
|
+
const code = await waitForOauthCallbackCode(
|
|
6981
|
+
server2,
|
|
6982
|
+
(request2) => callbacks.onPrompt(request2),
|
|
6983
|
+
callbacks.signal
|
|
6984
|
+
);
|
|
6985
|
+
callbacks.onProgress?.("Exchanging authorization code for tokens...");
|
|
6986
|
+
return exchangeVerifyCode(base, code, state, callbacks.signal);
|
|
6987
|
+
} finally {
|
|
6988
|
+
server2.close();
|
|
6989
|
+
}
|
|
6990
|
+
}
|
|
6991
|
+
function delay(ms, signal) {
|
|
6992
|
+
return new Promise((resolve2, reject) => {
|
|
6993
|
+
if (signal?.aborted) {
|
|
6994
|
+
reject(new Error("登录已取消"));
|
|
6995
|
+
return;
|
|
6996
|
+
}
|
|
6997
|
+
const timer2 = setTimeout(() => {
|
|
6998
|
+
signal?.removeEventListener("abort", onAbort);
|
|
6999
|
+
resolve2();
|
|
7000
|
+
}, ms);
|
|
7001
|
+
const onAbort = () => {
|
|
7002
|
+
clearTimeout(timer2);
|
|
7003
|
+
reject(new Error("登录已取消"));
|
|
7004
|
+
};
|
|
7005
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
7006
|
+
});
|
|
7007
|
+
}
|
|
7008
|
+
async function loginWithDevice(callbacks) {
|
|
7009
|
+
const base = verifyOauthBase();
|
|
7010
|
+
callbacks.onDeviceCode({
|
|
7011
|
+
userCode: VERIFY_DEVICE_USER_CODE,
|
|
7012
|
+
verificationUri: `${base}/device`
|
|
7013
|
+
});
|
|
7014
|
+
callbacks.onProgress?.("Enter the code in your browser");
|
|
7015
|
+
const deadline = Date.now() + 3e5;
|
|
7016
|
+
while (!callbacks.signal?.aborted) {
|
|
7017
|
+
if (Date.now() > deadline) throw new Error("verify device confirmation timed out");
|
|
7018
|
+
const response = await fetch(`${base}/device/poll?user_code=${VERIFY_DEVICE_USER_CODE}`, {
|
|
7019
|
+
signal: callbacks.signal
|
|
7020
|
+
});
|
|
7021
|
+
if (response.ok) {
|
|
7022
|
+
const data = await response.json();
|
|
7023
|
+
if (typeof data.access_token === "string" && typeof data.refresh_token === "string") {
|
|
7024
|
+
const expiresIn = typeof data.expires_in === "number" && Number.isFinite(data.expires_in) ? data.expires_in : 3600;
|
|
7025
|
+
return {
|
|
7026
|
+
access: data.access_token,
|
|
7027
|
+
refresh: data.refresh_token,
|
|
7028
|
+
expires: Date.now() + expiresIn * 1e3
|
|
7029
|
+
};
|
|
7030
|
+
}
|
|
7031
|
+
}
|
|
7032
|
+
await delay(500, callbacks.signal);
|
|
7033
|
+
}
|
|
7034
|
+
throw new Error("登录已取消");
|
|
7035
|
+
}
|
|
7036
|
+
function streamVerify() {
|
|
7037
|
+
return createEventStream();
|
|
7038
|
+
}
|
|
7039
|
+
function provider(name, login) {
|
|
7040
|
+
return {
|
|
7041
|
+
name,
|
|
7042
|
+
api: VERIFY_API,
|
|
7043
|
+
baseUrl: "http://127.0.0.1",
|
|
7044
|
+
models: [VERIFY_MODEL],
|
|
7045
|
+
streamSimple: streamVerify,
|
|
7046
|
+
oauth: {
|
|
7047
|
+
name,
|
|
7048
|
+
isSubscription: true,
|
|
7049
|
+
login,
|
|
7050
|
+
refreshToken: async (credentials) => credentials,
|
|
7051
|
+
getApiKey: (credentials) => credentials.access
|
|
7052
|
+
}
|
|
7053
|
+
};
|
|
7054
|
+
}
|
|
7055
|
+
function verifyOauthProviders(isPackaged) {
|
|
7056
|
+
if (!verifyOauthEnabled(isPackaged)) return [];
|
|
7057
|
+
return [
|
|
7058
|
+
[VERIFY_OAUTH_PROVIDER_ID, provider("Verify OAuth", loginWithCallback)],
|
|
7059
|
+
[VERIFY_DEVICE_PROVIDER_ID, provider("Verify Device", loginWithDevice)]
|
|
7060
|
+
];
|
|
7061
|
+
}
|
|
6890
7062
|
const OAUTH_POOL_EXHAUSTED = "No available ChatGPT OAuth accounts in the sequential pool. Re-authenticate an account or wait for its quota reset.";
|
|
6891
7063
|
const TTL = 6e4;
|
|
6892
7064
|
const ERROR_TTL = 15e3;
|
|
@@ -9186,7 +9358,10 @@ function getRuntime() {
|
|
|
9186
9358
|
runtime.registerProvider(DEVIN_PROVIDER_ID, devinProviderConfig());
|
|
9187
9359
|
runtime.registerProvider(QODER_PROVIDER_ID, qoderProviderConfig("global"));
|
|
9188
9360
|
runtime.registerProvider(QODER_CN_PROVIDER_ID, qoderProviderConfig("cn"));
|
|
9189
|
-
const
|
|
9361
|
+
for (const [id, config] of verifyOauthProviders(app.isPackaged)) {
|
|
9362
|
+
runtime.registerProvider(id, config);
|
|
9363
|
+
}
|
|
9364
|
+
const { CURSOR_PROVIDER_ID, loadCursorProvider } = await import("./chunks/loadProvider-B5WmMMag.js").then((n) => n.d);
|
|
9190
9365
|
onlineCatalogProviderIds.add(CURSOR_PROVIDER_ID);
|
|
9191
9366
|
await loadCursorProvider(runtime);
|
|
9192
9367
|
installCodexLinkedRefresh(runtime);
|
|
@@ -9388,13 +9563,13 @@ async function listOauthProviders() {
|
|
|
9388
9563
|
...meta[key]
|
|
9389
9564
|
};
|
|
9390
9565
|
};
|
|
9391
|
-
return runtime.getProviders().filter((
|
|
9392
|
-
id:
|
|
9393
|
-
name:
|
|
9394
|
-
loginLabel:
|
|
9395
|
-
supportsMultipleAccounts: supportsMultipleAccounts(
|
|
9396
|
-
accounts: (byProvider.get(
|
|
9397
|
-
models: expandOauthCatalog(
|
|
9566
|
+
return runtime.getProviders().filter((provider2) => provider2.auth.oauth && !provider2.id.includes("#")).map((provider2) => ({
|
|
9567
|
+
id: provider2.id,
|
|
9568
|
+
name: provider2.auth.oauth?.name || provider2.name,
|
|
9569
|
+
loginLabel: provider2.auth.oauth?.loginLabel,
|
|
9570
|
+
supportsMultipleAccounts: supportsMultipleAccounts(provider2.id),
|
|
9571
|
+
accounts: (byProvider.get(provider2.id) ?? []).map((key) => toAccount(provider2.id, key)),
|
|
9572
|
+
models: expandOauthCatalog(provider2.id, provider2.getModels()).map((model) => model.id)
|
|
9398
9573
|
}));
|
|
9399
9574
|
}
|
|
9400
9575
|
let activeLogin = null;
|
|
@@ -9499,16 +9674,17 @@ async function runOauthLogin(providerId, sender2, login, ownerSignal) {
|
|
|
9499
9674
|
break;
|
|
9500
9675
|
case "auth_url":
|
|
9501
9676
|
login.authUrl = event.url;
|
|
9502
|
-
void shell.openExternal(event.url);
|
|
9677
|
+
if (!remoteSenderById(sender2.id)) void shell.openExternal(event.url);
|
|
9503
9678
|
emit2({
|
|
9504
9679
|
type: "auth_url",
|
|
9505
9680
|
url: authUrlForRenderer(event.url),
|
|
9681
|
+
fullUrl: event.url,
|
|
9506
9682
|
instructions: event.instructions
|
|
9507
9683
|
});
|
|
9508
9684
|
break;
|
|
9509
9685
|
case "device_code":
|
|
9510
9686
|
login.authUrl = event.verificationUri;
|
|
9511
|
-
void shell.openExternal(event.verificationUri);
|
|
9687
|
+
if (!remoteSenderById(sender2.id)) void shell.openExternal(event.verificationUri);
|
|
9512
9688
|
emit2({
|
|
9513
9689
|
type: "device_code",
|
|
9514
9690
|
userCode: event.userCode,
|
|
@@ -9524,6 +9700,7 @@ async function runOauthLogin(providerId, sender2, login, ownerSignal) {
|
|
|
9524
9700
|
const requestId2 = crypto.randomUUID();
|
|
9525
9701
|
const { promise, resolve: resolve2, reject } = Promise.withResolvers();
|
|
9526
9702
|
const allowEmpty = "allowEmpty" in prompt && prompt.allowEmpty === true;
|
|
9703
|
+
const pasteError = "error" in prompt && typeof prompt.error === "string" && prompt.error ? prompt.error : void 0;
|
|
9527
9704
|
login.pendingPrompts.set(requestId2, { resolve: resolve2, reject, allowEmpty });
|
|
9528
9705
|
prompt.signal?.addEventListener("abort", () => {
|
|
9529
9706
|
if (login.pendingPrompts.delete(requestId2)) {
|
|
@@ -9539,7 +9716,8 @@ async function runOauthLogin(providerId, sender2, login, ownerSignal) {
|
|
|
9539
9716
|
message: prompt.message,
|
|
9540
9717
|
placeholder: "placeholder" in prompt ? prompt.placeholder : void 0,
|
|
9541
9718
|
options: prompt.type === "select" ? prompt.options.map((option) => ({ ...option })) : void 0,
|
|
9542
|
-
allowEmpty
|
|
9719
|
+
allowEmpty,
|
|
9720
|
+
...pasteError ? { error: pasteError } : {}
|
|
9543
9721
|
}
|
|
9544
9722
|
});
|
|
9545
9723
|
return promise;
|
|
@@ -10111,8 +10289,8 @@ function isProviderModelRefreshIntervalHours(value) {
|
|
|
10111
10289
|
function normalizeProviderModelRefreshIntervalHours(value) {
|
|
10112
10290
|
return isProviderModelRefreshIntervalHours(value) ? value : DEFAULT_PROVIDER_MODEL_REFRESH_INTERVAL_HOURS;
|
|
10113
10291
|
}
|
|
10114
|
-
function hasApiKeyProviderCredentials(
|
|
10115
|
-
return !
|
|
10292
|
+
function hasApiKeyProviderCredentials(provider2) {
|
|
10293
|
+
return !provider2.oauthAccountKey && !provider2.oauthProviderId && !provider2.oauthAccountPool && typeof provider2.apiKey === "string" && provider2.apiKey.trim().length > 0;
|
|
10116
10294
|
}
|
|
10117
10295
|
const HOUR_MS = 60 * 60 * 1e3;
|
|
10118
10296
|
function asRecord$2(value) {
|
|
@@ -10181,31 +10359,31 @@ function isModelApiKind(value) {
|
|
|
10181
10359
|
return MODEL_API_KINDS.some((api) => api === value);
|
|
10182
10360
|
}
|
|
10183
10361
|
function refreshTarget(value) {
|
|
10184
|
-
const
|
|
10185
|
-
if (!
|
|
10186
|
-
const { id, api, baseUrl, catalogId, models } =
|
|
10187
|
-
if (typeof id !== "string" ||
|
|
10362
|
+
const provider2 = asRecord$2(value);
|
|
10363
|
+
if (!provider2) return;
|
|
10364
|
+
const { id, api, baseUrl, catalogId, models } = provider2;
|
|
10365
|
+
if (typeof id !== "string" || provider2.enabled !== true || provider2.autoFetchModels !== true || !hasApiKeyProviderCredentials(provider2) || !isModelApiKind(api) || typeof baseUrl !== "string" || isClassifierOnlyProvider({
|
|
10188
10366
|
api,
|
|
10189
10367
|
baseUrl,
|
|
10190
10368
|
catalogId: typeof catalogId === "string" ? catalogId : void 0
|
|
10191
10369
|
}) || !Array.isArray(models) || !models.every((model) => typeof asRecord$2(model)?.id === "string")) {
|
|
10192
10370
|
return;
|
|
10193
10371
|
}
|
|
10194
|
-
const proxy = parseProviderProxy(
|
|
10372
|
+
const proxy = parseProviderProxy(provider2.proxy);
|
|
10195
10373
|
if (proxy === null) return;
|
|
10196
10374
|
const config = {
|
|
10197
10375
|
api,
|
|
10198
|
-
apiKey:
|
|
10376
|
+
apiKey: provider2.apiKey,
|
|
10199
10377
|
baseUrl,
|
|
10200
|
-
headers: parseProviderHeaders(
|
|
10378
|
+
headers: parseProviderHeaders(provider2.headers, { warn: false }),
|
|
10201
10379
|
proxy
|
|
10202
10380
|
};
|
|
10203
10381
|
return {
|
|
10204
10382
|
id,
|
|
10205
|
-
provider,
|
|
10383
|
+
provider: provider2,
|
|
10206
10384
|
config,
|
|
10207
10385
|
models,
|
|
10208
|
-
intervalMs: normalizeProviderModelRefreshIntervalHours(
|
|
10386
|
+
intervalMs: normalizeProviderModelRefreshIntervalHours(provider2.modelRefreshIntervalHours) * HOUR_MS
|
|
10209
10387
|
};
|
|
10210
10388
|
}
|
|
10211
10389
|
function createProviderModelRefresh(deps) {
|
|
@@ -18004,14 +18182,14 @@ class ExtensionPluginService {
|
|
|
18004
18182
|
/** 启动后稍等检查一次,之后每天一次;只查已启用的插件 */
|
|
18005
18183
|
startUpdateChecks() {
|
|
18006
18184
|
if (this.isDisposed || this.updateTimer) return;
|
|
18007
|
-
const run2 = (
|
|
18185
|
+
const run2 = (delay2) => {
|
|
18008
18186
|
if (this.isDisposed) return;
|
|
18009
18187
|
this.updateTimer = setTimeout(() => {
|
|
18010
18188
|
void this.checkUpdates({ enabledOnly: true }).finally(() => {
|
|
18011
18189
|
if (this.isDisposed || !this.updateTimer) return;
|
|
18012
18190
|
run2(UPDATE_CHECK_INTERVAL_MS);
|
|
18013
18191
|
});
|
|
18014
|
-
},
|
|
18192
|
+
}, delay2);
|
|
18015
18193
|
this.updateTimer.unref?.();
|
|
18016
18194
|
};
|
|
18017
18195
|
run2(UPDATE_CHECK_FIRST_DELAY_MS);
|
|
@@ -19817,7 +19995,7 @@ async function runAuthorize(serverId, deps) {
|
|
|
19817
19995
|
let authorized = false;
|
|
19818
19996
|
try {
|
|
19819
19997
|
deps.store.clearTokens(serverId);
|
|
19820
|
-
const
|
|
19998
|
+
const provider2 = new McpOAuthClientProvider({
|
|
19821
19999
|
serverId,
|
|
19822
20000
|
serverUrl,
|
|
19823
20001
|
redirectUrl: callback.redirectUri,
|
|
@@ -19836,10 +20014,10 @@ async function runAuthorize(serverId, deps) {
|
|
|
19836
20014
|
...challenge.resourceMetadataUrl ? { resourceMetadataUrl: new URL(challenge.resourceMetadataUrl) } : {}
|
|
19837
20015
|
} : {}
|
|
19838
20016
|
};
|
|
19839
|
-
let result = await deps.auth(
|
|
20017
|
+
let result = await deps.auth(provider2, flow);
|
|
19840
20018
|
if (result === "REDIRECT") {
|
|
19841
20019
|
const { code, iss } = await responsePromise;
|
|
19842
|
-
result = await deps.auth(
|
|
20020
|
+
result = await deps.auth(provider2, {
|
|
19843
20021
|
...flow,
|
|
19844
20022
|
authorizationCode: code,
|
|
19845
20023
|
...iss ? { iss } : {}
|
|
@@ -20149,7 +20327,7 @@ function directoryModel(id, name) {
|
|
|
20149
20327
|
}
|
|
20150
20328
|
function synthesizeModelDirectory(input) {
|
|
20151
20329
|
const cachedByKey = new Map(
|
|
20152
|
-
(input.cached ?? []).filter((
|
|
20330
|
+
(input.cached ?? []).filter((provider2) => provider2.kind === "oauth").map((provider2) => [provider2.key, provider2])
|
|
20153
20331
|
);
|
|
20154
20332
|
const providers2 = [];
|
|
20155
20333
|
for (const source2 of input.oauthProviders) {
|
|
@@ -20173,14 +20351,14 @@ function synthesizeModelDirectory(input) {
|
|
|
20173
20351
|
else if (cached?.discoveredAt !== void 0) section.discoveredAt = cached.discoveredAt;
|
|
20174
20352
|
providers2.push(section);
|
|
20175
20353
|
}
|
|
20176
|
-
for (const
|
|
20177
|
-
if (
|
|
20178
|
-
if (!
|
|
20354
|
+
for (const provider2 of input.customProviders) {
|
|
20355
|
+
if (provider2.oauthAccountKey) continue;
|
|
20356
|
+
if (!provider2.id) continue;
|
|
20179
20357
|
providers2.push({
|
|
20180
|
-
key:
|
|
20358
|
+
key: provider2.id,
|
|
20181
20359
|
kind: "custom",
|
|
20182
|
-
label: typeof
|
|
20183
|
-
models: (
|
|
20360
|
+
label: typeof provider2.name === "string" ? provider2.name : provider2.id,
|
|
20361
|
+
models: (provider2.models ?? []).filter((model) => model && typeof model.id === "string" && model.id.length > 0).map((model) => {
|
|
20184
20362
|
const entry = { id: model.id };
|
|
20185
20363
|
if (typeof model.label === "string" && model.label.length > 0) entry.label = model.label;
|
|
20186
20364
|
return entry;
|
|
@@ -20196,11 +20374,11 @@ function readCustomProviders() {
|
|
|
20196
20374
|
const custom = [];
|
|
20197
20375
|
for (const item of providers2) {
|
|
20198
20376
|
if (!item || typeof item !== "object" || Array.isArray(item)) continue;
|
|
20199
|
-
const
|
|
20200
|
-
if (typeof
|
|
20201
|
-
if (
|
|
20202
|
-
if (!Array.isArray(
|
|
20203
|
-
custom.push(
|
|
20377
|
+
const provider2 = item;
|
|
20378
|
+
if (typeof provider2.id !== "string" || provider2.id.length === 0) continue;
|
|
20379
|
+
if (provider2.oauthAccountKey) continue;
|
|
20380
|
+
if (!Array.isArray(provider2.models)) continue;
|
|
20381
|
+
custom.push(provider2);
|
|
20204
20382
|
}
|
|
20205
20383
|
return custom;
|
|
20206
20384
|
} catch {
|
|
@@ -20218,22 +20396,22 @@ function loadCachedOAuthProviders() {
|
|
|
20218
20396
|
generatedAt: 0,
|
|
20219
20397
|
providers: raw.providers
|
|
20220
20398
|
});
|
|
20221
|
-
return (parsed?.providers ?? []).filter((
|
|
20399
|
+
return (parsed?.providers ?? []).filter((provider2) => provider2.kind === "oauth");
|
|
20222
20400
|
} catch {
|
|
20223
20401
|
return [];
|
|
20224
20402
|
}
|
|
20225
20403
|
}
|
|
20226
20404
|
function oauthFallback() {
|
|
20227
|
-
const memory2 = snapshot?.providers.filter((
|
|
20405
|
+
const memory2 = snapshot?.providers.filter((provider2) => provider2.kind === "oauth") ?? [];
|
|
20228
20406
|
return memory2.length > 0 ? memory2 : loadCachedOAuthProviders();
|
|
20229
20407
|
}
|
|
20230
20408
|
function semanticKey(providers2) {
|
|
20231
20409
|
return JSON.stringify(
|
|
20232
|
-
providers2.map((
|
|
20233
|
-
key:
|
|
20234
|
-
kind:
|
|
20235
|
-
label:
|
|
20236
|
-
models:
|
|
20410
|
+
providers2.map((provider2) => ({
|
|
20411
|
+
key: provider2.key,
|
|
20412
|
+
kind: provider2.kind,
|
|
20413
|
+
label: provider2.label,
|
|
20414
|
+
models: provider2.models
|
|
20237
20415
|
}))
|
|
20238
20416
|
);
|
|
20239
20417
|
}
|
|
@@ -20259,7 +20437,7 @@ function onModelDirectoryChanged(listener) {
|
|
|
20259
20437
|
function atomicWriteCache(providers2) {
|
|
20260
20438
|
const target = cachePath$1();
|
|
20261
20439
|
const tempPath = `${target}.tmp`;
|
|
20262
|
-
const oauth = providers2.filter((
|
|
20440
|
+
const oauth = providers2.filter((provider2) => provider2.kind === "oauth");
|
|
20263
20441
|
writeFileSync(tempPath, JSON.stringify({ providers: oauth }), "utf8");
|
|
20264
20442
|
renameSync(tempPath, target);
|
|
20265
20443
|
}
|
|
@@ -20295,9 +20473,9 @@ function commitIfChanged(providers2, now) {
|
|
|
20295
20473
|
function materializeOffline(now) {
|
|
20296
20474
|
const cached = loadCachedOAuthProviders();
|
|
20297
20475
|
return synthesizeModelDirectory({
|
|
20298
|
-
oauthProviders: cached.map((
|
|
20299
|
-
id:
|
|
20300
|
-
label:
|
|
20476
|
+
oauthProviders: cached.map((provider2) => ({
|
|
20477
|
+
id: provider2.key,
|
|
20478
|
+
label: provider2.label,
|
|
20301
20479
|
models: []
|
|
20302
20480
|
})),
|
|
20303
20481
|
customProviders: readCustomProviders(),
|
|
@@ -20315,20 +20493,20 @@ async function loadLiveOAuthProviders() {
|
|
|
20315
20493
|
const { getRuntime: getRuntime2 } = await Promise.resolve().then(() => oauthProviders);
|
|
20316
20494
|
const runtime = await getRuntime2();
|
|
20317
20495
|
const live2 = [];
|
|
20318
|
-
for (const
|
|
20319
|
-
if (!
|
|
20320
|
-
const oauthName = typeof
|
|
20496
|
+
for (const provider2 of runtime.getProviders()) {
|
|
20497
|
+
if (!provider2.auth?.oauth || provider2.id.includes("#")) continue;
|
|
20498
|
+
const oauthName = typeof provider2.auth.oauth === "object" ? provider2.auth.oauth.name : void 0;
|
|
20321
20499
|
const models = withModelsDevOauthModels(
|
|
20322
|
-
|
|
20323
|
-
expandOauthCatalog(
|
|
20500
|
+
provider2.id,
|
|
20501
|
+
expandOauthCatalog(provider2.id, provider2.getModels()),
|
|
20324
20502
|
getModelsDevModels()
|
|
20325
20503
|
).map((model) => ({
|
|
20326
20504
|
id: model.id,
|
|
20327
20505
|
name: "name" in model && typeof model.name === "string" ? model.name : void 0
|
|
20328
20506
|
}));
|
|
20329
20507
|
live2.push({
|
|
20330
|
-
id:
|
|
20331
|
-
label: oauthName ||
|
|
20508
|
+
id: provider2.id,
|
|
20509
|
+
label: oauthName || provider2.name,
|
|
20332
20510
|
models
|
|
20333
20511
|
});
|
|
20334
20512
|
}
|
|
@@ -20340,9 +20518,9 @@ async function loadLiveOAuthProviders() {
|
|
|
20340
20518
|
async function refreshModelDirectory() {
|
|
20341
20519
|
const cached = oauthFallback();
|
|
20342
20520
|
const live2 = await loadLiveOAuthProviders();
|
|
20343
|
-
const oauthProviders2 = live2 ?? cached.map((
|
|
20344
|
-
id:
|
|
20345
|
-
label:
|
|
20521
|
+
const oauthProviders2 = live2 ?? cached.map((provider2) => ({
|
|
20522
|
+
id: provider2.key,
|
|
20523
|
+
label: provider2.label,
|
|
20346
20524
|
models: []
|
|
20347
20525
|
}));
|
|
20348
20526
|
const now = Date.now();
|
|
@@ -20371,10 +20549,10 @@ function noteDiscoveredOauthModels(providerId, models) {
|
|
|
20371
20549
|
const current2 = getModelDirectorySnapshot();
|
|
20372
20550
|
const now = Date.now();
|
|
20373
20551
|
const next = synthesizeModelDirectory({
|
|
20374
|
-
oauthProviders: current2.providers.filter((
|
|
20375
|
-
id:
|
|
20376
|
-
label:
|
|
20377
|
-
models:
|
|
20552
|
+
oauthProviders: current2.providers.filter((provider2) => provider2.kind === "oauth").map((provider2) => ({
|
|
20553
|
+
id: provider2.key,
|
|
20554
|
+
label: provider2.label,
|
|
20555
|
+
models: provider2.models.map((model) => ({ id: model.id, name: model.label }))
|
|
20378
20556
|
})),
|
|
20379
20557
|
customProviders: readCustomProviders(),
|
|
20380
20558
|
cached: loadCachedOAuthProviders(),
|
|
@@ -20387,7 +20565,7 @@ function noteDiscoveredOauthModels(providerId, models) {
|
|
|
20387
20565
|
function notifyModelDirectorySettingsChanged() {
|
|
20388
20566
|
try {
|
|
20389
20567
|
const current2 = getModelDirectorySnapshot();
|
|
20390
|
-
const oauth = current2.providers.filter((
|
|
20568
|
+
const oauth = current2.providers.filter((provider2) => provider2.kind === "oauth");
|
|
20391
20569
|
const custom = synthesizeModelDirectory({
|
|
20392
20570
|
oauthProviders: [],
|
|
20393
20571
|
customProviders: readCustomProviders(),
|
|
@@ -20618,14 +20796,14 @@ function pickSubagentModelRefs(entries, providers2, virtualModels) {
|
|
|
20618
20796
|
providerId = entry.providerId;
|
|
20619
20797
|
modelId = virtual.id;
|
|
20620
20798
|
} else {
|
|
20621
|
-
const
|
|
20622
|
-
if (!
|
|
20623
|
-
if (isClassifierOnlyProvider(
|
|
20624
|
-
if (!Array.isArray(
|
|
20625
|
-
const model =
|
|
20799
|
+
const provider2 = providers2.find((candidate) => candidate.id === entry.providerId);
|
|
20800
|
+
if (!provider2 || provider2.enabled === false || !hasProviderCredentials(provider2)) continue;
|
|
20801
|
+
if (isClassifierOnlyProvider(provider2)) continue;
|
|
20802
|
+
if (!Array.isArray(provider2.models)) continue;
|
|
20803
|
+
const model = provider2.models.find((candidate) => candidate?.id === entry.modelId);
|
|
20626
20804
|
if (!model || model.enabled === false) continue;
|
|
20627
|
-
base = `${
|
|
20628
|
-
providerId =
|
|
20805
|
+
base = `${provider2.name}/${model.id}`;
|
|
20806
|
+
providerId = provider2.id;
|
|
20629
20807
|
modelId = model.id;
|
|
20630
20808
|
}
|
|
20631
20809
|
seen.add(key);
|
|
@@ -20746,14 +20924,14 @@ let worker = null;
|
|
|
20746
20924
|
async function selectOauthPoolAccount(event) {
|
|
20747
20925
|
try {
|
|
20748
20926
|
const providers2 = providersFromSettings();
|
|
20749
|
-
const
|
|
20750
|
-
if (!
|
|
20927
|
+
const provider2 = providers2.find((entry) => entry.id === event.settingsProviderId);
|
|
20928
|
+
if (!provider2 || !isOauthAccountPool(provider2)) throw new Error(OAUTH_POOL_EXHAUSTED);
|
|
20751
20929
|
const runtime = await getRuntime();
|
|
20752
20930
|
const loggedIn = new Set(
|
|
20753
20931
|
(await runtime.listCredentials()).filter((entry) => entry.type === "oauth").map((entry) => entry.providerId)
|
|
20754
20932
|
);
|
|
20755
20933
|
const eligible2 = eligibleOauthPoolAccountKeys(
|
|
20756
|
-
|
|
20934
|
+
provider2,
|
|
20757
20935
|
event.modelId,
|
|
20758
20936
|
providers2,
|
|
20759
20937
|
loggedIn
|
|
@@ -20764,21 +20942,21 @@ async function selectOauthPoolAccount(event) {
|
|
|
20764
20942
|
});
|
|
20765
20943
|
const quota = getOauthQuotaCoordinator();
|
|
20766
20944
|
quota.reconcileKeys(loggedIn);
|
|
20767
|
-
const failed2 = await quota.validateFailure(
|
|
20945
|
+
const failed2 = await quota.validateFailure(provider2.id, event.failed);
|
|
20768
20946
|
const selected = await quota.select(
|
|
20769
|
-
|
|
20770
|
-
|
|
20947
|
+
provider2.id,
|
|
20948
|
+
provider2.oauthAccountPool?.accountKeys ?? [],
|
|
20771
20949
|
eligible2,
|
|
20772
20950
|
failed2
|
|
20773
20951
|
);
|
|
20774
20952
|
const { accountKey } = selected;
|
|
20775
|
-
const selectionReceipt = accountKey ? await quota.issueSelectionReceipt(
|
|
20953
|
+
const selectionReceipt = accountKey ? await quota.issueSelectionReceipt(provider2.id, accountKey) : void 0;
|
|
20776
20954
|
if (selected.warning) console.warn(`[OAuthQuota] ${selected.warning}`);
|
|
20777
20955
|
if (accountKey) {
|
|
20778
20956
|
const latestKeys = new Set(
|
|
20779
20957
|
(await runtime.listCredentials()).filter((entry) => entry.type === "oauth").map((entry) => entry.providerId)
|
|
20780
20958
|
);
|
|
20781
|
-
const receiptStillCurrent = selectionReceipt && await quota.validateFailure(
|
|
20959
|
+
const receiptStillCurrent = selectionReceipt && await quota.validateFailure(provider2.id, {
|
|
20782
20960
|
accountKey,
|
|
20783
20961
|
reason: "login-invalid",
|
|
20784
20962
|
selectionReceipt
|
|
@@ -21054,13 +21232,13 @@ ${tail2}`);
|
|
|
21054
21232
|
}
|
|
21055
21233
|
function scheduleReminderRevive() {
|
|
21056
21234
|
const dueAts = Object.values(readAllSessionReminders(path.join(agentDataDir(), "sessions"))).flat().map((item) => item.dueAt);
|
|
21057
|
-
const
|
|
21058
|
-
if (
|
|
21235
|
+
const delay2 = reminderReviveDelay(dueAts, Date.now());
|
|
21236
|
+
if (delay2 === void 0) return;
|
|
21059
21237
|
clearTimeout(reminderRevive);
|
|
21060
21238
|
reminderRevive = setTimeout(() => {
|
|
21061
21239
|
reminderRevive = void 0;
|
|
21062
21240
|
if (!worker && workerExited && !quitStopped) startAgentWorker();
|
|
21063
|
-
},
|
|
21241
|
+
}, delay2);
|
|
21064
21242
|
reminderRevive.unref?.();
|
|
21065
21243
|
}
|
|
21066
21244
|
function captureWorkerOutput(child) {
|
|
@@ -21523,8 +21701,8 @@ function resolveModelSelection(providerId, modelId, authenticatedAccountKeys, op
|
|
|
21523
21701
|
}
|
|
21524
21702
|
function resolveVirtualModelSelection(entry, authenticatedAccountKeys) {
|
|
21525
21703
|
const member = (ref) => {
|
|
21526
|
-
const
|
|
21527
|
-
if (!
|
|
21704
|
+
const provider2 = providersFromSettings().find((item) => item.id === ref.providerId);
|
|
21705
|
+
if (!provider2 || !canBeVirtualMember(provider2)) return void 0;
|
|
21528
21706
|
const resolved = resolvePhysicalModelSelection(
|
|
21529
21707
|
ref.providerId,
|
|
21530
21708
|
ref.modelId,
|
|
@@ -21574,22 +21752,22 @@ function resolveVirtualClassifier(classifier, authenticatedAccountKeys) {
|
|
|
21574
21752
|
);
|
|
21575
21753
|
return credentials ? { source: "pi-classifier", timeoutMs: classifier.timeoutMs, classifier: credentials } : void 0;
|
|
21576
21754
|
}
|
|
21577
|
-
function classifierCredentialsFor(
|
|
21578
|
-
if (!
|
|
21579
|
-
const piProvider = classifierProviderFor(
|
|
21755
|
+
function classifierCredentialsFor(provider2, modelId, authenticatedAccountKeys) {
|
|
21756
|
+
if (!provider2?.enabled) return void 0;
|
|
21757
|
+
const piProvider = classifierProviderFor(provider2);
|
|
21580
21758
|
if (!piProvider) return void 0;
|
|
21581
|
-
const baseUrl = classifierBaseUrlFor(
|
|
21582
|
-
if (
|
|
21583
|
-
if (!authenticatedAccountKeys.has(
|
|
21584
|
-
} else if (!
|
|
21759
|
+
const baseUrl = classifierBaseUrlFor(provider2);
|
|
21760
|
+
if (provider2.oauthAccountKey) {
|
|
21761
|
+
if (!authenticatedAccountKeys.has(provider2.oauthAccountKey)) return void 0;
|
|
21762
|
+
} else if (!provider2.apiKey) {
|
|
21585
21763
|
return void 0;
|
|
21586
21764
|
}
|
|
21587
|
-
const proxy =
|
|
21765
|
+
const proxy = provider2.oauthAccountKey ? void 0 : parseProviderProxy(provider2.proxy);
|
|
21588
21766
|
if (proxy === null) return void 0;
|
|
21589
21767
|
return {
|
|
21590
21768
|
provider: piProvider,
|
|
21591
21769
|
modelId,
|
|
21592
|
-
...
|
|
21770
|
+
...provider2.oauthAccountKey ? {} : { apiKey: provider2.apiKey },
|
|
21593
21771
|
...baseUrl ? { baseUrl } : {},
|
|
21594
21772
|
...proxy ? { proxy } : {}
|
|
21595
21773
|
};
|
|
@@ -21603,12 +21781,12 @@ function resolvePhysicalModelSelection(providerId, modelId, authenticatedAccount
|
|
|
21603
21781
|
if (reason !== "usable") {
|
|
21604
21782
|
return { ok: false, error: `Model is unavailable: ${reason}` };
|
|
21605
21783
|
}
|
|
21606
|
-
const
|
|
21607
|
-
if (!
|
|
21608
|
-
if (!
|
|
21784
|
+
const provider2 = providers2.find((entry) => entry.id === providerId);
|
|
21785
|
+
if (!provider2) return { ok: false, error: "Model provider is unavailable." };
|
|
21786
|
+
if (!provider2.oauthAccountKey && parseProviderProxy(provider2.proxy) === null) {
|
|
21609
21787
|
return { ok: false, error: "Model provider proxy configuration is invalid." };
|
|
21610
21788
|
}
|
|
21611
|
-
const config = spawnModelConfig(
|
|
21789
|
+
const config = spawnModelConfig(provider2, modelId);
|
|
21612
21790
|
return {
|
|
21613
21791
|
ok: true,
|
|
21614
21792
|
selection: {
|
|
@@ -22705,9 +22883,9 @@ function asModelRef(value) {
|
|
|
22705
22883
|
function resolveApprovalReviewer(authenticatedAccountKeys) {
|
|
22706
22884
|
const ref = asModelRef(readSettingsState()?.approvalReviewer);
|
|
22707
22885
|
if (!ref) return { ok: true, source: null };
|
|
22708
|
-
const
|
|
22709
|
-
if (
|
|
22710
|
-
const classifier = classifierCredentialsFor(
|
|
22886
|
+
const provider2 = providersFromSettings().find((item) => item.id === ref.providerId);
|
|
22887
|
+
if (provider2 && isClassifierOnlyProvider(provider2)) {
|
|
22888
|
+
const classifier = classifierCredentialsFor(provider2, ref.modelId, authenticatedAccountKeys);
|
|
22711
22889
|
const state = readSettingsState();
|
|
22712
22890
|
const managed = state?.approvalAutoManage === true;
|
|
22713
22891
|
const allowThreshold = parseApprovalAllowThreshold(state?.approvalAllowThreshold);
|
|
@@ -22825,14 +23003,14 @@ function resolveWebSearchConfig() {
|
|
|
22825
23003
|
const providers2 = providersFromSettings();
|
|
22826
23004
|
const chain = [];
|
|
22827
23005
|
for (const entry of rawChain) {
|
|
22828
|
-
const
|
|
22829
|
-
if (!
|
|
23006
|
+
const provider2 = providers2.find((p) => p.id === entry.providerId);
|
|
23007
|
+
if (!provider2 || provider2.enabled === false || provider2.oauthAccountPool !== void 0)
|
|
22830
23008
|
continue;
|
|
22831
|
-
if (!Array.isArray(
|
|
23009
|
+
if (!Array.isArray(provider2.models) || !provider2.models.some((model) => model?.id === entry.modelId && model.enabled !== false))
|
|
22832
23010
|
continue;
|
|
22833
|
-
if (!
|
|
23011
|
+
if (!provider2.oauthAccountKey && (typeof provider2.api !== "string" || typeof provider2.baseUrl !== "string" || typeof provider2.apiKey !== "string"))
|
|
22834
23012
|
continue;
|
|
22835
|
-
const runtimeProviderId =
|
|
23013
|
+
const runtimeProviderId = provider2.oauthAccountKey ?? providerKeyFor(provider2);
|
|
22836
23014
|
chain.push({ providerId: runtimeProviderId, modelId: entry.modelId });
|
|
22837
23015
|
}
|
|
22838
23016
|
return { chain, configured: rawChain.length > 0 };
|
|
@@ -22868,24 +23046,24 @@ function customProvidersForWorker() {
|
|
|
22868
23046
|
const out = [];
|
|
22869
23047
|
for (const item of providersFromSettings()) {
|
|
22870
23048
|
if (!item || typeof item !== "object" || Array.isArray(item)) continue;
|
|
22871
|
-
const
|
|
22872
|
-
if (
|
|
22873
|
-
if (typeof
|
|
22874
|
-
if (typeof
|
|
22875
|
-
if (typeof
|
|
23049
|
+
const provider2 = item;
|
|
23050
|
+
if (provider2.oauthAccountKey) continue;
|
|
23051
|
+
if (typeof provider2.id !== "string" || provider2.id.length === 0) continue;
|
|
23052
|
+
if (typeof provider2.name !== "string") continue;
|
|
23053
|
+
if (typeof provider2.api !== "string" || typeof provider2.baseUrl !== "string" || typeof provider2.apiKey !== "string") {
|
|
22876
23054
|
continue;
|
|
22877
23055
|
}
|
|
22878
|
-
if (!Array.isArray(
|
|
22879
|
-
const headers = parseProviderHeaders(
|
|
22880
|
-
const proxy = parseProviderProxy(
|
|
23056
|
+
if (!Array.isArray(provider2.models)) continue;
|
|
23057
|
+
const headers = parseProviderHeaders(provider2.headers);
|
|
23058
|
+
const proxy = parseProviderProxy(provider2.proxy);
|
|
22881
23059
|
if (proxy === null) continue;
|
|
22882
23060
|
out.push({
|
|
22883
|
-
settingsId:
|
|
22884
|
-
name:
|
|
22885
|
-
api:
|
|
22886
|
-
baseUrl:
|
|
22887
|
-
apiKey:
|
|
22888
|
-
models:
|
|
23061
|
+
settingsId: provider2.id,
|
|
23062
|
+
name: provider2.name,
|
|
23063
|
+
api: provider2.api,
|
|
23064
|
+
baseUrl: provider2.baseUrl,
|
|
23065
|
+
apiKey: provider2.apiKey,
|
|
23066
|
+
models: provider2.models,
|
|
22889
23067
|
...headers ? { headers } : {},
|
|
22890
23068
|
...proxy ? { proxy } : {}
|
|
22891
23069
|
});
|
|
@@ -22910,7 +23088,7 @@ function virtualModelsFromSettings() {
|
|
|
22910
23088
|
function providersFromSettings() {
|
|
22911
23089
|
const providers2 = readSettingsState()?.providers;
|
|
22912
23090
|
const raw = Array.isArray(providers2) ? providers2.filter(
|
|
22913
|
-
(
|
|
23091
|
+
(provider2) => Boolean(provider2) && typeof provider2 === "object" && typeof provider2.id === "string"
|
|
22914
23092
|
) : [];
|
|
22915
23093
|
const materialized = materializeProviders(raw, getModelDirectorySnapshot());
|
|
22916
23094
|
return materialized;
|
|
@@ -22921,22 +23099,22 @@ function modelRefForSpawnConfig(config) {
|
|
|
22921
23099
|
}
|
|
22922
23100
|
throw new Error("Spawn model is missing its settings provider identity.");
|
|
22923
23101
|
}
|
|
22924
|
-
function spawnModelConfig(
|
|
22925
|
-
if (
|
|
23102
|
+
function spawnModelConfig(provider2, modelId) {
|
|
23103
|
+
if (provider2.oauthAccountPool !== void 0 && !isOauthAccountPool(provider2))
|
|
22926
23104
|
throw new Error("Invalid ChatGPT OAuth pool configuration.");
|
|
22927
|
-
const entry =
|
|
22928
|
-
const headers = parseProviderHeaders(
|
|
22929
|
-
const proxy =
|
|
23105
|
+
const entry = provider2.models.find((model) => model.id === modelId);
|
|
23106
|
+
const headers = parseProviderHeaders(provider2.headers);
|
|
23107
|
+
const proxy = provider2.oauthAccountKey ? void 0 : parseProviderProxy(provider2.proxy);
|
|
22930
23108
|
return {
|
|
22931
|
-
api:
|
|
22932
|
-
baseUrl:
|
|
22933
|
-
apiKey:
|
|
23109
|
+
api: provider2.api,
|
|
23110
|
+
baseUrl: provider2.baseUrl,
|
|
23111
|
+
apiKey: provider2.apiKey,
|
|
22934
23112
|
modelId,
|
|
22935
|
-
settingsProviderId:
|
|
23113
|
+
settingsProviderId: provider2.id,
|
|
22936
23114
|
...headers ? { headers } : {},
|
|
22937
23115
|
...proxy ? { proxy } : {},
|
|
22938
|
-
...
|
|
22939
|
-
...isOauthAccountPool(
|
|
23116
|
+
...provider2.oauthAccountKey ? { oauthAccountKey: provider2.oauthAccountKey } : {},
|
|
23117
|
+
...isOauthAccountPool(provider2) ? { oauthAccountPool: provider2.oauthAccountPool } : {},
|
|
22940
23118
|
// 统一目录后 OAuth 条目 models 只承载稀疏用户覆盖(enabled/别名/能力/档位),
|
|
22941
23119
|
// 行覆盖对 OAuth 同样生效;旧守卫丢弃它们是因为那时行是 catalog 冻结拷贝。
|
|
22942
23120
|
// 已知过渡窗口:renderer 水合才执行 v16 稀疏化,Main 先读(bot 自启/tray)时
|
|
@@ -23872,11 +24050,11 @@ ${failure2}` : failure2;
|
|
|
23872
24050
|
this.now()
|
|
23873
24051
|
);
|
|
23874
24052
|
if (!event.interrupted && !active2.stopRequested && this.options.upstreamRecovery && this.options.runtime.retry && (classified.kind === "transient" || classified.kind === "quota")) {
|
|
23875
|
-
const
|
|
24053
|
+
const provider2 = event.provider ?? active2.upstreamWaiting?.provider ?? "default";
|
|
23876
24054
|
const decision = this.options.upstreamRecovery.reportFailure({
|
|
23877
24055
|
id: agent2.agentId,
|
|
23878
24056
|
kind: "subagent",
|
|
23879
|
-
provider,
|
|
24057
|
+
provider: provider2,
|
|
23880
24058
|
errorKind: classified.kind,
|
|
23881
24059
|
lastError: event.error,
|
|
23882
24060
|
...classified.resetAt !== void 0 ? { resetAt: classified.resetAt } : {}
|
|
@@ -23901,11 +24079,11 @@ ${failure2}` : failure2;
|
|
|
23901
24079
|
const recoverable = event.interrupted !== void 0 || classified.kind !== "permanent" && (event.retryExhausted === true || classified.kind === "transient" || classified.kind === "quota");
|
|
23902
24080
|
this.settleRun(agent2, active2, "failed", event.error, recoverable);
|
|
23903
24081
|
} else {
|
|
23904
|
-
const
|
|
24082
|
+
const provider2 = event.provider ?? active2.upstreamWaiting?.provider;
|
|
23905
24083
|
active2.upstreamWaiting = void 0;
|
|
23906
24084
|
active2.upstreamResuming = false;
|
|
23907
|
-
if (
|
|
23908
|
-
this.options.upstreamRecovery?.reportSuccess(
|
|
24085
|
+
if (provider2) {
|
|
24086
|
+
this.options.upstreamRecovery?.reportSuccess(provider2, agent2.agentId);
|
|
23909
24087
|
}
|
|
23910
24088
|
this.completeRun(agent2, active2);
|
|
23911
24089
|
}
|
|
@@ -23913,10 +24091,10 @@ ${failure2}` : failure2;
|
|
|
23913
24091
|
}
|
|
23914
24092
|
if (event.type === "retry-skipped" && active2?.resumed && active2.status === "running") {
|
|
23915
24093
|
if (event.reason === "nothing-to-retry") {
|
|
23916
|
-
const
|
|
24094
|
+
const provider2 = active2.upstreamWaiting?.provider;
|
|
23917
24095
|
active2.upstreamWaiting = void 0;
|
|
23918
24096
|
active2.upstreamResuming = false;
|
|
23919
|
-
if (
|
|
24097
|
+
if (provider2) this.options.upstreamRecovery?.reportSuccess(provider2, agent2.agentId);
|
|
23920
24098
|
this.completeRun(agent2, active2);
|
|
23921
24099
|
} else if (active2.upstreamResuming) {
|
|
23922
24100
|
active2.upstreamResuming = false;
|
|
@@ -27276,7 +27454,7 @@ function setMemoryServiceProgressSink(sink2) {
|
|
|
27276
27454
|
}
|
|
27277
27455
|
async function readTranscriptMain(sessionFile) {
|
|
27278
27456
|
const [{ SessionManager, sessionEntryToContextMessages: sessionEntryToContextMessages2 }, { projectMessage: projectMessage2 }] = await Promise.all(
|
|
27279
|
-
[import("@earendil-works/pi-coding-agent"), import("./chunks/workflowPresets-
|
|
27457
|
+
[import("@earendil-works/pi-coding-agent"), import("./chunks/workflowPresets-_DQtzohi.js").then((n) => n.fs)]
|
|
27280
27458
|
);
|
|
27281
27459
|
const root = path.resolve(path.join(app.getPath("userData"), "agent", "sessions"));
|
|
27282
27460
|
const resolved = path.resolve(sessionFile);
|
|
@@ -28588,17 +28766,17 @@ function parsePhoneCommand(value) {
|
|
|
28588
28766
|
function checkSpawn(command, whitelist2) {
|
|
28589
28767
|
const project = whitelist2.projects.find((p) => p.id === command.projectId);
|
|
28590
28768
|
if (!project) return { ok: false, error: `unknown projectId: ${command.projectId}` };
|
|
28591
|
-
const
|
|
28592
|
-
if (!
|
|
28593
|
-
if (!
|
|
28769
|
+
const provider2 = whitelist2.providers.find((p) => p.id === command.providerId);
|
|
28770
|
+
if (!provider2) return { ok: false, error: `unknown providerId: ${command.providerId}` };
|
|
28771
|
+
if (!provider2.models.some((m) => m.id === command.modelId)) {
|
|
28594
28772
|
return { ok: false, error: `model not enabled: ${command.modelId}` };
|
|
28595
28773
|
}
|
|
28596
28774
|
return { ok: true, resolved: { cwd: project.path } };
|
|
28597
28775
|
}
|
|
28598
28776
|
function checkSetModel(command, whitelist2) {
|
|
28599
|
-
const
|
|
28600
|
-
if (!
|
|
28601
|
-
if (!
|
|
28777
|
+
const provider2 = whitelist2.providers.find((p) => p.id === command.providerId);
|
|
28778
|
+
if (!provider2) return { ok: false, error: `unknown providerId: ${command.providerId}` };
|
|
28779
|
+
if (!provider2.models.some((m) => m.id === command.modelId)) {
|
|
28602
28780
|
return { ok: false, error: `model not enabled: ${command.modelId}` };
|
|
28603
28781
|
}
|
|
28604
28782
|
return { ok: true };
|
|
@@ -29902,11 +30080,15 @@ function attachHostSocket(conn, ws, generation) {
|
|
|
29902
30080
|
conn.ws = ws;
|
|
29903
30081
|
let settled2 = false;
|
|
29904
30082
|
let connectTimer = null;
|
|
30083
|
+
let openedAt = 0;
|
|
29905
30084
|
const closed = (code) => {
|
|
29906
30085
|
if (settled2) return;
|
|
29907
30086
|
settled2 = true;
|
|
29908
30087
|
if (connectTimer) clearTimeout(connectTimer);
|
|
29909
30088
|
if (conn.closed || conn.generation !== generation || conn.ws !== ws) return;
|
|
30089
|
+
console.log(
|
|
30090
|
+
`[pair] ${conn.device.deviceName}: relay ${code === null ? "dead" : `closed ${code}`}${openedAt ? ` after ${Math.round((Date.now() - openedAt) / 1e3)}s` : ""}`
|
|
30091
|
+
);
|
|
29910
30092
|
conn.heartbeat?.stop();
|
|
29911
30093
|
conn.heartbeat = null;
|
|
29912
30094
|
conn.ws = null;
|
|
@@ -29941,6 +30123,7 @@ function attachHostSocket(conn, ws, generation) {
|
|
|
29941
30123
|
}, RELAY_CONNECT_TIMEOUT_MS);
|
|
29942
30124
|
ws.onopen = () => {
|
|
29943
30125
|
if (connectTimer) clearTimeout(connectTimer);
|
|
30126
|
+
openedAt = Date.now();
|
|
29944
30127
|
conn.attempt = 0;
|
|
29945
30128
|
notifyStatus$1();
|
|
29946
30129
|
};
|
|
@@ -30012,8 +30195,8 @@ function dropRevoked$1(conn) {
|
|
|
30012
30195
|
function scheduleReconnect$1(conn) {
|
|
30013
30196
|
if (conn.closed) return;
|
|
30014
30197
|
if (conn.timer) clearTimeout(conn.timer);
|
|
30015
|
-
const
|
|
30016
|
-
conn.timer = setTimeout(() => connect$1(conn),
|
|
30198
|
+
const delay2 = backoffDelay(conn.attempt++);
|
|
30199
|
+
conn.timer = setTimeout(() => connect$1(conn), delay2);
|
|
30017
30200
|
}
|
|
30018
30201
|
function connectionCurrent(conn, generation, ioEpoch) {
|
|
30019
30202
|
return !conn.closed && conn.generation === generation && conn.ioEpoch === ioEpoch;
|
|
@@ -37940,8 +38123,8 @@ async function startPendingDispatches(ports, pendingIds, now) {
|
|
|
37940
38123
|
const classified = classifyUpstreamError({ error }, now);
|
|
37941
38124
|
if (classified.kind !== "permanent") {
|
|
37942
38125
|
const nextAttempt = (pending2.retryCount ?? 0) + 1;
|
|
37943
|
-
const
|
|
37944
|
-
if (
|
|
38126
|
+
const delay2 = nextPendingRetryDelayMs(nextAttempt);
|
|
38127
|
+
if (delay2 !== null) {
|
|
37945
38128
|
const latest = ports.dispatchFile();
|
|
37946
38129
|
latest.pending = {
|
|
37947
38130
|
...latest.pending ?? {},
|
|
@@ -37950,7 +38133,7 @@ async function startPendingDispatches(ports, pendingIds, now) {
|
|
|
37950
38133
|
status: "waiting",
|
|
37951
38134
|
updatedAt: now,
|
|
37952
38135
|
retryCount: nextAttempt,
|
|
37953
|
-
nextRetryAt: now +
|
|
38136
|
+
nextRetryAt: now + delay2,
|
|
37954
38137
|
lastError: error
|
|
37955
38138
|
}
|
|
37956
38139
|
};
|
|
@@ -39796,7 +39979,7 @@ function dispatchPortsFor(ctx) {
|
|
|
39796
39979
|
} = await Promise.resolve().then(() => agentHost);
|
|
39797
39980
|
const { readStoredOauthCredentialKeys: readStoredOauthCredentialKeys2 } = await Promise.resolve().then(() => oauthProviders);
|
|
39798
39981
|
const { modelUsability: modelUsability2 } = await Promise.resolve().then(() => defaultModel);
|
|
39799
|
-
const { resolveDispatchModel } = await import("./chunks/dispatchModel-
|
|
39982
|
+
const { resolveDispatchModel } = await import("./chunks/dispatchModel-JnEtucdi.js");
|
|
39800
39983
|
let keys;
|
|
39801
39984
|
try {
|
|
39802
39985
|
keys = await readStoredOauthCredentialKeys2();
|
|
@@ -44260,12 +44443,12 @@ class UpstreamHealthGate {
|
|
|
44260
44443
|
}
|
|
44261
44444
|
return { action: "wait", waiter: { ...waiter } };
|
|
44262
44445
|
}
|
|
44263
|
-
reportSuccess(
|
|
44446
|
+
reportSuccess(provider2, waiterId, now) {
|
|
44264
44447
|
if (waiterId) {
|
|
44265
44448
|
this.waiters.delete(waiterId);
|
|
44266
44449
|
}
|
|
44267
|
-
const hadDegraded = this.providers.delete(
|
|
44268
|
-
const remaining = this.waitersForProvider(
|
|
44450
|
+
const hadDegraded = this.providers.delete(provider2);
|
|
44451
|
+
const remaining = this.waitersForProvider(provider2).sort((a, b) => a.since - b.since);
|
|
44269
44452
|
if (remaining.length === 0) return;
|
|
44270
44453
|
if (!hadDegraded && remaining.every((w) => w.recovering)) return;
|
|
44271
44454
|
for (let index2 = 0; index2 < remaining.length; index2++) {
|
|
@@ -44279,13 +44462,13 @@ class UpstreamHealthGate {
|
|
|
44279
44462
|
}
|
|
44280
44463
|
takeDue(now) {
|
|
44281
44464
|
const out = [];
|
|
44282
|
-
for (const [
|
|
44465
|
+
for (const [provider2, bucket] of this.providers) {
|
|
44283
44466
|
if (bucket.state === "probing" && bucket.probingWaiterId) {
|
|
44284
44467
|
if (this.waiters.has(bucket.probingWaiterId)) continue;
|
|
44285
44468
|
bucket.probingWaiterId = void 0;
|
|
44286
44469
|
bucket.state = "degraded";
|
|
44287
44470
|
}
|
|
44288
|
-
const candidates = this.waitersForProvider(
|
|
44471
|
+
const candidates = this.waitersForProvider(provider2).filter((w) => !w.probing && w.nextAt <= now).sort((a, b) => a.nextAt - b.nextAt || a.since - b.since);
|
|
44289
44472
|
const chosen = candidates[0];
|
|
44290
44473
|
if (!chosen) continue;
|
|
44291
44474
|
chosen.probing = true;
|
|
@@ -44344,10 +44527,10 @@ class UpstreamHealthGate {
|
|
|
44344
44527
|
allWaiters() {
|
|
44345
44528
|
return [...this.waiters.values()].map((w) => ({ ...w }));
|
|
44346
44529
|
}
|
|
44347
|
-
snapshot(
|
|
44348
|
-
const bucket = this.providers.get(
|
|
44530
|
+
snapshot(provider2) {
|
|
44531
|
+
const bucket = this.providers.get(provider2);
|
|
44349
44532
|
if (!bucket) return void 0;
|
|
44350
|
-
const list2 = this.waitersForProvider(
|
|
44533
|
+
const list2 = this.waitersForProvider(provider2);
|
|
44351
44534
|
let nextProbeAt;
|
|
44352
44535
|
for (const waiter of list2) {
|
|
44353
44536
|
if (waiter.probing) continue;
|
|
@@ -44356,7 +44539,7 @@ class UpstreamHealthGate {
|
|
|
44356
44539
|
}
|
|
44357
44540
|
}
|
|
44358
44541
|
return {
|
|
44359
|
-
provider,
|
|
44542
|
+
provider: provider2,
|
|
44360
44543
|
state: bucket.state,
|
|
44361
44544
|
since: bucket.since,
|
|
44362
44545
|
errorKind: bucket.errorKind,
|
|
@@ -44368,22 +44551,22 @@ class UpstreamHealthGate {
|
|
|
44368
44551
|
}
|
|
44369
44552
|
snapshots() {
|
|
44370
44553
|
const out = [];
|
|
44371
|
-
for (const
|
|
44372
|
-
const snap = this.snapshot(
|
|
44554
|
+
for (const provider2 of this.providers.keys()) {
|
|
44555
|
+
const snap = this.snapshot(provider2);
|
|
44373
44556
|
if (snap) out.push(snap);
|
|
44374
44557
|
}
|
|
44375
44558
|
return out.sort((a, b) => a.since - b.since);
|
|
44376
44559
|
}
|
|
44377
|
-
waitersForProvider(
|
|
44560
|
+
waitersForProvider(provider2) {
|
|
44378
44561
|
const out = [];
|
|
44379
44562
|
for (const waiter of this.waiters.values()) {
|
|
44380
|
-
if (waiter.provider ===
|
|
44563
|
+
if (waiter.provider === provider2) out.push(waiter);
|
|
44381
44564
|
}
|
|
44382
44565
|
return out;
|
|
44383
44566
|
}
|
|
44384
|
-
pruneEmptyProvider(
|
|
44385
|
-
if (this.waitersForProvider(
|
|
44386
|
-
this.providers.delete(
|
|
44567
|
+
pruneEmptyProvider(provider2) {
|
|
44568
|
+
if (this.waitersForProvider(provider2).length === 0) {
|
|
44569
|
+
this.providers.delete(provider2);
|
|
44387
44570
|
}
|
|
44388
44571
|
}
|
|
44389
44572
|
}
|
|
@@ -44406,7 +44589,7 @@ function createUpstreamRecoveryService(options) {
|
|
|
44406
44589
|
}
|
|
44407
44590
|
const deadline = gate.nextDeadline();
|
|
44408
44591
|
if (deadline === null) return;
|
|
44409
|
-
const
|
|
44592
|
+
const delay2 = Math.max(0, deadline - now());
|
|
44410
44593
|
timer2 = setTimeout(() => {
|
|
44411
44594
|
timer2 = void 0;
|
|
44412
44595
|
const due = gate.takeDue(now());
|
|
@@ -44415,7 +44598,7 @@ function createUpstreamRecoveryService(options) {
|
|
|
44415
44598
|
for (const event of due) {
|
|
44416
44599
|
options.onWake(event);
|
|
44417
44600
|
}
|
|
44418
|
-
},
|
|
44601
|
+
}, delay2);
|
|
44419
44602
|
if (typeof timer2 === "object" && "unref" in timer2) {
|
|
44420
44603
|
timer2.unref();
|
|
44421
44604
|
}
|
|
@@ -44427,8 +44610,8 @@ function createUpstreamRecoveryService(options) {
|
|
|
44427
44610
|
schedule();
|
|
44428
44611
|
return result;
|
|
44429
44612
|
},
|
|
44430
|
-
reportSuccess(
|
|
44431
|
-
gate.reportSuccess(
|
|
44613
|
+
reportSuccess(provider2, waiterId) {
|
|
44614
|
+
gate.reportSuccess(provider2, waiterId, now());
|
|
44432
44615
|
emitHealthIfChanged();
|
|
44433
44616
|
schedule();
|
|
44434
44617
|
},
|
|
@@ -46366,15 +46549,15 @@ const MODEL_FAILURES = /* @__PURE__ */ new Set([
|
|
|
46366
46549
|
function providersFrom(state) {
|
|
46367
46550
|
const providers2 = state?.providers;
|
|
46368
46551
|
const raw = Array.isArray(providers2) ? providers2.filter(
|
|
46369
|
-
(
|
|
46552
|
+
(provider2) => Boolean(provider2) && typeof provider2 === "object" && typeof provider2.id === "string"
|
|
46370
46553
|
) : [];
|
|
46371
46554
|
return materializeProviders(raw, getModelDirectorySnapshot());
|
|
46372
46555
|
}
|
|
46373
46556
|
function modelLabel(state, ref) {
|
|
46374
46557
|
if (isVirtualRef(ref))
|
|
46375
46558
|
return findVirtualModel(parseVirtualModels(state?.virtualModels), ref)?.name ?? ref.modelId;
|
|
46376
|
-
const
|
|
46377
|
-
return
|
|
46559
|
+
const provider2 = providersFrom(state).find((item) => item.id === ref.providerId);
|
|
46560
|
+
return provider2 ? `${ref.modelId} (${provider2.name})` : ref.modelId;
|
|
46378
46561
|
}
|
|
46379
46562
|
function usabilityReasonText(reason) {
|
|
46380
46563
|
switch (reason) {
|
|
@@ -49965,9 +50148,9 @@ class DelegationService {
|
|
|
49965
50148
|
failure: "interrupted",
|
|
49966
50149
|
finishedAt: Date.now()
|
|
49967
50150
|
};
|
|
49968
|
-
const
|
|
50151
|
+
const delay2 = this.autoRetryDelay(interrupted);
|
|
49969
50152
|
this.save(
|
|
49970
|
-
|
|
50153
|
+
delay2 === void 0 ? interrupted : { ...interrupted, autoRetryAt: Date.now() + delay2 }
|
|
49971
50154
|
);
|
|
49972
50155
|
}
|
|
49973
50156
|
for (const record2 of deps.store.list()) if (record2.pendingResultEntry) this.postResult(record2);
|
|
@@ -51186,8 +51369,8 @@ ${group.text}` : results;
|
|
|
51186
51369
|
...error ? { error } : {},
|
|
51187
51370
|
...state === "failed" && failure2 === "error" && extra.transient ? { transient: true } : {}
|
|
51188
51371
|
};
|
|
51189
|
-
const
|
|
51190
|
-
if (
|
|
51372
|
+
const delay2 = this.autoRetryDelay(finished);
|
|
51373
|
+
if (delay2 !== void 0) finished = { ...finished, autoRetryAt: Date.now() + delay2 };
|
|
51191
51374
|
if (!this.disposed && this.resultChatId(finished))
|
|
51192
51375
|
finished = {
|
|
51193
51376
|
...finished,
|
|
@@ -54157,7 +54340,7 @@ ${text2}`;
|
|
|
54157
54340
|
scheduleStarted(record2) {
|
|
54158
54341
|
if (record2.state !== "running" || record2.depth !== 1 || !record2.chatId || SILENT_START.has(record2.trigger ?? "delegate") || this.starting.has(record2.id) || this.deps.chats.hasEntry(record2.chatId, progressId(record2.id, "started")))
|
|
54159
54342
|
return;
|
|
54160
|
-
const
|
|
54343
|
+
const delay2 = (record2.startedAt ?? this.now()) + (this.deps.progressDelayMs ?? PROGRESS_STARTED_DELAY_MS) - this.now();
|
|
54161
54344
|
const timer2 = setTimeout(
|
|
54162
54345
|
() => {
|
|
54163
54346
|
this.starting.delete(record2.id);
|
|
@@ -54167,7 +54350,7 @@ ${text2}`;
|
|
|
54167
54350
|
const task = this.deps.store.find(this.board(current2.chatId), current2.taskId);
|
|
54168
54351
|
if (task?.delegationId === current2.id) this.progress(current2, task, "started");
|
|
54169
54352
|
},
|
|
54170
|
-
Math.max(0,
|
|
54353
|
+
Math.max(0, delay2)
|
|
54171
54354
|
);
|
|
54172
54355
|
timer2.unref?.();
|
|
54173
54356
|
this.starting.set(record2.id, timer2);
|
|
@@ -55388,7 +55571,7 @@ class RoutineScheduler {
|
|
|
55388
55571
|
}
|
|
55389
55572
|
arm() {
|
|
55390
55573
|
if (!this.enabled || !this.due.size) return;
|
|
55391
|
-
const
|
|
55574
|
+
const delay2 = Math.max(0, Math.min(...this.due.values()) - Date.now());
|
|
55392
55575
|
this.timer = setTimeout(
|
|
55393
55576
|
() => {
|
|
55394
55577
|
for (const routine of this.deps.store.listAll()) {
|
|
@@ -55398,7 +55581,7 @@ class RoutineScheduler {
|
|
|
55398
55581
|
}
|
|
55399
55582
|
this.refresh();
|
|
55400
55583
|
},
|
|
55401
|
-
Math.min(
|
|
55584
|
+
Math.min(delay2, 2147483647)
|
|
55402
55585
|
);
|
|
55403
55586
|
this.timer.unref?.();
|
|
55404
55587
|
}
|
|
@@ -62126,13 +62309,13 @@ function registerAgentHandlers() {
|
|
|
62126
62309
|
...classified.hint ? { hint: classified.hint } : {}
|
|
62127
62310
|
};
|
|
62128
62311
|
}
|
|
62129
|
-
const
|
|
62312
|
+
const provider2 = isNonEmptyString$5(input.provider) ? input.provider : sourceAuthority?.conversation(input.sessionId)?.selection?.providerId ?? "default";
|
|
62130
62313
|
const since = typeof input.since === "number" && Number.isFinite(input.since) ? input.since : void 0;
|
|
62131
62314
|
const previousAttempt = typeof input.previousAttempt === "number" && Number.isInteger(input.previousAttempt) && input.previousAttempt >= 1 ? input.previousAttempt : void 0;
|
|
62132
62315
|
const decision = upstreamRecovery.reportFailure({
|
|
62133
62316
|
id: input.sessionId,
|
|
62134
62317
|
kind: "session",
|
|
62135
|
-
provider,
|
|
62318
|
+
provider: provider2,
|
|
62136
62319
|
errorKind: classified.kind,
|
|
62137
62320
|
lastError: input.error,
|
|
62138
62321
|
...classified.resetAt !== void 0 ? { resetAt: classified.resetAt } : {},
|
|
@@ -63642,7 +63825,7 @@ function registerAssetHandlers() {
|
|
|
63642
63825
|
ipcMain.handle(
|
|
63643
63826
|
IPC_CHANNELS.ASSETS_LIST_PROJECT_SKILLS,
|
|
63644
63827
|
async (_event, cwd, presetId) => {
|
|
63645
|
-
const { listProjectSkills, listSkillsAt } = await import("./chunks/menuSkills-
|
|
63828
|
+
const { listProjectSkills, listSkillsAt } = await import("./chunks/menuSkills-C-pqhzrG.js");
|
|
63646
63829
|
const agentDir2 = path.join(agentDataDir(), "pi-agent");
|
|
63647
63830
|
const plugin = listSkillsAt(
|
|
63648
63831
|
menuPluginSkillPaths(typeof presetId === "string" && presetId ? presetId : void 0),
|
|
@@ -63713,7 +63896,7 @@ function registerAssetHandlers() {
|
|
|
63713
63896
|
return occupancyForMcp(parseOccupancyIds(ids2), servers, listMcpOccupancyTools);
|
|
63714
63897
|
});
|
|
63715
63898
|
ipcMain.handle(IPC_CHANNELS.ASSETS_BUILTIN_TOOL_OCCUPANCY, async () => {
|
|
63716
|
-
const { snapshotBuiltinOccupancyTools } = await import("./chunks/builtinOccupancy-
|
|
63899
|
+
const { snapshotBuiltinOccupancyTools } = await import("./chunks/builtinOccupancy-K9RUDw3l.js");
|
|
63717
63900
|
return occupancyForBuiltinTools(snapshotBuiltinOccupancyTools());
|
|
63718
63901
|
});
|
|
63719
63902
|
ipcMain.handle(IPC_CHANNELS.INSTRUCTIONS_READ, (_event, id) => {
|
|
@@ -68057,8 +68240,8 @@ function dropRevoked(conn) {
|
|
|
68057
68240
|
function scheduleReconnect(conn) {
|
|
68058
68241
|
if (conn.closed) return;
|
|
68059
68242
|
if (conn.timer) clearTimeout(conn.timer);
|
|
68060
|
-
const
|
|
68061
|
-
conn.timer = setTimeout(() => connect(conn),
|
|
68243
|
+
const delay2 = backoffDelay(conn.attempt++);
|
|
68244
|
+
conn.timer = setTimeout(() => connect(conn), delay2);
|
|
68062
68245
|
}
|
|
68063
68246
|
function enqueueFrame(conn, frame) {
|
|
68064
68247
|
const task = conn.receiveQueue.then(async () => {
|
|
@@ -70342,9 +70525,9 @@ function parseOauthFlowControlRequest(value) {
|
|
|
70342
70525
|
async function listClassifierModels(providerId) {
|
|
70343
70526
|
if (typeof providerId !== "string" || !providerId) return [];
|
|
70344
70527
|
const providers2 = readSettingsState()?.providers;
|
|
70345
|
-
const
|
|
70346
|
-
if (!
|
|
70347
|
-
const piProvider = classifierProviderFor(
|
|
70528
|
+
const provider2 = Array.isArray(providers2) ? providers2.find((entry) => entry?.id === providerId) : void 0;
|
|
70529
|
+
if (!provider2 || typeof provider2 !== "object") return [];
|
|
70530
|
+
const piProvider = classifierProviderFor(provider2);
|
|
70348
70531
|
if (!piProvider) return [];
|
|
70349
70532
|
const runtime = await getRuntime();
|
|
70350
70533
|
return runtime.getModelsOfType("classifier", providerIdOfAccountKey(piProvider)).map((model) => ({ id: model.id, name: model.name || model.id }));
|
|
@@ -71074,12 +71257,12 @@ async function parseCcSwitchConfig(appType, config) {
|
|
|
71074
71257
|
};
|
|
71075
71258
|
case "codex": {
|
|
71076
71259
|
const toml = await parseTomlSafe(str$3(config.config));
|
|
71077
|
-
const
|
|
71078
|
-
if (!
|
|
71260
|
+
const provider2 = Object.values(obj(toml.model_providers)).map(obj)[0];
|
|
71261
|
+
if (!provider2) return null;
|
|
71079
71262
|
return {
|
|
71080
71263
|
apiKey: str$3(obj(config.auth).OPENAI_API_KEY),
|
|
71081
|
-
baseUrl: str$3(
|
|
71082
|
-
api: str$3(
|
|
71264
|
+
baseUrl: str$3(provider2.base_url),
|
|
71265
|
+
api: str$3(provider2.wire_api) === "responses" ? "openai-responses" : "openai-completions",
|
|
71083
71266
|
models: toModelEntries(str$3(toml.model) ? [str$3(toml.model)] : [])
|
|
71084
71267
|
};
|
|
71085
71268
|
}
|
|
@@ -71153,8 +71336,8 @@ async function readCherryStudio(leveldbDir) {
|
|
|
71153
71336
|
const root = decodeLevelValue(value);
|
|
71154
71337
|
const llm = obj(parseJson$1(root?.llm));
|
|
71155
71338
|
const providers2 = Array.isArray(llm.providers) ? llm.providers : [];
|
|
71156
|
-
return providers2.flatMap((
|
|
71157
|
-
const item = obj(
|
|
71339
|
+
return providers2.flatMap((provider2) => {
|
|
71340
|
+
const item = obj(provider2);
|
|
71158
71341
|
const name = str$3(item.name ?? item.id);
|
|
71159
71342
|
if (!name) return [];
|
|
71160
71343
|
return [
|
|
@@ -71179,8 +71362,8 @@ async function readCherryStudio(leveldbDir) {
|
|
|
71179
71362
|
}
|
|
71180
71363
|
}
|
|
71181
71364
|
function readYamlProviders(appId, providers2) {
|
|
71182
|
-
return providers2.flatMap((
|
|
71183
|
-
const item = obj(
|
|
71365
|
+
return providers2.flatMap((provider2) => {
|
|
71366
|
+
const item = obj(provider2);
|
|
71184
71367
|
const name = str$3(item.name ?? item.id);
|
|
71185
71368
|
if (!name) return [];
|
|
71186
71369
|
const baseUrl = str$3(item.apiHost || item.baseUrl || item.base_url);
|
|
@@ -71236,7 +71419,7 @@ function readClaudeCode(settingsPath) {
|
|
|
71236
71419
|
models: suffix ? [] : defaultModels
|
|
71237
71420
|
});
|
|
71238
71421
|
}
|
|
71239
|
-
if (!providers2.some((
|
|
71422
|
+
if (!providers2.some((provider2) => provider2.name === "Claude Code")) {
|
|
71240
71423
|
const apiKey = str$3(env.ANTHROPIC_API_KEY);
|
|
71241
71424
|
if (apiKey) {
|
|
71242
71425
|
providers2.push({
|
|
@@ -71308,8 +71491,8 @@ function readEnsoAi(settingsPath) {
|
|
|
71308
71491
|
const state = obj(obj(settings2["enso-settings"]).state);
|
|
71309
71492
|
const providers2 = obj(state.claudeCodeIntegration).providers;
|
|
71310
71493
|
if (!Array.isArray(providers2)) return [];
|
|
71311
|
-
return providers2.flatMap((
|
|
71312
|
-
const item = obj(
|
|
71494
|
+
return providers2.flatMap((provider2) => {
|
|
71495
|
+
const item = obj(provider2);
|
|
71313
71496
|
const apiKey = str$3(item.authToken ?? item.apiKey);
|
|
71314
71497
|
if (!apiKey) return [];
|
|
71315
71498
|
const modelIds = [
|
|
@@ -71385,8 +71568,8 @@ function existingFingerprints() {
|
|
|
71385
71568
|
const state = settings2?.["enso-settings"]?.state;
|
|
71386
71569
|
const providers2 = Array.isArray(state?.providers) ? state.providers : [];
|
|
71387
71570
|
return new Set(
|
|
71388
|
-
providers2.map((
|
|
71389
|
-
const item =
|
|
71571
|
+
providers2.map((provider2) => {
|
|
71572
|
+
const item = provider2;
|
|
71390
71573
|
return fingerprint(item.baseUrl ?? "", item.apiKey ?? "");
|
|
71391
71574
|
}).filter((value) => value !== "::")
|
|
71392
71575
|
);
|
|
@@ -71436,23 +71619,23 @@ async function scanLocalProviders() {
|
|
|
71436
71619
|
try {
|
|
71437
71620
|
const discovered = await readApp(appId, filePath);
|
|
71438
71621
|
const usable = discovered.filter(
|
|
71439
|
-
(
|
|
71622
|
+
(provider2) => (isUsableApiKey(provider2.apiKey) || provider2.api === "ollama") && (provider2.baseUrl === "" || isHttpUrl(provider2.baseUrl))
|
|
71440
71623
|
);
|
|
71441
71624
|
report.status = "found";
|
|
71442
71625
|
report.candidateCount = usable.length;
|
|
71443
|
-
for (const
|
|
71626
|
+
for (const provider2 of usable) {
|
|
71444
71627
|
const candidate = {
|
|
71445
71628
|
id: randomUUID(),
|
|
71446
71629
|
appId,
|
|
71447
71630
|
appName: APP_NAMES[appId],
|
|
71448
|
-
name:
|
|
71449
|
-
api:
|
|
71450
|
-
apiKeyMasked: maskKey(
|
|
71451
|
-
baseUrl:
|
|
71452
|
-
modelIds:
|
|
71453
|
-
duplicated: known.has(fingerprint(
|
|
71631
|
+
name: provider2.name,
|
|
71632
|
+
api: provider2.api,
|
|
71633
|
+
apiKeyMasked: maskKey(provider2.apiKey),
|
|
71634
|
+
baseUrl: provider2.baseUrl,
|
|
71635
|
+
modelIds: provider2.models.map((model) => model.label || model.id),
|
|
71636
|
+
duplicated: known.has(fingerprint(provider2.baseUrl, provider2.apiKey))
|
|
71454
71637
|
};
|
|
71455
|
-
byId2.set(candidate.id, { candidate, discovered:
|
|
71638
|
+
byId2.set(candidate.id, { candidate, discovered: provider2 });
|
|
71456
71639
|
candidates.push(candidate);
|
|
71457
71640
|
}
|
|
71458
71641
|
} catch (error) {
|
|
@@ -73615,11 +73798,11 @@ function createDispatchDriver(ports) {
|
|
|
73615
73798
|
clock2()
|
|
73616
73799
|
);
|
|
73617
73800
|
if (classified.kind === "transient" || classified.kind === "quota") {
|
|
73618
|
-
const
|
|
73801
|
+
const provider2 = event.provider ?? ports.providerOf?.(conversationId) ?? goal.retry?.provider ?? "default";
|
|
73619
73802
|
const result = ports.upstreamRecovery.reportFailure({
|
|
73620
73803
|
id: conversationId,
|
|
73621
73804
|
kind: "session",
|
|
73622
|
-
provider,
|
|
73805
|
+
provider: provider2,
|
|
73623
73806
|
errorKind: classified.kind,
|
|
73624
73807
|
lastError: event.error,
|
|
73625
73808
|
...classified.resetAt !== void 0 ? { resetAt: classified.resetAt } : {},
|
|
@@ -75790,8 +75973,8 @@ function createQueuedSessions(ports) {
|
|
|
75790
75973
|
const queued = queuedStartOf(current2);
|
|
75791
75974
|
if (!queued) return null;
|
|
75792
75975
|
const nextAttempt = (queued.retryCount ?? 0) + 1;
|
|
75793
|
-
const
|
|
75794
|
-
if (
|
|
75976
|
+
const delay2 = nextPendingRetryDelayMs(nextAttempt);
|
|
75977
|
+
if (delay2 === null) return null;
|
|
75795
75978
|
deferredAttempt = nextAttempt;
|
|
75796
75979
|
const { startingAt: _startingAt, failed: _failed, ...rest } = queued;
|
|
75797
75980
|
return {
|
|
@@ -75799,7 +75982,7 @@ function createQueuedSessions(ports) {
|
|
|
75799
75982
|
queuedStart: {
|
|
75800
75983
|
...rest,
|
|
75801
75984
|
retryCount: nextAttempt,
|
|
75802
|
-
nextRetryAt: now +
|
|
75985
|
+
nextRetryAt: now + delay2,
|
|
75803
75986
|
lastError: error
|
|
75804
75987
|
}
|
|
75805
75988
|
};
|
|
@@ -89042,8 +89225,8 @@ function toolResultText(message2) {
|
|
|
89042
89225
|
return (message2.content ?? []).map((part) => typeof part.text === "string" ? part.text : "").join("");
|
|
89043
89226
|
}
|
|
89044
89227
|
class RunTranscript {
|
|
89045
|
-
constructor(
|
|
89046
|
-
this.provider =
|
|
89228
|
+
constructor(provider2, pricing, now = Date.now) {
|
|
89229
|
+
this.provider = provider2;
|
|
89047
89230
|
this.pricing = pricing;
|
|
89048
89231
|
this.now = now;
|
|
89049
89232
|
}
|
|
@@ -89201,18 +89384,18 @@ function coerceProvider(value) {
|
|
|
89201
89384
|
...raw.oauthAccountPool ? { oauthAccountPool: raw.oauthAccountPool } : {}
|
|
89202
89385
|
};
|
|
89203
89386
|
}
|
|
89204
|
-
function enabledModelId(
|
|
89387
|
+
function enabledModelId(provider2, preferred) {
|
|
89205
89388
|
if (preferred) {
|
|
89206
|
-
const match =
|
|
89389
|
+
const match = provider2.models.find(
|
|
89207
89390
|
(model) => model.id === preferred && model.enabled !== false
|
|
89208
89391
|
);
|
|
89209
89392
|
return match ? match.id : null;
|
|
89210
89393
|
}
|
|
89211
|
-
return
|
|
89394
|
+
return provider2.models.find((model) => model.enabled !== false)?.id ?? null;
|
|
89212
89395
|
}
|
|
89213
|
-
function withModel(
|
|
89214
|
-
if (
|
|
89215
|
-
return { ...
|
|
89396
|
+
function withModel(provider2, modelId) {
|
|
89397
|
+
if (provider2.models.some((model) => model.id === modelId)) return provider2;
|
|
89398
|
+
return { ...provider2, models: [...provider2.models, { id: modelId }] };
|
|
89216
89399
|
}
|
|
89217
89400
|
function resolveRunProvider(request2, providersRaw) {
|
|
89218
89401
|
const rawList = Array.isArray(providersRaw) ? [...providersRaw] : [];
|
|
@@ -89224,7 +89407,7 @@ function resolveRunProvider(request2, providersRaw) {
|
|
|
89224
89407
|
const id = request2.providerId || "enso-run";
|
|
89225
89408
|
const api = inferApi(request2.baseUrl, request2.api);
|
|
89226
89409
|
const baseUrl = request2.baseUrl || DEFAULT_BASE_URLS[api];
|
|
89227
|
-
const index22 = known.findIndex((
|
|
89410
|
+
const index22 = known.findIndex((provider22) => provider22?.id === id);
|
|
89228
89411
|
const previous = index22 >= 0 ? known[index22] : null;
|
|
89229
89412
|
const base = previous ?? {
|
|
89230
89413
|
id,
|
|
@@ -89259,33 +89442,33 @@ function resolveRunProvider(request2, providersRaw) {
|
|
|
89259
89442
|
}
|
|
89260
89443
|
};
|
|
89261
89444
|
}
|
|
89262
|
-
const usable = known.filter((
|
|
89263
|
-
const
|
|
89264
|
-
if (!
|
|
89445
|
+
const usable = known.filter((provider22) => provider22 !== null);
|
|
89446
|
+
const provider2 = (request2.providerId ? usable.find((item) => item.id === request2.providerId) : void 0) ?? (!request2.providerId ? usable.find((item) => item.enabled && enabledModelId(item)) : void 0);
|
|
89447
|
+
if (!provider2) {
|
|
89265
89448
|
return {
|
|
89266
89449
|
ok: false,
|
|
89267
89450
|
error: request2.providerId ? `设置里没有服务商 ${request2.providerId}` : "没有可用服务商。用 --api-key、--base-url 和 --model 指定,或先写入 settings.json"
|
|
89268
89451
|
};
|
|
89269
89452
|
}
|
|
89270
|
-
if (!
|
|
89271
|
-
let modelId = enabledModelId(
|
|
89272
|
-
let next =
|
|
89453
|
+
if (!provider2.enabled) return { ok: false, error: `服务商 ${provider2.id} 已停用` };
|
|
89454
|
+
let modelId = enabledModelId(provider2, request2.modelId);
|
|
89455
|
+
let next = provider2;
|
|
89273
89456
|
if (!modelId && request2.modelId) {
|
|
89274
|
-
next = withModel(
|
|
89457
|
+
next = withModel(provider2, request2.modelId);
|
|
89275
89458
|
modelId = request2.modelId;
|
|
89276
89459
|
}
|
|
89277
|
-
if (!modelId) return { ok: false, error: `服务商 ${
|
|
89278
|
-
const reason = modelUsability({ providerId:
|
|
89460
|
+
if (!modelId) return { ok: false, error: `服务商 ${provider2.id} 没有可用模型` };
|
|
89461
|
+
const reason = modelUsability({ providerId: provider2.id, modelId }, [next], {
|
|
89279
89462
|
oauthCredentials: { status: "ready", authenticatedAccountKeys: /* @__PURE__ */ new Set() }
|
|
89280
89463
|
});
|
|
89281
89464
|
if (reason !== "usable") return { ok: false, error: `模型不可用: ${reason}` };
|
|
89282
|
-
const index2 = known.findIndex((item) => item?.id ===
|
|
89465
|
+
const index2 = known.findIndex((item) => item?.id === provider2.id);
|
|
89283
89466
|
const providers2 = [...rawList];
|
|
89284
89467
|
if (index2 >= 0) providers2[index2] = next;
|
|
89285
89468
|
return {
|
|
89286
89469
|
ok: true,
|
|
89287
89470
|
value: {
|
|
89288
|
-
providerId:
|
|
89471
|
+
providerId: provider2.id,
|
|
89289
89472
|
modelId,
|
|
89290
89473
|
providers: providers2,
|
|
89291
89474
|
changed: JSON.stringify(providers2) !== JSON.stringify(rawList)
|
|
@@ -90394,14 +90577,14 @@ class ServerUpdater {
|
|
|
90394
90577
|
return;
|
|
90395
90578
|
}
|
|
90396
90579
|
const remaining = this.idleGate.delayUntilReadyMs(now);
|
|
90397
|
-
const
|
|
90580
|
+
const delay2 = Math.min(
|
|
90398
90581
|
remaining === null ? BUSY_POLL_MS : Math.max(remaining, 250),
|
|
90399
90582
|
AUTO_RESTART_IDLE_MS
|
|
90400
90583
|
);
|
|
90401
90584
|
this.idleTimer = setTimeout(() => {
|
|
90402
90585
|
this.idleTimer = null;
|
|
90403
90586
|
this.notifyIdleStateChanged();
|
|
90404
|
-
},
|
|
90587
|
+
}, delay2);
|
|
90405
90588
|
this.idleTimer.unref?.();
|
|
90406
90589
|
}
|
|
90407
90590
|
clearIdleTimer() {
|