nolo-cli 0.264.0-alpha.2 → 0.266.0-alpha.1
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/{chunk-LXP53WGF.js → chunk-05wkntba.js} +44 -40
- package/{chunk-XFYFMTOM.js → chunk-08ts2q1n.js} +9 -11
- package/{chromeCommands-MVEEIY4R.js → chunk-0a3m1n6h.js} +182 -238
- package/chunk-0gfvc7g8.js +13 -0
- package/{chunk-CF7PE763.js → chunk-0h0sncy4.js} +3 -4
- package/{chunk-3UH7SS4W.js → chunk-0nsxwrge.js} +232 -241
- package/chunk-0ra8cne4.js +11 -0
- package/{chunk-MRACVEPZ.js → chunk-0sgwk7am.js} +1 -3
- package/{chunk-PEXGRTTQ.js → chunk-0tsfn0dk.js} +44 -45
- package/{chunk-WOAZVUSN.js → chunk-0y8cbwzy.js} +26 -30
- package/chunk-12gz55kk.js +6 -0
- package/{chunk-GLKOYSRU.js → chunk-186gshgw.js} +3 -6
- package/chunk-19w4ss38.js +44 -0
- package/{chunk-RF576RYE.js → chunk-1cakzp6r.js} +23 -23
- package/chunk-1fbfwbzp.js +27 -0
- package/{chunk-4IVMDQBA.js → chunk-1fv9k8zt.js} +103 -68
- package/{chunk-Q5FJJ6XI.js → chunk-1js4cdzp.js} +11 -19
- package/{chunk-YECCIUYU.js → chunk-1nhx0er5.js} +63 -63
- package/chunk-1p152b7g.js +12 -0
- package/{chunk-HXEO5DNV.js → chunk-1ynbq3yr.js} +322 -353
- package/{chunk-6UBGXX2W.js → chunk-1zrg4h5n.js} +3 -4
- package/{chunk-Y5GCAMGP.js → chunk-2g6zsfq8.js} +1 -3
- package/chunk-2hekb0eh.js +17 -0
- package/chunk-2pj6qzq5.js +12 -0
- package/chunk-2tvd4jyp.js +226 -0
- package/chunk-2ygg7azv.js +846 -0
- package/chunk-33405wtv.js +50 -0
- package/chunk-34axejtd.js +30 -0
- package/{tableCommands-FCPDULSU.js → chunk-3700dvt3.js} +224 -276
- package/{pdf-KE3QI2V7.js → chunk-3j08t1nm.js} +12505 -10133
- package/chunk-3j9gq18v.js +111 -0
- package/{chunk-LYPJYBE5.js → chunk-3qfpcdkm.js} +486 -505
- package/{settingThunks-PNC7ZISV.js → chunk-3r2x7h64.js} +189 -272
- package/{agentGrantCommands-2VLLXGIU.js → chunk-3tbj5fxt.js} +61 -56
- package/chunk-40whhjj5.js +168 -0
- package/chunk-4301919y.js +7 -0
- package/chunk-43adz39e.js +77 -0
- package/{chunk-5ZUL4CUO.js → chunk-49v3zc4g.js} +1 -3
- package/chunk-4dd7mxkb.js +72 -0
- package/{chunk-BKP325XS.js → chunk-4hapfzpq.js} +66 -62
- package/chunk-4mm7dz0m.js +95 -0
- package/chunk-4pqxempz.js +440 -0
- package/chunk-4x9zf5pv.js +10 -0
- package/{chunk-CA7LGAHV.js → chunk-511q8qzv.js} +66 -57
- package/{chunk-U7OULUMF.js → chunk-53v9g0np.js} +49 -64
- package/chunk-572mg6q5.js +19 -0
- package/{chunk-QAW6BEWQ.js → chunk-57eyhmwr.js} +17173 -16165
- package/chunk-5hsr0zjm.js +156 -0
- package/chunk-5k883yyd.js +20 -0
- package/chunk-5m0wsee4.js +639 -0
- package/{memberThunks-NEZRAW5K.js → chunk-5r1sq2gt.js} +299 -373
- package/chunk-648rq4np.js +255 -0
- package/{chunk-IYRZKHA6.js → chunk-666yjw5c.js} +63 -86
- package/{chunk-4O22PGNQ.js → chunk-6cdcbmtp.js} +19 -19
- package/chunk-6dbyqcf7.js +59 -0
- package/{agentProviderCommands-2W3VXDLV.js → chunk-6e8mgp1x.js} +82 -105
- package/chunk-6n0pw7sx.js +44 -0
- package/chunk-6q1b7381.js +361 -0
- package/chunk-6sj756ry.js +23 -0
- package/{chunk-4UNN45DS.js → chunk-6t7a7zck.js} +14785 -14454
- package/chunk-6yarwtxh.js +776 -0
- package/chunk-708h542p.js +18 -0
- package/chunk-76f076t8.js +266 -0
- package/chunk-782rrrwv.js +523 -0
- package/{workloadLifecycle-P2SJVV3S.js → chunk-7gk330wp.js} +77 -84
- package/{chunk-EZKIRVLJ.js → chunk-7ks60vxy.js} +146 -128
- package/{chunk-FI4DPLR7.js → chunk-7mrqbxe8.js} +342 -228
- package/chunk-7sztayrd.js +169 -0
- package/chunk-7vgt2mxz.js +15 -0
- package/{localFirstLog-OIETGK66.js → chunk-7z8y4k6y.js} +0 -2
- package/{chunk-KDDXC2IH.js → chunk-82htft2m.js} +49 -11
- package/{updateDialogTitleAction-XOSLNRT3.js → chunk-88vrtxxg.js} +65 -137
- package/{chunk-LS5KAVFQ.js → chunk-8dtjbp79.js} +293 -229
- package/chunk-8fajbkaz.js +50 -0
- package/chunk-8m1ebxpw.js +65 -0
- package/{accountResolver-JYG5L7YP.js → chunk-8mgfeg0w.js} +37 -30
- package/{chunk-LPXBBC32.js → chunk-8myksy35.js} +156 -160
- package/{chunk-BMQ2MJUK.js → chunk-8nrj7dc7.js} +75 -66
- package/{commandRegistry-ENNFT77C.js → chunk-8t8x64ec.js} +228 -286
- package/chunk-8yj4pq79.js +458 -0
- package/{chunk-5MKPNTJP.js → chunk-8z6pepcx.js} +43 -48
- package/{chunk-UYQILGDR.js → chunk-90egc9vb.js} +122 -102
- package/{chunk-EODBQPRM.js → chunk-91q5dc5r.js} +10 -14
- package/{chunk-U6VC4MU4.js → chunk-96jtrqk1.js} +2 -4
- package/{chunk-H57T64RA.js → chunk-996j61av.js} +28 -31
- package/{chunk-Q6FKWH66.js → chunk-9cxgb9jy.js} +137 -243
- package/{chunk-2ZBPWX7N.js → chunk-9q1gbmet.js} +62 -104
- package/chunk-9qtjh73q.js +344 -0
- package/{chunk-SR57FDTX.js → chunk-9raka469.js} +72 -155
- package/{chunk-V6K5U4YE.js → chunk-9vh4v046.js} +32 -41
- package/{chunk-AGIM7IMJ.js → chunk-9yr1fy7j.js} +14 -49
- package/{chunk-FGFJUFPS.js → chunk-a16x0wt6.js} +11 -18
- package/chunk-a5b2rvzs.js +131 -0
- package/{chunk-7DPNBQSV.js → chunk-a7bz6nc3.js} +3 -4
- package/chunk-ac85azv9.js +29 -0
- package/{chunk-VXL2FZTP.js → chunk-ahhbkad4.js} +16 -20
- package/{chunk-37DGW762.js → chunk-anhksj2j.js} +16 -29
- package/{cliAuthorityBrokerServer-27C5YBYP.js → chunk-atvmx76t.js} +180 -186
- package/{chunk-E6A5NHDH.js → chunk-av2mzeqz.js} +16 -17
- package/chunk-avbwrb0z.js +614 -0
- package/chunk-avr6rqe5.js +544 -0
- package/{workContextQueryProjection-CACY5VFE.js → chunk-axx60d5a.js} +7 -7
- package/{chunk-EWQ3HGNZ.js → chunk-b00vzjkb.js} +30 -23
- package/chunk-b0m6ezxr.js +132 -0
- package/chunk-bbd5mgdt.js +47 -0
- package/chunk-bcecft0r.js +28 -0
- package/chunk-beyr4pyp.js +33 -0
- package/{chunk-BR3GT6MR.js → chunk-bge0cagn.js} +7 -18
- package/{offlineMarxistsAgentCommand-MFURGWHL.js → chunk-bh53zg3t.js} +33 -43
- package/chunk-bmx1cw89.js +37 -0
- package/chunk-br2195h4.js +22 -0
- package/chunk-bsqkwveq.js +56 -0
- package/{chunk-QAU6KM2U.js → chunk-c09s2z1m.js} +139 -98
- package/chunk-c235kypv.js +24636 -0
- package/{chunk-2JMYAH5O.js → chunk-c30j6pyh.js} +213 -256
- package/chunk-c3v6r6sq.js +29 -0
- package/{chunk-PDSXYHNI.js → chunk-c5z7qspt.js} +1177 -1196
- package/{chunk-GWB6AGME.js → chunk-c6jvz0mp.js} +34 -50
- package/{chunk-PRJ473FK.js → chunk-cd6h9qqs.js} +14 -12
- package/chunk-cdt0amyy.js +37 -0
- package/{chunk-2AJLG6PY.js → chunk-cfh6tfc3.js} +73 -86
- package/{chunk-WIVVNJUS.js → chunk-ch4ck1yz.js} +38 -68
- package/chunk-chtvrtp5.js +55 -0
- package/{chunk-EYLGAEB4.js → chunk-ckvz7abv.js} +170 -165
- package/{chunk-YZMNK53S.js → chunk-csf18m5w.js} +32 -25
- package/{chunk-C36L6ZID.js → chunk-cwnvf8dt.js} +2 -10
- package/chunk-cy7thb6n.js +19877 -0
- package/{dialogPortabilityCommands-YQJNB2KL.js → chunk-d61q9nah.js} +439 -487
- package/chunk-d6xdy0gp.js +142 -0
- package/{chunk-EBH4RFJ6.js → chunk-dh69vqbd.js} +6390 -6496
- package/{chunk-KJ4J2XQB.js → chunk-dj4ggbc6.js} +17 -19
- package/{chunk-LISC7BD4.js → chunk-djrrhbk3.js} +29 -37
- package/chunk-drqzzzvr.js +822 -0
- package/chunk-e1n7edjk.js +33 -0
- package/chunk-e3atr4hk.js +59 -0
- package/chunk-e9bn2aav.js +13 -0
- package/chunk-ed396rfq.js +87 -0
- package/chunk-eha8ggh6.js +10 -0
- package/{chunk-MALPQFGT.js → chunk-ek122zzt.js} +893 -948
- package/chunk-epnmvek4.js +22 -0
- package/{chunk-S25VJYXV.js → chunk-eqzvk3xm.js} +69 -80
- package/chunk-ex34n71b.js +2874 -0
- package/{chunk-56OAS5RZ.js → chunk-f3ad6q4h.js} +7 -11
- package/{chunk-3PVYUPXK.js → chunk-f8jepva1.js} +6 -7
- package/{chunk-GH34JXNV.js → chunk-f9yvy9t9.js} +114 -92
- package/chunk-fbdz4f0j.js +90 -0
- package/{chunk-J44TXB4J.js → chunk-fcsc2day.js} +216 -164
- package/chunk-fevdhnbh.js +19 -0
- package/chunk-fkrgqq8w.js +3300 -0
- package/{chunk-TSBJVMNW.js → chunk-fs3bvh2p.js} +42 -57
- package/chunk-fvwzyhah.js +134 -0
- package/chunk-g0mpxdp9.js +101 -0
- package/{chunk-LTQ6ECCF.js → chunk-g35f20d1.js} +450 -414
- package/{chunk-3L2WKC3W.js → chunk-g5fhtjqg.js} +13 -16
- package/{chunk-DBEOW57U.js → chunk-gcq01td7.js} +270 -227
- package/{chunk-ADMRXWXJ.js → chunk-ge97b11r.js} +121 -42
- package/chunk-ghjtgbkw.js +180 -0
- package/chunk-gkra36c1.js +16 -0
- package/chunk-gmz86t60.js +1000 -0
- package/{localDialogRead-GWGWSL5K.js → chunk-gszpesze.js} +5 -12
- package/chunk-gvsfec9m.js +16536 -0
- package/{chunk-QSJ3HFEF.js → chunk-h1hzmqph.js} +1 -3
- package/chunk-h30dg154.js +17 -0
- package/chunk-h3hkb7cw.js +241 -0
- package/chunk-h40py996.js +28 -0
- package/{chunk-47T3QP4V.js → chunk-h60gnewh.js} +112 -116
- package/{agentPullCommand-XEGOUYQT.js → chunk-hkwsv9xf.js} +33 -45
- package/chunk-hnyg0gwj.js +28 -0
- package/{chunk-KSV6T4AH.js → chunk-hqqqph5w.js} +12 -4
- package/{chunk-YQJEXXDK.js → chunk-hrngs1wy.js} +157 -246
- package/{chunk-LRLLWD4P.js → chunk-htf69s94.js} +14 -12
- package/chunk-j0yxesh3.js +83 -0
- package/{chunk-VF4K2QE6.js → chunk-j22t9g05.js} +3 -6
- package/{chunk-3R4AYHJR.js → chunk-j4a8m2zn.js} +5 -34
- package/chunk-j9p4jnwg.js +27 -0
- package/{chunk-R72QWIFO.js → chunk-jdycmfsm.js} +9 -9
- package/chunk-jdyvrne0.js +52 -0
- package/{spacePruneCommand-YKIEUIDQ.js → chunk-je0b66qf.js} +44 -62
- package/{chunk-HNMXYYJR.js → chunk-jec44fkj.js} +3 -4
- package/{chunk-526GLZJE.js → chunk-jf1ex00r.js} +107 -73
- package/chunk-jgqdec9b.js +31 -0
- package/{chunk-56GBUMO5.js → chunk-jkw9n4h5.js} +16 -25
- package/{chunk-7422ZLGL.js → chunk-jmnzdwjt.js} +867 -965
- package/chunk-jqq57s0a.js +58 -0
- package/{chunk-OKUSDVRS.js → chunk-jtkn5aj6.js} +27 -38
- package/chunk-jwvzn9r0.js +316 -0
- package/chunk-k1re0fc7.js +107 -0
- package/chunk-k2ep3rb2.js +103 -0
- package/{chunk-JEXVIMYZ.js → chunk-k6ycb24w.js} +5 -8
- package/{chunk-RI7SXDJW.js → chunk-kawvydbk.js} +383 -195
- package/chunk-kf2ghpzh.js +10 -0
- package/{chunk-S6FAHQDH.js → chunk-kgah9e46.js} +28 -59
- package/{chunk-T3MWVUBE.js → chunk-kjjepkvc.js} +71 -82
- package/chunk-kn4dgg4j.js +4113 -0
- package/{chunk-2LFYMWM3.js → chunk-kn5p91n8.js} +43 -53
- package/{chunk-MVOZ22RZ.js → chunk-kntqrbwc.js} +8 -12
- package/{chunk-I6YIA2TY.js → chunk-kq3vr7mx.js} +25 -20
- package/chunk-kz1x1d8n.js +15 -0
- package/{mcpLocalAuthorizeCommand-IKOFKY5U.js → chunk-m22e7tt2.js} +53 -71
- package/{chunk-ZNFJWEN4.js → chunk-m32rwr4d.js} +11 -8
- package/chunk-m39e9m18.js +93 -0
- package/{chunk-4D4QD7FT.js → chunk-m5518371.js} +64 -56
- package/{chunk-LHTXSC2E.js → chunk-mb5hnfyp.js} +9 -11
- package/chunk-mexet11v.js +11 -0
- package/chunk-mg2hgfgh.js +185 -0
- package/chunk-mmdhm4kx.js +10317 -0
- package/chunk-mz002yz8.js +2821 -0
- package/chunk-mzadqnyq.js +56 -0
- package/{chunk-VIDPVFP3.js → chunk-n3r1ebdm.js} +5 -6
- package/chunk-n438qea7.js +33 -0
- package/chunk-n5ffnhnb.js +93 -0
- package/chunk-nbvd87fy.js +9 -0
- package/{chunk-E36V7MPY.js → chunk-ndej7jc9.js} +53 -43
- package/{chunk-B767MA64.js → chunk-nen6rwe4.js} +62 -22
- package/chunk-nf06tr3v.js +16 -0
- package/chunk-ng8z355q.js +16 -0
- package/{chunk-4MEKE5D3.js → chunk-nhtxfv8k.js} +78 -63
- package/{runAgentClientLoop-2SFASHDS.js → chunk-nj62jscj.js} +132 -214
- package/{chunk-GBWGPTA7.js → chunk-nkryrkyp.js} +16 -19
- package/chunk-nmesxem8.js +197 -0
- package/{chunk-YR4J7RFS.js → chunk-nmq0qwbn.js} +117 -164
- package/chunk-nph8brvw.js +7 -0
- package/chunk-nr8fees9.js +10 -0
- package/{chunk-DFI7MVCQ.js → chunk-nvewvf7h.js} +1441 -1427
- package/{chunk-G7Y4GXTY.js → chunk-nyamhphs.js} +70 -79
- package/chunk-nz1c8tcg.js +111 -0
- package/{chunk-GPLUFN2E.js → chunk-nzc5yffh.js} +176 -217
- package/{chunk-G3SUCT4W.js → chunk-p1vg4bx8.js} +2 -4
- package/chunk-p3k3abe8.js +202 -0
- package/chunk-p4zy30q5.js +8 -0
- package/{chunk-ZJACPM5O.js → chunk-p6se1rx0.js} +102 -102
- package/chunk-p9dpshev.js +6968 -0
- package/chunk-pa42wxr0.js +116 -0
- package/{chunk-TA5QI4MM.js → chunk-paxthgqp.js} +56 -107
- package/{readlineWorkspace-ZH5FGDMI.js → chunk-pb35s8d9.js} +5395 -5786
- package/{chunk-XT6C2QZW.js → chunk-pbebzbcq.js} +8 -8
- package/chunk-pbx7e1mb.js +11 -0
- package/chunk-pe5czfn9.js +8 -0
- package/chunk-pextk1j4.js +62 -0
- package/chunk-pf5rywc6.js +575 -0
- package/chunk-pjfhd3fz.js +136 -0
- package/{chunk-ZCMAKAZM.js → chunk-pkhqb0fs.js} +118 -59
- package/chunk-pm5xb9jh.js +26 -0
- package/{chunk-Y3KGWZKF.js → chunk-ppdmmdkx.js} +110 -97
- package/chunk-pqp6y2hs.js +9 -0
- package/{chunk-QHEN7NZ7.js → chunk-ptz8fm2n.js} +12 -17
- package/{chunk-EUHMI5KG.js → chunk-pwqnvbt7.js} +65 -46
- package/chunk-pzr31nz7.js +12 -0
- package/{chunk-WWC7I6TA.js → chunk-q3cx89sw.js} +2 -4
- package/chunk-q5pe7be3.js +78 -0
- package/{chunk-ZHWTBHT3.js → chunk-q6zqbxp2.js} +418 -409
- package/chunk-q7r0e1p3.js +15 -0
- package/chunk-q8t2fecd.js +6 -0
- package/{chunk-2QAZCYOM.js → chunk-q94zx4d0.js} +721 -753
- package/{runtimeDoctorCommands-52MBG5JN.js → chunk-qarz1az1.js} +65 -85
- package/{chunk-4INJGWE3.js → chunk-qdcvr25b.js} +72 -53
- package/{streamAgentChatTurn-KOUWITHH.js → chunk-qxs27wfg.js} +1079 -1475
- package/{chunk-GIXWVN2W.js → chunk-r06ycjjr.js} +50 -47
- package/{chunk-63W5N6P3.js → chunk-r20jw5hb.js} +57 -38
- package/{chunk-I5BYFTYK.js → chunk-r7sfwdka.js} +1201 -1142
- package/{chunk-UMADT6B2.js → chunk-r9sp1yyb.js} +6 -8
- package/{handleSendMessageAction-FHGUFT2X.js → chunk-rbd2vgb3.js} +627 -757
- package/chunk-rc37js46.js +12 -0
- package/{chunk-5YI447UL.js → chunk-rmngk6r3.js} +67 -76
- package/chunk-rnhbnbrq.js +15 -0
- package/{chunk-WRHVVIGI.js → chunk-rsfnmrt5.js} +111 -131
- package/{chunk-YFSM2366.js → chunk-rvvn2rhj.js} +28 -22
- package/{chunk-4Y6CZ2N4.js → chunk-s0fpz7ht.js} +37 -33
- package/{chunk-VI4SWTUO.js → chunk-s1cqzb2r.js} +77 -65
- package/{chunk-6QDYSCPW.js → chunk-s8q81tda.js} +73 -65
- package/chunk-s9hy639e.js +6 -0
- package/{chunk-R5GO3YZP.js → chunk-s9vbwme8.js} +115 -106
- package/chunk-sger1m1b.js +20 -0
- package/chunk-spe6crvk.js +60 -0
- package/chunk-spwsrvh9.js +70 -0
- package/chunk-sr05zpk7.js +573 -0
- package/{chunk-M2EJHDJP.js → chunk-srncrd3f.js} +1 -12
- package/{chunk-QXHFIX7W.js → chunk-sry80bpx.js} +71 -53
- package/{chunk-PSCNXBYA.js → chunk-t6q69p83.js} +3 -4
- package/{chunk-UAD2WT54.js → chunk-t714r4q0.js} +9 -28
- package/chunk-t7vbraqe.js +42 -0
- package/{chunk-CVMMWN6P.js → chunk-td7653rr.js} +10 -20
- package/{chunk-3BQDF4QB.js → chunk-tmytcetz.js} +17 -21
- package/{chunk-AMWMV56B.js → chunk-tta4prwg.js} +16 -15
- package/chunk-tvh8azgq.js +4829 -0
- package/{chunk-ID4G2MAR.js → chunk-v08kbfm8.js} +10 -11
- package/{chunk-OKPOQGQJ.js → chunk-v1x702q8.js} +801 -852
- package/{chunk-KHCLMKZZ.js → chunk-v39fea91.js} +576 -247
- package/{chunk-OW765XBU.js → chunk-vejtd8p2.js} +3 -4
- package/chunk-vep7zkha.js +368 -0
- package/chunk-vfwn1k7n.js +142 -0
- package/chunk-vg68vxhx.js +20 -0
- package/chunk-vgcqgnsm.js +31 -0
- package/{chunk-NF64D32W.js → chunk-vnzyjdea.js} +1 -3
- package/{chunk-ZCLSM5AK.js → chunk-vqgtw1px.js} +800 -717
- package/chunk-vv1gr5xz.js +76 -0
- package/{spaceCommands-Z2CTQD6G.js → chunk-w1qeadpq.js} +176 -242
- package/chunk-w468ez1p.js +13 -0
- package/chunk-w49s0t79.js +14 -0
- package/{mcpLocalManageCommands-KUDZQRM4.js → chunk-w58zhfbn.js} +91 -93
- package/chunk-w5b74aq6.js +11 -0
- package/chunk-w7y41qyw.js +117 -0
- package/chunk-w820gg1w.js +4165 -0
- package/{chunk-DBJAJ4UD.js → chunk-wdsmaqmt.js} +399 -453
- package/{chunk-3EUW3WEO.js → chunk-wfvvnmmj.js} +1 -3
- package/{chunk-QY4NZCDA.js → chunk-wkr04bhk.js} +432 -651
- package/{chunk-KUG52IAP.js → chunk-ws402twv.js} +1 -3
- package/chunk-wzwh311q.js +164 -0
- package/{runtimeModeArgs-X7DL7PUN.js → chunk-x5vtgvwn.js} +6 -5
- package/{agentMachineCommands-COJD2KPZ.js → chunk-x8h2csmq.js} +152 -195
- package/{chunk-BAZCS5XG.js → chunk-x9zfjnrc.js} +59 -47
- package/{chunk-WTIJKWCI.js → chunk-xcarc2rf.js} +50 -56
- package/chunk-xf33gz0a.js +8 -0
- package/{chunk-PVFYPUIM.js → chunk-y7b3gwx1.js} +78 -71
- package/{memoryCommands-SVLAVFCV.js → chunk-y7sphmnh.js} +119 -95
- package/{agentListCommands-436FHOIT.js → chunk-ycvaafhc.js} +260 -374
- package/chunk-yd7zprb0.js +9 -0
- package/chunk-yfz3d27k.js +40 -0
- package/{chunk-MKR6KDD3.js → chunk-ykv9g3m4.js} +141 -125
- package/chunk-ystjgb9e.js +544 -0
- package/chunk-yysxn7ep.js +12 -0
- package/{chunk-AL3TYDIF.js → chunk-z17eyawk.js} +18 -16
- package/{machineCommands-RVB5OG2X.js → chunk-z17q416p.js} +442 -563
- package/chunk-z1n98pcf.js +12 -0
- package/{dialogTraceCommand-HWXGIGZX.js → chunk-z566jx5r.js} +292 -397
- package/chunk-zjxd6942.js +6 -0
- package/{versionChangeNotice-RFABJGJE.js → chunk-zk11x9y5.js} +7 -9
- package/{chunk-TEFD5E2D.js → chunk-zt73yc33.js} +48 -51
- package/chunk-zvs2fra1.js +5 -0
- package/{chunk-SVFFKLMR.js → chunk-zwee84rh.js} +117 -141
- package/chunk-zxgfqv72.js +8 -0
- package/index.js +53 -69
- package/package.json +4 -4
- package/_executeModel-YQNZNR2Y.js +0 -341
- package/action-UK3HXGXF.js +0 -30
- package/addContentAction-CAKFVBDM.js +0 -38
- package/addDialogAgentAction-KLJ2YWWM.js +0 -77
- package/agentDeleteCommand-S5FVPYKT.js +0 -523
- package/agentEmailCommands-ZEFMGVKM.js +0 -742
- package/agentRecordCommands-JZ35AC5A.js +0 -211
- package/agentRun-UIO43TUG.js +0 -251
- package/agentRunCommand-ATLKKD6O.js +0 -249
- package/agentRunControl-U2MV74WR.js +0 -211
- package/agentRuntimeLocal-P4MMGIR6.js +0 -189
- package/agentSlice-HHNKNNYM.js +0 -52
- package/appConfigCommands-W4JQHMOJ.js +0 -417
- package/appDeleteCommands-IXR47IAV.js +0 -183
- package/appDeployCommands-LB6DHDF4.js +0 -232
- package/appDeployStatusCommands-UQ6MJL6D.js +0 -204
- package/appGetCommands-M5JCTDDQ.js +0 -185
- package/appListCommands-TE3ZHE3I.js +0 -186
- package/appMigrateCommands-FOXH6R4B.js +0 -230
- package/appSourceCommands-3ACYB6I7.js +0 -279
- package/authCommand-I5OBJP5S.js +0 -66
- package/authCommands-I6KCGOCN.js +0 -54
- package/builtinSkillRegistry-MIXYSZUU.js +0 -35
- package/chromeOpsCommands-IZRCYDSW.js +0 -579
- package/chunk-24BICQPB.js +0 -25
- package/chunk-2E4BYAUE.js +0 -69
- package/chunk-2O72G3U2.js +0 -17157
- package/chunk-2OROOEOQ.js +0 -229
- package/chunk-2R6M34JP.js +0 -27225
- package/chunk-2SXN7LAY.js +0 -15
- package/chunk-35JIFLIG.js +0 -30
- package/chunk-3VXVE2LF.js +0 -12
- package/chunk-4DBTBNTX.js +0 -477
- package/chunk-4JH2UMJR.js +0 -40
- package/chunk-4RUQ2PFX.js +0 -432
- package/chunk-4SN6J65J.js +0 -38
- package/chunk-5MMAK75Q.js +0 -15
- package/chunk-6NYQHXMV.js +0 -1737
- package/chunk-6R4IY46J.js +0 -14
- package/chunk-7E6YXSFZ.js +0 -441
- package/chunk-7K4J76JQ.js +0 -917
- package/chunk-7LR2IFUH.js +0 -100
- package/chunk-AETZ7AD6.js +0 -274
- package/chunk-ATNTHIZI.js +0 -13
- package/chunk-BPB3T5EU.js +0 -791
- package/chunk-BV3FLP2L.js +0 -133
- package/chunk-BVYHE6QD.js +0 -110
- package/chunk-BWJLEN6X.js +0 -1388
- package/chunk-CHOZJMJS.js +0 -78
- package/chunk-D2LTQAGN.js +0 -464
- package/chunk-DALXH7BG.js +0 -3392
- package/chunk-DBCWXGOC.js +0 -15210
- package/chunk-DLXL4NSL.js +0 -1179
- package/chunk-DSBRIUX5.js +0 -23
- package/chunk-DWLEOOGR.js +0 -8
- package/chunk-E2KZNP6C.js +0 -13
- package/chunk-E5JV4DCB.js +0 -272
- package/chunk-EUGTFFO6.js +0 -42
- package/chunk-FBNVJ2TO.js +0 -294
- package/chunk-FGXG6OLW.js +0 -34
- package/chunk-G22P2J7O.js +0 -1775
- package/chunk-HEVRQGGH.js +0 -106
- package/chunk-HHXF57CL.js +0 -180
- package/chunk-HI5RS2O4.js +0 -2109
- package/chunk-HJTI7RZV.js +0 -94
- package/chunk-HRWRIPTB.js +0 -531
- package/chunk-HYCVEESH.js +0 -2824
- package/chunk-I42VC5KR.js +0 -15
- package/chunk-IB5AR52X.js +0 -15
- package/chunk-IIRJ4P4I.js +0 -24
- package/chunk-IT3ZZRJE.js +0 -12
- package/chunk-IV6VUVLJ.js +0 -88
- package/chunk-J42X32PV.js +0 -472
- package/chunk-JDMWYVUF.js +0 -449
- package/chunk-JKVOKKMQ.js +0 -53
- package/chunk-JRTNUU5Z.js +0 -54
- package/chunk-K7HLFORE.js +0 -226
- package/chunk-KGBASAB5.js +0 -74
- package/chunk-KGKTN2NX.js +0 -25
- package/chunk-KX6YBIHG.js +0 -8
- package/chunk-KYHNSSL2.js +0 -62
- package/chunk-KZO2MTVM.js +0 -140
- package/chunk-LKZPX6YH.js +0 -0
- package/chunk-LLP2NDED.js +0 -201
- package/chunk-LOFRSJX2.js +0 -47
- package/chunk-M75RM77T.js +0 -3970
- package/chunk-MDAYRIP7.js +0 -1889
- package/chunk-MI6HRMCK.js +0 -25
- package/chunk-MTNQNLSE.js +0 -1029
- package/chunk-NH4PUEWK.js +0 -762
- package/chunk-NHLLXINQ.js +0 -8
- package/chunk-NTUNHTJV.js +0 -40
- package/chunk-OJKUU3LP.js +0 -67
- package/chunk-OQH3TAB7.js +0 -299
- package/chunk-P62DHV4F.js +0 -443
- package/chunk-PHIERFHT.js +0 -574
- package/chunk-PKDFU6MY.js +0 -102
- package/chunk-PL5RKESU.js +0 -40
- package/chunk-PSJJBBWV.js +0 -42
- package/chunk-QKM55LP2.js +0 -739
- package/chunk-QQ56R7KS.js +0 -88
- package/chunk-QYPE3TS3.js +0 -43
- package/chunk-REAE2SZK.js +0 -62
- package/chunk-RGQ4UUWZ.js +0 -208
- package/chunk-RIRFHJTW.js +0 -353
- package/chunk-RYMLMTPZ.js +0 -547
- package/chunk-SSGTV4FC.js +0 -303
- package/chunk-SVKWZ3EG.js +0 -607
- package/chunk-T7KODHYS.js +0 -317
- package/chunk-TGVVE5BA.js +0 -3085
- package/chunk-TKLBBR7P.js +0 -779
- package/chunk-TZXPT53C.js +0 -8
- package/chunk-U67V476Y.js +0 -35
- package/chunk-UEILX4EV.js +0 -15
- package/chunk-VIWDGTDA.js +0 -8
- package/chunk-VXUQWCEZ.js +0 -138
- package/chunk-W5GKF5ZW.js +0 -32
- package/chunk-WDWZPASX.js +0 -29
- package/chunk-WX266G2C.js +0 -9594
- package/chunk-YCITCYSJ.js +0 -356
- package/chunk-Z3KTXWWB.js +0 -76
- package/chunk-ZC3CMUKU.js +0 -322
- package/chunk-ZSZBHRLP.js +0 -1710
- package/chunk-ZV7ZY46L.js +0 -1343
- package/cliAgentConfigHelpers-WB2S7PDO.js +0 -47
- package/cliAuthorityBrokerClient-3SKOA7OZ.js +0 -23
- package/cliAuthorityBrokerProcess-BMBVXPKU.js +0 -24
- package/cliAuthorityStoreDriver-6FE3BJNB.js +0 -20
- package/cliEnvHelpers-7V5ZWUJA.js +0 -34
- package/cliExecutor-N3445G2Z.js +0 -45
- package/cliLocalAgentRecordReader-QKKRK53P.js +0 -113
- package/cloudAutomationCommands-S52NKCLL.js +0 -310
- package/contentThunks-ERA42OXW.js +0 -100
- package/cooldownCommands-ZFDAL4MR.js +0 -79
- package/createAgentAutomationAction-DMD2VDPI.js +0 -173
- package/createDialogAction-3SPOJQAK.js +0 -87
- package/createPageAction-AVXUMZVT.js +0 -91
- package/cursorProvider-2RACMEMF.js +0 -6123
- package/db-LTHLW7QA.js +0 -178
- package/dbSlice-WNUHTF4C.js +0 -76
- package/deleteDbKey-KV6MYBAI.js +0 -87
- package/desktopFolderProjects-4POAMVJN.js +0 -45
- package/dialogCommands-4MOLJW4G.js +0 -165
- package/dialogMessageRecord-2HJTEXQX.js +0 -7
- package/dialogNotifyCommand-YL2GFKLO.js +0 -45
- package/dialogSlice-Q7H2YVNO.js +0 -200
- package/dialogUsageCommand-IO2BQKL2.js +0 -31
- package/docCreateCommands-OYLRBK2M.js +0 -255
- package/docDeleteCommands-3NF6QPJU.js +0 -226
- package/docReadCommands-CBAERJAP.js +0 -184
- package/docStore-GWPFDV6Y.js +0 -89
- package/docUpdateCommands-BAMCGX6F.js +0 -326
- package/ebookDownloaderAgentCommand-NOIZ6U7Y.js +0 -675
- package/fetchMessages-P7FSCSXV.js +0 -19
- package/getPricing-KNXVEIUI.js +0 -40
- package/hostCredentialCreate-2VEYBXJV.js +0 -402
- package/i18n-SAK6DDY4.js +0 -51
- package/keys-FXEGMKSG.js +0 -183
- package/legacyMigration-TF4SYJCZ.js +0 -19
- package/levelAuthorityStore-L5SVDM5O.js +0 -10
- package/localAutomationCommands-XSK7SM7I.js +0 -199
- package/localAutomationRuntime-5WBO7HGQ.js +0 -61
- package/localRecall-BDYKXB46.js +0 -17
- package/localRuntimeAdapter-Y6H6XRIH.js +0 -310
- package/localRuntimeAuthority-Q5C2KWGF.js +0 -45
- package/localRuntimeDb-MM3DINZM.js +0 -12
- package/machineInfo-HNPJHQFU.js +0 -14
- package/machineWsRunDispatch-Y5SJGCEE.js +0 -228
- package/models-TOXYINNM.js +0 -10
- package/oauthTokenStore-RUYNYALS.js +0 -24
- package/overlay-JA3SPVUS.js +0 -15
- package/parityCommands-5OCBPVES.js +0 -613
- package/processSpawn-6GEO77KV.js +0 -11
- package/profileConfig-KOWK4HOG.js +0 -49
- package/projectArchive-WE3VVPZ2.js +0 -132
- package/providerPresetApply-YCVSP2WX.js +0 -235
- package/providerRegistry-26PAUYH2.js +0 -24
- package/read-D4WYJQJQ.js +0 -32
- package/readDocTool-3S3OQFOH.js +0 -22
- package/rememberExplicit-ZPI6KK5M.js +0 -16
- package/remove-AHRMUDMH.js +0 -32
- package/removeDialogAgentAction-AALRBFSA.js +0 -81
- package/secretCommands-2PSS3QNZ.js +0 -24
- package/setDialogExtraReferencesAction-SLHQ3GYL.js +0 -39
- package/setPrimaryDialogAgentAction-XKCSGJ7M.js +0 -96
- package/skillDiscovery-IUEZZG2B.js +0 -29
- package/skillSummaryMarker-62UW7HI7.js +0 -9
- package/slateToRenderMarkdown-R3X74MCX.js +0 -7
- package/slateUtils-ESQAJ6RN.js +0 -19
- package/store-WSAVTR32.js +0 -50
- package/switchDialogAgentAction-YJIWQGIR.js +0 -70
- package/tombstones-FQQMEDOW.js +0 -32
- package/toolApiClient-FVXTIIEN.js +0 -42
- package/tools-WN4AVSNS.js +0 -147
- package/tuiRestart-LU2BDLAW.js +0 -50
- package/tuiSummaryLlmCaller-Z2ZVBIGN.js +0 -53
- package/updateCommands-4QP7WJLA.js +0 -63
- package/usageCommand-AZX7D3LB.js +0 -31
- package/usageRebuildCommand-XV5QQCHK.js +0 -623
- package/userDataMerge-HT2ZVHBJ.js +0 -13
- package/windowsSelfUpdate-5OFKSW6Y.js +0 -14
- package/workContext-ZAW6VXT7.js +0 -18
- package/workContextAccess-VU5I4LKZ.js +0 -11
- package/workContextWriteNotice-YCSSMHN4.js +0 -7
- /package/{chunk-BYXBJQAS.js → chunk-0bcc25vg.js} +0 -0
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
writeOAuthCredential2
|
|
3
|
+
} from "./chunk-nyamhphs.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
5
|
+
loadProfileConfig2,
|
|
6
|
+
buildEnvFromProfile2
|
|
7
|
+
} from "./chunk-s9vbwme8.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
9
|
+
isRecord
|
|
10
|
+
} from "./chunk-ws402twv.js";
|
|
11
11
|
import {
|
|
12
12
|
toErrorMessage
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
asTrimmedString
|
|
16
|
-
} from "./chunk-3EUW3WEO.js";
|
|
13
|
+
} from "./chunk-jec44fkj.js";
|
|
17
14
|
import {
|
|
18
15
|
asOptionalFiniteNumber
|
|
19
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-q3cx89sw.js";
|
|
20
17
|
import {
|
|
21
|
-
|
|
22
|
-
} from "./chunk-
|
|
18
|
+
asTrimmedString
|
|
19
|
+
} from "./chunk-wfvvnmmj.js";
|
|
23
20
|
|
|
24
21
|
// packages/cli/tui/wtAmbiguousWidth.ts
|
|
25
22
|
import fs from "node:fs";
|
|
@@ -30,21 +27,21 @@ var WT_PACKAGE_NAMES = [
|
|
|
30
27
|
];
|
|
31
28
|
function wtSettingsCandidates(env = process.env) {
|
|
32
29
|
const localAppData = env.LOCALAPPDATA;
|
|
33
|
-
if (typeof localAppData !== "string" || localAppData.trim() === "")
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
);
|
|
30
|
+
if (typeof localAppData !== "string" || localAppData.trim() === "")
|
|
31
|
+
return [];
|
|
32
|
+
return WT_PACKAGE_NAMES.map((name) => path.join(localAppData, "Packages", name, "LocalState", "settings.json"));
|
|
37
33
|
}
|
|
38
34
|
function stripJsonComments(text) {
|
|
39
35
|
let out = "";
|
|
40
36
|
let inString = false;
|
|
41
37
|
let inLineComment = false;
|
|
42
38
|
let inBlockComment = false;
|
|
43
|
-
for (let i = 0;
|
|
39
|
+
for (let i = 0;i < text.length; i += 1) {
|
|
44
40
|
const ch = text[i];
|
|
45
41
|
const next = text[i + 1];
|
|
46
42
|
if (inLineComment) {
|
|
47
|
-
if (ch ===
|
|
43
|
+
if (ch === `
|
|
44
|
+
`) {
|
|
48
45
|
inLineComment = false;
|
|
49
46
|
out += ch;
|
|
50
47
|
}
|
|
@@ -64,7 +61,8 @@ function stripJsonComments(text) {
|
|
|
64
61
|
i += 1;
|
|
65
62
|
continue;
|
|
66
63
|
}
|
|
67
|
-
if (ch === '"')
|
|
64
|
+
if (ch === '"')
|
|
65
|
+
inString = false;
|
|
68
66
|
continue;
|
|
69
67
|
}
|
|
70
68
|
if (ch === '"') {
|
|
@@ -89,15 +87,19 @@ function stripJsonComments(text) {
|
|
|
89
87
|
function parseAmbiguousWidthSetting(text) {
|
|
90
88
|
const active = stripJsonComments(text);
|
|
91
89
|
const match = active.match(/"(?:[A-Za-z0-9_]+\.)?ambiguousWidth"\s*:\s*"([A-Za-z]+)"/);
|
|
92
|
-
if (!match)
|
|
90
|
+
if (!match)
|
|
91
|
+
return null;
|
|
93
92
|
const value = match[1].toLowerCase();
|
|
94
|
-
if (value === "wide")
|
|
95
|
-
|
|
93
|
+
if (value === "wide")
|
|
94
|
+
return "wide";
|
|
95
|
+
if (value === "narrow")
|
|
96
|
+
return "narrow";
|
|
96
97
|
return null;
|
|
97
98
|
}
|
|
98
99
|
function detectWindowsTerminalAmbiguousWidth(deps = {}) {
|
|
99
100
|
const platform = deps.platform ?? process.platform;
|
|
100
|
-
if (platform !== "win32")
|
|
101
|
+
if (platform !== "win32")
|
|
102
|
+
return null;
|
|
101
103
|
const env = deps.env ?? process.env;
|
|
102
104
|
const readFile = deps.readFile ?? ((filePath) => {
|
|
103
105
|
try {
|
|
@@ -108,280 +110,59 @@ function detectWindowsTerminalAmbiguousWidth(deps = {}) {
|
|
|
108
110
|
});
|
|
109
111
|
for (const candidate of wtSettingsCandidates(env)) {
|
|
110
112
|
const text = readFile(candidate);
|
|
111
|
-
if (text === null)
|
|
113
|
+
if (text === null)
|
|
114
|
+
continue;
|
|
112
115
|
const parsed = parseAmbiguousWidthSetting(text);
|
|
113
116
|
return parsed ?? "narrow";
|
|
114
117
|
}
|
|
115
118
|
return null;
|
|
116
119
|
}
|
|
117
120
|
|
|
118
|
-
// node_modules/ansi-regex/index.js
|
|
119
|
-
function ansiRegex({ onlyFirst = false } = {}) {
|
|
120
|
-
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
121
|
-
const osc = `(?:\\u001B\\][^\\u0007\\u001B\\u009C]*${ST})`;
|
|
122
|
-
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
123
|
-
const pattern = `${osc}|${csi}`;
|
|
124
|
-
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// node_modules/strip-ansi/index.js
|
|
128
|
-
var regex = ansiRegex();
|
|
129
|
-
function stripAnsi(string) {
|
|
130
|
-
if (typeof string !== "string") {
|
|
131
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
132
|
-
}
|
|
133
|
-
if (!string.includes("\x1B") && !string.includes("\x9B")) {
|
|
134
|
-
return string;
|
|
135
|
-
}
|
|
136
|
-
return string.replace(regex, "");
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// node_modules/get-east-asian-width/lookup-data.js
|
|
140
|
-
var ambiguousMinimalCodePoint = 161;
|
|
141
|
-
var ambiguousMaximumCodePoint = 1114109;
|
|
142
|
-
var ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
|
|
143
|
-
var fullwidthMinimalCodePoint = 12288;
|
|
144
|
-
var fullwidthMaximumCodePoint = 65510;
|
|
145
|
-
var fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
|
|
146
|
-
var wideMinimalCodePoint = 4352;
|
|
147
|
-
var wideMaximumCodePoint = 262141;
|
|
148
|
-
var wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101594, 101631, 101664, 101760, 101874, 101888, 102801, 102816, 102866, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110888, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110952, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127406, 127406, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128729, 128732, 128735, 128747, 128748, 128756, 128764, 128986, 128986, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129734, 129736, 129736, 129740, 129757, 129759, 129771, 129775, 129786, 131072, 196605, 196608, 262141];
|
|
149
|
-
|
|
150
|
-
// node_modules/get-east-asian-width/utilities.js
|
|
151
|
-
var isInRange = (ranges, codePoint) => {
|
|
152
|
-
let low = 0;
|
|
153
|
-
let high = Math.floor(ranges.length / 2) - 1;
|
|
154
|
-
while (low <= high) {
|
|
155
|
-
const mid = Math.floor((low + high) / 2);
|
|
156
|
-
const i = mid * 2;
|
|
157
|
-
if (codePoint < ranges[i]) {
|
|
158
|
-
high = mid - 1;
|
|
159
|
-
} else if (codePoint > ranges[i + 1]) {
|
|
160
|
-
low = mid + 1;
|
|
161
|
-
} else {
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return false;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// node_modules/get-east-asian-width/lookup.js
|
|
169
|
-
var commonCjkCodePoint = 19968;
|
|
170
|
-
var [wideFastPathStart, wideFastPathEnd] = /* @__PURE__ */ findWideFastPathRange(wideRanges);
|
|
171
|
-
function findWideFastPathRange(ranges) {
|
|
172
|
-
let fastPathStart = ranges[0];
|
|
173
|
-
let fastPathEnd = ranges[1];
|
|
174
|
-
for (let index = 0; index < ranges.length; index += 2) {
|
|
175
|
-
const start = ranges[index];
|
|
176
|
-
const end = ranges[index + 1];
|
|
177
|
-
if (commonCjkCodePoint >= start && commonCjkCodePoint <= end) {
|
|
178
|
-
return [start, end];
|
|
179
|
-
}
|
|
180
|
-
if (end - start > fastPathEnd - fastPathStart) {
|
|
181
|
-
fastPathStart = start;
|
|
182
|
-
fastPathEnd = end;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return [fastPathStart, fastPathEnd];
|
|
186
|
-
}
|
|
187
|
-
var isAmbiguous = (codePoint) => {
|
|
188
|
-
if (codePoint < ambiguousMinimalCodePoint || codePoint > ambiguousMaximumCodePoint) {
|
|
189
|
-
return false;
|
|
190
|
-
}
|
|
191
|
-
return isInRange(ambiguousRanges, codePoint);
|
|
192
|
-
};
|
|
193
|
-
var isFullwidth = (codePoint) => {
|
|
194
|
-
if (codePoint < fullwidthMinimalCodePoint || codePoint > fullwidthMaximumCodePoint) {
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
return isInRange(fullwidthRanges, codePoint);
|
|
198
|
-
};
|
|
199
|
-
var isWide = (codePoint) => {
|
|
200
|
-
if (codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd) {
|
|
201
|
-
return true;
|
|
202
|
-
}
|
|
203
|
-
if (codePoint < wideMinimalCodePoint || codePoint > wideMaximumCodePoint) {
|
|
204
|
-
return false;
|
|
205
|
-
}
|
|
206
|
-
return isInRange(wideRanges, codePoint);
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
// node_modules/get-east-asian-width/index.js
|
|
210
|
-
function validate(codePoint) {
|
|
211
|
-
if (!Number.isSafeInteger(codePoint)) {
|
|
212
|
-
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
216
|
-
validate(codePoint);
|
|
217
|
-
if (isFullwidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
218
|
-
return 2;
|
|
219
|
-
}
|
|
220
|
-
return 1;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// node_modules/string-width/index.js
|
|
224
|
-
var segmenter = new Intl.Segmenter();
|
|
225
|
-
var zeroWidthClusterRegex = new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Format}|\\p{Nonspacing_Mark}|\\p{Enclosing_Mark}|\\p{Surrogate})+$", "v");
|
|
226
|
-
var leadingNonPrintingRegex = new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Nonspacing_Mark}\\p{Enclosing_Mark}\\p{Surrogate}]+", "v");
|
|
227
|
-
var spacingMarkRegex = new RegExp("\\p{Spacing_Mark}", "v");
|
|
228
|
-
var rgiEmojiRegex = new RegExp("^\\p{RGI_Emoji}$", "v");
|
|
229
|
-
var unqualifiedKeycapRegex = /^[\d#*]\u20E3$/;
|
|
230
|
-
var extendedPictographicRegex = new RegExp("\\p{Extended_Pictographic}", "gu");
|
|
231
|
-
function isDoubleWidthNonRgiEmojiSequence(segment) {
|
|
232
|
-
if (segment.length > 50) {
|
|
233
|
-
return false;
|
|
234
|
-
}
|
|
235
|
-
if (unqualifiedKeycapRegex.test(segment)) {
|
|
236
|
-
return true;
|
|
237
|
-
}
|
|
238
|
-
if (segment.includes("\u200D")) {
|
|
239
|
-
const pictographics = segment.match(extendedPictographicRegex);
|
|
240
|
-
return pictographics !== null && pictographics.length >= 2;
|
|
241
|
-
}
|
|
242
|
-
return false;
|
|
243
|
-
}
|
|
244
|
-
function baseVisible(segment) {
|
|
245
|
-
return segment.replace(leadingNonPrintingRegex, "");
|
|
246
|
-
}
|
|
247
|
-
function isZeroWidthCluster(segment) {
|
|
248
|
-
return zeroWidthClusterRegex.test(segment);
|
|
249
|
-
}
|
|
250
|
-
function isHangulLeadingJamo(codePoint) {
|
|
251
|
-
return codePoint >= 4352 && codePoint <= 4447 || codePoint >= 43360 && codePoint <= 43388;
|
|
252
|
-
}
|
|
253
|
-
function isHangulVowelJamo(codePoint) {
|
|
254
|
-
return codePoint >= 4448 && codePoint <= 4519 || codePoint >= 55216 && codePoint <= 55238;
|
|
255
|
-
}
|
|
256
|
-
function isHangulTrailingJamo(codePoint) {
|
|
257
|
-
return codePoint >= 4520 && codePoint <= 4607 || codePoint >= 55243 && codePoint <= 55291;
|
|
258
|
-
}
|
|
259
|
-
function isHangulJamo(codePoint) {
|
|
260
|
-
return isHangulLeadingJamo(codePoint) || isHangulVowelJamo(codePoint) || isHangulTrailingJamo(codePoint);
|
|
261
|
-
}
|
|
262
|
-
function hangulClusterWidth(visibleSegment, eastAsianWidthOptions) {
|
|
263
|
-
const codePoints = [];
|
|
264
|
-
for (const character of visibleSegment) {
|
|
265
|
-
if (zeroWidthClusterRegex.test(character)) {
|
|
266
|
-
continue;
|
|
267
|
-
}
|
|
268
|
-
codePoints.push(character.codePointAt(0));
|
|
269
|
-
}
|
|
270
|
-
if (codePoints.length === 0) {
|
|
271
|
-
return void 0;
|
|
272
|
-
}
|
|
273
|
-
let width = 0;
|
|
274
|
-
for (let index = 0; index < codePoints.length; index++) {
|
|
275
|
-
const codePoint = codePoints[index];
|
|
276
|
-
if (!isHangulJamo(codePoint)) {
|
|
277
|
-
if (width === 0) {
|
|
278
|
-
return void 0;
|
|
279
|
-
}
|
|
280
|
-
for (let remaining = index; remaining < codePoints.length; remaining++) {
|
|
281
|
-
width += eastAsianWidth(codePoints[remaining], eastAsianWidthOptions);
|
|
282
|
-
}
|
|
283
|
-
return width;
|
|
284
|
-
}
|
|
285
|
-
if (isHangulLeadingJamo(codePoint) && isHangulVowelJamo(codePoints[index + 1])) {
|
|
286
|
-
width += 2;
|
|
287
|
-
index += isHangulTrailingJamo(codePoints[index + 2]) ? 2 : 1;
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
291
|
-
}
|
|
292
|
-
return width;
|
|
293
|
-
}
|
|
294
|
-
function trailingWidth(visibleSegment, eastAsianWidthOptions) {
|
|
295
|
-
let extra = 0;
|
|
296
|
-
let first = true;
|
|
297
|
-
for (const character of visibleSegment) {
|
|
298
|
-
if (first) {
|
|
299
|
-
first = false;
|
|
300
|
-
continue;
|
|
301
|
-
}
|
|
302
|
-
if (spacingMarkRegex.test(character) || character >= "\uFF00" && character <= "\uFFEF") {
|
|
303
|
-
extra += eastAsianWidth(character.codePointAt(0), eastAsianWidthOptions);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
return extra;
|
|
307
|
-
}
|
|
308
|
-
function stringWidth(input, options = {}) {
|
|
309
|
-
if (typeof input !== "string" || input.length === 0) {
|
|
310
|
-
return 0;
|
|
311
|
-
}
|
|
312
|
-
const {
|
|
313
|
-
ambiguousIsNarrow = true,
|
|
314
|
-
countAnsiEscapeCodes = false
|
|
315
|
-
} = options;
|
|
316
|
-
let string = input;
|
|
317
|
-
if (!countAnsiEscapeCodes && (string.includes("\x1B") || string.includes("\x9B"))) {
|
|
318
|
-
string = stripAnsi(string);
|
|
319
|
-
}
|
|
320
|
-
if (string.length === 0) {
|
|
321
|
-
return 0;
|
|
322
|
-
}
|
|
323
|
-
if (/^[\u0020-\u007E]*$/.test(string)) {
|
|
324
|
-
return string.length;
|
|
325
|
-
}
|
|
326
|
-
let width = 0;
|
|
327
|
-
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
328
|
-
for (const { segment } of segmenter.segment(string)) {
|
|
329
|
-
if (isZeroWidthCluster(segment)) {
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
if (rgiEmojiRegex.test(segment) || isDoubleWidthNonRgiEmojiSequence(segment)) {
|
|
333
|
-
width += 2;
|
|
334
|
-
continue;
|
|
335
|
-
}
|
|
336
|
-
const visibleSegment = baseVisible(segment);
|
|
337
|
-
const hangulWidth = hangulClusterWidth(visibleSegment, eastAsianWidthOptions);
|
|
338
|
-
if (hangulWidth !== void 0) {
|
|
339
|
-
width += hangulWidth;
|
|
340
|
-
continue;
|
|
341
|
-
}
|
|
342
|
-
const codePoint = visibleSegment.codePointAt(0);
|
|
343
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
344
|
-
width += trailingWidth(visibleSegment, eastAsianWidthOptions);
|
|
345
|
-
}
|
|
346
|
-
return width;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
121
|
// packages/cli/tui/tuiAnsi.ts
|
|
350
|
-
var ANSI_ESCAPE_REGEX = /\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g;
|
|
351
122
|
var OSC8_HYPERLINK_REGEX = /\x1b\]8;;[^\x1b]*\x1b\\/g;
|
|
352
|
-
var
|
|
353
|
-
var FIRST_ANSI_ESCAPE_REGEX = ansiRegex({ onlyFirst: true });
|
|
123
|
+
var FIRST_ANSI_ESCAPE_REGEX = /^\x1b(?:\][^\x07\x1b]*(?:\x07|\x1b\\)|\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]|[@-Z\\-_])/;
|
|
354
124
|
function stripOsc8Hyperlinks(text) {
|
|
355
125
|
return text.replace(OSC8_HYPERLINK_REGEX, "");
|
|
356
126
|
}
|
|
357
|
-
function
|
|
358
|
-
|
|
127
|
+
function stripAnsi(text) {
|
|
128
|
+
if (!text.includes("\x1B"))
|
|
129
|
+
return text;
|
|
130
|
+
return Bun.stripANSI(text);
|
|
359
131
|
}
|
|
360
132
|
var OSC8_KEEP_SPLIT_REGEX = /(\x1b\]8;[^;\x07\x1b]*;[^\x07\x1b]*(?:\x07|\x1b\\))/g;
|
|
361
133
|
var OSC8_WRAPPER_TOKEN_REGEX = /^\x1b\]8;[^;\x07\x1b]*;([^\x07\x1b]*)(?:\x07|\x1b\\)$/;
|
|
362
134
|
function stripAnsiKeepingOsc8(text) {
|
|
363
|
-
return text.split(OSC8_KEEP_SPLIT_REGEX).map((part, index) => index % 2 === 1 ? part :
|
|
135
|
+
return text.split(OSC8_KEEP_SPLIT_REGEX).map((part, index) => index % 2 === 1 ? part : stripAnsi(part)).join("");
|
|
364
136
|
}
|
|
365
|
-
var
|
|
137
|
+
var OSC8_STICKY_RE = /\x1b\]8;[^;\x07\x1b]*;[^\x07\x1b]*(?:\x07|\x1b\\)/y;
|
|
138
|
+
var SGR_STICKY_RE = /\x1b\[[0-9;]*m/y;
|
|
139
|
+
var CSI_STICKY_RE = /\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/y;
|
|
366
140
|
var TRAILING_SGR_REGEX = /(?:\x1b\[[0-9;]*m)+$/;
|
|
141
|
+
var TERMINAL_CONTROL_RE = /[\x00-\x08\x0b-\x1f\x7f]/;
|
|
367
142
|
function applyTerminalOutputToText(existing, chunk) {
|
|
368
|
-
if (!chunk)
|
|
143
|
+
if (!chunk)
|
|
144
|
+
return existing;
|
|
145
|
+
if (!TERMINAL_CONTROL_RE.test(chunk))
|
|
146
|
+
return existing + chunk;
|
|
369
147
|
let text = existing;
|
|
370
148
|
let index = 0;
|
|
371
149
|
while (index < chunk.length) {
|
|
372
150
|
if (chunk[index] === "\x1B") {
|
|
373
|
-
|
|
151
|
+
SGR_STICKY_RE.lastIndex = index;
|
|
152
|
+
const sgr = SGR_STICKY_RE.exec(chunk);
|
|
374
153
|
if (sgr) {
|
|
375
154
|
text += sgr[0];
|
|
376
155
|
index += sgr[0].length;
|
|
377
156
|
continue;
|
|
378
157
|
}
|
|
379
|
-
|
|
158
|
+
OSC8_STICKY_RE.lastIndex = index;
|
|
159
|
+
const osc = OSC8_STICKY_RE.exec(chunk);
|
|
380
160
|
if (osc) {
|
|
381
161
|
index += osc[0].length;
|
|
382
162
|
continue;
|
|
383
163
|
}
|
|
384
|
-
|
|
164
|
+
CSI_STICKY_RE.lastIndex = index;
|
|
165
|
+
const csi = CSI_STICKY_RE.exec(chunk);
|
|
385
166
|
if (csi) {
|
|
386
167
|
index += csi[0].length;
|
|
387
168
|
continue;
|
|
@@ -391,13 +172,16 @@ function applyTerminalOutputToText(existing, chunk) {
|
|
|
391
172
|
}
|
|
392
173
|
const ch = chunk[index];
|
|
393
174
|
if (ch === "\r") {
|
|
394
|
-
const lastNl = text.lastIndexOf(
|
|
175
|
+
const lastNl = text.lastIndexOf(`
|
|
176
|
+
`);
|
|
395
177
|
text = lastNl === -1 ? "" : text.slice(0, lastNl + 1);
|
|
396
178
|
index += 1;
|
|
397
179
|
continue;
|
|
398
180
|
}
|
|
399
|
-
if (ch ===
|
|
400
|
-
|
|
181
|
+
if (ch === `
|
|
182
|
+
`) {
|
|
183
|
+
text += `
|
|
184
|
+
`;
|
|
401
185
|
index += 1;
|
|
402
186
|
continue;
|
|
403
187
|
}
|
|
@@ -405,14 +189,15 @@ function applyTerminalOutputToText(existing, chunk) {
|
|
|
405
189
|
const trailing = TRAILING_SGR_REGEX.exec(text);
|
|
406
190
|
const sgrTail = trailing ? trailing[0] : "";
|
|
407
191
|
const head = sgrTail ? text.slice(0, -sgrTail.length) : text;
|
|
408
|
-
if (head.length > 0 && head[head.length - 1] !==
|
|
192
|
+
if (head.length > 0 && head[head.length - 1] !== `
|
|
193
|
+
`) {
|
|
409
194
|
text = head.slice(0, -1) + sgrTail;
|
|
410
195
|
}
|
|
411
196
|
index += 1;
|
|
412
197
|
continue;
|
|
413
198
|
}
|
|
414
199
|
const code = ch.charCodeAt(0);
|
|
415
|
-
if (code < 32 && ch !== "
|
|
200
|
+
if (code < 32 && ch !== "\t" || code === 127) {
|
|
416
201
|
index += 1;
|
|
417
202
|
continue;
|
|
418
203
|
}
|
|
@@ -422,77 +207,77 @@ function applyTerminalOutputToText(existing, chunk) {
|
|
|
422
207
|
return text;
|
|
423
208
|
}
|
|
424
209
|
function resolveAmbiguousWidth(explicit, env = process.env) {
|
|
425
|
-
if (explicit === "wide" || explicit === "narrow")
|
|
210
|
+
if (explicit === "wide" || explicit === "narrow")
|
|
211
|
+
return explicit;
|
|
426
212
|
const raw = env.NOLO_TUI_AMBIGUOUS_WIDTH;
|
|
427
213
|
if (typeof raw === "string") {
|
|
428
214
|
const trimmed = raw.trim().toLowerCase();
|
|
429
|
-
if (trimmed === "wide")
|
|
430
|
-
|
|
215
|
+
if (trimmed === "wide")
|
|
216
|
+
return "wide";
|
|
217
|
+
if (trimmed === "narrow")
|
|
218
|
+
return "narrow";
|
|
431
219
|
}
|
|
432
220
|
return detectedWindowsTerminalAmbiguousWidth() ?? "narrow";
|
|
433
221
|
}
|
|
434
222
|
var wtAmbiguousWidthCache;
|
|
435
223
|
function detectedWindowsTerminalAmbiguousWidth() {
|
|
436
|
-
if (wtAmbiguousWidthCache ===
|
|
224
|
+
if (wtAmbiguousWidthCache === undefined) {
|
|
437
225
|
wtAmbiguousWidthCache = detectWindowsTerminalAmbiguousWidth();
|
|
438
226
|
}
|
|
439
227
|
return wtAmbiguousWidthCache;
|
|
440
228
|
}
|
|
441
229
|
function isCjkFontWideSymbolCode(code) {
|
|
442
|
-
return code >= 9728 && code <= 10175 && !(code >= 10088 && code <= 10101) || code >= 11008 && code <= 11263 || code >= 127744 && code <= 129791 || code >= 8986 && code <= 8987 ||
|
|
443
|
-
code >= 9193 && code <= 9210;
|
|
444
|
-
}
|
|
445
|
-
function isCjkQuoteCode(code) {
|
|
446
|
-
return code === 8220 || code === 8221 || code === 8216 || code === 8217;
|
|
230
|
+
return code >= 9728 && code <= 10175 && !(code >= 10088 && code <= 10101) || code >= 11008 && code <= 11263 || code >= 127744 && code <= 129791 || code >= 8986 && code <= 8987 || code >= 9193 && code <= 9210;
|
|
447
231
|
}
|
|
448
232
|
var UNICODE_BOX_GLYPHS = {
|
|
449
|
-
h: "
|
|
450
|
-
v: "
|
|
451
|
-
tl: "
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
mr: "\u2524",
|
|
457
|
-
bl: "\u2514",
|
|
458
|
-
bm: "\u2534",
|
|
459
|
-
br: "\u2518"
|
|
233
|
+
h: "─",
|
|
234
|
+
v: "│",
|
|
235
|
+
tl: "┌",
|
|
236
|
+
tr: "┐",
|
|
237
|
+
mm: "┼",
|
|
238
|
+
bl: "└",
|
|
239
|
+
br: "┘"
|
|
460
240
|
};
|
|
461
241
|
var ASCII_BOX_GLYPHS = {
|
|
462
242
|
h: "-",
|
|
463
243
|
v: "|",
|
|
464
244
|
tl: "+",
|
|
465
|
-
tm: "+",
|
|
466
245
|
tr: "+",
|
|
467
|
-
ml: "+",
|
|
468
246
|
mm: "+",
|
|
469
|
-
mr: "+",
|
|
470
247
|
bl: "+",
|
|
471
|
-
bm: "+",
|
|
472
248
|
br: "+"
|
|
473
249
|
};
|
|
474
250
|
function resolveBoxCharset(ambiguousWidth = resolveAmbiguousWidth(), env = process.env) {
|
|
475
251
|
const raw = env.NOLO_TUI_BOX;
|
|
476
252
|
if (typeof raw === "string") {
|
|
477
253
|
const trimmed = raw.trim().toLowerCase();
|
|
478
|
-
if (trimmed === "ascii")
|
|
479
|
-
|
|
254
|
+
if (trimmed === "ascii")
|
|
255
|
+
return "ascii";
|
|
256
|
+
if (trimmed === "unicode")
|
|
257
|
+
return "unicode";
|
|
480
258
|
}
|
|
481
259
|
return ambiguousWidth === "wide" ? "ascii" : "unicode";
|
|
482
260
|
}
|
|
483
261
|
function boxGlyphs(charset) {
|
|
484
262
|
return charset === "ascii" ? ASCII_BOX_GLYPHS : UNICODE_BOX_GLYPHS;
|
|
485
263
|
}
|
|
486
|
-
function
|
|
487
|
-
let
|
|
264
|
+
function scanWidthKind(plain, ambiguousWidth) {
|
|
265
|
+
let kind = 0;
|
|
488
266
|
const isWideMode = ambiguousWidth === "wide";
|
|
489
|
-
for (let i = 0;
|
|
267
|
+
for (let i = 0;i < plain.length; i++) {
|
|
490
268
|
const cc = plain.charCodeAt(i);
|
|
491
|
-
if (cc
|
|
492
|
-
|
|
269
|
+
if (cc >= 32 && cc <= 126)
|
|
270
|
+
continue;
|
|
271
|
+
if (cc < 128) {
|
|
272
|
+
if (kind === 0)
|
|
273
|
+
kind = 1;
|
|
493
274
|
continue;
|
|
494
275
|
}
|
|
495
|
-
|
|
276
|
+
kind = 2;
|
|
277
|
+
if (cc < 8192)
|
|
278
|
+
continue;
|
|
279
|
+
if (!isWideMode)
|
|
280
|
+
continue;
|
|
496
281
|
let code = cc;
|
|
497
282
|
if (cc >= 55296 && cc <= 56319 && i + 1 < plain.length) {
|
|
498
283
|
const lo = plain.charCodeAt(i + 1);
|
|
@@ -501,37 +286,36 @@ function scanWidthNeeds(plain, locale, ambiguousWidth) {
|
|
|
501
286
|
i += 1;
|
|
502
287
|
}
|
|
503
288
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
if (isSymbolCandidate || isQuoteCandidate) {
|
|
507
|
-
return { hasNonAscii: true, hasCandidate: true };
|
|
508
|
-
}
|
|
289
|
+
if (isCjkFontWideSymbolCode(code))
|
|
290
|
+
return 3;
|
|
509
291
|
}
|
|
510
|
-
return
|
|
292
|
+
return kind;
|
|
511
293
|
}
|
|
512
|
-
var displayWidthCache =
|
|
294
|
+
var displayWidthCache = new Map;
|
|
513
295
|
var DISPLAY_WIDTH_CACHE_MAX = 4096;
|
|
514
|
-
function
|
|
515
|
-
const plain =
|
|
516
|
-
const locale = getCliLocale();
|
|
296
|
+
function displayWidth2(str, ambiguousWidth = resolveAmbiguousWidth()) {
|
|
297
|
+
const plain = stripAnsi(str);
|
|
517
298
|
const widthOptions = { ambiguousIsNarrow: ambiguousWidth !== "wide" };
|
|
518
|
-
const
|
|
519
|
-
if (
|
|
520
|
-
return
|
|
521
|
-
|
|
522
|
-
|
|
299
|
+
const kind = scanWidthKind(plain, ambiguousWidth);
|
|
300
|
+
if (kind === 0)
|
|
301
|
+
return plain.length;
|
|
302
|
+
if (kind === 1)
|
|
303
|
+
return Bun.stringWidth(plain, widthOptions);
|
|
304
|
+
const key = ambiguousWidth + "\x00" + plain;
|
|
523
305
|
const cached = displayWidthCache.get(key);
|
|
524
|
-
if (cached !==
|
|
525
|
-
|
|
306
|
+
if (cached !== undefined)
|
|
307
|
+
return cached;
|
|
308
|
+
const remember = (width) => {
|
|
526
309
|
if (displayWidthCache.size >= DISPLAY_WIDTH_CACHE_MAX) {
|
|
527
310
|
const eldest = displayWidthCache.keys().next().value;
|
|
528
|
-
if (eldest !==
|
|
311
|
+
if (eldest !== undefined)
|
|
312
|
+
displayWidthCache.delete(eldest);
|
|
529
313
|
}
|
|
530
|
-
displayWidthCache.set(key,
|
|
531
|
-
return
|
|
314
|
+
displayWidthCache.set(key, width);
|
|
315
|
+
return width;
|
|
532
316
|
};
|
|
533
|
-
const base = stringWidth(plain, widthOptions);
|
|
534
|
-
if (
|
|
317
|
+
const base = Bun.stringWidth(plain, widthOptions);
|
|
318
|
+
if (kind === 2) {
|
|
535
319
|
return remember(base);
|
|
536
320
|
}
|
|
537
321
|
let width = base;
|
|
@@ -539,20 +323,22 @@ function displayWidth(str, ambiguousWidth = resolveAmbiguousWidth()) {
|
|
|
539
323
|
for (const { segment } of graphemeSegmenter.segment(plain)) {
|
|
540
324
|
const code = segment.codePointAt(0) ?? 0;
|
|
541
325
|
const isSymbol = isWideMode && isCjkFontWideSymbolCode(code);
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
326
|
+
if (isSymbol) {
|
|
327
|
+
if (Bun.stringWidth(segment, widthOptions) === 1)
|
|
328
|
+
width += 1;
|
|
545
329
|
}
|
|
546
330
|
}
|
|
547
331
|
return remember(width);
|
|
548
332
|
}
|
|
549
333
|
function visibleWidth(str) {
|
|
550
|
-
return
|
|
334
|
+
return displayWidth2(str);
|
|
551
335
|
}
|
|
552
336
|
function truncateAnsi(text, maxWidth) {
|
|
553
|
-
if (maxWidth <= 0)
|
|
337
|
+
if (maxWidth <= 0)
|
|
338
|
+
return "";
|
|
554
339
|
text = stripOsc8Hyperlinks(text);
|
|
555
|
-
if (visibleWidth(text) <= maxWidth)
|
|
340
|
+
if (visibleWidth(text) <= maxWidth)
|
|
341
|
+
return text;
|
|
556
342
|
let width = 0;
|
|
557
343
|
let out = "";
|
|
558
344
|
let i = 0;
|
|
@@ -564,7 +350,8 @@ function truncateAnsi(text, maxWidth) {
|
|
|
564
350
|
while (j < text.length) {
|
|
565
351
|
const code = text.charCodeAt(j);
|
|
566
352
|
j += 1;
|
|
567
|
-
if (code >= 64 && code <= 126)
|
|
353
|
+
if (code >= 64 && code <= 126)
|
|
354
|
+
break;
|
|
568
355
|
}
|
|
569
356
|
out += text.slice(i, j);
|
|
570
357
|
i = j;
|
|
@@ -572,37 +359,34 @@ function truncateAnsi(text, maxWidth) {
|
|
|
572
359
|
}
|
|
573
360
|
const codePoint = text.codePointAt(i) ?? 0;
|
|
574
361
|
const char = String.fromCodePoint(codePoint);
|
|
575
|
-
const charWidth =
|
|
576
|
-
if (width + charWidth > maxWidth)
|
|
362
|
+
const charWidth = displayWidth2(char);
|
|
363
|
+
if (width + charWidth > maxWidth)
|
|
364
|
+
break;
|
|
577
365
|
out += char;
|
|
578
366
|
width += charWidth;
|
|
579
367
|
i += char.length;
|
|
580
368
|
}
|
|
581
369
|
return sawAnsi ? `${out}\x1B[0m` : out;
|
|
582
370
|
}
|
|
583
|
-
function fitAnsiLine(text, width, ellipsis = "
|
|
584
|
-
if (width <= 0)
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
371
|
+
function fitAnsiLine(text, width, ellipsis = "…") {
|
|
372
|
+
if (width <= 0)
|
|
373
|
+
return "";
|
|
374
|
+
if (visibleWidth(text) <= width)
|
|
375
|
+
return text;
|
|
376
|
+
const ellipsisWidth = displayWidth2(ellipsis);
|
|
377
|
+
if (width < ellipsisWidth)
|
|
378
|
+
return truncateAnsi(text, width);
|
|
379
|
+
if (width === ellipsisWidth)
|
|
380
|
+
return truncateAnsi(ellipsis, width) || truncateAnsi(text, width);
|
|
589
381
|
return `${truncateAnsi(text, width - ellipsisWidth)}${ellipsis}`;
|
|
590
382
|
}
|
|
591
|
-
function countPhysicalLines(text, columns) {
|
|
592
|
-
const lines = text.split("\n");
|
|
593
|
-
let total = 0;
|
|
594
|
-
for (const line of lines) {
|
|
595
|
-
const width = visibleWidth(stripOsc8Hyperlinks(line));
|
|
596
|
-
total += Math.max(1, Math.ceil(width / columns));
|
|
597
|
-
}
|
|
598
|
-
return Math.max(total, 1);
|
|
599
|
-
}
|
|
600
383
|
function takeDisplayWidth(text, width) {
|
|
601
384
|
let used = 0;
|
|
602
385
|
let index = 0;
|
|
603
386
|
for (const char of text) {
|
|
604
|
-
const charWidth =
|
|
605
|
-
if (used + charWidth > width && used > 0)
|
|
387
|
+
const charWidth = displayWidth2(char);
|
|
388
|
+
if (used + charWidth > width && used > 0)
|
|
389
|
+
break;
|
|
606
390
|
used += charWidth;
|
|
607
391
|
index += char.length;
|
|
608
392
|
}
|
|
@@ -616,25 +400,37 @@ function padOrTruncateToWidth(text, width) {
|
|
|
616
400
|
return `${text}${" ".repeat(width - textWidth)}`;
|
|
617
401
|
}
|
|
618
402
|
var SGR_RESET_REGEX = /^\x1b\[0?m$/;
|
|
619
|
-
var graphemeSegmenter = new Intl.Segmenter(
|
|
403
|
+
var graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
404
|
+
function isWideCjkCode(cc) {
|
|
405
|
+
return cc >= 19968 && cc <= 40959 || cc >= 12288 && cc <= 12351 || cc >= 65281 && cc <= 65376;
|
|
406
|
+
}
|
|
407
|
+
var NON_SGR_ESC_RE = /\x1b(?!\[[0-9;]*m)/;
|
|
408
|
+
function isSafeShortAnsiLine(line) {
|
|
409
|
+
const lastEsc = line.lastIndexOf("\x1B");
|
|
410
|
+
return lastEsc === -1 || line.startsWith("\x1B[0m", lastEsc) && !line.includes("\x1B]8;") && !NON_SGR_ESC_RE.test(line);
|
|
411
|
+
}
|
|
620
412
|
function tokenizeAnsiLine(line) {
|
|
621
413
|
const tokens = [];
|
|
414
|
+
const ambiguousWidth = resolveAmbiguousWidth();
|
|
622
415
|
let index = 0;
|
|
623
416
|
while (index < line.length) {
|
|
624
417
|
if (line[index] === "\x1B") {
|
|
625
|
-
|
|
418
|
+
OSC8_STICKY_RE.lastIndex = index;
|
|
419
|
+
const osc = OSC8_STICKY_RE.exec(line);
|
|
626
420
|
if (osc) {
|
|
627
421
|
tokens.push({ kind: "sgr", value: osc[0], width: 0, charIndex: index });
|
|
628
422
|
index += osc[0].length;
|
|
629
423
|
continue;
|
|
630
424
|
}
|
|
631
|
-
|
|
425
|
+
SGR_STICKY_RE.lastIndex = index;
|
|
426
|
+
const sgr = SGR_STICKY_RE.exec(line);
|
|
632
427
|
if (sgr) {
|
|
633
428
|
tokens.push({ kind: "sgr", value: sgr[0], width: 0, charIndex: index });
|
|
634
429
|
index += sgr[0].length;
|
|
635
430
|
continue;
|
|
636
431
|
}
|
|
637
|
-
|
|
432
|
+
CSI_STICKY_RE.lastIndex = index;
|
|
433
|
+
const csi = CSI_STICKY_RE.exec(line);
|
|
638
434
|
if (csi) {
|
|
639
435
|
index += csi[0].length;
|
|
640
436
|
continue;
|
|
@@ -648,15 +444,48 @@ function tokenizeAnsiLine(line) {
|
|
|
648
444
|
continue;
|
|
649
445
|
}
|
|
650
446
|
let nextEsc = line.indexOf("\x1B", index);
|
|
651
|
-
if (nextEsc === -1)
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
447
|
+
if (nextEsc === -1)
|
|
448
|
+
nextEsc = line.length;
|
|
449
|
+
let simpleAsciiOrCjk = true;
|
|
450
|
+
for (let k = index;k < nextEsc; k++) {
|
|
451
|
+
const cc = line.charCodeAt(k);
|
|
452
|
+
if (cc >= 32 && cc <= 126 || isWideCjkCode(cc))
|
|
453
|
+
continue;
|
|
454
|
+
simpleAsciiOrCjk = false;
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
if (simpleAsciiOrCjk) {
|
|
458
|
+
for (let k = index;k < nextEsc; k++) {
|
|
459
|
+
tokens.push({
|
|
460
|
+
kind: "char",
|
|
461
|
+
value: line[k],
|
|
462
|
+
width: line.charCodeAt(k) <= 126 ? 1 : 2,
|
|
463
|
+
charIndex: k
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
} else {
|
|
467
|
+
const chunk = line.slice(index, nextEsc);
|
|
468
|
+
for (const item of graphemeSegmenter.segment(chunk)) {
|
|
469
|
+
const seg = item.segment;
|
|
470
|
+
let w;
|
|
471
|
+
if (seg.length === 1) {
|
|
472
|
+
const cc = seg.charCodeAt(0);
|
|
473
|
+
if (cc >= 32 && cc <= 126)
|
|
474
|
+
w = 1;
|
|
475
|
+
else if (isWideCjkCode(cc))
|
|
476
|
+
w = 2;
|
|
477
|
+
else
|
|
478
|
+
w = displayWidth2(seg, ambiguousWidth);
|
|
479
|
+
} else {
|
|
480
|
+
w = displayWidth2(seg, ambiguousWidth);
|
|
481
|
+
}
|
|
482
|
+
tokens.push({
|
|
483
|
+
kind: "char",
|
|
484
|
+
value: seg,
|
|
485
|
+
width: w,
|
|
486
|
+
charIndex: index + item.index
|
|
487
|
+
});
|
|
488
|
+
}
|
|
660
489
|
}
|
|
661
490
|
index = nextEsc;
|
|
662
491
|
}
|
|
@@ -668,31 +497,32 @@ function buildSourceMapping(rawLine, styledLine, prefixCharCount) {
|
|
|
668
497
|
let lineToParse = rawLine;
|
|
669
498
|
if (headingMatch) {
|
|
670
499
|
contentStart = headingMatch[1].length + 1;
|
|
671
|
-
while (contentStart < rawLine.length && rawLine[contentStart] === " ")
|
|
500
|
+
while (contentStart < rawLine.length && rawLine[contentStart] === " ")
|
|
501
|
+
contentStart++;
|
|
672
502
|
lineToParse = rawLine.slice(contentStart);
|
|
673
503
|
}
|
|
674
|
-
const visibleBody =
|
|
504
|
+
const visibleBody = stripAnsi(styledLine.slice(prefixCharCount));
|
|
675
505
|
const INLINE_RE = /(\[([^\]]+)\]\(([^)\s]+)\)|`([^`]+)`|\*\*(.+?)\*\*|(?<!\*)\*([^*]+?)\*(?!\*)|~~([^~]+?)~~)/g;
|
|
676
506
|
const mapping = [];
|
|
677
507
|
let lastIdx = 0;
|
|
678
508
|
let match;
|
|
679
509
|
while ((match = INLINE_RE.exec(lineToParse)) !== null) {
|
|
680
510
|
const plainBefore = lineToParse.slice(lastIdx, match.index);
|
|
681
|
-
for (let c = 0;
|
|
511
|
+
for (let c = 0;c < plainBefore.length; c++) {
|
|
682
512
|
mapping.push(contentStart + lastIdx + c);
|
|
683
513
|
}
|
|
684
514
|
const fullMatch = match[0];
|
|
685
|
-
if (match[2] !==
|
|
515
|
+
if (match[2] !== undefined && match[3] !== undefined) {
|
|
686
516
|
const linkText = match[2];
|
|
687
517
|
const linkUrl = match[3];
|
|
688
518
|
const cleanText = linkText.replace(/[\u0000-\u001f\u007f]/g, "");
|
|
689
519
|
const cleanUrl = linkUrl.replace(/[\u0000-\u001f\u007f]/g, "");
|
|
690
520
|
const cursor = mapping.length;
|
|
691
521
|
const textOffset = contentStart + match.index + 1;
|
|
692
|
-
for (let c = 0;
|
|
522
|
+
for (let c = 0;c < cleanText.length; c++) {
|
|
693
523
|
mapping.push(textOffset + c);
|
|
694
524
|
}
|
|
695
|
-
if (visibleBody.startsWith(`${cleanText}
|
|
525
|
+
if (visibleBody.startsWith(`${cleanText} ↗`, cursor)) {
|
|
696
526
|
const closeParenOffset = contentStart + match.index + fullMatch.length - 1;
|
|
697
527
|
mapping.push(closeParenOffset);
|
|
698
528
|
mapping.push(closeParenOffset);
|
|
@@ -701,50 +531,49 @@ function buildSourceMapping(rawLine, styledLine, prefixCharCount) {
|
|
|
701
531
|
mapping.push(parenOffset);
|
|
702
532
|
mapping.push(parenOffset + 1);
|
|
703
533
|
const urlOffset = parenOffset + 2;
|
|
704
|
-
for (let c = 0;
|
|
534
|
+
for (let c = 0;c < cleanUrl.length; c++) {
|
|
705
535
|
mapping.push(urlOffset + c);
|
|
706
536
|
}
|
|
707
537
|
mapping.push(urlOffset + linkUrl.length);
|
|
708
|
-
} else if (visibleBody.startsWith(cleanText, cursor) && cleanText.trim() === cleanUrl.trim()) {
|
|
709
|
-
} else if (linkText.trim() !== linkUrl.trim()) {
|
|
538
|
+
} else if (visibleBody.startsWith(cleanText, cursor) && cleanText.trim() === cleanUrl.trim()) {} else if (linkText.trim() !== linkUrl.trim()) {
|
|
710
539
|
const parenOffset = textOffset + linkText.length;
|
|
711
540
|
mapping.push(parenOffset);
|
|
712
541
|
mapping.push(parenOffset + 1);
|
|
713
542
|
const urlOffset = parenOffset + 2;
|
|
714
|
-
for (let c = 0;
|
|
543
|
+
for (let c = 0;c < linkUrl.length; c++) {
|
|
715
544
|
mapping.push(urlOffset + c);
|
|
716
545
|
}
|
|
717
546
|
mapping.push(urlOffset + linkUrl.length);
|
|
718
547
|
}
|
|
719
|
-
} else if (match[4] !==
|
|
548
|
+
} else if (match[4] !== undefined) {
|
|
720
549
|
const codeText = match[4];
|
|
721
550
|
const codeOffset = contentStart + match.index + 1;
|
|
722
|
-
for (let c = 0;
|
|
551
|
+
for (let c = 0;c < codeText.length; c++) {
|
|
723
552
|
mapping.push(codeOffset + c);
|
|
724
553
|
}
|
|
725
|
-
} else if (match[5] !==
|
|
554
|
+
} else if (match[5] !== undefined) {
|
|
726
555
|
const boldText = match[5];
|
|
727
556
|
const boldOffset = contentStart + match.index + 2;
|
|
728
|
-
for (let c = 0;
|
|
557
|
+
for (let c = 0;c < boldText.length; c++) {
|
|
729
558
|
mapping.push(boldOffset + c);
|
|
730
559
|
}
|
|
731
|
-
} else if (match[6] !==
|
|
560
|
+
} else if (match[6] !== undefined) {
|
|
732
561
|
const italicText = match[6];
|
|
733
562
|
const italicOffset = contentStart + match.index + 1;
|
|
734
|
-
for (let c = 0;
|
|
563
|
+
for (let c = 0;c < italicText.length; c++) {
|
|
735
564
|
mapping.push(italicOffset + c);
|
|
736
565
|
}
|
|
737
|
-
} else if (match[7] !==
|
|
566
|
+
} else if (match[7] !== undefined) {
|
|
738
567
|
const strikeText = match[7];
|
|
739
568
|
const strikeOffset = contentStart + match.index + 2;
|
|
740
|
-
for (let c = 0;
|
|
569
|
+
for (let c = 0;c < strikeText.length; c++) {
|
|
741
570
|
mapping.push(strikeOffset + c);
|
|
742
571
|
}
|
|
743
572
|
}
|
|
744
573
|
lastIdx = match.index + fullMatch.length;
|
|
745
574
|
}
|
|
746
575
|
const plainRest = lineToParse.slice(lastIdx);
|
|
747
|
-
for (let c = 0;
|
|
576
|
+
for (let c = 0;c < plainRest.length; c++) {
|
|
748
577
|
mapping.push(contentStart + lastIdx + c);
|
|
749
578
|
}
|
|
750
579
|
return mapping;
|
|
@@ -761,6 +590,54 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
761
590
|
}
|
|
762
591
|
];
|
|
763
592
|
}
|
|
593
|
+
if (isSafeShortAnsiLine(line) && displayWidth2(line) <= columns) {
|
|
594
|
+
const bodySlice = prefixCharCount > 0 ? line.slice(prefixCharCount) : line;
|
|
595
|
+
const plainBody = bodySlice.includes("\x1B") ? stripAnsi(bodySlice) : bodySlice;
|
|
596
|
+
const bodyLen = plainBody.length;
|
|
597
|
+
if (bodyLen === 0) {
|
|
598
|
+
return [
|
|
599
|
+
{
|
|
600
|
+
rendered: line,
|
|
601
|
+
sourceStart: lineSourceStart,
|
|
602
|
+
sourceEnd: lineSourceStart + (rawLineLength ?? 0),
|
|
603
|
+
prefixWidth,
|
|
604
|
+
softWrapped: false,
|
|
605
|
+
softWrapJoiner: ""
|
|
606
|
+
}
|
|
607
|
+
];
|
|
608
|
+
}
|
|
609
|
+
if (!sourceMapping) {
|
|
610
|
+
return [
|
|
611
|
+
{
|
|
612
|
+
rendered: line,
|
|
613
|
+
sourceStart: lineSourceStart,
|
|
614
|
+
sourceEnd: lineSourceStart + (rawLineLength ?? bodyLen),
|
|
615
|
+
prefixWidth,
|
|
616
|
+
sourceMapping: undefined,
|
|
617
|
+
softWrapped: false,
|
|
618
|
+
softWrapJoiner: ""
|
|
619
|
+
}
|
|
620
|
+
];
|
|
621
|
+
}
|
|
622
|
+
const rowMapping = new Array(bodyLen);
|
|
623
|
+
for (let i = 0;i < bodyLen; i++) {
|
|
624
|
+
const mapped = sourceMapping[i];
|
|
625
|
+
rowMapping[i] = lineSourceStart + (mapped !== undefined ? mapped : i);
|
|
626
|
+
}
|
|
627
|
+
const segSourceStart = rowMapping[0];
|
|
628
|
+
const segSourceEnd = rawLineLength !== undefined ? lineSourceStart + rawLineLength : rowMapping[bodyLen - 1] + 1;
|
|
629
|
+
return [
|
|
630
|
+
{
|
|
631
|
+
rendered: line,
|
|
632
|
+
sourceStart: segSourceStart,
|
|
633
|
+
sourceEnd: segSourceEnd,
|
|
634
|
+
prefixWidth,
|
|
635
|
+
sourceMapping: rowMapping,
|
|
636
|
+
softWrapped: false,
|
|
637
|
+
softWrapJoiner: ""
|
|
638
|
+
}
|
|
639
|
+
];
|
|
640
|
+
}
|
|
764
641
|
const tokens = tokenizeAnsiLine(line);
|
|
765
642
|
const rows = [];
|
|
766
643
|
let activeStyles = [];
|
|
@@ -779,7 +656,7 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
779
656
|
return true;
|
|
780
657
|
};
|
|
781
658
|
let lastContentTokenIndex = -1;
|
|
782
|
-
for (let i = tokens.length - 1;
|
|
659
|
+
for (let i = tokens.length - 1;i >= 0; i -= 1) {
|
|
783
660
|
if (tokens[i].kind !== "sgr") {
|
|
784
661
|
lastContentTokenIndex = i;
|
|
785
662
|
break;
|
|
@@ -807,7 +684,8 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
807
684
|
let plainCharIndexAtStart = 0;
|
|
808
685
|
let start = 0;
|
|
809
686
|
while (start < tokens.length) {
|
|
810
|
-
if (start > lastContentTokenIndex && rows.length > 0)
|
|
687
|
+
if (start > lastContentTokenIndex && rows.length > 0)
|
|
688
|
+
break;
|
|
811
689
|
const openingStyles = [...activeStyles];
|
|
812
690
|
const openingOsc8 = activeOsc8;
|
|
813
691
|
const isContinuation = rows.length > 0;
|
|
@@ -815,7 +693,8 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
815
693
|
const indentWidth = isContinuation ? visibleWidth(hangingIndent) : 0;
|
|
816
694
|
const maxSegmentWidth = Math.max(1, columns - indentWidth);
|
|
817
695
|
const nextContent = (from) => {
|
|
818
|
-
while (from < tokens.length && tokens[from].kind === "sgr")
|
|
696
|
+
while (from < tokens.length && tokens[from].kind === "sgr")
|
|
697
|
+
from += 1;
|
|
819
698
|
return tokens[from];
|
|
820
699
|
};
|
|
821
700
|
let width = 0;
|
|
@@ -827,11 +706,12 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
827
706
|
end += 1;
|
|
828
707
|
continue;
|
|
829
708
|
}
|
|
830
|
-
if (width + token.width > maxSegmentWidth && width > 0)
|
|
709
|
+
if (width + token.width > maxSegmentWidth && width > 0)
|
|
710
|
+
break;
|
|
831
711
|
width += token.width;
|
|
832
712
|
end += 1;
|
|
833
713
|
if (token.charIndex >= prefixCharCount && (isContinuation || end > listMarkerEndToken)) {
|
|
834
|
-
if (token.value === " " || token.value === "
|
|
714
|
+
if (token.value === " " || token.value === "\t" || CJK_CLOSING_OR_SEP_REGEX.test(token.value) || token.value === "/") {
|
|
835
715
|
lastBreak = end;
|
|
836
716
|
}
|
|
837
717
|
}
|
|
@@ -860,14 +740,15 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
860
740
|
break;
|
|
861
741
|
}
|
|
862
742
|
const preceding = tokens[previous];
|
|
863
|
-
if (previous > minBacktrack && preceding?.kind === "char" && preceding.value !== " " && preceding.value !== "
|
|
743
|
+
if (previous > minBacktrack && preceding?.kind === "char" && preceding.value !== " " && preceding.value !== "\t") {
|
|
864
744
|
segmentEnd = previous;
|
|
865
745
|
}
|
|
866
746
|
}
|
|
867
|
-
if (segmentEnd === start)
|
|
747
|
+
if (segmentEnd === start)
|
|
748
|
+
segmentEnd = start + 1;
|
|
868
749
|
let segment = "";
|
|
869
750
|
let sawStyle = openingStyles.length > 0;
|
|
870
|
-
for (let i = start;
|
|
751
|
+
for (let i = start;i < segmentEnd; i += 1) {
|
|
871
752
|
const token = tokens[i];
|
|
872
753
|
segment += token.value;
|
|
873
754
|
if (token.kind === "sgr") {
|
|
@@ -884,23 +765,25 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
884
765
|
let segSourceStart = lineSourceStart;
|
|
885
766
|
let segSourceEnd = lineSourceStart;
|
|
886
767
|
let foundFirst = false;
|
|
887
|
-
const rowMapping = [];
|
|
768
|
+
const rowMapping = sourceMapping ? [] : undefined;
|
|
888
769
|
let plainCharIndex = plainCharIndexAtStart;
|
|
889
|
-
for (let i = start;
|
|
770
|
+
for (let i = start;i < segmentEnd; i++) {
|
|
890
771
|
const tok = tokens[i];
|
|
891
772
|
if (tok.kind === "char" && tok.charIndex >= prefixCharCount) {
|
|
892
|
-
const mappedOffset = sourceMapping && sourceMapping[plainCharIndex] !==
|
|
773
|
+
const mappedOffset = sourceMapping && sourceMapping[plainCharIndex] !== undefined ? sourceMapping[plainCharIndex] : plainCharIndex;
|
|
893
774
|
if (!foundFirst) {
|
|
894
775
|
segSourceStart = lineSourceStart + mappedOffset;
|
|
895
776
|
foundFirst = true;
|
|
896
777
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
778
|
+
if (rowMapping) {
|
|
779
|
+
for (let c = 0;c < tok.value.length; c++) {
|
|
780
|
+
const idx = plainCharIndex + c;
|
|
781
|
+
const mapped = sourceMapping[idx] !== undefined ? sourceMapping[idx] : idx;
|
|
782
|
+
rowMapping.push(lineSourceStart + mapped);
|
|
783
|
+
}
|
|
901
784
|
}
|
|
902
785
|
const lastCharIdx = plainCharIndex + tok.value.length - 1;
|
|
903
|
-
const mappedEndOffset = sourceMapping && sourceMapping[lastCharIdx] !==
|
|
786
|
+
const mappedEndOffset = sourceMapping && sourceMapping[lastCharIdx] !== undefined ? sourceMapping[lastCharIdx] + 1 : plainCharIndex + tok.value.length;
|
|
904
787
|
segSourceEnd = lineSourceStart + mappedEndOffset;
|
|
905
788
|
plainCharIndex += tok.value.length;
|
|
906
789
|
}
|
|
@@ -911,7 +794,7 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
911
794
|
const token = tokens[start];
|
|
912
795
|
if (token.kind === "char" && token.value === " " && token.charIndex >= prefixCharCount) {
|
|
913
796
|
softWrapJoiner += token.value;
|
|
914
|
-
const mappedOffset = sourceMapping && sourceMapping[plainCharIndex] !==
|
|
797
|
+
const mappedOffset = sourceMapping && sourceMapping[plainCharIndex] !== undefined ? sourceMapping[plainCharIndex] + 1 : plainCharIndex + 1;
|
|
915
798
|
segSourceEnd = lineSourceStart + mappedOffset;
|
|
916
799
|
plainCharIndex += token.value.length;
|
|
917
800
|
start += 1;
|
|
@@ -919,7 +802,7 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
919
802
|
}
|
|
920
803
|
break;
|
|
921
804
|
}
|
|
922
|
-
if (start >= tokens.length && rawLineLength !==
|
|
805
|
+
if (start >= tokens.length && rawLineLength !== undefined) {
|
|
923
806
|
segSourceEnd = lineSourceStart + rawLineLength;
|
|
924
807
|
}
|
|
925
808
|
plainCharIndexAtStart = plainCharIndex;
|
|
@@ -928,7 +811,7 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
928
811
|
sourceStart: segSourceStart,
|
|
929
812
|
sourceEnd: segSourceEnd,
|
|
930
813
|
prefixWidth: currentPrefixWidth,
|
|
931
|
-
sourceMapping: rowMapping.length > 0 ? rowMapping :
|
|
814
|
+
sourceMapping: rowMapping && rowMapping.length > 0 ? rowMapping : undefined,
|
|
932
815
|
softWrapped: start < tokens.length,
|
|
933
816
|
softWrapJoiner
|
|
934
817
|
});
|
|
@@ -942,17 +825,15 @@ function wrapTranscriptLineWithLayout(line, columns, hangingIndent = "", lineSou
|
|
|
942
825
|
}
|
|
943
826
|
];
|
|
944
827
|
}
|
|
945
|
-
function wrapTranscriptLine(line, columns, hangingIndent = "") {
|
|
946
|
-
return wrapTranscriptLineWithLayout(line, columns, hangingIndent).map((r) => r.rendered);
|
|
947
|
-
}
|
|
948
828
|
function buildWindowTitle(title) {
|
|
949
|
-
const plain =
|
|
829
|
+
const plain = stripAnsi(title).replace(/[\x00-\x1f\x7f-\x9f]+/g, " ");
|
|
950
830
|
let truncated = "";
|
|
951
831
|
let width = 0;
|
|
952
832
|
const maxCols = 80;
|
|
953
833
|
for (const char of plain) {
|
|
954
|
-
const charWidth =
|
|
955
|
-
if (width + charWidth > maxCols)
|
|
834
|
+
const charWidth = displayWidth2(char);
|
|
835
|
+
if (width + charWidth > maxCols)
|
|
836
|
+
break;
|
|
956
837
|
truncated += char;
|
|
957
838
|
width += charWidth;
|
|
958
839
|
}
|
|
@@ -960,7 +841,8 @@ function buildWindowTitle(title) {
|
|
|
960
841
|
}
|
|
961
842
|
function wrapTextToLines(text, columns) {
|
|
962
843
|
const result = [];
|
|
963
|
-
for (const logicalLine of text.split(
|
|
844
|
+
for (const logicalLine of text.split(`
|
|
845
|
+
`)) {
|
|
964
846
|
if (logicalLine === "") {
|
|
965
847
|
result.push("");
|
|
966
848
|
continue;
|
|
@@ -974,34 +856,30 @@ function wrapTextToLines(text, columns) {
|
|
|
974
856
|
}
|
|
975
857
|
return result;
|
|
976
858
|
}
|
|
977
|
-
|
|
978
859
|
// packages/cli/oauth/flows/openai-codex.ts
|
|
979
860
|
import { createHash as createHash2 } from "node:crypto";
|
|
980
861
|
|
|
981
862
|
// packages/agent-runtime/oauthRefreshError.ts
|
|
982
|
-
var PERMANENT_REFRESH_CODES =
|
|
863
|
+
var PERMANENT_REFRESH_CODES = new Set([
|
|
983
864
|
"invalid_grant",
|
|
984
|
-
// OpenAI 令牌端点对失效/不存在的 refresh token 返回 401
|
|
985
|
-
// {"error":{"code":"invalid_refresh_token",...}}(2026-10-01 用必然无效的
|
|
986
|
-
// token 实测)。线上 chatgpt 凭据正是因为没认出它,被当成临时的
|
|
987
|
-
// "unauthorized"、每 15 分钟重试一次且永远不提示重新授权。
|
|
988
865
|
"invalid_refresh_token",
|
|
989
866
|
"refresh_token_reused",
|
|
990
867
|
"invalid_client"
|
|
991
868
|
]);
|
|
992
869
|
var SAFE_MESSAGES = {
|
|
993
|
-
invalid_grant: "refresh token
|
|
994
|
-
invalid_refresh_token: "refresh token
|
|
995
|
-
refresh_token_reused: "refresh token
|
|
996
|
-
invalid_client: "OAuth
|
|
997
|
-
unauthorized: "
|
|
998
|
-
rate_limited: "
|
|
999
|
-
http_5xx: "
|
|
1000
|
-
network: "
|
|
1001
|
-
bad_response: "
|
|
1002
|
-
unknown: "
|
|
870
|
+
invalid_grant: "refresh token 已失效,请重新授权",
|
|
871
|
+
invalid_refresh_token: "refresh token 已失效,请重新授权",
|
|
872
|
+
refresh_token_reused: "refresh token 已被其他副本使用,请重新授权",
|
|
873
|
+
invalid_client: "OAuth 客户端被拒绝,请重新授权",
|
|
874
|
+
unauthorized: "上游拒绝了刷新请求(401/403)",
|
|
875
|
+
rate_limited: "上游限流,稍后重试",
|
|
876
|
+
http_5xx: "上游服务暂时不可用",
|
|
877
|
+
network: "无法连接上游",
|
|
878
|
+
bad_response: "上游返回了无法识别的响应",
|
|
879
|
+
unknown: "刷新失败"
|
|
1003
880
|
};
|
|
1004
|
-
|
|
881
|
+
|
|
882
|
+
class OAuthRefreshError extends Error {
|
|
1005
883
|
code;
|
|
1006
884
|
status;
|
|
1007
885
|
retryAfterMs;
|
|
@@ -1009,45 +887,54 @@ var OAuthRefreshError = class extends Error {
|
|
|
1009
887
|
super(SAFE_MESSAGES[code]);
|
|
1010
888
|
this.name = "OAuthRefreshError";
|
|
1011
889
|
this.code = code;
|
|
1012
|
-
if (opts.status !==
|
|
1013
|
-
|
|
890
|
+
if (opts.status !== undefined)
|
|
891
|
+
this.status = opts.status;
|
|
892
|
+
if (opts.retryAfterMs !== undefined)
|
|
893
|
+
this.retryAfterMs = opts.retryAfterMs;
|
|
1014
894
|
}
|
|
1015
895
|
get permanent() {
|
|
1016
896
|
return PERMANENT_REFRESH_CODES.has(this.code);
|
|
1017
897
|
}
|
|
1018
|
-
}
|
|
898
|
+
}
|
|
1019
899
|
function readErrorCode(payload) {
|
|
1020
|
-
if (!payload || typeof payload !== "object")
|
|
900
|
+
if (!payload || typeof payload !== "object")
|
|
901
|
+
return;
|
|
1021
902
|
const err = payload.error;
|
|
1022
|
-
if (typeof err === "string")
|
|
903
|
+
if (typeof err === "string")
|
|
904
|
+
return err;
|
|
1023
905
|
if (err && typeof err === "object") {
|
|
1024
906
|
const code = err.code;
|
|
1025
|
-
if (typeof code === "string")
|
|
907
|
+
if (typeof code === "string")
|
|
908
|
+
return code;
|
|
1026
909
|
}
|
|
1027
|
-
return
|
|
910
|
+
return;
|
|
1028
911
|
}
|
|
1029
912
|
function classifyOAuthRefreshHttpFailure(status, payload, headers) {
|
|
1030
913
|
const raw = readErrorCode(payload)?.toLowerCase();
|
|
1031
|
-
if (raw === "invalid_grant")
|
|
914
|
+
if (raw === "invalid_grant")
|
|
915
|
+
return new OAuthRefreshError("invalid_grant", { status });
|
|
1032
916
|
if (raw === "invalid_refresh_token") {
|
|
1033
917
|
return new OAuthRefreshError("invalid_refresh_token", { status });
|
|
1034
918
|
}
|
|
1035
919
|
if (raw === "refresh_token_reused") {
|
|
1036
920
|
return new OAuthRefreshError("refresh_token_reused", { status });
|
|
1037
921
|
}
|
|
1038
|
-
if (raw === "invalid_client")
|
|
922
|
+
if (raw === "invalid_client")
|
|
923
|
+
return new OAuthRefreshError("invalid_client", { status });
|
|
1039
924
|
if (status === 429) {
|
|
1040
925
|
const seconds = Number(headers?.get("retry-after"));
|
|
1041
926
|
return new OAuthRefreshError("rate_limited", {
|
|
1042
927
|
status,
|
|
1043
|
-
...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds *
|
|
928
|
+
...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1000 } : {}
|
|
1044
929
|
});
|
|
1045
930
|
}
|
|
1046
|
-
if (status === 401 || status === 403)
|
|
1047
|
-
|
|
931
|
+
if (status === 401 || status === 403)
|
|
932
|
+
return new OAuthRefreshError("unauthorized", { status });
|
|
933
|
+
if (status >= 500)
|
|
934
|
+
return new OAuthRefreshError("http_5xx", { status });
|
|
1048
935
|
return new OAuthRefreshError("unknown", { status });
|
|
1049
936
|
}
|
|
1050
|
-
var TRANSIENT_MAX_MS = 15 *
|
|
937
|
+
var TRANSIENT_MAX_MS = 15 * 60000;
|
|
1051
938
|
|
|
1052
939
|
// packages/agent-runtime/openaiCodexOAuth.ts
|
|
1053
940
|
var OPENAI_CODEX_CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
|
|
@@ -1069,18 +956,18 @@ var OPENAI_CODEX_ORIGINATOR = "codex_cli_rs";
|
|
|
1069
956
|
var OPENAI_CODEX_CALLBACK_PORT = 1455;
|
|
1070
957
|
var OPENAI_CODEX_CALLBACK_PATH = "/auth/callback";
|
|
1071
958
|
var OPENAI_CODEX_CALLBACK_URL = `http://localhost:${OPENAI_CODEX_CALLBACK_PORT}${OPENAI_CODEX_CALLBACK_PATH}`;
|
|
1072
|
-
var OPENAI_CODEX_ACCESS_TOKEN_CLIENT_SKEW_MS = 5 * 60 *
|
|
1073
|
-
var OPENAI_CODEX_TOKEN_REQUEST_TIMEOUT_MS =
|
|
959
|
+
var OPENAI_CODEX_ACCESS_TOKEN_CLIENT_SKEW_MS = 5 * 60 * 1000;
|
|
960
|
+
var OPENAI_CODEX_TOKEN_REQUEST_TIMEOUT_MS = 30000;
|
|
1074
961
|
function decodeOpenAiIdToken(idToken) {
|
|
1075
|
-
if (!idToken || typeof idToken !== "string")
|
|
962
|
+
if (!idToken || typeof idToken !== "string")
|
|
963
|
+
return {};
|
|
1076
964
|
const parts = idToken.split(".");
|
|
1077
|
-
if (parts.length < 2)
|
|
965
|
+
if (parts.length < 2)
|
|
966
|
+
return {};
|
|
1078
967
|
try {
|
|
1079
|
-
const payload = JSON.parse(
|
|
1080
|
-
Buffer.from(parts[1], "base64url").toString("utf-8")
|
|
1081
|
-
);
|
|
968
|
+
const payload = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf-8"));
|
|
1082
969
|
const authClaim = payload["https://api.openai.com/auth"];
|
|
1083
|
-
const nestedAccountId = authClaim && typeof authClaim === "object" ? authClaim.chatgpt_account_id :
|
|
970
|
+
const nestedAccountId = authClaim && typeof authClaim === "object" ? authClaim.chatgpt_account_id : undefined;
|
|
1084
971
|
const accountId = nestedAccountId ?? payload["chatgpt_account_id"] ?? payload["account_id"];
|
|
1085
972
|
const email = payload["email"];
|
|
1086
973
|
return {
|
|
@@ -1099,8 +986,8 @@ function normalizeOpenAiCodexTokenPayload(args) {
|
|
|
1099
986
|
const accessToken = payload.access_token.trim();
|
|
1100
987
|
const expiresIn = asOptionalFiniteNumber(payload.expires_in);
|
|
1101
988
|
const clientSkewMs = args.clientSkewMs ?? OPENAI_CODEX_ACCESS_TOKEN_CLIENT_SKEW_MS;
|
|
1102
|
-
const expiresAt = expiresIn !==
|
|
1103
|
-
const idTokenStr = typeof payload.id_token === "string" && payload.id_token.trim() ? payload.id_token.trim() :
|
|
989
|
+
const expiresAt = expiresIn !== undefined ? now + expiresIn * 1000 - clientSkewMs : baseCredential?.expiresAt;
|
|
990
|
+
const idTokenStr = typeof payload.id_token === "string" && payload.id_token.trim() ? payload.id_token.trim() : undefined;
|
|
1104
991
|
const fromAccess = decodeOpenAiIdToken(accessToken);
|
|
1105
992
|
const fromId = idTokenStr ? decodeOpenAiIdToken(idTokenStr) : {};
|
|
1106
993
|
const accountId = fromAccess.accountId ?? fromId.accountId ?? baseCredential?.accountId;
|
|
@@ -1116,14 +1003,14 @@ function normalizeOpenAiCodexTokenPayload(args) {
|
|
|
1116
1003
|
provider: "chatgpt",
|
|
1117
1004
|
accessToken,
|
|
1118
1005
|
...refreshToken ? { refreshToken } : {},
|
|
1119
|
-
...expiresAt !==
|
|
1006
|
+
...expiresAt !== undefined ? { expiresAt } : {},
|
|
1120
1007
|
obtainedAt: now,
|
|
1121
1008
|
...scope ? { scope } : {},
|
|
1122
1009
|
...accountId ? { accountId } : {},
|
|
1123
1010
|
...Object.keys(metadata).length > 0 ? { metadata } : {}
|
|
1124
1011
|
};
|
|
1125
1012
|
}
|
|
1126
|
-
async function
|
|
1013
|
+
async function refreshOpenAiCodexToken2(credential, deps = {}) {
|
|
1127
1014
|
if (!credential.refreshToken) {
|
|
1128
1015
|
throw new Error("Cannot refresh OpenAI Codex token without a refresh token.");
|
|
1129
1016
|
}
|
|
@@ -1164,10 +1051,11 @@ async function refreshOpenAiCodexToken(credential, deps = {}) {
|
|
|
1164
1051
|
|
|
1165
1052
|
// packages/cli/oauth/callback-server.ts
|
|
1166
1053
|
import { createServer } from "node:http";
|
|
1167
|
-
var DEFAULT_CALLBACK_TIMEOUT_MS = 5 * 60 *
|
|
1054
|
+
var DEFAULT_CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
1168
1055
|
function parseQuery(url) {
|
|
1169
1056
|
const questionIndex = url.indexOf("?");
|
|
1170
|
-
if (questionIndex < 0)
|
|
1057
|
+
if (questionIndex < 0)
|
|
1058
|
+
return {};
|
|
1171
1059
|
const search = url.slice(questionIndex + 1);
|
|
1172
1060
|
const params = new URLSearchParams(search);
|
|
1173
1061
|
const result = {};
|
|
@@ -1198,9 +1086,10 @@ function startCallbackServerOnPort(options) {
|
|
|
1198
1086
|
resultReject = rej;
|
|
1199
1087
|
});
|
|
1200
1088
|
const timeoutTimer = setTimeout(() => {
|
|
1201
|
-
if (settled)
|
|
1089
|
+
if (settled)
|
|
1090
|
+
return;
|
|
1202
1091
|
settled = true;
|
|
1203
|
-
const err = new Error(`OAuth callback timed out after ${Math.round(timeoutMs /
|
|
1092
|
+
const err = new Error(`OAuth callback timed out after ${Math.round(timeoutMs / 1000)}s`);
|
|
1204
1093
|
server.close();
|
|
1205
1094
|
resultReject?.(err);
|
|
1206
1095
|
}, Math.max(0, deadline - now()));
|
|
@@ -1228,7 +1117,8 @@ function startCallbackServerOnPort(options) {
|
|
|
1228
1117
|
}
|
|
1229
1118
|
});
|
|
1230
1119
|
server.on("error", (err) => {
|
|
1231
|
-
if (settled)
|
|
1120
|
+
if (settled)
|
|
1121
|
+
return;
|
|
1232
1122
|
settled = true;
|
|
1233
1123
|
clearTimeout(timeoutTimer);
|
|
1234
1124
|
server.close();
|
|
@@ -1302,9 +1192,7 @@ function renderDeviceCodeDisplay(args) {
|
|
|
1302
1192
|
return [
|
|
1303
1193
|
`Authorize nolo-cli for ${provider} (device code / headless):`,
|
|
1304
1194
|
top,
|
|
1305
|
-
...rows.map(
|
|
1306
|
-
(row) => `${g.v}${row.rendered}${" ".repeat(innerWidth - row.plain.length)}${g.v}`
|
|
1307
|
-
),
|
|
1195
|
+
...rows.map((row) => `${g.v}${row.rendered}${" ".repeat(innerWidth - row.plain.length)}${g.v}`),
|
|
1308
1196
|
bottom,
|
|
1309
1197
|
...notes
|
|
1310
1198
|
];
|
|
@@ -1333,8 +1221,8 @@ function generatePkcePair(length = PKCE_VERIFIER_LENGTH) {
|
|
|
1333
1221
|
|
|
1334
1222
|
// packages/cli/oauth/flows/openai-codex.ts
|
|
1335
1223
|
var AUTHORIZATION_CODE_GRANT_TYPE = "authorization_code";
|
|
1336
|
-
var DEVICE_CODE_DEFAULT_INTERVAL_MS =
|
|
1337
|
-
var DEVICE_POLL_SAFETY_MARGIN_MS =
|
|
1224
|
+
var DEVICE_CODE_DEFAULT_INTERVAL_MS = 5000;
|
|
1225
|
+
var DEVICE_POLL_SAFETY_MARGIN_MS = 3000;
|
|
1338
1226
|
var DEVICE_MAX_POLLS = 120;
|
|
1339
1227
|
async function postJson(fetchImpl, url, body, deps) {
|
|
1340
1228
|
const response = await fetchImpl(url, {
|
|
@@ -1372,17 +1260,10 @@ function scopeString() {
|
|
|
1372
1260
|
}
|
|
1373
1261
|
async function startDeviceCodeFlow(deps) {
|
|
1374
1262
|
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
1375
|
-
const response = await postJson(
|
|
1376
|
-
fetchImpl,
|
|
1377
|
-
OPENAI_CODEX_DEVICE_AUTH_URL,
|
|
1378
|
-
{ client_id: OPENAI_CODEX_CLIENT_ID },
|
|
1379
|
-
deps
|
|
1380
|
-
);
|
|
1263
|
+
const response = await postJson(fetchImpl, OPENAI_CODEX_DEVICE_AUTH_URL, { client_id: OPENAI_CODEX_CLIENT_ID }, deps);
|
|
1381
1264
|
if (!response.ok) {
|
|
1382
|
-
const
|
|
1383
|
-
throw new Error(
|
|
1384
|
-
`OpenAI device-code start failed (HTTP ${response.status}): ${JSON.stringify(data2)}`
|
|
1385
|
-
);
|
|
1265
|
+
const data = await parseJsonResponse(response);
|
|
1266
|
+
throw new Error(`OpenAI device-code start failed (HTTP ${response.status}): ${JSON.stringify(data)}`);
|
|
1386
1267
|
}
|
|
1387
1268
|
const data = await parseJsonResponse(response);
|
|
1388
1269
|
const deviceAuthId = data["device_auth_id"];
|
|
@@ -1398,7 +1279,7 @@ async function startDeviceCodeFlow(deps) {
|
|
|
1398
1279
|
return {
|
|
1399
1280
|
deviceAuthId,
|
|
1400
1281
|
userCode,
|
|
1401
|
-
intervalMs: Math.max(1, intervalSec) *
|
|
1282
|
+
intervalMs: Math.max(1, intervalSec) * 1000 + DEVICE_POLL_SAFETY_MARGIN_MS
|
|
1402
1283
|
};
|
|
1403
1284
|
}
|
|
1404
1285
|
async function pollDeviceCodeToken(args) {
|
|
@@ -1406,23 +1287,16 @@ async function pollDeviceCodeToken(args) {
|
|
|
1406
1287
|
const sleep = args.sleep ?? args.deps?.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
1407
1288
|
const intervalMs = args.intervalMs ?? DEVICE_CODE_DEFAULT_INTERVAL_MS;
|
|
1408
1289
|
const maxPolls = args.maxPolls ?? DEVICE_MAX_POLLS;
|
|
1409
|
-
for (let poll = 0;
|
|
1290
|
+
for (let poll = 0;poll < maxPolls; poll++) {
|
|
1410
1291
|
await sleep(poll === 0 ? Math.min(intervalMs, DEVICE_CODE_DEFAULT_INTERVAL_MS) : intervalMs);
|
|
1411
|
-
const response = await postJson(
|
|
1412
|
-
fetchImpl,
|
|
1413
|
-
OPENAI_CODEX_DEVICE_TOKEN_URL,
|
|
1414
|
-
{ device_auth_id: args.deviceAuthId, user_code: args.userCode },
|
|
1415
|
-
args.deps
|
|
1416
|
-
);
|
|
1292
|
+
const response = await postJson(fetchImpl, OPENAI_CODEX_DEVICE_TOKEN_URL, { device_auth_id: args.deviceAuthId, user_code: args.userCode }, args.deps);
|
|
1417
1293
|
if (response.status === 403 || response.status === 404) {
|
|
1418
1294
|
args.onPending?.();
|
|
1419
1295
|
continue;
|
|
1420
1296
|
}
|
|
1421
1297
|
const data = await parseJsonResponse(response);
|
|
1422
1298
|
if (!response.ok) {
|
|
1423
|
-
throw new Error(
|
|
1424
|
-
`OpenAI device-code poll failed (HTTP ${response.status}): ${JSON.stringify(data)}`
|
|
1425
|
-
);
|
|
1299
|
+
throw new Error(`OpenAI device-code poll failed (HTTP ${response.status}): ${JSON.stringify(data)}`);
|
|
1426
1300
|
}
|
|
1427
1301
|
const authorizationCode = data["authorization_code"];
|
|
1428
1302
|
const codeVerifier = data["code_verifier"];
|
|
@@ -1449,7 +1323,8 @@ async function runOpenAiCodexDeviceCode(deps = {}) {
|
|
|
1449
1323
|
}
|
|
1450
1324
|
if (deps.openBrowser) {
|
|
1451
1325
|
const opened = await deps.openBrowser(OPENAI_CODEX_DEVICE_VERIFICATION_URL);
|
|
1452
|
-
if (!opened)
|
|
1326
|
+
if (!opened)
|
|
1327
|
+
deps.output?.log?.("Could not open a browser automatically. Open the URL above.");
|
|
1453
1328
|
} else {
|
|
1454
1329
|
deps.output?.log?.("Open the URL above in a browser and enter the code to approve.");
|
|
1455
1330
|
}
|
|
@@ -1470,32 +1345,23 @@ async function runOpenAiCodexDeviceCode(deps = {}) {
|
|
|
1470
1345
|
deps,
|
|
1471
1346
|
now
|
|
1472
1347
|
});
|
|
1473
|
-
|
|
1474
|
-
deps.output?.log?.(
|
|
1475
|
-
`Saved ChatGPT OAuth credential (account=${credential.accountId ?? "unknown"}).`
|
|
1476
|
-
);
|
|
1348
|
+
writeOAuthCredential2("chatgpt", credential);
|
|
1349
|
+
deps.output?.log?.(`Saved ChatGPT OAuth credential (account=${credential.accountId ?? "unknown"}).`);
|
|
1477
1350
|
return credential;
|
|
1478
1351
|
}
|
|
1479
1352
|
async function exchangeCodexAuthorizationCode(args) {
|
|
1480
1353
|
const fetchImpl = args.deps?.fetchImpl ?? fetch;
|
|
1481
1354
|
const now = (args.now ?? Date.now)();
|
|
1482
|
-
const response = await postForm(
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
client_id: OPENAI_CODEX_CLIENT_ID,
|
|
1490
|
-
code_verifier: args.codeVerifier
|
|
1491
|
-
},
|
|
1492
|
-
args.deps
|
|
1493
|
-
);
|
|
1355
|
+
const response = await postForm(fetchImpl, OPENAI_CODEX_TOKEN_URL, {
|
|
1356
|
+
grant_type: AUTHORIZATION_CODE_GRANT_TYPE,
|
|
1357
|
+
code: args.code,
|
|
1358
|
+
redirect_uri: args.redirectUri,
|
|
1359
|
+
client_id: OPENAI_CODEX_CLIENT_ID,
|
|
1360
|
+
code_verifier: args.codeVerifier
|
|
1361
|
+
}, args.deps);
|
|
1494
1362
|
const data = await parseJsonResponse(response);
|
|
1495
1363
|
if (!response.ok) {
|
|
1496
|
-
throw new Error(
|
|
1497
|
-
`OpenAI authorization-code exchange failed (HTTP ${response.status}): ${JSON.stringify(data)}`
|
|
1498
|
-
);
|
|
1364
|
+
throw new Error(`OpenAI authorization-code exchange failed (HTTP ${response.status}): ${JSON.stringify(data)}`);
|
|
1499
1365
|
}
|
|
1500
1366
|
return normalizeOpenAiCodexTokenPayload({
|
|
1501
1367
|
payload: data,
|
|
@@ -1536,7 +1402,8 @@ async function runOpenAiCodexBrowserPkce(deps = {}) {
|
|
|
1536
1402
|
deps.output?.log?.(authorizeUrlString);
|
|
1537
1403
|
if (deps.openBrowser) {
|
|
1538
1404
|
const opened = await deps.openBrowser(authorizeUrlString);
|
|
1539
|
-
if (!opened)
|
|
1405
|
+
if (!opened)
|
|
1406
|
+
deps.output?.log?.("Could not open a browser automatically. Open the URL above.");
|
|
1540
1407
|
}
|
|
1541
1408
|
const result = await callback.waitForCode();
|
|
1542
1409
|
if (result.state && result.state !== state) {
|
|
@@ -1549,47 +1416,20 @@ async function runOpenAiCodexBrowserPkce(deps = {}) {
|
|
|
1549
1416
|
deps,
|
|
1550
1417
|
now
|
|
1551
1418
|
});
|
|
1552
|
-
|
|
1553
|
-
deps.output?.log?.(
|
|
1554
|
-
`Saved ChatGPT OAuth credential (account=${credential.accountId ?? "unknown"}).`
|
|
1555
|
-
);
|
|
1419
|
+
writeOAuthCredential2("chatgpt", credential);
|
|
1420
|
+
deps.output?.log?.(`Saved ChatGPT OAuth credential (account=${credential.accountId ?? "unknown"}).`);
|
|
1556
1421
|
return credential;
|
|
1557
1422
|
} finally {
|
|
1558
|
-
await callback.close().catch(() => {
|
|
1559
|
-
});
|
|
1423
|
+
await callback.close().catch(() => {});
|
|
1560
1424
|
}
|
|
1561
1425
|
}
|
|
1562
|
-
var
|
|
1563
|
-
return
|
|
1426
|
+
var refreshOpenAiCodexToken = async (credential, deps = {}) => {
|
|
1427
|
+
return refreshOpenAiCodexToken2(credential, {
|
|
1564
1428
|
fetchImpl: deps.fetchImpl,
|
|
1565
1429
|
now: deps.now
|
|
1566
1430
|
});
|
|
1567
1431
|
};
|
|
1568
1432
|
|
|
1569
|
-
// packages/cli/oauth/serverSyncConfig.ts
|
|
1570
|
-
function resolveServerSyncConfig() {
|
|
1571
|
-
const envServer = process.env.NOLO_SERVER?.trim() || process.env.NOLO_SERVER_URL?.trim() || process.env.BASE_URL?.trim() || "";
|
|
1572
|
-
const envToken = process.env.AUTH_TOKEN?.trim() || process.env.NOLO_AUTH_TOKEN?.trim() || "";
|
|
1573
|
-
if (envServer && envToken) {
|
|
1574
|
-
return { serverOrigin: envServer.replace(/\/+$/, ""), authToken: envToken };
|
|
1575
|
-
}
|
|
1576
|
-
let profileServer = "";
|
|
1577
|
-
let profileToken = "";
|
|
1578
|
-
try {
|
|
1579
|
-
const config = loadProfileConfig();
|
|
1580
|
-
const profileEnv = buildEnvFromProfile(config);
|
|
1581
|
-
profileServer = profileEnv.NOLO_SERVER?.trim() || "";
|
|
1582
|
-
profileToken = profileEnv.AUTH_TOKEN?.trim() || "";
|
|
1583
|
-
} catch {
|
|
1584
|
-
}
|
|
1585
|
-
const serverOrigin = (envServer || profileServer).replace(/\/+$/, "");
|
|
1586
|
-
const authToken = envToken || profileToken;
|
|
1587
|
-
if (serverOrigin && authToken) {
|
|
1588
|
-
return { serverOrigin, authToken };
|
|
1589
|
-
}
|
|
1590
|
-
return null;
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
1433
|
// packages/agent-runtime/xaiOAuth.ts
|
|
1594
1434
|
var XAI_OAUTH_ISSUER = "https://auth.x.ai";
|
|
1595
1435
|
var XAI_OAUTH_DISCOVERY_URL = `${XAI_OAUTH_ISSUER}/.well-known/openid-configuration`;
|
|
@@ -1601,13 +1441,13 @@ var XAI_OAUTH_REDIRECT_PATH = "/callback";
|
|
|
1601
1441
|
var XAI_OAUTH_REDIRECT_URI = `http://${XAI_OAUTH_REDIRECT_HOST}:${XAI_OAUTH_REDIRECT_PORT}${XAI_OAUTH_REDIRECT_PATH}`;
|
|
1602
1442
|
var XAI_OAUTH_DOCS_URL = "https://hermes-agent.nousresearch.com/docs/guides/xai-grok-oauth";
|
|
1603
1443
|
var XAI_DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
1604
|
-
var XAI_DEVICE_CODE_DEFAULT_INTERVAL_MS =
|
|
1605
|
-
var XAI_DEVICE_CODE_MIN_INTERVAL_MS =
|
|
1606
|
-
var XAI_DEVICE_CODE_SLOW_DOWN_INCREMENT_MS =
|
|
1607
|
-
var XAI_DEVICE_CODE_DEFAULT_EXPIRES_MS = 5 *
|
|
1608
|
-
var XAI_ACCESS_TOKEN_CLIENT_SKEW_MS = 5 * 60 *
|
|
1609
|
-
var XAI_DISCOVERY_TIMEOUT_MS =
|
|
1610
|
-
var XAI_TOKEN_REQUEST_TIMEOUT_MS =
|
|
1444
|
+
var XAI_DEVICE_CODE_DEFAULT_INTERVAL_MS = 5000;
|
|
1445
|
+
var XAI_DEVICE_CODE_MIN_INTERVAL_MS = 1000;
|
|
1446
|
+
var XAI_DEVICE_CODE_SLOW_DOWN_INCREMENT_MS = 5000;
|
|
1447
|
+
var XAI_DEVICE_CODE_DEFAULT_EXPIRES_MS = 5 * 60000;
|
|
1448
|
+
var XAI_ACCESS_TOKEN_CLIENT_SKEW_MS = 5 * 60 * 1000;
|
|
1449
|
+
var XAI_DISCOVERY_TIMEOUT_MS = 15000;
|
|
1450
|
+
var XAI_TOKEN_REQUEST_TIMEOUT_MS = 20000;
|
|
1611
1451
|
function validateXAIEndpoint(url, field) {
|
|
1612
1452
|
let parsed;
|
|
1613
1453
|
try {
|
|
@@ -1626,18 +1466,14 @@ function validateXAIEndpoint(url, field) {
|
|
|
1626
1466
|
}
|
|
1627
1467
|
function isLikelyHtmlOrCloudflareChallenge(response, bodyText) {
|
|
1628
1468
|
const contentType = response.headers.get("content-type") ?? "";
|
|
1629
|
-
return response.headers.get("cf-mitigated") === "challenge" || /text\/html/i.test(contentType) || /<!doctype html|<html\b/i.test(bodyText) || /\b(?:cloudflare|attention required|just a moment|enable javascript and cookies|challenge-platform)\b/i.test(
|
|
1630
|
-
bodyText
|
|
1631
|
-
);
|
|
1469
|
+
return response.headers.get("cf-mitigated") === "challenge" || /text\/html/i.test(contentType) || /<!doctype html|<html\b/i.test(bodyText) || /\b(?:cloudflare|attention required|just a moment|enable javascript and cookies|challenge-platform)\b/i.test(bodyText);
|
|
1632
1470
|
}
|
|
1633
1471
|
async function readJsonBody(response, context) {
|
|
1634
1472
|
let text = "";
|
|
1635
1473
|
try {
|
|
1636
1474
|
text = await response.text();
|
|
1637
1475
|
} catch (error) {
|
|
1638
|
-
throw new Error(
|
|
1639
|
-
`${context}: failed to read response body: ${toErrorMessage(error)}`
|
|
1640
|
-
);
|
|
1476
|
+
throw new Error(`${context}: failed to read response body: ${toErrorMessage(error)}`);
|
|
1641
1477
|
}
|
|
1642
1478
|
if (!text.trim()) {
|
|
1643
1479
|
if (!response.ok) {
|
|
@@ -1656,13 +1492,9 @@ async function readJsonBody(response, context) {
|
|
|
1656
1492
|
throw error;
|
|
1657
1493
|
}
|
|
1658
1494
|
if (isLikelyHtmlOrCloudflareChallenge(response, text)) {
|
|
1659
|
-
throw new Error(
|
|
1660
|
-
`${context} failed (${response.status}): xAI returned an HTML/Cloudflare challenge instead of OAuth JSON`
|
|
1661
|
-
);
|
|
1495
|
+
throw new Error(`${context} failed (${response.status}): xAI returned an HTML/Cloudflare challenge instead of OAuth JSON`);
|
|
1662
1496
|
}
|
|
1663
|
-
throw new Error(
|
|
1664
|
-
`${context} returned invalid JSON: ${toErrorMessage(error)}`
|
|
1665
|
-
);
|
|
1497
|
+
throw new Error(`${context} returned invalid JSON: ${toErrorMessage(error)}`);
|
|
1666
1498
|
}
|
|
1667
1499
|
}
|
|
1668
1500
|
async function xaiOAuthDiscovery(fetchImpl = fetch, options = {}) {
|
|
@@ -1675,18 +1507,11 @@ async function xaiOAuthDiscovery(fetchImpl = fetch, options = {}) {
|
|
|
1675
1507
|
signal: AbortSignal.timeout(timeoutMs)
|
|
1676
1508
|
});
|
|
1677
1509
|
} catch (error) {
|
|
1678
|
-
throw new Error(
|
|
1679
|
-
`xAI OIDC discovery failed: ${toErrorMessage(error)}`
|
|
1680
|
-
);
|
|
1510
|
+
throw new Error(`xAI OIDC discovery failed: ${toErrorMessage(error)}`);
|
|
1681
1511
|
}
|
|
1682
1512
|
if (response.status !== 200) {
|
|
1683
|
-
if (isLikelyHtmlOrCloudflareChallenge(
|
|
1684
|
-
response
|
|
1685
|
-
await response.clone().text().catch(() => "")
|
|
1686
|
-
)) {
|
|
1687
|
-
throw new Error(
|
|
1688
|
-
`xAI OIDC discovery failed (${response.status}): xAI returned an HTML/Cloudflare challenge instead of OAuth JSON`
|
|
1689
|
-
);
|
|
1513
|
+
if (isLikelyHtmlOrCloudflareChallenge(response, await response.clone().text().catch(() => ""))) {
|
|
1514
|
+
throw new Error(`xAI OIDC discovery failed (${response.status}): xAI returned an HTML/Cloudflare challenge instead of OAuth JSON`);
|
|
1690
1515
|
}
|
|
1691
1516
|
throw new Error(`xAI OIDC discovery returned status ${response.status}.`);
|
|
1692
1517
|
}
|
|
@@ -1698,14 +1523,10 @@ async function xaiOAuthDiscovery(fetchImpl = fetch, options = {}) {
|
|
|
1698
1523
|
}
|
|
1699
1524
|
validateXAIEndpoint(authorizationEndpoint, "authorization_endpoint");
|
|
1700
1525
|
validateXAIEndpoint(tokenEndpoint, "token_endpoint");
|
|
1701
|
-
const deviceAuthorizationEndpoint = asTrimmedString(
|
|
1702
|
-
obj.device_authorization_endpoint
|
|
1703
|
-
);
|
|
1526
|
+
const deviceAuthorizationEndpoint = asTrimmedString(obj.device_authorization_endpoint);
|
|
1704
1527
|
if (options.requireDeviceAuthorization) {
|
|
1705
1528
|
if (!deviceAuthorizationEndpoint) {
|
|
1706
|
-
throw new Error(
|
|
1707
|
-
"xAI OIDC discovery response was missing device_authorization_endpoint."
|
|
1708
|
-
);
|
|
1529
|
+
throw new Error("xAI OIDC discovery response was missing device_authorization_endpoint.");
|
|
1709
1530
|
}
|
|
1710
1531
|
validateXAIEndpoint(deviceAuthorizationEndpoint, "device_authorization_endpoint");
|
|
1711
1532
|
} else if (deviceAuthorizationEndpoint) {
|
|
@@ -1729,12 +1550,12 @@ function normalizeXaiTokenPayload(args) {
|
|
|
1729
1550
|
if (!accessToken) {
|
|
1730
1551
|
throw new Error(`${context} missing access_token`);
|
|
1731
1552
|
}
|
|
1732
|
-
const rawRefreshToken = typeof payload.refresh_token === "string" && payload.refresh_token.trim() ? payload.refresh_token.trim() :
|
|
1553
|
+
const rawRefreshToken = typeof payload.refresh_token === "string" && payload.refresh_token.trim() ? payload.refresh_token.trim() : undefined;
|
|
1733
1554
|
if (requireRefreshToken && !rawRefreshToken) {
|
|
1734
1555
|
throw new Error(`${context} missing refresh_token`);
|
|
1735
1556
|
}
|
|
1736
1557
|
const expiresIn = asOptionalFiniteNumber(payload.expires_in);
|
|
1737
|
-
if (expiresIn ===
|
|
1558
|
+
if (expiresIn === undefined) {
|
|
1738
1559
|
throw new Error(`${context} missing expires_in`);
|
|
1739
1560
|
}
|
|
1740
1561
|
const refreshToken = rawRefreshToken ?? baseCredential?.refreshToken;
|
|
@@ -1746,7 +1567,7 @@ function normalizeXaiTokenPayload(args) {
|
|
|
1746
1567
|
provider: "xai",
|
|
1747
1568
|
accessToken,
|
|
1748
1569
|
...refreshToken ? { refreshToken } : {},
|
|
1749
|
-
expiresAt: now + expiresIn *
|
|
1570
|
+
expiresAt: now + expiresIn * 1000 - XAI_ACCESS_TOKEN_CLIENT_SKEW_MS,
|
|
1750
1571
|
...scope ? { scope } : {},
|
|
1751
1572
|
...idToken ? { idToken } : {},
|
|
1752
1573
|
...accountId ? { accountId } : {},
|
|
@@ -1777,16 +1598,12 @@ async function refreshXaiToken(credential, deps = {}) {
|
|
|
1777
1598
|
signal: AbortSignal.timeout(XAI_TOKEN_REQUEST_TIMEOUT_MS)
|
|
1778
1599
|
});
|
|
1779
1600
|
} catch (error) {
|
|
1780
|
-
throw new Error(
|
|
1781
|
-
`xAI token refresh failed: ${toErrorMessage(error)}`
|
|
1782
|
-
);
|
|
1601
|
+
throw new Error(`xAI token refresh failed: ${toErrorMessage(error)}`);
|
|
1783
1602
|
}
|
|
1784
1603
|
const data = await readJsonBody(response, "xAI token refresh");
|
|
1785
1604
|
if (!response.ok) {
|
|
1786
1605
|
const detail = typeof data.error_description === "string" && data.error_description || typeof data.error === "string" && data.error || "";
|
|
1787
|
-
throw new Error(
|
|
1788
|
-
`xAI token refresh failed: ${response.status}${detail ? ` ${detail}` : ""}`
|
|
1789
|
-
);
|
|
1606
|
+
throw new Error(`xAI token refresh failed: ${response.status}${detail ? ` ${detail}` : ""}`);
|
|
1790
1607
|
}
|
|
1791
1608
|
const now = deps.now?.() ?? Date.now();
|
|
1792
1609
|
return normalizeXaiTokenPayload({
|
|
@@ -1803,20 +1620,21 @@ var CURSOR_LOGIN_URL = "https://cursor.com/loginDeepControl";
|
|
|
1803
1620
|
var CURSOR_POLL_URL = "https://api2.cursor.sh/auth/poll";
|
|
1804
1621
|
var CURSOR_REFRESH_URL = "https://api2.cursor.sh/auth/exchange_user_api_key";
|
|
1805
1622
|
var CURSOR_POLL_MAX_ATTEMPTS = 150;
|
|
1806
|
-
var CURSOR_POLL_BASE_DELAY_MS =
|
|
1623
|
+
var CURSOR_POLL_BASE_DELAY_MS = 1000;
|
|
1807
1624
|
var CURSOR_POLL_MAX_DELAY_MS = 1e4;
|
|
1808
1625
|
var CURSOR_POLL_BACKOFF_MULTIPLIER = 1.2;
|
|
1809
1626
|
var CURSOR_POLL_MAX_CONSECUTIVE_ERRORS = 3;
|
|
1810
|
-
var CURSOR_ACCESS_TOKEN_CLIENT_SKEW_MS = 5 * 60 *
|
|
1811
|
-
var CURSOR_TOKEN_REQUEST_TIMEOUT_MS =
|
|
1627
|
+
var CURSOR_ACCESS_TOKEN_CLIENT_SKEW_MS = 5 * 60 * 1000;
|
|
1628
|
+
var CURSOR_TOKEN_REQUEST_TIMEOUT_MS = 30000;
|
|
1812
1629
|
function decodeJwtExp(token) {
|
|
1813
1630
|
try {
|
|
1814
1631
|
const parts = token.split(".");
|
|
1815
|
-
if (parts.length < 2)
|
|
1632
|
+
if (parts.length < 2)
|
|
1633
|
+
return null;
|
|
1816
1634
|
const payloadJson = Buffer.from(parts[1], "base64url").toString("utf-8");
|
|
1817
1635
|
const payload = JSON.parse(payloadJson);
|
|
1818
1636
|
if (typeof payload.exp === "number" && Number.isFinite(payload.exp)) {
|
|
1819
|
-
return payload.exp *
|
|
1637
|
+
return payload.exp * 1000;
|
|
1820
1638
|
}
|
|
1821
1639
|
return null;
|
|
1822
1640
|
} catch {
|
|
@@ -1829,7 +1647,7 @@ function normalizeCursorTokenPayload(args) {
|
|
|
1829
1647
|
throw new Error("Cursor token refresh response missing accessToken");
|
|
1830
1648
|
}
|
|
1831
1649
|
const accessToken = payload.accessToken.trim();
|
|
1832
|
-
const expiresAt = decodeJwtExp(accessToken) ?? now + 3600 *
|
|
1650
|
+
const expiresAt = decodeJwtExp(accessToken) ?? now + 3600 * 1000 - CURSOR_ACCESS_TOKEN_CLIENT_SKEW_MS;
|
|
1833
1651
|
const newRefresh = typeof payload.refreshToken === "string" && payload.refreshToken.trim() ? payload.refreshToken.trim() : baseCredential?.refreshToken;
|
|
1834
1652
|
return {
|
|
1835
1653
|
...baseCredential ?? {},
|
|
@@ -1857,19 +1675,14 @@ async function refreshCursorToken(credential, deps = {}) {
|
|
|
1857
1675
|
signal: AbortSignal.timeout(CURSOR_TOKEN_REQUEST_TIMEOUT_MS)
|
|
1858
1676
|
});
|
|
1859
1677
|
} catch (error) {
|
|
1860
|
-
throw new Error(
|
|
1861
|
-
`Cursor token refresh failed: ${toErrorMessage(error)}`
|
|
1862
|
-
);
|
|
1678
|
+
throw new Error(`Cursor token refresh failed: ${toErrorMessage(error)}`);
|
|
1863
1679
|
}
|
|
1864
1680
|
if (!response.ok) {
|
|
1865
1681
|
let detail = "";
|
|
1866
1682
|
try {
|
|
1867
1683
|
detail = (await response.text()).trim();
|
|
1868
|
-
} catch {
|
|
1869
|
-
}
|
|
1870
|
-
throw new Error(
|
|
1871
|
-
`Cursor token refresh failed: ${response.status}${detail ? ` ${detail}` : ""}`
|
|
1872
|
-
);
|
|
1684
|
+
} catch {}
|
|
1685
|
+
throw new Error(`Cursor token refresh failed: ${response.status}${detail ? ` ${detail}` : ""}`);
|
|
1873
1686
|
}
|
|
1874
1687
|
let data;
|
|
1875
1688
|
try {
|
|
@@ -1886,59 +1699,27 @@ async function refreshCursorToken(credential, deps = {}) {
|
|
|
1886
1699
|
}
|
|
1887
1700
|
var cursorRefresh = refreshCursorToken;
|
|
1888
1701
|
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
runOpenAiCodexDeviceCode,
|
|
1914
|
-
runOpenAiCodexBrowserPkce,
|
|
1915
|
-
refreshOpenAiCodexToken2 as refreshOpenAiCodexToken,
|
|
1916
|
-
XAI_OAUTH_CLIENT_ID,
|
|
1917
|
-
XAI_OAUTH_SCOPE,
|
|
1918
|
-
XAI_OAUTH_REDIRECT_HOST,
|
|
1919
|
-
XAI_OAUTH_REDIRECT_PORT,
|
|
1920
|
-
XAI_OAUTH_REDIRECT_PATH,
|
|
1921
|
-
XAI_OAUTH_DOCS_URL,
|
|
1922
|
-
XAI_DEVICE_CODE_GRANT_TYPE,
|
|
1923
|
-
XAI_DEVICE_CODE_DEFAULT_INTERVAL_MS,
|
|
1924
|
-
XAI_DEVICE_CODE_MIN_INTERVAL_MS,
|
|
1925
|
-
XAI_DEVICE_CODE_SLOW_DOWN_INCREMENT_MS,
|
|
1926
|
-
XAI_DEVICE_CODE_DEFAULT_EXPIRES_MS,
|
|
1927
|
-
XAI_ACCESS_TOKEN_CLIENT_SKEW_MS,
|
|
1928
|
-
XAI_TOKEN_REQUEST_TIMEOUT_MS,
|
|
1929
|
-
validateXAIEndpoint,
|
|
1930
|
-
readJsonBody,
|
|
1931
|
-
xaiOAuthDiscovery,
|
|
1932
|
-
xaiRefresh,
|
|
1933
|
-
CURSOR_LOGIN_URL,
|
|
1934
|
-
CURSOR_POLL_URL,
|
|
1935
|
-
CURSOR_POLL_MAX_ATTEMPTS,
|
|
1936
|
-
CURSOR_POLL_BASE_DELAY_MS,
|
|
1937
|
-
CURSOR_POLL_MAX_DELAY_MS,
|
|
1938
|
-
CURSOR_POLL_BACKOFF_MULTIPLIER,
|
|
1939
|
-
CURSOR_POLL_MAX_CONSECUTIVE_ERRORS,
|
|
1940
|
-
CURSOR_ACCESS_TOKEN_CLIENT_SKEW_MS,
|
|
1941
|
-
decodeJwtExp,
|
|
1942
|
-
cursorRefresh,
|
|
1943
|
-
resolveServerSyncConfig
|
|
1944
|
-
};
|
|
1702
|
+
// packages/cli/oauth/serverSyncConfig.ts
|
|
1703
|
+
function resolveServerSyncConfig2() {
|
|
1704
|
+
const envServer = process.env.NOLO_SERVER?.trim() || process.env.NOLO_SERVER_URL?.trim() || process.env.BASE_URL?.trim() || "";
|
|
1705
|
+
const envToken = process.env.AUTH_TOKEN?.trim() || process.env.NOLO_AUTH_TOKEN?.trim() || "";
|
|
1706
|
+
if (envServer && envToken) {
|
|
1707
|
+
return { serverOrigin: envServer.replace(/\/+$/, ""), authToken: envToken };
|
|
1708
|
+
}
|
|
1709
|
+
let profileServer = "";
|
|
1710
|
+
let profileToken = "";
|
|
1711
|
+
try {
|
|
1712
|
+
const config = loadProfileConfig2();
|
|
1713
|
+
const profileEnv = buildEnvFromProfile2(config);
|
|
1714
|
+
profileServer = profileEnv.NOLO_SERVER?.trim() || "";
|
|
1715
|
+
profileToken = profileEnv.AUTH_TOKEN?.trim() || "";
|
|
1716
|
+
} catch {}
|
|
1717
|
+
const serverOrigin = (envServer || profileServer).replace(/\/+$/, "");
|
|
1718
|
+
const authToken = envToken || profileToken;
|
|
1719
|
+
if (serverOrigin && authToken) {
|
|
1720
|
+
return { serverOrigin, authToken };
|
|
1721
|
+
}
|
|
1722
|
+
return null;
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
export { stripAnsi, stripAnsiKeepingOsc8, applyTerminalOutputToText, resolveAmbiguousWidth, resolveBoxCharset, boxGlyphs, displayWidth2, visibleWidth, truncateAnsi, fitAnsiLine, takeDisplayWidth, padOrTruncateToWidth, graphemeSegmenter, tokenizeAnsiLine, buildSourceMapping, wrapTranscriptLineWithLayout, buildWindowTitle, wrapTextToLines, startCallbackServer, renderDeviceCodeDisplay, generatePkcePair, runOpenAiCodexDeviceCode, runOpenAiCodexBrowserPkce, refreshOpenAiCodexToken, XAI_OAUTH_CLIENT_ID, XAI_OAUTH_SCOPE, XAI_OAUTH_REDIRECT_HOST, XAI_OAUTH_REDIRECT_PORT, XAI_OAUTH_REDIRECT_PATH, XAI_OAUTH_DOCS_URL, XAI_DEVICE_CODE_GRANT_TYPE, XAI_DEVICE_CODE_DEFAULT_INTERVAL_MS, XAI_DEVICE_CODE_MIN_INTERVAL_MS, XAI_DEVICE_CODE_SLOW_DOWN_INCREMENT_MS, XAI_DEVICE_CODE_DEFAULT_EXPIRES_MS, XAI_ACCESS_TOKEN_CLIENT_SKEW_MS, XAI_TOKEN_REQUEST_TIMEOUT_MS, validateXAIEndpoint, readJsonBody, xaiOAuthDiscovery, xaiRefresh, CURSOR_LOGIN_URL, CURSOR_POLL_URL, CURSOR_POLL_MAX_ATTEMPTS, CURSOR_POLL_BASE_DELAY_MS, CURSOR_POLL_MAX_DELAY_MS, CURSOR_POLL_BACKOFF_MULTIPLIER, CURSOR_POLL_MAX_CONSECUTIVE_ERRORS, CURSOR_ACCESS_TOKEN_CLIENT_SKEW_MS, decodeJwtExp, cursorRefresh, resolveServerSyncConfig2 };
|