@jayjiang/open-cc 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -17
- package/dist/{chunk-1bhva2z9.js → chunk-03k3e3z0.js} +7 -7
- package/dist/{chunk-ft7fs35e.js → chunk-04zxtqnd.js} +2 -2
- package/dist/{chunk-00dxqxqj.js → chunk-050m5zxa.js} +2 -2
- package/dist/{chunk-khmz14d4.js → chunk-055ys2sk.js} +1 -1
- package/dist/{chunk-n128bzxs.js → chunk-07q7v2v9.js} +4 -4
- package/dist/{chunk-jkhvm8yk.js → chunk-0f71ws0e.js} +2 -2
- package/dist/{chunk-bapy5rc8.js → chunk-0h03m1j0.js} +2 -2
- package/dist/{chunk-dnwzz9f7.js → chunk-0t3bjs9k.js} +2 -2
- package/dist/{chunk-s56j2d6g.js → chunk-0w66q485.js} +1 -1
- package/dist/{chunk-jqp0q5nk.js → chunk-1401zjq1.js} +1 -1
- package/dist/{chunk-aftppv3p.js → chunk-1n2k0naa.js} +1 -1
- package/dist/{chunk-ebyr6p77.js → chunk-1wb6341y.js} +7 -7
- package/dist/{chunk-edfv7pme.js → chunk-1wyfn8fs.js} +2 -2
- package/dist/{chunk-30k39xd2.js → chunk-1x3g3ce2.js} +1 -1
- package/dist/{chunk-dfx733j3.js → chunk-20je43x3.js} +2 -2
- package/dist/{chunk-m4bc15mz.js → chunk-25cesfja.js} +1 -1
- package/dist/{chunk-n4nbgkvd.js → chunk-2bxptkrt.js} +2 -2
- package/dist/{chunk-tanfpxm1.js → chunk-2crdnncs.js} +3 -3
- package/dist/{chunk-wpqbrv0f.js → chunk-2dr6asnr.js} +2 -2
- package/dist/{chunk-fdvcpaz3.js → chunk-2eaa1xjc.js} +3 -3
- package/dist/{chunk-kkrz2zw2.js → chunk-2vergs5e.js} +2 -2
- package/dist/{chunk-gq5bbtme.js → chunk-31jgr3tt.js} +2 -2
- package/dist/{chunk-01p8hhsp.js → chunk-33caan56.js} +2 -2
- package/dist/{chunk-jynzr5w9.js → chunk-3kwmf042.js} +1 -1
- package/dist/{chunk-ztpr96av.js → chunk-3tnb1471.js} +1 -1
- package/dist/{chunk-178ykx7k.js → chunk-418x3wg1.js} +5 -5
- package/dist/{chunk-a2krhf3c.js → chunk-46q68jv4.js} +6 -6
- package/dist/{chunk-rfdbzyjh.js → chunk-491yb5hj.js} +11 -11
- package/dist/{chunk-eaf7c8ck.js → chunk-49qytxa9.js} +3 -3
- package/dist/{chunk-kv1ryvtm.js → chunk-4b65gyje.js} +3 -3
- package/dist/{chunk-dcz167d6.js → chunk-4dp1b3zd.js} +1 -1
- package/dist/{chunk-72fey14y.js → chunk-5f6knz25.js} +2 -2
- package/dist/{chunk-0hn525br.js → chunk-5t02m61e.js} +2 -2
- package/dist/{chunk-cwehsmj5.js → chunk-5tqgf8w6.js} +10 -10
- package/dist/{chunk-jpgr7zfs.js → chunk-6996b18z.js} +1 -1
- package/dist/{chunk-zmg1pcp3.js → chunk-6cws47ab.js} +1 -1
- package/dist/{chunk-1qjb22fx.js → chunk-6knv93mq.js} +7 -7
- package/dist/{chunk-vht4mzgb.js → chunk-760t6316.js} +2 -2
- package/dist/{chunk-5p2ssw3d.js → chunk-7b81e1jf.js} +1 -1
- package/dist/{chunk-p0hff8zy.js → chunk-7q10mn7f.js} +58 -58
- package/dist/{chunk-gac6nzhc.js → chunk-7yt4jd3n.js} +6 -6
- package/dist/{chunk-sk3gpkdt.js → chunk-8bhsbtjd.js} +3 -3
- package/dist/{chunk-4axcksrv.js → chunk-8qbemgf5.js} +3 -3
- package/dist/{chunk-2y54j9ew.js → chunk-94a17ey0.js} +369 -299
- package/dist/{chunk-jdt5s5k7.js → chunk-99ywn0ej.js} +1 -1
- package/dist/{chunk-ab59azrr.js → chunk-9h9dgw51.js} +62 -18
- package/dist/{chunk-bp0dnrwg.js → chunk-9ym8f6v7.js} +1 -1
- package/dist/{chunk-4n989n6h.js → chunk-9za5agc9.js} +4 -4
- package/dist/{chunk-xpm4ebhz.js → chunk-afgm906b.js} +1 -1
- package/dist/{chunk-v9ybze94.js → chunk-amj2cne3.js} +1 -1
- package/dist/{chunk-yxvy4jt4.js → chunk-any1t25n.js} +2 -2
- package/dist/{chunk-26k0324b.js → chunk-atmergmr.js} +3 -3
- package/dist/{chunk-ev5p07yh.js → chunk-axh49ea0.js} +3 -3
- package/dist/{chunk-rbgjkg3v.js → chunk-b0whm6mb.js} +2 -2
- package/dist/{chunk-09y0jvtm.js → chunk-b3kgy25m.js} +3 -3
- package/dist/{chunk-nx7s0zn5.js → chunk-b5er2edx.js} +2 -2
- package/dist/{chunk-h8qd1gw2.js → chunk-b5z6rj3x.js} +2 -2
- package/dist/{chunk-g0nbec9m.js → chunk-bef7x0zj.js} +2 -2
- package/dist/{chunk-tww14j0s.js → chunk-bgjj4b0s.js} +1 -1
- package/dist/{chunk-mzn0z9d3.js → chunk-bn2yj49s.js} +5 -5
- package/dist/{chunk-gntr3b25.js → chunk-btzryrke.js} +60 -67
- package/dist/{chunk-cdm0k2n0.js → chunk-bynmk3h0.js} +7 -7
- package/dist/{chunk-mezwt1bt.js → chunk-bzmrjhn4.js} +2 -2
- package/dist/{chunk-pthzapbx.js → chunk-c40es3w7.js} +1 -1
- package/dist/{chunk-mb2gpwwf.js → chunk-c5sc57fe.js} +1 -1
- package/dist/{chunk-m0g3xv72.js → chunk-c5vxf67y.js} +1 -1
- package/dist/{chunk-qvrq1sby.js → chunk-d44bd9z4.js} +8 -8
- package/dist/chunk-d9eqjnya.js +761 -0
- package/dist/{chunk-qgjgqmy5.js → chunk-db74da38.js} +4 -4
- package/dist/{chunk-87jfpcm7.js → chunk-dg980z8h.js} +2 -2
- package/dist/{chunk-789khc7a.js → chunk-dh4jnzs3.js} +1 -1
- package/dist/{chunk-g1fdv1kb.js → chunk-e8y2k8mp.js} +2 -2
- package/dist/{chunk-jne71s1f.js → chunk-eaecktgy.js} +2 -2
- package/dist/{chunk-4rze71rx.js → chunk-efv61cqg.js} +7 -7
- package/dist/{chunk-y9nnmev5.js → chunk-emcst9rk.js} +1 -1
- package/dist/{chunk-vxj5rbg5.js → chunk-emm7qbhm.js} +3 -3
- package/dist/{chunk-5ywjzvm8.js → chunk-ez4b4twb.js} +1 -1
- package/dist/{chunk-9ebygqen.js → chunk-f0df5cr5.js} +3 -3
- package/dist/{chunk-p5z8t6r3.js → chunk-f3rm5cyn.js} +1 -1
- package/dist/{chunk-nttf3k0r.js → chunk-f979wqq7.js} +5 -5
- package/dist/{chunk-44q8kegv.js → chunk-fzbthhkm.js} +4 -4
- package/dist/{chunk-k445en8h.js → chunk-gasmbc3t.js} +2 -2
- package/dist/{chunk-b4w4argn.js → chunk-ghwt3yee.js} +3 -3
- package/dist/{chunk-tm1wwvm1.js → chunk-gjckcxhk.js} +3 -3
- package/dist/{chunk-q132dkwr.js → chunk-h3dsp9ew.js} +2 -2
- package/dist/{chunk-hzhd0p1y.js → chunk-h4e6yx8f.js} +2 -2
- package/dist/{chunk-qjcxkbv6.js → chunk-h6rem2kp.js} +2 -2
- package/dist/{chunk-nx638j6h.js → chunk-hmg55x4b.js} +2 -2
- package/dist/{chunk-x6tb96y2.js → chunk-hw67007k.js} +2 -2
- package/dist/{chunk-qj7h3xc3.js → chunk-hzw7v9hd.js} +1 -1
- package/dist/{chunk-znrwmznk.js → chunk-j1bkeg89.js} +3 -3
- package/dist/{chunk-c2g96ga2.js → chunk-javrjweb.js} +1 -1
- package/dist/{chunk-58a0x39g.js → chunk-jm3jcvv7.js} +5 -5
- package/dist/{chunk-v4qn3g0d.js → chunk-jmrr15c1.js} +2 -2
- package/dist/{chunk-xm3ed3zn.js → chunk-jppj9ntn.js} +3 -3
- package/dist/{chunk-ymy4xrr8.js → chunk-jrcywjsm.js} +6 -6
- package/dist/{chunk-6b8ksqmf.js → chunk-k569dka2.js} +2 -2
- package/dist/{chunk-95rj8m4e.js → chunk-kad9x7e9.js} +5 -5
- package/dist/{chunk-j595yd4h.js → chunk-kjxh14v2.js} +9 -9
- package/dist/{chunk-dc4eha8a.js → chunk-knejp6ct.js} +14 -14
- package/dist/{chunk-95dt8mpg.js → chunk-krmwj24j.js} +2 -2
- package/dist/{chunk-4g5mrzm0.js → chunk-krw2m86w.js} +2 -2
- package/dist/{chunk-rca5xtnd.js → chunk-kscjn6es.js} +3 -3
- package/dist/{chunk-xc9khn0r.js → chunk-m1nng5as.js} +1 -1
- package/dist/{chunk-jtqgnyaq.js → chunk-m50sdknd.js} +2 -2
- package/dist/{chunk-73fhat5j.js → chunk-m88csyn5.js} +1 -1
- package/dist/{chunk-6cpqmd4r.js → chunk-mgtethqg.js} +4 -4
- package/dist/{chunk-6n6jfmce.js → chunk-mh7n6peb.js} +4 -4
- package/dist/{chunk-accxhkm6.js → chunk-mqe2sfb1.js} +7 -7
- package/dist/{chunk-hcdt34n4.js → chunk-mtdrhdc1.js} +43 -43
- package/dist/{chunk-2bhq4emw.js → chunk-mwbe7yfx.js} +8 -8
- package/dist/{chunk-xch406a3.js → chunk-n33y9xtk.js} +7 -7
- package/dist/{chunk-j7qwxra8.js → chunk-n39rn8tg.js} +2 -2
- package/dist/{chunk-cp76dsdp.js → chunk-n3rsjj87.js} +7 -7
- package/dist/{chunk-62vwr0y5.js → chunk-n64nzb7s.js} +2 -2
- package/dist/{chunk-yfa54ssn.js → chunk-n943c903.js} +3 -3
- package/dist/{chunk-9tkq3g56.js → chunk-nez3gykb.js} +3 -3
- package/dist/{chunk-qz3fe4fj.js → chunk-p0rtjz76.js} +1 -1
- package/dist/{chunk-2s5f2nnw.js → chunk-p4zfbz27.js} +44 -44
- package/dist/{chunk-fgc0q2b2.js → chunk-pcyftw8z.js} +5 -5
- package/dist/{chunk-vvn4gkak.js → chunk-pq3qngwy.js} +3 -3
- package/dist/{chunk-8nsem424.js → chunk-qdpfabyz.js} +2 -2
- package/dist/{chunk-pd6653na.js → chunk-qjmjcs63.js} +2 -2
- package/dist/{chunk-sp5cjcjh.js → chunk-qvd0m1vp.js} +2 -2
- package/dist/{chunk-c1zc58pw.js → chunk-qvmmse8a.js} +2 -2
- package/dist/{chunk-er8ckwzt.js → chunk-qw2rzvj6.js} +1 -1
- package/dist/{chunk-waambva2.js → chunk-r3jp4gc6.js} +4 -4
- package/dist/{chunk-wbhsqc2a.js → chunk-r54p01mz.js} +2 -2
- package/dist/{chunk-zbmxxxz8.js → chunk-r9yhwx1y.js} +3 -3
- package/dist/{chunk-a05hje2h.js → chunk-re0rf0vw.js} +4 -4
- package/dist/{chunk-0y3vcsv4.js → chunk-rhtq60c1.js} +2 -2
- package/dist/{chunk-5kp252z6.js → chunk-rr8w81t1.js} +2 -2
- package/dist/{chunk-hsq4vtjy.js → chunk-rywmy7bd.js} +2 -2
- package/dist/{chunk-t4k75hqs.js → chunk-s5pvh4qz.js} +22 -22
- package/dist/{chunk-7v0wq9nk.js → chunk-sxft0w1b.js} +6 -6
- package/dist/{chunk-agmw1vmf.js → chunk-t2xw2rh1.js} +4 -4
- package/dist/{chunk-f63q7vx7.js → chunk-t6ws2gm1.js} +1 -1
- package/dist/{chunk-xe0bpcbr.js → chunk-t8shyyz1.js} +2 -2
- package/dist/{chunk-dz8exe78.js → chunk-tmxhxy9a.js} +5 -5
- package/dist/{chunk-4wbhvcag.js → chunk-trea3s0q.js} +5 -5
- package/dist/{chunk-kgn1nfg9.js → chunk-tvq6r54h.js} +2 -2
- package/dist/{chunk-8j6vs75t.js → chunk-twbv2xr1.js} +2 -2
- package/dist/{chunk-r6e45bzh.js → chunk-txywb35s.js} +2 -2
- package/dist/{chunk-k1jnpyj9.js → chunk-tzxm7q7t.js} +2 -2
- package/dist/{chunk-m9t8j37k.js → chunk-v3cv3z2z.js} +3 -3
- package/dist/{chunk-sbs1r0h4.js → chunk-v98ntm4b.js} +2 -2
- package/dist/{chunk-e9nkfs4e.js → chunk-v9z1x9kn.js} +1 -1
- package/dist/{chunk-mywpbwad.js → chunk-vc4bw7y9.js} +2 -2
- package/dist/{chunk-1nqaq1rs.js → chunk-vm8crmkd.js} +3 -3
- package/dist/{chunk-de55jjre.js → chunk-vpshs9f2.js} +2 -2
- package/dist/{chunk-sfht9xvd.js → chunk-vt2behmr.js} +1 -1
- package/dist/{chunk-j98f65zv.js → chunk-w2cagryn.js} +2 -2
- package/dist/{chunk-sq847dr5.js → chunk-wbncq3a7.js} +5 -5
- package/dist/{chunk-rh7q28df.js → chunk-wfp4gxpe.js} +7 -7
- package/dist/{chunk-fm2jvsk7.js → chunk-wt3kg2dm.js} +3 -3
- package/dist/{chunk-b2rkh01x.js → chunk-wt6w9mbw.js} +2 -2
- package/dist/{chunk-sskngwam.js → chunk-wy5bf4v9.js} +3 -3
- package/dist/{chunk-76t2h5v2.js → chunk-x75gtbay.js} +1 -1
- package/dist/{chunk-6tnekwtp.js → chunk-xh91k4cv.js} +1 -1
- package/dist/{chunk-j1s1jvad.js → chunk-xnsnhmmb.js} +7 -7
- package/dist/{chunk-0scs4rpx.js → chunk-xpdhed8a.js} +2 -2
- package/dist/{chunk-fcna95wg.js → chunk-xv0exc70.js} +3 -3
- package/dist/{chunk-wbsnpxzh.js → chunk-y02t64a2.js} +2 -2
- package/dist/{chunk-7azp8c8y.js → chunk-y2g6g5fx.js} +1 -1
- package/dist/{chunk-40tedt0y.js → chunk-y612qk68.js} +1 -1
- package/dist/{chunk-tf9h0cyj.js → chunk-y7p5yx4y.js} +2 -2
- package/dist/{chunk-kf8kjmfv.js → chunk-y8rcgtpp.js} +2 -2
- package/dist/{chunk-20gm89wf.js → chunk-ydaba8sr.js} +1 -1
- package/dist/{chunk-4e1271a8.js → chunk-ydgs4nys.js} +4 -4
- package/dist/{chunk-73fgm72g.js → chunk-ymn6n1vn.js} +2 -2
- package/dist/{chunk-btkettbr.js → chunk-yv366pne.js} +2 -2
- package/dist/{chunk-5w33j8gy.js → chunk-yzcndkqh.js} +2 -2
- package/dist/{chunk-1p7jfcee.js → chunk-zatb0qz2.js} +2 -2
- package/dist/{chunk-rw6fwk2s.js → chunk-zbq7qfcy.js} +1 -1
- package/dist/{chunk-bs6keys0.js → chunk-zrdzck9g.js} +4 -4
- package/dist/{chunk-kjhmt6ba.js → chunk-zte56zrq.js} +2 -2
- package/dist/{chunk-jeaek018.js → chunk-zwzdzvfh.js} +1 -1
- package/dist/cli.js +172 -7
- package/package.json +1 -1
- package/dist/chunk-z2xxx2sz.js +0 -294
|
@@ -0,0 +1,761 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
BUILTIN_PROVIDERS,
|
|
4
|
+
POPULAR_PROVIDERS,
|
|
5
|
+
PROVIDER_KEY_HELP_URLS,
|
|
6
|
+
Select,
|
|
7
|
+
getAvailableProvidersMerged,
|
|
8
|
+
getConnectedProviderId,
|
|
9
|
+
getProviderRouter,
|
|
10
|
+
hasEnvKeyDynamic,
|
|
11
|
+
init_CustomSelect,
|
|
12
|
+
init_presets,
|
|
13
|
+
init_router,
|
|
14
|
+
init_state,
|
|
15
|
+
providerHasAuth,
|
|
16
|
+
setConnectedProviderId,
|
|
17
|
+
storeProviderApiKey,
|
|
18
|
+
storeProviderOAuthToken
|
|
19
|
+
} from "./chunk-94a17ey0.js";
|
|
20
|
+
import"./chunk-1yzc16qa.js";
|
|
21
|
+
import"./chunk-s10vyjz4.js";
|
|
22
|
+
import"./chunk-1k4j1xcf.js";
|
|
23
|
+
import"./chunk-3c4qja3e.js";
|
|
24
|
+
import"./chunk-rc5bbzx4.js";
|
|
25
|
+
import"./chunk-e6rrwzv0.js";
|
|
26
|
+
import"./chunk-2gzv8nrw.js";
|
|
27
|
+
import"./chunk-743znc5c.js";
|
|
28
|
+
import"./chunk-7b81e1jf.js";
|
|
29
|
+
import"./chunk-cgfdkzhb.js";
|
|
30
|
+
import"./chunk-bhdt6k7w.js";
|
|
31
|
+
import"./chunk-6wkdqk81.js";
|
|
32
|
+
import"./chunk-5dbk24zg.js";
|
|
33
|
+
import"./chunk-bda3gxxz.js";
|
|
34
|
+
import"./chunk-zxhezavg.js";
|
|
35
|
+
import"./chunk-x8eg216f.js";
|
|
36
|
+
import"./chunk-9gbamk79.js";
|
|
37
|
+
import"./chunk-t175chdd.js";
|
|
38
|
+
import"./chunk-7rjyn5d3.js";
|
|
39
|
+
import"./chunk-6q2x8zeg.js";
|
|
40
|
+
import {
|
|
41
|
+
ThemedBox_default,
|
|
42
|
+
ThemedText,
|
|
43
|
+
init_ink,
|
|
44
|
+
use_input_default
|
|
45
|
+
} from "./chunk-0yb4dz9c.js";
|
|
46
|
+
import"./chunk-7m2nd8da.js";
|
|
47
|
+
import"./chunk-ps49ymvj.js";
|
|
48
|
+
import {
|
|
49
|
+
require_jsx_dev_runtime,
|
|
50
|
+
require_react
|
|
51
|
+
} from "./chunk-g338npwr.js";
|
|
52
|
+
import"./chunk-zk2wsm7d.js";
|
|
53
|
+
import"./chunk-eh474zhj.js";
|
|
54
|
+
import"./chunk-ga5faygf.js";
|
|
55
|
+
import"./chunk-e7c8ypwc.js";
|
|
56
|
+
import"./chunk-g6qddbvf.js";
|
|
57
|
+
import"./chunk-b1s11z4y.js";
|
|
58
|
+
import"./chunk-4jm600zv.js";
|
|
59
|
+
import"./chunk-yxmz5k16.js";
|
|
60
|
+
import"./chunk-v9smspw2.js";
|
|
61
|
+
import"./chunk-qz2x630m.js";
|
|
62
|
+
import {
|
|
63
|
+
init_source,
|
|
64
|
+
source_default
|
|
65
|
+
} from "./chunk-30chpfyc.js";
|
|
66
|
+
import"./chunk-84k64e4a.js";
|
|
67
|
+
import"./chunk-y3py9g5d.js";
|
|
68
|
+
import"./chunk-7pemewz2.js";
|
|
69
|
+
import"./chunk-s4w01jsb.js";
|
|
70
|
+
import"./chunk-c8vn3ynx.js";
|
|
71
|
+
import"./chunk-g0j0t6qk.js";
|
|
72
|
+
import"./chunk-6kpbgc5w.js";
|
|
73
|
+
import"./chunk-3c25bcsw.js";
|
|
74
|
+
import"./chunk-mzdtkccs.js";
|
|
75
|
+
import"./chunk-55wgxwa9.js";
|
|
76
|
+
import"./chunk-5k2gdxnr.js";
|
|
77
|
+
import"./chunk-2qhs9n36.js";
|
|
78
|
+
import"./chunk-f5ma3nh5.js";
|
|
79
|
+
import"./chunk-v1kzp02e.js";
|
|
80
|
+
import"./chunk-p2816w9z.js";
|
|
81
|
+
import"./chunk-0vkfrmqm.js";
|
|
82
|
+
import"./chunk-0xjaqda8.js";
|
|
83
|
+
import"./chunk-mr9df5v8.js";
|
|
84
|
+
import"./chunk-cdz5yb0r.js";
|
|
85
|
+
import"./chunk-f2mhrmww.js";
|
|
86
|
+
import"./chunk-10fdxge0.js";
|
|
87
|
+
import"./chunk-r1v8d6da.js";
|
|
88
|
+
import"./chunk-d3v2fbay.js";
|
|
89
|
+
import"./chunk-qnfx3qtx.js";
|
|
90
|
+
import"./chunk-f2zhqnb6.js";
|
|
91
|
+
import"./chunk-cvp5vayb.js";
|
|
92
|
+
import"./chunk-b5b7h81y.js";
|
|
93
|
+
import"./chunk-nm2cncrq.js";
|
|
94
|
+
import"./chunk-8tnsngw2.js";
|
|
95
|
+
import"./chunk-0rkbrabt.js";
|
|
96
|
+
import"./chunk-7wm5s02e.js";
|
|
97
|
+
import"./chunk-rwagvxh5.js";
|
|
98
|
+
import"./chunk-fbv4apne.js";
|
|
99
|
+
import"./chunk-0fkqze0v.js";
|
|
100
|
+
import"./chunk-2zcaw1jd.js";
|
|
101
|
+
import"./chunk-hqmz36b3.js";
|
|
102
|
+
import"./chunk-4g3v8y12.js";
|
|
103
|
+
import"./chunk-7739pg2c.js";
|
|
104
|
+
import"./chunk-xszk7n10.js";
|
|
105
|
+
import"./chunk-sdj9b9wh.js";
|
|
106
|
+
import {
|
|
107
|
+
__esm,
|
|
108
|
+
__require,
|
|
109
|
+
__toESM
|
|
110
|
+
} from "./chunk-qp2qdcda.js";
|
|
111
|
+
|
|
112
|
+
// src/components/ProviderPicker.tsx
|
|
113
|
+
function getStatusBadge(id, connectedId) {
|
|
114
|
+
if (id === connectedId)
|
|
115
|
+
return "(connected)";
|
|
116
|
+
if (providerHasAuth(id) || hasEnvKeyDynamic(id))
|
|
117
|
+
return "(key detected)";
|
|
118
|
+
return "";
|
|
119
|
+
}
|
|
120
|
+
function filterProviders(providers, query) {
|
|
121
|
+
if (!query)
|
|
122
|
+
return providers;
|
|
123
|
+
const lower = query.toLowerCase();
|
|
124
|
+
return providers.filter((p) => p.id.toLowerCase().includes(lower) || p.name.toLowerCase().includes(lower));
|
|
125
|
+
}
|
|
126
|
+
function buildOptions(providers, connectedId, hasSearch) {
|
|
127
|
+
const popular = providers.filter((p) => POPULAR_PROVIDERS.includes(p.id)).sort((a, b) => POPULAR_PROVIDERS.indexOf(a.id) - POPULAR_PROVIDERS.indexOf(b.id));
|
|
128
|
+
const other = providers.filter((p) => !POPULAR_PROVIDERS.includes(p.id)).sort((a, b) => a.name.localeCompare(b.name));
|
|
129
|
+
const toOption = (p) => ({
|
|
130
|
+
value: p.id,
|
|
131
|
+
label: p.name,
|
|
132
|
+
description: getStatusBadge(p.id, connectedId)
|
|
133
|
+
});
|
|
134
|
+
if (hasSearch) {
|
|
135
|
+
return [...popular.map(toOption), ...other.map(toOption)];
|
|
136
|
+
}
|
|
137
|
+
const options = [];
|
|
138
|
+
if (popular.length > 0) {
|
|
139
|
+
options.push({
|
|
140
|
+
value: "__popular_header",
|
|
141
|
+
label: "Popular",
|
|
142
|
+
disabled: true
|
|
143
|
+
});
|
|
144
|
+
options.push(...popular.map(toOption));
|
|
145
|
+
}
|
|
146
|
+
if (other.length > 0) {
|
|
147
|
+
options.push({
|
|
148
|
+
value: "__other_header",
|
|
149
|
+
label: "Other",
|
|
150
|
+
disabled: true
|
|
151
|
+
});
|
|
152
|
+
options.push(...other.map(toOption));
|
|
153
|
+
}
|
|
154
|
+
return options;
|
|
155
|
+
}
|
|
156
|
+
function ProviderPicker({ onSelect, onCancel }) {
|
|
157
|
+
const connectedId = getConnectedProviderId();
|
|
158
|
+
const [providers, setProviders] = import_react.useState([]);
|
|
159
|
+
const [loading, setLoading] = import_react.useState(true);
|
|
160
|
+
const [search, setSearch] = import_react.useState("");
|
|
161
|
+
import_react.useEffect(() => {
|
|
162
|
+
getAvailableProvidersMerged().then(setProviders).finally(() => setLoading(false));
|
|
163
|
+
}, []);
|
|
164
|
+
if (loading) {
|
|
165
|
+
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
|
|
166
|
+
flexDirection: "column",
|
|
167
|
+
children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
|
|
168
|
+
dimColor: true,
|
|
169
|
+
children: "Loading providers..."
|
|
170
|
+
}, undefined, false, undefined, this)
|
|
171
|
+
}, undefined, false, undefined, this);
|
|
172
|
+
}
|
|
173
|
+
const filtered = filterProviders(providers, search);
|
|
174
|
+
const options = buildOptions(filtered, connectedId, search.length > 0);
|
|
175
|
+
const searchOption = {
|
|
176
|
+
value: "__search",
|
|
177
|
+
type: "input",
|
|
178
|
+
label: "Search",
|
|
179
|
+
placeholder: "Search",
|
|
180
|
+
onChange: (value) => setSearch(value),
|
|
181
|
+
allowEmptySubmitToCancel: true
|
|
182
|
+
};
|
|
183
|
+
const allOptions = [searchOption, ...options];
|
|
184
|
+
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
|
|
185
|
+
flexDirection: "column",
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
|
|
188
|
+
marginBottom: 1,
|
|
189
|
+
justifyContent: "space-between",
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
|
|
192
|
+
bold: true,
|
|
193
|
+
children: "Connect a provider"
|
|
194
|
+
}, undefined, false, undefined, this),
|
|
195
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
|
|
196
|
+
dimColor: true,
|
|
197
|
+
children: "esc"
|
|
198
|
+
}, undefined, false, undefined, this)
|
|
199
|
+
]
|
|
200
|
+
}, undefined, true, undefined, this),
|
|
201
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Select, {
|
|
202
|
+
options: allOptions,
|
|
203
|
+
onChange: (value) => {
|
|
204
|
+
if (value === "__search" || value === "__popular_header" || value === "__other_header")
|
|
205
|
+
return;
|
|
206
|
+
onSelect(value);
|
|
207
|
+
},
|
|
208
|
+
onCancel: onCancel ?? (() => {}),
|
|
209
|
+
defaultValue: connectedId,
|
|
210
|
+
visibleOptionCount: 20,
|
|
211
|
+
hideIndexes: true
|
|
212
|
+
}, undefined, false, undefined, this),
|
|
213
|
+
filtered.length === 0 && search && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
|
|
214
|
+
marginTop: 1,
|
|
215
|
+
children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
|
|
216
|
+
dimColor: true,
|
|
217
|
+
children: "No providers found"
|
|
218
|
+
}, undefined, false, undefined, this)
|
|
219
|
+
}, undefined, false, undefined, this)
|
|
220
|
+
]
|
|
221
|
+
}, undefined, true, undefined, this);
|
|
222
|
+
}
|
|
223
|
+
var import_react, jsx_dev_runtime;
|
|
224
|
+
var init_ProviderPicker = __esm(() => {
|
|
225
|
+
init_ink();
|
|
226
|
+
init_CustomSelect();
|
|
227
|
+
init_presets();
|
|
228
|
+
init_state();
|
|
229
|
+
import_react = __toESM(require_react(), 1);
|
|
230
|
+
jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// src/components/ApiKeyInput.tsx
|
|
234
|
+
function ApiKeyInput({ providerId, providerName, onSubmit, onCancel }) {
|
|
235
|
+
const [value, setValue] = import_react2.useState("");
|
|
236
|
+
const helpUrl = PROVIDER_KEY_HELP_URLS[providerId];
|
|
237
|
+
use_input_default((input, key) => {
|
|
238
|
+
if (key.escape && onCancel) {
|
|
239
|
+
onCancel();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (key.return && value.trim()) {
|
|
243
|
+
onSubmit(value.trim());
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (key.backspace || key.delete) {
|
|
247
|
+
setValue((v) => v.slice(0, -1));
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (input && !key.ctrl && !key.meta) {
|
|
251
|
+
setValue((v) => v + input);
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
const masked = "*".repeat(value.length);
|
|
255
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
|
|
256
|
+
flexDirection: "column",
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
|
|
259
|
+
marginBottom: 1,
|
|
260
|
+
children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
|
|
261
|
+
bold: true,
|
|
262
|
+
children: [
|
|
263
|
+
"Connect to ",
|
|
264
|
+
providerName
|
|
265
|
+
]
|
|
266
|
+
}, undefined, true, undefined, this)
|
|
267
|
+
}, undefined, false, undefined, this),
|
|
268
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
|
|
269
|
+
children: [
|
|
270
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
|
|
271
|
+
children: "API Key: "
|
|
272
|
+
}, undefined, false, undefined, this),
|
|
273
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
|
|
274
|
+
children: masked || "Enter your API key..."
|
|
275
|
+
}, undefined, false, undefined, this)
|
|
276
|
+
]
|
|
277
|
+
}, undefined, true, undefined, this),
|
|
278
|
+
helpUrl && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
|
|
279
|
+
marginTop: 1,
|
|
280
|
+
children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
|
|
281
|
+
dimColor: true,
|
|
282
|
+
children: [
|
|
283
|
+
"Get your key at: ",
|
|
284
|
+
helpUrl
|
|
285
|
+
]
|
|
286
|
+
}, undefined, true, undefined, this)
|
|
287
|
+
}, undefined, false, undefined, this),
|
|
288
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
|
|
289
|
+
marginTop: 1,
|
|
290
|
+
children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
|
|
291
|
+
dimColor: true,
|
|
292
|
+
children: "enter confirm esc back"
|
|
293
|
+
}, undefined, false, undefined, this)
|
|
294
|
+
}, undefined, false, undefined, this)
|
|
295
|
+
]
|
|
296
|
+
}, undefined, true, undefined, this);
|
|
297
|
+
}
|
|
298
|
+
var import_react2, jsx_dev_runtime2;
|
|
299
|
+
var init_ApiKeyInput = __esm(() => {
|
|
300
|
+
init_ink();
|
|
301
|
+
init_presets();
|
|
302
|
+
import_react2 = __toESM(require_react(), 1);
|
|
303
|
+
jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// src/services/providers/copilot-auth.ts
|
|
307
|
+
import { setTimeout as sleep } from "timers/promises";
|
|
308
|
+
function normalizeDomain(url) {
|
|
309
|
+
return url.replace(/^https?:\/\//, "").replace(/\/$/, "");
|
|
310
|
+
}
|
|
311
|
+
function getUrls(domain) {
|
|
312
|
+
return {
|
|
313
|
+
deviceCodeUrl: `https://${domain}/login/device/code`,
|
|
314
|
+
accessTokenUrl: `https://${domain}/login/oauth/access_token`
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
async function startCopilotDeviceAuth(domain, enterpriseUrl) {
|
|
318
|
+
const urls = getUrls(domain);
|
|
319
|
+
const deviceResponse = await fetch(urls.deviceCodeUrl, {
|
|
320
|
+
method: "POST",
|
|
321
|
+
headers: {
|
|
322
|
+
Accept: "application/json",
|
|
323
|
+
"Content-Type": "application/json"
|
|
324
|
+
},
|
|
325
|
+
body: JSON.stringify({
|
|
326
|
+
client_id: CLIENT_ID,
|
|
327
|
+
scope: "read:user"
|
|
328
|
+
})
|
|
329
|
+
});
|
|
330
|
+
if (!deviceResponse.ok) {
|
|
331
|
+
throw new Error(`Failed to initiate device authorization (${deviceResponse.status})`);
|
|
332
|
+
}
|
|
333
|
+
const deviceData = await deviceResponse.json();
|
|
334
|
+
return {
|
|
335
|
+
userCode: deviceData.user_code,
|
|
336
|
+
verificationUri: deviceData.verification_uri,
|
|
337
|
+
async poll() {
|
|
338
|
+
const startTime = Date.now();
|
|
339
|
+
let interval = deviceData.interval;
|
|
340
|
+
while (Date.now() - startTime < POLLING_TIMEOUT_MS) {
|
|
341
|
+
await sleep(interval * 1000 + POLLING_SAFETY_MARGIN_MS);
|
|
342
|
+
const response = await fetch(urls.accessTokenUrl, {
|
|
343
|
+
method: "POST",
|
|
344
|
+
headers: {
|
|
345
|
+
Accept: "application/json",
|
|
346
|
+
"Content-Type": "application/json"
|
|
347
|
+
},
|
|
348
|
+
body: JSON.stringify({
|
|
349
|
+
client_id: CLIENT_ID,
|
|
350
|
+
device_code: deviceData.device_code,
|
|
351
|
+
grant_type: "urn:ietf:params:oauth:grant-type:device_code"
|
|
352
|
+
})
|
|
353
|
+
});
|
|
354
|
+
if (!response.ok) {
|
|
355
|
+
return { type: "error", message: "Authorization request failed" };
|
|
356
|
+
}
|
|
357
|
+
const data = await response.json();
|
|
358
|
+
if (data.access_token) {
|
|
359
|
+
return {
|
|
360
|
+
type: "success",
|
|
361
|
+
token: data.access_token,
|
|
362
|
+
enterpriseUrl
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
if (data.error === "authorization_pending") {
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
if (data.error === "slow_down") {
|
|
369
|
+
const serverInterval = data.interval;
|
|
370
|
+
if (serverInterval && typeof serverInterval === "number" && serverInterval > 0) {
|
|
371
|
+
interval = serverInterval;
|
|
372
|
+
} else {
|
|
373
|
+
interval = interval + 5;
|
|
374
|
+
}
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
if (data.error === "expired_token") {
|
|
378
|
+
return { type: "error", message: "Authorization timed out" };
|
|
379
|
+
}
|
|
380
|
+
if (data.error === "access_denied") {
|
|
381
|
+
return { type: "error", message: "Authorization denied" };
|
|
382
|
+
}
|
|
383
|
+
return {
|
|
384
|
+
type: "error",
|
|
385
|
+
message: data.error ?? "Unknown error"
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
return { type: "error", message: "Authorization timed out" };
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
function validateEnterpriseUrl(input) {
|
|
393
|
+
if (!input.trim())
|
|
394
|
+
return null;
|
|
395
|
+
try {
|
|
396
|
+
const url = input.includes("://") ? new URL(input) : new URL(`https://${input}`);
|
|
397
|
+
if (!url.hostname)
|
|
398
|
+
return null;
|
|
399
|
+
return normalizeDomain(url.href);
|
|
400
|
+
} catch {
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
var CLIENT_ID = "Ov23li8tweQw6odWQebz", POLLING_SAFETY_MARGIN_MS = 3000, POLLING_TIMEOUT_MS;
|
|
405
|
+
var init_copilot_auth = __esm(() => {
|
|
406
|
+
POLLING_TIMEOUT_MS = 5 * 60 * 1000;
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
// src/commands/connect/connect.tsx
|
|
410
|
+
function finishConnect(providerId, onDone) {
|
|
411
|
+
setConnectedProviderId(providerId);
|
|
412
|
+
getProviderRouter().setConnectedProvider(providerId);
|
|
413
|
+
const name = BUILTIN_PROVIDERS[providerId]?.name ?? providerId;
|
|
414
|
+
onDone(`Connected to ${source_default.bold(name)}`);
|
|
415
|
+
}
|
|
416
|
+
function CopilotDeployPicker({
|
|
417
|
+
onSelect,
|
|
418
|
+
onCancel
|
|
419
|
+
}) {
|
|
420
|
+
const options = [
|
|
421
|
+
{
|
|
422
|
+
value: "public",
|
|
423
|
+
label: "GitHub.com Public"
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
value: "enterprise",
|
|
427
|
+
label: "GitHub Enterprise",
|
|
428
|
+
description: "Data residency or self-hosted"
|
|
429
|
+
}
|
|
430
|
+
];
|
|
431
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
432
|
+
flexDirection: "column",
|
|
433
|
+
children: [
|
|
434
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
435
|
+
marginBottom: 1,
|
|
436
|
+
justifyContent: "space-between",
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
439
|
+
bold: true,
|
|
440
|
+
children: "Select GitHub deployment type"
|
|
441
|
+
}, undefined, false, undefined, this),
|
|
442
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
443
|
+
dimColor: true,
|
|
444
|
+
children: "esc"
|
|
445
|
+
}, undefined, false, undefined, this)
|
|
446
|
+
]
|
|
447
|
+
}, undefined, true, undefined, this),
|
|
448
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Select, {
|
|
449
|
+
options,
|
|
450
|
+
onChange: onSelect,
|
|
451
|
+
onCancel,
|
|
452
|
+
hideIndexes: true
|
|
453
|
+
}, undefined, false, undefined, this)
|
|
454
|
+
]
|
|
455
|
+
}, undefined, true, undefined, this);
|
|
456
|
+
}
|
|
457
|
+
function EnterpriseUrlInput({
|
|
458
|
+
onSubmit,
|
|
459
|
+
onCancel
|
|
460
|
+
}) {
|
|
461
|
+
const [value, setValue] = import_react3.useState("");
|
|
462
|
+
const [error, setError] = import_react3.useState("");
|
|
463
|
+
use_input_default((input, key) => {
|
|
464
|
+
if (key.escape) {
|
|
465
|
+
onCancel();
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (key.return && value.trim()) {
|
|
469
|
+
const domain = validateEnterpriseUrl(value.trim());
|
|
470
|
+
if (!domain) {
|
|
471
|
+
setError("Please enter a valid URL (e.g., company.ghe.com)");
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
setError("");
|
|
475
|
+
onSubmit(domain);
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
if (key.backspace || key.delete) {
|
|
479
|
+
setValue((v) => v.slice(0, -1));
|
|
480
|
+
setError("");
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
if (input && !key.ctrl && !key.meta) {
|
|
484
|
+
setValue((v) => v + input);
|
|
485
|
+
setError("");
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
489
|
+
flexDirection: "column",
|
|
490
|
+
children: [
|
|
491
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
492
|
+
marginBottom: 1,
|
|
493
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
494
|
+
bold: true,
|
|
495
|
+
children: "Enter your GitHub Enterprise URL or domain"
|
|
496
|
+
}, undefined, false, undefined, this)
|
|
497
|
+
}, undefined, false, undefined, this),
|
|
498
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
499
|
+
children: [
|
|
500
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
501
|
+
children: "URL: "
|
|
502
|
+
}, undefined, false, undefined, this),
|
|
503
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
504
|
+
children: value || "company.ghe.com or https://company.ghe.com"
|
|
505
|
+
}, undefined, false, undefined, this)
|
|
506
|
+
]
|
|
507
|
+
}, undefined, true, undefined, this),
|
|
508
|
+
error && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
509
|
+
marginTop: 1,
|
|
510
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
511
|
+
color: "red",
|
|
512
|
+
children: error
|
|
513
|
+
}, undefined, false, undefined, this)
|
|
514
|
+
}, undefined, false, undefined, this),
|
|
515
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
516
|
+
marginTop: 1,
|
|
517
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
518
|
+
dimColor: true,
|
|
519
|
+
children: "enter confirm esc back"
|
|
520
|
+
}, undefined, false, undefined, this)
|
|
521
|
+
}, undefined, false, undefined, this)
|
|
522
|
+
]
|
|
523
|
+
}, undefined, true, undefined, this);
|
|
524
|
+
}
|
|
525
|
+
function CopilotOAuthFlow({
|
|
526
|
+
domain,
|
|
527
|
+
enterpriseUrl,
|
|
528
|
+
onSuccess,
|
|
529
|
+
onError,
|
|
530
|
+
onCancel
|
|
531
|
+
}) {
|
|
532
|
+
const [status, setStatus] = import_react3.useState("starting");
|
|
533
|
+
const [userCode, setUserCode] = import_react3.useState("");
|
|
534
|
+
const [verificationUri, setVerificationUri] = import_react3.useState("");
|
|
535
|
+
const [errorMessage, setErrorMessage] = import_react3.useState("");
|
|
536
|
+
use_input_default((_input, key) => {
|
|
537
|
+
if (key.escape) {
|
|
538
|
+
onCancel();
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
import_react3.useEffect(() => {
|
|
542
|
+
let cancelled = false;
|
|
543
|
+
async function run() {
|
|
544
|
+
try {
|
|
545
|
+
const result = await startCopilotDeviceAuth(domain, enterpriseUrl);
|
|
546
|
+
if (cancelled)
|
|
547
|
+
return;
|
|
548
|
+
setUserCode(result.userCode);
|
|
549
|
+
setVerificationUri(result.verificationUri);
|
|
550
|
+
setStatus("waiting");
|
|
551
|
+
try {
|
|
552
|
+
const { exec } = await import("child_process");
|
|
553
|
+
exec(`open "${result.verificationUri}"`);
|
|
554
|
+
} catch {}
|
|
555
|
+
const pollResult = await result.poll();
|
|
556
|
+
if (cancelled)
|
|
557
|
+
return;
|
|
558
|
+
if (pollResult.type === "success") {
|
|
559
|
+
onSuccess(pollResult.token, pollResult.enterpriseUrl);
|
|
560
|
+
} else {
|
|
561
|
+
setStatus("error");
|
|
562
|
+
setErrorMessage(pollResult.message);
|
|
563
|
+
onError(pollResult.message);
|
|
564
|
+
}
|
|
565
|
+
} catch (err) {
|
|
566
|
+
if (cancelled)
|
|
567
|
+
return;
|
|
568
|
+
setStatus("error");
|
|
569
|
+
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
570
|
+
setErrorMessage(msg);
|
|
571
|
+
onError(msg);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
run();
|
|
575
|
+
return () => {
|
|
576
|
+
cancelled = true;
|
|
577
|
+
};
|
|
578
|
+
}, [domain, enterpriseUrl]);
|
|
579
|
+
if (status === "starting") {
|
|
580
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
581
|
+
flexDirection: "column",
|
|
582
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
583
|
+
children: "Initiating GitHub authorization..."
|
|
584
|
+
}, undefined, false, undefined, this)
|
|
585
|
+
}, undefined, false, undefined, this);
|
|
586
|
+
}
|
|
587
|
+
if (status === "error") {
|
|
588
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
589
|
+
flexDirection: "column",
|
|
590
|
+
children: [
|
|
591
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
592
|
+
color: "red",
|
|
593
|
+
children: [
|
|
594
|
+
"Authorization failed: ",
|
|
595
|
+
errorMessage
|
|
596
|
+
]
|
|
597
|
+
}, undefined, true, undefined, this),
|
|
598
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
599
|
+
marginTop: 1,
|
|
600
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
601
|
+
dimColor: true,
|
|
602
|
+
children: "esc to go back"
|
|
603
|
+
}, undefined, false, undefined, this)
|
|
604
|
+
}, undefined, false, undefined, this)
|
|
605
|
+
]
|
|
606
|
+
}, undefined, true, undefined, this);
|
|
607
|
+
}
|
|
608
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
609
|
+
flexDirection: "column",
|
|
610
|
+
children: [
|
|
611
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
612
|
+
marginBottom: 1,
|
|
613
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
614
|
+
bold: true,
|
|
615
|
+
children: "GitHub Copilot Authorization"
|
|
616
|
+
}, undefined, false, undefined, this)
|
|
617
|
+
}, undefined, false, undefined, this),
|
|
618
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
619
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
620
|
+
children: [
|
|
621
|
+
"Enter code ",
|
|
622
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
623
|
+
bold: true,
|
|
624
|
+
color: "suggestion",
|
|
625
|
+
children: userCode
|
|
626
|
+
}, undefined, false, undefined, this),
|
|
627
|
+
" at",
|
|
628
|
+
" ",
|
|
629
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
630
|
+
underline: true,
|
|
631
|
+
children: verificationUri
|
|
632
|
+
}, undefined, false, undefined, this)
|
|
633
|
+
]
|
|
634
|
+
}, undefined, true, undefined, this)
|
|
635
|
+
}, undefined, false, undefined, this),
|
|
636
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
637
|
+
marginTop: 1,
|
|
638
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
639
|
+
dimColor: true,
|
|
640
|
+
children: "Waiting for authorization..."
|
|
641
|
+
}, undefined, false, undefined, this)
|
|
642
|
+
}, undefined, false, undefined, this),
|
|
643
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
644
|
+
marginTop: 1,
|
|
645
|
+
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
|
|
646
|
+
dimColor: true,
|
|
647
|
+
children: "esc cancel"
|
|
648
|
+
}, undefined, false, undefined, this)
|
|
649
|
+
}, undefined, false, undefined, this)
|
|
650
|
+
]
|
|
651
|
+
}, undefined, true, undefined, this);
|
|
652
|
+
}
|
|
653
|
+
function ConnectFlow({
|
|
654
|
+
onDone
|
|
655
|
+
}) {
|
|
656
|
+
const [phase, setPhase] = import_react3.useState("pick");
|
|
657
|
+
const [selectedId, setSelectedId] = import_react3.useState(null);
|
|
658
|
+
const [copilotDomain, setCopilotDomain] = import_react3.useState("github.com");
|
|
659
|
+
const [copilotEnterpriseUrl, setCopilotEnterpriseUrl] = import_react3.useState(undefined);
|
|
660
|
+
function handleProviderSelect(providerId) {
|
|
661
|
+
if (providerId === "github-copilot") {
|
|
662
|
+
setSelectedId(providerId);
|
|
663
|
+
setPhase("copilot-deploy");
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
if (providerHasAuth(providerId)) {
|
|
667
|
+
finishConnect(providerId, onDone);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
setSelectedId(providerId);
|
|
671
|
+
setPhase("auth");
|
|
672
|
+
}
|
|
673
|
+
function handleApiKeySubmit(key) {
|
|
674
|
+
if (!selectedId)
|
|
675
|
+
return;
|
|
676
|
+
storeProviderApiKey(selectedId, key);
|
|
677
|
+
finishConnect(selectedId, onDone);
|
|
678
|
+
}
|
|
679
|
+
function handleCancel() {
|
|
680
|
+
if (phase !== "pick") {
|
|
681
|
+
setPhase("pick");
|
|
682
|
+
setSelectedId(null);
|
|
683
|
+
setCopilotDomain("github.com");
|
|
684
|
+
setCopilotEnterpriseUrl(undefined);
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
onDone("Cancelled", { display: "system" });
|
|
688
|
+
}
|
|
689
|
+
if (phase === "copilot-deploy") {
|
|
690
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(CopilotDeployPicker, {
|
|
691
|
+
onSelect: (type) => {
|
|
692
|
+
if (type === "public") {
|
|
693
|
+
setCopilotDomain("github.com");
|
|
694
|
+
setCopilotEnterpriseUrl(undefined);
|
|
695
|
+
setPhase("copilot-oauth");
|
|
696
|
+
} else {
|
|
697
|
+
setPhase("copilot-enterprise-url");
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
onCancel: handleCancel
|
|
701
|
+
}, undefined, false, undefined, this);
|
|
702
|
+
}
|
|
703
|
+
if (phase === "copilot-enterprise-url") {
|
|
704
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(EnterpriseUrlInput, {
|
|
705
|
+
onSubmit: (domain) => {
|
|
706
|
+
setCopilotDomain(domain);
|
|
707
|
+
setCopilotEnterpriseUrl(domain);
|
|
708
|
+
setPhase("copilot-oauth");
|
|
709
|
+
},
|
|
710
|
+
onCancel: handleCancel
|
|
711
|
+
}, undefined, false, undefined, this);
|
|
712
|
+
}
|
|
713
|
+
if (phase === "copilot-oauth") {
|
|
714
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(CopilotOAuthFlow, {
|
|
715
|
+
domain: copilotDomain,
|
|
716
|
+
enterpriseUrl: copilotEnterpriseUrl,
|
|
717
|
+
onSuccess: (token, entUrl) => {
|
|
718
|
+
storeProviderOAuthToken("github-copilot", token, entUrl);
|
|
719
|
+
finishConnect("github-copilot", onDone);
|
|
720
|
+
},
|
|
721
|
+
onError: () => {},
|
|
722
|
+
onCancel: handleCancel
|
|
723
|
+
}, undefined, false, undefined, this);
|
|
724
|
+
}
|
|
725
|
+
if (phase === "auth" && selectedId) {
|
|
726
|
+
const name = BUILTIN_PROVIDERS[selectedId]?.name ?? selectedId;
|
|
727
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ApiKeyInput, {
|
|
728
|
+
providerId: selectedId,
|
|
729
|
+
providerName: name,
|
|
730
|
+
onSubmit: handleApiKeySubmit,
|
|
731
|
+
onCancel: handleCancel
|
|
732
|
+
}, undefined, false, undefined, this);
|
|
733
|
+
}
|
|
734
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ProviderPicker, {
|
|
735
|
+
onSelect: handleProviderSelect,
|
|
736
|
+
onCancel: handleCancel
|
|
737
|
+
}, undefined, false, undefined, this);
|
|
738
|
+
}
|
|
739
|
+
var import_react3, jsx_dev_runtime3, call = async (onDone, _context, _args) => {
|
|
740
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ConnectFlow, {
|
|
741
|
+
onDone
|
|
742
|
+
}, undefined, false, undefined, this);
|
|
743
|
+
};
|
|
744
|
+
var init_connect = __esm(() => {
|
|
745
|
+
init_source();
|
|
746
|
+
init_ink();
|
|
747
|
+
init_CustomSelect();
|
|
748
|
+
init_ProviderPicker();
|
|
749
|
+
init_ApiKeyInput();
|
|
750
|
+
init_presets();
|
|
751
|
+
init_state();
|
|
752
|
+
init_router();
|
|
753
|
+
init_copilot_auth();
|
|
754
|
+
import_react3 = __toESM(require_react(), 1);
|
|
755
|
+
jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
|
756
|
+
});
|
|
757
|
+
init_connect();
|
|
758
|
+
|
|
759
|
+
export {
|
|
760
|
+
call
|
|
761
|
+
};
|