@ensocode/server 0.3.15-beta.240 → 0.3.15-beta.243
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-XiL-l5PI.js → EditDiff-dV8SxcNO.js} +1 -1
- package/out/phone/assets/{ReadFileView-CpFSSRpt.js → ReadFileView-BL74jSoX.js} +1 -1
- package/out/phone/assets/{abnfDiagram-VCTEODGH-DazQZSv_.js → abnfDiagram-VCTEODGH-CEKu-VDa.js} +1 -1
- package/out/phone/assets/architecture-7GRP2DOG-Ck0TCz23.js +1 -0
- package/out/phone/assets/{architectureDiagram-5GKGNRK7-DG5K6Su1.js → architectureDiagram-5GKGNRK7-DZSF1JKX.js} +1 -1
- package/out/phone/assets/{blockDiagram-I7D4REHJ-ajgyqJXe.js → blockDiagram-I7D4REHJ-DbETbGjb.js} +1 -1
- package/out/phone/assets/{c4Diagram-7LVT6UL2-qHAVjxM_.js → c4Diagram-7LVT6UL2-_6Y-r-uC.js} +1 -1
- package/out/phone/assets/channel-BE5zs32I.js +1 -0
- package/out/phone/assets/{chunk-4HAMMTFA-u69nZNu9.js → chunk-4HAMMTFA-vCRskPi2.js} +1 -1
- package/out/phone/assets/{chunk-75Z2AOVW-kY4F26Wh.js → chunk-75Z2AOVW-BmrgBCi6.js} +1 -1
- package/out/phone/assets/{chunk-DU6HZSFF-BgKQRmB0.js → chunk-DU6HZSFF-DKPNBHNE.js} +1 -1
- package/out/phone/assets/{chunk-F27PBJKO-c1ETtt2d.js → chunk-F27PBJKO-L0-uVWLV.js} +1 -1
- package/out/phone/assets/{chunk-GMAD6QVW-DdXUBdDH.js → chunk-GMAD6QVW-DXo2TRvH.js} +1 -1
- package/out/phone/assets/{chunk-GVQU2GXP-dKT6pw8a.js → chunk-GVQU2GXP-CDwb8f7v.js} +1 -1
- package/out/phone/assets/{chunk-IMKFNOWR-DvdOmIA1.js → chunk-IMKFNOWR-DAErcQ9l.js} +1 -1
- package/out/phone/assets/{chunk-L3NEJ4N5-BxVxA1MI.js → chunk-L3NEJ4N5-CFyx_Rve.js} +1 -1
- package/out/phone/assets/{chunk-OSK3NFVY-BUQykTA7.js → chunk-OSK3NFVY-DkC9IrH5.js} +1 -1
- package/out/phone/assets/{chunk-P2QGCYS3-PEfAPaln.js → chunk-P2QGCYS3-F1s8U5mo.js} +1 -1
- package/out/phone/assets/{chunk-POPQ4Y6H-BFPZeUpT.js → chunk-POPQ4Y6H--k158s9f.js} +1 -1
- package/out/phone/assets/{chunk-PWAF6VOD-hSMQrZMV.js → chunk-PWAF6VOD-CTM9mqxJ.js} +1 -1
- package/out/phone/assets/{chunk-SHT3W25Y-k9LZnAbd.js → chunk-SHT3W25Y-CqyCB6AP.js} +1 -1
- package/out/phone/assets/{chunk-SVP7TREG-BuSNDJ4M.js → chunk-SVP7TREG-DqzhG60d.js} +1 -1
- package/out/phone/assets/{chunk-TICWLB2K-CenNvPLg.js → chunk-TICWLB2K-CHNZrV0N.js} +1 -1
- package/out/phone/assets/classDiagram-ZZMXUADV-CZaWI4f1.js +1 -0
- package/out/phone/assets/classDiagram-v2-VYDZK3BY-CZaWI4f1.js +1 -0
- package/out/phone/assets/{codeHighlighter-Vw6QAm1k.js → codeHighlighter-Bq1tgZ31.js} +1 -1
- package/out/phone/assets/{cynefin-OW5HDTMX-DFvQp9Qe.js → cynefin-OW5HDTMX-D7FIJ5TE.js} +1 -1
- package/out/phone/assets/{cynefinDiagram-5FMLGOSQ-DznqjwdD.js → cynefinDiagram-5FMLGOSQ-CwRefxxR.js} +1 -1
- package/out/phone/assets/{dagre-GXQ25YYZ-Co1sLXqm.js → dagre-GXQ25YYZ-2k5JKLap.js} +1 -1
- package/out/phone/assets/{desk-YcsUZG7u.js → desk-2DcKD4PO.js} +1 -1
- package/out/phone/assets/{diagram-S7CK7UJ4-BVZwukFL.js → diagram-S7CK7UJ4-COP6uauS.js} +1 -1
- package/out/phone/assets/{diagram-UQ7AKVKN-FnuPXxn9.js → diagram-UQ7AKVKN-DGe3w4Mb.js} +1 -1
- package/out/phone/assets/{diagram-VSXAHHWV-CL0_vSmH.js → diagram-VSXAHHWV-BdL-Y7lZ.js} +1 -1
- package/out/phone/assets/{diagram-VX7I27RA-CBWnoa7C.js → diagram-VX7I27RA-Cmm1PcJ7.js} +1 -1
- package/out/phone/assets/{diagram-Z3DM3KII-DP2i6Nab.js → diagram-Z3DM3KII-BELK9Cyu.js} +1 -1
- package/out/phone/assets/{ebnfDiagram-PWID7BFC-AzdUDwlS.js → ebnfDiagram-PWID7BFC-DprpRwix.js} +1 -1
- package/out/phone/assets/{erDiagram-RLTQ6QDP-Dsf_M2LC.js → erDiagram-RLTQ6QDP-I2-zilY7.js} +1 -1
- package/out/phone/assets/eventmodeling-NTZA5JFV-DHZXyZ9N.js +1 -0
- package/out/phone/assets/flowDiagram-HODETNUW-C767Y7I4.js +1 -0
- package/out/phone/assets/{ganttDiagram-EL5Y4UJY-XRioaZLM.js → ganttDiagram-EL5Y4UJY-BwfKo0BI.js} +1 -1
- package/out/phone/assets/{gitGraph-4MIJSDKK-D0ivix8u.js → gitGraph-4MIJSDKK-07eg-1Rq.js} +1 -1
- package/out/phone/assets/{gitGraphDiagram-WWUBYQGX-CqmFJCAU.js → gitGraphDiagram-WWUBYQGX-CbVbFZC2.js} +1 -1
- package/out/phone/assets/{info-A6RAGUB7-BZ69g_fw.js → info-A6RAGUB7-DLHHu_G9.js} +1 -1
- package/out/phone/assets/{infoDiagram-27XIBGKW-aYsMvhe5.js → infoDiagram-27XIBGKW-cLqkTO5u.js} +1 -1
- package/out/phone/assets/{ishikawaDiagram-5VMMS53U-CmBVBjJT.js → ishikawaDiagram-5VMMS53U-Cd8fSl-A.js} +1 -1
- package/out/phone/assets/{journeyDiagram-3NMN7TZE-BoY_lC0j.js → journeyDiagram-3NMN7TZE-BtjAbCrz.js} +1 -1
- package/out/phone/assets/{kanban-definition-UXKFOSKX-B5aEO9tu.js → kanban-definition-UXKFOSKX-DndWaQnc.js} +1 -1
- package/out/phone/assets/{line-D57BAt5Y.js → line-Daz1Pnrk.js} +1 -1
- package/out/phone/assets/main-6fqTYTkO.css +2 -0
- package/out/phone/assets/{main-BZYGEXQW.js → main-D-KAtgTj.js} +37 -37
- package/out/phone/assets/{mermaid-parser.core-DHwLXlJr.js → mermaid-parser.core-DXa4u2HJ.js} +3 -3
- package/out/phone/assets/{mermaid.core-jjfo4hhh.js → mermaid.core-DzGM-Ye4.js} +4 -4
- package/out/phone/assets/{mindmap-definition-YA3MSWOX-4Kk3P_nC.js → mindmap-definition-YA3MSWOX-nro3b7Qu.js} +1 -1
- package/out/phone/assets/{packet-AYTQ26CC-Bbt8I8of.js → packet-AYTQ26CC-lfMwTpBv.js} +1 -1
- package/out/phone/assets/{pegDiagram-XKGWAZYB-D9TJYzFE.js → pegDiagram-XKGWAZYB-DCAqCUIc.js} +1 -1
- package/out/phone/assets/{pie-WAS4IAKB-CpRv0soJ.js → pie-WAS4IAKB-BwocEZEZ.js} +1 -1
- package/out/phone/assets/{pieDiagram-E7YTZNPT-wsiDXZiI.js → pieDiagram-E7YTZNPT-RtZ3p-o4.js} +1 -1
- package/out/phone/assets/{quadrantDiagram-AXDQQJYC-Q6yFFpVe.js → quadrantDiagram-AXDQQJYC-DfOq0__S.js} +1 -1
- package/out/phone/assets/{radar-RG4KPBEZ-D03KgP_q.js → radar-RG4KPBEZ-CSpvoUTZ.js} +1 -1
- package/out/phone/assets/{railroad-74A4TZTK-BLFYq0jd.js → railroad-74A4TZTK-CycLSwqm.js} +1 -1
- package/out/phone/assets/railroad-abnf-HS5TGJTU-hrMHL4K3.js +1 -0
- package/out/phone/assets/railroad-ebnf-LZEXJU2U-BYCRhR6k.js +1 -0
- package/out/phone/assets/railroad-peg-WCYAUIDC-DsR1d8D_.js +1 -0
- package/out/phone/assets/{railroadDiagram-O6MQD6OU-ZdYiXn62.js → railroadDiagram-O6MQD6OU-BN5MHF6W.js} +1 -1
- package/out/phone/assets/{requirementDiagram-BXWQKSXE-B_7vc64X.js → requirementDiagram-BXWQKSXE-DIu5xE9B.js} +1 -1
- package/out/phone/assets/{sankeyDiagram-P5KCCOFB-4n6yLwLB.js → sankeyDiagram-P5KCCOFB-BstydEqp.js} +1 -1
- package/out/phone/assets/{sequenceDiagram-WJ2MYXX4-C_l-LHIg.js → sequenceDiagram-WJ2MYXX4-CcUvBArn.js} +1 -1
- package/out/phone/assets/{shellUpdate-CyY9ugiN.js → shellUpdate-CmGIiHAj.js} +1 -1
- package/out/phone/assets/{stateDiagram-D77RDMKH-CgPcsrGk.js → stateDiagram-D77RDMKH-zg_p65lf.js} +1 -1
- package/out/phone/assets/stateDiagram-v2-MP3YSRHH-y0nVL_Wz.js +1 -0
- package/out/phone/assets/{swimlanes-42K2YHIH-DXhwzVlA.js → swimlanes-42K2YHIH-DLRevnN4.js} +1 -1
- package/out/phone/assets/swimlanesDiagram-VR7AAH4N-BXCOZBRL.js +8 -0
- package/out/phone/assets/{timeline-definition-24CTP7MA-Dhqcybib.js → timeline-definition-24CTP7MA-CA07Zepd.js} +1 -1
- package/out/phone/assets/{treeView-Q6P3EWNA-D944lb0J.js → treeView-Q6P3EWNA-B8Zz7Snr.js} +1 -1
- package/out/phone/assets/{treemap-WGGIJYW6-SvjVIc_e.js → treemap-WGGIJYW6-CPAU7wdT.js} +1 -1
- package/out/phone/assets/{vennDiagram-4TSXK5OY-BoJHneQg.js → vennDiagram-4TSXK5OY-CwdYkM1f.js} +1 -1
- package/out/phone/assets/{wardley-WFR3VGLG-BooUrlYZ.js → wardley-WFR3VGLG-CskqkmNX.js} +1 -1
- package/out/phone/assets/{wardleyDiagram-VM6X3IG4-BGNB94BV.js → wardleyDiagram-VM6X3IG4-DFuB2mB3.js} +1 -1
- package/out/phone/assets/{xychartDiagram-S5SC5T6Z-cwmBbDMK.js → xychartDiagram-S5SC5T6Z-B-zDdHgv.js} +1 -1
- package/out/phone/desk.html +3 -3
- package/out/phone/index.html +4 -4
- package/out/phone/sw.js +2 -2
- package/out/renderer/assets/{EditDiff-C5tSOQb2.js → EditDiff-BhdEeLFW.js} +1 -1
- package/out/renderer/assets/{ReadFileView-VbAe6o1G.js → ReadFileView-zU2KPPdT.js} +1 -1
- package/out/renderer/assets/{SidePanel-BGXusuy3.js → SidePanel-0icYoJ5O.js} +1 -1
- package/out/renderer/assets/{abnfDiagram-VCTEODGH-BxdReQfq.js → abnfDiagram-VCTEODGH-DdIPktDk.js} +1 -1
- package/out/renderer/assets/{arc-8V7jHSRR.js → arc-B6R80ZK6.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-5GKGNRK7-o4VFatqe.js → architectureDiagram-5GKGNRK7-DcXnCOUz.js} +1 -1
- package/out/renderer/assets/{blockDiagram-I7D4REHJ-yNuNnW72.js → blockDiagram-I7D4REHJ-CKku8GkS.js} +1 -1
- package/out/renderer/assets/{c4Diagram-7LVT6UL2-B3IZXQYK.js → c4Diagram-7LVT6UL2-Dl6RR3j-.js} +1 -1
- package/out/renderer/assets/channel-ChHA9tHt.js +1 -0
- package/out/renderer/assets/{chunk-2Q5K7J3B-DlsQFyyV.js → chunk-2Q5K7J3B-D8Iw_pkf.js} +1 -1
- package/out/renderer/assets/{chunk-5VM5RSS4-Du1d7WRE.js → chunk-5VM5RSS4-DUhSpdls.js} +1 -1
- package/out/renderer/assets/{chunk-F27PBJKO-BHG4Cmdu.js → chunk-F27PBJKO-W5SL8MUr.js} +1 -1
- package/out/renderer/assets/{chunk-IMKFNOWR-BnSfItoF.js → chunk-IMKFNOWR-PLwPndGV.js} +1 -1
- package/out/renderer/assets/{chunk-JWPE2WC7-BC8tfm2i.js → chunk-JWPE2WC7-6blIrMdp.js} +1 -1
- package/out/renderer/assets/{chunk-POPQ4Y6H-UsUDNVEz.js → chunk-POPQ4Y6H-dx-1wuPc.js} +1 -1
- package/out/renderer/assets/{chunk-SVP7TREG-Bgkn_YQq.js → chunk-SVP7TREG-rOchctsj.js} +1 -1
- package/out/renderer/assets/{chunk-TICWLB2K-BqUXAsWB.js → chunk-TICWLB2K-DRaCXImj.js} +1 -1
- package/out/renderer/assets/{chunk-XXDRQBXY-LfY-ZzDR.js → chunk-XXDRQBXY-BCrhC30c.js} +1 -1
- package/out/renderer/assets/classDiagram-ZZMXUADV-Cs094JZn.js +1 -0
- package/out/renderer/assets/classDiagram-v2-VYDZK3BY-Cs094JZn.js +1 -0
- package/out/renderer/assets/{cose-bilkent-JH36ORCC-CgtI1_Gy.js → cose-bilkent-JH36ORCC-D4e0PFmW.js} +1 -1
- package/out/renderer/assets/{cynefin-OW5HDTMX-DLFr8vmt.js → cynefin-OW5HDTMX-RLQgcB4O.js} +1 -1
- package/out/renderer/assets/{cynefinDiagram-5FMLGOSQ-BcT60hkk.js → cynefinDiagram-5FMLGOSQ-Be4QVxeQ.js} +1 -1
- package/out/renderer/assets/{dagre-GXQ25YYZ-48Dz0fF7.js → dagre-GXQ25YYZ-D4dEms30.js} +1 -1
- package/out/renderer/assets/{diagram-S7CK7UJ4-96rXPSnH.js → diagram-S7CK7UJ4-D1bZM8kp.js} +1 -1
- package/out/renderer/assets/{diagram-UQ7AKVKN-DMHZUHdH.js → diagram-UQ7AKVKN-BUOm9kVS.js} +1 -1
- package/out/renderer/assets/{diagram-VSXAHHWV-CTqw8eFX.js → diagram-VSXAHHWV-Maay-egJ.js} +1 -1
- package/out/renderer/assets/{diagram-VX7I27RA-BtRe1HVA.js → diagram-VX7I27RA-DHioBbkr.js} +1 -1
- package/out/renderer/assets/{diagram-Z3DM3KII-Hj9lO76-.js → diagram-Z3DM3KII-NoBOALE6.js} +1 -1
- package/out/renderer/assets/{ebnfDiagram-PWID7BFC-C5t3c4Se.js → ebnfDiagram-PWID7BFC-DKsMlGNO.js} +1 -1
- package/out/renderer/assets/{erDiagram-RLTQ6QDP-B-eR6akq.js → erDiagram-RLTQ6QDP-CrceugA8.js} +1 -1
- package/out/renderer/assets/{flowDiagram-HODETNUW-Bw9VQ570.js → flowDiagram-HODETNUW-Dsyooc0w.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-EL5Y4UJY-DuJm4569.js → ganttDiagram-EL5Y4UJY-CA6uw94p.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-WWUBYQGX-DbRtG2nJ.js → gitGraphDiagram-WWUBYQGX-CKwMGVqQ.js} +1 -1
- package/out/renderer/assets/{index-mJjIny4N.js → index-D4LxgFqz.js} +270 -270
- package/out/renderer/assets/index-VOhKg_w1.css +1 -0
- package/out/renderer/assets/{infoDiagram-27XIBGKW-DhQK0Qdj.js → infoDiagram-27XIBGKW-D_WUVG3l.js} +1 -1
- package/out/renderer/assets/{ishikawaDiagram-5VMMS53U-lvDqP9aC.js → ishikawaDiagram-5VMMS53U-CJy9QY0P.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-3NMN7TZE-CjhsT3Ie.js → journeyDiagram-3NMN7TZE-BJCGt5LN.js} +1 -1
- package/out/renderer/assets/{kanban-definition-UXKFOSKX-CnNxr_wk.js → kanban-definition-UXKFOSKX-DEsx9e2o.js} +1 -1
- package/out/renderer/assets/{layout-Cr2KdY-M.js → layout-Do2DxdOh.js} +1 -1
- package/out/renderer/assets/{linear-DkNm1Gso.js → linear-D7u4_Jet.js} +1 -1
- package/out/renderer/assets/{mermaid.core-ioNz7ync.js → mermaid.core-CheRwdcN.js} +5 -5
- package/out/renderer/assets/{mindmap-definition-YA3MSWOX-DwYNeUyM.js → mindmap-definition-YA3MSWOX-Dj1zY6Tj.js} +1 -1
- package/out/renderer/assets/{pegDiagram-XKGWAZYB-iOfmwe_o.js → pegDiagram-XKGWAZYB-DeMHxEYt.js} +1 -1
- package/out/renderer/assets/{pieDiagram-E7YTZNPT-BB5H6jIJ.js → pieDiagram-E7YTZNPT-BzKBvB16.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-AXDQQJYC-DPCGd1Lz.js → quadrantDiagram-AXDQQJYC-DPa4vyO_.js} +1 -1
- package/out/renderer/assets/{railroadDiagram-O6MQD6OU-SAFinsIi.js → railroadDiagram-O6MQD6OU-DC5n1jqP.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-BXWQKSXE-Ch7UA4PM.js → requirementDiagram-BXWQKSXE-BFGfpcAs.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-P5KCCOFB-DE8_TU0r.js → sankeyDiagram-P5KCCOFB-CWzuO7ij.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-WJ2MYXX4-g61Xe6T0.js → sequenceDiagram-WJ2MYXX4-6pbC_bzq.js} +1 -1
- package/out/renderer/assets/{sessionChanges-DJKK-W-b.js → sessionChanges-BpE_kf6a.js} +1 -1
- package/out/renderer/assets/{sizeCapture-INFHLROL-CVrBFmtN.js → sizeCapture-INFHLROL-BVbSh92j.js} +1 -1
- package/out/renderer/assets/{stateDiagram-D77RDMKH-CMlTHXDm.js → stateDiagram-D77RDMKH-DEsyHHV6.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-B-VkOaQO.js +1 -0
- package/out/renderer/assets/{swimlanes-42K2YHIH-DV_Cima1.js → swimlanes-42K2YHIH-PUiwxgii.js} +1 -1
- package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-gjV0EuTL.js +8 -0
- package/out/renderer/assets/{timeline-definition-24CTP7MA-CXvrSM6T.js → timeline-definition-24CTP7MA-DLRxhkx9.js} +1 -1
- package/out/renderer/assets/{vennDiagram-4TSXK5OY-BfyXZwR6.js → vennDiagram-4TSXK5OY-jWOKXNZk.js} +1 -1
- package/out/renderer/assets/{wardleyDiagram-VM6X3IG4-DVert9YG.js → wardleyDiagram-VM6X3IG4-C_s6PoY1.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-S5SC5T6Z-DIhAS62p.js → xychartDiagram-S5SC5T6Z-CtSoETdP.js} +1 -1
- package/out/renderer/index.html +2 -2
- package/out/server/agent.js +4 -4
- package/out/server/chunks/{builtinOccupancy-DFegpcXc.js → builtinOccupancy-BkHNhNZ1.js} +3 -3
- package/out/server/chunks/{dispatchModel-Cxe1soBb.js → dispatchModel-D9_CXjYz.js} +2 -2
- package/out/server/chunks/{loadProvider-B3ukq5Fy.js → loadProvider-D1YF4iYt.js} +2 -2
- package/out/server/chunks/{menuSkills-D6ieuD0G.js → menuSkills-C6t47j3a.js} +3 -3
- package/out/server/chunks/{projectCode-DweDyxNg.js → projectCode-FQGMcmvA.js} +2 -2
- package/out/server/chunks/{web-Bw_WHFTz.js → web--2c28PU3.js} +2 -2
- package/out/server/chunks/{workflowPresets-BsPcimG1.js → workflowPresets-qBnlqy0O.js} +334 -222
- package/out/server/index.js +445 -264
- package/package.json +1 -1
- package/out/phone/assets/architecture-7GRP2DOG-BuIF9Mkk.js +0 -1
- package/out/phone/assets/channel-vHP6f3Jd.js +0 -1
- package/out/phone/assets/classDiagram-ZZMXUADV-BaifMI8p.js +0 -1
- package/out/phone/assets/classDiagram-v2-VYDZK3BY-BaifMI8p.js +0 -1
- package/out/phone/assets/eventmodeling-NTZA5JFV-DJUGNkPF.js +0 -1
- package/out/phone/assets/flowDiagram-HODETNUW-CEnrRqZZ.js +0 -1
- package/out/phone/assets/main-Bk2Gcz5l.css +0 -2
- package/out/phone/assets/railroad-abnf-HS5TGJTU-BnGgFPSB.js +0 -1
- package/out/phone/assets/railroad-ebnf-LZEXJU2U-BZD06tbs.js +0 -1
- package/out/phone/assets/railroad-peg-WCYAUIDC-DhA8WMVS.js +0 -1
- package/out/phone/assets/stateDiagram-v2-MP3YSRHH-Cd0PzZb6.js +0 -1
- package/out/phone/assets/swimlanesDiagram-VR7AAH4N-B2aaipbb.js +0 -8
- package/out/renderer/assets/channel-67Lz8TBw.js +0 -1
- package/out/renderer/assets/classDiagram-ZZMXUADV-Brn4il5L.js +0 -1
- package/out/renderer/assets/classDiagram-v2-VYDZK3BY-Brn4il5L.js +0 -1
- package/out/renderer/assets/index-CtOLwaEJ.css +0 -1
- package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-GJVYcTB4.js +0 -1
- package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-Bac5YQUH.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-qBnlqy0O.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";
|
|
@@ -886,9 +886,35 @@ const zhTranslations = {
|
|
|
886
886
|
"Sign in with provider subscriptions (SuperGrok, Claude Pro, ChatGPT, etc.)": "使用订阅账号登录(SuperGrok、Claude Pro、ChatGPT 等)",
|
|
887
887
|
"Add account": "添加账号",
|
|
888
888
|
"{{count}} accounts": "{{count}} 个账号",
|
|
889
|
+
"{{count}} providers": "{{count}} 个服务商",
|
|
889
890
|
"Log out": "退出登录",
|
|
890
891
|
"Starting login...": "正在启动登录…",
|
|
891
892
|
"Complete authorization in your browser": "请在浏览器中完成授权",
|
|
893
|
+
"Sign in to Devin in your browser.": "请在浏览器中登录 Devin。",
|
|
894
|
+
"Waiting for browser authentication...": "正在等待浏览器完成授权…",
|
|
895
|
+
"Exchanging authorization code for tokens...": "正在用授权码换取令牌…",
|
|
896
|
+
"After you authorize, the browser opens a localhost page that will not load. Paste the full address from the address bar here.": "授权完成后,浏览器会跳到打不开的 localhost 页面。把地址栏里的完整链接粘贴到这里。",
|
|
897
|
+
"The link does not match this authorization. Copy the latest address again.": "链接与本次授权不匹配,请重新复制最新的地址",
|
|
898
|
+
"That input has no authorization code. Paste the full localhost address from the address bar.": "这里没有授权码。请粘贴地址栏里的完整 localhost 链接。",
|
|
899
|
+
"That is not an authorization callback address.": "这不是授权回调地址",
|
|
900
|
+
"Paste a Qoder Personal Access Token (pt-...), or leave empty for browser login": "粘贴 Qoder 个人访问令牌(pt-...),或留空走浏览器登录",
|
|
901
|
+
"Paste a Qoder CN Personal Access Token, or leave empty to cancel": "粘贴 Qoder CN 个人访问令牌,或留空取消",
|
|
902
|
+
"Paste your Qoder Personal Access Token (pt-...)": "请粘贴 Qoder 个人访问令牌(pt-...)",
|
|
903
|
+
"Paste your Qoder CN Personal Access Token": "请粘贴 Qoder CN 个人访问令牌",
|
|
904
|
+
"Please complete login in your browser...": "请在浏览器中完成登录…",
|
|
905
|
+
"Click to sign in with your Qoder account in the browser.": "点此在浏览器中使用 Qoder 账号登录。",
|
|
906
|
+
"Exchanging access token...": "正在交换访问令牌…",
|
|
907
|
+
"Fetching user profile...": "正在获取用户资料…",
|
|
908
|
+
"Login successful!": "登录成功",
|
|
909
|
+
"Login cancelled": "登录已取消",
|
|
910
|
+
"No Personal Access Token provided": "未提供个人访问令牌",
|
|
911
|
+
"Qoder device login network error": "Qoder 设备登录网络出错",
|
|
912
|
+
"Authorization timed out": "授权超时",
|
|
913
|
+
"Device token poll returned invalid response": "设备登录返回了无效响应",
|
|
914
|
+
"Device token poll returned empty access token": "设备登录没有返回访问令牌",
|
|
915
|
+
"OAuth login ended unexpectedly": "登录意外结束",
|
|
916
|
+
"Verify OAuth": "验证用 OAuth",
|
|
917
|
+
"Verify Device": "验证用设备码",
|
|
892
918
|
"Open authorization page": "打开授权页面",
|
|
893
919
|
"Enter code": "输入代码",
|
|
894
920
|
"Verifying...": "正在验证…",
|
|
@@ -917,6 +943,8 @@ const zhTranslations = {
|
|
|
917
943
|
"Fetch all models": "拉取全部模型",
|
|
918
944
|
"Refresh model info": "刷新模型信息",
|
|
919
945
|
"Refresh all models and info": "拉取全部模型与模型信息",
|
|
946
|
+
"Refresh provider models": "刷新此服务商的模型",
|
|
947
|
+
"Refresh failed": "刷新失败",
|
|
920
948
|
"Model info updated": "模型信息已更新",
|
|
921
949
|
"Model info refresh failed, using cache": "模型信息刷新失败,仍使用缓存",
|
|
922
950
|
"Model info refresh failed": "模型信息刷新失败",
|
|
@@ -957,7 +985,7 @@ const zhTranslations = {
|
|
|
957
985
|
Exit: "退出",
|
|
958
986
|
// 统一的供应商设置、默认模型与 Enso
|
|
959
987
|
"Add a provider subscription or API Key, or import providers from local AI apps": "添加服务商订阅或 API Key,也可从本地 AI 应用导入服务商",
|
|
960
|
-
"Add model or provider": "
|
|
988
|
+
"Add model or provider": "添加模型或服务商",
|
|
961
989
|
"Import providers from local apps or use the unified setup to get started": "从本地应用导入服务商,或使用统一向导开始配置",
|
|
962
990
|
"Choose a provider first. You will select subscription or API Key next.": "请先选择服务商,下一步再选择订阅或 API Key。",
|
|
963
991
|
"Choose how to connect": "选择连接方式",
|
|
@@ -3968,18 +3996,18 @@ const EMBEDDING_MODEL_PATTERN = /embed|bge|m3e|voyage|jina|nomic|mxbai|stella|co
|
|
|
3968
3996
|
function isLikelyEmbeddingModelId(id) {
|
|
3969
3997
|
return EMBEDDING_MODEL_PATTERN.test(id);
|
|
3970
3998
|
}
|
|
3971
|
-
function embeddingModelsOf(
|
|
3972
|
-
return Array.isArray(
|
|
3999
|
+
function embeddingModelsOf(provider2) {
|
|
4000
|
+
return Array.isArray(provider2.models) ? provider2.models.filter((m) => typeof m?.id === "string" && isLikelyEmbeddingModelId(m.id)) : [];
|
|
3973
4001
|
}
|
|
3974
4002
|
function remoteEmbeddingIssue(input) {
|
|
3975
|
-
const { providerId, provider, modelId } = input;
|
|
4003
|
+
const { providerId, provider: provider2, modelId } = input;
|
|
3976
4004
|
if (!providerId) return "no-provider";
|
|
3977
|
-
if (!
|
|
3978
|
-
if (!
|
|
3979
|
-
if (typeof
|
|
4005
|
+
if (!provider2) return "provider-missing";
|
|
4006
|
+
if (!provider2.apiKey) return "no-api-key";
|
|
4007
|
+
if (typeof provider2.baseUrl !== "string" || !provider2.baseUrl.trim()) return "no-base-url";
|
|
3980
4008
|
if (!modelId || modelId === REMOTE_EMBEDDING_SENTINEL_MODEL) return "no-model";
|
|
3981
4009
|
if (isLikelyEmbeddingModelId(modelId)) return null;
|
|
3982
|
-
return embeddingModelsOf(
|
|
4010
|
+
return embeddingModelsOf(provider2).length > 0 ? "not-embedding-model" : "no-embedding-models";
|
|
3983
4011
|
}
|
|
3984
4012
|
const ISSUE_KEYS = {
|
|
3985
4013
|
"no-provider": "No remote embedding provider is selected. Choose a provider with an API key, or switch to a local embedding model.",
|
|
@@ -6325,38 +6353,38 @@ function modelUsability(selection, providers2, credentials, virtualModels) {
|
|
|
6325
6353
|
if (!entry.enabled) return "model-disabled";
|
|
6326
6354
|
return modelUsability(entry.primary, providers2, credentials);
|
|
6327
6355
|
}
|
|
6328
|
-
const
|
|
6329
|
-
if (!
|
|
6330
|
-
if (!
|
|
6331
|
-
if (isClassifierOnlyProvider(
|
|
6332
|
-
const model =
|
|
6356
|
+
const provider2 = providers2.find((entry) => entry.id === selection.providerId);
|
|
6357
|
+
if (!provider2) return "provider-missing";
|
|
6358
|
+
if (!provider2.enabled) return "provider-disabled";
|
|
6359
|
+
if (isClassifierOnlyProvider(provider2)) return "classifier-only";
|
|
6360
|
+
const model = provider2.models.find((entry) => entry.id === selection.modelId);
|
|
6333
6361
|
if (!model) return "model-missing";
|
|
6334
6362
|
if (model.enabled === false) return "model-disabled";
|
|
6335
|
-
if (
|
|
6363
|
+
if (provider2.oauthAccountPool !== void 0 && !isOauthAccountPool(provider2))
|
|
6336
6364
|
return "oauth-account-missing";
|
|
6337
|
-
if (!
|
|
6365
|
+
if (!provider2.oauthAccountKey) return provider2.apiKey ? "usable" : "api-key-missing";
|
|
6338
6366
|
if (credentials.oauthCredentials.status !== "ready") {
|
|
6339
6367
|
return oauthCredentialBlock(credentials)?.reason ?? "oauth-credentials-error";
|
|
6340
6368
|
}
|
|
6341
|
-
if (isOauthAccountPool(
|
|
6369
|
+
if (isOauthAccountPool(provider2)) {
|
|
6342
6370
|
return eligibleOauthPoolAccountKeys(
|
|
6343
|
-
|
|
6371
|
+
provider2,
|
|
6344
6372
|
selection.modelId,
|
|
6345
6373
|
providers2,
|
|
6346
6374
|
credentials.oauthCredentials.authenticatedAccountKeys
|
|
6347
6375
|
).length > 0 ? "usable" : "oauth-account-missing";
|
|
6348
6376
|
}
|
|
6349
|
-
return credentials.oauthCredentials.authenticatedAccountKeys.has(
|
|
6377
|
+
return credentials.oauthCredentials.authenticatedAccountKeys.has(provider2.oauthAccountKey) ? "usable" : "oauth-account-missing";
|
|
6350
6378
|
}
|
|
6351
6379
|
function isUsableModel(selection, providers2, credentials, virtualModels) {
|
|
6352
6380
|
return modelUsability(selection, providers2, credentials, virtualModels) === "usable";
|
|
6353
6381
|
}
|
|
6354
6382
|
function isUsableApprovalClassifier(selection, providers2) {
|
|
6355
6383
|
if (!selection) return false;
|
|
6356
|
-
const
|
|
6357
|
-
if (!
|
|
6358
|
-
if (!
|
|
6359
|
-
const model =
|
|
6384
|
+
const provider2 = providers2.find((entry) => entry.id === selection.providerId);
|
|
6385
|
+
if (!provider2?.enabled || !isClassifierOnlyProvider(provider2)) return false;
|
|
6386
|
+
if (!provider2.apiKey || provider2.oauthAccountKey) return false;
|
|
6387
|
+
const model = provider2.models.find((entry) => entry.id === selection.modelId);
|
|
6360
6388
|
return Boolean(model && model.enabled !== false);
|
|
6361
6389
|
}
|
|
6362
6390
|
function isUsableApprovalReviewer(reviewer, providers2, credentials) {
|
|
@@ -6887,6 +6915,153 @@ function kimiCodingBearerToken(headers) {
|
|
|
6887
6915
|
const match = /^Bearer\s+(\S+)/i.exec(raw.trim());
|
|
6888
6916
|
return match?.[1];
|
|
6889
6917
|
}
|
|
6918
|
+
const VERIFY_OAUTH_PROVIDER_ID = "__verify__";
|
|
6919
|
+
const VERIFY_DEVICE_PROVIDER_ID = "__verify-device__";
|
|
6920
|
+
const VERIFY_DEVICE_USER_CODE = "WXYZ-1234";
|
|
6921
|
+
const VERIFY_API = "verify-oauth";
|
|
6922
|
+
const VERIFY_MODEL = {
|
|
6923
|
+
id: "verify-stub",
|
|
6924
|
+
name: "Verify Stub",
|
|
6925
|
+
reasoning: false,
|
|
6926
|
+
input: ["text"],
|
|
6927
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
6928
|
+
contextWindow: 8e3,
|
|
6929
|
+
maxTokens: 1024
|
|
6930
|
+
};
|
|
6931
|
+
function verifyOauthBase() {
|
|
6932
|
+
const raw = process.env.ENSO_VERIFY_OAUTH_BASE?.trim();
|
|
6933
|
+
if (!raw) throw new Error("ENSO_VERIFY_OAUTH_BASE is not set");
|
|
6934
|
+
return raw.replace(/\/+$/, "");
|
|
6935
|
+
}
|
|
6936
|
+
function verifyOauthEnabled(isPackaged) {
|
|
6937
|
+
return process.env.ENSO_VERIFY === "1" && !isPackaged;
|
|
6938
|
+
}
|
|
6939
|
+
async function exchangeVerifyCode(base, code, state, signal) {
|
|
6940
|
+
const response = await fetch(`${base}/token`, {
|
|
6941
|
+
method: "POST",
|
|
6942
|
+
headers: { "Content-Type": "application/json" },
|
|
6943
|
+
body: JSON.stringify({ code, state }),
|
|
6944
|
+
signal
|
|
6945
|
+
});
|
|
6946
|
+
if (!response.ok) throw new Error(`verify oauth token endpoint returned ${response.status}`);
|
|
6947
|
+
const data = await response.json();
|
|
6948
|
+
if (typeof data.access_token !== "string" || !data.access_token) {
|
|
6949
|
+
throw new Error("verify oauth token endpoint returned no access token");
|
|
6950
|
+
}
|
|
6951
|
+
if (typeof data.refresh_token !== "string" || !data.refresh_token) {
|
|
6952
|
+
throw new Error("verify oauth token endpoint returned no refresh token");
|
|
6953
|
+
}
|
|
6954
|
+
const expiresIn = typeof data.expires_in === "number" && Number.isFinite(data.expires_in) ? data.expires_in : 3600;
|
|
6955
|
+
return {
|
|
6956
|
+
access: data.access_token,
|
|
6957
|
+
refresh: data.refresh_token,
|
|
6958
|
+
expires: Date.now() + expiresIn * 1e3
|
|
6959
|
+
};
|
|
6960
|
+
}
|
|
6961
|
+
async function loginWithCallback(callbacks) {
|
|
6962
|
+
const base = verifyOauthBase();
|
|
6963
|
+
const state = randomBytes(16).toString("hex");
|
|
6964
|
+
const server2 = await startOauthCallbackServer({
|
|
6965
|
+
preferredPort: 0,
|
|
6966
|
+
callbackPath: "/callback",
|
|
6967
|
+
expectedState: state,
|
|
6968
|
+
signal: callbacks.signal,
|
|
6969
|
+
onProgress: callbacks.onProgress
|
|
6970
|
+
});
|
|
6971
|
+
try {
|
|
6972
|
+
const params = new URLSearchParams({
|
|
6973
|
+
client_id: "enso-verify",
|
|
6974
|
+
response_type: "code",
|
|
6975
|
+
redirect_uri: server2.redirectUri,
|
|
6976
|
+
state
|
|
6977
|
+
});
|
|
6978
|
+
callbacks.onAuth({
|
|
6979
|
+
url: `${base}/authorize?${params.toString()}`,
|
|
6980
|
+
instructions: "Complete authorization in your browser"
|
|
6981
|
+
});
|
|
6982
|
+
callbacks.onProgress?.("Waiting for browser authentication...");
|
|
6983
|
+
const code = await waitForOauthCallbackCode(
|
|
6984
|
+
server2,
|
|
6985
|
+
(request2) => callbacks.onPrompt(request2),
|
|
6986
|
+
callbacks.signal
|
|
6987
|
+
);
|
|
6988
|
+
callbacks.onProgress?.("Exchanging authorization code for tokens...");
|
|
6989
|
+
return exchangeVerifyCode(base, code, state, callbacks.signal);
|
|
6990
|
+
} finally {
|
|
6991
|
+
server2.close();
|
|
6992
|
+
}
|
|
6993
|
+
}
|
|
6994
|
+
function delay(ms, signal) {
|
|
6995
|
+
return new Promise((resolve2, reject) => {
|
|
6996
|
+
if (signal?.aborted) {
|
|
6997
|
+
reject(new Error("登录已取消"));
|
|
6998
|
+
return;
|
|
6999
|
+
}
|
|
7000
|
+
const timer2 = setTimeout(() => {
|
|
7001
|
+
signal?.removeEventListener("abort", onAbort);
|
|
7002
|
+
resolve2();
|
|
7003
|
+
}, ms);
|
|
7004
|
+
const onAbort = () => {
|
|
7005
|
+
clearTimeout(timer2);
|
|
7006
|
+
reject(new Error("登录已取消"));
|
|
7007
|
+
};
|
|
7008
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
7009
|
+
});
|
|
7010
|
+
}
|
|
7011
|
+
async function loginWithDevice(callbacks) {
|
|
7012
|
+
const base = verifyOauthBase();
|
|
7013
|
+
callbacks.onDeviceCode({
|
|
7014
|
+
userCode: VERIFY_DEVICE_USER_CODE,
|
|
7015
|
+
verificationUri: `${base}/device`
|
|
7016
|
+
});
|
|
7017
|
+
callbacks.onProgress?.("Enter the code in your browser");
|
|
7018
|
+
const deadline = Date.now() + 3e5;
|
|
7019
|
+
while (!callbacks.signal?.aborted) {
|
|
7020
|
+
if (Date.now() > deadline) throw new Error("verify device confirmation timed out");
|
|
7021
|
+
const response = await fetch(`${base}/device/poll?user_code=${VERIFY_DEVICE_USER_CODE}`, {
|
|
7022
|
+
signal: callbacks.signal
|
|
7023
|
+
});
|
|
7024
|
+
if (response.ok) {
|
|
7025
|
+
const data = await response.json();
|
|
7026
|
+
if (typeof data.access_token === "string" && typeof data.refresh_token === "string") {
|
|
7027
|
+
const expiresIn = typeof data.expires_in === "number" && Number.isFinite(data.expires_in) ? data.expires_in : 3600;
|
|
7028
|
+
return {
|
|
7029
|
+
access: data.access_token,
|
|
7030
|
+
refresh: data.refresh_token,
|
|
7031
|
+
expires: Date.now() + expiresIn * 1e3
|
|
7032
|
+
};
|
|
7033
|
+
}
|
|
7034
|
+
}
|
|
7035
|
+
await delay(500, callbacks.signal);
|
|
7036
|
+
}
|
|
7037
|
+
throw new Error("登录已取消");
|
|
7038
|
+
}
|
|
7039
|
+
function streamVerify() {
|
|
7040
|
+
return createEventStream();
|
|
7041
|
+
}
|
|
7042
|
+
function provider(name, login) {
|
|
7043
|
+
return {
|
|
7044
|
+
name,
|
|
7045
|
+
api: VERIFY_API,
|
|
7046
|
+
baseUrl: "http://127.0.0.1",
|
|
7047
|
+
models: [VERIFY_MODEL],
|
|
7048
|
+
streamSimple: streamVerify,
|
|
7049
|
+
oauth: {
|
|
7050
|
+
name,
|
|
7051
|
+
isSubscription: true,
|
|
7052
|
+
login,
|
|
7053
|
+
refreshToken: async (credentials) => credentials,
|
|
7054
|
+
getApiKey: (credentials) => credentials.access
|
|
7055
|
+
}
|
|
7056
|
+
};
|
|
7057
|
+
}
|
|
7058
|
+
function verifyOauthProviders(isPackaged) {
|
|
7059
|
+
if (!verifyOauthEnabled(isPackaged)) return [];
|
|
7060
|
+
return [
|
|
7061
|
+
[VERIFY_OAUTH_PROVIDER_ID, provider("Verify OAuth", loginWithCallback)],
|
|
7062
|
+
[VERIFY_DEVICE_PROVIDER_ID, provider("Verify Device", loginWithDevice)]
|
|
7063
|
+
];
|
|
7064
|
+
}
|
|
6890
7065
|
const OAUTH_POOL_EXHAUSTED = "No available ChatGPT OAuth accounts in the sequential pool. Re-authenticate an account or wait for its quota reset.";
|
|
6891
7066
|
const TTL = 6e4;
|
|
6892
7067
|
const ERROR_TTL = 15e3;
|
|
@@ -9186,7 +9361,10 @@ function getRuntime() {
|
|
|
9186
9361
|
runtime.registerProvider(DEVIN_PROVIDER_ID, devinProviderConfig());
|
|
9187
9362
|
runtime.registerProvider(QODER_PROVIDER_ID, qoderProviderConfig("global"));
|
|
9188
9363
|
runtime.registerProvider(QODER_CN_PROVIDER_ID, qoderProviderConfig("cn"));
|
|
9189
|
-
const
|
|
9364
|
+
for (const [id, config] of verifyOauthProviders(app.isPackaged)) {
|
|
9365
|
+
runtime.registerProvider(id, config);
|
|
9366
|
+
}
|
|
9367
|
+
const { CURSOR_PROVIDER_ID, loadCursorProvider } = await import("./chunks/loadProvider-D1YF4iYt.js").then((n) => n.d);
|
|
9190
9368
|
onlineCatalogProviderIds.add(CURSOR_PROVIDER_ID);
|
|
9191
9369
|
await loadCursorProvider(runtime);
|
|
9192
9370
|
installCodexLinkedRefresh(runtime);
|
|
@@ -9388,13 +9566,13 @@ async function listOauthProviders() {
|
|
|
9388
9566
|
...meta[key]
|
|
9389
9567
|
};
|
|
9390
9568
|
};
|
|
9391
|
-
return runtime.getProviders().filter((
|
|
9392
|
-
id:
|
|
9393
|
-
name:
|
|
9394
|
-
loginLabel:
|
|
9395
|
-
supportsMultipleAccounts: supportsMultipleAccounts(
|
|
9396
|
-
accounts: (byProvider.get(
|
|
9397
|
-
models: expandOauthCatalog(
|
|
9569
|
+
return runtime.getProviders().filter((provider2) => provider2.auth.oauth && !provider2.id.includes("#")).map((provider2) => ({
|
|
9570
|
+
id: provider2.id,
|
|
9571
|
+
name: provider2.auth.oauth?.name || provider2.name,
|
|
9572
|
+
loginLabel: provider2.auth.oauth?.loginLabel,
|
|
9573
|
+
supportsMultipleAccounts: supportsMultipleAccounts(provider2.id),
|
|
9574
|
+
accounts: (byProvider.get(provider2.id) ?? []).map((key) => toAccount(provider2.id, key)),
|
|
9575
|
+
models: expandOauthCatalog(provider2.id, provider2.getModels()).map((model) => model.id)
|
|
9398
9576
|
}));
|
|
9399
9577
|
}
|
|
9400
9578
|
let activeLogin = null;
|
|
@@ -9499,16 +9677,17 @@ async function runOauthLogin(providerId, sender2, login, ownerSignal) {
|
|
|
9499
9677
|
break;
|
|
9500
9678
|
case "auth_url":
|
|
9501
9679
|
login.authUrl = event.url;
|
|
9502
|
-
void shell.openExternal(event.url);
|
|
9680
|
+
if (!remoteSenderById(sender2.id)) void shell.openExternal(event.url);
|
|
9503
9681
|
emit2({
|
|
9504
9682
|
type: "auth_url",
|
|
9505
9683
|
url: authUrlForRenderer(event.url),
|
|
9684
|
+
fullUrl: event.url,
|
|
9506
9685
|
instructions: event.instructions
|
|
9507
9686
|
});
|
|
9508
9687
|
break;
|
|
9509
9688
|
case "device_code":
|
|
9510
9689
|
login.authUrl = event.verificationUri;
|
|
9511
|
-
void shell.openExternal(event.verificationUri);
|
|
9690
|
+
if (!remoteSenderById(sender2.id)) void shell.openExternal(event.verificationUri);
|
|
9512
9691
|
emit2({
|
|
9513
9692
|
type: "device_code",
|
|
9514
9693
|
userCode: event.userCode,
|
|
@@ -9524,6 +9703,7 @@ async function runOauthLogin(providerId, sender2, login, ownerSignal) {
|
|
|
9524
9703
|
const requestId2 = crypto.randomUUID();
|
|
9525
9704
|
const { promise, resolve: resolve2, reject } = Promise.withResolvers();
|
|
9526
9705
|
const allowEmpty = "allowEmpty" in prompt && prompt.allowEmpty === true;
|
|
9706
|
+
const pasteError = "error" in prompt && typeof prompt.error === "string" && prompt.error ? prompt.error : void 0;
|
|
9527
9707
|
login.pendingPrompts.set(requestId2, { resolve: resolve2, reject, allowEmpty });
|
|
9528
9708
|
prompt.signal?.addEventListener("abort", () => {
|
|
9529
9709
|
if (login.pendingPrompts.delete(requestId2)) {
|
|
@@ -9539,7 +9719,8 @@ async function runOauthLogin(providerId, sender2, login, ownerSignal) {
|
|
|
9539
9719
|
message: prompt.message,
|
|
9540
9720
|
placeholder: "placeholder" in prompt ? prompt.placeholder : void 0,
|
|
9541
9721
|
options: prompt.type === "select" ? prompt.options.map((option) => ({ ...option })) : void 0,
|
|
9542
|
-
allowEmpty
|
|
9722
|
+
allowEmpty,
|
|
9723
|
+
...pasteError ? { error: pasteError } : {}
|
|
9543
9724
|
}
|
|
9544
9725
|
});
|
|
9545
9726
|
return promise;
|
|
@@ -10111,8 +10292,8 @@ function isProviderModelRefreshIntervalHours(value) {
|
|
|
10111
10292
|
function normalizeProviderModelRefreshIntervalHours(value) {
|
|
10112
10293
|
return isProviderModelRefreshIntervalHours(value) ? value : DEFAULT_PROVIDER_MODEL_REFRESH_INTERVAL_HOURS;
|
|
10113
10294
|
}
|
|
10114
|
-
function hasApiKeyProviderCredentials(
|
|
10115
|
-
return !
|
|
10295
|
+
function hasApiKeyProviderCredentials(provider2) {
|
|
10296
|
+
return !provider2.oauthAccountKey && !provider2.oauthProviderId && !provider2.oauthAccountPool && typeof provider2.apiKey === "string" && provider2.apiKey.trim().length > 0;
|
|
10116
10297
|
}
|
|
10117
10298
|
const HOUR_MS = 60 * 60 * 1e3;
|
|
10118
10299
|
function asRecord$2(value) {
|
|
@@ -10181,31 +10362,31 @@ function isModelApiKind(value) {
|
|
|
10181
10362
|
return MODEL_API_KINDS.some((api) => api === value);
|
|
10182
10363
|
}
|
|
10183
10364
|
function refreshTarget(value) {
|
|
10184
|
-
const
|
|
10185
|
-
if (!
|
|
10186
|
-
const { id, api, baseUrl, catalogId, models } =
|
|
10187
|
-
if (typeof id !== "string" ||
|
|
10365
|
+
const provider2 = asRecord$2(value);
|
|
10366
|
+
if (!provider2) return;
|
|
10367
|
+
const { id, api, baseUrl, catalogId, models } = provider2;
|
|
10368
|
+
if (typeof id !== "string" || provider2.enabled !== true || provider2.autoFetchModels !== true || !hasApiKeyProviderCredentials(provider2) || !isModelApiKind(api) || typeof baseUrl !== "string" || isClassifierOnlyProvider({
|
|
10188
10369
|
api,
|
|
10189
10370
|
baseUrl,
|
|
10190
10371
|
catalogId: typeof catalogId === "string" ? catalogId : void 0
|
|
10191
10372
|
}) || !Array.isArray(models) || !models.every((model) => typeof asRecord$2(model)?.id === "string")) {
|
|
10192
10373
|
return;
|
|
10193
10374
|
}
|
|
10194
|
-
const proxy = parseProviderProxy(
|
|
10375
|
+
const proxy = parseProviderProxy(provider2.proxy);
|
|
10195
10376
|
if (proxy === null) return;
|
|
10196
10377
|
const config = {
|
|
10197
10378
|
api,
|
|
10198
|
-
apiKey:
|
|
10379
|
+
apiKey: provider2.apiKey,
|
|
10199
10380
|
baseUrl,
|
|
10200
|
-
headers: parseProviderHeaders(
|
|
10381
|
+
headers: parseProviderHeaders(provider2.headers, { warn: false }),
|
|
10201
10382
|
proxy
|
|
10202
10383
|
};
|
|
10203
10384
|
return {
|
|
10204
10385
|
id,
|
|
10205
|
-
provider,
|
|
10386
|
+
provider: provider2,
|
|
10206
10387
|
config,
|
|
10207
10388
|
models,
|
|
10208
|
-
intervalMs: normalizeProviderModelRefreshIntervalHours(
|
|
10389
|
+
intervalMs: normalizeProviderModelRefreshIntervalHours(provider2.modelRefreshIntervalHours) * HOUR_MS
|
|
10209
10390
|
};
|
|
10210
10391
|
}
|
|
10211
10392
|
function createProviderModelRefresh(deps) {
|
|
@@ -18004,14 +18185,14 @@ class ExtensionPluginService {
|
|
|
18004
18185
|
/** 启动后稍等检查一次,之后每天一次;只查已启用的插件 */
|
|
18005
18186
|
startUpdateChecks() {
|
|
18006
18187
|
if (this.isDisposed || this.updateTimer) return;
|
|
18007
|
-
const run2 = (
|
|
18188
|
+
const run2 = (delay2) => {
|
|
18008
18189
|
if (this.isDisposed) return;
|
|
18009
18190
|
this.updateTimer = setTimeout(() => {
|
|
18010
18191
|
void this.checkUpdates({ enabledOnly: true }).finally(() => {
|
|
18011
18192
|
if (this.isDisposed || !this.updateTimer) return;
|
|
18012
18193
|
run2(UPDATE_CHECK_INTERVAL_MS);
|
|
18013
18194
|
});
|
|
18014
|
-
},
|
|
18195
|
+
}, delay2);
|
|
18015
18196
|
this.updateTimer.unref?.();
|
|
18016
18197
|
};
|
|
18017
18198
|
run2(UPDATE_CHECK_FIRST_DELAY_MS);
|
|
@@ -19817,7 +19998,7 @@ async function runAuthorize(serverId, deps) {
|
|
|
19817
19998
|
let authorized = false;
|
|
19818
19999
|
try {
|
|
19819
20000
|
deps.store.clearTokens(serverId);
|
|
19820
|
-
const
|
|
20001
|
+
const provider2 = new McpOAuthClientProvider({
|
|
19821
20002
|
serverId,
|
|
19822
20003
|
serverUrl,
|
|
19823
20004
|
redirectUrl: callback.redirectUri,
|
|
@@ -19836,10 +20017,10 @@ async function runAuthorize(serverId, deps) {
|
|
|
19836
20017
|
...challenge.resourceMetadataUrl ? { resourceMetadataUrl: new URL(challenge.resourceMetadataUrl) } : {}
|
|
19837
20018
|
} : {}
|
|
19838
20019
|
};
|
|
19839
|
-
let result = await deps.auth(
|
|
20020
|
+
let result = await deps.auth(provider2, flow);
|
|
19840
20021
|
if (result === "REDIRECT") {
|
|
19841
20022
|
const { code, iss } = await responsePromise;
|
|
19842
|
-
result = await deps.auth(
|
|
20023
|
+
result = await deps.auth(provider2, {
|
|
19843
20024
|
...flow,
|
|
19844
20025
|
authorizationCode: code,
|
|
19845
20026
|
...iss ? { iss } : {}
|
|
@@ -20149,7 +20330,7 @@ function directoryModel(id, name) {
|
|
|
20149
20330
|
}
|
|
20150
20331
|
function synthesizeModelDirectory(input) {
|
|
20151
20332
|
const cachedByKey = new Map(
|
|
20152
|
-
(input.cached ?? []).filter((
|
|
20333
|
+
(input.cached ?? []).filter((provider2) => provider2.kind === "oauth").map((provider2) => [provider2.key, provider2])
|
|
20153
20334
|
);
|
|
20154
20335
|
const providers2 = [];
|
|
20155
20336
|
for (const source2 of input.oauthProviders) {
|
|
@@ -20173,14 +20354,14 @@ function synthesizeModelDirectory(input) {
|
|
|
20173
20354
|
else if (cached?.discoveredAt !== void 0) section.discoveredAt = cached.discoveredAt;
|
|
20174
20355
|
providers2.push(section);
|
|
20175
20356
|
}
|
|
20176
|
-
for (const
|
|
20177
|
-
if (
|
|
20178
|
-
if (!
|
|
20357
|
+
for (const provider2 of input.customProviders) {
|
|
20358
|
+
if (provider2.oauthAccountKey) continue;
|
|
20359
|
+
if (!provider2.id) continue;
|
|
20179
20360
|
providers2.push({
|
|
20180
|
-
key:
|
|
20361
|
+
key: provider2.id,
|
|
20181
20362
|
kind: "custom",
|
|
20182
|
-
label: typeof
|
|
20183
|
-
models: (
|
|
20363
|
+
label: typeof provider2.name === "string" ? provider2.name : provider2.id,
|
|
20364
|
+
models: (provider2.models ?? []).filter((model) => model && typeof model.id === "string" && model.id.length > 0).map((model) => {
|
|
20184
20365
|
const entry = { id: model.id };
|
|
20185
20366
|
if (typeof model.label === "string" && model.label.length > 0) entry.label = model.label;
|
|
20186
20367
|
return entry;
|
|
@@ -20196,11 +20377,11 @@ function readCustomProviders() {
|
|
|
20196
20377
|
const custom = [];
|
|
20197
20378
|
for (const item of providers2) {
|
|
20198
20379
|
if (!item || typeof item !== "object" || Array.isArray(item)) continue;
|
|
20199
|
-
const
|
|
20200
|
-
if (typeof
|
|
20201
|
-
if (
|
|
20202
|
-
if (!Array.isArray(
|
|
20203
|
-
custom.push(
|
|
20380
|
+
const provider2 = item;
|
|
20381
|
+
if (typeof provider2.id !== "string" || provider2.id.length === 0) continue;
|
|
20382
|
+
if (provider2.oauthAccountKey) continue;
|
|
20383
|
+
if (!Array.isArray(provider2.models)) continue;
|
|
20384
|
+
custom.push(provider2);
|
|
20204
20385
|
}
|
|
20205
20386
|
return custom;
|
|
20206
20387
|
} catch {
|
|
@@ -20218,22 +20399,22 @@ function loadCachedOAuthProviders() {
|
|
|
20218
20399
|
generatedAt: 0,
|
|
20219
20400
|
providers: raw.providers
|
|
20220
20401
|
});
|
|
20221
|
-
return (parsed?.providers ?? []).filter((
|
|
20402
|
+
return (parsed?.providers ?? []).filter((provider2) => provider2.kind === "oauth");
|
|
20222
20403
|
} catch {
|
|
20223
20404
|
return [];
|
|
20224
20405
|
}
|
|
20225
20406
|
}
|
|
20226
20407
|
function oauthFallback() {
|
|
20227
|
-
const memory2 = snapshot?.providers.filter((
|
|
20408
|
+
const memory2 = snapshot?.providers.filter((provider2) => provider2.kind === "oauth") ?? [];
|
|
20228
20409
|
return memory2.length > 0 ? memory2 : loadCachedOAuthProviders();
|
|
20229
20410
|
}
|
|
20230
20411
|
function semanticKey(providers2) {
|
|
20231
20412
|
return JSON.stringify(
|
|
20232
|
-
providers2.map((
|
|
20233
|
-
key:
|
|
20234
|
-
kind:
|
|
20235
|
-
label:
|
|
20236
|
-
models:
|
|
20413
|
+
providers2.map((provider2) => ({
|
|
20414
|
+
key: provider2.key,
|
|
20415
|
+
kind: provider2.kind,
|
|
20416
|
+
label: provider2.label,
|
|
20417
|
+
models: provider2.models
|
|
20237
20418
|
}))
|
|
20238
20419
|
);
|
|
20239
20420
|
}
|
|
@@ -20259,7 +20440,7 @@ function onModelDirectoryChanged(listener) {
|
|
|
20259
20440
|
function atomicWriteCache(providers2) {
|
|
20260
20441
|
const target = cachePath$1();
|
|
20261
20442
|
const tempPath = `${target}.tmp`;
|
|
20262
|
-
const oauth = providers2.filter((
|
|
20443
|
+
const oauth = providers2.filter((provider2) => provider2.kind === "oauth");
|
|
20263
20444
|
writeFileSync(tempPath, JSON.stringify({ providers: oauth }), "utf8");
|
|
20264
20445
|
renameSync(tempPath, target);
|
|
20265
20446
|
}
|
|
@@ -20295,9 +20476,9 @@ function commitIfChanged(providers2, now) {
|
|
|
20295
20476
|
function materializeOffline(now) {
|
|
20296
20477
|
const cached = loadCachedOAuthProviders();
|
|
20297
20478
|
return synthesizeModelDirectory({
|
|
20298
|
-
oauthProviders: cached.map((
|
|
20299
|
-
id:
|
|
20300
|
-
label:
|
|
20479
|
+
oauthProviders: cached.map((provider2) => ({
|
|
20480
|
+
id: provider2.key,
|
|
20481
|
+
label: provider2.label,
|
|
20301
20482
|
models: []
|
|
20302
20483
|
})),
|
|
20303
20484
|
customProviders: readCustomProviders(),
|
|
@@ -20315,20 +20496,20 @@ async function loadLiveOAuthProviders() {
|
|
|
20315
20496
|
const { getRuntime: getRuntime2 } = await Promise.resolve().then(() => oauthProviders);
|
|
20316
20497
|
const runtime = await getRuntime2();
|
|
20317
20498
|
const live2 = [];
|
|
20318
|
-
for (const
|
|
20319
|
-
if (!
|
|
20320
|
-
const oauthName = typeof
|
|
20499
|
+
for (const provider2 of runtime.getProviders()) {
|
|
20500
|
+
if (!provider2.auth?.oauth || provider2.id.includes("#")) continue;
|
|
20501
|
+
const oauthName = typeof provider2.auth.oauth === "object" ? provider2.auth.oauth.name : void 0;
|
|
20321
20502
|
const models = withModelsDevOauthModels(
|
|
20322
|
-
|
|
20323
|
-
expandOauthCatalog(
|
|
20503
|
+
provider2.id,
|
|
20504
|
+
expandOauthCatalog(provider2.id, provider2.getModels()),
|
|
20324
20505
|
getModelsDevModels()
|
|
20325
20506
|
).map((model) => ({
|
|
20326
20507
|
id: model.id,
|
|
20327
20508
|
name: "name" in model && typeof model.name === "string" ? model.name : void 0
|
|
20328
20509
|
}));
|
|
20329
20510
|
live2.push({
|
|
20330
|
-
id:
|
|
20331
|
-
label: oauthName ||
|
|
20511
|
+
id: provider2.id,
|
|
20512
|
+
label: oauthName || provider2.name,
|
|
20332
20513
|
models
|
|
20333
20514
|
});
|
|
20334
20515
|
}
|
|
@@ -20340,9 +20521,9 @@ async function loadLiveOAuthProviders() {
|
|
|
20340
20521
|
async function refreshModelDirectory() {
|
|
20341
20522
|
const cached = oauthFallback();
|
|
20342
20523
|
const live2 = await loadLiveOAuthProviders();
|
|
20343
|
-
const oauthProviders2 = live2 ?? cached.map((
|
|
20344
|
-
id:
|
|
20345
|
-
label:
|
|
20524
|
+
const oauthProviders2 = live2 ?? cached.map((provider2) => ({
|
|
20525
|
+
id: provider2.key,
|
|
20526
|
+
label: provider2.label,
|
|
20346
20527
|
models: []
|
|
20347
20528
|
}));
|
|
20348
20529
|
const now = Date.now();
|
|
@@ -20371,10 +20552,10 @@ function noteDiscoveredOauthModels(providerId, models) {
|
|
|
20371
20552
|
const current2 = getModelDirectorySnapshot();
|
|
20372
20553
|
const now = Date.now();
|
|
20373
20554
|
const next = synthesizeModelDirectory({
|
|
20374
|
-
oauthProviders: current2.providers.filter((
|
|
20375
|
-
id:
|
|
20376
|
-
label:
|
|
20377
|
-
models:
|
|
20555
|
+
oauthProviders: current2.providers.filter((provider2) => provider2.kind === "oauth").map((provider2) => ({
|
|
20556
|
+
id: provider2.key,
|
|
20557
|
+
label: provider2.label,
|
|
20558
|
+
models: provider2.models.map((model) => ({ id: model.id, name: model.label }))
|
|
20378
20559
|
})),
|
|
20379
20560
|
customProviders: readCustomProviders(),
|
|
20380
20561
|
cached: loadCachedOAuthProviders(),
|
|
@@ -20387,7 +20568,7 @@ function noteDiscoveredOauthModels(providerId, models) {
|
|
|
20387
20568
|
function notifyModelDirectorySettingsChanged() {
|
|
20388
20569
|
try {
|
|
20389
20570
|
const current2 = getModelDirectorySnapshot();
|
|
20390
|
-
const oauth = current2.providers.filter((
|
|
20571
|
+
const oauth = current2.providers.filter((provider2) => provider2.kind === "oauth");
|
|
20391
20572
|
const custom = synthesizeModelDirectory({
|
|
20392
20573
|
oauthProviders: [],
|
|
20393
20574
|
customProviders: readCustomProviders(),
|
|
@@ -20618,14 +20799,14 @@ function pickSubagentModelRefs(entries, providers2, virtualModels) {
|
|
|
20618
20799
|
providerId = entry.providerId;
|
|
20619
20800
|
modelId = virtual.id;
|
|
20620
20801
|
} else {
|
|
20621
|
-
const
|
|
20622
|
-
if (!
|
|
20623
|
-
if (isClassifierOnlyProvider(
|
|
20624
|
-
if (!Array.isArray(
|
|
20625
|
-
const model =
|
|
20802
|
+
const provider2 = providers2.find((candidate) => candidate.id === entry.providerId);
|
|
20803
|
+
if (!provider2 || provider2.enabled === false || !hasProviderCredentials(provider2)) continue;
|
|
20804
|
+
if (isClassifierOnlyProvider(provider2)) continue;
|
|
20805
|
+
if (!Array.isArray(provider2.models)) continue;
|
|
20806
|
+
const model = provider2.models.find((candidate) => candidate?.id === entry.modelId);
|
|
20626
20807
|
if (!model || model.enabled === false) continue;
|
|
20627
|
-
base = `${
|
|
20628
|
-
providerId =
|
|
20808
|
+
base = `${provider2.name}/${model.id}`;
|
|
20809
|
+
providerId = provider2.id;
|
|
20629
20810
|
modelId = model.id;
|
|
20630
20811
|
}
|
|
20631
20812
|
seen.add(key);
|
|
@@ -20746,14 +20927,14 @@ let worker = null;
|
|
|
20746
20927
|
async function selectOauthPoolAccount(event) {
|
|
20747
20928
|
try {
|
|
20748
20929
|
const providers2 = providersFromSettings();
|
|
20749
|
-
const
|
|
20750
|
-
if (!
|
|
20930
|
+
const provider2 = providers2.find((entry) => entry.id === event.settingsProviderId);
|
|
20931
|
+
if (!provider2 || !isOauthAccountPool(provider2)) throw new Error(OAUTH_POOL_EXHAUSTED);
|
|
20751
20932
|
const runtime = await getRuntime();
|
|
20752
20933
|
const loggedIn = new Set(
|
|
20753
20934
|
(await runtime.listCredentials()).filter((entry) => entry.type === "oauth").map((entry) => entry.providerId)
|
|
20754
20935
|
);
|
|
20755
20936
|
const eligible2 = eligibleOauthPoolAccountKeys(
|
|
20756
|
-
|
|
20937
|
+
provider2,
|
|
20757
20938
|
event.modelId,
|
|
20758
20939
|
providers2,
|
|
20759
20940
|
loggedIn
|
|
@@ -20764,21 +20945,21 @@ async function selectOauthPoolAccount(event) {
|
|
|
20764
20945
|
});
|
|
20765
20946
|
const quota = getOauthQuotaCoordinator();
|
|
20766
20947
|
quota.reconcileKeys(loggedIn);
|
|
20767
|
-
const failed2 = await quota.validateFailure(
|
|
20948
|
+
const failed2 = await quota.validateFailure(provider2.id, event.failed);
|
|
20768
20949
|
const selected = await quota.select(
|
|
20769
|
-
|
|
20770
|
-
|
|
20950
|
+
provider2.id,
|
|
20951
|
+
provider2.oauthAccountPool?.accountKeys ?? [],
|
|
20771
20952
|
eligible2,
|
|
20772
20953
|
failed2
|
|
20773
20954
|
);
|
|
20774
20955
|
const { accountKey } = selected;
|
|
20775
|
-
const selectionReceipt = accountKey ? await quota.issueSelectionReceipt(
|
|
20956
|
+
const selectionReceipt = accountKey ? await quota.issueSelectionReceipt(provider2.id, accountKey) : void 0;
|
|
20776
20957
|
if (selected.warning) console.warn(`[OAuthQuota] ${selected.warning}`);
|
|
20777
20958
|
if (accountKey) {
|
|
20778
20959
|
const latestKeys = new Set(
|
|
20779
20960
|
(await runtime.listCredentials()).filter((entry) => entry.type === "oauth").map((entry) => entry.providerId)
|
|
20780
20961
|
);
|
|
20781
|
-
const receiptStillCurrent = selectionReceipt && await quota.validateFailure(
|
|
20962
|
+
const receiptStillCurrent = selectionReceipt && await quota.validateFailure(provider2.id, {
|
|
20782
20963
|
accountKey,
|
|
20783
20964
|
reason: "login-invalid",
|
|
20784
20965
|
selectionReceipt
|
|
@@ -21054,13 +21235,13 @@ ${tail2}`);
|
|
|
21054
21235
|
}
|
|
21055
21236
|
function scheduleReminderRevive() {
|
|
21056
21237
|
const dueAts = Object.values(readAllSessionReminders(path.join(agentDataDir(), "sessions"))).flat().map((item) => item.dueAt);
|
|
21057
|
-
const
|
|
21058
|
-
if (
|
|
21238
|
+
const delay2 = reminderReviveDelay(dueAts, Date.now());
|
|
21239
|
+
if (delay2 === void 0) return;
|
|
21059
21240
|
clearTimeout(reminderRevive);
|
|
21060
21241
|
reminderRevive = setTimeout(() => {
|
|
21061
21242
|
reminderRevive = void 0;
|
|
21062
21243
|
if (!worker && workerExited && !quitStopped) startAgentWorker();
|
|
21063
|
-
},
|
|
21244
|
+
}, delay2);
|
|
21064
21245
|
reminderRevive.unref?.();
|
|
21065
21246
|
}
|
|
21066
21247
|
function captureWorkerOutput(child) {
|
|
@@ -21523,8 +21704,8 @@ function resolveModelSelection(providerId, modelId, authenticatedAccountKeys, op
|
|
|
21523
21704
|
}
|
|
21524
21705
|
function resolveVirtualModelSelection(entry, authenticatedAccountKeys) {
|
|
21525
21706
|
const member = (ref) => {
|
|
21526
|
-
const
|
|
21527
|
-
if (!
|
|
21707
|
+
const provider2 = providersFromSettings().find((item) => item.id === ref.providerId);
|
|
21708
|
+
if (!provider2 || !canBeVirtualMember(provider2)) return void 0;
|
|
21528
21709
|
const resolved = resolvePhysicalModelSelection(
|
|
21529
21710
|
ref.providerId,
|
|
21530
21711
|
ref.modelId,
|
|
@@ -21574,22 +21755,22 @@ function resolveVirtualClassifier(classifier, authenticatedAccountKeys) {
|
|
|
21574
21755
|
);
|
|
21575
21756
|
return credentials ? { source: "pi-classifier", timeoutMs: classifier.timeoutMs, classifier: credentials } : void 0;
|
|
21576
21757
|
}
|
|
21577
|
-
function classifierCredentialsFor(
|
|
21578
|
-
if (!
|
|
21579
|
-
const piProvider = classifierProviderFor(
|
|
21758
|
+
function classifierCredentialsFor(provider2, modelId, authenticatedAccountKeys) {
|
|
21759
|
+
if (!provider2?.enabled) return void 0;
|
|
21760
|
+
const piProvider = classifierProviderFor(provider2);
|
|
21580
21761
|
if (!piProvider) return void 0;
|
|
21581
|
-
const baseUrl = classifierBaseUrlFor(
|
|
21582
|
-
if (
|
|
21583
|
-
if (!authenticatedAccountKeys.has(
|
|
21584
|
-
} else if (!
|
|
21762
|
+
const baseUrl = classifierBaseUrlFor(provider2);
|
|
21763
|
+
if (provider2.oauthAccountKey) {
|
|
21764
|
+
if (!authenticatedAccountKeys.has(provider2.oauthAccountKey)) return void 0;
|
|
21765
|
+
} else if (!provider2.apiKey) {
|
|
21585
21766
|
return void 0;
|
|
21586
21767
|
}
|
|
21587
|
-
const proxy =
|
|
21768
|
+
const proxy = provider2.oauthAccountKey ? void 0 : parseProviderProxy(provider2.proxy);
|
|
21588
21769
|
if (proxy === null) return void 0;
|
|
21589
21770
|
return {
|
|
21590
21771
|
provider: piProvider,
|
|
21591
21772
|
modelId,
|
|
21592
|
-
...
|
|
21773
|
+
...provider2.oauthAccountKey ? {} : { apiKey: provider2.apiKey },
|
|
21593
21774
|
...baseUrl ? { baseUrl } : {},
|
|
21594
21775
|
...proxy ? { proxy } : {}
|
|
21595
21776
|
};
|
|
@@ -21603,12 +21784,12 @@ function resolvePhysicalModelSelection(providerId, modelId, authenticatedAccount
|
|
|
21603
21784
|
if (reason !== "usable") {
|
|
21604
21785
|
return { ok: false, error: `Model is unavailable: ${reason}` };
|
|
21605
21786
|
}
|
|
21606
|
-
const
|
|
21607
|
-
if (!
|
|
21608
|
-
if (!
|
|
21787
|
+
const provider2 = providers2.find((entry) => entry.id === providerId);
|
|
21788
|
+
if (!provider2) return { ok: false, error: "Model provider is unavailable." };
|
|
21789
|
+
if (!provider2.oauthAccountKey && parseProviderProxy(provider2.proxy) === null) {
|
|
21609
21790
|
return { ok: false, error: "Model provider proxy configuration is invalid." };
|
|
21610
21791
|
}
|
|
21611
|
-
const config = spawnModelConfig(
|
|
21792
|
+
const config = spawnModelConfig(provider2, modelId);
|
|
21612
21793
|
return {
|
|
21613
21794
|
ok: true,
|
|
21614
21795
|
selection: {
|
|
@@ -22705,9 +22886,9 @@ function asModelRef(value) {
|
|
|
22705
22886
|
function resolveApprovalReviewer(authenticatedAccountKeys) {
|
|
22706
22887
|
const ref = asModelRef(readSettingsState()?.approvalReviewer);
|
|
22707
22888
|
if (!ref) return { ok: true, source: null };
|
|
22708
|
-
const
|
|
22709
|
-
if (
|
|
22710
|
-
const classifier = classifierCredentialsFor(
|
|
22889
|
+
const provider2 = providersFromSettings().find((item) => item.id === ref.providerId);
|
|
22890
|
+
if (provider2 && isClassifierOnlyProvider(provider2)) {
|
|
22891
|
+
const classifier = classifierCredentialsFor(provider2, ref.modelId, authenticatedAccountKeys);
|
|
22711
22892
|
const state = readSettingsState();
|
|
22712
22893
|
const managed = state?.approvalAutoManage === true;
|
|
22713
22894
|
const allowThreshold = parseApprovalAllowThreshold(state?.approvalAllowThreshold);
|
|
@@ -22825,14 +23006,14 @@ function resolveWebSearchConfig() {
|
|
|
22825
23006
|
const providers2 = providersFromSettings();
|
|
22826
23007
|
const chain = [];
|
|
22827
23008
|
for (const entry of rawChain) {
|
|
22828
|
-
const
|
|
22829
|
-
if (!
|
|
23009
|
+
const provider2 = providers2.find((p) => p.id === entry.providerId);
|
|
23010
|
+
if (!provider2 || provider2.enabled === false || provider2.oauthAccountPool !== void 0)
|
|
22830
23011
|
continue;
|
|
22831
|
-
if (!Array.isArray(
|
|
23012
|
+
if (!Array.isArray(provider2.models) || !provider2.models.some((model) => model?.id === entry.modelId && model.enabled !== false))
|
|
22832
23013
|
continue;
|
|
22833
|
-
if (!
|
|
23014
|
+
if (!provider2.oauthAccountKey && (typeof provider2.api !== "string" || typeof provider2.baseUrl !== "string" || typeof provider2.apiKey !== "string"))
|
|
22834
23015
|
continue;
|
|
22835
|
-
const runtimeProviderId =
|
|
23016
|
+
const runtimeProviderId = provider2.oauthAccountKey ?? providerKeyFor(provider2);
|
|
22836
23017
|
chain.push({ providerId: runtimeProviderId, modelId: entry.modelId });
|
|
22837
23018
|
}
|
|
22838
23019
|
return { chain, configured: rawChain.length > 0 };
|
|
@@ -22868,24 +23049,24 @@ function customProvidersForWorker() {
|
|
|
22868
23049
|
const out = [];
|
|
22869
23050
|
for (const item of providersFromSettings()) {
|
|
22870
23051
|
if (!item || typeof item !== "object" || Array.isArray(item)) continue;
|
|
22871
|
-
const
|
|
22872
|
-
if (
|
|
22873
|
-
if (typeof
|
|
22874
|
-
if (typeof
|
|
22875
|
-
if (typeof
|
|
23052
|
+
const provider2 = item;
|
|
23053
|
+
if (provider2.oauthAccountKey) continue;
|
|
23054
|
+
if (typeof provider2.id !== "string" || provider2.id.length === 0) continue;
|
|
23055
|
+
if (typeof provider2.name !== "string") continue;
|
|
23056
|
+
if (typeof provider2.api !== "string" || typeof provider2.baseUrl !== "string" || typeof provider2.apiKey !== "string") {
|
|
22876
23057
|
continue;
|
|
22877
23058
|
}
|
|
22878
|
-
if (!Array.isArray(
|
|
22879
|
-
const headers = parseProviderHeaders(
|
|
22880
|
-
const proxy = parseProviderProxy(
|
|
23059
|
+
if (!Array.isArray(provider2.models)) continue;
|
|
23060
|
+
const headers = parseProviderHeaders(provider2.headers);
|
|
23061
|
+
const proxy = parseProviderProxy(provider2.proxy);
|
|
22881
23062
|
if (proxy === null) continue;
|
|
22882
23063
|
out.push({
|
|
22883
|
-
settingsId:
|
|
22884
|
-
name:
|
|
22885
|
-
api:
|
|
22886
|
-
baseUrl:
|
|
22887
|
-
apiKey:
|
|
22888
|
-
models:
|
|
23064
|
+
settingsId: provider2.id,
|
|
23065
|
+
name: provider2.name,
|
|
23066
|
+
api: provider2.api,
|
|
23067
|
+
baseUrl: provider2.baseUrl,
|
|
23068
|
+
apiKey: provider2.apiKey,
|
|
23069
|
+
models: provider2.models,
|
|
22889
23070
|
...headers ? { headers } : {},
|
|
22890
23071
|
...proxy ? { proxy } : {}
|
|
22891
23072
|
});
|
|
@@ -22910,7 +23091,7 @@ function virtualModelsFromSettings() {
|
|
|
22910
23091
|
function providersFromSettings() {
|
|
22911
23092
|
const providers2 = readSettingsState()?.providers;
|
|
22912
23093
|
const raw = Array.isArray(providers2) ? providers2.filter(
|
|
22913
|
-
(
|
|
23094
|
+
(provider2) => Boolean(provider2) && typeof provider2 === "object" && typeof provider2.id === "string"
|
|
22914
23095
|
) : [];
|
|
22915
23096
|
const materialized = materializeProviders(raw, getModelDirectorySnapshot());
|
|
22916
23097
|
return materialized;
|
|
@@ -22921,22 +23102,22 @@ function modelRefForSpawnConfig(config) {
|
|
|
22921
23102
|
}
|
|
22922
23103
|
throw new Error("Spawn model is missing its settings provider identity.");
|
|
22923
23104
|
}
|
|
22924
|
-
function spawnModelConfig(
|
|
22925
|
-
if (
|
|
23105
|
+
function spawnModelConfig(provider2, modelId) {
|
|
23106
|
+
if (provider2.oauthAccountPool !== void 0 && !isOauthAccountPool(provider2))
|
|
22926
23107
|
throw new Error("Invalid ChatGPT OAuth pool configuration.");
|
|
22927
|
-
const entry =
|
|
22928
|
-
const headers = parseProviderHeaders(
|
|
22929
|
-
const proxy =
|
|
23108
|
+
const entry = provider2.models.find((model) => model.id === modelId);
|
|
23109
|
+
const headers = parseProviderHeaders(provider2.headers);
|
|
23110
|
+
const proxy = provider2.oauthAccountKey ? void 0 : parseProviderProxy(provider2.proxy);
|
|
22930
23111
|
return {
|
|
22931
|
-
api:
|
|
22932
|
-
baseUrl:
|
|
22933
|
-
apiKey:
|
|
23112
|
+
api: provider2.api,
|
|
23113
|
+
baseUrl: provider2.baseUrl,
|
|
23114
|
+
apiKey: provider2.apiKey,
|
|
22934
23115
|
modelId,
|
|
22935
|
-
settingsProviderId:
|
|
23116
|
+
settingsProviderId: provider2.id,
|
|
22936
23117
|
...headers ? { headers } : {},
|
|
22937
23118
|
...proxy ? { proxy } : {},
|
|
22938
|
-
...
|
|
22939
|
-
...isOauthAccountPool(
|
|
23119
|
+
...provider2.oauthAccountKey ? { oauthAccountKey: provider2.oauthAccountKey } : {},
|
|
23120
|
+
...isOauthAccountPool(provider2) ? { oauthAccountPool: provider2.oauthAccountPool } : {},
|
|
22940
23121
|
// 统一目录后 OAuth 条目 models 只承载稀疏用户覆盖(enabled/别名/能力/档位),
|
|
22941
23122
|
// 行覆盖对 OAuth 同样生效;旧守卫丢弃它们是因为那时行是 catalog 冻结拷贝。
|
|
22942
23123
|
// 已知过渡窗口:renderer 水合才执行 v16 稀疏化,Main 先读(bot 自启/tray)时
|
|
@@ -23872,11 +24053,11 @@ ${failure2}` : failure2;
|
|
|
23872
24053
|
this.now()
|
|
23873
24054
|
);
|
|
23874
24055
|
if (!event.interrupted && !active2.stopRequested && this.options.upstreamRecovery && this.options.runtime.retry && (classified.kind === "transient" || classified.kind === "quota")) {
|
|
23875
|
-
const
|
|
24056
|
+
const provider2 = event.provider ?? active2.upstreamWaiting?.provider ?? "default";
|
|
23876
24057
|
const decision = this.options.upstreamRecovery.reportFailure({
|
|
23877
24058
|
id: agent2.agentId,
|
|
23878
24059
|
kind: "subagent",
|
|
23879
|
-
provider,
|
|
24060
|
+
provider: provider2,
|
|
23880
24061
|
errorKind: classified.kind,
|
|
23881
24062
|
lastError: event.error,
|
|
23882
24063
|
...classified.resetAt !== void 0 ? { resetAt: classified.resetAt } : {}
|
|
@@ -23901,11 +24082,11 @@ ${failure2}` : failure2;
|
|
|
23901
24082
|
const recoverable = event.interrupted !== void 0 || classified.kind !== "permanent" && (event.retryExhausted === true || classified.kind === "transient" || classified.kind === "quota");
|
|
23902
24083
|
this.settleRun(agent2, active2, "failed", event.error, recoverable);
|
|
23903
24084
|
} else {
|
|
23904
|
-
const
|
|
24085
|
+
const provider2 = event.provider ?? active2.upstreamWaiting?.provider;
|
|
23905
24086
|
active2.upstreamWaiting = void 0;
|
|
23906
24087
|
active2.upstreamResuming = false;
|
|
23907
|
-
if (
|
|
23908
|
-
this.options.upstreamRecovery?.reportSuccess(
|
|
24088
|
+
if (provider2) {
|
|
24089
|
+
this.options.upstreamRecovery?.reportSuccess(provider2, agent2.agentId);
|
|
23909
24090
|
}
|
|
23910
24091
|
this.completeRun(agent2, active2);
|
|
23911
24092
|
}
|
|
@@ -23913,10 +24094,10 @@ ${failure2}` : failure2;
|
|
|
23913
24094
|
}
|
|
23914
24095
|
if (event.type === "retry-skipped" && active2?.resumed && active2.status === "running") {
|
|
23915
24096
|
if (event.reason === "nothing-to-retry") {
|
|
23916
|
-
const
|
|
24097
|
+
const provider2 = active2.upstreamWaiting?.provider;
|
|
23917
24098
|
active2.upstreamWaiting = void 0;
|
|
23918
24099
|
active2.upstreamResuming = false;
|
|
23919
|
-
if (
|
|
24100
|
+
if (provider2) this.options.upstreamRecovery?.reportSuccess(provider2, agent2.agentId);
|
|
23920
24101
|
this.completeRun(agent2, active2);
|
|
23921
24102
|
} else if (active2.upstreamResuming) {
|
|
23922
24103
|
active2.upstreamResuming = false;
|
|
@@ -27276,7 +27457,7 @@ function setMemoryServiceProgressSink(sink2) {
|
|
|
27276
27457
|
}
|
|
27277
27458
|
async function readTranscriptMain(sessionFile) {
|
|
27278
27459
|
const [{ SessionManager, sessionEntryToContextMessages: sessionEntryToContextMessages2 }, { projectMessage: projectMessage2 }] = await Promise.all(
|
|
27279
|
-
[import("@earendil-works/pi-coding-agent"), import("./chunks/workflowPresets-
|
|
27460
|
+
[import("@earendil-works/pi-coding-agent"), import("./chunks/workflowPresets-qBnlqy0O.js").then((n) => n.fs)]
|
|
27280
27461
|
);
|
|
27281
27462
|
const root = path.resolve(path.join(app.getPath("userData"), "agent", "sessions"));
|
|
27282
27463
|
const resolved = path.resolve(sessionFile);
|
|
@@ -28588,17 +28769,17 @@ function parsePhoneCommand(value) {
|
|
|
28588
28769
|
function checkSpawn(command, whitelist2) {
|
|
28589
28770
|
const project = whitelist2.projects.find((p) => p.id === command.projectId);
|
|
28590
28771
|
if (!project) return { ok: false, error: `unknown projectId: ${command.projectId}` };
|
|
28591
|
-
const
|
|
28592
|
-
if (!
|
|
28593
|
-
if (!
|
|
28772
|
+
const provider2 = whitelist2.providers.find((p) => p.id === command.providerId);
|
|
28773
|
+
if (!provider2) return { ok: false, error: `unknown providerId: ${command.providerId}` };
|
|
28774
|
+
if (!provider2.models.some((m) => m.id === command.modelId)) {
|
|
28594
28775
|
return { ok: false, error: `model not enabled: ${command.modelId}` };
|
|
28595
28776
|
}
|
|
28596
28777
|
return { ok: true, resolved: { cwd: project.path } };
|
|
28597
28778
|
}
|
|
28598
28779
|
function checkSetModel(command, whitelist2) {
|
|
28599
|
-
const
|
|
28600
|
-
if (!
|
|
28601
|
-
if (!
|
|
28780
|
+
const provider2 = whitelist2.providers.find((p) => p.id === command.providerId);
|
|
28781
|
+
if (!provider2) return { ok: false, error: `unknown providerId: ${command.providerId}` };
|
|
28782
|
+
if (!provider2.models.some((m) => m.id === command.modelId)) {
|
|
28602
28783
|
return { ok: false, error: `model not enabled: ${command.modelId}` };
|
|
28603
28784
|
}
|
|
28604
28785
|
return { ok: true };
|
|
@@ -30017,8 +30198,8 @@ function dropRevoked$1(conn) {
|
|
|
30017
30198
|
function scheduleReconnect$1(conn) {
|
|
30018
30199
|
if (conn.closed) return;
|
|
30019
30200
|
if (conn.timer) clearTimeout(conn.timer);
|
|
30020
|
-
const
|
|
30021
|
-
conn.timer = setTimeout(() => connect$1(conn),
|
|
30201
|
+
const delay2 = backoffDelay(conn.attempt++);
|
|
30202
|
+
conn.timer = setTimeout(() => connect$1(conn), delay2);
|
|
30022
30203
|
}
|
|
30023
30204
|
function connectionCurrent(conn, generation, ioEpoch) {
|
|
30024
30205
|
return !conn.closed && conn.generation === generation && conn.ioEpoch === ioEpoch;
|
|
@@ -37945,8 +38126,8 @@ async function startPendingDispatches(ports, pendingIds, now) {
|
|
|
37945
38126
|
const classified = classifyUpstreamError({ error }, now);
|
|
37946
38127
|
if (classified.kind !== "permanent") {
|
|
37947
38128
|
const nextAttempt = (pending2.retryCount ?? 0) + 1;
|
|
37948
|
-
const
|
|
37949
|
-
if (
|
|
38129
|
+
const delay2 = nextPendingRetryDelayMs(nextAttempt);
|
|
38130
|
+
if (delay2 !== null) {
|
|
37950
38131
|
const latest = ports.dispatchFile();
|
|
37951
38132
|
latest.pending = {
|
|
37952
38133
|
...latest.pending ?? {},
|
|
@@ -37955,7 +38136,7 @@ async function startPendingDispatches(ports, pendingIds, now) {
|
|
|
37955
38136
|
status: "waiting",
|
|
37956
38137
|
updatedAt: now,
|
|
37957
38138
|
retryCount: nextAttempt,
|
|
37958
|
-
nextRetryAt: now +
|
|
38139
|
+
nextRetryAt: now + delay2,
|
|
37959
38140
|
lastError: error
|
|
37960
38141
|
}
|
|
37961
38142
|
};
|
|
@@ -39801,7 +39982,7 @@ function dispatchPortsFor(ctx) {
|
|
|
39801
39982
|
} = await Promise.resolve().then(() => agentHost);
|
|
39802
39983
|
const { readStoredOauthCredentialKeys: readStoredOauthCredentialKeys2 } = await Promise.resolve().then(() => oauthProviders);
|
|
39803
39984
|
const { modelUsability: modelUsability2 } = await Promise.resolve().then(() => defaultModel);
|
|
39804
|
-
const { resolveDispatchModel } = await import("./chunks/dispatchModel-
|
|
39985
|
+
const { resolveDispatchModel } = await import("./chunks/dispatchModel-D9_CXjYz.js");
|
|
39805
39986
|
let keys;
|
|
39806
39987
|
try {
|
|
39807
39988
|
keys = await readStoredOauthCredentialKeys2();
|
|
@@ -44265,12 +44446,12 @@ class UpstreamHealthGate {
|
|
|
44265
44446
|
}
|
|
44266
44447
|
return { action: "wait", waiter: { ...waiter } };
|
|
44267
44448
|
}
|
|
44268
|
-
reportSuccess(
|
|
44449
|
+
reportSuccess(provider2, waiterId, now) {
|
|
44269
44450
|
if (waiterId) {
|
|
44270
44451
|
this.waiters.delete(waiterId);
|
|
44271
44452
|
}
|
|
44272
|
-
const hadDegraded = this.providers.delete(
|
|
44273
|
-
const remaining = this.waitersForProvider(
|
|
44453
|
+
const hadDegraded = this.providers.delete(provider2);
|
|
44454
|
+
const remaining = this.waitersForProvider(provider2).sort((a, b) => a.since - b.since);
|
|
44274
44455
|
if (remaining.length === 0) return;
|
|
44275
44456
|
if (!hadDegraded && remaining.every((w) => w.recovering)) return;
|
|
44276
44457
|
for (let index2 = 0; index2 < remaining.length; index2++) {
|
|
@@ -44284,13 +44465,13 @@ class UpstreamHealthGate {
|
|
|
44284
44465
|
}
|
|
44285
44466
|
takeDue(now) {
|
|
44286
44467
|
const out = [];
|
|
44287
|
-
for (const [
|
|
44468
|
+
for (const [provider2, bucket] of this.providers) {
|
|
44288
44469
|
if (bucket.state === "probing" && bucket.probingWaiterId) {
|
|
44289
44470
|
if (this.waiters.has(bucket.probingWaiterId)) continue;
|
|
44290
44471
|
bucket.probingWaiterId = void 0;
|
|
44291
44472
|
bucket.state = "degraded";
|
|
44292
44473
|
}
|
|
44293
|
-
const candidates = this.waitersForProvider(
|
|
44474
|
+
const candidates = this.waitersForProvider(provider2).filter((w) => !w.probing && w.nextAt <= now).sort((a, b) => a.nextAt - b.nextAt || a.since - b.since);
|
|
44294
44475
|
const chosen = candidates[0];
|
|
44295
44476
|
if (!chosen) continue;
|
|
44296
44477
|
chosen.probing = true;
|
|
@@ -44349,10 +44530,10 @@ class UpstreamHealthGate {
|
|
|
44349
44530
|
allWaiters() {
|
|
44350
44531
|
return [...this.waiters.values()].map((w) => ({ ...w }));
|
|
44351
44532
|
}
|
|
44352
|
-
snapshot(
|
|
44353
|
-
const bucket = this.providers.get(
|
|
44533
|
+
snapshot(provider2) {
|
|
44534
|
+
const bucket = this.providers.get(provider2);
|
|
44354
44535
|
if (!bucket) return void 0;
|
|
44355
|
-
const list2 = this.waitersForProvider(
|
|
44536
|
+
const list2 = this.waitersForProvider(provider2);
|
|
44356
44537
|
let nextProbeAt;
|
|
44357
44538
|
for (const waiter of list2) {
|
|
44358
44539
|
if (waiter.probing) continue;
|
|
@@ -44361,7 +44542,7 @@ class UpstreamHealthGate {
|
|
|
44361
44542
|
}
|
|
44362
44543
|
}
|
|
44363
44544
|
return {
|
|
44364
|
-
provider,
|
|
44545
|
+
provider: provider2,
|
|
44365
44546
|
state: bucket.state,
|
|
44366
44547
|
since: bucket.since,
|
|
44367
44548
|
errorKind: bucket.errorKind,
|
|
@@ -44373,22 +44554,22 @@ class UpstreamHealthGate {
|
|
|
44373
44554
|
}
|
|
44374
44555
|
snapshots() {
|
|
44375
44556
|
const out = [];
|
|
44376
|
-
for (const
|
|
44377
|
-
const snap = this.snapshot(
|
|
44557
|
+
for (const provider2 of this.providers.keys()) {
|
|
44558
|
+
const snap = this.snapshot(provider2);
|
|
44378
44559
|
if (snap) out.push(snap);
|
|
44379
44560
|
}
|
|
44380
44561
|
return out.sort((a, b) => a.since - b.since);
|
|
44381
44562
|
}
|
|
44382
|
-
waitersForProvider(
|
|
44563
|
+
waitersForProvider(provider2) {
|
|
44383
44564
|
const out = [];
|
|
44384
44565
|
for (const waiter of this.waiters.values()) {
|
|
44385
|
-
if (waiter.provider ===
|
|
44566
|
+
if (waiter.provider === provider2) out.push(waiter);
|
|
44386
44567
|
}
|
|
44387
44568
|
return out;
|
|
44388
44569
|
}
|
|
44389
|
-
pruneEmptyProvider(
|
|
44390
|
-
if (this.waitersForProvider(
|
|
44391
|
-
this.providers.delete(
|
|
44570
|
+
pruneEmptyProvider(provider2) {
|
|
44571
|
+
if (this.waitersForProvider(provider2).length === 0) {
|
|
44572
|
+
this.providers.delete(provider2);
|
|
44392
44573
|
}
|
|
44393
44574
|
}
|
|
44394
44575
|
}
|
|
@@ -44411,7 +44592,7 @@ function createUpstreamRecoveryService(options) {
|
|
|
44411
44592
|
}
|
|
44412
44593
|
const deadline = gate.nextDeadline();
|
|
44413
44594
|
if (deadline === null) return;
|
|
44414
|
-
const
|
|
44595
|
+
const delay2 = Math.max(0, deadline - now());
|
|
44415
44596
|
timer2 = setTimeout(() => {
|
|
44416
44597
|
timer2 = void 0;
|
|
44417
44598
|
const due = gate.takeDue(now());
|
|
@@ -44420,7 +44601,7 @@ function createUpstreamRecoveryService(options) {
|
|
|
44420
44601
|
for (const event of due) {
|
|
44421
44602
|
options.onWake(event);
|
|
44422
44603
|
}
|
|
44423
|
-
},
|
|
44604
|
+
}, delay2);
|
|
44424
44605
|
if (typeof timer2 === "object" && "unref" in timer2) {
|
|
44425
44606
|
timer2.unref();
|
|
44426
44607
|
}
|
|
@@ -44432,8 +44613,8 @@ function createUpstreamRecoveryService(options) {
|
|
|
44432
44613
|
schedule();
|
|
44433
44614
|
return result;
|
|
44434
44615
|
},
|
|
44435
|
-
reportSuccess(
|
|
44436
|
-
gate.reportSuccess(
|
|
44616
|
+
reportSuccess(provider2, waiterId) {
|
|
44617
|
+
gate.reportSuccess(provider2, waiterId, now());
|
|
44437
44618
|
emitHealthIfChanged();
|
|
44438
44619
|
schedule();
|
|
44439
44620
|
},
|
|
@@ -46371,15 +46552,15 @@ const MODEL_FAILURES = /* @__PURE__ */ new Set([
|
|
|
46371
46552
|
function providersFrom(state) {
|
|
46372
46553
|
const providers2 = state?.providers;
|
|
46373
46554
|
const raw = Array.isArray(providers2) ? providers2.filter(
|
|
46374
|
-
(
|
|
46555
|
+
(provider2) => Boolean(provider2) && typeof provider2 === "object" && typeof provider2.id === "string"
|
|
46375
46556
|
) : [];
|
|
46376
46557
|
return materializeProviders(raw, getModelDirectorySnapshot());
|
|
46377
46558
|
}
|
|
46378
46559
|
function modelLabel(state, ref) {
|
|
46379
46560
|
if (isVirtualRef(ref))
|
|
46380
46561
|
return findVirtualModel(parseVirtualModels(state?.virtualModels), ref)?.name ?? ref.modelId;
|
|
46381
|
-
const
|
|
46382
|
-
return
|
|
46562
|
+
const provider2 = providersFrom(state).find((item) => item.id === ref.providerId);
|
|
46563
|
+
return provider2 ? `${ref.modelId} (${provider2.name})` : ref.modelId;
|
|
46383
46564
|
}
|
|
46384
46565
|
function usabilityReasonText(reason) {
|
|
46385
46566
|
switch (reason) {
|
|
@@ -49970,9 +50151,9 @@ class DelegationService {
|
|
|
49970
50151
|
failure: "interrupted",
|
|
49971
50152
|
finishedAt: Date.now()
|
|
49972
50153
|
};
|
|
49973
|
-
const
|
|
50154
|
+
const delay2 = this.autoRetryDelay(interrupted);
|
|
49974
50155
|
this.save(
|
|
49975
|
-
|
|
50156
|
+
delay2 === void 0 ? interrupted : { ...interrupted, autoRetryAt: Date.now() + delay2 }
|
|
49976
50157
|
);
|
|
49977
50158
|
}
|
|
49978
50159
|
for (const record2 of deps.store.list()) if (record2.pendingResultEntry) this.postResult(record2);
|
|
@@ -51191,8 +51372,8 @@ ${group.text}` : results;
|
|
|
51191
51372
|
...error ? { error } : {},
|
|
51192
51373
|
...state === "failed" && failure2 === "error" && extra.transient ? { transient: true } : {}
|
|
51193
51374
|
};
|
|
51194
|
-
const
|
|
51195
|
-
if (
|
|
51375
|
+
const delay2 = this.autoRetryDelay(finished);
|
|
51376
|
+
if (delay2 !== void 0) finished = { ...finished, autoRetryAt: Date.now() + delay2 };
|
|
51196
51377
|
if (!this.disposed && this.resultChatId(finished))
|
|
51197
51378
|
finished = {
|
|
51198
51379
|
...finished,
|
|
@@ -54162,7 +54343,7 @@ ${text2}`;
|
|
|
54162
54343
|
scheduleStarted(record2) {
|
|
54163
54344
|
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")))
|
|
54164
54345
|
return;
|
|
54165
|
-
const
|
|
54346
|
+
const delay2 = (record2.startedAt ?? this.now()) + (this.deps.progressDelayMs ?? PROGRESS_STARTED_DELAY_MS) - this.now();
|
|
54166
54347
|
const timer2 = setTimeout(
|
|
54167
54348
|
() => {
|
|
54168
54349
|
this.starting.delete(record2.id);
|
|
@@ -54172,7 +54353,7 @@ ${text2}`;
|
|
|
54172
54353
|
const task = this.deps.store.find(this.board(current2.chatId), current2.taskId);
|
|
54173
54354
|
if (task?.delegationId === current2.id) this.progress(current2, task, "started");
|
|
54174
54355
|
},
|
|
54175
|
-
Math.max(0,
|
|
54356
|
+
Math.max(0, delay2)
|
|
54176
54357
|
);
|
|
54177
54358
|
timer2.unref?.();
|
|
54178
54359
|
this.starting.set(record2.id, timer2);
|
|
@@ -55393,7 +55574,7 @@ class RoutineScheduler {
|
|
|
55393
55574
|
}
|
|
55394
55575
|
arm() {
|
|
55395
55576
|
if (!this.enabled || !this.due.size) return;
|
|
55396
|
-
const
|
|
55577
|
+
const delay2 = Math.max(0, Math.min(...this.due.values()) - Date.now());
|
|
55397
55578
|
this.timer = setTimeout(
|
|
55398
55579
|
() => {
|
|
55399
55580
|
for (const routine of this.deps.store.listAll()) {
|
|
@@ -55403,7 +55584,7 @@ class RoutineScheduler {
|
|
|
55403
55584
|
}
|
|
55404
55585
|
this.refresh();
|
|
55405
55586
|
},
|
|
55406
|
-
Math.min(
|
|
55587
|
+
Math.min(delay2, 2147483647)
|
|
55407
55588
|
);
|
|
55408
55589
|
this.timer.unref?.();
|
|
55409
55590
|
}
|
|
@@ -62131,13 +62312,13 @@ function registerAgentHandlers() {
|
|
|
62131
62312
|
...classified.hint ? { hint: classified.hint } : {}
|
|
62132
62313
|
};
|
|
62133
62314
|
}
|
|
62134
|
-
const
|
|
62315
|
+
const provider2 = isNonEmptyString$5(input.provider) ? input.provider : sourceAuthority?.conversation(input.sessionId)?.selection?.providerId ?? "default";
|
|
62135
62316
|
const since = typeof input.since === "number" && Number.isFinite(input.since) ? input.since : void 0;
|
|
62136
62317
|
const previousAttempt = typeof input.previousAttempt === "number" && Number.isInteger(input.previousAttempt) && input.previousAttempt >= 1 ? input.previousAttempt : void 0;
|
|
62137
62318
|
const decision = upstreamRecovery.reportFailure({
|
|
62138
62319
|
id: input.sessionId,
|
|
62139
62320
|
kind: "session",
|
|
62140
|
-
provider,
|
|
62321
|
+
provider: provider2,
|
|
62141
62322
|
errorKind: classified.kind,
|
|
62142
62323
|
lastError: input.error,
|
|
62143
62324
|
...classified.resetAt !== void 0 ? { resetAt: classified.resetAt } : {},
|
|
@@ -63647,7 +63828,7 @@ function registerAssetHandlers() {
|
|
|
63647
63828
|
ipcMain.handle(
|
|
63648
63829
|
IPC_CHANNELS.ASSETS_LIST_PROJECT_SKILLS,
|
|
63649
63830
|
async (_event, cwd, presetId) => {
|
|
63650
|
-
const { listProjectSkills, listSkillsAt } = await import("./chunks/menuSkills-
|
|
63831
|
+
const { listProjectSkills, listSkillsAt } = await import("./chunks/menuSkills-C6t47j3a.js");
|
|
63651
63832
|
const agentDir2 = path.join(agentDataDir(), "pi-agent");
|
|
63652
63833
|
const plugin = listSkillsAt(
|
|
63653
63834
|
menuPluginSkillPaths(typeof presetId === "string" && presetId ? presetId : void 0),
|
|
@@ -63718,7 +63899,7 @@ function registerAssetHandlers() {
|
|
|
63718
63899
|
return occupancyForMcp(parseOccupancyIds(ids2), servers, listMcpOccupancyTools);
|
|
63719
63900
|
});
|
|
63720
63901
|
ipcMain.handle(IPC_CHANNELS.ASSETS_BUILTIN_TOOL_OCCUPANCY, async () => {
|
|
63721
|
-
const { snapshotBuiltinOccupancyTools } = await import("./chunks/builtinOccupancy-
|
|
63902
|
+
const { snapshotBuiltinOccupancyTools } = await import("./chunks/builtinOccupancy-BkHNhNZ1.js");
|
|
63722
63903
|
return occupancyForBuiltinTools(snapshotBuiltinOccupancyTools());
|
|
63723
63904
|
});
|
|
63724
63905
|
ipcMain.handle(IPC_CHANNELS.INSTRUCTIONS_READ, (_event, id) => {
|
|
@@ -68062,8 +68243,8 @@ function dropRevoked(conn) {
|
|
|
68062
68243
|
function scheduleReconnect(conn) {
|
|
68063
68244
|
if (conn.closed) return;
|
|
68064
68245
|
if (conn.timer) clearTimeout(conn.timer);
|
|
68065
|
-
const
|
|
68066
|
-
conn.timer = setTimeout(() => connect(conn),
|
|
68246
|
+
const delay2 = backoffDelay(conn.attempt++);
|
|
68247
|
+
conn.timer = setTimeout(() => connect(conn), delay2);
|
|
68067
68248
|
}
|
|
68068
68249
|
function enqueueFrame(conn, frame) {
|
|
68069
68250
|
const task = conn.receiveQueue.then(async () => {
|
|
@@ -70347,9 +70528,9 @@ function parseOauthFlowControlRequest(value) {
|
|
|
70347
70528
|
async function listClassifierModels(providerId) {
|
|
70348
70529
|
if (typeof providerId !== "string" || !providerId) return [];
|
|
70349
70530
|
const providers2 = readSettingsState()?.providers;
|
|
70350
|
-
const
|
|
70351
|
-
if (!
|
|
70352
|
-
const piProvider = classifierProviderFor(
|
|
70531
|
+
const provider2 = Array.isArray(providers2) ? providers2.find((entry) => entry?.id === providerId) : void 0;
|
|
70532
|
+
if (!provider2 || typeof provider2 !== "object") return [];
|
|
70533
|
+
const piProvider = classifierProviderFor(provider2);
|
|
70353
70534
|
if (!piProvider) return [];
|
|
70354
70535
|
const runtime = await getRuntime();
|
|
70355
70536
|
return runtime.getModelsOfType("classifier", providerIdOfAccountKey(piProvider)).map((model) => ({ id: model.id, name: model.name || model.id }));
|
|
@@ -71079,12 +71260,12 @@ async function parseCcSwitchConfig(appType, config) {
|
|
|
71079
71260
|
};
|
|
71080
71261
|
case "codex": {
|
|
71081
71262
|
const toml = await parseTomlSafe(str$3(config.config));
|
|
71082
|
-
const
|
|
71083
|
-
if (!
|
|
71263
|
+
const provider2 = Object.values(obj(toml.model_providers)).map(obj)[0];
|
|
71264
|
+
if (!provider2) return null;
|
|
71084
71265
|
return {
|
|
71085
71266
|
apiKey: str$3(obj(config.auth).OPENAI_API_KEY),
|
|
71086
|
-
baseUrl: str$3(
|
|
71087
|
-
api: str$3(
|
|
71267
|
+
baseUrl: str$3(provider2.base_url),
|
|
71268
|
+
api: str$3(provider2.wire_api) === "responses" ? "openai-responses" : "openai-completions",
|
|
71088
71269
|
models: toModelEntries(str$3(toml.model) ? [str$3(toml.model)] : [])
|
|
71089
71270
|
};
|
|
71090
71271
|
}
|
|
@@ -71158,8 +71339,8 @@ async function readCherryStudio(leveldbDir) {
|
|
|
71158
71339
|
const root = decodeLevelValue(value);
|
|
71159
71340
|
const llm = obj(parseJson$1(root?.llm));
|
|
71160
71341
|
const providers2 = Array.isArray(llm.providers) ? llm.providers : [];
|
|
71161
|
-
return providers2.flatMap((
|
|
71162
|
-
const item = obj(
|
|
71342
|
+
return providers2.flatMap((provider2) => {
|
|
71343
|
+
const item = obj(provider2);
|
|
71163
71344
|
const name = str$3(item.name ?? item.id);
|
|
71164
71345
|
if (!name) return [];
|
|
71165
71346
|
return [
|
|
@@ -71184,8 +71365,8 @@ async function readCherryStudio(leveldbDir) {
|
|
|
71184
71365
|
}
|
|
71185
71366
|
}
|
|
71186
71367
|
function readYamlProviders(appId, providers2) {
|
|
71187
|
-
return providers2.flatMap((
|
|
71188
|
-
const item = obj(
|
|
71368
|
+
return providers2.flatMap((provider2) => {
|
|
71369
|
+
const item = obj(provider2);
|
|
71189
71370
|
const name = str$3(item.name ?? item.id);
|
|
71190
71371
|
if (!name) return [];
|
|
71191
71372
|
const baseUrl = str$3(item.apiHost || item.baseUrl || item.base_url);
|
|
@@ -71241,7 +71422,7 @@ function readClaudeCode(settingsPath) {
|
|
|
71241
71422
|
models: suffix ? [] : defaultModels
|
|
71242
71423
|
});
|
|
71243
71424
|
}
|
|
71244
|
-
if (!providers2.some((
|
|
71425
|
+
if (!providers2.some((provider2) => provider2.name === "Claude Code")) {
|
|
71245
71426
|
const apiKey = str$3(env.ANTHROPIC_API_KEY);
|
|
71246
71427
|
if (apiKey) {
|
|
71247
71428
|
providers2.push({
|
|
@@ -71313,8 +71494,8 @@ function readEnsoAi(settingsPath) {
|
|
|
71313
71494
|
const state = obj(obj(settings2["enso-settings"]).state);
|
|
71314
71495
|
const providers2 = obj(state.claudeCodeIntegration).providers;
|
|
71315
71496
|
if (!Array.isArray(providers2)) return [];
|
|
71316
|
-
return providers2.flatMap((
|
|
71317
|
-
const item = obj(
|
|
71497
|
+
return providers2.flatMap((provider2) => {
|
|
71498
|
+
const item = obj(provider2);
|
|
71318
71499
|
const apiKey = str$3(item.authToken ?? item.apiKey);
|
|
71319
71500
|
if (!apiKey) return [];
|
|
71320
71501
|
const modelIds = [
|
|
@@ -71390,8 +71571,8 @@ function existingFingerprints() {
|
|
|
71390
71571
|
const state = settings2?.["enso-settings"]?.state;
|
|
71391
71572
|
const providers2 = Array.isArray(state?.providers) ? state.providers : [];
|
|
71392
71573
|
return new Set(
|
|
71393
|
-
providers2.map((
|
|
71394
|
-
const item =
|
|
71574
|
+
providers2.map((provider2) => {
|
|
71575
|
+
const item = provider2;
|
|
71395
71576
|
return fingerprint(item.baseUrl ?? "", item.apiKey ?? "");
|
|
71396
71577
|
}).filter((value) => value !== "::")
|
|
71397
71578
|
);
|
|
@@ -71441,23 +71622,23 @@ async function scanLocalProviders() {
|
|
|
71441
71622
|
try {
|
|
71442
71623
|
const discovered = await readApp(appId, filePath);
|
|
71443
71624
|
const usable = discovered.filter(
|
|
71444
|
-
(
|
|
71625
|
+
(provider2) => (isUsableApiKey(provider2.apiKey) || provider2.api === "ollama") && (provider2.baseUrl === "" || isHttpUrl(provider2.baseUrl))
|
|
71445
71626
|
);
|
|
71446
71627
|
report.status = "found";
|
|
71447
71628
|
report.candidateCount = usable.length;
|
|
71448
|
-
for (const
|
|
71629
|
+
for (const provider2 of usable) {
|
|
71449
71630
|
const candidate = {
|
|
71450
71631
|
id: randomUUID(),
|
|
71451
71632
|
appId,
|
|
71452
71633
|
appName: APP_NAMES[appId],
|
|
71453
|
-
name:
|
|
71454
|
-
api:
|
|
71455
|
-
apiKeyMasked: maskKey(
|
|
71456
|
-
baseUrl:
|
|
71457
|
-
modelIds:
|
|
71458
|
-
duplicated: known.has(fingerprint(
|
|
71634
|
+
name: provider2.name,
|
|
71635
|
+
api: provider2.api,
|
|
71636
|
+
apiKeyMasked: maskKey(provider2.apiKey),
|
|
71637
|
+
baseUrl: provider2.baseUrl,
|
|
71638
|
+
modelIds: provider2.models.map((model) => model.label || model.id),
|
|
71639
|
+
duplicated: known.has(fingerprint(provider2.baseUrl, provider2.apiKey))
|
|
71459
71640
|
};
|
|
71460
|
-
byId2.set(candidate.id, { candidate, discovered:
|
|
71641
|
+
byId2.set(candidate.id, { candidate, discovered: provider2 });
|
|
71461
71642
|
candidates.push(candidate);
|
|
71462
71643
|
}
|
|
71463
71644
|
} catch (error) {
|
|
@@ -73620,11 +73801,11 @@ function createDispatchDriver(ports) {
|
|
|
73620
73801
|
clock2()
|
|
73621
73802
|
);
|
|
73622
73803
|
if (classified.kind === "transient" || classified.kind === "quota") {
|
|
73623
|
-
const
|
|
73804
|
+
const provider2 = event.provider ?? ports.providerOf?.(conversationId) ?? goal.retry?.provider ?? "default";
|
|
73624
73805
|
const result = ports.upstreamRecovery.reportFailure({
|
|
73625
73806
|
id: conversationId,
|
|
73626
73807
|
kind: "session",
|
|
73627
|
-
provider,
|
|
73808
|
+
provider: provider2,
|
|
73628
73809
|
errorKind: classified.kind,
|
|
73629
73810
|
lastError: event.error,
|
|
73630
73811
|
...classified.resetAt !== void 0 ? { resetAt: classified.resetAt } : {},
|
|
@@ -75795,8 +75976,8 @@ function createQueuedSessions(ports) {
|
|
|
75795
75976
|
const queued = queuedStartOf(current2);
|
|
75796
75977
|
if (!queued) return null;
|
|
75797
75978
|
const nextAttempt = (queued.retryCount ?? 0) + 1;
|
|
75798
|
-
const
|
|
75799
|
-
if (
|
|
75979
|
+
const delay2 = nextPendingRetryDelayMs(nextAttempt);
|
|
75980
|
+
if (delay2 === null) return null;
|
|
75800
75981
|
deferredAttempt = nextAttempt;
|
|
75801
75982
|
const { startingAt: _startingAt, failed: _failed, ...rest } = queued;
|
|
75802
75983
|
return {
|
|
@@ -75804,7 +75985,7 @@ function createQueuedSessions(ports) {
|
|
|
75804
75985
|
queuedStart: {
|
|
75805
75986
|
...rest,
|
|
75806
75987
|
retryCount: nextAttempt,
|
|
75807
|
-
nextRetryAt: now +
|
|
75988
|
+
nextRetryAt: now + delay2,
|
|
75808
75989
|
lastError: error
|
|
75809
75990
|
}
|
|
75810
75991
|
};
|
|
@@ -89047,8 +89228,8 @@ function toolResultText(message2) {
|
|
|
89047
89228
|
return (message2.content ?? []).map((part) => typeof part.text === "string" ? part.text : "").join("");
|
|
89048
89229
|
}
|
|
89049
89230
|
class RunTranscript {
|
|
89050
|
-
constructor(
|
|
89051
|
-
this.provider =
|
|
89231
|
+
constructor(provider2, pricing, now = Date.now) {
|
|
89232
|
+
this.provider = provider2;
|
|
89052
89233
|
this.pricing = pricing;
|
|
89053
89234
|
this.now = now;
|
|
89054
89235
|
}
|
|
@@ -89206,18 +89387,18 @@ function coerceProvider(value) {
|
|
|
89206
89387
|
...raw.oauthAccountPool ? { oauthAccountPool: raw.oauthAccountPool } : {}
|
|
89207
89388
|
};
|
|
89208
89389
|
}
|
|
89209
|
-
function enabledModelId(
|
|
89390
|
+
function enabledModelId(provider2, preferred) {
|
|
89210
89391
|
if (preferred) {
|
|
89211
|
-
const match =
|
|
89392
|
+
const match = provider2.models.find(
|
|
89212
89393
|
(model) => model.id === preferred && model.enabled !== false
|
|
89213
89394
|
);
|
|
89214
89395
|
return match ? match.id : null;
|
|
89215
89396
|
}
|
|
89216
|
-
return
|
|
89397
|
+
return provider2.models.find((model) => model.enabled !== false)?.id ?? null;
|
|
89217
89398
|
}
|
|
89218
|
-
function withModel(
|
|
89219
|
-
if (
|
|
89220
|
-
return { ...
|
|
89399
|
+
function withModel(provider2, modelId) {
|
|
89400
|
+
if (provider2.models.some((model) => model.id === modelId)) return provider2;
|
|
89401
|
+
return { ...provider2, models: [...provider2.models, { id: modelId }] };
|
|
89221
89402
|
}
|
|
89222
89403
|
function resolveRunProvider(request2, providersRaw) {
|
|
89223
89404
|
const rawList = Array.isArray(providersRaw) ? [...providersRaw] : [];
|
|
@@ -89229,7 +89410,7 @@ function resolveRunProvider(request2, providersRaw) {
|
|
|
89229
89410
|
const id = request2.providerId || "enso-run";
|
|
89230
89411
|
const api = inferApi(request2.baseUrl, request2.api);
|
|
89231
89412
|
const baseUrl = request2.baseUrl || DEFAULT_BASE_URLS[api];
|
|
89232
|
-
const index22 = known.findIndex((
|
|
89413
|
+
const index22 = known.findIndex((provider22) => provider22?.id === id);
|
|
89233
89414
|
const previous = index22 >= 0 ? known[index22] : null;
|
|
89234
89415
|
const base = previous ?? {
|
|
89235
89416
|
id,
|
|
@@ -89264,33 +89445,33 @@ function resolveRunProvider(request2, providersRaw) {
|
|
|
89264
89445
|
}
|
|
89265
89446
|
};
|
|
89266
89447
|
}
|
|
89267
|
-
const usable = known.filter((
|
|
89268
|
-
const
|
|
89269
|
-
if (!
|
|
89448
|
+
const usable = known.filter((provider22) => provider22 !== null);
|
|
89449
|
+
const provider2 = (request2.providerId ? usable.find((item) => item.id === request2.providerId) : void 0) ?? (!request2.providerId ? usable.find((item) => item.enabled && enabledModelId(item)) : void 0);
|
|
89450
|
+
if (!provider2) {
|
|
89270
89451
|
return {
|
|
89271
89452
|
ok: false,
|
|
89272
89453
|
error: request2.providerId ? `设置里没有服务商 ${request2.providerId}` : "没有可用服务商。用 --api-key、--base-url 和 --model 指定,或先写入 settings.json"
|
|
89273
89454
|
};
|
|
89274
89455
|
}
|
|
89275
|
-
if (!
|
|
89276
|
-
let modelId = enabledModelId(
|
|
89277
|
-
let next =
|
|
89456
|
+
if (!provider2.enabled) return { ok: false, error: `服务商 ${provider2.id} 已停用` };
|
|
89457
|
+
let modelId = enabledModelId(provider2, request2.modelId);
|
|
89458
|
+
let next = provider2;
|
|
89278
89459
|
if (!modelId && request2.modelId) {
|
|
89279
|
-
next = withModel(
|
|
89460
|
+
next = withModel(provider2, request2.modelId);
|
|
89280
89461
|
modelId = request2.modelId;
|
|
89281
89462
|
}
|
|
89282
|
-
if (!modelId) return { ok: false, error: `服务商 ${
|
|
89283
|
-
const reason = modelUsability({ providerId:
|
|
89463
|
+
if (!modelId) return { ok: false, error: `服务商 ${provider2.id} 没有可用模型` };
|
|
89464
|
+
const reason = modelUsability({ providerId: provider2.id, modelId }, [next], {
|
|
89284
89465
|
oauthCredentials: { status: "ready", authenticatedAccountKeys: /* @__PURE__ */ new Set() }
|
|
89285
89466
|
});
|
|
89286
89467
|
if (reason !== "usable") return { ok: false, error: `模型不可用: ${reason}` };
|
|
89287
|
-
const index2 = known.findIndex((item) => item?.id ===
|
|
89468
|
+
const index2 = known.findIndex((item) => item?.id === provider2.id);
|
|
89288
89469
|
const providers2 = [...rawList];
|
|
89289
89470
|
if (index2 >= 0) providers2[index2] = next;
|
|
89290
89471
|
return {
|
|
89291
89472
|
ok: true,
|
|
89292
89473
|
value: {
|
|
89293
|
-
providerId:
|
|
89474
|
+
providerId: provider2.id,
|
|
89294
89475
|
modelId,
|
|
89295
89476
|
providers: providers2,
|
|
89296
89477
|
changed: JSON.stringify(providers2) !== JSON.stringify(rawList)
|
|
@@ -90399,14 +90580,14 @@ class ServerUpdater {
|
|
|
90399
90580
|
return;
|
|
90400
90581
|
}
|
|
90401
90582
|
const remaining = this.idleGate.delayUntilReadyMs(now);
|
|
90402
|
-
const
|
|
90583
|
+
const delay2 = Math.min(
|
|
90403
90584
|
remaining === null ? BUSY_POLL_MS : Math.max(remaining, 250),
|
|
90404
90585
|
AUTO_RESTART_IDLE_MS
|
|
90405
90586
|
);
|
|
90406
90587
|
this.idleTimer = setTimeout(() => {
|
|
90407
90588
|
this.idleTimer = null;
|
|
90408
90589
|
this.notifyIdleStateChanged();
|
|
90409
|
-
},
|
|
90590
|
+
}, delay2);
|
|
90410
90591
|
this.idleTimer.unref?.();
|
|
90411
90592
|
}
|
|
90412
90593
|
clearIdleTimer() {
|