Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0241c3e6b | ||
|
|
d8b1ade0ea | ||
|
|
0b04915694 | ||
|
|
40cb8329e6 | ||
|
|
d88d3a7829 | ||
|
|
646ceef400 | ||
|
|
b741c439e9 | ||
|
|
a29917297b | ||
|
|
d3f61fc925 | ||
|
|
e3302b694c | ||
|
|
a7ea27d047 | ||
|
|
53be957861 | ||
|
|
e6ec1fd86a | ||
|
|
08065bd061 | ||
|
|
159a3b218e | ||
|
|
46758c9787 | ||
|
|
91fe656204 | ||
|
|
67c79b9dc5 | ||
|
|
53f6f99433 | ||
|
|
cea7a0f4e3 | ||
|
|
f4ae033c97 | ||
|
|
1c2396bb52 | ||
|
|
3da810d19a | ||
|
|
1b3542d77c | ||
|
|
1c3edd9f4a | ||
|
|
c603b98c2b | ||
|
|
fbc6545d85 | ||
|
|
20fda28fb4 | ||
|
|
469fd38420 | ||
|
|
0b80a392e7 | ||
|
|
f9da6dcb0a | ||
|
|
16a0799176 | ||
|
|
ff5fa96583 | ||
|
|
3e205f7335 | ||
|
|
056e4d8edf | ||
|
|
fcdcbfc174 | ||
|
|
85687a4ab7 | ||
|
|
388a7a127d | ||
|
|
e040fdb330 | ||
|
|
81929c06da | ||
|
|
d548446ce8 | ||
|
|
852642d5ee | ||
|
|
371bfc3528 | ||
|
|
9cf230cc40 | ||
|
|
de8d8cc432 | ||
|
|
3d853cb295 | ||
|
|
8fc58e0806 | ||
|
|
1e4ba8f4c7 | ||
|
|
950e484af6 | ||
|
|
9167f0a416 | ||
|
|
3af8992d23 | ||
|
|
9332a5eac8 | ||
|
|
9fddf15d2a | ||
|
|
f793af5a12 | ||
|
|
1436721c3e | ||
|
|
5f48b13144 | ||
|
|
fc9616026b | ||
|
|
a2a4fba626 | ||
|
|
3595d47a9d | ||
|
|
82a00093b6 | ||
|
|
3a828bb14c | ||
|
|
c93f57a02a | ||
|
|
dd0d99e64b | ||
|
|
96f28fc5d5 | ||
|
|
85f6a29477 | ||
|
|
13a1fbe946 | ||
|
|
1f82eedbef | ||
|
|
d9e5506949 | ||
|
|
6628e20d8c | ||
|
|
64e2a43259 | ||
|
|
febd409cca | ||
|
|
23e9dda036 | ||
|
|
af4affc150 | ||
|
|
bd11f5372d | ||
|
|
98247b0b8d | ||
|
|
691aeb78fe | ||
|
|
cc0156f28c | ||
|
|
6d89800038 | ||
|
|
165de06c69 | ||
|
|
b402506252 | ||
|
|
4a13c2e269 | ||
|
|
8ad863a4a2 | ||
|
|
08fb275fb6 | ||
|
|
a445780e43 | ||
|
|
3d26dbadb0 | ||
|
|
8e1acbf5d0 | ||
|
|
a0b068756c | ||
|
|
960422f715 | ||
|
|
6d47c30305 | ||
|
|
dfd2e09898 | ||
|
|
0af0ad14e5 | ||
|
|
a82585ba21 | ||
|
|
6ffc26271c | ||
|
|
dd41652e99 | ||
|
|
f4f66ad0d3 | ||
|
|
cf558dd166 | ||
|
|
4cf25c05ce | ||
|
|
064f2e6b8d | ||
|
|
9ee4e17e6d | ||
|
|
9809985f91 | ||
|
|
a987b9fb83 | ||
|
|
7fd8acef64 | ||
|
|
85bf0bc9e0 | ||
|
|
e94805c460 | ||
|
|
81f6c044f2 | ||
|
|
ef84773394 | ||
|
|
1a78f65cb0 | ||
|
|
90625182f3 | ||
|
|
346d8d3fb6 | ||
|
|
182b46bb5d | ||
|
|
f55574adcf | ||
|
|
38e7f28233 | ||
|
|
6c0c0b3a44 | ||
|
|
a6e817b72f | ||
|
|
7e3df456a5 | ||
|
|
9861bf3ded | ||
|
|
93e2e03793 | ||
|
|
bc3bea72f3 | ||
|
|
9eece2ea2a | ||
|
|
1f1160eb07 | ||
|
|
2f72e9801a | ||
|
|
3e4dccf857 | ||
|
|
4491089ad1 | ||
|
|
7cc4e9d8f5 | ||
|
|
75ca091a73 | ||
|
|
8927e6b71d | ||
|
|
ef60b1cd7e | ||
|
|
3986099409 | ||
|
|
b4fd299fce | ||
|
|
b5077879d0 | ||
|
|
861c4c29d9 | ||
|
|
0db83010aa | ||
|
|
977c5c18ad | ||
|
|
0801d1d101 | ||
|
|
993e6795c0 | ||
|
|
4ba0a04c37 | ||
|
|
006bd54c9a | ||
|
|
af48e0f37b | ||
|
|
2f6fee08d4 | ||
|
|
35b033ae06 | ||
|
|
d9b3f07db3 | ||
|
|
4a3996ca5c | ||
|
|
459997789e | ||
|
|
29f0da4942 | ||
|
|
39796063c5 | ||
|
|
a7fa518584 | ||
|
|
8473211ad6 | ||
|
|
4527e5a7e5 | ||
|
|
acdf099442 | ||
|
|
1c9ade20f8 | ||
|
|
787af1fb12 | ||
|
|
070ddb0ff5 | ||
|
|
ae7946402a | ||
|
|
a7b7856135 | ||
|
|
c73b709a98 | ||
|
|
63e54f2ca4 | ||
|
|
ac2d6df45e | ||
|
|
6756600812 | ||
|
|
3a00e35a5a | ||
|
|
cb25c754ea | ||
|
|
a8592c8410 | ||
|
|
9e53fc4540 | ||
|
|
e17990c2f8 | ||
|
|
71a502075e | ||
|
|
bcd735b2a8 | ||
|
|
584648416a | ||
|
|
41b1ad654e | ||
|
|
7d1dc22657 | ||
|
|
6b85dadce7 | ||
|
|
24626d061d | ||
|
|
3fc5b5a3b3 | ||
|
|
357eed3ec6 | ||
|
|
d6104a0fca | ||
|
|
45ba3b9c3f | ||
|
|
92bf72d8c5 | ||
|
|
1fa155621b | ||
|
|
1663148a32 | ||
|
|
1d29f18172 | ||
|
|
5be8c90506 | ||
|
|
377697331b | ||
|
|
e86d2b86d5 | ||
|
|
3fb213d513 | ||
|
|
e0fa10b669 | ||
|
|
4a0f8232d5 | ||
|
|
3d4b723fb3 | ||
|
|
5428a0ad74 | ||
|
|
02b0714e3a | ||
|
|
94088ea1de | ||
|
|
e6e7e6db30 | ||
|
|
f528639f1c | ||
|
|
5dd078ffb3 | ||
|
|
8d8a010577 | ||
|
|
27b25bc0d7 | ||
|
|
5a38b6bc04 | ||
|
|
f1d05cc027 | ||
|
|
e80b531d68 | ||
|
|
8d737adaf1 | ||
|
|
513594deb4 | ||
|
|
de766d80b3 | ||
|
|
eead4d59f4 | ||
|
|
f030ec3384 | ||
|
|
22f91dc48e | ||
|
|
ed136fef5d | ||
|
|
630102632f | ||
|
|
2e490cf8f2 | ||
|
|
7beb9b788a | ||
|
|
e845700b9e | ||
|
|
2913c4a20e | ||
|
|
cb53b9ca2a | ||
|
|
3127555850 | ||
|
|
31ca3a2d93 | ||
|
|
4c3d538979 | ||
|
|
4d14eeb608 | ||
|
|
7fc975198d | ||
|
|
629bdad1c9 | ||
|
|
f2eabe57c5 | ||
|
|
a2d701b205 | ||
|
|
7b22c4fd4d | ||
|
|
e277e0f413 | ||
|
|
aab559c781 | ||
|
|
c83da30d3d | ||
|
|
4d33b21446 | ||
|
|
e11daa1b39 | ||
|
|
d77af50d66 | ||
|
|
2d1c2070a9 | ||
|
|
f415504d35 | ||
|
|
522f0e5c89 | ||
|
|
d6dd24e2b7 | ||
|
|
2d73c520cb | ||
|
|
daa3e91278 | ||
|
|
291b69ced1 | ||
|
|
6b2dbf6840 | ||
|
|
8a822b1f05 | ||
|
|
dc05446bf0 | ||
|
|
16dc9c7101 | ||
|
|
45289603b9 | ||
|
|
53d28c9ec0 | ||
|
|
33fbfa7b53 | ||
|
|
193b240b31 | ||
|
|
ef8088f7db | ||
|
|
e8a6269a45 | ||
|
|
a09a23380e | ||
|
|
5f8941b407 | ||
|
|
e1b58ba16e | ||
|
|
68cfd33685 | ||
|
|
a493e9c115 | ||
|
|
3f0c29e275 | ||
|
|
b654a19a09 | ||
|
|
0420fd0046 | ||
|
|
46ad228707 | ||
|
|
741333697e | ||
|
|
d3b5b0017f | ||
|
|
9f5eb93f64 | ||
|
|
baf72225a5 | ||
|
|
01e1d5aed2 | ||
|
|
19bf935a2e | ||
|
|
fd9d097b8e | ||
|
|
4bf4256e3f | ||
|
|
95bbb4d7f3 | ||
|
|
a9cef821f9 | ||
|
|
a1620c5cb0 | ||
|
|
2465a8fff1 | ||
|
|
f0568a5c20 | ||
|
|
63da07d1f1 | ||
|
|
7157230427 | ||
|
|
bcdbba5f76 | ||
|
|
9679f69b81 | ||
|
|
8ddaa140af | ||
|
|
34f9bbd56e | ||
|
|
cddccdd5cb | ||
|
|
06c41e1a00 | ||
|
|
092cef6fa3 | ||
|
|
7806419df5 | ||
|
|
ff5a078229 | ||
|
|
e2894fa447 | ||
|
|
d9500d4961 | ||
|
|
ab2be5d03c | ||
|
|
0761e2b695 | ||
|
|
db647820c9 | ||
|
|
8c991a8ed3 | ||
|
|
123fd00c0a | ||
|
|
b87fe4580d | ||
|
|
aeff3e8c09 | ||
|
|
3a8fac2514 | ||
|
|
283e8cfb52 | ||
|
|
854bd25940 | ||
|
|
f42cadf459 | ||
|
|
b4a54444d8 | ||
|
|
6990e769ea | ||
|
|
69ba18a095 | ||
|
|
8b9f5ebe00 | ||
|
|
65e243ec1b | ||
|
|
fce1e62aa4 | ||
|
|
bc3d89d958 | ||
|
|
5d9d4328f9 | ||
|
|
b02b3c32ce | ||
|
|
616cde1a0f | ||
|
|
d2efc1dd8e | ||
|
|
86470c8274 | ||
|
|
5fdb0ff618 | ||
|
|
f9f4425147 | ||
|
|
dc0685561e | ||
|
|
0551a8bd18 | ||
|
|
33be41ba03 | ||
|
|
d317728d93 | ||
|
|
c8176cddab | ||
|
|
30978f1f17 | ||
|
|
1f3e82af04 | ||
|
|
093e77c8c0 | ||
|
|
4dd917ff31 | ||
|
|
43f625caf1 | ||
|
|
c33d299137 | ||
|
|
5930e6b8c4 | ||
|
|
3531191944 | ||
|
|
b9ccbfb107 | ||
|
|
fecc80de5f | ||
|
|
3abcc42139 | ||
|
|
b17f421233 | ||
|
|
d8eb507d6f | ||
|
|
7c87e241fb | ||
|
|
3d9e0cb89b | ||
|
|
99c4d3ccc3 | ||
|
|
e5aec4a28e | ||
|
|
5f7ebd40fe | ||
|
|
36621166c8 | ||
|
|
e15a091615 | ||
|
|
ad5c8112cb | ||
|
|
50b540fcae | ||
|
|
2ad425588f | ||
|
|
e099c1dc0b | ||
|
|
10013ad979 | ||
|
|
556fac1667 | ||
|
|
1b0394bf55 | ||
|
|
c720fad57b | ||
|
|
aafbdb9c46 | ||
|
|
76c52e1a47 | ||
|
|
0ffee090d0 | ||
|
|
fd71a01aa7 | ||
|
|
2796512cb3 | ||
|
|
289871da14 | ||
|
|
336359c9d7 | ||
|
|
06684b81ef | ||
|
|
f0a7040b00 | ||
|
|
64358ecfd8 | ||
|
|
0ce9661a88 | ||
|
|
e01aeda3de | ||
|
|
de5098f8aa | ||
|
|
2219bc04e4 | ||
|
|
94ef02e19d | ||
|
|
f5b7aaf9ae | ||
|
|
35018f2e43 | ||
|
|
6d4e3ceb29 | ||
|
|
6982a4cc31 | ||
|
|
bd7575ca2b | ||
|
|
27036f44a2 | ||
|
|
3f737dc3c7 | ||
|
|
23a1fa749c | ||
|
|
e01976448c | ||
|
|
6e53bdade9 | ||
|
|
7d90fda663 | ||
|
|
93a0643466 | ||
|
|
dd113e5077 | ||
|
|
e20343eeec | ||
|
|
738cd4d365 | ||
|
|
244782281c | ||
|
|
1e803c918c | ||
|
|
3bf998591e | ||
|
|
bff94bd739 | ||
|
|
4f65198207 | ||
|
|
6737add91e | ||
|
|
470a371295 | ||
|
|
8e18f36d96 | ||
|
|
baa38a6420 | ||
|
|
b7cd41110e | ||
|
|
6fe6d743bd | ||
|
|
ea371ccfc6 | ||
|
|
7b58cdc5a6 | ||
|
|
d103729baf | ||
|
|
edacca735a | ||
|
|
3d8fe7d4e9 | ||
|
|
83160e11a7 | ||
|
|
594c830a39 | ||
|
|
cea2b82ffc | ||
|
|
8f0165f743 | ||
|
|
936cb0a873 | ||
|
|
4206d57bd9 | ||
|
|
b8ffbab975 | ||
|
|
9583beadb8 | ||
|
|
4827af9b48 | ||
|
|
710a2dc3bc | ||
|
|
2125f99650 | ||
|
|
997ea17f88 | ||
|
|
ffb7ae1b41 | ||
|
|
4f32ceac9b | ||
|
|
3e8d6e3c92 | ||
|
|
0da9aa6cd3 | ||
|
|
7afc014c0e | ||
|
|
1a85ba0e17 | ||
|
|
891a52c5de | ||
|
|
f7ae19d960 | ||
|
|
ad355f75a7 | ||
|
|
48c4cbcdf7 | ||
|
|
e6ea4295ab | ||
|
|
ea41ba8980 | ||
|
|
75cf72720c | ||
|
|
58035e8499 | ||
|
|
15bd80da7c | ||
|
|
9777997886 | ||
|
|
d02a63311c | ||
|
|
5ab8b5adf3 | ||
|
|
1e48d75aa8 | ||
|
|
233eb30219 | ||
|
|
e372d2220b | ||
|
|
551c664564 | ||
|
|
21101c7a03 | ||
|
|
5099678f17 | ||
|
|
b1653fc6d0 | ||
|
|
d3aa7ece4e | ||
|
|
f2c51915f0 | ||
|
|
ecbe4424cb | ||
|
|
cae634a64f | ||
|
|
42063d9f2a | ||
|
|
33eefe2ec3 | ||
|
|
3ca0cccc75 | ||
|
|
e590a2e7c7 | ||
|
|
a1ca0ddcb8 | ||
|
|
c6661972b1 | ||
|
|
e0756a566c | ||
|
|
89bafc418c | ||
|
|
ff0dea6cd6 | ||
|
|
cb4a7e0bbf | ||
|
|
310fd1f202 | ||
|
|
2a8565467b | ||
|
|
7d1b514a2e | ||
|
|
7fdbb17d47 | ||
|
|
4511e2a589 | ||
|
|
60582b647e | ||
|
|
e663c9d395 | ||
|
|
a20c4cefdc | ||
|
|
efda335476 | ||
|
|
833a560ae1 | ||
|
|
1a3c4ec586 | ||
|
|
50b453adc0 | ||
|
|
7d70539d80 | ||
|
|
1878476f76 | ||
|
|
9c19023a39 | ||
|
|
70f292a8c8 | ||
|
|
75a9908a3b | ||
|
|
f780519ee6 | ||
|
|
7457183dd1 | ||
|
|
8822013a74 | ||
|
|
bc30977567 | ||
|
|
0fb4f42ffb | ||
|
|
d8165d05d9 | ||
|
|
0b448f7aa7 | ||
|
|
91b13504f8 | ||
|
|
ffc608b7fe | ||
|
|
9e1cd7a61d | ||
|
|
277e66c542 | ||
|
|
9a2363d6bd | ||
|
|
352095c54c | ||
|
|
009fbb2a37 | ||
|
|
7d11a35a16 | ||
|
|
9cdce5e8d8 | ||
|
|
7d9a114bf8 | ||
|
|
82f02c6d59 | ||
|
|
096daa30a7 | ||
|
|
5b11c113fb | ||
|
|
b127b674e9 | ||
|
|
6163489aca | ||
|
|
0b12eafe6c | ||
|
|
e89a0f5fcb | ||
|
|
c7d06a3ace | ||
|
|
81848357c4 | ||
|
|
74319cd89e | ||
|
|
018cba3491 | ||
|
|
a6da22f391 | ||
|
|
8ae32d440a | ||
|
|
26a17c7456 | ||
|
|
d0c29cb584 | ||
|
|
0f5836e14b | ||
|
|
e96d568671 | ||
|
|
21125722cd | ||
|
|
3e47344da9 | ||
|
|
31e52f26e8 | ||
|
|
3cf08319d4 | ||
|
|
b1a4bede65 | ||
|
|
6cfd29ff1d | ||
|
|
2874e52a2a | ||
|
|
40c46acc08 | ||
|
|
d8eb83c8fd | ||
|
|
5de9cfa8ea | ||
|
|
185dcc46dd | ||
|
|
705039b410 | ||
|
|
782e3f26a5 | ||
|
|
25e73af418 | ||
|
|
ceec470273 | ||
|
|
bbcf06f163 | ||
|
|
00c64b3bcb | ||
|
|
24467aa957 | ||
|
|
68cf672e6b | ||
|
|
d9f67d1a8a | ||
|
|
7e8863b45b | ||
|
|
2ccbba05e5 | ||
|
|
5c60aea115 | ||
|
|
0a5b2f1fc0 | ||
|
|
8dd850241a | ||
|
|
3ee272620e | ||
|
|
6a1038871f | ||
|
|
2c09998780 | ||
|
|
9c91f3c511 | ||
|
|
281ac2e0ba | ||
|
|
2e7b68922a | ||
|
|
bb562e3d36 | ||
|
|
3f8366de1a | ||
|
|
f4a2ac6962 | ||
|
|
d014612bd6 | ||
|
|
f7b02ce207 | ||
|
|
9e2f45fcf5 | ||
|
|
95eb896831 | ||
|
|
660c0f7656 | ||
|
|
aca1f54478 | ||
|
|
c10abab37c | ||
|
|
d71582d7d8 | ||
|
|
f3bc99cc35 | ||
|
|
923f3f68b7 | ||
|
|
0e03289627 | ||
|
|
7631297204 | ||
|
|
3e3d0bf933 | ||
|
|
c6d8e6abb1 | ||
|
|
9fb39ff966 | ||
|
|
e08235b4d1 | ||
|
|
7a5fd20272 | ||
|
|
b37551edd8 | ||
|
|
39c7c6760a | ||
|
|
7e13a0dfdd | ||
|
|
9394166777 | ||
|
|
a6ea590cce | ||
|
|
7329675592 | ||
|
|
cab21a5089 | ||
|
|
c4701abb00 | ||
|
|
7b3ef0ea43 | ||
|
|
5a9c652f48 | ||
|
|
715c71830e | ||
|
|
aab8294d96 | ||
|
|
59e947e8a8 | ||
|
|
2617902571 | ||
|
|
270a176925 | ||
|
|
f4e7d5b92e | ||
|
|
eb84cbe543 | ||
|
|
e71648f4b6 | ||
|
|
1b5bd183b9 | ||
|
|
095718e31e | ||
|
|
abe7597d99 | ||
|
|
01cd7942b5 | ||
|
|
b669cfa650 | ||
|
|
c53fabd3a8 | ||
|
|
4ceed0428b | ||
|
|
462856639c | ||
|
|
b75ef23d5c | ||
|
|
8e236dd69d | ||
|
|
20146a1f7d | ||
|
|
b5b6d65e79 | ||
|
|
12aa47b91c | ||
|
|
5ce65eed85 | ||
|
|
e75e5716e9 | ||
|
|
d519feeba1 | ||
|
|
f1f8e2c1a6 | ||
|
|
bd893efee9 | ||
|
|
18757ebe7c | ||
|
|
09e96a45ca | ||
|
|
8e729276b0 | ||
|
|
1a1c85f043 | ||
|
|
9e187cd08f | ||
|
|
a8c389ffa6 | ||
|
|
999529c154 | ||
|
|
355932e138 | ||
|
|
d3466b31af | ||
|
|
f19594e490 | ||
|
|
946cc75e71 | ||
|
|
93c0b8703c | ||
|
|
0dda5a01a2 | ||
|
|
572792f2c6 | ||
|
|
12ac05a22f | ||
|
|
af37fbf2e0 | ||
|
|
f52bc59b2e | ||
|
|
5cf7518f26 | ||
|
|
6767188a8e | ||
|
|
7cbbf954d6 | ||
|
|
6e8f055816 | ||
|
|
87dbbedd4b | ||
|
|
a84e59f31c | ||
|
|
ca06786892 | ||
|
|
25dd8b2087 | ||
|
|
57d5b4b1b1 | ||
|
|
f80e1bb068 | ||
|
|
d68f32f00e | ||
|
|
221a386040 | ||
|
|
f52840b10e | ||
|
|
036beb061a | ||
|
|
98d5650d55 | ||
|
|
c141565eae | ||
|
|
8696d57ca6 | ||
|
|
9eeeb88e35 | ||
|
|
d407c7c779 | ||
|
|
b354ff8a21 | ||
|
|
b7a8424238 | ||
|
|
4b44ab8328 | ||
|
|
3e4cf30ee3 | ||
|
|
4dbe6f88eb | ||
|
|
612d0b6e26 | ||
|
|
cf8b2dcc85 | ||
|
|
8e24d9dc34 | ||
|
|
8c8cae63d7 | ||
|
|
8c14135f97 | ||
|
|
f83d2b638a | ||
|
|
3c72b950d3 | ||
|
|
a6eecfb8d5 | ||
|
|
f97ef1f2a3 | ||
|
|
53918b4c92 | ||
|
|
b402979a3f | ||
|
|
719027f4e9 | ||
|
|
5d2848d951 | ||
|
|
02fd226098 | ||
|
|
7d3d5ccbb4 | ||
|
|
baf03f07b8 | ||
|
|
7c8e9f39c9 | ||
|
|
2f43e94ec2 | ||
|
|
d39b7b3e4f | ||
|
|
ed57d82bc1 | ||
|
|
7af5a90a0b | ||
|
|
7551faff79 | ||
|
|
cdb9c2e6e8 | ||
|
|
6b80ec79a0 | ||
|
|
d3f4783a24 | ||
|
|
1cb6bdbc87 | ||
|
|
96ddfc1f24 | ||
|
|
c169b32570 | ||
|
|
36a512fdf2 | ||
|
|
ee6fc4e8a1 | ||
|
|
8fee16aecd | ||
|
|
e592a57458 | ||
|
|
a862984dca | ||
|
|
f0365f0465 | ||
|
|
349b2ba3af | ||
|
|
98db5aabd0 | ||
|
|
7fd98f3556 | ||
|
|
e8de87ee90 | ||
|
|
6c7f18c448 | ||
|
|
97356b1a04 | ||
|
|
b1aecc2bf1 | ||
|
|
f52114dab2 | ||
|
|
12370ee84e | ||
|
|
5f65dd5bb4 | ||
|
|
e755e567ea | ||
|
|
db491c8f9b | ||
|
|
293cc8c1a3 | ||
|
|
5418bbc338 | ||
|
|
e23e0fb137 | ||
|
|
00b8fc07cf | ||
|
|
8fac6b147a | ||
|
|
5f118810a9 | ||
|
|
7be4b683d7 | ||
|
|
98917aa3eb | ||
|
|
5c464f116f | ||
|
|
1a405d7976 | ||
|
|
9fa18f5c8b | ||
|
|
57eae651d3 | ||
|
|
f56cfdd6a2 | ||
|
|
ff7088ee8f | ||
|
|
d96d9e0b8e | ||
|
|
d9b9863dab | ||
|
|
3b4b44d113 | ||
|
|
ed9c9c8ec6 | ||
|
|
e4ac6390f5 | ||
|
|
b0989c08cd | ||
|
|
d44aadd1fc | ||
|
|
348609a93f | ||
|
|
33cf877a15 | ||
|
|
40722131ee | ||
|
|
e505267093 | ||
|
|
ae506ce66e | ||
|
|
8da2bae873 | ||
|
|
406f8849b0 | ||
|
|
a31a7eac0c | ||
|
|
40d78908ed | ||
|
|
e76aacf5ec | ||
|
|
f019f43879 | ||
|
|
56fa81f3c6 | ||
|
|
035da8b358 | ||
|
|
82f2a5d7be | ||
|
|
b6de9e41d7 | ||
|
|
2e21fb75d5 | ||
|
|
d7d1d06451 | ||
|
|
88224aab1a | ||
|
|
03209b35c0 | ||
|
|
843316ea7a | ||
|
|
0c4c7556c9 | ||
|
|
377e92542e | ||
|
|
17a18845a8 | ||
|
|
f107680796 | ||
|
|
87d14940a7 | ||
|
|
e21b21b187 | ||
|
|
2913fb220a | ||
|
|
b23106ee91 | ||
|
|
e0a7f37d2d | ||
|
|
607abf2338 | ||
|
|
b8f6781bb8 | ||
|
|
ba2f9121ae | ||
|
|
a782c70d47 | ||
|
|
2413b8de46 | ||
|
|
44f66d2257 | ||
|
|
3b51a0fe12 | ||
|
|
2d91c2a3f5 | ||
|
|
b8866d91e7 | ||
|
|
4ea5586b6f | ||
|
|
e3af8783b9 | ||
|
|
15a2aa92ad | ||
|
|
b914a84e72 | ||
|
|
57473ec3c6 | ||
|
|
cacd2301b3 | ||
|
|
4807312802 | ||
|
|
6e466e9823 | ||
|
|
3e0aac0a9c | ||
|
|
dd83e3ae2c | ||
|
|
39a5a0ac24 | ||
|
|
654f48dc9a | ||
|
|
60c270bd56 | ||
|
|
c2118c28c9 | ||
|
|
f022b151c2 | ||
|
|
428b1f04c1 | ||
|
|
626f501f49 | ||
|
|
893c43ae30 | ||
|
|
423e24211a | ||
|
|
cd1a61a8a5 | ||
|
|
35e139bb3d | ||
|
|
358f7a6439 | ||
|
|
9812ab3fb4 | ||
|
|
99eb979353 | ||
|
|
24edfc63ff | ||
|
|
70dd0cd283 | ||
|
|
c3b058a7af | ||
|
|
0f646800f6 | ||
|
|
ca993238f3 | ||
|
|
cf9a246d53 | ||
|
|
54acd69e9d | ||
|
|
d687ee2777 | ||
|
|
54c2fefbad | ||
|
|
f7b17ee6ec | ||
|
|
408614c74c | ||
|
|
b540106287 | ||
|
|
3336d15282 | ||
|
|
6c39925728 | ||
|
|
dc17f8f600 | ||
|
|
2151171175 | ||
|
|
e2fe9f2403 | ||
|
|
a2e1849032 | ||
|
|
8a570a471b | ||
|
|
0155a01bb1 | ||
|
|
cfeee5d511 | ||
|
|
10e0ea1309 | ||
|
|
7bef161e7e | ||
|
|
4cc8d086ff | ||
|
|
c5d64d807a | ||
|
|
2f5bb3a501 | ||
|
|
34082f2eef | ||
|
|
1d000affec | ||
|
|
03da5113c3 | ||
|
|
0a74cf7efb | ||
|
|
e1b9fa0a36 | ||
|
|
11b994cd14 | ||
|
|
9471a0d9ee | ||
|
|
80e383098f | ||
|
|
ce03ba863b | ||
|
|
72be557be8 | ||
|
|
d23af0518d | ||
|
|
efb6965ef3 | ||
|
|
e57cfdffb2 | ||
|
|
944f70aedb | ||
|
|
1d2a9f6b5e | ||
|
|
6c3df69ded | ||
|
|
e7678e4ab8 | ||
|
|
29bb32ccfd | ||
|
|
932f40b13f | ||
|
|
1548b30abb | ||
|
|
d219b04b69 | ||
|
|
7eeb81293b | ||
|
|
9bd149e6dd | ||
|
|
3bff4ed6f1 | ||
|
|
206897308f | ||
|
|
90b3eabc68 | ||
|
|
6f1cb57908 | ||
|
|
ee8bbb3aa8 | ||
|
|
d8e55c7318 | ||
|
|
d4c3f6fcad | ||
|
|
7649532c4a | ||
|
|
d3ca1218c5 | ||
|
|
bc38faa2ad | ||
|
|
0d6e1e6037 | ||
|
|
aa42fc0ee7 | ||
|
|
be88c3c9b2 | ||
|
|
755291cef8 | ||
|
|
52d5bd83f2 | ||
|
|
b1b30d10ea | ||
|
|
ef732615a4 | ||
|
|
2b53dbb09c | ||
|
|
3167b12f0c | ||
|
|
ed30fd6f63 | ||
|
|
13d1ba7137 | ||
|
|
1fd1dc26da | ||
|
|
462a70541e | ||
|
|
2407c1f4af | ||
|
|
5a576264dd | ||
|
|
22313d9cd7 | ||
|
|
e7e1b26f11 | ||
|
|
f9859ff6f3 | ||
|
|
4c95db775e | ||
|
|
7f260eb15e | ||
|
|
024bc25b2c | ||
|
|
b91ee8d008 | ||
|
|
92c62bb2fb | ||
|
|
344066fd11 | ||
|
|
bcb8092488 | ||
|
|
1efade8bdb | ||
|
|
99e9ff1ad6 | ||
|
|
f957b8948c | ||
|
|
cd0b14dd2d | ||
|
|
894703a484 | ||
|
|
e2950408bc | ||
|
|
d6aff12ace | ||
|
|
52f4d23c85 | ||
|
|
d7eacf9524 | ||
|
|
4303412761 | ||
|
|
d0da29f954 | ||
|
|
153d2bec96 | ||
|
|
2298be6958 | ||
|
|
6558cbbc0a | ||
|
|
d08a2453f7 | ||
|
|
3f53eea1e0 | ||
|
|
f3d1cc8dc1 | ||
|
|
e889efeda7 | ||
|
|
0a3a95521c | ||
|
|
4ebaf6f7a9 | ||
|
|
59ac1a3f60 | ||
|
|
923a5d6efb | ||
|
|
734b7e42ad | ||
|
|
10e77fcf24 | ||
|
|
bbb21d7c2b | ||
|
|
c46099c5d7 | ||
|
|
407020de0c | ||
|
|
4b4cd108ce | ||
|
|
188de4ff2a | ||
|
|
8fb1f114bc | ||
|
|
6a4cff6699 | ||
|
|
de0ea3ac49 | ||
|
|
12116b018d | ||
|
|
c3ed3b40ea | ||
|
|
b80c2aabb0 | ||
|
|
e73b9e10a6 | ||
|
|
9c04c18c04 | ||
|
|
81ae09d0ec | ||
|
|
01cf221167 | ||
|
|
7ecc7aabda | ||
|
|
79033aee34 | ||
|
|
92ca5078c1 | ||
|
|
aca8523060 | ||
|
|
1ea0cff3a4 | ||
|
|
75793a18f0 | ||
|
|
58866b21cb | ||
|
|
db80b20bc2 | ||
|
|
05b499fb83 | ||
|
|
ba6aa5fbbe | ||
|
|
75ce0919a0 | ||
|
|
7f4f6bc9ca | ||
|
|
54d4fd7f84 | ||
|
|
8dc690a638 | ||
|
|
fdeb84db2b | ||
|
|
84920cb670 | ||
|
|
204bba9dea | ||
|
|
35fdd7bc05 | ||
|
|
6a94afab6c | ||
|
|
218dc17713 | ||
|
|
28469576bf | ||
|
|
40e7f066e4 | ||
|
|
ef0edbfe69 | ||
|
|
242b4d5754 | ||
|
|
4ce7c61a17 | ||
|
|
69fccf0015 | ||
|
|
6133bac226 | ||
|
|
f302be5ce6 | ||
|
|
cd4e84a360 | ||
|
|
4360ed8a7b | ||
|
|
b27a175fef | ||
|
|
8d5f89ccfd | ||
|
|
084e2666cb | ||
|
|
2eb2dbb266 | ||
|
|
7758a86d1e | ||
|
|
9f72a875f8 | ||
|
|
f999650322 | ||
|
|
38319b0483 | ||
|
|
af543238aa | ||
|
|
2de27c560b | ||
|
|
773ed6cc64 | ||
|
|
a594338bc5 | ||
|
|
1fd1ccca17 | ||
|
|
1fa5514d56 | ||
|
|
c353606860 | ||
|
|
2ba31ecc2d | ||
|
|
36380846a7 | ||
|
|
608cd8ee3d | ||
|
|
9f41894573 | ||
|
|
ab9e9442ec | ||
|
|
6b49580716 | ||
|
|
0d4f32a881 | ||
|
|
1770c491db | ||
|
|
a0c6cffb0d | ||
|
|
2bf9e08b31 | ||
|
|
f56bfaa689 | ||
|
|
5d716dc796 | ||
|
|
f81ff16022 | ||
|
|
68cbe20664 | ||
|
|
15353a6b6a | ||
|
|
04f0070a80 | ||
|
|
239fc4a8c4 | ||
|
|
df91408919 | ||
|
|
aa6c7facab | ||
|
|
8ba4c7c7ed | ||
|
|
a4804b358f | ||
|
|
b73e53d6c4 | ||
|
|
b06463c6d9 | ||
|
|
5eb8453e91 | ||
|
|
f77c22e6ff | ||
|
|
df83ba877f | ||
|
|
9583f6b1c5 | ||
|
|
02d8a1cfec | ||
|
|
92f033dec0 | ||
|
|
4b01ecba2e | ||
|
|
f241124599 | ||
|
|
aa810ee719 | ||
|
|
5d2baf6058 | ||
|
|
d138df07bf | ||
|
|
691cdb6bdf | ||
|
|
8064cba288 | ||
|
|
f8aba62860 | ||
|
|
e24af6e545 | ||
|
|
48dd987867 | ||
|
|
6b60bdd139 | ||
|
|
8a98506a15 | ||
|
|
dcd0ff834e | ||
|
|
a6fa622aca | ||
|
|
6ee95b18f7 | ||
|
|
8afcc710d4 | ||
|
|
4419b71699 | ||
|
|
43cac7b5f6 | ||
|
|
c6ecdf4a7e | ||
|
|
838f47a7e9 | ||
|
|
5b01eba943 | ||
|
|
8203bf64ec | ||
|
|
52e5551d8f | ||
|
|
0087eecad8 | ||
|
|
fa087eeefa | ||
|
|
1a9f939eac | ||
|
|
7515090cb6 | ||
|
|
2c296e9cb1 | ||
|
|
efd28bf981 | ||
|
|
3a9ac7ef33 |
@@ -4,6 +4,25 @@
|
||||
# NOTE: Environment variables are only required when using remote storage options.
|
||||
# For local file-based storage (default), no environment variables need to be set.
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Anchor Summaries (heuristic long-session memory)
|
||||
# ------------------------------------------------------------------------------
|
||||
# CLIPROXY_ANCHOR_SUMMARY_MAX_CHARS=14000
|
||||
# CLIPROXY_ANCHOR_APPEND_ONLY=1
|
||||
# CLIPROXY_MEMORY_MAX_WRITES_PER_MIN=120
|
||||
# CLIPROXY_MEMORY_EXPORT_MAX_BYTES=262144000
|
||||
# CLIPROXY_MEMORY_MAX_AGE_DAYS=0
|
||||
# CLIPROXY_MEMORY_MAX_SESSIONS=0
|
||||
# CLIPROXY_MEMORY_MAX_BYTES_PER_SESSION=0
|
||||
# CLIPROXY_SEMANTIC_RERANK=1
|
||||
# CLIPROXY_SEMANTIC_KEYWORD_BOOST=0.25
|
||||
# CLIPROXY_SEMANTIC_RECENCY_BOOST=0.15
|
||||
# CLIPROXY_SEMANTIC_MAX_AGE_DAYS=0
|
||||
# CLIPROXY_SEMANTIC_MAX_NAMESPACES=0
|
||||
# CLIPROXY_SEMANTIC_MAX_BYTES_PER_NAMESPACE=0
|
||||
# CLIPROXY_SEMANTIC_MAX_WRITES_PER_MIN=120
|
||||
# CLIPROXY_SEMANTIC_QUERY_MAX_CHARS=512
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Management Web UI
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
cargo fetch --manifest-path rust/Cargo.toml
|
||||
if [ ! -f rust/proxypilot-rs.toml ]; then
|
||||
cargo run --manifest-path rust/Cargo.toml -p proxypilot-rs -- init --config rust/proxypilot-rs.toml
|
||||
fi
|
||||
@@ -0,0 +1,86 @@
|
||||
# Architecture
|
||||
|
||||
High-level system guidance for the Rust terminal operator-console slice.
|
||||
|
||||
**What belongs here:** module boundaries, state ownership, data flow, invariants, and where workers should add new behavior.
|
||||
**What does not belong here:** low-level implementation diffs or line-by-line rewrite plans.
|
||||
|
||||
---
|
||||
|
||||
## Current Rust Entry Points
|
||||
|
||||
- `rust/proxypilot-rs/src/main.rs` wires CLI entrypoints.
|
||||
- `cli.rs` defines command surfaces.
|
||||
- `accounts.rs` handles CLI account operations against disk-backed account state.
|
||||
- `config.rs` loads TOML config and resolves the state-file path.
|
||||
- `state.rs` owns persisted local account state.
|
||||
- `codex.rs` owns Codex device login and refresh-token exchange logic.
|
||||
- `proxy.rs` owns the local HTTP proxy process and current in-memory proxy state.
|
||||
- `tui.rs` owns the terminal operator console.
|
||||
|
||||
## State Layers
|
||||
|
||||
There are three distinct state layers in this mission. Workers must keep them separate and truthful:
|
||||
|
||||
1. **Config state**
|
||||
- Loaded from TOML via `config.rs`
|
||||
- Includes bind address, state-file path, upstream base URL, and fallback API key
|
||||
|
||||
2. **Saved local account state**
|
||||
- Loaded and saved through `state.rs`
|
||||
- Used by CLI account commands and by the TUI for disk-backed account visibility and local actions
|
||||
|
||||
3. **Live runtime state**
|
||||
- Lives inside the running proxy process
|
||||
- Includes the adopted active credential, request counters, refresh attempts/results, and any runtime-auth summary shown by `/v0/runtime/stats`
|
||||
- Must not silently re-read disk on every stats request and pretend disk changes already altered runtime memory
|
||||
|
||||
## Desired Shared Domain for This Mission
|
||||
|
||||
This milestone should create a small shared auth/runtime domain used by both proxy and TUI-facing logic. It should own:
|
||||
|
||||
- RFC3339 parsing / clock helpers
|
||||
- auth-health classification with the shared vocabulary:
|
||||
- `valid`
|
||||
- `expiring_soon`
|
||||
- `expired`
|
||||
- `static`
|
||||
- `unknown`
|
||||
- refresh outcome/status types
|
||||
- runtime stats snapshot types for `/v0/runtime/stats`
|
||||
|
||||
The goal is to remove duplicated auth/time decision logic currently spread across `proxy.rs` and `tui.rs`.
|
||||
|
||||
## Runtime Stats Surface
|
||||
|
||||
`GET /v0/runtime/stats` is a read-only local operator endpoint.
|
||||
|
||||
It should expose runtime-memory state for:
|
||||
- bind address
|
||||
- upstream base URL
|
||||
- active account name
|
||||
- account count
|
||||
- auth-health summary
|
||||
- request counters
|
||||
- last runtime refresh status
|
||||
- last runtime refresh timestamp
|
||||
|
||||
This endpoint is the runtime source of truth for the TUI's operator-health panels.
|
||||
|
||||
## TUI Composition Model
|
||||
|
||||
The TUI should combine two inputs:
|
||||
|
||||
- **Disk-backed local state** for account list, selected-account details, and local account actions
|
||||
- **Runtime stats HTTP data** for live auth/runtime visibility
|
||||
|
||||
This split is intentional. The UI must stay truthful if local saved state and running runtime state diverge.
|
||||
|
||||
## Mission Invariants
|
||||
|
||||
- The branch remains Codex-only for this mission.
|
||||
- The TUI remains terminal-first and should become more operator-console-like, not more dashboard-like.
|
||||
- Runtime counters are in-memory only and reset when the proxy process restarts.
|
||||
- `R` targets the active account runtime action; `f` targets the selected saved account action.
|
||||
- `r` reloads local/disk and runtime surfaces; `c` clears transient feedback only.
|
||||
- Empty states and failures must stay readable and operator-meaningful.
|
||||
@@ -0,0 +1,27 @@
|
||||
# Environment
|
||||
|
||||
Environment variables, external dependencies, and setup notes.
|
||||
|
||||
**What belongs here:** required env vars, local setup notes, external dependency expectations, and fixture guidance.
|
||||
**What does not belong here:** service start/stop commands or fixed ports outside explanatory notes.
|
||||
|
||||
---
|
||||
|
||||
## External Dependencies
|
||||
|
||||
- No external database, cache, or queue is required for this mission.
|
||||
- No live Codex/OpenAI credentials are required for baseline automated validation.
|
||||
- Use mocked local HTTP fixtures for upstream proxy and refresh-token flows unless the user explicitly expands scope to live credentials.
|
||||
|
||||
## Local Config Notes
|
||||
|
||||
- The Rust slice uses a TOML config and a separate state file.
|
||||
- Run `./.factory/init.sh` to fetch Rust dependencies and create `rust/proxypilot-rs.toml` if it is missing before local smoke validation.
|
||||
- Workers may generate temporary local configs for smoke validation.
|
||||
- Relative state-file paths resolve relative to the chosen config file path.
|
||||
|
||||
## Local Runtime Notes
|
||||
|
||||
- The default Rust bind is `127.0.0.1:8318`.
|
||||
- Keep runtime observability surfaces on the same local Rust proxy process.
|
||||
- Avoid unrelated busy ports already present on the machine.
|
||||
@@ -0,0 +1,97 @@
|
||||
# User Testing
|
||||
|
||||
Validation guidance for the Rust terminal operator-console mission.
|
||||
|
||||
**What belongs here:** validation surfaces, tools, setup notes, and concurrency guidance.
|
||||
**What does not belong here:** service command definitions (use `.factory/services.yaml`).
|
||||
|
||||
---
|
||||
|
||||
## Validation Surface
|
||||
|
||||
### HTTP runtime surface
|
||||
- Endpoints:
|
||||
- `GET /healthz`
|
||||
- `GET /v0/runtime/stats`
|
||||
- supported local Codex proxy routes touched by runtime tracking
|
||||
- Primary tools:
|
||||
- `curl`
|
||||
- Rust mocked endpoint tests
|
||||
- Validation focus:
|
||||
- local health identity
|
||||
- runtime stats schema and semantics
|
||||
- request counters
|
||||
- proactive refresh
|
||||
- 401 retry refresh
|
||||
- refresh failure tracking
|
||||
|
||||
### TUI surface
|
||||
- Command:
|
||||
- `cargo run -p proxypilot-rs -- tui --config <path>`
|
||||
- Primary tools:
|
||||
- `tuistory`
|
||||
- manual local smoke when needed
|
||||
- Validation focus:
|
||||
- runtime/auth visibility
|
||||
- truthful footer/help text
|
||||
- local account visibility when runtime is down
|
||||
- reload, clear feedback, selected refresh, active refresh-now
|
||||
- readable empty/error states
|
||||
|
||||
### CLI/account surface
|
||||
- Commands:
|
||||
- `init`
|
||||
- `account add-codex`
|
||||
- `account list`
|
||||
- `account activate`
|
||||
- `account remove`
|
||||
- `account refresh-codex`
|
||||
- Primary tools:
|
||||
- shell
|
||||
- Validation focus:
|
||||
- config creation semantics
|
||||
- disk-backed account lifecycle semantics
|
||||
- refreshable vs static-account behavior
|
||||
|
||||
## Validation Concurrency
|
||||
|
||||
- Automated Rust validation activities: max `2` concurrent
|
||||
- rationale: machine has ample memory/CPU, but Rust tests plus local mocked listener flows should stay conservative
|
||||
- Manual TUI validation: max `1` at a time
|
||||
- rationale: interactive terminal verification is not realistically parallel and should not overlap with another heavy manual runtime smoke
|
||||
|
||||
## Setup Notes
|
||||
|
||||
- Baseline automated validation does not require live external credentials.
|
||||
- Prefer mocked local upstream and refresh fixtures for HTTP/runtime tests.
|
||||
- TUI validation requires a local config file and usually a running local Rust proxy for runtime-visible scenarios.
|
||||
- Proxy-down scenarios are also required: validators should verify local disk-backed account visibility when runtime is unreachable.
|
||||
|
||||
## Flow Validator Guidance: shell
|
||||
- Use only `.factory/validation/terminal-operator-console/user-testing/fixtures/cli-shell/` plus `/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/`.
|
||||
- Use temporary config/state files inside that fixture directory; do not modify repo-root default configs.
|
||||
- Stay on CLI/account flows only; do not start long-lived proxy services from this fixture.
|
||||
- Do not use live device-login. Prefer `init`, `account add-codex`, `account list`, `account activate`, `account remove`, and negative-path `account refresh-codex` checks against local fixture state.
|
||||
- If refresh-success validation cannot be isolated without live OpenAI OAuth, record it as blocked with concrete evidence rather than using private credentials.
|
||||
|
||||
|
||||
## Flow Validator Guidance: curl
|
||||
- Use only `.factory/validation/terminal-operator-console/user-testing/fixtures/http-runtime/` plus `/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/`.
|
||||
- Own ports `18318-18339` for this validator only. Keep the proxy on `127.0.0.1:18318` unless a collision forces another port in that range.
|
||||
- Mock the Codex upstream locally; never send `/v1/*` validation traffic to the real OpenAI upstream.
|
||||
- Auth-refresh success paths may be blocked if the running binary cannot be pointed at a local OAuth token stub. Failure-path validation with intentionally invalid refresh tokens is allowed if it stays within the assigned fixture.
|
||||
- Capture before/after `curl` output for stats-changing requests so counter deltas are explicit.
|
||||
|
||||
|
||||
## Flow Validator Guidance: tuistory
|
||||
- Use only `.factory/validation/terminal-operator-console/user-testing/fixtures/tui-console/` plus `/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/`.
|
||||
- Run only one TUI session at a time.
|
||||
- Own ports `18418-18439` for proxy/mock services used by this validator. Keep runtime-down scenarios fully local by stopping those fixture services instead of touching shared ports.
|
||||
- Keep disk-backed state isolated to the assigned fixture config/state files so reload, activate, delete, and refresh actions are attributable to this validator alone.
|
||||
- Capture snapshots before and after each key flow (`r`, `a`, `d`, `f`, `R`, `c`) and note whether feedback came from local disk state or live runtime stats.
|
||||
|
||||
## Discovered Validation Quirks
|
||||
|
||||
- CLI `account refresh-codex` and runtime-triggered refresh paths now honor `codex.refresh_token_url` when set, so validators can redirect refresh success to a local stub from the real user surface while still relying on the built-in OpenAI OAuth endpoint when the override is unset.
|
||||
- `tuistory` sessions should be closed explicitly after the TUI exits with `q`; the PTY can remain allocated even after the binary terminates.
|
||||
- In runtime-down TUI scenarios, selected-account refresh (`f`) still attempts the hardwired OAuth refresh exchange for refreshable saved accounts and surfaces that remote failure text. Treat that as truthful runtime-dependent behavior, not as loss of local disk state.
|
||||
@@ -0,0 +1,16 @@
|
||||
commands:
|
||||
install: cargo fetch --manifest-path rust/Cargo.toml
|
||||
init: ./.factory/init.sh
|
||||
fmt: cargo fmt --all --manifest-path rust/Cargo.toml
|
||||
test: cargo test --manifest-path rust/Cargo.toml
|
||||
typecheck: cargo check --manifest-path rust/Cargo.toml
|
||||
lint: cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings
|
||||
tui-help: cargo run --manifest-path rust/Cargo.toml -p proxypilot-rs -- tui --help
|
||||
|
||||
services:
|
||||
proxypilot-rs:
|
||||
start: cargo run --manifest-path rust/Cargo.toml -p proxypilot-rs -- run --config rust/proxypilot-rs.toml
|
||||
stop: lsof -ti :8318 | xargs -r kill
|
||||
healthcheck: curl -sf http://127.0.0.1:8318/healthz
|
||||
port: 8318
|
||||
depends_on: []
|
||||
@@ -0,0 +1,89 @@
|
||||
---
|
||||
name: rust-operator-worker
|
||||
description: Implement Rust terminal-operator-console features for proxypilot-rs with test-first discipline and truthful runtime/TUI verification.
|
||||
---
|
||||
|
||||
# Rust Operator Worker
|
||||
|
||||
NOTE: Startup and cleanup are handled by `worker-base`. This skill defines the WORK PROCEDURE.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Use for features in the Rust replatform slice that touch `proxypilot-rs` runtime/auth logic, local HTTP observability, CLI/account coherence, or the terminal operator console.
|
||||
|
||||
## Required Skills
|
||||
|
||||
- `tdd` — invoke before implementation to drive failing tests first for new runtime/auth/TUI helper behavior.
|
||||
- `tuistory` — invoke when manually validating terminal operator-console behavior.
|
||||
- `verification-before-completion` — invoke before claiming the feature is complete so evidence matches the actual commands and outputs.
|
||||
|
||||
## Work Procedure
|
||||
|
||||
1. Read `mission.md`, `validation-contract.md`, mission `AGENTS.md`, and `.factory/library/*.md` relevant to the feature before editing.
|
||||
2. Confirm which validation assertions the feature fulfills and restate them in your notes.
|
||||
3. Write or update failing Rust tests first (red) for the feature's intended behavior before changing implementation.
|
||||
4. Implement the smallest Rust changes needed to make those tests pass while preserving the mission boundaries:
|
||||
- keep the work inside the Rust replatform slice unless docs are explicitly part of the feature
|
||||
- prefer shared auth/runtime helpers over duplicating logic
|
||||
- keep runtime-memory state distinct from disk-backed saved state
|
||||
5. Run focused checks during iteration, then the required final validators:
|
||||
- `cargo fmt --all --manifest-path rust/Cargo.toml`
|
||||
- `cargo test --manifest-path rust/Cargo.toml`
|
||||
6. If the feature affects the TUI or runtime observability surface, perform manual verification with `tuistory` or equivalent local smoke and capture what changed on screen or via local HTTP output.
|
||||
7. Review the changed files for truthfulness of operator-visible wording, especially where runtime state and disk state can diverge.
|
||||
8. Produce a handoff that cites exact commands, tests added, interactive checks, and any discovered gaps.
|
||||
|
||||
## Example Handoff
|
||||
|
||||
```json
|
||||
{
|
||||
"salientSummary": "Added a shared auth-health/runtime model plus `/v0/runtime/stats`, then wired the TUI runtime panel to the new stats surface. Ran fmt/tests successfully and manually verified runtime counters plus active-account refresh feedback in the terminal UI.",
|
||||
"whatWasImplemented": "Created a shared runtime/auth module for auth-health classification and refresh status, extended proxy state with in-memory counters and last refresh metadata, added GET /v0/runtime/stats with stable fields, and updated the TUI to render runtime stats while keeping disk-backed account controls separate.",
|
||||
"whatWasLeftUndone": "",
|
||||
"verification": {
|
||||
"commandsRun": [
|
||||
{
|
||||
"command": "cargo fmt --all --manifest-path rust/Cargo.toml",
|
||||
"exitCode": 0,
|
||||
"observation": "Formatting completed without changes needed after final pass."
|
||||
},
|
||||
{
|
||||
"command": "cargo test --manifest-path rust/Cargo.toml",
|
||||
"exitCode": 0,
|
||||
"observation": "Workspace tests passed, including new runtime stats and auth-health cases."
|
||||
}
|
||||
],
|
||||
"interactiveChecks": [
|
||||
{
|
||||
"action": "Launched proxypilot-rs TUI against a local fixture config, pressed `r`, `R`, and `c`, and inspected the runtime/auth panel.",
|
||||
"observed": "Runtime counters and last refresh outcome became visible, active-account refresh targeted the active account even when another row was selected, and clear-feedback only cleared the transient status line."
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": {
|
||||
"added": [
|
||||
{
|
||||
"file": "rust/proxypilot-rs/src/proxy.rs",
|
||||
"cases": [
|
||||
{
|
||||
"name": "runtime_stats_reset_after_restart",
|
||||
"verifies": "In-memory runtime stats start empty on fresh process start and do not persist across restarts."
|
||||
},
|
||||
{
|
||||
"name": "runtime_stats_reports_401_refresh_path_once",
|
||||
"verifies": "A single client request that triggers 401 and retry increments upstream 401 and refresh counters without double-counting total proxied requests."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"discoveredIssues": []
|
||||
}
|
||||
```
|
||||
|
||||
## When to Return to Orchestrator
|
||||
|
||||
- The feature requires changing mission boundaries or touching non-Rust product surfaces outside the approved scope.
|
||||
- The intended behavior cannot be implemented truthfully without clarifying runtime-vs-disk ownership semantics.
|
||||
- A required local validation path cannot be exercised because config/fixtures/runtime setup is missing or broken.
|
||||
- The feature reveals a larger refactor is needed than fits a single worker session.
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"featureId": "cli-state-runtime-truthfulness-and-docs",
|
||||
"reviewedAt": "2026-04-05T10:54:50.137470Z",
|
||||
"commitId": "1c2396bb",
|
||||
"transcriptSkeletonReviewed": true,
|
||||
"diffReviewed": true,
|
||||
"status": "fail",
|
||||
"codeReview": {
|
||||
"summary": "Reviewed feature commit 1c2396bb together with the directly relevant follow-up fixes f4ae033c and cea7a0f4. CLI wording, docs alignment, static-account refresh errors, and runtime-vs-disk refresh targeting are much clearer after those changes, but the TUI footer layout still prevents the new explanatory copy from being visible.",
|
||||
"issues": [
|
||||
{
|
||||
"file": "rust/proxypilot-rs/src/tui.rs",
|
||||
"line": 389,
|
||||
"severity": "blocking",
|
||||
"description": "The footer block is still allocated `Constraint::Length(3)` even though it now renders four content lines (feedback, selected-account hint, runtime status hint, and key help) inside a bordered paragraph at lines 523-534. In ratatui that height leaves room for only a single inner text row, so the newly added runtime/disk guidance and keybinding help are clipped off-screen. That means the feature does not actually make the cross-surface behavior explicit to operators, and docs/tests now describe footer copy that users cannot see."
|
||||
}
|
||||
]
|
||||
},
|
||||
"sharedStateObservations": [
|
||||
{
|
||||
"area": "skills",
|
||||
"observation": "TUI copy changes in this mission need a visibility check, not just string-helper tests. The current worker skill and tests verified footer text helpers, but they did not verify that the fixed-height footer block can actually render the added lines.",
|
||||
"evidence": "rust/proxypilot-rs/src/tui.rs:389 keeps the footer at `Constraint::Length(3)` while rust/proxypilot-rs/src/tui.rs:523-534 renders four lines; the added tests at rust/proxypilot-rs/src/tui.rs:770-842 assert string content only and do not exercise visible layout fit."
|
||||
}
|
||||
],
|
||||
"addressesFailureFrom": null,
|
||||
"summary": "Fail: the reviewed feature and its direct follow-up fixes improved CLI/runtime truthfulness, but the TUI footer's fixed height still clips the newly added selected-account/runtime hints and key help, so an operator cannot see the copy intended to explain runtime-vs-disk divergence."
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"featureId": "fix-runtime-account-count-semantics",
|
||||
"reviewedAt": "2026-04-05T11:36:06.651055Z",
|
||||
"commitId": "91fe6562",
|
||||
"transcriptSkeletonReviewed": true,
|
||||
"diffReviewed": true,
|
||||
"status": "pass",
|
||||
"codeReview": {
|
||||
"summary": "Reviewed the original runtime-stats feature (`1b3542d7`), the prior scrutiny finding, and the fix commit (`91fe6562`). The fix resolves the remaining non-blocking truthfulness issue: `/v0/runtime/stats.account_count` now counts only runtime-usable Codex accounts, mixed-provider and blank-key entries no longer inflate that value, and the TUI wording matches the runtime semantics.",
|
||||
"issues": []
|
||||
},
|
||||
"sharedStateObservations": [
|
||||
{
|
||||
"area": "skills",
|
||||
"observation": "The worker skipped the rust-operator-worker skill's required manual `tuistory` verification even though the feature touched TUI-visible runtime wording. For this fix the unit-level wording assertion was likely sufficient, but the skill currently leaves that lightweight label-only case undocumented.",
|
||||
"evidence": "Skill procedure step 6 requires manual verification with `tuistory` when the feature affects the TUI or runtime observability surface (`/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/skills/rust-operator-worker/SKILL.md`). The handoff for session `38bb865f-5bfd-4b20-8a75-281170e69c06` records `followedProcedure: false` and says manual TUI verification was skipped in favor of unit tests because the change was only label alignment."
|
||||
}
|
||||
],
|
||||
"addressesFailureFrom": "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/scrutiny/reviews/proxy-runtime-stats-surface.json",
|
||||
"summary": "Pass. The follow-up fix closes the prior `account_count` truthfulness gap and I found no new code issues in the scoped change."
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"featureId": "fix-runtime-auth-health-and-date-validation",
|
||||
"reviewedAt": "2026-04-05T10:53:54.938311Z",
|
||||
"commitId": "f4ae033c97c0912c03c0a0eaa9b14a2aeb696f8f",
|
||||
"transcriptSkeletonReviewed": true,
|
||||
"diffReviewed": true,
|
||||
"status": "pass",
|
||||
"codeReview": {
|
||||
"summary": "Reviewed commit `f4ae033c97c0912c03c0a0eaa9b14a2aeb696f8f` against the feature requirements and worker handoff. The implementation now rejects impossible RFC3339 calendar dates in `auth_runtime::parse_rfc3339_z`, classifies malformed impossible expiry metadata as `unknown`, and recomputes `/v0/runtime/stats` auth health from the live in-memory account state after proactive and 401-triggered refresh mutations. The targeted regressions in `auth_runtime.rs` and `proxy.rs` cover invalid leap-day/month-end inputs plus successful and failed refresh paths, and I found no remaining high-confidence correctness issues in scope.",
|
||||
"issues": []
|
||||
},
|
||||
"sharedStateObservations": [],
|
||||
"addressesFailureFrom": null,
|
||||
"summary": "Pass. The reviewed fix closes the two reported blockers: impossible RFC3339 calendar dates no longer parse as valid expiries, and proxy runtime stats now report refreshed auth health truthfully after runtime credential mutations."
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"featureId": "fix-tui-footer-and-passive-polling",
|
||||
"reviewedAt": "2026-04-05T11:36:55Z",
|
||||
"commitId": "67c79b9dc5755305448c33df5cb1d761f150bece",
|
||||
"transcriptSkeletonReviewed": true,
|
||||
"diffReviewed": true,
|
||||
"status": "fail",
|
||||
"codeReview": {
|
||||
"summary": "Reviewed the fix commit together with both prior failed reviews (`terminal-tui-operator-console` and `cli-state-runtime-truthfulness-and-docs`). The passive-polling blocker is resolved: idle polling now stays on `/healthz` + `/v0/runtime/stats`, and the new regression test proves it no longer calls `/v1/models`. However, the footer visibility blocker is only partially fixed: the panel now fits the four nominal footer lines, but realistic long feedback still wraps and pushes the help text back out of view.",
|
||||
"issues": [
|
||||
{
|
||||
"file": "rust/proxypilot-rs/src/tui.rs",
|
||||
"line": 396,
|
||||
"severity": "blocking",
|
||||
"description": "The footer still has a fixed height of `Constraint::Length(6)`, which leaves only four inner text rows once the bordered `Keys` block is rendered (`tui.rs:530-543`). That is enough only when the feedback line stays on a single row. But routine operator messages in this same file are much longer\u2014for example the `runtime_refresh_target` failure text at `tui.rs:701-708` is 131 characters before account-name variation, so in the worker's own 120-column verification geometry it wraps to two rows. When that happens, one of the status/help lines is clipped again, so the feature does not fully satisfy the prior blocker of keeping all footer/help guidance visible. The added snapshot test (`tui.rs:943-975`) only exercises a short `Feedback line`, so it misses this realistic wrapped-feedback path."
|
||||
}
|
||||
]
|
||||
},
|
||||
"sharedStateObservations": [
|
||||
{
|
||||
"area": "skills",
|
||||
"observation": "The shared Rust operator-worker guidance still does not tell workers to exercise long, wrapped operator feedback when validating fixed-height TUI regions. That omission helped this fix reintroduce a footer-visibility edge case even though the worker followed the documented procedure and added a snapshot test.",
|
||||
"evidence": "`rust-operator-worker` step 6/7 asks for manual TUI verification and truthful operator-visible wording review, but it does not call out wrap/line-budget checks for fixed-height panels (`/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/skills/rust-operator-worker/SKILL.md`). In this fix, the new regression test in `rust/proxypilot-rs/src/tui.rs:943-975` only uses a one-line `Feedback line`, while the production footer can render much longer routine messages such as `runtime_refresh_target` at `tui.rs:701-708`."
|
||||
}
|
||||
],
|
||||
"addressesFailureFrom": "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/scrutiny/reviews/terminal-tui-operator-console.json; /home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/scrutiny/reviews/cli-state-runtime-truthfulness-and-docs.json",
|
||||
"summary": "Fail. The fix successfully stops passive idle polling from contaminating runtime telemetry, but the footer/help blocker is not fully resolved because long, routine feedback messages can still wrap and hide guidance in the fixed-height footer."
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"featureId": "fix-tui-footer-wrap-visibility",
|
||||
"reviewedAt": "2026-04-05T12:02:30Z",
|
||||
"commitId": "159a3b21",
|
||||
"transcriptSkeletonReviewed": true,
|
||||
"diffReviewed": true,
|
||||
"status": "pass",
|
||||
"codeReview": {
|
||||
"summary": "Reviewed the prior failed fix (`fix-tui-footer-and-passive-polling`) alongside the rerun fix commit `159a3b21`, the worker handoff, and the transcript skeleton. This rerun fully addresses the remaining footer-wrap blocker: the TUI now sizes the footer from its wrapped content instead of a fixed six-row region, and the regression test was updated to use the same long runtime-active-account failure wording that previously exposed clipping.",
|
||||
"issues": []
|
||||
},
|
||||
"sharedStateObservations": [],
|
||||
"addressesFailureFrom": "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/scrutiny/reviews/fix-tui-footer-and-passive-polling.json",
|
||||
"summary": "Pass. The rerun replaces the fixed-height footer with content-based sizing and adds realistic long-message regression coverage, so the prior footer-wrap visibility failure is adequately resolved."
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"featureId": "fix-tui-runtime-truthfulness",
|
||||
"reviewedAt": "2026-04-05T10:51:50.745826Z",
|
||||
"commitId": "cea7a0f4",
|
||||
"transcriptSkeletonReviewed": true,
|
||||
"diffReviewed": true,
|
||||
"status": "pass",
|
||||
"codeReview": {
|
||||
"summary": "The TUI change now drives `R` from the runtime stats active account, preserves truthful runtime-unavailable and missing-runtime-active feedback, and relabels runtime-memory account counts so they are no longer presented as disk state. The scoped tests cover the new runtime-vs-disk selection logic and wording, and I found no high-confidence correctness issues in the reviewed change.",
|
||||
"issues": []
|
||||
},
|
||||
"sharedStateObservations": [
|
||||
{
|
||||
"area": "skills",
|
||||
"observation": "Mission worker guidance does not explain that mission artifacts may live outside the repo under `/home/fsos/.factory/missions/<id>`. The reviewed worker initially tried repo-relative mission paths and hit ENOENT before switching to the absolute mission directory.",
|
||||
"evidence": "The transcript skeleton for worker session `da34164d-4575-44bf-b059-608a68652407` shows failed reads of `/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/{mission.md,validation-contract.md,AGENTS.md}` followed by successful reads from `/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/...`; `rust-operator-worker` step 1 requires reading mission artifacts but does not document this path fallback."
|
||||
}
|
||||
],
|
||||
"addressesFailureFrom": null,
|
||||
"summary": "Pass. Commit `cea7a0f4` resolves the reviewed TUI truthfulness blockers: `R` now follows runtime-active state from `/v0/runtime/stats`, runtime-unavailable cases remain explicit without hiding disk-backed state, and the runtime count label no longer claims to be disk-backed."
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"featureId": "proxy-runtime-stats-surface",
|
||||
"reviewedAt": "2026-04-05T10:57:26.499831Z",
|
||||
"commitId": "1b3542d77c125df31d091f052ca872237c5932c6",
|
||||
"transcriptSkeletonReviewed": true,
|
||||
"diffReviewed": true,
|
||||
"status": "pass",
|
||||
"codeReview": {
|
||||
"summary": "Reviewed the original runtime-stats implementation commit (`1b3542d7`) plus the directly relevant follow-up fix commit (`f4ae033c`). The feature now satisfies the core HTTP contract: `/v0/runtime/stats` is local-only, counters stay in memory and reset on restart, supported proxied requests are counted once per client request, proactive and 401-triggered refresh outcomes are surfaced, and post-refresh auth health is recomputed truthfully. I found one remaining non-blocking truthfulness gap in mixed-provider saved state.",
|
||||
"issues": [
|
||||
{
|
||||
"file": "rust/proxypilot-rs/src/proxy.rs",
|
||||
"line": 105,
|
||||
"severity": "non_blocking",
|
||||
"description": "`account_count` reports `accounts.accounts.len()`, which counts every saved entry loaded into memory, not just runtime-usable Codex accounts. That becomes untruthful in mixed-provider state because `AccountState` only treats `provider == \"codex\"` entries as active/refreshable (`rust/proxypilot-rs/src/state.rs:153`, `rust/proxypilot-rs/src/state.rs:170`, `rust/proxypilot-rs/src/state.rs:300`), while imported auth preserves arbitrary `provider_type` values from disk (`rust/proxypilot-rs/src/state.rs:232`). A non-Codex imported entry will inflate `/v0/runtime/stats.account_count` even though the runtime cannot actually use it."
|
||||
}
|
||||
]
|
||||
},
|
||||
"sharedStateObservations": [
|
||||
{
|
||||
"area": "conventions",
|
||||
"observation": "This feature updated `docs/rust-replatform.md` even though the mission guidance says only docs-alignment work should touch that file. The rule exists, but the worker still crossed it in the runtime-stats feature commit.",
|
||||
"evidence": "Mission AGENTS says `Docs ownership: only features explicitly scoped to docs alignment should update docs/rust-replatform.md or README.md` (`/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/AGENTS.md:59`), while commit `1b3542d7` changes `docs/rust-replatform.md` alongside `rust/proxypilot-rs/src/proxy.rs`."
|
||||
},
|
||||
{
|
||||
"area": "services",
|
||||
"observation": "Runtime-surface smoke verification depends on setup that is not represented in `.factory/services.yaml`: generating a config file and standing up a local mock upstream/refresh server. Workers had to do this ad hoc in the transcript instead of using shared service metadata.",
|
||||
"evidence": "`.factory/services.yaml:8-12` only defines `proxypilot-rs` start/stop/healthcheck. The reviewed worker transcript for session `f8120536-90d3-4124-9b6f-a84412e716f4` shows manual `.factory/init.sh`, temporary config creation, and a background mock HTTP server before the `curl` smoke documented in the handoff `2026-04-05T09-14-14-581Z__proxy-runtime-stats-surface__f8120536-90d3-4124-9b6f-a84412e716f4.json`."
|
||||
}
|
||||
],
|
||||
"addressesFailureFrom": null,
|
||||
"summary": "Pass with one non-blocking issue. The runtime stats surface works as intended after the direct follow-up fix, but `account_count` still overstates runtime-usable accounts when saved state contains non-Codex imported entries."
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"featureId": "shared-auth-runtime-domain",
|
||||
"reviewedAt": "2026-04-05T10:52:53.771197Z",
|
||||
"commitId": "1c3edd9f4a2493a2dcd27931a680c359c14c9f43",
|
||||
"transcriptSkeletonReviewed": true,
|
||||
"diffReviewed": true,
|
||||
"status": "pass",
|
||||
"codeReview": {
|
||||
"summary": "The feature successfully extracted shared auth/runtime primitives into `auth_runtime.rs` and both proxy and TUI consumers were moved onto the shared RFC3339 parsing, auth-health classification, and runtime snapshot types. The only blocking correctness gap from the original commit (impossible calendar dates being accepted, plus stale runtime auth-health after refresh) was addressed by the directly relevant follow-up fix `f4ae033c`, so there are no remaining high-confidence issues in this review scope.",
|
||||
"issues": []
|
||||
},
|
||||
"sharedStateObservations": [
|
||||
{
|
||||
"area": "skills",
|
||||
"observation": "The worker had to deviate because the mission/bootstrap path guidance pointed at a repo-relative mission directory that did not exist; the recoverable fallback to `/home/fsos/.factory/missions/...` is not captured in the Rust worker guidance.",
|
||||
"evidence": "Handoff `2026-04-05T08-56-54-173Z__shared-auth-runtime-domain__132757c8-6967-4cb2-b929-a387c3429b02.json`: lines 100-115 record `followedProcedure: false` and explicitly ask to clarify handling when bootstrap paths point to a repo-relative mission directory that does not exist."
|
||||
},
|
||||
{
|
||||
"area": "services",
|
||||
"observation": "Local smoke/runtime setup depends on generating `rust/proxypilot-rs.toml` first, but the services manifest only advertises a start command that assumes that file already exists. The canonical setup helper is discoverable only via `.factory/init.sh` rather than the shared service metadata.",
|
||||
"evidence": "`.factory/services.yaml:9` starts proxypilot-rs with `--config rust/proxypilot-rs.toml`, while `.factory/init.sh:6-7` creates that file on demand before smoke validation."
|
||||
}
|
||||
],
|
||||
"addressesFailureFrom": null,
|
||||
"summary": "Reviewed the shared auth/runtime domain commit (`1c3edd9f4a2493a2dcd27931a680c359c14c9f43`), its transcript/handoff, and the directly relevant follow-up fix (`f4ae033c`). Result: pass, with no remaining actionable code defects in scope after the follow-up fix, plus two shared-state observations about mission path guidance and init/service discoverability."
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"featureId": "terminal-tui-operator-console",
|
||||
"reviewedAt": "2026-04-05T18:06:00Z",
|
||||
"commitId": "3da810d19a174aa439f079db9b4fb9ad3a15461e",
|
||||
"transcriptSkeletonReviewed": true,
|
||||
"diffReviewed": true,
|
||||
"status": "fail",
|
||||
"codeReview": {
|
||||
"summary": "Reviewed the original TUI feature commit `3da810d1` plus the directly relevant follow-up fix `cea7a0f4`. The console now shows runtime stats, handles runtime-unavailable cases more explicitly, and `R` now targets the runtime-reported active account, but two blocking truthfulness issues remain in the live console: the footer/help region is clipped by the fixed layout height, and the TUI's own background model polling mutates the runtime counters and refresh state it is supposed to observe.",
|
||||
"issues": [
|
||||
{
|
||||
"file": "rust/proxypilot-rs/src/tui.rs",
|
||||
"line": 389,
|
||||
"severity": "blocking",
|
||||
"description": "The footer block is still allocated `Constraint::Length(3)` while the `Keys` paragraph renders four separate content lines (`feedback`, selected-account hint, runtime hint, and key help at lines 525-532). With a bordered ratatui block that leaves only one inner text row, so the newly added help/runtime guidance is clipped off-screen. The feature therefore does not actually deliver readable, truthful footer/help text in the running console."
|
||||
},
|
||||
{
|
||||
"file": "rust/proxypilot-rs/src/tui.rs",
|
||||
"line": 113,
|
||||
"severity": "blocking",
|
||||
"description": "The idle poll path still calls `refresh_models()` whenever `/healthz` succeeds (`tui.rs:49-50`, `tui.rs:113-121`, `tui.rs:218-220`). That performs a real `GET /v1/models` through the local proxy, and the proxy counts every supported request and may trigger proactive refresh before forwarding (`proxy.rs:143-145`, `proxy.rs:264-267`). As a result, merely leaving the operator console open inflates `total_proxied_requests`/`successful_upstream_responses` and can change `last_refresh`, so the runtime counters and refresh outcome are not a truthful view of external runtime activity."
|
||||
}
|
||||
]
|
||||
},
|
||||
"sharedStateObservations": [
|
||||
{
|
||||
"area": "conventions",
|
||||
"observation": "Mission guidance says only docs-scoped features should edit `docs/rust-replatform.md`, but this TUI feature commit changed that file anyway.",
|
||||
"evidence": "Mission AGENTS `/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/AGENTS.md:59` says `Docs ownership: only features explicitly scoped to docs alignment should update docs/rust-replatform.md or README.md`, while commit `3da810d1` changes `docs/rust-replatform.md` alongside `rust/proxypilot-rs/src/tui.rs`."
|
||||
},
|
||||
{
|
||||
"area": "skills",
|
||||
"observation": "For TUI work, helper-string tests are not enough; shared guidance should explicitly require a layout-fit check for any new multi-line regions.",
|
||||
"evidence": "`rust/proxypilot-rs/src/tui.rs:743-840` tests helper string content, but no test or skill step verifies that those lines fit inside the fixed-height footer/runtime blocks (`tui.rs:387-389`, `tui.rs:523-534`). The worker handoff for session `b1f2df79-2748-4890-a74a-2cb5e38b416c` reported footer/help validation even though the clipped layout remained."
|
||||
}
|
||||
],
|
||||
"addressesFailureFrom": null,
|
||||
"summary": "Fail. The feature and direct `cea7a0f4` follow-up improved runtime visibility and `R` targeting, but the live TUI still hides much of the footer/help copy and its own background polling contaminates the runtime counters and refresh status it displays."
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"milestone": "terminal-operator-console",
|
||||
"round": 3,
|
||||
"status": "pass",
|
||||
"validatorsRun": {
|
||||
"format": {
|
||||
"passed": true,
|
||||
"command": "cargo fmt --all --manifest-path rust/Cargo.toml -- --check",
|
||||
"exitCode": 0
|
||||
},
|
||||
"test": {
|
||||
"passed": true,
|
||||
"command": "cargo test --manifest-path rust/Cargo.toml",
|
||||
"exitCode": 0
|
||||
},
|
||||
"typecheck": {
|
||||
"passed": true,
|
||||
"command": "cargo check --manifest-path rust/Cargo.toml",
|
||||
"exitCode": 0
|
||||
},
|
||||
"lint": {
|
||||
"passed": true,
|
||||
"command": "cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings",
|
||||
"exitCode": 0
|
||||
}
|
||||
},
|
||||
"reviewsSummary": {
|
||||
"total": 1,
|
||||
"passed": 1,
|
||||
"failed": 0,
|
||||
"failedFeatures": []
|
||||
},
|
||||
"blockingIssues": [],
|
||||
"nonBlockingIssues": [],
|
||||
"appliedUpdates": [],
|
||||
"suggestedGuidanceUpdates": [],
|
||||
"rejectedObservations": [],
|
||||
"previousRound": "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/scrutiny/synthesis.round2.json"
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"milestone": "terminal-operator-console",
|
||||
"round": 1,
|
||||
"status": "fail",
|
||||
"validatorsRun": {
|
||||
"format": {
|
||||
"passed": true,
|
||||
"command": "cargo fmt --all --manifest-path rust/Cargo.toml -- --check",
|
||||
"exitCode": 0
|
||||
},
|
||||
"test": {
|
||||
"passed": true,
|
||||
"command": "cargo test --manifest-path rust/Cargo.toml",
|
||||
"exitCode": 0
|
||||
},
|
||||
"typecheck": {
|
||||
"passed": true,
|
||||
"command": "cargo check --manifest-path rust/Cargo.toml",
|
||||
"exitCode": 0
|
||||
},
|
||||
"lint": {
|
||||
"passed": true,
|
||||
"command": "cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings",
|
||||
"exitCode": 0
|
||||
}
|
||||
},
|
||||
"reviewsSummary": {
|
||||
"total": 6,
|
||||
"passed": 4,
|
||||
"failed": 2,
|
||||
"failedFeatures": [
|
||||
"terminal-tui-operator-console",
|
||||
"cli-state-runtime-truthfulness-and-docs"
|
||||
]
|
||||
},
|
||||
"blockingIssues": [
|
||||
{
|
||||
"featureId": "terminal-tui-operator-console",
|
||||
"severity": "blocking",
|
||||
"description": "The TUI footer/help block still uses Constraint::Length(3) while rendering four content lines inside a bordered block, so the selected-account/runtime divergence copy and key help are clipped off-screen. This makes the console fail both the TUI readability contract and the CLI/runtime-truthfulness feature's operator-facing explanation goals."
|
||||
},
|
||||
{
|
||||
"featureId": "terminal-tui-operator-console",
|
||||
"severity": "blocking",
|
||||
"description": "The TUI background polling path still calls GET /v1/models whenever /healthz succeeds, which goes through the proxy and mutates total_proxied_requests, successful_upstream_responses, and potentially last_refresh/auth state. Leaving the console open therefore contaminates the runtime stats it is supposed to observe."
|
||||
}
|
||||
],
|
||||
"nonBlockingIssues": [
|
||||
{
|
||||
"featureId": "proxy-runtime-stats-surface",
|
||||
"severity": "non_blocking",
|
||||
"description": "runtime_stats.account_count currently reports all saved state entries rather than only runtime-usable Codex accounts, so mixed-provider saved state can overstate runtime-usable account count."
|
||||
}
|
||||
],
|
||||
"appliedUpdates": [
|
||||
{
|
||||
"target": "services.yaml",
|
||||
"description": "Added `init`, `typecheck`, and `lint` commands so scrutiny/user-testing workers can bootstrap the Rust slice and run the full validator suite from shared service metadata.",
|
||||
"sourceFeature": "scrutiny-validator-terminal-operator-console"
|
||||
},
|
||||
{
|
||||
"target": "library",
|
||||
"description": "Documented in `.factory/library/environment.md` that `./.factory/init.sh` fetches Rust dependencies and creates `rust/proxypilot-rs.toml` when missing before smoke validation.",
|
||||
"sourceFeature": "shared-auth-runtime-domain"
|
||||
}
|
||||
],
|
||||
"suggestedGuidanceUpdates": [
|
||||
{
|
||||
"target": "rust-operator-worker",
|
||||
"suggestion": "Clarify that mission artifacts may live under `/home/fsos/.factory/missions/<id>` even when repo-relative `.factory/missions/...` paths are absent, and instruct workers to fall back to the absolute mission directory before treating missing files as blockers.",
|
||||
"evidence": "Review reports for `shared-auth-runtime-domain` and `fix-tui-runtime-truthfulness` both recorded ENOENT attempts against repo-relative mission paths before successfully reading `/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/...`.",
|
||||
"isSystemic": true
|
||||
},
|
||||
{
|
||||
"target": "rust-operator-worker",
|
||||
"suggestion": "For TUI features that change visible copy or layout, require a layout-fit visibility check (render/snapshot or terminal smoke) in addition to helper-string assertions so multi-line regions are proven visible.",
|
||||
"evidence": "Both `terminal-tui-operator-console` and `cli-state-runtime-truthfulness-and-docs` failed review because the footer stayed at `Constraint::Length(3)` while rendering four lines, yet the worker tests only asserted helper-string content.",
|
||||
"isSystemic": true
|
||||
},
|
||||
{
|
||||
"target": "rust-operator-worker",
|
||||
"suggestion": "Reinforce the mission boundary that only docs-scoped features may edit `docs/rust-replatform.md` or `README.md`, and direct workers to defer such changes to the explicit docs-alignment feature when possible.",
|
||||
"evidence": "Review reports for `proxy-runtime-stats-surface` and `terminal-tui-operator-console` both recorded edits to `docs/rust-replatform.md` despite mission AGENTS guidance reserving docs changes for docs-alignment work.",
|
||||
"isSystemic": true
|
||||
}
|
||||
],
|
||||
"rejectedObservations": [
|
||||
{
|
||||
"observation": "Add a dedicated mock upstream/refresh service definition to `.factory/services.yaml` for runtime smoke validation.",
|
||||
"reason": "ambiguous: the reviewed mock servers were scenario-specific one-off fixtures with ad hoc ports and behavior, so a generic shared service entry would risk encoding the wrong workflow. The concrete bootstrap/config discovery gap was handled instead via additive command/library updates."
|
||||
}
|
||||
],
|
||||
"previousRound": null
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"milestone": "terminal-operator-console",
|
||||
"round": 2,
|
||||
"status": "fail",
|
||||
"validatorsRun": {
|
||||
"format": {
|
||||
"passed": true,
|
||||
"command": "cargo fmt --all --manifest-path rust/Cargo.toml -- --check",
|
||||
"exitCode": 0
|
||||
},
|
||||
"test": {
|
||||
"passed": true,
|
||||
"command": "cargo test --manifest-path rust/Cargo.toml",
|
||||
"exitCode": 0
|
||||
},
|
||||
"typecheck": {
|
||||
"passed": true,
|
||||
"command": "cargo check --manifest-path rust/Cargo.toml",
|
||||
"exitCode": 0
|
||||
},
|
||||
"lint": {
|
||||
"passed": true,
|
||||
"command": "cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings",
|
||||
"exitCode": 0
|
||||
}
|
||||
},
|
||||
"reviewsSummary": {
|
||||
"total": 2,
|
||||
"passed": 1,
|
||||
"failed": 1,
|
||||
"failedFeatures": [
|
||||
"fix-tui-footer-and-passive-polling"
|
||||
]
|
||||
},
|
||||
"blockingIssues": [
|
||||
{
|
||||
"featureId": "fix-tui-footer-and-passive-polling",
|
||||
"severity": "blocking",
|
||||
"description": "The TUI footer still has a fixed six-row outer height, which leaves only four inner text rows inside the bordered keys block. Long routine feedback such as the runtime-active-account failure copy wraps at the validated terminal width, so one of the footer status/help lines becomes clipped again and the operator console still fails the footer-visibility contract."
|
||||
}
|
||||
],
|
||||
"nonBlockingIssues": [],
|
||||
"appliedUpdates": [],
|
||||
"suggestedGuidanceUpdates": [
|
||||
{
|
||||
"target": "rust-operator-worker",
|
||||
"suggestion": "When validating fixed-height TUI regions, explicitly exercise long wrapped operator feedback (not just short placeholder strings) so layout-fit checks prove realistic messages remain visible.",
|
||||
"evidence": "The follow-up review for `fix-tui-footer-and-passive-polling` found the new snapshot test only covered a short `Feedback line`, while real footer messages in `rust/proxypilot-rs/src/tui.rs` are long enough to wrap and clip help text again within the fixed six-row footer.",
|
||||
"isSystemic": true
|
||||
},
|
||||
{
|
||||
"target": "rust-operator-worker",
|
||||
"suggestion": "Document when label-only TUI/runtime wording changes may use lightweight non-interactive verification instead of full `tuistory` validation, so narrow observability fixes can follow a clear exception path.",
|
||||
"evidence": "The pass review for `fix-runtime-account-count-semantics` noted the worker intentionally skipped manual `tuistory` verification because the change only aligned runtime/TUI labels, but the current skill does not describe that small-change exception.",
|
||||
"isSystemic": false
|
||||
}
|
||||
],
|
||||
"rejectedObservations": [],
|
||||
"previousRound": "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/scrutiny/synthesis.round1.json"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
active_account = "refreshable-local"
|
||||
|
||||
[[accounts]]
|
||||
name = "refreshable-local"
|
||||
provider = "codex"
|
||||
api_key = "refreshed-access-token"
|
||||
refresh_token = "refreshed-refresh-token"
|
||||
id_token = "TEST_ID_TOKEN_PLACEHOLDER"
|
||||
email = "rerun@example.com"
|
||||
account_id = "acct_refresh_rerun"
|
||||
plan_type = "pro"
|
||||
expires_at = "2030-01-01T00:00:00Z"
|
||||
source = "import:/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/user-testing/fixtures/cli-refresh-rerun/refreshable-auth.json"
|
||||
|
||||
[[accounts]]
|
||||
name = "static-local"
|
||||
provider = "codex"
|
||||
api_key = "sk-static-local"
|
||||
source = "manual"
|
||||
@@ -0,0 +1,11 @@
|
||||
# isolated CLI refresh rerun config
|
||||
[server]
|
||||
bind = "127.0.0.1:8318"
|
||||
|
||||
[state]
|
||||
path = "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/user-testing/fixtures/cli-refresh-rerun/proxypilot-rs.state.toml"
|
||||
|
||||
[codex]
|
||||
upstream_base_url = "https://api.openai.com"
|
||||
api_key = ""
|
||||
refresh_token_url = "http://127.0.0.1:34051/oauth/token"
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"access_token": "seed-access-token",
|
||||
"refresh_token": "seed-refresh-token",
|
||||
"email": "seed@example.com",
|
||||
"account_id": "acct_seed",
|
||||
"expired": "2020-01-01T00:00:00Z",
|
||||
"type": "codex"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
active_account = "preemptive-account"
|
||||
|
||||
[[accounts]]
|
||||
name = "preemptive-account"
|
||||
provider = "codex"
|
||||
api_key = "expired-preemptive-token"
|
||||
refresh_token = "preemptive-refresh-token"
|
||||
id_token = "header.payload.sig"
|
||||
email = "refresh@example.com"
|
||||
account_id = "acct_seed"
|
||||
plan_type = "seed"
|
||||
expires_at = "1970-01-01T00:00:00Z"
|
||||
source = "fixture"
|
||||
@@ -0,0 +1,10 @@
|
||||
[server]
|
||||
bind = "127.0.0.1:18318"
|
||||
|
||||
[state]
|
||||
path = "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/user-testing/fixtures/http-refresh-rerun/VAL-HTTP-007.state.toml"
|
||||
|
||||
[codex]
|
||||
upstream_base_url = "http://127.0.0.1:18319"
|
||||
api_key = ""
|
||||
refresh_token_url = "http://127.0.0.1:18319/oauth/token"
|
||||
@@ -0,0 +1,13 @@
|
||||
active_account = "retry-account"
|
||||
|
||||
[[accounts]]
|
||||
name = "retry-account"
|
||||
provider = "codex"
|
||||
api_key = "stale-401-token"
|
||||
refresh_token = "retry-refresh-token"
|
||||
id_token = "header.payload.sig"
|
||||
email = "refresh@example.com"
|
||||
account_id = "acct_seed"
|
||||
plan_type = "seed"
|
||||
expires_at = "2035-01-01T00:00:00Z"
|
||||
source = "fixture"
|
||||
@@ -0,0 +1,10 @@
|
||||
[server]
|
||||
bind = "127.0.0.1:18318"
|
||||
|
||||
[state]
|
||||
path = "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/user-testing/fixtures/http-refresh-rerun/VAL-HTTP-008.state.toml"
|
||||
|
||||
[codex]
|
||||
upstream_base_url = "http://127.0.0.1:18319"
|
||||
api_key = ""
|
||||
refresh_token_url = "http://127.0.0.1:18319/oauth/token"
|
||||
@@ -0,0 +1,142 @@
|
||||
import argparse
|
||||
import base64
|
||||
import json
|
||||
import time
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
from urllib.parse import parse_qs
|
||||
|
||||
|
||||
def encode_claims(exp, email, account_id, plan_type):
|
||||
payload = {
|
||||
"email": email,
|
||||
"exp": exp,
|
||||
"https://api.openai.com/auth": {
|
||||
"chatgpt_account_id": account_id,
|
||||
"chatgpt_plan_type": plan_type,
|
||||
},
|
||||
}
|
||||
raw = json.dumps(payload, separators=(",", ":")).encode()
|
||||
return base64.urlsafe_b64encode(raw).decode().rstrip("=")
|
||||
|
||||
|
||||
class ReusableServer(ThreadingHTTPServer):
|
||||
allow_reuse_address = True
|
||||
|
||||
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
scenario = "preemptive"
|
||||
log_path = None
|
||||
state = {"model_calls": 0}
|
||||
|
||||
def log_message(self, format, *args):
|
||||
return
|
||||
|
||||
def _write_json(self, status, payload):
|
||||
body = json.dumps(payload).encode()
|
||||
self.send_response(status)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
return body
|
||||
|
||||
def _record(self, *, response_status, response_body, request_body=""):
|
||||
entry = {
|
||||
"ts": time.time(),
|
||||
"scenario": self.scenario,
|
||||
"method": self.command,
|
||||
"path": self.path,
|
||||
"headers": {k: v for k, v in self.headers.items()},
|
||||
"request_body": request_body,
|
||||
"response_status": response_status,
|
||||
"response_body": response_body,
|
||||
"model_call_index": self.state["model_calls"],
|
||||
}
|
||||
with open(self.log_path, "a", encoding="utf-8") as fh:
|
||||
fh.write(json.dumps(entry) + "\n")
|
||||
|
||||
def do_GET(self):
|
||||
if self.path == "/__health":
|
||||
body = b"ok"
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/plain")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
return
|
||||
|
||||
if self.path == "/v1/models":
|
||||
auth = self.headers.get("Authorization", "")
|
||||
self.state["model_calls"] += 1
|
||||
if self.scenario == "retry401" and self.state["model_calls"] == 1:
|
||||
payload = {
|
||||
"error": "expired token",
|
||||
"received_authorization": auth,
|
||||
"attempt": 1,
|
||||
}
|
||||
self._record(response_status=401, response_body=payload)
|
||||
self._write_json(401, payload)
|
||||
return
|
||||
payload = {
|
||||
"object": "list",
|
||||
"data": [{"id": "gpt-5.2-codex", "object": "model"}],
|
||||
"received_authorization": auth,
|
||||
"attempt": self.state["model_calls"],
|
||||
"scenario": self.scenario,
|
||||
}
|
||||
self._record(response_status=200, response_body=payload)
|
||||
self._write_json(200, payload)
|
||||
return
|
||||
|
||||
payload = {"error": "not found", "path": self.path}
|
||||
self._record(response_status=404, response_body=payload)
|
||||
self._write_json(404, payload)
|
||||
|
||||
def do_POST(self):
|
||||
length = int(self.headers.get("Content-Length", "0"))
|
||||
raw_body = self.rfile.read(length).decode()
|
||||
if self.path == "/oauth/token":
|
||||
form = parse_qs(raw_body)
|
||||
refresh_token = form.get("refresh_token", [""])[0]
|
||||
if self.scenario == "preemptive":
|
||||
payload = {
|
||||
"access_token": "preemptive-fresh-token",
|
||||
"refresh_token": "preemptive-fresh-refresh-token",
|
||||
"id_token": f"header.{encode_claims(1893456000, 'refresh@example.com', 'acct_preemptive', 'team')}.sig",
|
||||
"expires_in": 3600,
|
||||
"seen_refresh_token": refresh_token,
|
||||
}
|
||||
else:
|
||||
payload = {
|
||||
"access_token": "retry-fresh-token",
|
||||
"refresh_token": "retry-fresh-refresh-token",
|
||||
"id_token": f"header.{encode_claims(1893456000, 'refresh@example.com', 'acct_retry401', 'pro')}.sig",
|
||||
"expires_in": 3600,
|
||||
"seen_refresh_token": refresh_token,
|
||||
}
|
||||
self._record(response_status=200, response_body=payload, request_body=raw_body)
|
||||
self._write_json(200, payload)
|
||||
return
|
||||
|
||||
payload = {"error": "not found", "path": self.path}
|
||||
self._record(response_status=404, response_body=payload, request_body=raw_body)
|
||||
self._write_json(404, payload)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--scenario", required=True, choices=["preemptive", "retry401"])
|
||||
parser.add_argument("--port", required=True, type=int)
|
||||
parser.add_argument("--log", required=True)
|
||||
args = parser.parse_args()
|
||||
|
||||
Handler.scenario = args.scenario
|
||||
Handler.log_path = args.log
|
||||
Handler.state = {"model_calls": 0}
|
||||
server = ReusableServer(("127.0.0.1", args.port), Handler)
|
||||
try:
|
||||
server.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
finally:
|
||||
server.server_close()
|
||||
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"groupId": "cli-refresh-rerun",
|
||||
"testedAt": "2026-04-05T13:32:26Z",
|
||||
"isolation": {
|
||||
"surface": "shell",
|
||||
"fixtureDirectory": "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/user-testing/fixtures/cli-refresh-rerun",
|
||||
"evidenceDirectory": "/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-refresh-rerun",
|
||||
"configPath": "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/user-testing/fixtures/cli-refresh-rerun/proxypilot-rs.toml",
|
||||
"statePath": "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/user-testing/fixtures/cli-refresh-rerun/proxypilot-rs.state.toml",
|
||||
"refreshTokenUrl": "http://127.0.0.1:34051/oauth/token"
|
||||
},
|
||||
"toolsUsed": [
|
||||
"shell"
|
||||
],
|
||||
"assertions": [
|
||||
{
|
||||
"id": "VAL-CLI-003",
|
||||
"title": "Refresh commands handle both refreshable and static accounts clearly",
|
||||
"status": "pass",
|
||||
"steps": [
|
||||
{
|
||||
"action": "Import a refreshable saved Codex account into isolated state and add a static account",
|
||||
"expected": "Fixture state contains one active refreshable account and one static account",
|
||||
"observed": "account list showed `refreshable-local` active with `refresh=refreshable` and `static-local` present with `refresh=static`"
|
||||
},
|
||||
{
|
||||
"action": "Run `account refresh-codex` with no `--name` while the refreshable account is active",
|
||||
"expected": "Refresh succeeds through the configured local refresh endpoint and updates saved account metadata",
|
||||
"observed": "Command printed `refreshed saved Codex account `refreshable-local` in local state`; the local stub received one POST to `/oauth/token`; state updated access token, refresh token, email, account id, plan, and expiry"
|
||||
},
|
||||
{
|
||||
"action": "Run `account refresh-codex --name static-local`",
|
||||
"expected": "Static account refresh is rejected with a clear operator-readable error and no state corruption",
|
||||
"observed": "Command exited non-zero with `account `static-local` is static and has no refresh token`; follow-up state snapshot matched the post-success state byte-for-byte"
|
||||
},
|
||||
{
|
||||
"action": "Run `account refresh-codex --name missing-local`",
|
||||
"expected": "Missing account refresh is rejected with a clear operator-readable error and no state corruption",
|
||||
"observed": "Command exited non-zero with `no saved Codex account named missing-local`; follow-up state snapshot remained unchanged and list output still showed the same active/static accounts"
|
||||
}
|
||||
],
|
||||
"evidence": {
|
||||
"commandOutputs": [
|
||||
"terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-import-refreshable.txt",
|
||||
"terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-add-static.txt",
|
||||
"terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-list-before-refresh.txt",
|
||||
"terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-refresh-success.txt",
|
||||
"terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-list-after-success.txt",
|
||||
"terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-refresh-static-fails.txt",
|
||||
"terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-refresh-missing-fails.txt",
|
||||
"terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-list-after-failures.txt"
|
||||
],
|
||||
"stateSnapshots": [
|
||||
"terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-state-before-refresh.toml",
|
||||
"terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-state-after-success.toml",
|
||||
"terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-state-after-failures.toml"
|
||||
],
|
||||
"network": "terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-refresh-stub-requests.json",
|
||||
"config": "terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-config.toml",
|
||||
"fixtureImport": "terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-import-auth.json",
|
||||
"validator": "terminal-operator-console/cli-refresh-rerun/VAL-CLI-003-refresh-related-tests.txt"
|
||||
},
|
||||
"issues": null
|
||||
}
|
||||
],
|
||||
"frictions": [],
|
||||
"blockers": [],
|
||||
"summary": "VAL-CLI-003 passed: refresh succeeded for the active refreshable Codex account through `codex.refresh_token_url`, static and missing account refreshes failed clearly, and saved state stayed coherent after all runs."
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"groupId": "cli-shell",
|
||||
"surface": "shell",
|
||||
"toolsUsed": [
|
||||
"shell"
|
||||
],
|
||||
"assertions": [
|
||||
{
|
||||
"id": "VAL-CLI-001",
|
||||
"status": "pass",
|
||||
"summary": "init wrote an example config at the requested fixture path and a second run without --force refused to overwrite it with a clear error.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-001-init-success.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-001-init-refused-overwrite.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-001-config.toml"
|
||||
],
|
||||
"details": "Used isolated fixture config /home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/user-testing/fixtures/cli-shell/20260405T121714Z/proxypilot-rs.toml. Successful init printed the written path. Re-running init returned exit code 1 with \"config already exists ... (pass --force to overwrite)\". The captured config file includes server.bind=127.0.0.1:8318, state.path=proxypilot-rs.state.toml, and codex.upstream_base_url=https://api.openai.com."
|
||||
},
|
||||
{
|
||||
"id": "VAL-CLI-002",
|
||||
"status": "pass",
|
||||
"summary": "Add, list, activate, and remove commands kept saved active-account state coherent, including promotion back to the remaining account and explicit empty-state output after removing the final account.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-002-add-primary.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-002-add-backup.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-002-list-after-add.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-002-activate-backup.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-002-list-after-activate.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-002-remove-backup.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-002-list-after-remove-backup.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-002-remove-primary.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-002-list-after-remove-primary.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-002-state-after-activate-backup.toml",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-002-state-after-remove-backup.toml",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-002-state-after-remove-primary.toml"
|
||||
],
|
||||
"details": "primary became active when first added; list output marked it with `*`. After activating backup, list output switched the marker to backup and the saved state snapshot shows active_account=\"backup\". Removing backup reported \"local active account is now `primary`\" and the next state snapshot shows active_account=\"primary\". Removing primary reported \"no local active account remains\" and follow-up list output showed \"No local Rust accounts saved yet.\" with an empty accounts snapshot."
|
||||
},
|
||||
{
|
||||
"id": "VAL-CLI-003",
|
||||
"status": "blocked",
|
||||
"summary": "Negative refresh paths behaved clearly for static and missing accounts, but the required refresh-success path could not be exercised within the isolated fixture because refresh-codex is hardwired to the live OpenAI OAuth refresh endpoint.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-003-state-with-static-and-refreshable.toml",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-003-list-pre-refresh.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-003-refresh-static-fails.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-003-refresh-missing-fails.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-003-list-after-failures.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-003-state-after-failures.toml",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/cli-shell/20260405T121714Z/VAL-CLI-003-refresh-success-blocked.txt"
|
||||
],
|
||||
"details": "Imported a refreshable local fixture account and added a static account inside the assigned fixture state. Refreshing the static account failed cleanly with \"account `static-local` is static and has no refresh token\"; refreshing a missing account failed with \"no saved Codex account named missing-local\". Follow-up list/state evidence shows saved state remained unchanged after both failures. The assertion remains blocked because the CLI refresh path uses the built-in OpenAI OAuth refresh endpoint and the supported config surface does not expose a way to redirect refresh-codex to a local mock endpoint without live credentials."
|
||||
}
|
||||
],
|
||||
"frictions": [],
|
||||
"blockers": [
|
||||
"VAL-CLI-003 success-path refresh is not isolatable in this shell fixture: refresh-codex uses the built-in live OpenAI OAuth refresh endpoint, and the allowed CLI/config surface provides no local mock override. Live device-login/private credentials were explicitly disallowed, so the refresh-success portion of the assertion was recorded as blocked with evidence."
|
||||
],
|
||||
"overallSummary": "Validated 3 CLI shell assertions for terminal-operator-console: VAL-CLI-001 pass, VAL-CLI-002 pass, VAL-CLI-003 blocked due to non-mockable live refresh dependency. Report and evidence were written under the requested flow-report and mission evidence paths."
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"groupId": "http-refresh-rerun",
|
||||
"testedAt": "2026-04-05T13:34:49Z",
|
||||
"isolation": {
|
||||
"surface": "curl",
|
||||
"fixtureDirectory": "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/user-testing/fixtures/http-refresh-rerun",
|
||||
"evidenceDirectory": "/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-refresh-rerun",
|
||||
"proxyBind": "127.0.0.1:18318",
|
||||
"stubBind": "127.0.0.1:18319",
|
||||
"refreshTokenUrl": "http://127.0.0.1:18319/oauth/token"
|
||||
},
|
||||
"toolsUsed": [
|
||||
"curl"
|
||||
],
|
||||
"assertions": [
|
||||
{
|
||||
"id": "VAL-HTTP-007",
|
||||
"title": "Proactive refresh is visible before forwarding expired or near-expiry requests",
|
||||
"status": "pass",
|
||||
"steps": [
|
||||
{
|
||||
"action": "Start proxypilot-rs with an expired refreshable active account plus a local OAuth/upstream stub",
|
||||
"expected": "Runtime stats start with expired auth health and zero counters",
|
||||
"observed": "/v0/runtime/stats reported auth_health.state=expired with total_proxied_requests=0 and auth_refresh_attempts=0"
|
||||
},
|
||||
{
|
||||
"action": "Send GET /v1/models through the proxy",
|
||||
"expected": "Proxy refreshes before forwarding and the client request succeeds with the refreshed token",
|
||||
"observed": "Client received 200 JSON showing received_authorization=Bearer preemptive-fresh-token"
|
||||
},
|
||||
{
|
||||
"action": "Inspect runtime stats and stub traffic after the request",
|
||||
"expected": "Stats show one refresh attempt/success and upstream sees only refreshed-token traffic",
|
||||
"observed": "Stats showed total_proxied_requests=1, successful_upstream_responses=1, auth_refresh_attempts=1, upstream_401_count=0, last_refresh.kind=success; stub log recorded POST /oauth/token before GET /v1/models with Bearer preemptive-fresh-token"
|
||||
}
|
||||
],
|
||||
"evidence": {
|
||||
"statsBefore": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-007-stats-before.json",
|
||||
"requestHeaders": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-007-request.headers.txt",
|
||||
"requestBody": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-007-request-body.json",
|
||||
"statsAfter": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-007-stats-after.json",
|
||||
"stubLog": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-007-stub-log.jsonl",
|
||||
"proxyLog": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-007-proxy.log",
|
||||
"stubStdout": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-007-stub.log"
|
||||
},
|
||||
"issues": null
|
||||
},
|
||||
{
|
||||
"id": "VAL-HTTP-008",
|
||||
"title": "Upstream 401 retry refresh is visible and counted exactly once",
|
||||
"status": "pass",
|
||||
"steps": [
|
||||
{
|
||||
"action": "Start proxypilot-rs with a refreshable active account and a local stub that returns 401 on the first /v1/models request",
|
||||
"expected": "Initial stats are zeroed and the first upstream attempt uses the stale token",
|
||||
"observed": "Stub log recorded the first GET /v1/models with Bearer stale-401-token and response_status=401"
|
||||
},
|
||||
{
|
||||
"action": "Let the proxy handle the 401-triggered refresh-and-retry path for one GET /v1/models client request",
|
||||
"expected": "Proxy refreshes once, retries once, and the client sees the retried success result",
|
||||
"observed": "Client received 200 JSON showing received_authorization=Bearer retry-fresh-token on attempt=2"
|
||||
},
|
||||
{
|
||||
"action": "Inspect runtime stats and stub traffic after the request",
|
||||
"expected": "Stats count one proxied request, one upstream 401, one refresh success, and mock upstream shows 401 then refresh then retry",
|
||||
"observed": "Stats showed total_proxied_requests=1, successful_upstream_responses=1, auth_refresh_attempts=1, upstream_401_count=1, last_refresh.kind=success; stub log showed GET 401 -> POST /oauth/token -> GET 200 with Bearer retry-fresh-token"
|
||||
}
|
||||
],
|
||||
"evidence": {
|
||||
"statsBefore": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-008-stats-before.json",
|
||||
"requestHeaders": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-008-request.headers.txt",
|
||||
"requestBody": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-008-request-body.json",
|
||||
"statsAfter": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-008-stats-after.json",
|
||||
"stubLog": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-008-stub-log.jsonl",
|
||||
"proxyLog": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-008-proxy.log",
|
||||
"stubStdout": "terminal-operator-console/http-refresh-rerun/VAL-HTTP-008-stub.log"
|
||||
},
|
||||
"issues": null
|
||||
}
|
||||
],
|
||||
"frictions": [],
|
||||
"blockers": [],
|
||||
"summary": "Retested 2 assertions: VAL-HTTP-007 passed with proactive refresh before forwarding, and VAL-HTTP-008 passed with one 401-triggered refresh-and-retry path counted exactly once."
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
{
|
||||
"assertions": [
|
||||
{
|
||||
"details": "Observed status=ok, provider=codex, listen=127.0.0.1:18318, upstream=http://127.0.0.1:18319 on the reachable fixture and the same local health response with upstream=http://127.0.0.1:18339.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-001-healthz-reachable.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-001-healthz-unreachable.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/fixture-config-fallback.toml",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/fixture-config-unreachable.toml"
|
||||
],
|
||||
"id": "VAL-HTTP-001",
|
||||
"status": "pass",
|
||||
"summary": "Health checks returned 200 with local proxy identity fields both with the mock upstream and with an unreachable local upstream port."
|
||||
},
|
||||
{
|
||||
"details": "The stats call returned HTTP 200 with a JSON payload and the mock log remained empty (request_count=0), confirming the operator surface is read-only and local.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-002-runtime-stats.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-002-mock-log.json"
|
||||
],
|
||||
"id": "VAL-HTTP-002",
|
||||
"status": "pass",
|
||||
"summary": "The local /v0/runtime/stats surface returned 200 without auth and did not create any upstream mock traffic."
|
||||
},
|
||||
{
|
||||
"details": "Before and after mutating the state file on disk, /v0/runtime/stats continued to report active_account_name=runtime-valid and auth_health.state=valid for the running process while exposing bind_address, upstream_base_url, account_count, auth_health, request_counters, and last_refresh.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-003-stats-before-disk-mutation.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-003-stats-after-disk-mutation.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-003-state-before.toml",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-003-state-mutated.toml"
|
||||
],
|
||||
"id": "VAL-HTTP-003",
|
||||
"status": "pass",
|
||||
"summary": "The runtime stats payload exposed the expected stable schema and stayed pinned to runtime-memory state after the disk state file was mutated externally."
|
||||
},
|
||||
{
|
||||
"details": "Observed auth_health.state values: fallback-key -> static with source=config_fallback_key and no active_account_name; static saved account -> static with source=active_account; valid fixture -> valid; expiring fixture -> expiring_soon; expired fixture -> expired; malformed expiry fixture -> unknown with metadata_state=malformed.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-004-fallback-key.json",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-004-static-saved.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-004-valid.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-004-expiring.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-004-expired.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-004-malformed.txt"
|
||||
],
|
||||
"id": "VAL-HTTP-004",
|
||||
"status": "pass",
|
||||
"summary": "Representative fixtures produced explicit auth-health states for fallback static, saved static, valid, expiring_soon, expired, and malformed unknown cases."
|
||||
},
|
||||
{
|
||||
"details": "Initial stats showed all request counters at 0 and last_refresh.kind=unknown with null timestamps; after two successful requests the counters rose; after restarting the proxy with the same fixture they reset to zero again.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-002-runtime-stats.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-006-stats-after-success.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-005-stats-after-restart.txt"
|
||||
],
|
||||
"id": "VAL-HTTP-005",
|
||||
"status": "pass",
|
||||
"summary": "Fresh runtime counters started at zero, last-refresh metadata was null-like before any attempt, and a restart cleared in-memory stats after traffic."
|
||||
},
|
||||
{
|
||||
"details": "Starting from zero, one GET /v1/models and one POST /v1/chat/completions produced total_proxied_requests=2 and successful_upstream_responses=2, with two corresponding mock upstream calls.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-006-models-success.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-006-chat-success.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-006-stats-after-success.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-006-mock-log.json"
|
||||
],
|
||||
"id": "VAL-HTTP-006",
|
||||
"status": "pass",
|
||||
"summary": "Successful supported proxy requests incremented both total_proxied_requests and successful_upstream_responses."
|
||||
},
|
||||
{
|
||||
"details": "With an expired refreshable account, the next proxied request returned 502, auth_refresh_attempts/auth_refresh_failures incremented, last_refresh.kind became failure, and the local upstream mock saw zero calls. This confirms the pre-forward refresh attempt, but successful local stubbed refresh remains blocked because the available config surface has no OAuth token endpoint override.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-007-stats-before.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-007-proactive-refresh-attempt.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-007-stats-after.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-007-mock-log.json",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/fixture-config-expired.toml"
|
||||
],
|
||||
"id": "VAL-HTTP-007",
|
||||
"status": "blocked",
|
||||
"summary": "A proactive refresh attempt was observable before forwarding, but the success path could not be validated because the runtime cannot be redirected from the user surface to a local OAuth token stub."
|
||||
},
|
||||
{
|
||||
"details": "The local mock forced one upstream 401 and the proxy recorded upstream_401_count=1 with a single proxied request, but the refresh attempt failed with a 502 response and the mock saw no /oauth/token call. A successful refresh-and-retry path therefore remains blocked under the current user-surface configuration.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-008-009-stats-before.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-008-009-401-refresh-attempt.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-008-009-stats-after.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-008-009-mock-log.json",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/fixture-config-401-retry.toml"
|
||||
],
|
||||
"id": "VAL-HTTP-008",
|
||||
"status": "blocked",
|
||||
"summary": "The 401-triggered refresh path is visible, but the success retry case cannot be validated locally because the runtime cannot point refresh traffic at a local OAuth token stub from the user surface."
|
||||
},
|
||||
{
|
||||
"details": "The client received HTTP 502 with a local JSON error after the mock upstream returned 401, while /v0/runtime/stats showed total_proxied_requests=1, upstream_401_count=1, auth_refresh_attempts=1, auth_refresh_failures=1, and last_refresh.kind=failure with a failure timestamp/message.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-008-009-401-refresh-attempt.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-008-009-stats-after.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-008-009-mock-log.json"
|
||||
],
|
||||
"id": "VAL-HTTP-009",
|
||||
"status": "pass",
|
||||
"summary": "A 401-triggered refresh failure remained visible to the operator surface and did not masquerade as success."
|
||||
},
|
||||
{
|
||||
"details": "POST /v1/files returned HTTP 404 with an error naming /v1/files and the supported routes list; successful_upstream_responses and total_proxied_requests stayed unchanged across the before/after stats captures.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-010-stats-before.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-010-unsupported-route.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/http-runtime/val-http-010-stats-after.txt"
|
||||
],
|
||||
"id": "VAL-HTTP-010",
|
||||
"status": "pass",
|
||||
"summary": "Unsupported /v1/* routes returned a clear 404 JSON error and did not change success counters."
|
||||
}
|
||||
],
|
||||
"blockers": [
|
||||
"VAL-HTTP-007 and VAL-HTTP-008 remain blocked for success-path validation because proxypilot-rs exposes no user-surface config knob to redirect refresh token exchange from the hardwired OAuth endpoint to a local stub."
|
||||
],
|
||||
"frictions": [],
|
||||
"groupId": "http-runtime",
|
||||
"overallSummary": "Validated 10 HTTP runtime assertions: 8 passed and 2 were blocked (refresh-success paths VAL-HTTP-007 and VAL-HTTP-008).",
|
||||
"surface": "curl",
|
||||
"toolsUsed": [
|
||||
"curl"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"groupId": "tui-console",
|
||||
"surface": "tuistory",
|
||||
"toolsUsed": [
|
||||
"tuistory",
|
||||
"shell",
|
||||
"curl"
|
||||
],
|
||||
"assertions": [
|
||||
{
|
||||
"id": "VAL-TUI-001",
|
||||
"status": "pass",
|
||||
"summary": "The TUI opened as a readable Codex operator console with overview, runtime, runtime-stats, models, accounts, selected-account, feedback, and key-help regions visible.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-initial.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-initial.png"
|
||||
],
|
||||
"details": "Launching `cargo run --manifest-path rust/Cargo.toml -p proxypilot-rs -- tui --config .../config-live.toml` rendered the Codex Operator Console immediately. The initial surface showed readable runtime health, live runtime stats, a disk-backed account list, selected-account details, and footer/help text rather than a blank or cryptic screen."
|
||||
},
|
||||
{
|
||||
"id": "VAL-TUI-002",
|
||||
"status": "pass",
|
||||
"summary": "The footer/help text matched the shipped key bindings, and each listed action was exercised through the TUI during validation.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-initial.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-activate-alpha.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-delete-beta.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-clear-feedback.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/auth-trouble-after-q-snapshot.txt"
|
||||
],
|
||||
"details": "Visible help text listed `q`, `r`, arrows, `a`, `f`, `R`, `d`, and `c`. Those bindings were exercised across the live, runtime-down, and auth-trouble sessions: reload/poll updated state, arrows changed selection, activate/delete changed local state, selected refresh and active refresh produced targeted feedback, clear removed feedback, and `q` exited the TUI process back to the launcher shell."
|
||||
},
|
||||
{
|
||||
"id": "VAL-TUI-003",
|
||||
"status": "pass",
|
||||
"summary": "With no proxy running on the configured port, the TUI explicitly showed runtime unavailability while keeping the local disk-backed account list and selected-account details visible.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-initial.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-initial.png"
|
||||
],
|
||||
"details": "Using the isolated runtime-down fixture on 127.0.0.1:18430 without starting a proxy produced `Health: proxy not running yet` and `Runtime unavailable` copy, while still rendering six saved accounts and full selected-account details from the local fixture state file."
|
||||
},
|
||||
{
|
||||
"id": "VAL-TUI-004",
|
||||
"status": "pass",
|
||||
"summary": "Pressing `r` refreshed both disk-backed state and runtime-observed data without restarting the TUI.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-initial.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/cli-activate-beta.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-cli-activate-reload.txt"
|
||||
],
|
||||
"details": "After changing the saved active account externally through the CLI and generating runtime traffic through `/v1/models`, pressing `r` in the live TUI updated the disk active account from `alpha` to `beta`, loaded the model list, and refreshed runtime counters to `total=1 success=1` while still truthfully showing the runtime active account as `alpha`."
|
||||
},
|
||||
{
|
||||
"id": "VAL-TUI-005",
|
||||
"status": "pass",
|
||||
"summary": "The activate action updated active markers, selected-account details, and feedback coherently.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-before-activate.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-activate-alpha.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-activate-alpha.png"
|
||||
],
|
||||
"details": "Before pressing `a`, the selected row was `alpha` while the disk active marker was on `beta`. After `a`, the footer reported `Activated account \\`alpha\\`.` and the active marker moved to `alpha` without corrupting selection or the selected-account panel."
|
||||
},
|
||||
{
|
||||
"id": "VAL-TUI-006",
|
||||
"status": "pass",
|
||||
"summary": "The delete action removed the selected account, kept selection in bounds, and updated visible account state coherently.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-clear-feedback.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-delete-beta.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-delete-beta.png"
|
||||
],
|
||||
"details": "With `beta` selected, pressing `d` removed that row, reduced the saved-account count from two to one, moved selection to the remaining `alpha` row, and showed `Deleted account \\`beta\\`.` in the footer without leaving stale details on screen."
|
||||
},
|
||||
{
|
||||
"id": "VAL-TUI-007",
|
||||
"status": "pass",
|
||||
"summary": "Selected-account refresh targeted the selected row and named that account clearly in feedback.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-select-beta.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-refresh-selected-beta.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-after-refresh-selected-soon.txt"
|
||||
],
|
||||
"details": "On the live fixture, `beta` was selected while `alpha` remained active; pressing `f` produced `Failed to refresh account \\`beta\\`: account \\`beta\\` is static and has no refresh token`. In the runtime-down fixture, selecting `soon` and pressing `f` produced feedback naming `soon`, confirming the action targets the selected row rather than the active row."
|
||||
},
|
||||
{
|
||||
"id": "VAL-TUI-008",
|
||||
"status": "pass",
|
||||
"summary": "Active-account refresh-now targeted the active account even when another row was selected.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-select-beta.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-refresh-active-alpha.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-select-valid-while-active-soon.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-after-refresh-active-runtime-down.txt"
|
||||
],
|
||||
"details": "In the live fixture, `beta` was selected while `alpha` was the active disk/runtime account; pressing `R` produced feedback naming `alpha`, not `beta`. In the runtime-down fixture, `valid` was selected while disk active remained `soon`, and `R` reported `Disk active account remains \\`soon\\``, again proving the action targeted the active account rather than the selected row."
|
||||
},
|
||||
{
|
||||
"id": "VAL-TUI-009",
|
||||
"status": "pass",
|
||||
"summary": "Clear-feedback removed transient status text without altering selection or account state.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-refresh-active-alpha.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-clear-feedback.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-after-clear-feedback.txt"
|
||||
],
|
||||
"details": "After visible failure feedback in both live and runtime-down sessions, pressing `c` cleared the footer message back to blank while keeping the selected row, disk active account, runtime panel, and counters unchanged."
|
||||
},
|
||||
{
|
||||
"id": "VAL-TUI-010",
|
||||
"status": "pass",
|
||||
"summary": "The TUI used explicit operator-readable auth labels for valid, expiring soon, expired, static, and unknown, with distinct missing-vs-malformed expiry details.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/auth-labels-valid.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/auth-labels-expiring-soon.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/auth-labels-expired.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/auth-labels-static.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/auth-labels-unknown-missing.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/auth-labels-unknown-malformed.txt"
|
||||
],
|
||||
"details": "A dedicated auth-label fixture showed `Auth health: valid`, `expiring soon`, `expired`, `static`, and `unknown` in the selected-account panel. The `unknown-missing` account showed `Expiry: expiry metadata missing`, while `unknown-malformed` showed `Expiry: malformed expiry metadata (not-a-timestamp)`, which truthfully distinguishes the two unknown states."
|
||||
},
|
||||
{
|
||||
"id": "VAL-TUI-011",
|
||||
"status": "pass",
|
||||
"summary": "When runtime stats were available, the TUI surfaced request counters and the last refresh outcome/timestamp in the runtime panel.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-initial.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-cli-activate-reload.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/auth-trouble-after-reload.txt"
|
||||
],
|
||||
"details": "The idle live fixture showed zeroed counters and `Last refresh: unknown`. After proxied traffic, the live runtime panel updated to `total=1 success=1`. After a proxy-triggered refresh failure, the auth-trouble TUI showed `refresh_attempts=1 refresh_failures=1` and `Last refresh: failure for \\`refresh-fail\\` at ...`, making runtime refresh outcome visible without reading files or logs."
|
||||
},
|
||||
{
|
||||
"id": "VAL-TUI-012",
|
||||
"status": "pass",
|
||||
"summary": "When runtime was down, local disk-backed actions still worked where feasible and runtime-dependent refresh paths failed with readable copy while local state stayed visible.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-after-activate-soon.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-after-refresh-selected-soon.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-after-refresh-active-runtime-down.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-after-delete-valid.txt"
|
||||
],
|
||||
"details": "With runtime unavailable, pressing `a` still updated the local disk active account from `valid` to `soon`; `f` failed with readable refresh-token-exchange copy naming the selected account; `R` failed with explicit `runtime stats unavailable` copy while preserving the disk active account label; and `d` still deleted a locally saved account without hiding the local account list."
|
||||
},
|
||||
{
|
||||
"id": "VAL-CROSS-001",
|
||||
"status": "pass",
|
||||
"summary": "CLI active-account changes became visible in the TUI after reload while runtime state remained truthfully separate.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/cli-activate-beta.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-cli-activate-reload.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/cli-remove-alpha.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/live-after-cli-remove-alpha-reload.txt"
|
||||
],
|
||||
"details": "After CLI activation changed the saved active account to `beta`, TUI reload showed `Local disk active account: beta` while still showing `Runtime active account: alpha`. After CLI removal of `alpha`, reload again showed the saved state change (`beta` on disk, one saved account left) while runtime stats still truthfully reported the still-running proxy's runtime state as `alpha`."
|
||||
},
|
||||
{
|
||||
"id": "VAL-CROSS-002",
|
||||
"status": "pass",
|
||||
"summary": "A proxy-triggered refresh attempt became visible across runtime surfaces without reading the state file manually.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/auth-trouble-proxy-request.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/auth-trouble-stats-after.json",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/auth-trouble-after-reload.txt"
|
||||
],
|
||||
"details": "A proxied `GET /v1/models` against the auth-trouble fixture triggered an expired-account refresh attempt and returned a local 502. `/v0/runtime/stats` then showed `auth_refresh_attempts=1`, `auth_refresh_failures=1`, and a failed `last_refresh`, and the auth-trouble TUI showed the same failed refresh outcome in its runtime panel after reload."
|
||||
},
|
||||
{
|
||||
"id": "VAL-CROSS-003",
|
||||
"status": "pass",
|
||||
"summary": "When runtime was down, reload and feedback clearing preserved local state while keeping runtime failures separate from local actions.",
|
||||
"evidence": [
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-after-refresh-active-runtime-down.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-after-clear-feedback.txt",
|
||||
"/home/fsos/.factory/missions/7e6968f8-b3d3-4772-9518-ca3a93ea1374/evidence/terminal-operator-console/tui-console/runtime-down-clean-after-reload.txt"
|
||||
],
|
||||
"details": "In the runtime-down fixture, local actions changed disk state, `R` surfaced runtime unavailability separately from that local state, `c` cleared only the transient footer message, and `r` reloaded the current disk-backed account list without hiding local accounts or collapsing the separate `Runtime unavailable` messaging."
|
||||
}
|
||||
],
|
||||
"frictions": [
|
||||
"tuistory keeps the PTY session alive after `q` exits the TUI binary, so explicit `tuistory close` cleanup was still required even though the application quit successfully.",
|
||||
"With runtime down, `f` still attempts the hardwired Codex OAuth refresh exchange and surfaces the resulting OAuth 401 text instead of a pure local runtime-unavailable message; this was truthful but not called out in user-testing guidance."
|
||||
],
|
||||
"blockers": [],
|
||||
"overallSummary": "Validated 15 assigned TUI/cross-surface assertions for terminal-operator-console: 15 passed, 0 failed, 0 blocked. Evidence and the flow report were written under the requested mission and validation paths."
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"milestone": "terminal-operator-console",
|
||||
"round": 2,
|
||||
"status": "pass",
|
||||
"assertionsSummary": {
|
||||
"total": 3,
|
||||
"passed": 3,
|
||||
"failed": 0,
|
||||
"blocked": 0
|
||||
},
|
||||
"passedAssertions": [
|
||||
"VAL-CLI-003",
|
||||
"VAL-HTTP-007",
|
||||
"VAL-HTTP-008"
|
||||
],
|
||||
"failedAssertions": [],
|
||||
"blockedAssertions": [],
|
||||
"appliedUpdates": [],
|
||||
"previousRound": "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/user-testing/synthesis.round1.json"
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"milestone": "terminal-operator-console",
|
||||
"round": 1,
|
||||
"status": "fail",
|
||||
"assertionsSummary": {
|
||||
"total": 28,
|
||||
"passed": 25,
|
||||
"failed": 0,
|
||||
"blocked": 3
|
||||
},
|
||||
"passedAssertions": [
|
||||
"VAL-CLI-001",
|
||||
"VAL-CLI-002",
|
||||
"VAL-HTTP-001",
|
||||
"VAL-HTTP-002",
|
||||
"VAL-HTTP-003",
|
||||
"VAL-HTTP-004",
|
||||
"VAL-HTTP-005",
|
||||
"VAL-HTTP-006",
|
||||
"VAL-HTTP-009",
|
||||
"VAL-HTTP-010",
|
||||
"VAL-TUI-001",
|
||||
"VAL-TUI-002",
|
||||
"VAL-TUI-003",
|
||||
"VAL-TUI-004",
|
||||
"VAL-TUI-005",
|
||||
"VAL-TUI-006",
|
||||
"VAL-TUI-007",
|
||||
"VAL-TUI-008",
|
||||
"VAL-TUI-009",
|
||||
"VAL-TUI-010",
|
||||
"VAL-TUI-011",
|
||||
"VAL-TUI-012",
|
||||
"VAL-CROSS-001",
|
||||
"VAL-CROSS-002",
|
||||
"VAL-CROSS-003"
|
||||
],
|
||||
"failedAssertions": [],
|
||||
"blockedAssertions": [
|
||||
{
|
||||
"id": "VAL-CLI-003",
|
||||
"blockedBy": "Negative refresh paths behaved clearly for static and missing accounts, but the required refresh-success path could not be exercised within the isolated fixture because refresh-codex is hardwired to the live OpenAI OAuth refresh endpoint."
|
||||
},
|
||||
{
|
||||
"id": "VAL-HTTP-007",
|
||||
"blockedBy": "A proactive refresh attempt was observable before forwarding, but the success path could not be validated because the runtime cannot be redirected from the user surface to a local OAuth token stub."
|
||||
},
|
||||
{
|
||||
"id": "VAL-HTTP-008",
|
||||
"blockedBy": "The 401-triggered refresh path is visible, but the success retry case cannot be validated locally because the runtime cannot point refresh traffic at a local OAuth token stub from the user surface."
|
||||
}
|
||||
],
|
||||
"appliedUpdates": [
|
||||
{
|
||||
"target": "user-testing.md",
|
||||
"description": "Added flow validator guidance for shell, curl, and tuistory surfaces plus isolated fixture/evidence boundaries for terminal-operator-console validation.",
|
||||
"source": "setup"
|
||||
},
|
||||
{
|
||||
"target": "user-testing.md",
|
||||
"description": "Documented discovered validation quirks: hardwired OAuth refresh paths block local success-path refresh testing, tuistory PTYs need explicit close, and runtime-down selected refresh still surfaces remote OAuth failure text.",
|
||||
"source": "flow-report"
|
||||
}
|
||||
],
|
||||
"previousRound": null
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"milestone": "terminal-operator-console",
|
||||
"round": 2,
|
||||
"status": "pass",
|
||||
"assertionsSummary": {
|
||||
"total": 3,
|
||||
"passed": 3,
|
||||
"failed": 0,
|
||||
"blocked": 0
|
||||
},
|
||||
"passedAssertions": [
|
||||
"VAL-CLI-003",
|
||||
"VAL-HTTP-007",
|
||||
"VAL-HTTP-008"
|
||||
],
|
||||
"failedAssertions": [],
|
||||
"blockedAssertions": [],
|
||||
"appliedUpdates": [],
|
||||
"previousRound": "/home/fsos/code-lean/ai-tools/ProxyPilot/.factory/validation/terminal-operator-console/user-testing/synthesis.round1.json"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com
|
||||
681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com
|
||||
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
|
||||
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
|
||||
@@ -0,0 +1,22 @@
|
||||
# Default owner for the entire repository
|
||||
* @Finesssee
|
||||
|
||||
# Core proxy logic
|
||||
/internal/runtime/executor/ @Finesssee
|
||||
/internal/translator/ @Finesssee
|
||||
/sdk/ @Finesssee
|
||||
|
||||
# Authentication providers
|
||||
/internal/auth/ @Finesssee
|
||||
|
||||
# API and middleware
|
||||
/internal/api/ @Finesssee
|
||||
|
||||
# WebUI dashboard
|
||||
/webui/ @Finesssee
|
||||
|
||||
# CI/CD and infrastructure
|
||||
/.github/ @Finesssee
|
||||
/Dockerfile @Finesssee
|
||||
/docker-compose.yml @Finesssee
|
||||
/.goreleaser.yml @Finesssee
|
||||
@@ -0,0 +1,21 @@
|
||||
## Description
|
||||
|
||||
<!-- What does this PR do? Why is it needed? -->
|
||||
|
||||
## Changes
|
||||
|
||||
<!-- List the key changes made -->
|
||||
-
|
||||
|
||||
## Testing
|
||||
|
||||
<!-- How was this tested? -->
|
||||
- [ ] `go test ./...` passes
|
||||
- [ ] `go vet ./...` passes
|
||||
- [ ] Manually tested with relevant provider(s)
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] Code follows existing patterns and conventions
|
||||
- [ ] No secrets or credentials committed
|
||||
- [ ] No changes under `internal/translator/` (restricted path)
|
||||
@@ -0,0 +1,172 @@
|
||||
name: check-upstream
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Run daily at 08:00 UTC (like vibeproxy)
|
||||
- cron: '0 8 * * *'
|
||||
workflow_dispatch: # Allow manual trigger
|
||||
|
||||
concurrency:
|
||||
group: check-upstream
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
check-update:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get tracked upstream version
|
||||
id: current
|
||||
run: |
|
||||
CURRENT_TAG=$(tr -d '[:space:]' < UPSTREAM_VERSION 2>/dev/null || true)
|
||||
CURRENT_SHA=""
|
||||
if [ -n "$CURRENT_TAG" ]; then
|
||||
CURRENT_SHA=$(git ls-remote https://github.com/router-for-me/CLIProxyAPI.git "refs/tags/$CURRENT_TAG" | cut -f1)
|
||||
fi
|
||||
echo "tag=$CURRENT_TAG" >> $GITHUB_OUTPUT
|
||||
echo "sha=$CURRENT_SHA" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Get upstream release info
|
||||
id: upstream
|
||||
run: |
|
||||
# Fetch latest release from CLIProxyAPI
|
||||
RELEASE_INFO=$(curl -s https://api.github.com/repos/router-for-me/CLIProxyAPI/releases/latest)
|
||||
|
||||
# Extract tag name and version
|
||||
TAG_NAME=$(echo "$RELEASE_INFO" | jq -r '.tag_name // empty')
|
||||
|
||||
if [ -z "$TAG_NAME" ]; then
|
||||
echo "No release found, checking latest commit instead"
|
||||
LATEST_SHA=$(git ls-remote https://github.com/router-for-me/CLIProxyAPI.git HEAD | cut -f1)
|
||||
echo "tag=" >> $GITHUB_OUTPUT
|
||||
echo "sha=$LATEST_SHA" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Found release: $TAG_NAME"
|
||||
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
|
||||
# Get the commit SHA for this tag
|
||||
TAG_SHA=$(git ls-remote https://github.com/router-for-me/CLIProxyAPI.git "refs/tags/$TAG_NAME" | cut -f1)
|
||||
echo "sha=$TAG_SHA" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Check for updates
|
||||
id: check
|
||||
run: |
|
||||
echo "Current tracked tag: ${{ steps.current.outputs.tag }}"
|
||||
echo "Current SHA: ${{ steps.current.outputs.sha }}"
|
||||
echo "Upstream SHA: ${{ steps.upstream.outputs.sha }}"
|
||||
echo "Upstream Tag: ${{ steps.upstream.outputs.tag }}"
|
||||
|
||||
if [ -z "${{ steps.upstream.outputs.tag }}" ]; then
|
||||
echo "Unable to determine latest upstream release tag"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${{ steps.current.outputs.tag }}" != "${{ steps.upstream.outputs.tag }}" ]; then
|
||||
echo "Update available!"
|
||||
echo "has_update=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Already up to date"
|
||||
echo "has_update=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Create sync branch and PR
|
||||
if: steps.check.outputs.has_update == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
CURRENT_TAG="${{ steps.current.outputs.tag }}"
|
||||
TAG="${{ steps.upstream.outputs.tag }}"
|
||||
SHA="${{ steps.upstream.outputs.sha }}"
|
||||
SHORT_SHA="${SHA:0:7}"
|
||||
|
||||
if [ -n "$CURRENT_TAG" ]; then
|
||||
BRANCH_NAME="sync-upstream-$CURRENT_TAG-to-$TAG"
|
||||
PR_TITLE="chore: sync CLIProxyAPI $CURRENT_TAG-$TAG"
|
||||
PR_BODY="## Summary
|
||||
|
||||
ProxyPilot is currently tracking upstream CLIProxyAPI release \`$CURRENT_TAG\` and a newer release \`$TAG\` is available.
|
||||
|
||||
**Upstream release:** https://github.com/router-for-me/CLIProxyAPI/releases/tag/$TAG
|
||||
|
||||
## Tracking
|
||||
|
||||
- Current tracked upstream version: \`$CURRENT_TAG\`
|
||||
- Latest upstream version: \`$TAG\`
|
||||
- Latest upstream commit: \`$SHORT_SHA\`
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] Merge upstream changes into ProxyPilot
|
||||
- [ ] Review upstream changes
|
||||
- [ ] Test locally before merging
|
||||
- [ ] Update \`UPSTREAM_VERSION\`, docs, and release notes
|
||||
- [ ] Cut a new ProxyPilot release tag
|
||||
|
||||
---
|
||||
🤖 Generated by [check-upstream workflow](https://github.com/${{ github.repository }}/actions/workflows/check-upstream.yml)"
|
||||
else
|
||||
BRANCH_NAME="sync-upstream-$SHORT_SHA"
|
||||
PR_TITLE="chore: sync CLIProxyAPI $TAG"
|
||||
PR_BODY="## Summary
|
||||
|
||||
ProxyPilot does not have a tracked upstream version in \`UPSTREAM_VERSION\`, and upstream CLIProxyAPI release \`$TAG\` is available.
|
||||
|
||||
**Upstream release:** https://github.com/router-for-me/CLIProxyAPI/releases/tag/$TAG
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] Set the correct tracked upstream version
|
||||
- [ ] Merge upstream changes into ProxyPilot
|
||||
- [ ] Review upstream changes
|
||||
- [ ] Test locally before merging
|
||||
|
||||
---
|
||||
🤖 Generated by [check-upstream workflow](https://github.com/${{ github.repository }}/actions/workflows/check-upstream.yml)"
|
||||
fi
|
||||
|
||||
# Check if branch already exists
|
||||
if git ls-remote --exit-code --heads origin "$BRANCH_NAME" > /dev/null 2>&1; then
|
||||
echo "Branch $BRANCH_NAME already exists, skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if PR already exists
|
||||
EXISTING_PR=$(gh pr list --search "$PR_TITLE" --state open --json number --jq '.[0].number')
|
||||
if [ -n "$EXISTING_PR" ]; then
|
||||
echo "PR already exists: #$EXISTING_PR"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Configure git
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
# Create branch
|
||||
git checkout -b "$BRANCH_NAME"
|
||||
|
||||
# Add marker files so the PR records which upstream release triggered it.
|
||||
echo "$SHA" > .upstream-sync-sha
|
||||
echo "$TAG" > .upstream-sync-tag
|
||||
|
||||
# Commit
|
||||
git add .upstream-sync-sha .upstream-sync-tag
|
||||
git commit -m "$PR_TITLE" --allow-empty
|
||||
|
||||
# Push
|
||||
git push origin "$BRANCH_NAME"
|
||||
|
||||
# Create PR
|
||||
gh pr create \
|
||||
--title "$PR_TITLE" \
|
||||
--body "$PR_BODY" \
|
||||
--base main \
|
||||
--head "$BRANCH_NAME" \
|
||||
--label "sync-upstream"
|
||||
@@ -1,147 +1,65 @@
|
||||
name: docker-image
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
APP_NAME: CLIProxyAPI
|
||||
DOCKERHUB_REPO: eceasy/cli-proxy-api
|
||||
APP_NAME: ProxyPilot
|
||||
DOCKERHUB_REPO: ${{ secrets.DOCKERHUB_REPO || 'proxypilot/proxypilot' }}
|
||||
|
||||
jobs:
|
||||
docker_amd64:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Refresh models catalog
|
||||
run: |
|
||||
git fetch --depth 1 https://github.com/router-for-me/models.git main
|
||||
git show FETCH_HEAD:models.json > internal/registry/models/models.json
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Generate Build Metadata
|
||||
run: |
|
||||
echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
|
||||
echo COMMIT=`git rev-parse --short HEAD` >> $GITHUB_ENV
|
||||
echo BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` >> $GITHUB_ENV
|
||||
- name: Build and push (amd64)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
build-args: |
|
||||
VERSION=${{ env.VERSION }}
|
||||
COMMIT=${{ env.COMMIT }}
|
||||
BUILD_DATE=${{ env.BUILD_DATE }}
|
||||
tags: |
|
||||
${{ env.DOCKERHUB_REPO }}:latest-amd64
|
||||
${{ env.DOCKERHUB_REPO }}:${{ env.VERSION }}-amd64
|
||||
|
||||
docker_arm64:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Refresh models catalog
|
||||
run: |
|
||||
git fetch --depth 1 https://github.com/router-for-me/models.git main
|
||||
git show FETCH_HEAD:models.json > internal/registry/models/models.json
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Generate Build Metadata
|
||||
run: |
|
||||
echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
|
||||
echo COMMIT=`git rev-parse --short HEAD` >> $GITHUB_ENV
|
||||
echo BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` >> $GITHUB_ENV
|
||||
- name: Build and push (arm64)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/arm64
|
||||
push: true
|
||||
build-args: |
|
||||
VERSION=${{ env.VERSION }}
|
||||
COMMIT=${{ env.COMMIT }}
|
||||
BUILD_DATE=${{ env.BUILD_DATE }}
|
||||
tags: |
|
||||
${{ env.DOCKERHUB_REPO }}:latest-arm64
|
||||
${{ env.DOCKERHUB_REPO }}:${{ env.VERSION }}-arm64
|
||||
|
||||
docker_manifest:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- docker_amd64
|
||||
- docker_arm64
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Generate Build Metadata
|
||||
run: |
|
||||
echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
|
||||
echo COMMIT=`git rev-parse --short HEAD` >> $GITHUB_ENV
|
||||
echo BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` >> $GITHUB_ENV
|
||||
- name: Create and push multi-arch manifests
|
||||
run: |
|
||||
docker buildx imagetools create \
|
||||
--tag "${DOCKERHUB_REPO}:latest" \
|
||||
"${DOCKERHUB_REPO}:latest-amd64" \
|
||||
"${DOCKERHUB_REPO}:latest-arm64"
|
||||
docker buildx imagetools create \
|
||||
--tag "${DOCKERHUB_REPO}:${VERSION}" \
|
||||
"${DOCKERHUB_REPO}:${VERSION}-amd64" \
|
||||
"${DOCKERHUB_REPO}:${VERSION}-arm64"
|
||||
- name: Cleanup temporary tags
|
||||
continue-on-error: true
|
||||
- name: Check DockerHub credentials
|
||||
id: check-secrets
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
HAS_USERNAME: ${{ secrets.DOCKERHUB_USERNAME != '' }}
|
||||
HAS_TOKEN: ${{ secrets.DOCKERHUB_TOKEN != '' }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
namespace="${DOCKERHUB_REPO%%/*}"
|
||||
repo_name="${DOCKERHUB_REPO#*/}"
|
||||
|
||||
token="$(
|
||||
curl -fsSL \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{\"username\":\"${DOCKERHUB_USERNAME}\",\"password\":\"${DOCKERHUB_TOKEN}\"}" \
|
||||
'https://hub.docker.com/v2/users/login/' \
|
||||
| python3 -c 'import json,sys; print(json.load(sys.stdin)["token"])'
|
||||
)"
|
||||
|
||||
delete_tag() {
|
||||
local tag="$1"
|
||||
local url="https://hub.docker.com/v2/repositories/${namespace}/${repo_name}/tags/${tag}/"
|
||||
local http_code
|
||||
http_code="$(curl -sS -o /dev/null -w "%{http_code}" -X DELETE -H "Authorization: JWT ${token}" "${url}" || true)"
|
||||
if [ "${http_code}" = "204" ] || [ "${http_code}" = "404" ]; then
|
||||
echo "Docker Hub tag removed (or missing): ${DOCKERHUB_REPO}:${tag} (HTTP ${http_code})"
|
||||
return 0
|
||||
fi
|
||||
echo "Docker Hub tag delete failed: ${DOCKERHUB_REPO}:${tag} (HTTP ${http_code})"
|
||||
return 0
|
||||
}
|
||||
|
||||
delete_tag "latest-amd64"
|
||||
delete_tag "latest-arm64"
|
||||
delete_tag "${VERSION}-amd64"
|
||||
delete_tag "${VERSION}-arm64"
|
||||
if [[ "$HAS_USERNAME" != "true" || "$HAS_TOKEN" != "true" ]]; then
|
||||
echo "skip=true" >> $GITHUB_OUTPUT
|
||||
echo "::warning::DockerHub credentials not configured, skipping push"
|
||||
else
|
||||
echo "skip=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Checkout
|
||||
if: steps.check-secrets.outputs.skip != 'true'
|
||||
uses: actions/checkout@v4
|
||||
- name: Refresh models catalog
|
||||
if: steps.check-secrets.outputs.skip != 'true'
|
||||
run: curl -fsSL https://raw.githubusercontent.com/router-for-me/models/refs/heads/main/models.json -o internal/registry/models/models.json
|
||||
- name: Set up QEMU
|
||||
if: steps.check-secrets.outputs.skip != 'true'
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
if: steps.check-secrets.outputs.skip != 'true'
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to DockerHub
|
||||
if: steps.check-secrets.outputs.skip != 'true'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Generate Build Metadata
|
||||
if: steps.check-secrets.outputs.skip != 'true'
|
||||
run: |
|
||||
echo VERSION=`git describe --tags --always --dirty` >> $GITHUB_ENV
|
||||
echo COMMIT=`git rev-parse --short HEAD` >> $GITHUB_ENV
|
||||
echo BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` >> $GITHUB_ENV
|
||||
- name: Build and push
|
||||
if: steps.check-secrets.outputs.skip != 'true'
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: |
|
||||
linux/amd64
|
||||
linux/arm64
|
||||
push: true
|
||||
build-args: |
|
||||
VERSION=${{ env.VERSION }}
|
||||
COMMIT=${{ env.COMMIT }}
|
||||
BUILD_DATE=${{ env.BUILD_DATE }}
|
||||
tags: |
|
||||
${{ env.DOCKERHUB_REPO }}:latest
|
||||
${{ env.DOCKERHUB_REPO }}:${{ env.VERSION }}
|
||||
|
||||
@@ -13,9 +13,7 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Refresh models catalog
|
||||
run: |
|
||||
git fetch --depth 1 https://github.com/router-for-me/models.git main
|
||||
git show FETCH_HEAD:models.json > internal/registry/models/models.json
|
||||
run: curl -fsSL https://raw.githubusercontent.com/router-for-me/models/refs/heads/main/models.json -o internal/registry/models/models.json
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
@@ -25,3 +23,17 @@ jobs:
|
||||
run: |
|
||||
go build -o test-output ./cmd/server
|
||||
rm -f test-output
|
||||
- name: Vet
|
||||
run: go vet ./...
|
||||
- name: Test with coverage
|
||||
run: |
|
||||
go test -coverprofile=coverage.out -covermode=atomic ./... 2>&1 | tee test-output.txt
|
||||
# Extract total coverage percentage
|
||||
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%')
|
||||
echo "Total coverage: ${COVERAGE}%"
|
||||
# Fail if coverage drops below 30%
|
||||
THRESHOLD=30
|
||||
if [ "$(echo "$COVERAGE < $THRESHOLD" | bc -l)" -eq 1 ]; then
|
||||
echo "ERROR: Coverage ${COVERAGE}% is below threshold ${THRESHOLD}%"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
name: Publish ProxyPilot via Bun
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["ProxyPilot Release"]
|
||||
types:
|
||||
- completed
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- name: Setup registry auth
|
||||
working-directory: bun/proxypilot
|
||||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
|
||||
|
||||
- name: Publish package
|
||||
working-directory: bun/proxypilot
|
||||
run: bun publish --access public
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
@@ -0,0 +1,83 @@
|
||||
name: ProxyPilot Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build ${{ matrix.os }}-${{ matrix.arch }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: darwin
|
||||
arch: amd64
|
||||
extension: ''
|
||||
- os: darwin
|
||||
arch: arm64
|
||||
extension: ''
|
||||
- os: linux
|
||||
arch: amd64
|
||||
extension: ''
|
||||
- os: linux
|
||||
arch: arm64
|
||||
extension: ''
|
||||
- os: windows
|
||||
arch: amd64
|
||||
extension: '.exe'
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Remove Windows resources for non-Windows builds
|
||||
if: matrix.os != 'windows'
|
||||
run: rm -f cmd/server/*.syso
|
||||
|
||||
- name: Build binary
|
||||
env:
|
||||
GOOS: ${{ matrix.os }}
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
CGO_ENABLED: 0
|
||||
run: |
|
||||
go build -ldflags="-s -w" -o proxypilot-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }} ./cmd/server
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: proxypilot-${{ matrix.os }}-${{ matrix.arch }}
|
||||
path: proxypilot-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}
|
||||
|
||||
release:
|
||||
name: Create Release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Prepare release assets
|
||||
run: |
|
||||
mkdir -p release
|
||||
find artifacts -type f -exec cp {} release/ \;
|
||||
cd release && sha256sum * > checksums.txt
|
||||
ls -la
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: release/*
|
||||
generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -17,9 +17,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Refresh models catalog
|
||||
run: |
|
||||
git fetch --depth 1 https://github.com/router-for-me/models.git main
|
||||
git show FETCH_HEAD:models.json > internal/registry/models/models.json
|
||||
run: curl -fsSL https://raw.githubusercontent.com/router-for-me/models/refs/heads/main/models.json -o internal/registry/models/models.json
|
||||
- run: git fetch --force --tags
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
@@ -27,14 +25,15 @@ jobs:
|
||||
cache: true
|
||||
- name: Generate Build Metadata
|
||||
run: |
|
||||
echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
|
||||
VERSION=$(git describe --tags --always --dirty)
|
||||
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
echo COMMIT=`git rev-parse --short HEAD` >> $GITHUB_ENV
|
||||
echo BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` >> $GITHUB_ENV
|
||||
- uses: goreleaser/goreleaser-action@v4
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --clean --skip=validate
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VERSION: ${{ env.VERSION }}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
name: Build Windows Release
|
||||
|
||||
on:
|
||||
# Only run manually - not on every tag
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version (e.g., 0.1.0)'
|
||||
required: true
|
||||
default: '0.1.0'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Build WebUI
|
||||
run: |
|
||||
cd webui
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
- name: Build Windows binaries
|
||||
run: |
|
||||
mkdir -p dist
|
||||
# Build tray app (includes embedded dashboard)
|
||||
go build -ldflags="-s -w -H=windowsgui" -o dist/ProxyPilot.exe ./cmd/proxypilot-tray
|
||||
|
||||
- name: Install Inno Setup
|
||||
run: |
|
||||
choco install innosetup -y
|
||||
|
||||
- name: Generate installer branding images
|
||||
run: |
|
||||
cd installer/assets
|
||||
powershell -ExecutionPolicy Bypass -File generate-wizard-images.ps1
|
||||
|
||||
- name: Get version
|
||||
id: version
|
||||
run: |
|
||||
if ("${{ github.event.inputs.version }}" -ne "") {
|
||||
$version = "${{ github.event.inputs.version }}"
|
||||
} else {
|
||||
$tag = "${{ github.ref_name }}"
|
||||
$version = $tag -replace '^v', ''
|
||||
}
|
||||
$versionInfo = $version -replace '^v', '' -replace '-dev-0\.', '.' -replace '-dev-', '.'
|
||||
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
|
||||
echo "VERSION_INFO=$versionInfo" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Build Inno Setup Installer
|
||||
run: |
|
||||
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /DAppVersion="${{ steps.version.outputs.VERSION }}" /DVersionInfoVersion="${{ steps.version.outputs.VERSION_INFO }}" installer\proxypilot.iss
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows-release
|
||||
path: |
|
||||
dist/ProxyPilot.exe
|
||||
dist/ProxyPilot-*-Setup.exe
|
||||
|
||||
- name: Upload to Release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
dist/ProxyPilot.exe
|
||||
dist/ProxyPilot-${{ steps.version.outputs.VERSION }}-Setup.exe
|
||||
@@ -1,5 +1,9 @@
|
||||
# Binaries
|
||||
cli-proxy-api
|
||||
cliproxy
|
||||
proxypilot-linux
|
||||
proxypilot-darwin
|
||||
proxypilot-windows
|
||||
*.exe
|
||||
|
||||
# Configuration
|
||||
@@ -20,6 +24,12 @@ objectstore/*
|
||||
|
||||
# Static assets
|
||||
static/*
|
||||
!static/icon.png
|
||||
!static/icon.ico
|
||||
test/
|
||||
dist/*
|
||||
.proxypilot/*
|
||||
memory/*
|
||||
|
||||
# Authentication data
|
||||
auths/*
|
||||
@@ -27,6 +37,19 @@ auths/*
|
||||
|
||||
# Documentation
|
||||
docs/*
|
||||
!docs/claude-code-local-proxy.md
|
||||
!docs/cursor-ide.md
|
||||
!docs/compat-matrix.md
|
||||
!docs/hindsight.md
|
||||
!docs/desktop-ui-spec.md
|
||||
!docs/windows-ui-spec.md
|
||||
!docs/memory.md
|
||||
!docs/proxypilot.md
|
||||
!docs/agentic-harness-demo.md
|
||||
!docs/long-context-features.md
|
||||
!docs/desktop-app-build-process.md
|
||||
!docs/cli.md
|
||||
!docs/rust-replatform.md
|
||||
AGENTS.md
|
||||
CLAUDE.md
|
||||
GEMINI.md
|
||||
@@ -45,11 +68,60 @@ GEMINI.md
|
||||
.bmad/*
|
||||
_bmad/*
|
||||
_bmad-output/*
|
||||
.mcp/*
|
||||
.cursor/*
|
||||
|
||||
# Local artifacts
|
||||
claude-progress.txt
|
||||
feature_list.json
|
||||
tui-snapshot*.txt
|
||||
tui-ttyd.png
|
||||
rust/target/
|
||||
|
||||
# Local settings (user-specific)
|
||||
*.local.json
|
||||
*.local.yaml
|
||||
*.local.toml
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
._*
|
||||
|
||||
# Windows artifacts
|
||||
nul
|
||||
Thumbs.db
|
||||
desktop.ini
|
||||
|
||||
# Backup/temp files
|
||||
*~
|
||||
*.bak
|
||||
*.tmp
|
||||
*.swp
|
||||
*.orig
|
||||
*.proxypilot-backup
|
||||
|
||||
# Test scripts
|
||||
*.ahk
|
||||
tray_click_log.txt
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
*_out.txt
|
||||
|
||||
# Added by Gemini CLI fix
|
||||
node_modules/
|
||||
dist/
|
||||
.turbo/
|
||||
build/
|
||||
|
||||
# Local files
|
||||
PLAN-*.md
|
||||
config-debug.yaml
|
||||
.wix/
|
||||
test_results.txt
|
||||
test_results_full.txt
|
||||
tmpclaude-*
|
||||
|
||||
# Opencode
|
||||
.beads/
|
||||
.opencode/
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
version: 2
|
||||
before:
|
||||
hooks:
|
||||
# Remove Windows resource files before building
|
||||
# These .syso files cause ARM64 cross-compile failures on Linux/Darwin
|
||||
- find . -name "*.syso" -type f -delete || true
|
||||
|
||||
builds:
|
||||
- id: "cli-proxy-api"
|
||||
- id: "cli-proxy-api-plus"
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
@@ -12,12 +16,16 @@ builds:
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
ignore:
|
||||
# Skip Windows ARM64 (not commonly used)
|
||||
- goos: windows
|
||||
goarch: arm64
|
||||
main: ./cmd/server/
|
||||
binary: cli-proxy-api
|
||||
binary: cli-proxy-api-plus
|
||||
ldflags:
|
||||
- -s -w -X 'main.Version={{.Version}}' -X 'main.Commit={{.ShortCommit}}' -X 'main.BuildDate={{.Date}}'
|
||||
- -s -w -X 'main.Version={{.Version}}-plus' -X 'main.Commit={{.ShortCommit}}' -X 'main.BuildDate={{.Date}}'
|
||||
archives:
|
||||
- id: "cli-proxy-api"
|
||||
- id: "cli-proxy-api-plus"
|
||||
format: tar.gz
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
@@ -25,7 +33,6 @@ archives:
|
||||
files:
|
||||
- LICENSE
|
||||
- README.md
|
||||
- README_CN.md
|
||||
- config.example.yaml
|
||||
|
||||
checksum:
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
# Contributing to ProxyPilot
|
||||
|
||||
Thank you for your interest in contributing to ProxyPilot! This guide will help you get started.
|
||||
|
||||
## Development Environment Setup
|
||||
|
||||
1. **Install Go 1.24+**
|
||||
- Download from [golang.org](https://golang.org/dl/)
|
||||
- Verify installation: `go version`
|
||||
|
||||
2. **Clone the repository**
|
||||
```bash
|
||||
git clone https://github.com/your-org/ProxyPilot.git
|
||||
cd ProxyPilot
|
||||
```
|
||||
|
||||
3. **Install dependencies**
|
||||
```bash
|
||||
go mod download
|
||||
```
|
||||
|
||||
## Running Tests
|
||||
|
||||
Run all tests:
|
||||
```bash
|
||||
go test ./...
|
||||
```
|
||||
|
||||
Run tests with coverage:
|
||||
```bash
|
||||
go test -cover ./...
|
||||
```
|
||||
|
||||
Run tests for a specific package:
|
||||
```bash
|
||||
go test ./pkg/proxy/...
|
||||
```
|
||||
|
||||
## Code Style Guidelines
|
||||
|
||||
We follow standard Go conventions:
|
||||
|
||||
- **Format code** before committing:
|
||||
```bash
|
||||
go fmt ./...
|
||||
```
|
||||
|
||||
- **Run static analysis**:
|
||||
```bash
|
||||
go vet ./...
|
||||
```
|
||||
|
||||
- Follow [Effective Go](https://golang.org/doc/effective_go) guidelines
|
||||
- Keep functions focused and reasonably sized
|
||||
- Add comments for exported functions and types
|
||||
- Use meaningful variable and function names
|
||||
|
||||
## Pull Request Process
|
||||
|
||||
1. Fork the repository and create a feature branch from `main`
|
||||
2. Make your changes with clear, atomic commits
|
||||
3. Ensure all tests pass and add tests for new functionality
|
||||
4. Run `go fmt` and `go vet` before submitting
|
||||
5. Open a pull request with a clear description of the changes
|
||||
6. Link any related issues in the PR description
|
||||
7. Address review feedback promptly
|
||||
|
||||
## Issue Reporting Guidelines
|
||||
|
||||
When reporting issues, please include:
|
||||
|
||||
- **Bug reports**: Steps to reproduce, expected behavior, actual behavior, Go version, and OS
|
||||
- **Feature requests**: Clear description of the proposed feature and its use case
|
||||
- **Questions**: Check existing issues and documentation first
|
||||
|
||||
Use descriptive titles and provide as much context as possible.
|
||||
|
||||
## Third-Party Provider Integrations
|
||||
|
||||
We welcome contributions that add integrations with third-party providers! If you're adding a new provider integration:
|
||||
|
||||
- Follow the existing integration patterns in the codebase
|
||||
- Include documentation for configuration options
|
||||
- Add appropriate tests
|
||||
- Update the README if necessary
|
||||
|
||||
## Questions?
|
||||
|
||||
Feel free to open an issue for any questions about contributing.
|
||||
@@ -12,19 +12,19 @@ ARG VERSION=dev
|
||||
ARG COMMIT=none
|
||||
ARG BUILD_DATE=unknown
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X 'main.Version=${VERSION}' -X 'main.Commit=${COMMIT}' -X 'main.BuildDate=${BUILD_DATE}'" -o ./CLIProxyAPI ./cmd/server/
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X 'main.Version=${VERSION}-plus' -X 'main.Commit=${COMMIT}' -X 'main.BuildDate=${BUILD_DATE}'" -o ./CLIProxyAPIPlus ./cmd/server/
|
||||
|
||||
FROM alpine:3.22.0
|
||||
|
||||
RUN apk add --no-cache tzdata
|
||||
|
||||
RUN mkdir /CLIProxyAPI
|
||||
RUN mkdir /ProxyPilot
|
||||
|
||||
COPY --from=builder ./app/CLIProxyAPI /CLIProxyAPI/CLIProxyAPI
|
||||
COPY --from=builder ./app/CLIProxyAPIPlus /CLIProxyAPI/CLIProxyAPIPlus
|
||||
|
||||
COPY config.example.yaml /CLIProxyAPI/config.example.yaml
|
||||
COPY config.example.yaml /ProxyPilot/config.example.yaml
|
||||
|
||||
WORKDIR /CLIProxyAPI
|
||||
WORKDIR /ProxyPilot
|
||||
|
||||
EXPOSE 8317
|
||||
|
||||
@@ -32,4 +32,4 @@ ENV TZ=Asia/Shanghai
|
||||
|
||||
RUN cp /usr/share/zoneinfo/${TZ} /etc/localtime && echo "${TZ}" > /etc/timezone
|
||||
|
||||
CMD ["./CLIProxyAPI"]
|
||||
CMD ["./CLIProxyAPIPlus"]
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
FROM alpine:latest
|
||||
|
||||
# Install ttyd
|
||||
RUN apk add --no-cache ttyd
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the binary (we'll mount it instead for dev)
|
||||
# The binary will be mounted at runtime
|
||||
|
||||
EXPOSE 7681
|
||||
|
||||
# Run ttyd with the mounted binary
|
||||
CMD ["ttyd", "-p", "7681", "-W", "./proxypilot", "tui"]
|
||||
@@ -1,7 +1,8 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025-2005.9 Luis Pater
|
||||
Copyright (c) 2025.9-present Router-For.ME
|
||||
Copyright (c) 2024-2025 Luis Pater
|
||||
Copyright (c) 2024-2025 Router-For.ME
|
||||
Copyright (c) 2025 Finesssee (ProxyPilot fork)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
ProxyPilot
|
||||
|
||||
ProxyPilot is a fork and rebrand of the CLIProxyAPI project (the underlying proxy engine).
|
||||
|
||||
This repository is distributed under the MIT License; see LICENSE.
|
||||
|
||||
@@ -1,206 +1,380 @@
|
||||
# CLI Proxy API
|
||||
<p align="center">
|
||||
<img src="./static/icon.png" width="128" height="128" alt="ProxyPilot Logo">
|
||||
</p>
|
||||
|
||||
English | [中文](README_CN.md) | [日本語](README_JA.md)
|
||||
<h1 align="center">ProxyPilot</h1>
|
||||
|
||||
A proxy server that provides OpenAI/Gemini/Claude/Codex compatible API interfaces for CLI.
|
||||
<p align="center">
|
||||
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-28a745" alt="MIT License"></a>
|
||||
<a href="https://golang.org/"><img src="https://img.shields.io/badge/Go-1.24+-00ADD8?logo=go" alt="Go Version"></a>
|
||||
<a href="https://x.com/Finessse377721"><img src="https://img.shields.io/badge/Follow-%F0%9D%95%8F%2F%40Finessse377721-1c9bf0" alt="Follow on 𝕏"></a>
|
||||
<a href="https://github.com/Finesssee/ProxyPilot"><img src="https://img.shields.io/github/stars/Finesssee/ProxyPilot.svg?style=social&label=Star%20this%20repo" alt="Star this repo"></a>
|
||||
</p>
|
||||
|
||||
It now also supports OpenAI Codex (GPT models) and Claude Code via OAuth.
|
||||
<p align="center">
|
||||
<strong>Stop juggling API keys.</strong> ProxyPilot is a powerful local API proxy that lets you use your existing Claude Code, Codex, Gemini, Kiro, and Qwen subscriptions with any AI coding tool – no separate API keys required.
|
||||
</p>
|
||||
|
||||
So you can use local or multi-account CLI access with OpenAI(include Responses)/Gemini/Claude-compatible clients and SDKs.
|
||||
<p align="center">
|
||||
Built in Go, it handles OAuth authentication, token management, and API translation automatically. One server to route them all.
|
||||
</p>
|
||||
|
||||
## Sponsor
|
||||
|
||||
[](https://z.ai/subscribe?ic=8JVLJQFSKB)
|
||||
|
||||
This project is sponsored by Z.ai, supporting us with their GLM CODING PLAN.
|
||||
|
||||
GLM CODING PLAN is a subscription service designed for AI coding, starting at just $10/month. It provides access to their flagship GLM-4.7 & (GLM-5 Only Available for Pro Users)model across 10+ popular AI coding tools (Claude Code, Cline, Roo Code, etc.), offering developers top-tier, fast, and stable coding experiences.
|
||||
|
||||
Get 10% OFF GLM CODING PLAN:https://z.ai/subscribe?ic=8JVLJQFSKB
|
||||
<p align="center">
|
||||
An experimental Rust replatform now lives on the <code>rust-replatform</code> branch with a terminal-first <code>proxypilot-rs</code> binary under <code>rust/</code>.
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="180"><a href="https://www.packyapi.com/register?aff=cliproxyapi"><img src="./assets/packycode.png" alt="PackyCode" width="150"></a></td>
|
||||
<td>Thanks to PackyCode for sponsoring this project! PackyCode is a reliable and efficient API relay service provider, offering relay services for Claude Code, Codex, Gemini, and more. PackyCode provides special discounts for our software users: register using <a href="https://www.packyapi.com/register?aff=cliproxyapi">this link</a> and enter the "cliproxyapi" promo code during recharge to get 10% off.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180"><a href="https://www.aicodemirror.com/register?invitecode=TJNAIF"><img src="./assets/aicodemirror.png" alt="AICodeMirror" width="150"></a></td>
|
||||
<td>Thanks to AICodeMirror for sponsoring this project! AICodeMirror provides official high-stability relay services for Claude Code / Codex / Gemini CLI, with enterprise-grade concurrency, fast invoicing, and 24/7 dedicated technical support. Claude Code / Codex / Gemini official channels at 38% / 2% / 9% of original price, with extra discounts on top-ups! AICodeMirror offers special benefits for CLIProxyAPI users: register via <a href="https://www.aicodemirror.com/register?invitecode=TJNAIF">this link</a> to enjoy 20% off your first top-up, and enterprise customers can get up to 25% off!</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180"><a href="https://shop.bmoplus.com/?utm_source=github"><img src="./assets/bmoplus.png" alt="BmoPlus" width="150"></a></td>
|
||||
<td>Huge thanks to BmoPlus for sponsoring this project! BmoPlus is a highly reliable AI account provider built strictly for heavy AI users and developers. They offer rock-solid, ready-to-use accounts and official top-up services for ChatGPT Plus / ChatGPT Pro (Full Warranty) / Claude Pro / Super Grok / Gemini Pro. By registering and ordering through <a href="https://shop.bmoplus.com/?utm_source=github">BmoPlus - Premium AI Accounts & Top-ups</a>, users can unlock the mind-blowing rate of <b>10% of the official GPT subscription price (90% OFF)</b>!</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180"><a href="https://www.lingtrue.com/register"><img src="./assets/lingtrue.png" alt="LingtrueAPI" width="150"></a></td>
|
||||
<td>Thanks to LingtrueAPI for its sponsorship of this project! LingtrueAPI is a global large - model API intermediary service platform that provides API calling services for various top - notch models such as Claude Code, Codex, and Gemini. It is committed to enabling users to connect to global AI capabilities at low cost and with high stability. LingtrueAPI offers special discounts to users of this software: register using <a href="https://www.lingtrue.com/register">this link</a>, and enter the promo code "LingtrueAPI" when making the first recharge to enjoy a 10% discount.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180"><a href="https://poixe.com/i/m8kvep"><img src="./assets/poixeai.png" alt="PoixeAI" width="150"></a></td>
|
||||
<td>Thanks to Poixe AI for sponsoring this project! Poixe AI provides reliable LLM API services. You can leverage the platform's API endpoints to seamlessly build AI-powered products. Additionally, you can become a vendor by providing AI API resources to the platform and earn revenue. Register through the exclusive CLIProxyAPI <a href="https://poixe.com/i/m8kvep">referral link</a> and receive a bonus of $5 USD on your first top-up.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
> [!TIP]
|
||||
> 📣 **Latest models supported:**
|
||||
> Claude Opus 4.5 / Sonnet 4.5 with extended thinking, GPT-5.2 / GPT-5.2 Codex, Gemini 3 Pro/Flash, and Kiro (AWS CodeWhisperer)! 🚀
|
||||
|
||||
## Overview
|
||||
**Setup Guides:**
|
||||
- [Claude Code Setup →](docs/claude-code-local-proxy.md)
|
||||
- [Cursor IDE Setup →](docs/cursor-ide.md)
|
||||
|
||||
- OpenAI/Gemini/Claude compatible API endpoints for CLI models
|
||||
- OpenAI Codex support (GPT models) via OAuth login
|
||||
- Claude Code support via OAuth login
|
||||
- Qwen Code support via OAuth login
|
||||
- iFlow support via OAuth login
|
||||
- Amp CLI and IDE extensions support with provider routing
|
||||
- Streaming and non-streaming responses
|
||||
- Function calling/tools support
|
||||
- Multimodal input support (text and images)
|
||||
- Multiple accounts with round-robin load balancing (Gemini, OpenAI, Claude, Qwen and iFlow)
|
||||
- Simple CLI authentication flows (Gemini, OpenAI, Claude, Qwen and iFlow)
|
||||
- Generative Language API Key support
|
||||
- AI Studio Build multi-account load balancing
|
||||
- Gemini CLI multi-account load balancing
|
||||
- Claude Code multi-account load balancing
|
||||
- Qwen Code multi-account load balancing
|
||||
- iFlow multi-account load balancing
|
||||
- OpenAI Codex multi-account load balancing
|
||||
- OpenAI-compatible upstream providers via config (e.g., OpenRouter)
|
||||
- Reusable Go SDK for embedding the proxy (see `docs/sdk-usage.md`)
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
## Features
|
||||
|
||||
CLIProxyAPI Guides: [https://help.router-for.me/](https://help.router-for.me/)
|
||||
- 🎯 **10 Auth Providers** - Claude, Codex (OpenAI), Gemini, Gemini CLI, Kiro (AWS), Amazon Q CLI, Qwen, Antigravity, MiniMax, Zhipu AI
|
||||
- 🔄 **Universal API Translation** - Auto-converts between OpenAI, Anthropic, and Gemini formats
|
||||
- 🔧 **Tool Calling Repair** - Fixes tool/function call mismatches between providers automatically
|
||||
- 🧠 **Extended Thinking** - Full support for Claude and Gemini thinking models
|
||||
- 🔐 **OAuth Integration** - Browser-based login with automatic token refresh
|
||||
- 👥 **Multi-Account Support** - Round-robin distribution with automatic failover
|
||||
- ⚡ **Quota Auto-Switch** - Automatically switches to backup project/model when quota exceeded
|
||||
- 📊 **Usage Statistics** - Track requests, tokens, and errors per provider/model
|
||||
- 🧩 **Context Compression** - LLM-based summarization for long sessions (Factory.ai research)
|
||||
- 🤖 **Agentic Harness** - Guided workflow for coding agents (Anthropic research)
|
||||
- 💾 **Session Memory** - Persistent storage across conversation turns
|
||||
- 🎨 **System Tray** - Native Windows tray app for quick access
|
||||
- 🔄 **Auto-Updates** - Background update checking with one-click install
|
||||
- ⏪ **Rollback Support** - Automatic crash detection with version recovery
|
||||
- 📡 **60+ Management APIs** - Full control via REST endpoints
|
||||
|
||||
## Management API
|
||||
---
|
||||
|
||||
see [MANAGEMENT_API.md](https://help.router-for.me/management/api)
|
||||
## Supported Providers
|
||||
|
||||
## Amp CLI Support
|
||||
| Provider | Auth Method | Models |
|
||||
|----------|-------------|--------|
|
||||
| Claude (Anthropic) | OAuth2 / API Key | Claude Opus 4.5, Sonnet 4.5, Haiku 4.5 |
|
||||
| Codex (OpenAI) | OAuth2 / API Key | GPT-5.2, GPT-5.2 Codex |
|
||||
| Gemini | OAuth2 / API Key | Gemini 3 Pro, Gemini 3 Flash |
|
||||
| Gemini CLI | OAuth2 | Cloud Code Assist (separate quota) |
|
||||
| Kiro | OAuth2 + AWS SSO | AWS CodeWhisperer |
|
||||
| Amazon Q CLI | Import from CLI | Amazon Q Developer |
|
||||
| Qwen | OAuth2 | Qwen models |
|
||||
| Antigravity | OAuth2 | Gemini via Antigravity (separate quota) |
|
||||
| MiniMax | API Key | MiniMax M2, M2.1 models |
|
||||
| Zhipu AI | API Key | GLM-4.5, GLM-4.6, GLM-4.7 |
|
||||
| Custom | API Key | Any OpenAI-compatible endpoint |
|
||||
|
||||
CLIProxyAPI includes integrated support for [Amp CLI](https://ampcode.com) and Amp IDE extensions, enabling you to use your Google/ChatGPT/Claude OAuth subscriptions with Amp's coding tools:
|
||||
---
|
||||
|
||||
- Provider route aliases for Amp's API patterns (`/api/provider/{provider}/v1...`)
|
||||
- Management proxy for OAuth authentication and account features
|
||||
- Smart model fallback with automatic routing
|
||||
- **Model mapping** to route unavailable models to alternatives (e.g., `claude-opus-4.5` → `claude-sonnet-4`)
|
||||
- Security-first design with localhost-only management endpoints
|
||||
## Installation
|
||||
|
||||
When you need the request/response shape of a specific backend family, use the provider-specific paths instead of the merged `/v1/...` endpoints:
|
||||
### Download Pre-built Release (Recommended)
|
||||
|
||||
- Use `/api/provider/{provider}/v1/messages` for messages-style backends.
|
||||
- Use `/api/provider/{provider}/v1beta/models/...` for model-scoped generate endpoints.
|
||||
- Use `/api/provider/{provider}/v1/chat/completions` for chat-completions backends.
|
||||
1. Go to the [**Releases**](https://github.com/Finesssee/ProxyPilot/releases) page
|
||||
2. Download the latest binary for your platform
|
||||
3. Run `./proxypilot`
|
||||
|
||||
These routes help you select the protocol surface, but they do not by themselves guarantee a unique inference executor when the same client-visible model name is reused across multiple backends. Inference routing is still resolved from the request model/alias. For strict backend pinning, use unique aliases, prefixes, or otherwise avoid overlapping client-visible model names.
|
||||
### Build from Source
|
||||
|
||||
**→ [Complete Amp CLI Integration Guide](https://help.router-for.me/agent-client/amp-cli.html)**
|
||||
```bash
|
||||
git clone https://github.com/Finesssee/ProxyPilot.git
|
||||
cd ProxyPilot
|
||||
go build -o proxypilot ./cmd/server
|
||||
./proxypilot
|
||||
```
|
||||
|
||||
## SDK Docs
|
||||
---
|
||||
|
||||
- Usage: [docs/sdk-usage.md](docs/sdk-usage.md)
|
||||
- Advanced (executors & translators): [docs/sdk-advanced.md](docs/sdk-advanced.md)
|
||||
- Access: [docs/sdk-access.md](docs/sdk-access.md)
|
||||
- Watcher: [docs/sdk-watcher.md](docs/sdk-watcher.md)
|
||||
- Custom Provider Example: `examples/custom-provider`
|
||||
## Usage
|
||||
|
||||
## Contributing
|
||||
### First Launch
|
||||
|
||||
Contributions are welcome! Please feel free to submit a Pull Request.
|
||||
1. Packaged installs create `config.yaml` automatically on first start when `config.example.yaml` is bundled next to the executable.
|
||||
2. If you're running from source, copy config: `cp config.example.yaml config.yaml`
|
||||
3. Run: `./proxypilot`
|
||||
4. Server starts on `http://localhost:8317`
|
||||
5. Open dashboard: `http://localhost:8317/management.html`
|
||||
|
||||
1. Fork the repository
|
||||
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
||||
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
||||
4. Push to the branch (`git push origin feature/amazing-feature`)
|
||||
5. Open a Pull Request
|
||||
### Authentication
|
||||
|
||||
## Who is with us?
|
||||
Run OAuth login for your provider:
|
||||
|
||||
Those projects are based on CLIProxyAPI:
|
||||
```bash
|
||||
# OAuth providers (opens browser)
|
||||
./proxypilot --claude-login # Claude
|
||||
./proxypilot --codex-login # OpenAI/Codex
|
||||
./proxypilot --login # Gemini
|
||||
./proxypilot --kiro-login # Kiro (Google OAuth)
|
||||
./proxypilot --kiro-aws-login # Kiro (AWS Builder ID)
|
||||
./proxypilot --qwen-login # Qwen
|
||||
./proxypilot --antigravity-login # Antigravity
|
||||
|
||||
### [vibeproxy](https://github.com/automazeio/vibeproxy)
|
||||
# Import providers (from existing CLI tools)
|
||||
./proxypilot --kiro-import # Kiro IDE token
|
||||
|
||||
Native macOS menu bar app to use your Claude Code & ChatGPT subscriptions with AI coding tools - no API keys needed
|
||||
# API key providers (prompts for key)
|
||||
./proxypilot --minimax-login # MiniMax API key
|
||||
./proxypilot --zhipu-login # Zhipu AI API key
|
||||
```
|
||||
|
||||
### [Subtitle Translator](https://github.com/VjayC/SRT-Subtitle-Translator-Validator)
|
||||
OAuth tokens are stored locally and auto-refreshed before expiry.
|
||||
|
||||
Browser-based tool to translate SRT subtitles using your Gemini subscription via CLIProxyAPI with automatic validation/error correction - no API keys needed
|
||||
### Security Defaults (Auth + CORS)
|
||||
|
||||
### [CCS (Claude Code Switch)](https://github.com/kaitranntt/ccs)
|
||||
- Proxy requests require API keys by default. To allow unauthenticated access (not recommended), set `allow-unauthenticated: true` in `config.yaml`.
|
||||
- CORS is enabled for non-management endpoints by default (wildcard `*`). Management endpoints **do not** emit CORS headers unless you explicitly allow origins under `cors.management-allow-origins`.
|
||||
|
||||
CLI wrapper for instant switching between multiple Claude accounts and alternative models (Gemini, Codex, Antigravity) via CLIProxyAPI OAuth - no API keys needed
|
||||
Example:
|
||||
|
||||
### [Quotio](https://github.com/nguyenphutrong/quotio)
|
||||
```yaml
|
||||
allow-unauthenticated: false
|
||||
cors:
|
||||
allow-origins:
|
||||
- "http://localhost:5173"
|
||||
management-allow-origins:
|
||||
- "http://localhost:5173"
|
||||
```
|
||||
|
||||
Native macOS menu bar app that unifies Claude, Gemini, OpenAI, Qwen, and Antigravity subscriptions with real-time quota tracking and smart auto-failover for AI coding tools like Claude Code, OpenCode, and Droid - no API keys needed.
|
||||
### Configure Your Tools
|
||||
|
||||
### [CodMate](https://github.com/loocor/CodMate)
|
||||
**Claude Code** (`~/.claude/settings.json`):
|
||||
```json
|
||||
{
|
||||
"env": {
|
||||
"ANTHROPIC_BASE_URL": "http://127.0.0.1:8317",
|
||||
"ANTHROPIC_AUTH_TOKEN": "your-api-key"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Native macOS SwiftUI app for managing CLI AI sessions (Codex, Claude Code, Gemini CLI) with unified provider management, Git review, project organization, global search, and terminal integration. Integrates CLIProxyAPI to provide OAuth authentication for Codex, Claude, Gemini, Antigravity, and Qwen Code, with built-in and third-party provider rerouting through a single proxy endpoint - no API keys needed for OAuth providers.
|
||||
**Codex CLI** (`~/.codex/config.toml`):
|
||||
```toml
|
||||
[openai]
|
||||
api_base_url = "http://127.0.0.1:8317"
|
||||
```
|
||||
|
||||
### [ProxyPilot](https://github.com/Finesssee/ProxyPilot)
|
||||
**Factory Droid** (`~/.factory/settings.json`):
|
||||
```json
|
||||
{
|
||||
"customModels": [{
|
||||
"name": "ProxyPilot",
|
||||
"baseUrl": "http://127.0.0.1:8317"
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
Windows-native CLIProxyAPI fork with TUI, system tray, and multi-provider OAuth for AI coding tools - no API keys needed.
|
||||
---
|
||||
|
||||
### [Claude Proxy VSCode](https://github.com/uzhao/claude-proxy-vscode)
|
||||
## API Endpoints
|
||||
|
||||
VSCode extension for quick switching between Claude Code models, featuring integrated CLIProxyAPI as its backend with automatic background lifecycle management.
|
||||
```
|
||||
POST /v1/chat/completions # OpenAI Chat Completions
|
||||
POST /v1/responses # OpenAI Responses API
|
||||
POST /v1/messages # Anthropic Messages API
|
||||
GET /v1/models # List available models
|
||||
GET /healthz # Health check
|
||||
```
|
||||
|
||||
### [ZeroLimit](https://github.com/0xtbug/zero-limit)
|
||||
All endpoints auto-translate between formats based on the target provider.
|
||||
|
||||
Windows desktop app built with Tauri + React for monitoring AI coding assistant quotas via CLIProxyAPI. Track usage across Gemini, Claude, OpenAI Codex, and Antigravity accounts with real-time dashboard, system tray integration, and one-click proxy control - no API keys needed.
|
||||
---
|
||||
|
||||
### [CPA-XXX Panel](https://github.com/ferretgeek/CPA-X)
|
||||
## Caching
|
||||
|
||||
A lightweight web admin panel for CLIProxyAPI with health checks, resource monitoring, real-time logs, auto-update, request statistics and pricing display. Supports one-click installation and systemd service.
|
||||
ProxyPilot includes two caching layers to reduce latency and token usage.
|
||||
|
||||
### [CLIProxyAPI Tray](https://github.com/kitephp/CLIProxyAPI_Tray)
|
||||
### Response Cache
|
||||
|
||||
A Windows tray application implemented using PowerShell scripts, without relying on any third-party libraries. The main features include: automatic creation of shortcuts, silent running, password management, channel switching (Main / Plus), and automatic downloading and updating.
|
||||
Caches full API responses for identical requests. Useful for repeated queries during development.
|
||||
|
||||
### [霖君](https://github.com/wangdabaoqq/LinJun)
|
||||
**Config** (`config.yaml`):
|
||||
```yaml
|
||||
response-cache:
|
||||
enabled: true # Default: false
|
||||
max-size: 1000 # Max entries (default: 1000)
|
||||
max-bytes: 0 # Optional total cache size cap in bytes
|
||||
ttl-seconds: 300 # Cache TTL (default: 300 = 5 min)
|
||||
exclude-models: # Models to skip (supports wildcards)
|
||||
- "*-thinking"
|
||||
- "o1-*"
|
||||
```
|
||||
|
||||
霖君 is a cross-platform desktop application for managing AI programming assistants, supporting macOS, Windows, and Linux systems. Unified management of Claude Code, Gemini CLI, OpenAI Codex, Qwen Code, and other AI coding tools, with local proxy for multi-account quota tracking and one-click configuration.
|
||||
### Prompt Cache
|
||||
|
||||
### [CLIProxyAPI Dashboard](https://github.com/itsmylife44/cliproxyapi-dashboard)
|
||||
Synthetic prompt caching for providers without native support. Tracks repeated system prompts and estimates token savings.
|
||||
|
||||
A modern web-based management dashboard for CLIProxyAPI built with Next.js, React, and PostgreSQL. Features real-time log streaming, structured configuration editing, API key management, OAuth provider integration for Claude/Gemini/Codex, usage analytics, container management, and config sync with OpenCode via companion plugin - no manual YAML editing needed.
|
||||
**Config** (`config.yaml`):
|
||||
```yaml
|
||||
prompt-cache:
|
||||
enabled: true # Default: false
|
||||
max-size: 500 # Max entries (default: 500)
|
||||
max-bytes: 0 # Optional total cache size cap in bytes
|
||||
ttl-seconds: 1800 # Cache TTL (default: 1800 = 30 min)
|
||||
```
|
||||
|
||||
### [All API Hub](https://github.com/qixing-jk/all-api-hub)
|
||||
### Cache Management API
|
||||
|
||||
Browser extension for one-stop management of New API-compatible relay site accounts, featuring balance and usage dashboards, auto check-in, one-click key export to common apps, in-page API availability testing, and channel/model sync and redirection. It integrates with CLIProxyAPI through the Management API for one-click provider import and config sync.
|
||||
| Endpoint | Method | Description |
|
||||
|----------|--------|-------------|
|
||||
| `/v0/management/cache/stats` | GET | Response cache stats (hits, misses, size) |
|
||||
| `/v0/management/cache/clear` | POST | Clear response cache |
|
||||
| `/v0/management/cache/enabled` | PUT | Enable/disable at runtime `{"enabled": true}` |
|
||||
| `/v0/management/prompt-cache/stats` | GET | Prompt cache stats + estimated tokens saved |
|
||||
| `/v0/management/prompt-cache/clear` | POST | Clear prompt cache |
|
||||
| `/v0/management/prompt-cache/enabled` | PUT | Enable/disable at runtime |
|
||||
| `/v0/management/prompt-cache/top` | GET | Top 10 most-hit prompts |
|
||||
|
||||
### [Shadow AI](https://github.com/HEUDavid/shadow-ai)
|
||||
---
|
||||
|
||||
Shadow AI is an AI assistant tool designed specifically for restricted environments. It provides a stealthy operation
|
||||
mode without windows or traces, and enables cross-device AI Q&A interaction and control via the local area network (
|
||||
LAN). Essentially, it is an automated collaboration layer of "screen/audio capture + AI inference + low-friction delivery",
|
||||
helping users to immersively use AI assistants across applications on controlled devices or in restricted environments.
|
||||
## Lightweight Profile
|
||||
|
||||
### [ProxyPal](https://github.com/buddingnewinsights/proxypal)
|
||||
For low‑memory or high‑throughput setups, you can disable heavier features:
|
||||
|
||||
Cross-platform desktop app (macOS, Windows, Linux) wrapping CLIProxyAPI with a native GUI. Connects Claude, ChatGPT, Gemini, GitHub Copilot, Qwen, iFlow, and custom OpenAI-compatible endpoints with usage analytics, request monitoring, and auto-configuration for popular coding tools - no API keys needed.
|
||||
```yaml
|
||||
commercial-mode: true
|
||||
usage-statistics-enabled: false
|
||||
usage-sample-rate: 0.25
|
||||
metrics-enabled: false
|
||||
request-history-enabled: false
|
||||
request-history-sample-rate: 0.25
|
||||
agentic-harness-enabled: false
|
||||
prompt-budget-enabled: false
|
||||
request-log: false
|
||||
response-cache:
|
||||
enabled: false
|
||||
prompt-cache:
|
||||
enabled: false
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> If you developed a project based on CLIProxyAPI, please open a PR to add it to this list.
|
||||
---
|
||||
|
||||
## More choices
|
||||
## Auto-Updates
|
||||
|
||||
Those projects are ports of CLIProxyAPI or inspired by it:
|
||||
ProxyPilot includes a built-in auto-update system that checks for new releases and allows one-click installation.
|
||||
|
||||
### [9Router](https://github.com/decolua/9router)
|
||||
### Configuration
|
||||
|
||||
A Next.js implementation inspired by CLIProxyAPI, easy to install and use, built from scratch with format translation (OpenAI/Claude/Gemini/Ollama), combo system with auto-fallback, multi-account management with exponential backoff, a Next.js web dashboard, and support for CLI tools (Cursor, Claude Code, Cline, RooCode) - no API keys needed.
|
||||
**Config** (`config.yaml`):
|
||||
```yaml
|
||||
updates:
|
||||
auto-check: true # Enable background update checking (default: true)
|
||||
check-interval-hours: 24 # How often to check (default: 24)
|
||||
notify-on-update: true # Show toast notification when update available (default: true)
|
||||
channel: stable # Update channel: "stable" or "prerelease" (default: stable)
|
||||
```
|
||||
|
||||
### [OmniRoute](https://github.com/diegosouzapw/OmniRoute)
|
||||
### Features
|
||||
|
||||
Never stop coding. Smart routing to FREE & low-cost AI models with automatic fallback.
|
||||
- **Background Polling** - Checks for updates at configurable intervals
|
||||
- **Dashboard Banner** - Proactive notification when update is available
|
||||
- **One-Click Install** - Download, verify, and install from the tray menu
|
||||
- **Session Dismissal** - Dismissed banners won't reappear until next session
|
||||
|
||||
OmniRoute is an AI gateway for multi-provider LLMs: an OpenAI-compatible endpoint with smart routing, load balancing, retries, and fallbacks. Add policies, rate limits, caching, and observability for reliable, cost-aware inference.
|
||||
### Tray Menu
|
||||
|
||||
> [!NOTE]
|
||||
> If you have developed a port of CLIProxyAPI or a project inspired by it, please open a PR to add it to this list.
|
||||
When an update is available:
|
||||
- **Settings → Download & Install vX.X.X** - One-click update flow
|
||||
- **Settings → Check for Updates** - Manual check
|
||||
|
||||
---
|
||||
|
||||
## Rollback Support
|
||||
|
||||
ProxyPilot automatically backs up the previous version during updates and can restore it if something goes wrong.
|
||||
|
||||
### Automatic Recovery
|
||||
|
||||
- **Crash Detection** - Tracks rapid restarts within a 30-second window
|
||||
- **Auto-Rollback** - After 3 rapid failures, automatically restores previous version
|
||||
- **Health Marking** - After 30 seconds of stable operation, clears the failure counter
|
||||
|
||||
### Manual Rollback
|
||||
|
||||
From the tray menu:
|
||||
- **Settings → Rollback to Previous Version** - Restore the previous version
|
||||
|
||||
### How It Works
|
||||
|
||||
1. During update, current binary is saved as `.old` backup
|
||||
2. Rollback metadata stored in `%APPDATA%/ProxyPilot/updates/`
|
||||
3. On crash loop detection, previous version is automatically restored
|
||||
4. After successful startup (30s), backup can be cleaned up
|
||||
|
||||
---
|
||||
|
||||
## CLI Tools
|
||||
|
||||
| Binary | Description |
|
||||
|--------|-------------|
|
||||
| `proxypilot` | Main CLI with server and config switching |
|
||||
| `proxypilot-tray` | System tray app |
|
||||
|
||||
---
|
||||
|
||||
## Tool Integrations
|
||||
|
||||
Works with these AI coding tools:
|
||||
|
||||
- **Claude Code** - Auto-configure via settings.json
|
||||
- **Codex CLI** - Auto-configure via config.toml
|
||||
- **Factory Droid** - Auto-configure via settings.json
|
||||
- **Cursor IDE** - Manual endpoint configuration
|
||||
- **Continue** - Manual endpoint configuration
|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
|
||||
- macOS, Linux, or Windows
|
||||
- Go 1.24+ (for building from source)
|
||||
|
||||
---
|
||||
|
||||
## Author
|
||||
|
||||
ProxyPilot is developed and maintained by [@Finesssee](https://github.com/Finesssee). Some contributors shown in the git history are from upstream [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) merges. Direct contributors to ProxyPilot will be listed here as the project grows.
|
||||
|
||||
---
|
||||
|
||||
## Credits
|
||||
|
||||
ProxyPilot builds upon excellent work from the open-source community:
|
||||
|
||||
- **[CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI)** - The original unified proxy server that inspired this project
|
||||
- **[VibeProxy](https://github.com/automazeio/vibeproxy)** - Native macOS menu bar app showcasing clean proxy UX
|
||||
|
||||
Long-context features are inspired by research from the AI community:
|
||||
|
||||
- **[Factory.ai](https://factory.ai/news/evaluating-compression)** - Context compression techniques for long-running coding agents
|
||||
- **[Anthropic](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents)** - Effective harnesses for long-running agents
|
||||
|
||||
Special thanks to these teams for sharing their work and insights.
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
MIT License - see [LICENSE](LICENSE) for details.
|
||||
|
||||
---
|
||||
|
||||
## Support
|
||||
|
||||
- **Report Issues**: [GitHub Issues](https://github.com/Finesssee/ProxyPilot/issues)
|
||||
|
||||
---
|
||||
|
||||
## Disclaimer
|
||||
|
||||
This project is for educational and interoperability research purposes. It interacts with various APIs to provide compatibility layers.
|
||||
|
||||
- **Use at your own risk.** Authors are not responsible for account suspensions or service interruptions.
|
||||
- **Not affiliated** with Google, OpenAI, Anthropic, Amazon, or any other provider.
|
||||
- Users must comply with the Terms of Service of connected platforms.
|
||||
|
||||
@@ -1,210 +0,0 @@
|
||||
# CLI 代理 API
|
||||
|
||||
[English](README.md) | 中文 | [日本語](README_JA.md)
|
||||
|
||||
一个为 CLI 提供 OpenAI/Gemini/Claude/Codex 兼容 API 接口的代理服务器。
|
||||
|
||||
现已支持通过 OAuth 登录接入 OpenAI Codex(GPT 系列)和 Claude Code。
|
||||
|
||||
您可以使用本地或多账户的CLI方式,通过任何与 OpenAI(包括Responses)/Gemini/Claude 兼容的客户端和SDK进行访问。
|
||||
|
||||
## 赞助商
|
||||
|
||||
[](https://www.bigmodel.cn/claude-code?ic=RRVJPB5SII)
|
||||
|
||||
本项目由 Z智谱 提供赞助, 他们通过 GLM CODING PLAN 对本项目提供技术支持。
|
||||
|
||||
GLM CODING PLAN 是专为AI编码打造的订阅套餐,每月最低仅需20元,即可在十余款主流AI编码工具如 Claude Code、Cline、Roo Code 中畅享智谱旗舰模型GLM-4.7(受限于算力,目前仅限Pro用户开放),为开发者提供顶尖的编码体验。
|
||||
|
||||
智谱AI为本产品提供了特别优惠,使用以下链接购买可以享受九折优惠:https://www.bigmodel.cn/claude-code?ic=RRVJPB5SII
|
||||
|
||||
---
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="180"><a href="https://www.packyapi.com/register?aff=cliproxyapi"><img src="./assets/packycode.png" alt="PackyCode" width="150"></a></td>
|
||||
<td>感谢 PackyCode 对本项目的赞助!PackyCode 是一家可靠高效的 API 中转服务商,提供 Claude Code、Codex、Gemini 等多种服务的中转。PackyCode 为本软件用户提供了特别优惠:使用<a href="https://www.packyapi.com/register?aff=cliproxyapi">此链接</a>注册,并在充值时输入 "cliproxyapi" 优惠码即可享受九折优惠。</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180"><a href="https://www.aicodemirror.com/register?invitecode=TJNAIF"><img src="./assets/aicodemirror.png" alt="AICodeMirror" width="150"></a></td>
|
||||
<td>感谢 AICodeMirror 赞助了本项目!AICodeMirror 提供 Claude Code / Codex / Gemini CLI 官方高稳定中转服务,支持企业级高并发、极速开票、7×24 专属技术支持。 Claude Code / Codex / Gemini 官方渠道低至 3.8 / 0.2 / 0.9 折,充值更有折上折!AICodeMirror 为 CLIProxyAPI 的用户提供了特别福利,通过<a href="https://www.aicodemirror.com/register?invitecode=TJNAIF">此链接</a>注册的用户,可享受首充8折,企业客户最高可享 7.5 折!</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180"><a href="https://shop.bmoplus.com/?utm_source=github"><img src="./assets/bmoplus.png" alt="BmoPlus" width="150"></a></td>
|
||||
<td>感谢 BmoPlus 赞助了本项目!BmoPlus 是一家专为AI订阅重度用户打造的可靠 AI 账号代充服务商,提供稳定的 ChatGPT Plus / ChatGPT Pro(全程质保) / Claude Pro / Super Grok / Gemini Pro 的官方代充&成品账号。 通过<a href="https://shop.bmoplus.com/?utm_source=github">BmoPlus AI成品号专卖/代充</a>注册下单的用户,可享GPT <b>官网订阅一折</b> 的震撼价格!</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180"><a href="https://www.lingtrue.com/register"><img src="./assets/lingtrue.png" alt="LingtrueAPI" width="150"></a></td>
|
||||
<td>感谢 LingtrueAPI 对本项目的赞助!LingtrueAPI 是一家全球大模型API中转服务平台,提供Claude Code、Codex、Gemini 等多种顶级模型API调用服务,致力于让用户以低成本、高稳定性链接全球AI能力。LingtrueAPI为本软件用户提供了特别优惠:使用<a href="https://www.lingtrue.com/register">此链接</a>注册,并在首次充值时输入 "LingtrueAPI" 优惠码即可享受9折优惠。</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180"><a href="https://poixe.com/i/m8kvep"><img src="./assets/poixeai.png" alt="PoixeAI" width="150"></a></td>
|
||||
<td>感谢 Poixe AI 对本项目的赞助!Poixe AI 提供可靠的 AI 模型接口服务,您可以使用平台提供的 LLM API 接口轻松构建 AI 产品,同时也可以成为供应商,为平台提供大模型资源以赚取收益。通过 CLIProxyAPI <a href="https://poixe.com/i/m8kvep">专属链接</a>注册,充值额外赠送 $5 美金</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
## 功能特性
|
||||
|
||||
- 为 CLI 模型提供 OpenAI/Gemini/Claude/Codex 兼容的 API 端点
|
||||
- 新增 OpenAI Codex(GPT 系列)支持(OAuth 登录)
|
||||
- 新增 Claude Code 支持(OAuth 登录)
|
||||
- 新增 Qwen Code 支持(OAuth 登录)
|
||||
- 新增 iFlow 支持(OAuth 登录)
|
||||
- 支持流式与非流式响应
|
||||
- 函数调用/工具支持
|
||||
- 多模态输入(文本、图片)
|
||||
- 多账户支持与轮询负载均衡(Gemini、OpenAI、Claude、Qwen 与 iFlow)
|
||||
- 简单的 CLI 身份验证流程(Gemini、OpenAI、Claude、Qwen 与 iFlow)
|
||||
- 支持 Gemini AIStudio API 密钥
|
||||
- 支持 AI Studio Build 多账户轮询
|
||||
- 支持 Gemini CLI 多账户轮询
|
||||
- 支持 Claude Code 多账户轮询
|
||||
- 支持 Qwen Code 多账户轮询
|
||||
- 支持 iFlow 多账户轮询
|
||||
- 支持 OpenAI Codex 多账户轮询
|
||||
- 通过配置接入上游 OpenAI 兼容提供商(例如 OpenRouter)
|
||||
- 可复用的 Go SDK(见 `docs/sdk-usage_CN.md`)
|
||||
|
||||
## 新手入门
|
||||
|
||||
CLIProxyAPI 用户手册: [https://help.router-for.me/](https://help.router-for.me/cn/)
|
||||
|
||||
## 管理 API 文档
|
||||
|
||||
请参见 [MANAGEMENT_API_CN.md](https://help.router-for.me/cn/management/api)
|
||||
|
||||
## Amp CLI 支持
|
||||
|
||||
CLIProxyAPI 已内置对 [Amp CLI](https://ampcode.com) 和 Amp IDE 扩展的支持,可让你使用自己的 Google/ChatGPT/Claude OAuth 订阅来配合 Amp 编码工具:
|
||||
|
||||
- 提供商路由别名,兼容 Amp 的 API 路径模式(`/api/provider/{provider}/v1...`)
|
||||
- 管理代理,处理 OAuth 认证和账号功能
|
||||
- 智能模型回退与自动路由
|
||||
- 以安全为先的设计,管理端点仅限 localhost
|
||||
|
||||
当你需要某一类后端的请求/响应协议形态时,优先使用 provider-specific 路径,而不是合并后的 `/v1/...` 端点:
|
||||
|
||||
- 对于 messages 风格的后端,使用 `/api/provider/{provider}/v1/messages`。
|
||||
- 对于按模型路径暴露生成接口的后端,使用 `/api/provider/{provider}/v1beta/models/...`。
|
||||
- 对于 chat-completions 风格的后端,使用 `/api/provider/{provider}/v1/chat/completions`。
|
||||
|
||||
这些路径有助于选择协议表面,但当多个后端复用同一个客户端可见模型名时,它们本身并不能保证唯一的推理执行器。实际的推理路由仍然根据请求里的 model/alias 解析。若要严格钉住某个后端,请使用唯一 alias、前缀,或避免让多个后端暴露相同的客户端模型名。
|
||||
|
||||
**→ [Amp CLI 完整集成指南](https://help.router-for.me/cn/agent-client/amp-cli.html)**
|
||||
|
||||
## SDK 文档
|
||||
|
||||
- 使用文档:[docs/sdk-usage_CN.md](docs/sdk-usage_CN.md)
|
||||
- 高级(执行器与翻译器):[docs/sdk-advanced_CN.md](docs/sdk-advanced_CN.md)
|
||||
- 认证: [docs/sdk-access_CN.md](docs/sdk-access_CN.md)
|
||||
- 凭据加载/更新: [docs/sdk-watcher_CN.md](docs/sdk-watcher_CN.md)
|
||||
- 自定义 Provider 示例:`examples/custom-provider`
|
||||
|
||||
## 贡献
|
||||
|
||||
欢迎贡献!请随时提交 Pull Request。
|
||||
|
||||
1. Fork 仓库
|
||||
2. 创建您的功能分支(`git checkout -b feature/amazing-feature`)
|
||||
3. 提交您的更改(`git commit -m 'Add some amazing feature'`)
|
||||
4. 推送到分支(`git push origin feature/amazing-feature`)
|
||||
5. 打开 Pull Request
|
||||
|
||||
## 谁与我们在一起?
|
||||
|
||||
这些项目基于 CLIProxyAPI:
|
||||
|
||||
### [vibeproxy](https://github.com/automazeio/vibeproxy)
|
||||
|
||||
一个原生 macOS 菜单栏应用,让您可以使用 Claude Code & ChatGPT 订阅服务和 AI 编程工具,无需 API 密钥。
|
||||
|
||||
### [Subtitle Translator](https://github.com/VjayC/SRT-Subtitle-Translator-Validator)
|
||||
|
||||
一款基于浏览器的 SRT 字幕翻译工具,可通过 CLI 代理 API 使用您的 Gemini 订阅。内置自动验证与错误修正功能,无需 API 密钥。
|
||||
|
||||
### [CCS (Claude Code Switch)](https://github.com/kaitranntt/ccs)
|
||||
|
||||
CLI 封装器,用于通过 CLIProxyAPI OAuth 即时切换多个 Claude 账户和替代模型(Gemini, Codex, Antigravity),无需 API 密钥。
|
||||
|
||||
### [Quotio](https://github.com/nguyenphutrong/quotio)
|
||||
|
||||
原生 macOS 菜单栏应用,统一管理 Claude、Gemini、OpenAI、Qwen 和 Antigravity 订阅,提供实时配额追踪和智能自动故障转移,支持 Claude Code、OpenCode 和 Droid 等 AI 编程工具,无需 API 密钥。
|
||||
|
||||
### [CodMate](https://github.com/loocor/CodMate)
|
||||
|
||||
原生 macOS SwiftUI 应用,用于管理 CLI AI 会话(Claude Code、Codex、Gemini CLI),提供统一的提供商管理、Git 审查、项目组织、全局搜索和终端集成。集成 CLIProxyAPI 为 Codex、Claude、Gemini、Antigravity 和 Qwen Code 提供统一的 OAuth 认证,支持内置和第三方提供商通过单一代理端点重路由 - OAuth 提供商无需 API 密钥。
|
||||
|
||||
### [ProxyPilot](https://github.com/Finesssee/ProxyPilot)
|
||||
|
||||
原生 Windows CLIProxyAPI 分支,集成 TUI、系统托盘及多服务商 OAuth 认证,专为 AI 编程工具打造,无需 API 密钥。
|
||||
|
||||
### [Claude Proxy VSCode](https://github.com/uzhao/claude-proxy-vscode)
|
||||
|
||||
一款 VSCode 扩展,提供了在 VSCode 中快速切换 Claude Code 模型的功能,内置 CLIProxyAPI 作为其后端,支持后台自动启动和关闭。
|
||||
|
||||
### [ZeroLimit](https://github.com/0xtbug/zero-limit)
|
||||
|
||||
Windows 桌面应用,基于 Tauri + React 构建,用于通过 CLIProxyAPI 监控 AI 编程助手配额。支持跨 Gemini、Claude、OpenAI Codex 和 Antigravity 账户的使用量追踪,提供实时仪表盘、系统托盘集成和一键代理控制,无需 API 密钥。
|
||||
|
||||
### [CPA-XXX Panel](https://github.com/ferretgeek/CPA-X)
|
||||
|
||||
面向 CLIProxyAPI 的 Web 管理面板,提供健康检查、资源监控、日志查看、自动更新、请求统计与定价展示,支持一键安装与 systemd 服务。
|
||||
|
||||
### [CLIProxyAPI Tray](https://github.com/kitephp/CLIProxyAPI_Tray)
|
||||
|
||||
Windows 托盘应用,基于 PowerShell 脚本实现,不依赖任何第三方库。主要功能包括:自动创建快捷方式、静默运行、密码管理、通道切换(Main / Plus)以及自动下载与更新。
|
||||
|
||||
### [霖君](https://github.com/wangdabaoqq/LinJun)
|
||||
|
||||
霖君是一款用于管理AI编程助手的跨平台桌面应用,支持macOS、Windows、Linux系统。统一管理Claude Code、Gemini CLI、OpenAI Codex、Qwen Code等AI编程工具,本地代理实现多账户配额跟踪和一键配置。
|
||||
|
||||
### [CLIProxyAPI Dashboard](https://github.com/itsmylife44/cliproxyapi-dashboard)
|
||||
|
||||
一个面向 CLIProxyAPI 的现代化 Web 管理仪表盘,基于 Next.js、React 和 PostgreSQL 构建。支持实时日志流、结构化配置编辑、API Key 管理、Claude/Gemini/Codex 的 OAuth 提供方集成、使用量分析、容器管理,并可通过配套插件与 OpenCode 同步配置,无需手动编辑 YAML。
|
||||
|
||||
### [All API Hub](https://github.com/qixing-jk/all-api-hub)
|
||||
|
||||
用于一站式管理 New API 兼容中转站账号的浏览器扩展,提供余额与用量看板、自动签到、密钥一键导出到常用应用、网页内 API 可用性测试,以及渠道与模型同步和重定向。支持通过 CLIProxyAPI Management API 一键导入 Provider 与同步配置。
|
||||
|
||||
### [Shadow AI](https://github.com/HEUDavid/shadow-ai)
|
||||
|
||||
Shadow AI 是一款专为受限环境设计的 AI 辅助工具。提供无窗口、无痕迹的隐蔽运行方式,并通过局域网实现跨设备的 AI 问答交互与控制。本质上是一个「屏幕/音频采集 + AI 推理 + 低摩擦投送」的自动化协作层,帮助用户在受控设备/受限环境下沉浸式跨应用地使用 AI 助手。
|
||||
|
||||
### [ProxyPal](https://github.com/buddingnewinsights/proxypal)
|
||||
|
||||
跨平台桌面应用(macOS、Windows、Linux),以原生 GUI 封装 CLIProxyAPI。支持连接 Claude、ChatGPT、Gemini、GitHub Copilot、Qwen、iFlow 及自定义 OpenAI 兼容端点,具备使用分析、请求监控和热门编程工具自动配置功能,无需 API 密钥。
|
||||
|
||||
> [!NOTE]
|
||||
> 如果你开发了基于 CLIProxyAPI 的项目,请提交一个 PR(拉取请求)将其添加到此列表中。
|
||||
|
||||
## 更多选择
|
||||
|
||||
以下项目是 CLIProxyAPI 的移植版或受其启发:
|
||||
|
||||
### [9Router](https://github.com/decolua/9router)
|
||||
|
||||
基于 Next.js 的实现,灵感来自 CLIProxyAPI,易于安装使用;自研格式转换(OpenAI/Claude/Gemini/Ollama)、组合系统与自动回退、多账户管理(指数退避)、Next.js Web 控制台,并支持 Cursor、Claude Code、Cline、RooCode 等 CLI 工具,无需 API 密钥。
|
||||
|
||||
### [OmniRoute](https://github.com/diegosouzapw/OmniRoute)
|
||||
|
||||
代码不止,创新不停。智能路由至免费及低成本 AI 模型,并支持自动故障转移。
|
||||
|
||||
OmniRoute 是一个面向多供应商大语言模型的 AI 网关:它提供兼容 OpenAI 的端点,具备智能路由、负载均衡、重试及回退机制。通过添加策略、速率限制、缓存和可观测性,确保推理过程既可靠又具备成本意识。
|
||||
|
||||
> [!NOTE]
|
||||
> 如果你开发了 CLIProxyAPI 的移植或衍生项目,请提交 PR 将其添加到此列表中。
|
||||
|
||||
## 许可证
|
||||
|
||||
此项目根据 MIT 许可证授权 - 有关详细信息,请参阅 [LICENSE](LICENSE) 文件。
|
||||
|
||||
## 写给所有中国网友的
|
||||
|
||||
QQ 群:188637136(满)、1081218164
|
||||
|
||||
或
|
||||
|
||||
Telegram 群:https://t.me/CLIProxyAPI
|
||||
@@ -1,203 +0,0 @@
|
||||
# CLI Proxy API
|
||||
|
||||
[English](README.md) | [中文](README_CN.md) | 日本語
|
||||
|
||||
CLI向けのOpenAI/Gemini/Claude/Codex互換APIインターフェースを提供するプロキシサーバーです。
|
||||
|
||||
OAuth経由でOpenAI Codex(GPTモデル)およびClaude Codeもサポートしています。
|
||||
|
||||
ローカルまたはマルチアカウントのCLIアクセスを、OpenAI(Responses含む)/Gemini/Claude互換のクライアントやSDKで利用できます。
|
||||
|
||||
## スポンサー
|
||||
|
||||
[](https://z.ai/subscribe?ic=8JVLJQFSKB)
|
||||
|
||||
本プロジェクトはZ.aiにスポンサーされており、GLM CODING PLANの提供を受けています。
|
||||
|
||||
GLM CODING PLANはAIコーディング向けに設計されたサブスクリプションサービスで、月額わずか$10から利用可能です。フラッグシップのGLM-4.7および(GLM-5はProユーザーのみ利用可能)モデルを10以上の人気AIコーディングツール(Claude Code、Cline、Roo Codeなど)で利用でき、開発者にトップクラスの高速かつ安定したコーディング体験を提供します。
|
||||
|
||||
GLM CODING PLANを10%割引で取得:https://z.ai/subscribe?ic=8JVLJQFSKB
|
||||
|
||||
---
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="180"><a href="https://www.packyapi.com/register?aff=cliproxyapi"><img src="./assets/packycode.png" alt="PackyCode" width="150"></a></td>
|
||||
<td>PackyCodeのスポンサーシップに感謝します!PackyCodeは信頼性が高く効率的なAPIリレーサービスプロバイダーで、Claude Code、Codex、Geminiなどのリレーサービスを提供しています。PackyCodeは当ソフトウェアのユーザーに特別割引を提供しています:<a href="https://www.packyapi.com/register?aff=cliproxyapi">こちらのリンク</a>から登録し、チャージ時にプロモーションコード「cliproxyapi」を入力すると10%割引になります。</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180"><a href="https://www.aicodemirror.com/register?invitecode=TJNAIF"><img src="./assets/aicodemirror.png" alt="AICodeMirror" width="150"></a></td>
|
||||
<td>AICodeMirrorのスポンサーシップに感謝します!AICodeMirrorはClaude Code / Codex / Gemini CLI向けの公式高安定性リレーサービスを提供しており、エンタープライズグレードの同時接続、迅速な請求書発行、24時間365日の専任技術サポートを備えています。Claude Code / Codex / Geminiの公式チャネルが元の価格の38% / 2% / 9%で利用でき、チャージ時にはさらに割引があります!CLIProxyAPIユーザー向けの特別特典:<a href="https://www.aicodemirror.com/register?invitecode=TJNAIF">こちらのリンク</a>から登録すると、初回チャージが20%割引になり、エンタープライズのお客様は最大25%割引を受けられます!</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180"><a href="https://shop.bmoplus.com/?utm_source=github"><img src="./assets/bmoplus.png" alt="BmoPlus" width="150"></a></td>
|
||||
<td>本プロジェクトにご支援いただいた BmoPlus に感謝いたします!BmoPlusは、AIサブスクリプションのヘビーユーザー向けに特化した信頼性の高いAIアカウントサービスプロバイダーであり、安定した ChatGPT Plus / ChatGPT Pro (完全保証) / Claude Pro / Super Grok / Gemini Pro の公式代行チャージおよび即納アカウントを提供しています。こちらの<a href="https://shop.bmoplus.com/?utm_source=github">BmoPlus AIアカウント専門店/代行チャージ</a>経由でご登録・ご注文いただいたユーザー様は、GPTを <b>公式サイト価格の約1割(90% OFF)</b> という驚異的な価格でご利用いただけます!</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180"><a href="https://www.lingtrue.com/register"><img src="./assets/lingtrue.png" alt="LingtrueAPI" width="150"></a></td>
|
||||
<td>LingtrueAPIのスポンサーシップに感謝します!LingtrueAPIはグローバルな大規模モデルAPIリレーサービスプラットフォームで、Claude Code、Codex、GeminiなどのトップモデルAPI呼び出しサービスを提供し、ユーザーが低コストかつ高い安定性で世界中のAI能力に接続できるよう支援しています。LingtrueAPIは本ソフトウェアのユーザーに特別割引を提供しています:<a href="https://www.lingtrue.com/register">こちらのリンク</a>から登録し、初回チャージ時にプロモーションコード「LingtrueAPI」を入力すると10%割引になります。</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="180"><a href="https://poixe.com/i/m8kvep"><img src="./assets/poixeai.png" alt="PoixeAI" width="150"></a></td>
|
||||
<td>Poixe AIのスポンサーシップに感謝します!Poixe AIは信頼できるAIモデルAPIサービスを提供しており、プラットフォームが提供するLLM APIを使って簡単にAI製品を構築できます。また、サプライヤーとしてプラットフォームに大規模モデルのリソースを提供し、収益を得ることも可能です。CLIProxyAPIの<a href="https://poixe.com/i/m8kvep">専用リンク</a>から登録すると、チャージ時に追加で$5が付与されます。</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## 概要
|
||||
|
||||
- CLIモデル向けのOpenAI/Gemini/Claude互換APIエンドポイント
|
||||
- OAuthログインによるOpenAI Codexサポート(GPTモデル)
|
||||
- OAuthログインによるClaude Codeサポート
|
||||
- OAuthログインによるQwen Codeサポート
|
||||
- OAuthログインによるiFlowサポート
|
||||
- プロバイダールーティングによるAmp CLIおよびIDE拡張機能のサポート
|
||||
- ストリーミングおよび非ストリーミングレスポンス
|
||||
- 関数呼び出し/ツールのサポート
|
||||
- マルチモーダル入力サポート(テキストと画像)
|
||||
- ラウンドロビン負荷分散による複数アカウント対応(Gemini、OpenAI、Claude、QwenおよびiFlow)
|
||||
- シンプルなCLI認証フロー(Gemini、OpenAI、Claude、QwenおよびiFlow)
|
||||
- Generative Language APIキーのサポート
|
||||
- AI Studioビルドのマルチアカウント負荷分散
|
||||
- Gemini CLIのマルチアカウント負荷分散
|
||||
- Claude Codeのマルチアカウント負荷分散
|
||||
- Qwen Codeのマルチアカウント負荷分散
|
||||
- iFlowのマルチアカウント負荷分散
|
||||
- OpenAI Codexのマルチアカウント負荷分散
|
||||
- 設定によるOpenAI互換アップストリームプロバイダー(例:OpenRouter)
|
||||
- プロキシ埋め込み用の再利用可能なGo SDK(`docs/sdk-usage.md`を参照)
|
||||
|
||||
## はじめに
|
||||
|
||||
CLIProxyAPIガイド:[https://help.router-for.me/](https://help.router-for.me/)
|
||||
|
||||
## 管理API
|
||||
|
||||
[MANAGEMENT_API.md](https://help.router-for.me/management/api)を参照
|
||||
|
||||
## Amp CLIサポート
|
||||
|
||||
CLIProxyAPIは[Amp CLI](https://ampcode.com)およびAmp IDE拡張機能の統合サポートを含んでおり、Google/ChatGPT/ClaudeのOAuthサブスクリプションをAmpのコーディングツールで使用できます:
|
||||
|
||||
- Ampの APIパターン用のプロバイダールートエイリアス(`/api/provider/{provider}/v1...`)
|
||||
- OAuth認証およびアカウント機能用の管理プロキシ
|
||||
- 自動ルーティングによるスマートモデルフォールバック
|
||||
- 利用できないモデルを代替モデルにルーティングする**モデルマッピング**(例:`claude-opus-4.5` → `claude-sonnet-4`)
|
||||
- localhostのみの管理エンドポイントによるセキュリティファーストの設計
|
||||
|
||||
特定のバックエンド系統のリクエスト/レスポンス形状が必要な場合は、統合された `/v1/...` エンドポイントよりも provider-specific のパスを優先してください。
|
||||
|
||||
- messages 系のバックエンドには `/api/provider/{provider}/v1/messages`
|
||||
- モデル単位の generate 系エンドポイントには `/api/provider/{provider}/v1beta/models/...`
|
||||
- chat-completions 系のバックエンドには `/api/provider/{provider}/v1/chat/completions`
|
||||
|
||||
これらのパスはプロトコル面の選択には役立ちますが、同じクライアント向けモデル名が複数バックエンドで再利用されている場合、それだけで推論実行系が一意に固定されるわけではありません。実際の推論ルーティングは、引き続きリクエスト内の model/alias 解決に従います。厳密にバックエンドを固定したい場合は、一意な alias や prefix を使うか、クライアント向けモデル名の重複自体を避けてください。
|
||||
|
||||
**→ [Amp CLI統合ガイドの完全版](https://help.router-for.me/agent-client/amp-cli.html)**
|
||||
|
||||
## SDKドキュメント
|
||||
|
||||
- 使い方:[docs/sdk-usage.md](docs/sdk-usage.md)
|
||||
- 上級(エグゼキューターとトランスレーター):[docs/sdk-advanced.md](docs/sdk-advanced.md)
|
||||
- アクセス:[docs/sdk-access.md](docs/sdk-access.md)
|
||||
- ウォッチャー:[docs/sdk-watcher.md](docs/sdk-watcher.md)
|
||||
- カスタムプロバイダーの例:`examples/custom-provider`
|
||||
|
||||
## コントリビューション
|
||||
|
||||
コントリビューションを歓迎します!お気軽にPull Requestを送ってください。
|
||||
|
||||
1. リポジトリをフォーク
|
||||
2. フィーチャーブランチを作成(`git checkout -b feature/amazing-feature`)
|
||||
3. 変更をコミット(`git commit -m 'Add some amazing feature'`)
|
||||
4. ブランチにプッシュ(`git push origin feature/amazing-feature`)
|
||||
5. Pull Requestを作成
|
||||
|
||||
## 関連プロジェクト
|
||||
|
||||
CLIProxyAPIをベースにした以下のプロジェクトがあります:
|
||||
|
||||
### [vibeproxy](https://github.com/automazeio/vibeproxy)
|
||||
|
||||
macOSネイティブのメニューバーアプリで、Claude CodeとChatGPTのサブスクリプションをAIコーディングツールで使用可能 - APIキー不要
|
||||
|
||||
### [Subtitle Translator](https://github.com/VjayC/SRT-Subtitle-Translator-Validator)
|
||||
|
||||
CLIProxyAPI経由でGeminiサブスクリプションを使用してSRT字幕を翻訳するブラウザベースのツール。自動検証/エラー修正機能付き - APIキー不要
|
||||
|
||||
### [CCS (Claude Code Switch)](https://github.com/kaitranntt/ccs)
|
||||
|
||||
CLIProxyAPI OAuthを使用して複数のClaudeアカウントや代替モデル(Gemini、Codex、Antigravity)を即座に切り替えるCLIラッパー - APIキー不要
|
||||
|
||||
### [Quotio](https://github.com/nguyenphutrong/quotio)
|
||||
|
||||
Claude、Gemini、OpenAI、Qwen、Antigravityのサブスクリプションを統合し、リアルタイムのクォータ追跡とスマート自動フェイルオーバーを備えたmacOSネイティブのメニューバーアプリ。Claude Code、OpenCode、Droidなどのコーディングツール向け - APIキー不要
|
||||
|
||||
### [CodMate](https://github.com/loocor/CodMate)
|
||||
|
||||
CLI AIセッション(Codex、Claude Code、Gemini CLI)を管理するmacOS SwiftUIネイティブアプリ。統合プロバイダー管理、Gitレビュー、プロジェクト整理、グローバル検索、ターミナル統合機能を搭載。CLIProxyAPIと統合し、Codex、Claude、Gemini、Antigravity、Qwen CodeのOAuth認証を提供。単一のプロキシエンドポイントを通じた組み込みおよびサードパーティプロバイダーの再ルーティングに対応 - OAuthプロバイダーではAPIキー不要
|
||||
|
||||
### [ProxyPilot](https://github.com/Finesssee/ProxyPilot)
|
||||
|
||||
TUI、システムトレイ、マルチプロバイダーOAuthを備えたWindows向けCLIProxyAPIフォーク - AIコーディングツール用、APIキー不要
|
||||
|
||||
### [Claude Proxy VSCode](https://github.com/uzhao/claude-proxy-vscode)
|
||||
|
||||
Claude Codeモデルを素早く切り替えるVSCode拡張機能。バックエンドとしてCLIProxyAPIを統合し、バックグラウンドでの自動ライフサイクル管理を搭載
|
||||
|
||||
### [ZeroLimit](https://github.com/0xtbug/zero-limit)
|
||||
|
||||
CLIProxyAPIを使用してAIコーディングアシスタントのクォータを監視するTauri + React製のWindowsデスクトップアプリ。Gemini、Claude、OpenAI Codex、Antigravityアカウントの使用量をリアルタイムダッシュボード、システムトレイ統合、ワンクリックプロキシコントロールで追跡 - APIキー不要
|
||||
|
||||
### [CPA-XXX Panel](https://github.com/ferretgeek/CPA-X)
|
||||
|
||||
CLIProxyAPI向けの軽量Web管理パネル。ヘルスチェック、リソース監視、リアルタイムログ、自動更新、リクエスト統計、料金表示機能を搭載。ワンクリックインストールとsystemdサービスに対応
|
||||
|
||||
### [CLIProxyAPI Tray](https://github.com/kitephp/CLIProxyAPI_Tray)
|
||||
|
||||
PowerShellスクリプトで実装されたWindowsトレイアプリケーション。サードパーティライブラリに依存せず、ショートカットの自動作成、サイレント実行、パスワード管理、チャネル切り替え(Main / Plus)、自動ダウンロードおよび自動更新に対応
|
||||
|
||||
### [霖君](https://github.com/wangdabaoqq/LinJun)
|
||||
|
||||
霖君はAIプログラミングアシスタントを管理するクロスプラットフォームデスクトップアプリケーションで、macOS、Windows、Linuxシステムに対応。Claude Code、Gemini CLI、OpenAI Codex、Qwen Codeなどのコーディングツールを統合管理し、ローカルプロキシによるマルチアカウントクォータ追跡とワンクリック設定が可能
|
||||
|
||||
### [CLIProxyAPI Dashboard](https://github.com/itsmylife44/cliproxyapi-dashboard)
|
||||
|
||||
Next.js、React、PostgreSQLで構築されたCLIProxyAPI用のモダンなWebベース管理ダッシュボード。リアルタイムログストリーミング、構造化された設定編集、APIキー管理、Claude/Gemini/Codex向けOAuthプロバイダー統合、使用量分析、コンテナ管理、コンパニオンプラグインによるOpenCodeとの設定同期機能を搭載 - 手動でのYAML編集は不要
|
||||
|
||||
### [All API Hub](https://github.com/qixing-jk/all-api-hub)
|
||||
|
||||
New API互換リレーサイトアカウントをワンストップで管理するブラウザ拡張機能。残高と使用量のダッシュボード、自動チェックイン、一般的なアプリへのワンクリックキーエクスポート、ページ内API可用性テスト、チャネル/モデルの同期とリダイレクト機能を搭載。Management APIを通じてCLIProxyAPIと統合し、ワンクリックでプロバイダーのインポートと設定同期が可能
|
||||
|
||||
### [Shadow AI](https://github.com/HEUDavid/shadow-ai)
|
||||
|
||||
Shadow AIは制限された環境向けに特別に設計されたAIアシスタントツールです。ウィンドウや痕跡のないステルス動作モードを提供し、LAN(ローカルエリアネットワーク)を介したクロスデバイスAI質疑応答のインタラクションと制御を可能にします。本質的には「画面/音声キャプチャ + AI推論 + 低摩擦デリバリー」の自動化コラボレーションレイヤーであり、制御されたデバイスや制限された環境でアプリケーション横断的にAIアシスタントを没入的に使用できるようユーザーを支援します。
|
||||
|
||||
### [ProxyPal](https://github.com/buddingnewinsights/proxypal)
|
||||
|
||||
CLIProxyAPIをネイティブGUIでラップしたクロスプラットフォームデスクトップアプリ(macOS、Windows、Linux)。Claude、ChatGPT、Gemini、GitHub Copilot、Qwen、iFlow、カスタムOpenAI互換エンドポイントに対応し、使用状況分析、リクエスト監視、人気コーディングツールの自動設定機能を搭載 - APIキー不要
|
||||
|
||||
> [!NOTE]
|
||||
> CLIProxyAPIをベースにプロジェクトを開発した場合は、PRを送ってこのリストに追加してください。
|
||||
|
||||
## その他の選択肢
|
||||
|
||||
以下のプロジェクトはCLIProxyAPIの移植版またはそれに触発されたものです:
|
||||
|
||||
### [9Router](https://github.com/decolua/9router)
|
||||
|
||||
CLIProxyAPIに触発されたNext.js実装。インストールと使用が簡単で、フォーマット変換(OpenAI/Claude/Gemini/Ollama)、自動フォールバック付きコンボシステム、指数バックオフ付きマルチアカウント管理、Next.js Webダッシュボード、CLIツール(Cursor、Claude Code、Cline、RooCode)のサポートをゼロから構築 - APIキー不要
|
||||
|
||||
### [OmniRoute](https://github.com/diegosouzapw/OmniRoute)
|
||||
|
||||
コーディングを止めない。無料および低コストのAIモデルへのスマートルーティングと自動フォールバック。
|
||||
|
||||
OmniRouteはマルチプロバイダーLLM向けのAIゲートウェイです:スマートルーティング、負荷分散、リトライ、フォールバックを備えたOpenAI互換エンドポイント。ポリシー、レート制限、キャッシュ、可観測性を追加して、信頼性が高くコストを意識した推論を実現します。
|
||||
|
||||
> [!NOTE]
|
||||
> CLIProxyAPIの移植版またはそれに触発されたプロジェクトを開発した場合は、PRを送ってこのリストに追加してください。
|
||||
|
||||
## ライセンス
|
||||
|
||||
本プロジェクトはMITライセンスの下でライセンスされています - 詳細は[LICENSE](LICENSE)ファイルを参照してください。
|
||||
@@ -0,0 +1,58 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
The following versions of ProxyPilot are currently supported with security updates:
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| latest | :white_check_mark: |
|
||||
| < 1.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
We take the security of ProxyPilot seriously. If you discover a security vulnerability, please report it responsibly.
|
||||
|
||||
### How to Report
|
||||
|
||||
You can report a vulnerability through one of the following methods:
|
||||
|
||||
1. **GitHub Security Advisory (Preferred)**: Open a private security advisory through [GitHub Security Advisories](https://github.com/smat-dev/ProxyPilot/security/advisories/new). This allows for private discussion and coordination.
|
||||
|
||||
2. **Email**: Send an email to the project maintainers with details of the vulnerability. Please include:
|
||||
- A description of the vulnerability
|
||||
- Steps to reproduce the issue
|
||||
- Potential impact of the vulnerability
|
||||
- Any suggested fixes (if available)
|
||||
|
||||
### What to Expect
|
||||
|
||||
After submitting a vulnerability report:
|
||||
|
||||
- **Initial Response**: You will receive an acknowledgment within **48 hours** confirming we have received your report.
|
||||
- **Assessment**: We will investigate and assess the vulnerability within **7 days**.
|
||||
- **Resolution Timeline**: We aim to release a fix for confirmed vulnerabilities within **30 days**, depending on complexity.
|
||||
- **Disclosure**: Once a fix is released, we will coordinate with you on public disclosure timing.
|
||||
|
||||
We will keep you informed throughout the process and credit you for the discovery (unless you prefer to remain anonymous).
|
||||
|
||||
## Responsible Disclosure Guidelines
|
||||
|
||||
To protect our users, we ask that you:
|
||||
|
||||
- **DO NOT** disclose the vulnerability publicly until a fix has been released.
|
||||
- **DO NOT** exploit the vulnerability beyond what is necessary to demonstrate the issue.
|
||||
- **DO NOT** access, modify, or delete data belonging to other users.
|
||||
- **DO** provide us with reasonable time to address the issue before any public disclosure.
|
||||
- **DO** act in good faith to avoid privacy violations, data destruction, or service disruption.
|
||||
|
||||
We are committed to working with security researchers and will not take legal action against individuals who discover and report vulnerabilities responsibly.
|
||||
|
||||
## Security Best Practices for Users
|
||||
|
||||
- Always use the latest version of ProxyPilot.
|
||||
- Review and understand the proxy configurations before deployment.
|
||||
- Use secure connections (HTTPS) where applicable.
|
||||
- Regularly review access logs for suspicious activity.
|
||||
|
||||
Thank you for helping keep ProxyPilot and its users safe.
|
||||
@@ -0,0 +1 @@
|
||||
v6.9.16
|
||||
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 39 KiB |
@@ -0,0 +1,2 @@
|
||||
.npmrc
|
||||
node_modules/
|
||||
@@ -0,0 +1,74 @@
|
||||
# proxypilot
|
||||
|
||||
ProxyPilot CLI - Includes the ProxyPilot server and configuration switcher for AI CLI agents.
|
||||
|
||||
## Features
|
||||
|
||||
- **Server**: Run the ProxyPilot proxy server locally
|
||||
- **Switch**: Switch AI CLI agents between proxy and native modes
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
bun install -g proxypilot
|
||||
```
|
||||
|
||||
Or run without installing:
|
||||
|
||||
```bash
|
||||
bunx proxypilot
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Start the ProxyPilot server
|
||||
proxypilot server
|
||||
|
||||
# Show status of all agents
|
||||
proxypilot switch
|
||||
|
||||
# Switch Claude to proxy mode
|
||||
proxypilot switch claude proxy
|
||||
|
||||
# Switch Gemini to native mode
|
||||
proxypilot switch gemini native
|
||||
|
||||
# Show help
|
||||
proxypilot --help
|
||||
```
|
||||
|
||||
## Supported Agents
|
||||
|
||||
| Agent | Command |
|
||||
|-------|---------|
|
||||
| Claude Code | `proxypilot switch claude proxy` |
|
||||
| Gemini CLI | `proxypilot switch gemini proxy` |
|
||||
| Codex CLI | `proxypilot switch codex proxy` |
|
||||
| OpenCode | `proxypilot switch opencode proxy` |
|
||||
| Factory Droid | `proxypilot switch droid proxy` |
|
||||
| Cursor | `proxypilot switch cursor proxy` |
|
||||
| Kilo Code* | `proxypilot switch kilo proxy` |
|
||||
| RooCode* | `proxypilot switch roocode proxy` |
|
||||
|
||||
\* VS Code extensions require manual configuration
|
||||
|
||||
## Modes
|
||||
|
||||
- `proxy` - Route through ProxyPilot (http://127.0.0.1:8317)
|
||||
- `native` - Use direct API access (restore original config)
|
||||
|
||||
## How It Works
|
||||
|
||||
The switcher manages config files for each agent:
|
||||
|
||||
```
|
||||
~/.claude/
|
||||
├── settings.json # Active config
|
||||
├── settings.native.json # Original/backup config
|
||||
└── settings.proxy.json # ProxyPilot config
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import { spawn } from "bun";
|
||||
import { join } from "path";
|
||||
|
||||
const ext = process.platform === "win32" ? ".exe" : "";
|
||||
const binary = join(import.meta.dir, `proxypilot${ext}`);
|
||||
|
||||
const proc = spawn([binary, ...process.argv.slice(2)], {
|
||||
stdio: ["inherit", "inherit", "inherit"],
|
||||
});
|
||||
|
||||
await proc.exited;
|
||||
process.exit(proc.exitCode ?? 0);
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import { chmodSync } from "fs";
|
||||
import { join } from "path";
|
||||
import pkg from "./package.json";
|
||||
|
||||
const VERSION = pkg.version;
|
||||
const REPO = "Finesssee/ProxyPilot";
|
||||
|
||||
const PLATFORM_MAP: Record<string, string> = {
|
||||
darwin: "darwin",
|
||||
linux: "linux",
|
||||
win32: "windows",
|
||||
};
|
||||
|
||||
const ARCH_MAP: Record<string, string> = {
|
||||
x64: "amd64",
|
||||
arm64: "arm64",
|
||||
};
|
||||
|
||||
async function install() {
|
||||
const platform = PLATFORM_MAP[process.platform];
|
||||
const arch = ARCH_MAP[process.arch];
|
||||
|
||||
if (!platform || !arch) {
|
||||
console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const ext = platform === "windows" ? ".exe" : "";
|
||||
const binaryName = `proxypilot-${platform}-${arch}${ext}`;
|
||||
const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${binaryName}`;
|
||||
|
||||
const binDir = join(import.meta.dir, "bin");
|
||||
const binPath = join(binDir, platform === "windows" ? "proxypilot.exe" : "proxypilot");
|
||||
|
||||
console.log(`Downloading proxypilot v${VERSION} for ${platform}-${arch}...`);
|
||||
|
||||
try {
|
||||
const response = await fetch(url, { redirect: "follow" });
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
||||
}
|
||||
|
||||
await Bun.write(binPath, response);
|
||||
|
||||
// Make executable on Unix
|
||||
if (platform !== "windows") {
|
||||
chmodSync(binPath, 0o755);
|
||||
}
|
||||
|
||||
console.log("proxypilot installed successfully!");
|
||||
console.log('Run "proxypilot --help" to get started.');
|
||||
} catch (err: any) {
|
||||
console.error("Failed to download proxypilot:", err.message);
|
||||
console.error(`\nYou can manually download from:\nhttps://github.com/${REPO}/releases`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
install();
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "proxypilot",
|
||||
"version": "0.2.9",
|
||||
"description": "ProxyPilot - Local API proxy for AI coding tools with CLI control",
|
||||
"bin": {
|
||||
"proxypilot": "bin/proxypilot"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "bun run install.ts"
|
||||
},
|
||||
"keywords": [
|
||||
"proxypilot",
|
||||
"claude",
|
||||
"gemini",
|
||||
"codex",
|
||||
"ai",
|
||||
"cli",
|
||||
"proxy",
|
||||
"config",
|
||||
"switcher"
|
||||
],
|
||||
"author": "ProxyPilot",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Finesssee/ProxyPilot"
|
||||
},
|
||||
"homepage": "https://github.com/Finesssee/ProxyPilot",
|
||||
"os": [
|
||||
"darwin",
|
||||
"linux",
|
||||
"win32"
|
||||
],
|
||||
"cpu": [
|
||||
"x64",
|
||||
"arm64"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
# ProxyPilot Installer Build Script
|
||||
# This script builds the installer with embedded UI and application files.
|
||||
|
||||
param(
|
||||
[string]$OutputPath = ".\dist\ProxyPilotInstaller.exe",
|
||||
[string]$ProxyPilotExe = ".\dist\ProxyPilot.exe",
|
||||
[switch]$SkipUI
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$repoRoot = Split-Path -Parent (Split-Path -Parent $scriptDir)
|
||||
|
||||
Write-Host "Building ProxyPilot Installer..." -ForegroundColor Cyan
|
||||
|
||||
# Step 1: Build the installer UI (if not skipped)
|
||||
if (-not $SkipUI) {
|
||||
Write-Host "Building installer UI..." -ForegroundColor Yellow
|
||||
Push-Location "$repoRoot\installer-ui"
|
||||
try {
|
||||
npm install
|
||||
npm run build
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Copy built UI to cmd/installer/ui
|
||||
Write-Host "Copying UI assets..." -ForegroundColor Yellow
|
||||
$uiSrcDir = "$repoRoot\installer-ui\dist"
|
||||
$uiDstDir = "$scriptDir\ui"
|
||||
|
||||
if (Test-Path $uiDstDir) {
|
||||
Remove-Item -Recurse -Force $uiDstDir
|
||||
}
|
||||
Copy-Item -Recurse $uiSrcDir $uiDstDir
|
||||
}
|
||||
|
||||
# Step 2: Copy bundle files
|
||||
Write-Host "Preparing bundle files..." -ForegroundColor Yellow
|
||||
$bundleDir = "$scriptDir\bundle"
|
||||
|
||||
# Ensure bundle directory exists
|
||||
if (-not (Test-Path $bundleDir)) {
|
||||
New-Item -ItemType Directory -Path $bundleDir | Out-Null
|
||||
}
|
||||
|
||||
# Copy ProxyPilot.exe
|
||||
if (Test-Path $ProxyPilotExe) {
|
||||
Copy-Item $ProxyPilotExe "$bundleDir\ProxyPilot.exe" -Force
|
||||
Write-Host " Copied ProxyPilot.exe" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " Warning: ProxyPilot.exe not found at $ProxyPilotExe" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# Copy config.example.yaml
|
||||
$configExample = "$repoRoot\config.example.yaml"
|
||||
if (Test-Path $configExample) {
|
||||
Copy-Item $configExample "$bundleDir\config.example.yaml" -Force
|
||||
Write-Host " Copied config.example.yaml" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Copy icons
|
||||
$iconIco = "$repoRoot\static\icon.ico"
|
||||
$iconPng = "$repoRoot\static\icon.png"
|
||||
if (Test-Path $iconIco) {
|
||||
Copy-Item $iconIco "$bundleDir\icon.ico" -Force
|
||||
Write-Host " Copied icon.ico" -ForegroundColor Green
|
||||
}
|
||||
if (Test-Path $iconPng) {
|
||||
Copy-Item $iconPng "$bundleDir\icon.png" -Force
|
||||
Write-Host " Copied icon.png" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Step 3: Build the installer executable
|
||||
Write-Host "Building installer executable..." -ForegroundColor Yellow
|
||||
|
||||
$outputDir = Split-Path -Parent $OutputPath
|
||||
if (-not (Test-Path $outputDir)) {
|
||||
New-Item -ItemType Directory -Path $outputDir | Out-Null
|
||||
}
|
||||
|
||||
Push-Location $repoRoot
|
||||
try {
|
||||
# Build with Windows GUI subsystem (no console window)
|
||||
$env:GOOS = "windows"
|
||||
$env:GOARCH = "amd64"
|
||||
go build -ldflags="-s -w -H=windowsgui" -o $OutputPath ./cmd/installer
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
if (Test-Path $OutputPath) {
|
||||
$size = (Get-Item $OutputPath).Length / 1MB
|
||||
Write-Host "Build complete: $OutputPath ($([math]::Round($size, 2)) MB)" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Build failed: Output file not created" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
# Server host/interface to bind to. Default is empty ("") to bind all interfaces (IPv4 + IPv6).
|
||||
# Use "127.0.0.1" or "localhost" to restrict access to local machine only.
|
||||
host: ""
|
||||
# Server port
|
||||
port: 8317
|
||||
# TLS settings for HTTPS. When enabled, the server listens with the provided certificate and key.
|
||||
tls:
|
||||
enable: false
|
||||
cert: ""
|
||||
key: ""
|
||||
# Management API settings
|
||||
remote-management:
|
||||
# Whether to allow remote (non-localhost) management access.
|
||||
# When false, only localhost can access management endpoints (a key is still required).
|
||||
allow-remote: false
|
||||
# Management key. If a plaintext value is provided here, it will be hashed on startup.
|
||||
# All management requests (even from localhost) require this key.
|
||||
# Leave empty to disable the Management API entirely (404 for all /v0/management routes).
|
||||
secret-key: "$2a$10$iphjVa6f4T/FARz4e/edtOHvdoxTbE4tv/9mS0ebvDg/C8fEbPtgq"
|
||||
# Disable the bundled management control panel asset download and HTTP route when true.
|
||||
disable-control-panel: false
|
||||
|
||||
# GitHub repository for the management control panel. Accepts a repository URL or releases API URL.
|
||||
panel-github-repository: "https://github.com/router-for-me/Cli-Proxy-API-Management-Center"
|
||||
|
||||
# Authentication directory (supports ~ for home directory)
|
||||
auth-dir: "~/.cli-proxy-api"
|
||||
# Long-running agent harness files root directory (feature_list.json, claude-progress.txt).
|
||||
# The harness guides AI agents through structured, incremental development workflows.
|
||||
# - INITIALIZER mode: Creates feature list, progress log, and init.sh for new sessions
|
||||
# - CODING mode: Forces one-feature-at-a-time workflow with verification
|
||||
# Leave empty to use session-based memory storage (recommended).
|
||||
# Set to a specific directory to share harness files across sessions.
|
||||
# harness-root-dir: ""
|
||||
#
|
||||
# Environment variables:
|
||||
# CLIPROXY_HARNESS_ENABLED=true/false # Enable/disable harness injection (default: true)
|
||||
|
||||
# API keys for authentication
|
||||
api-keys:
|
||||
- "local-dev-key"
|
||||
# Enable debug logging
|
||||
debug: false
|
||||
|
||||
# When true, disable high-overhead HTTP middleware features to reduce per-request memory usage under high concurrency.
|
||||
commercial-mode: false
|
||||
|
||||
# Open OAuth URLs in incognito/private browser mode.
|
||||
# Useful when you want to login with a different account without logging out from your current session.
|
||||
# Default: false (but Kiro auth defaults to true for multi-account support)
|
||||
incognito-browser: true
|
||||
|
||||
# When true, write application logs to rotating files instead of stdout
|
||||
logging-to-file: false
|
||||
|
||||
# Maximum total size (MB) of log files under the logs directory. When exceeded, the oldest log
|
||||
# files are deleted until within the limit. Set to 0 to disable.
|
||||
logs-max-total-size-mb: 0
|
||||
|
||||
# When false, disable in-memory usage statistics aggregation
|
||||
usage-statistics-enabled: false
|
||||
# Proxy URL. Supports socks5/http/https protocols. Example: socks5://user:pass@192.168.1.1:1080/
|
||||
proxy-url: ""
|
||||
|
||||
# When true, unprefixed model requests only use credentials without a prefix (except when prefix == model name).
|
||||
force-model-prefix: false
|
||||
|
||||
# Number of times to retry a request. Retries will occur if the HTTP response code is 403, 408, 500, 502, 503, or 504.
|
||||
request-retry: 3
|
||||
# Maximum wait time in seconds for a cooled-down credential before triggering a retry.
|
||||
max-retry-interval: 30
|
||||
# Quota exceeded behavior
|
||||
quota-exceeded:
|
||||
switch-project: true # Whether to automatically switch to another project when a quota is exceeded
|
||||
switch-preview-model: true # Whether to automatically switch to a preview model when a quota is exceeded
|
||||
|
||||
# Routing strategy for selecting credentials when multiple match.
|
||||
routing:
|
||||
strategy: "round-robin" # round-robin (default), fill-first, usage-aware
|
||||
|
||||
# Global model mappings - route friendly names to actual models across all providers.
|
||||
# These mappings are checked before per-credential model mappings.
|
||||
# global-model-mappings:
|
||||
# - from: "smart" # Client requests "smart"
|
||||
# to: "claude-opus-4-5-20251101" # Routes to Claude Opus
|
||||
# - from: "rush"
|
||||
# to: "claude-haiku-4-5-20251001" # Routes to Claude Haiku (fast)
|
||||
# - from: "think"
|
||||
# to: "claude-opus-4-5-thinking" # Routes to thinking model
|
||||
# - from: "gemini-pro"
|
||||
# to: "gemini-2.5-pro-preview"
|
||||
# provider: "gemini" # Only applies to Gemini provider
|
||||
# - from: "cheap"
|
||||
# to: "gpt-4o-mini"
|
||||
# provider: "codex"
|
||||
# enabled: false # Disabled mapping (kept for reference)
|
||||
|
||||
# When true, enable authentication for the WebSocket API (/v1/ws).
|
||||
ws-auth: false
|
||||
|
||||
# Streaming behavior (SSE keep-alives, bootstrap retries, chunk sizing).
|
||||
# streaming:
|
||||
# keepalive-seconds: 15 # Default: 0 (disabled). <= 0 disables keep-alives.
|
||||
# bootstrap-retries: 1 # Default: 0 (disabled). Retries before first byte is sent.
|
||||
# max-chunk-size: 65536 # Default: 65536 (64KB). Max bytes per response chunk. 0 disables limiting.
|
||||
|
||||
# Context compression behavior (Factory.ai-style structured summarization).
|
||||
# Uses LLM to generate intelligent summaries with structured sections when context
|
||||
# exceeds the threshold. Summaries include: session intent, file modifications,
|
||||
# decisions made, next steps, and technical details.
|
||||
# compression:
|
||||
# enabled: true # Default: true. Enable LLM-based structured summarization.
|
||||
# threshold-percent: 0.75 # Default: 0.75. Trigger compression at 75% of context window.
|
||||
# max-summary-tokens: 2000 # Default: 2000. Maximum tokens for generated summaries.
|
||||
# summarization-timeout-seconds: 30 # Default: 30. Timeout for LLM summarization calls.
|
||||
# fallback-to-regex: true # Default: true. Use regex-based summary when LLM fails.
|
||||
|
||||
# Response caching - cache identical API responses to reduce upstream calls.
|
||||
# response-cache:
|
||||
# enabled: true
|
||||
# max-size: 1000 # Max cached responses
|
||||
# ttl-seconds: 300 # 5 minutes
|
||||
# exclude-models: # Don't cache these models
|
||||
# - "*-thinking"
|
||||
# - "o1-*"
|
||||
|
||||
# Prompt caching - track system prompts for analytics.
|
||||
# prompt-cache:
|
||||
# enabled: true
|
||||
# max-size: 500
|
||||
# ttl-seconds: 1800 # 30 minutes
|
||||
|
||||
# Token-aware compression (proactive trimming based on model context window).
|
||||
# Prevents "prompt too long" errors by trimming before hitting model limits.
|
||||
# Environment variables:
|
||||
# CLIPROXY_TOKEN_AWARE_ENABLED=true # Default: true. Enable token-based compression.
|
||||
# CLIPROXY_COMPRESSION_THRESHOLD=0.75 # Default: 0.75. Trim at 75% of context window.
|
||||
# CLIPROXY_RESERVE_TOKENS=8192 # Default: 8192. Tokens reserved for model output.
|
||||
|
||||
# Gemini API keys
|
||||
# gemini-api-key:
|
||||
# - api-key: "AIzaSy...01"
|
||||
# prefix: "test" # optional: require calls like "test/gemini-3-pro-preview" to target this credential
|
||||
# base-url: "https://generativelanguage.googleapis.com"
|
||||
# headers:
|
||||
# X-Custom-Header: "custom-value"
|
||||
# proxy-url: "socks5://proxy.example.com:1080"
|
||||
# excluded-models:
|
||||
# - "gemini-2.5-pro" # exclude specific models from this provider (exact match)
|
||||
# - "gemini-2.5-*" # wildcard matching prefix (e.g. gemini-2.5-flash, gemini-2.5-pro)
|
||||
# - "*-preview" # wildcard matching suffix (e.g. gemini-3-pro-preview, gemini-3-flash-preview)
|
||||
# - "*flash*" # wildcard matching substring (e.g. gemini-2.5-flash-lite)
|
||||
# - api-key: "AIzaSy...02"
|
||||
|
||||
# Codex API keys
|
||||
# codex-api-key:
|
||||
# - api-key: "sk-atSM..."
|
||||
# prefix: "test" # optional: require calls like "test/gpt-5-codex" to target this credential
|
||||
# base-url: "https://www.example.com" # use the custom codex API endpoint
|
||||
# headers:
|
||||
# X-Custom-Header: "custom-value"
|
||||
# proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override
|
||||
# models:
|
||||
# - name: "gpt-5-codex" # upstream model name
|
||||
# alias: "codex-latest" # client alias mapped to the upstream model
|
||||
# excluded-models:
|
||||
# - "gpt-5.2" # exclude specific models (exact match)
|
||||
# - "gpt-5-*" # wildcard matching prefix (e.g. gpt-5-medium, gpt-5-codex)
|
||||
# - "*-mini" # wildcard matching suffix (e.g. gpt-5-codex-mini)
|
||||
# - "*codex*" # wildcard matching substring (e.g. gpt-5-codex-low)
|
||||
|
||||
# Claude API keys
|
||||
# claude-api-key:
|
||||
# - api-key: "sk-atSM..." # use the official claude API key, no need to set the base url
|
||||
# - api-key: "sk-atSM..."
|
||||
# prefix: "test" # optional: require calls like "test/claude-sonnet-latest" to target this credential
|
||||
# base-url: "https://www.example.com" # use the custom claude API endpoint
|
||||
# headers:
|
||||
# X-Custom-Header: "custom-value"
|
||||
# proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override
|
||||
# models:
|
||||
# - name: "claude-sonnet-4-5-20250929" # upstream model name
|
||||
# alias: "claude-sonnet-latest" # client alias mapped to the upstream model
|
||||
# excluded-models:
|
||||
# - "claude-opus-4-5-20251101" # exclude specific models (exact match)
|
||||
# - "claude-4-*" # wildcard matching prefix (e.g. claude-sonnet-4-5-20250929)
|
||||
# - "*-thinking" # wildcard matching suffix (e.g. claude-opus-4-5-thinking)
|
||||
# - "*haiku*" # wildcard matching substring (e.g. claude-haiku-4-5-20251001)
|
||||
|
||||
# Kiro (AWS CodeWhisperer) configuration
|
||||
# kiro-key:
|
||||
# - token-file: "~/.aws/sso/cache/kiro-auth-token.json"
|
||||
# region: "us-east-1"
|
||||
# proxy-url: "socks5://proxy.example.com:1080"
|
||||
# agent-task-type: "dev"
|
||||
# excluded-models:
|
||||
# - "kiro-claude-haiku"
|
||||
|
||||
# Kiro (AWS CodeWhisperer) configuration
|
||||
# Note: Kiro API currently only operates in us-east-1 region
|
||||
#kiro:
|
||||
# - token-file: "~/.aws/sso/cache/kiro-auth-token.json" # path to Kiro token file
|
||||
# agent-task-type: "" # optional: "vibe" or empty (API default)
|
||||
# - access-token: "aoaAAAAA..." # or provide tokens directly
|
||||
# refresh-token: "aorAAAAA..."
|
||||
# profile-arn: "arn:aws:codewhisperer:us-east-1:..."
|
||||
# proxy-url: "socks5://proxy.example.com:1080" # optional: proxy override
|
||||
|
||||
# OpenAI compatibility providers
|
||||
# openai-compatibility:
|
||||
# - name: "openrouter" # The name of the provider; it will be used in the user agent and other places.
|
||||
# prefix: "test" # optional: require calls like "test/kimi-k2" to target this provider's credentials
|
||||
# base-url: "https://openrouter.ai/api/v1" # The base URL of the provider.
|
||||
# headers:
|
||||
# X-Custom-Header: "custom-value"
|
||||
# api-key-entries:
|
||||
# - api-key: "sk-or-v1-...b780"
|
||||
# proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override
|
||||
# - api-key: "sk-or-v1-...b781" # without proxy-url
|
||||
# models: # The models supported by the provider.
|
||||
# - name: "moonshotai/kimi-k2:free" # The actual model name.
|
||||
# alias: "kimi-k2" # The alias used in the API.
|
||||
|
||||
# Vertex API keys (Vertex-compatible endpoints, use API key + base URL)
|
||||
# vertex-api-key:
|
||||
# - api-key: "vk-123..." # x-goog-api-key header
|
||||
# prefix: "test" # optional: require calls like "test/vertex-pro" to target this credential
|
||||
# base-url: "https://example.com/api" # e.g. https://zenmux.ai/api
|
||||
# proxy-url: "socks5://proxy.example.com:1080" # optional per-key proxy override
|
||||
# headers:
|
||||
# X-Custom-Header: "custom-value"
|
||||
# models: # optional: map aliases to upstream model names
|
||||
# - name: "gemini-2.5-flash" # upstream model name
|
||||
# alias: "vertex-flash" # client-visible alias
|
||||
# - name: "gemini-1.5-pro"
|
||||
# alias: "vertex-pro"
|
||||
|
||||
# OAuth provider excluded models
|
||||
# oauth-excluded-models:
|
||||
# gemini-cli:
|
||||
# - "gemini-2.5-pro" # exclude specific models (exact match)
|
||||
# - "gemini-2.5-*" # wildcard matching prefix (e.g. gemini-2.5-flash, gemini-2.5-pro)
|
||||
# - "*-preview" # wildcard matching suffix (e.g. gemini-3-pro-preview, gemini-3-flash-preview)
|
||||
# - "*flash*" # wildcard matching substring (e.g. gemini-2.5-flash-lite)
|
||||
# vertex:
|
||||
# - "gemini-3-pro-preview"
|
||||
# - "gemini-3-flash-preview"
|
||||
# aistudio:
|
||||
# - "gemini-3-pro-preview"
|
||||
# antigravity:
|
||||
# - "gemini-3-pro-preview"
|
||||
# claude:
|
||||
# - "claude-3-5-haiku-20241022"
|
||||
# codex:
|
||||
# - "gpt-5-codex-mini"
|
||||
# qwen:
|
||||
# - "vision-model"
|
||||
# kiro:
|
||||
# - "kiro-claude-haiku"
|
||||
|
||||
# Optional payload configuration
|
||||
# payload:
|
||||
# default: # Default rules only set parameters when they are missing in the payload.
|
||||
# - models:
|
||||
# - name: "gemini-2.5-pro" # Supports wildcards (e.g., "gemini-*")
|
||||
# protocol: "gemini" # restricts the rule to a specific protocol, options: openai, gemini, claude, codex
|
||||
# params: # JSON path (gjson/sjson syntax) -> value
|
||||
# "generationConfig.thinkingConfig.thinkingBudget": 32768
|
||||
# override: # Override rules always set parameters, overwriting any existing values.
|
||||
# - models:
|
||||
# - name: "gpt-*" # Supports wildcards (e.g., "gpt-*")
|
||||
# protocol: "codex" # restricts the rule to a specific protocol, options: openai, gemini, claude, codex
|
||||
# params: # JSON path (gjson/sjson syntax) -> value
|
||||
# "reasoning.effort": "high"
|
||||
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 194 KiB |
@@ -0,0 +1,19 @@
|
||||
//go:build windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
)
|
||||
|
||||
// embeddedUI contains the built installer UI from installer-ui/dist.
|
||||
// The ui directory should contain index.html and any other assets.
|
||||
//
|
||||
//go:embed all:ui
|
||||
var embeddedUI embed.FS
|
||||
|
||||
// embeddedBundle contains the files to install.
|
||||
// These are embedded during the build process.
|
||||
//
|
||||
//go:embed bundle/ProxyPilot.exe bundle/config.example.yaml bundle/icon.ico bundle/icon.png
|
||||
var embeddedBundle embed.FS
|
||||
@@ -0,0 +1,196 @@
|
||||
//go:build windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// InstallConfig holds the configuration for the installation process.
|
||||
type InstallConfig struct {
|
||||
// InstallDir is the target installation directory.
|
||||
// Defaults to %LOCALAPPDATA%\ProxyPilot.
|
||||
InstallDir string
|
||||
|
||||
// CreateDesktopShortcut indicates whether to create a Desktop shortcut.
|
||||
CreateDesktopShortcut bool
|
||||
|
||||
// EnableAutostart indicates whether to register the app for autostart.
|
||||
EnableAutostart bool
|
||||
}
|
||||
|
||||
// ProgressCallback is called during file copy operations to report progress.
|
||||
type ProgressCallback func(progress int, status string)
|
||||
|
||||
// bundleFiles is the list of files to extract from the embedded bundle.
|
||||
var bundleFiles = []struct {
|
||||
src string // Path within embeddedBundle.
|
||||
dst string // Destination filename.
|
||||
size int64 // Approximate size for progress calculation.
|
||||
}{
|
||||
{"bundle/ProxyPilot.exe", "ProxyPilot.exe", 0},
|
||||
{"bundle/config.example.yaml", "config.example.yaml", 0},
|
||||
{"bundle/icon.ico", "icon.ico", 0},
|
||||
{"bundle/icon.png", "icon.png", 0},
|
||||
}
|
||||
|
||||
// CopyFiles extracts the embedded bundle files to the installation directory.
|
||||
func CopyFiles(config *InstallConfig, progress ProgressCallback) error {
|
||||
if config.InstallDir == "" {
|
||||
return fmt.Errorf("install directory not specified")
|
||||
}
|
||||
|
||||
// Ensure the installation directory exists.
|
||||
if err := os.MkdirAll(config.InstallDir, 0755); err != nil {
|
||||
return fmt.Errorf("failed to create install directory: %w", err)
|
||||
}
|
||||
|
||||
// Calculate total number of files for progress.
|
||||
totalFiles := len(bundleFiles)
|
||||
copiedFiles := 0
|
||||
|
||||
for _, file := range bundleFiles {
|
||||
dstPath := filepath.Join(config.InstallDir, file.dst)
|
||||
|
||||
if progress != nil {
|
||||
progress((copiedFiles*100)/totalFiles, fmt.Sprintf("Copying %s...", file.dst))
|
||||
}
|
||||
|
||||
if err := extractEmbeddedFile(file.src, dstPath); err != nil {
|
||||
return fmt.Errorf("failed to copy %s: %w", file.dst, err)
|
||||
}
|
||||
|
||||
copiedFiles++
|
||||
}
|
||||
|
||||
// Create config.yaml from config.example.yaml if it doesn't exist.
|
||||
configPath := filepath.Join(config.InstallDir, "config.yaml")
|
||||
examplePath := filepath.Join(config.InstallDir, "config.example.yaml")
|
||||
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
||||
if _, err := os.Stat(examplePath); err == nil {
|
||||
if err := copyFile(examplePath, configPath); err != nil {
|
||||
// Non-fatal: user can create config manually.
|
||||
_ = err
|
||||
} else if progress != nil {
|
||||
progress(95, "Created default configuration")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if progress != nil {
|
||||
progress(100, "All files copied successfully")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// extractEmbeddedFile extracts a file from the embedded bundle to the destination path.
|
||||
func extractEmbeddedFile(src, dst string) error {
|
||||
// Open the embedded file.
|
||||
srcFile, err := embeddedBundle.Open(src)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open embedded file %s: %w", src, err)
|
||||
}
|
||||
defer srcFile.Close()
|
||||
|
||||
// Get file info for permissions.
|
||||
info, err := srcFile.(fs.File).Stat()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to stat embedded file: %w", err)
|
||||
}
|
||||
|
||||
// Create destination directory if needed.
|
||||
dstDir := filepath.Dir(dst)
|
||||
if err := os.MkdirAll(dstDir, 0755); err != nil {
|
||||
return fmt.Errorf("failed to create directory %s: %w", dstDir, err)
|
||||
}
|
||||
|
||||
// Create the destination file.
|
||||
dstFile, err := os.OpenFile(dst, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, info.Mode())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create file %s: %w", dst, err)
|
||||
}
|
||||
defer dstFile.Close()
|
||||
|
||||
// Copy the content.
|
||||
if _, err := io.Copy(dstFile, srcFile); err != nil {
|
||||
return fmt.Errorf("failed to write file %s: %w", dst, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// copyFile copies a file from src to dst.
|
||||
func copyFile(src, dst string) error {
|
||||
srcFile, err := os.Open(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer srcFile.Close()
|
||||
|
||||
dstFile, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer dstFile.Close()
|
||||
|
||||
if _, err := io.Copy(dstFile, srcFile); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Cleanup removes all installed files on failure.
|
||||
func Cleanup(config *InstallConfig) error {
|
||||
if config.InstallDir == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Remove autostart registration.
|
||||
_ = UnregisterAutostart(config)
|
||||
|
||||
// Remove uninstall registration.
|
||||
_ = UnregisterUninstall()
|
||||
|
||||
// Remove shortcuts.
|
||||
_ = RemoveShortcuts(config)
|
||||
|
||||
// Remove the installation directory.
|
||||
// Only remove if it's under LocalAppData to prevent accidental deletion.
|
||||
localAppData := os.Getenv("LOCALAPPDATA")
|
||||
if localAppData != "" && filepath.HasPrefix(config.InstallDir, localAppData) {
|
||||
return os.RemoveAll(config.InstallDir)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveShortcuts removes all created shortcuts.
|
||||
func RemoveShortcuts(config *InstallConfig) error {
|
||||
var lastErr error
|
||||
|
||||
// Remove Start Menu shortcut.
|
||||
startMenuPath := getStartMenuPath()
|
||||
if startMenuPath != "" {
|
||||
shortcutPath := filepath.Join(startMenuPath, appName+".lnk")
|
||||
if err := os.Remove(shortcutPath); err != nil && !os.IsNotExist(err) {
|
||||
lastErr = err
|
||||
}
|
||||
}
|
||||
|
||||
// Remove Desktop shortcut.
|
||||
desktopPath := getDesktopPath()
|
||||
if desktopPath != "" {
|
||||
shortcutPath := filepath.Join(desktopPath, appName+".lnk")
|
||||
if err := os.Remove(shortcutPath); err != nil && !os.IsNotExist(err) {
|
||||
lastErr = err
|
||||
}
|
||||
}
|
||||
|
||||
return lastErr
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
//go:build windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/jchv/go-webview2"
|
||||
)
|
||||
|
||||
const (
|
||||
windowWidth = 500
|
||||
windowHeight = 400
|
||||
appName = "ProxyPilot"
|
||||
)
|
||||
|
||||
var (
|
||||
// assetServerURL holds the local HTTP server URL for serving embedded UI assets.
|
||||
assetServerURL string
|
||||
|
||||
// webviewInstance is the global WebView2 instance for window control.
|
||||
webviewInstance webview2.WebView
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Lock this goroutine to an OS thread - required for Windows COM/GUI operations.
|
||||
runtime.LockOSThread()
|
||||
|
||||
// Start embedded asset server for the installer UI.
|
||||
assetLn, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
if err != nil {
|
||||
_ = messageBox("ProxyPilot Installer", "Failed to start asset server: "+err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
assetServerURL = "http://" + assetLn.Addr().String()
|
||||
|
||||
go func() {
|
||||
fsys, err := fs.Sub(embeddedUI, "ui")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_ = http.Serve(assetLn, http.FileServer(http.FS(fsys)))
|
||||
}()
|
||||
|
||||
// Create frameless WebView2 window with dark theme.
|
||||
w := webview2.NewWithOptions(webview2.WebViewOptions{
|
||||
Debug: false,
|
||||
AutoFocus: true,
|
||||
WindowOptions: webview2.WindowOptions{
|
||||
Title: "ProxyPilot Installer",
|
||||
Width: uint(windowWidth),
|
||||
Height: uint(windowHeight),
|
||||
Center: true,
|
||||
IconId: 1, // Use embedded icon from resource.syso if present.
|
||||
},
|
||||
})
|
||||
if w == nil {
|
||||
_ = messageBox("ProxyPilot Installer", "Failed to initialize WebView2.\n\nPlease ensure WebView2 Runtime is installed.")
|
||||
os.Exit(1)
|
||||
}
|
||||
defer w.Destroy()
|
||||
|
||||
webviewInstance = w
|
||||
|
||||
// Bind Go functions to JavaScript.
|
||||
bindInstallerFunctions(w)
|
||||
|
||||
// Navigate to the embedded UI.
|
||||
target := assetServerURL + "/index.html"
|
||||
w.Navigate(target)
|
||||
|
||||
// Apply dark window chrome and frameless styling after navigation.
|
||||
w.Dispatch(func() {
|
||||
applyDarkWindowChrome(w)
|
||||
})
|
||||
|
||||
w.Run()
|
||||
}
|
||||
|
||||
// bindInstallerFunctions binds all Go functions to the JavaScript window.installer object.
|
||||
func bindInstallerFunctions(w webview2.WebView) {
|
||||
// Create the installer namespace.
|
||||
w.Init(`window.installer = {};`)
|
||||
|
||||
// Bind startInstall - starts the installation process.
|
||||
_ = w.Bind("installer_startInstall", func(optionsJSON string) (map[string]any, error) {
|
||||
var options struct {
|
||||
Desktop bool `json:"desktop"`
|
||||
Autostart bool `json:"autostart"`
|
||||
}
|
||||
if err := json.Unmarshal([]byte(optionsJSON), &options); err != nil {
|
||||
options.Desktop = false
|
||||
options.Autostart = true
|
||||
}
|
||||
|
||||
config := &InstallConfig{
|
||||
CreateDesktopShortcut: options.Desktop,
|
||||
EnableAutostart: options.Autostart,
|
||||
}
|
||||
|
||||
// Run installation in a goroutine to not block the UI.
|
||||
go func() {
|
||||
if err := runInstallation(w, config); err != nil {
|
||||
callSetProgress(w, -1, "Installation failed: "+err.Error())
|
||||
}
|
||||
}()
|
||||
|
||||
return map[string]any{"started": true}, nil
|
||||
})
|
||||
|
||||
// Bind launch - launches the installed application.
|
||||
_ = w.Bind("installer_launch", func() error {
|
||||
installDir := getInstallDir()
|
||||
exePath := filepath.Join(installDir, "ProxyPilot.exe")
|
||||
if _, err := os.Stat(exePath); err != nil {
|
||||
return fmt.Errorf("ProxyPilot.exe not found at %s", exePath)
|
||||
}
|
||||
cmd := exec.Command(exePath)
|
||||
cmd.Dir = installDir
|
||||
return cmd.Start()
|
||||
})
|
||||
|
||||
// Bind close - closes the installer window.
|
||||
_ = w.Bind("installer_close", func() error {
|
||||
w.Dispatch(func() {
|
||||
w.Terminate()
|
||||
})
|
||||
return nil
|
||||
})
|
||||
|
||||
// Bind minimize - minimizes the window.
|
||||
_ = w.Bind("installer_minimize", func() error {
|
||||
w.Dispatch(func() {
|
||||
minimizeWindow(w)
|
||||
})
|
||||
return nil
|
||||
})
|
||||
|
||||
// Bind getInstallPath - returns the default installation path.
|
||||
_ = w.Bind("installer_getInstallPath", func() (string, error) {
|
||||
return getInstallDir(), nil
|
||||
})
|
||||
|
||||
// Initialize the window.installer JavaScript API.
|
||||
w.Init(`
|
||||
window.installer.startInstall = function(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
installer_startInstall(JSON.stringify(options || {}))
|
||||
.then(resolve)
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
||||
window.installer.launch = installer_launch;
|
||||
window.installer.close = installer_close;
|
||||
window.installer.minimize = installer_minimize;
|
||||
window.installer.getInstallPath = installer_getInstallPath;
|
||||
`)
|
||||
}
|
||||
|
||||
// runInstallation performs the complete installation process with progress reporting.
|
||||
func runInstallation(w webview2.WebView, config *InstallConfig) error {
|
||||
// Initialize install configuration with defaults.
|
||||
config.InstallDir = getInstallDir()
|
||||
|
||||
// Step 1: Prepare installation directory (10%).
|
||||
callSetProgress(w, 5, "Preparing installation directory...")
|
||||
if err := os.MkdirAll(config.InstallDir, 0755); err != nil {
|
||||
return fmt.Errorf("failed to create install directory: %w", err)
|
||||
}
|
||||
callSetProgress(w, 10, "Installation directory ready")
|
||||
|
||||
// Step 2: Copy files (10% - 60%).
|
||||
callSetProgress(w, 15, "Copying application files...")
|
||||
if err := CopyFiles(config, func(progress int, status string) {
|
||||
// Map 0-100 to 15-60.
|
||||
mappedProgress := 15 + (progress * 45 / 100)
|
||||
callSetProgress(w, mappedProgress, status)
|
||||
}); err != nil {
|
||||
return fmt.Errorf("failed to copy files: %w", err)
|
||||
}
|
||||
callSetProgress(w, 60, "Files copied successfully")
|
||||
|
||||
// Step 3: Create shortcuts (60% - 80%).
|
||||
callSetProgress(w, 65, "Creating shortcuts...")
|
||||
if err := CreateShortcuts(config); err != nil {
|
||||
// Non-fatal: log but continue.
|
||||
callSetProgress(w, 70, "Warning: Some shortcuts could not be created")
|
||||
} else {
|
||||
callSetProgress(w, 80, "Shortcuts created")
|
||||
}
|
||||
|
||||
// Step 4: Register autostart if enabled (80% - 90%).
|
||||
if config.EnableAutostart {
|
||||
callSetProgress(w, 85, "Configuring autostart...")
|
||||
if err := RegisterAutostart(config); err != nil {
|
||||
// Non-fatal: log but continue.
|
||||
callSetProgress(w, 88, "Warning: Autostart could not be configured")
|
||||
} else {
|
||||
callSetProgress(w, 90, "Autostart configured")
|
||||
}
|
||||
} else {
|
||||
callSetProgress(w, 90, "Skipping autostart configuration")
|
||||
}
|
||||
|
||||
// Step 5: Register uninstaller (90% - 100%).
|
||||
callSetProgress(w, 92, "Registering application...")
|
||||
if err := RegisterUninstall(config); err != nil {
|
||||
// Non-fatal: log but continue.
|
||||
callSetProgress(w, 95, "Warning: Uninstall registration incomplete")
|
||||
} else {
|
||||
callSetProgress(w, 98, "Application registered")
|
||||
}
|
||||
|
||||
callSetProgress(w, 100, "Installation complete!")
|
||||
return nil
|
||||
}
|
||||
|
||||
// callSetProgress calls window.setProgress in the WebView.
|
||||
func callSetProgress(w webview2.WebView, percent int, statusText string) {
|
||||
// Escape the status text for JavaScript.
|
||||
escaped := strings.ReplaceAll(statusText, "\\", "\\\\")
|
||||
escaped = strings.ReplaceAll(escaped, "'", "\\'")
|
||||
escaped = strings.ReplaceAll(escaped, "\n", "\\n")
|
||||
|
||||
js := fmt.Sprintf("if(window.setProgress){window.setProgress(%d,'%s');}", percent, escaped)
|
||||
w.Dispatch(func() {
|
||||
w.Eval(js)
|
||||
})
|
||||
}
|
||||
|
||||
// getInstallDir returns the default installation directory.
|
||||
func getInstallDir() string {
|
||||
localAppData := os.Getenv("LOCALAPPDATA")
|
||||
if localAppData == "" {
|
||||
home, _ := os.UserHomeDir()
|
||||
localAppData = filepath.Join(home, "AppData", "Local")
|
||||
}
|
||||
return filepath.Join(localAppData, appName)
|
||||
}
|
||||
|
||||
// applyDarkWindowChrome applies dark mode window chrome styling.
|
||||
func applyDarkWindowChrome(w webview2.WebView) {
|
||||
hwnd := getWindowHandle(w)
|
||||
if hwnd == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// Enable dark mode for the window frame.
|
||||
dwmapi := syscall.NewLazyDLL("dwmapi.dll")
|
||||
dwmSetWindowAttribute := dwmapi.NewProc("DwmSetWindowAttribute")
|
||||
|
||||
// DWMWA_USE_IMMERSIVE_DARK_MODE = 20.
|
||||
const DWMWA_USE_IMMERSIVE_DARK_MODE = 20
|
||||
darkMode := int32(1)
|
||||
_, _, _ = dwmSetWindowAttribute.Call(
|
||||
hwnd,
|
||||
uintptr(DWMWA_USE_IMMERSIVE_DARK_MODE),
|
||||
uintptr(unsafe.Pointer(&darkMode)),
|
||||
unsafe.Sizeof(darkMode),
|
||||
)
|
||||
|
||||
// DWMWA_CAPTION_COLOR = 35 (Windows 11).
|
||||
const DWMWA_CAPTION_COLOR = 35
|
||||
captionColor := uint32(0x001E1E1E) // Dark gray in BGR format.
|
||||
_, _, _ = dwmSetWindowAttribute.Call(
|
||||
hwnd,
|
||||
uintptr(DWMWA_CAPTION_COLOR),
|
||||
uintptr(unsafe.Pointer(&captionColor)),
|
||||
unsafe.Sizeof(captionColor),
|
||||
)
|
||||
}
|
||||
|
||||
// getWindowHandle retrieves the HWND for the WebView window.
|
||||
func getWindowHandle(w webview2.WebView) uintptr {
|
||||
// The go-webview2 library provides a Window() method that returns the HWND.
|
||||
return uintptr(w.Window())
|
||||
}
|
||||
|
||||
// minimizeWindow minimizes the WebView window.
|
||||
func minimizeWindow(w webview2.WebView) {
|
||||
hwnd := getWindowHandle(w)
|
||||
if hwnd == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
user32 := syscall.NewLazyDLL("user32.dll")
|
||||
showWindow := user32.NewProc("ShowWindow")
|
||||
const SW_MINIMIZE = 6
|
||||
_, _, _ = showWindow.Call(hwnd, uintptr(SW_MINIMIZE))
|
||||
}
|
||||
|
||||
// messageBox displays a Windows message box.
|
||||
func messageBox(title, text string) error {
|
||||
user32 := syscall.NewLazyDLL("user32.dll")
|
||||
proc := user32.NewProc("MessageBoxW")
|
||||
t, _ := syscall.UTF16PtrFromString(title)
|
||||
m, _ := syscall.UTF16PtrFromString(text)
|
||||
// MB_OK | MB_ICONERROR.
|
||||
_, _, err := proc.Call(0, uintptr(unsafe.Pointer(m)), uintptr(unsafe.Pointer(t)), 0x00000000|0x00000010)
|
||||
if err == syscall.Errno(0) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
//go:build windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"golang.org/x/sys/windows/registry"
|
||||
)
|
||||
|
||||
const (
|
||||
// Registry key paths.
|
||||
autostartKeyPath = `Software\Microsoft\Windows\CurrentVersion\Run`
|
||||
uninstallKeyPath = `Software\Microsoft\Windows\CurrentVersion\Uninstall\` + appName
|
||||
uninstallKeyBase = `Software\Microsoft\Windows\CurrentVersion\Uninstall`
|
||||
|
||||
// Application metadata.
|
||||
appPublisher = "ProxyPilot"
|
||||
appVersion = "1.0.0"
|
||||
)
|
||||
|
||||
// RegisterAutostart adds the application to the Windows autostart registry.
|
||||
func RegisterAutostart(config *InstallConfig) error {
|
||||
if config.InstallDir == "" {
|
||||
return fmt.Errorf("install directory not specified")
|
||||
}
|
||||
|
||||
exePath := filepath.Join(config.InstallDir, "ProxyPilot.exe")
|
||||
|
||||
key, _, err := registry.CreateKey(registry.CURRENT_USER, autostartKeyPath, registry.SET_VALUE)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open autostart registry key: %w", err)
|
||||
}
|
||||
defer key.Close()
|
||||
|
||||
// Add the application with quoted path to handle spaces.
|
||||
if err := key.SetStringValue(appName, `"`+exePath+`"`); err != nil {
|
||||
return fmt.Errorf("failed to set autostart value: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnregisterAutostart removes the application from Windows autostart.
|
||||
func UnregisterAutostart(config *InstallConfig) error {
|
||||
key, err := registry.OpenKey(registry.CURRENT_USER, autostartKeyPath, registry.SET_VALUE)
|
||||
if err != nil {
|
||||
// Key doesn't exist or can't be opened; nothing to remove.
|
||||
return nil
|
||||
}
|
||||
defer key.Close()
|
||||
|
||||
if err := key.DeleteValue(appName); err != nil {
|
||||
// Value doesn't exist; that's fine.
|
||||
if err == registry.ErrNotExist {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("failed to remove autostart value: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsAutostartEnabled checks if the application is registered for autostart.
|
||||
func IsAutostartEnabled() bool {
|
||||
key, err := registry.OpenKey(registry.CURRENT_USER, autostartKeyPath, registry.QUERY_VALUE)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
defer key.Close()
|
||||
|
||||
_, _, err = key.GetStringValue(appName)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// RegisterUninstall registers the application in Add/Remove Programs.
|
||||
func RegisterUninstall(config *InstallConfig) error {
|
||||
if config.InstallDir == "" {
|
||||
return fmt.Errorf("install directory not specified")
|
||||
}
|
||||
|
||||
exePath := filepath.Join(config.InstallDir, "ProxyPilot.exe")
|
||||
iconPath := filepath.Join(config.InstallDir, "icon.ico")
|
||||
|
||||
// Create the uninstall key.
|
||||
key, _, err := registry.CreateKey(registry.CURRENT_USER, uninstallKeyPath, registry.SET_VALUE)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create uninstall registry key: %w", err)
|
||||
}
|
||||
defer key.Close()
|
||||
|
||||
// Set the required values.
|
||||
values := map[string]string{
|
||||
"DisplayName": appName,
|
||||
"DisplayVersion": appVersion,
|
||||
"Publisher": appPublisher,
|
||||
"InstallLocation": config.InstallDir,
|
||||
"DisplayIcon": iconPath,
|
||||
"UninstallString": `"` + exePath + `" --uninstall`,
|
||||
"QuietUninstallString": `"` + exePath + `" --uninstall --quiet`,
|
||||
}
|
||||
|
||||
for name, value := range values {
|
||||
if err := key.SetStringValue(name, value); err != nil {
|
||||
return fmt.Errorf("failed to set %s: %w", name, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Set NoModify and NoRepair flags.
|
||||
if err := key.SetDWordValue("NoModify", 1); err != nil {
|
||||
return fmt.Errorf("failed to set NoModify: %w", err)
|
||||
}
|
||||
if err := key.SetDWordValue("NoRepair", 1); err != nil {
|
||||
return fmt.Errorf("failed to set NoRepair: %w", err)
|
||||
}
|
||||
|
||||
// Estimate the installed size in KB.
|
||||
estimatedSize := uint32(40 * 1024) // ~40 MB estimate.
|
||||
if err := key.SetDWordValue("EstimatedSize", estimatedSize); err != nil {
|
||||
// Non-fatal.
|
||||
_ = err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnregisterUninstall removes the application from Add/Remove Programs.
|
||||
func UnregisterUninstall() error {
|
||||
// Delete the entire uninstall key.
|
||||
if err := registry.DeleteKey(registry.CURRENT_USER, uninstallKeyPath); err != nil {
|
||||
if err == registry.ErrNotExist {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("failed to delete uninstall registry key: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetInstallPathFromRegistry retrieves the installation path from the registry.
|
||||
// Returns an empty string if not found.
|
||||
func GetInstallPathFromRegistry() string {
|
||||
key, err := registry.OpenKey(registry.CURRENT_USER, uninstallKeyPath, registry.QUERY_VALUE)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
defer key.Close()
|
||||
|
||||
path, _, err := key.GetStringValue("InstallLocation")
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
// SetRegistryString is a helper to set a string value in the registry.
|
||||
func SetRegistryString(keyPath, valueName, value string) error {
|
||||
key, _, err := registry.CreateKey(registry.CURRENT_USER, keyPath, registry.SET_VALUE)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer key.Close()
|
||||
return key.SetStringValue(valueName, value)
|
||||
}
|
||||
|
||||
// DeleteRegistryValue is a helper to delete a registry value.
|
||||
func DeleteRegistryValue(keyPath, valueName string) error {
|
||||
key, err := registry.OpenKey(registry.CURRENT_USER, keyPath, registry.SET_VALUE)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer key.Close()
|
||||
return key.DeleteValue(valueName)
|
||||
}
|
||||
|
||||
// DeleteRegistryKey is a helper to delete a registry key.
|
||||
func DeleteRegistryKey(keyPath string) error {
|
||||
return registry.DeleteKey(registry.CURRENT_USER, keyPath)
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
//go:build windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
// GUID for IShellLinkW.
|
||||
var (
|
||||
CLSID_ShellLink = windows.GUID{
|
||||
Data1: 0x00021401,
|
||||
Data2: 0x0000,
|
||||
Data3: 0x0000,
|
||||
Data4: [8]byte{0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46},
|
||||
}
|
||||
IID_IShellLinkW = windows.GUID{
|
||||
Data1: 0x000214F9,
|
||||
Data2: 0x0000,
|
||||
Data3: 0x0000,
|
||||
Data4: [8]byte{0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46},
|
||||
}
|
||||
IID_IPersistFile = windows.GUID{
|
||||
Data1: 0x0000010B,
|
||||
Data2: 0x0000,
|
||||
Data3: 0x0000,
|
||||
Data4: [8]byte{0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46},
|
||||
}
|
||||
)
|
||||
|
||||
// IShellLinkW virtual table.
|
||||
type IShellLinkWVtbl struct {
|
||||
QueryInterface uintptr
|
||||
AddRef uintptr
|
||||
Release uintptr
|
||||
GetPath uintptr
|
||||
GetIDList uintptr
|
||||
SetIDList uintptr
|
||||
GetDescription uintptr
|
||||
SetDescription uintptr
|
||||
GetWorkingDirectory uintptr
|
||||
SetWorkingDirectory uintptr
|
||||
GetArguments uintptr
|
||||
SetArguments uintptr
|
||||
GetHotkey uintptr
|
||||
SetHotkey uintptr
|
||||
GetShowCmd uintptr
|
||||
SetShowCmd uintptr
|
||||
GetIconLocation uintptr
|
||||
SetIconLocation uintptr
|
||||
SetRelativePath uintptr
|
||||
Resolve uintptr
|
||||
SetPath uintptr
|
||||
}
|
||||
|
||||
type IShellLinkW struct {
|
||||
vtbl *IShellLinkWVtbl
|
||||
}
|
||||
|
||||
// IPersistFile virtual table.
|
||||
type IPersistFileVtbl struct {
|
||||
QueryInterface uintptr
|
||||
AddRef uintptr
|
||||
Release uintptr
|
||||
GetClassID uintptr
|
||||
IsDirty uintptr
|
||||
Load uintptr
|
||||
Save uintptr
|
||||
SaveCompleted uintptr
|
||||
GetCurFile uintptr
|
||||
}
|
||||
|
||||
type IPersistFile struct {
|
||||
vtbl *IPersistFileVtbl
|
||||
}
|
||||
|
||||
var (
|
||||
ole32 = syscall.NewLazyDLL("ole32.dll")
|
||||
coInitializeEx = ole32.NewProc("CoInitializeEx")
|
||||
coCreateInstance = ole32.NewProc("CoCreateInstance")
|
||||
coUninitialize = ole32.NewProc("CoUninitialize")
|
||||
)
|
||||
|
||||
const (
|
||||
COINIT_APARTMENTTHREADED = 0x2
|
||||
CLSCTX_INPROC_SERVER = 0x1
|
||||
)
|
||||
|
||||
// CreateShortcuts creates Start Menu and optionally Desktop shortcuts.
|
||||
func CreateShortcuts(config *InstallConfig) error {
|
||||
if config.InstallDir == "" {
|
||||
return fmt.Errorf("install directory not specified")
|
||||
}
|
||||
|
||||
exePath := filepath.Join(config.InstallDir, "ProxyPilot.exe")
|
||||
iconPath := filepath.Join(config.InstallDir, "icon.ico")
|
||||
|
||||
// Create Start Menu shortcut.
|
||||
startMenuPath := getStartMenuPath()
|
||||
if startMenuPath != "" {
|
||||
shortcutPath := filepath.Join(startMenuPath, appName+".lnk")
|
||||
if err := createShortcut(shortcutPath, exePath, config.InstallDir, iconPath, "ProxyPilot - AI Proxy Router"); err != nil {
|
||||
return fmt.Errorf("failed to create Start Menu shortcut: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Create Desktop shortcut if requested.
|
||||
if config.CreateDesktopShortcut {
|
||||
desktopPath := getDesktopPath()
|
||||
if desktopPath != "" {
|
||||
shortcutPath := filepath.Join(desktopPath, appName+".lnk")
|
||||
if err := createShortcut(shortcutPath, exePath, config.InstallDir, iconPath, "ProxyPilot - AI Proxy Router"); err != nil {
|
||||
return fmt.Errorf("failed to create Desktop shortcut: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// createShortcut creates a Windows .lnk shortcut file using COM.
|
||||
func createShortcut(shortcutPath, targetPath, workingDir, iconPath, description string) error {
|
||||
// Initialize COM.
|
||||
hr, _, _ := coInitializeEx.Call(0, uintptr(COINIT_APARTMENTTHREADED))
|
||||
if hr != 0 && hr != 1 { // S_OK or S_FALSE.
|
||||
return fmt.Errorf("CoInitializeEx failed: 0x%X", hr)
|
||||
}
|
||||
defer coUninitialize.Call()
|
||||
|
||||
// Create IShellLink instance.
|
||||
var shellLink *IShellLinkW
|
||||
hr, _, _ = coCreateInstance.Call(
|
||||
uintptr(unsafe.Pointer(&CLSID_ShellLink)),
|
||||
0,
|
||||
uintptr(CLSCTX_INPROC_SERVER),
|
||||
uintptr(unsafe.Pointer(&IID_IShellLinkW)),
|
||||
uintptr(unsafe.Pointer(&shellLink)),
|
||||
)
|
||||
if hr != 0 {
|
||||
return fmt.Errorf("CoCreateInstance failed: 0x%X", hr)
|
||||
}
|
||||
|
||||
// Set the target path.
|
||||
targetPathW, _ := syscall.UTF16PtrFromString(targetPath)
|
||||
hr, _, _ = syscall.SyscallN(shellLink.vtbl.SetPath, uintptr(unsafe.Pointer(shellLink)), uintptr(unsafe.Pointer(targetPathW)))
|
||||
if hr != 0 {
|
||||
return fmt.Errorf("SetPath failed: 0x%X", hr)
|
||||
}
|
||||
|
||||
// Set the working directory.
|
||||
workingDirW, _ := syscall.UTF16PtrFromString(workingDir)
|
||||
hr, _, _ = syscall.SyscallN(shellLink.vtbl.SetWorkingDirectory, uintptr(unsafe.Pointer(shellLink)), uintptr(unsafe.Pointer(workingDirW)))
|
||||
if hr != 0 {
|
||||
return fmt.Errorf("SetWorkingDirectory failed: 0x%X", hr)
|
||||
}
|
||||
|
||||
// Set the description.
|
||||
descriptionW, _ := syscall.UTF16PtrFromString(description)
|
||||
hr, _, _ = syscall.SyscallN(shellLink.vtbl.SetDescription, uintptr(unsafe.Pointer(shellLink)), uintptr(unsafe.Pointer(descriptionW)))
|
||||
if hr != 0 {
|
||||
return fmt.Errorf("SetDescription failed: 0x%X", hr)
|
||||
}
|
||||
|
||||
// Set the icon.
|
||||
if iconPath != "" {
|
||||
iconPathW, _ := syscall.UTF16PtrFromString(iconPath)
|
||||
hr, _, _ = syscall.SyscallN(shellLink.vtbl.SetIconLocation, uintptr(unsafe.Pointer(shellLink)), uintptr(unsafe.Pointer(iconPathW)), 0)
|
||||
if hr != 0 {
|
||||
// Non-fatal: continue without icon.
|
||||
_ = hr
|
||||
}
|
||||
}
|
||||
|
||||
// Query for IPersistFile interface.
|
||||
var persistFile *IPersistFile
|
||||
hr, _, _ = syscall.SyscallN(
|
||||
shellLink.vtbl.QueryInterface,
|
||||
uintptr(unsafe.Pointer(shellLink)),
|
||||
uintptr(unsafe.Pointer(&IID_IPersistFile)),
|
||||
uintptr(unsafe.Pointer(&persistFile)),
|
||||
)
|
||||
if hr != 0 {
|
||||
return fmt.Errorf("QueryInterface for IPersistFile failed: 0x%X", hr)
|
||||
}
|
||||
|
||||
// Ensure the shortcut directory exists.
|
||||
shortcutDir := filepath.Dir(shortcutPath)
|
||||
if err := os.MkdirAll(shortcutDir, 0755); err != nil {
|
||||
return fmt.Errorf("failed to create shortcut directory: %w", err)
|
||||
}
|
||||
|
||||
// Save the shortcut.
|
||||
shortcutPathW, _ := syscall.UTF16PtrFromString(shortcutPath)
|
||||
hr, _, _ = syscall.SyscallN(persistFile.vtbl.Save, uintptr(unsafe.Pointer(persistFile)), uintptr(unsafe.Pointer(shortcutPathW)), 1)
|
||||
if hr != 0 {
|
||||
return fmt.Errorf("Save failed: 0x%X", hr)
|
||||
}
|
||||
|
||||
// Release interfaces.
|
||||
syscall.SyscallN(persistFile.vtbl.Release, uintptr(unsafe.Pointer(persistFile)))
|
||||
syscall.SyscallN(shellLink.vtbl.Release, uintptr(unsafe.Pointer(shellLink)))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// getStartMenuPath returns the user's Start Menu Programs folder.
|
||||
func getStartMenuPath() string {
|
||||
// CSIDL_PROGRAMS = 0x0002.
|
||||
path := getKnownFolderPath(0x0002)
|
||||
if path != "" {
|
||||
return path
|
||||
}
|
||||
|
||||
// Fallback to constructing the path manually.
|
||||
appData := os.Getenv("APPDATA")
|
||||
if appData != "" {
|
||||
return filepath.Join(appData, "Microsoft", "Windows", "Start Menu", "Programs")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// getDesktopPath returns the user's Desktop folder.
|
||||
func getDesktopPath() string {
|
||||
// CSIDL_DESKTOP = 0x0000.
|
||||
path := getKnownFolderPath(0x0000)
|
||||
if path != "" {
|
||||
return path
|
||||
}
|
||||
|
||||
// Fallback.
|
||||
home, _ := os.UserHomeDir()
|
||||
if home != "" {
|
||||
return filepath.Join(home, "Desktop")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// getKnownFolderPath retrieves a known folder path using SHGetFolderPath.
|
||||
func getKnownFolderPath(csidl int) string {
|
||||
shell32 := syscall.NewLazyDLL("shell32.dll")
|
||||
shGetFolderPath := shell32.NewProc("SHGetFolderPathW")
|
||||
|
||||
buf := make([]uint16, 260) // MAX_PATH.
|
||||
hr, _, _ := shGetFolderPath.Call(
|
||||
0,
|
||||
uintptr(csidl),
|
||||
0,
|
||||
0,
|
||||
uintptr(unsafe.Pointer(&buf[0])),
|
||||
)
|
||||
if hr != 0 {
|
||||
return ""
|
||||
}
|
||||
return syscall.UTF16ToString(buf)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>ProxyPilot Installer</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet" />
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html, body, #root {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
body {
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
background: #0a0a0b;
|
||||
}
|
||||
</style>
|
||||
<script type="module" crossorigin src="./assets/index-Ct7uoBdX.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-DTO-I4cJ.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 194 KiB |
@@ -0,0 +1,261 @@
|
||||
//go:build windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/config"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/desktopctl"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// EmbeddedEngine runs the proxy service in-process within the tray application.
|
||||
// It provides thread-safe methods for starting, stopping, and querying the service status.
|
||||
type EmbeddedEngine struct {
|
||||
mu sync.Mutex
|
||||
|
||||
// running indicates whether the service is currently active.
|
||||
running bool
|
||||
|
||||
// port is the port number the service is listening on.
|
||||
port int
|
||||
|
||||
// configPath stores the path to the configuration file.
|
||||
configPath string
|
||||
|
||||
// lastError holds the most recent error encountered during operation.
|
||||
lastError error
|
||||
|
||||
// startedAt records when the service was started.
|
||||
startedAt time.Time
|
||||
|
||||
// cancel is the function to cancel the service context.
|
||||
cancel context.CancelFunc
|
||||
|
||||
// wg waits for the service goroutine to complete.
|
||||
wg sync.WaitGroup
|
||||
|
||||
// panicCount tracks the number of panics for monitoring.
|
||||
panicCount int
|
||||
|
||||
// restartCount tracks the number of automatic restarts.
|
||||
restartCount int
|
||||
}
|
||||
|
||||
// NewEmbeddedEngine creates a new EmbeddedEngine instance.
|
||||
func NewEmbeddedEngine() *EmbeddedEngine {
|
||||
return &EmbeddedEngine{}
|
||||
}
|
||||
|
||||
// Start builds and runs the proxy service in a background goroutine.
|
||||
// It returns an error if the service is already running or if building the service fails.
|
||||
func (e *EmbeddedEngine) Start(cfg *config.Config, configPath, password string) error {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
|
||||
if e.running {
|
||||
return errors.New("engine is already running")
|
||||
}
|
||||
|
||||
if cfg == nil {
|
||||
return errors.New("configuration is required")
|
||||
}
|
||||
|
||||
if configPath == "" {
|
||||
return errors.New("configuration path is required")
|
||||
}
|
||||
|
||||
// Build the service using the SDK builder pattern
|
||||
builder := cliproxy.NewBuilder().
|
||||
WithConfig(cfg).
|
||||
WithConfigPath(configPath).
|
||||
WithLocalManagementPassword(password)
|
||||
|
||||
service, err := builder.Build()
|
||||
if err != nil {
|
||||
e.lastError = fmt.Errorf("failed to build proxy service: %w", err)
|
||||
return e.lastError
|
||||
}
|
||||
|
||||
// Create a cancelable context for the service
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
e.cancel = cancel
|
||||
|
||||
// Track state
|
||||
e.running = true
|
||||
e.port = cfg.Port
|
||||
e.configPath = configPath
|
||||
e.lastError = nil
|
||||
e.startedAt = time.Now()
|
||||
|
||||
log.Infof("starting embedded proxy engine on port %d", e.port)
|
||||
|
||||
// Run the service in a goroutine with panic recovery
|
||||
e.wg.Add(1)
|
||||
go func() {
|
||||
defer e.wg.Done()
|
||||
defer func() {
|
||||
// Recover from panics to prevent crashing the tray app
|
||||
if r := recover(); r != nil {
|
||||
e.mu.Lock()
|
||||
e.panicCount++
|
||||
e.running = false
|
||||
e.cancel = nil
|
||||
e.lastError = fmt.Errorf("proxy service panicked: %v", r)
|
||||
e.mu.Unlock()
|
||||
log.Errorf("embedded proxy engine panic recovered: %v", r)
|
||||
}
|
||||
}()
|
||||
defer func() {
|
||||
e.mu.Lock()
|
||||
e.running = false
|
||||
e.cancel = nil
|
||||
e.mu.Unlock()
|
||||
log.Info("embedded proxy engine stopped")
|
||||
}()
|
||||
|
||||
err := service.Run(ctx)
|
||||
if err != nil && !errors.Is(err, context.Canceled) {
|
||||
e.mu.Lock()
|
||||
e.lastError = fmt.Errorf("proxy service exited with error: %w", err)
|
||||
e.mu.Unlock()
|
||||
log.Errorf("embedded proxy engine error: %v", err)
|
||||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stop cancels the running service and waits for it to shut down gracefully.
|
||||
// It returns an error if the service is not running or if shutdown times out.
|
||||
func (e *EmbeddedEngine) Stop() error {
|
||||
e.mu.Lock()
|
||||
|
||||
if !e.running {
|
||||
e.mu.Unlock()
|
||||
return errors.New("engine is not running")
|
||||
}
|
||||
|
||||
if e.cancel != nil {
|
||||
log.Info("stopping embedded proxy engine...")
|
||||
e.cancel()
|
||||
}
|
||||
|
||||
e.mu.Unlock()
|
||||
|
||||
// Wait for the goroutine to complete with a timeout
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
e.wg.Wait()
|
||||
close(done)
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-done:
|
||||
log.Info("embedded proxy engine stopped gracefully")
|
||||
return nil
|
||||
case <-time.After(10 * time.Second):
|
||||
// Force mark as stopped to prevent deadlock
|
||||
e.mu.Lock()
|
||||
e.running = false
|
||||
e.cancel = nil
|
||||
e.lastError = errors.New("shutdown timed out after 10 seconds")
|
||||
e.mu.Unlock()
|
||||
log.Warn("embedded proxy engine shutdown timed out, forcing stop")
|
||||
return errors.New("shutdown timed out")
|
||||
}
|
||||
}
|
||||
|
||||
// Restart stops the running service (if any) and starts it again with the new configuration.
|
||||
func (e *EmbeddedEngine) Restart(cfg *config.Config, configPath, password string) error {
|
||||
// Stop if running (ignore error if not running)
|
||||
if e.IsRunning() {
|
||||
if err := e.Stop(); err != nil {
|
||||
log.Warnf("error stopping engine during restart: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Increment restart counter
|
||||
e.mu.Lock()
|
||||
e.restartCount++
|
||||
e.mu.Unlock()
|
||||
|
||||
// Start with new configuration
|
||||
return e.Start(cfg, configPath, password)
|
||||
}
|
||||
|
||||
// Status returns the current status of the embedded engine.
|
||||
// The returned status is compatible with desktopctl.Status for UI integration.
|
||||
func (e *EmbeddedEngine) Status() desktopctl.Status {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
|
||||
status := desktopctl.Status{
|
||||
Running: e.running,
|
||||
Managed: true, // Embedded engine is always managed by the tray
|
||||
Port: e.port,
|
||||
ConfigPath: e.configPath,
|
||||
StartedAt: e.startedAt,
|
||||
}
|
||||
|
||||
if e.running && e.port > 0 {
|
||||
status.BaseURL = fmt.Sprintf("http://127.0.0.1:%d", e.port)
|
||||
}
|
||||
|
||||
if e.lastError != nil {
|
||||
status.LastError = e.lastError.Error()
|
||||
}
|
||||
|
||||
return status
|
||||
}
|
||||
|
||||
// IsRunning returns whether the engine is currently running.
|
||||
func (e *EmbeddedEngine) IsRunning() bool {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
return e.running
|
||||
}
|
||||
|
||||
// LastError returns the most recent error encountered, or nil if none.
|
||||
func (e *EmbeddedEngine) LastError() error {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
return e.lastError
|
||||
}
|
||||
|
||||
// Port returns the port number the engine is configured to listen on.
|
||||
func (e *EmbeddedEngine) Port() int {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
return e.port
|
||||
}
|
||||
|
||||
// PanicCount returns the number of panics that have been recovered.
|
||||
func (e *EmbeddedEngine) PanicCount() int {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
return e.panicCount
|
||||
}
|
||||
|
||||
// RestartCount returns the number of times the engine has been restarted.
|
||||
func (e *EmbeddedEngine) RestartCount() int {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
return e.restartCount
|
||||
}
|
||||
|
||||
// Uptime returns the duration the engine has been running, or 0 if not running.
|
||||
func (e *EmbeddedEngine) Uptime() time.Duration {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
if !e.running || e.startedAt.IsZero() {
|
||||
return 0
|
||||
}
|
||||
return time.Since(e.startedAt)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//go:build !windows
|
||||
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("proxypilot-tray is currently supported on Windows only.")
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"FixedFileInfo": {
|
||||
"FileVersion": {
|
||||
"Major": 0,
|
||||
"Minor": 3,
|
||||
"Patch": 0,
|
||||
"Build": 0
|
||||
},
|
||||
"ProductVersion": {
|
||||
"Major": 0,
|
||||
"Minor": 3,
|
||||
"Patch": 0,
|
||||
"Build": 0
|
||||
},
|
||||
"FileFlagsMask": "3f",
|
||||
"FileFlags ": "00",
|
||||
"FileOS": "040004",
|
||||
"FileType": "01",
|
||||
"FileSubType": "00"
|
||||
},
|
||||
"StringFileInfo": {
|
||||
"Comments": "Local AI Proxy with Embedded Engine",
|
||||
"CompanyName": "ProxyPilot",
|
||||
"FileDescription": "ProxyPilot - Single Binary Desktop App",
|
||||
"FileVersion": "0.3.0",
|
||||
"InternalName": "ProxyPilot",
|
||||
"LegalCopyright": "MIT License",
|
||||
"OriginalFilename": "ProxyPilot.exe",
|
||||
"ProductName": "ProxyPilot",
|
||||
"ProductVersion": "0.3.0"
|
||||
},
|
||||
"VarFileInfo": {
|
||||
"Translation": {
|
||||
"LangID": "0409",
|
||||
"CharsetID": "04B0"
|
||||
}
|
||||
},
|
||||
"IconPath": "../../static/icon.ico",
|
||||
"ManifestPath": ""
|
||||
}
|
||||
@@ -0,0 +1,479 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"bytes"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/trayicon"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var (
|
||||
outDir string
|
||||
repoDir string
|
||||
)
|
||||
flag.StringVar(&repoDir, "repo", "", "Repository root (defaults to current directory)")
|
||||
flag.StringVar(&outDir, "out", "", "Output directory (defaults to <repo>/dist)")
|
||||
flag.Parse()
|
||||
|
||||
args := flag.Args()
|
||||
if len(args) == 0 {
|
||||
die("usage: proxypilotpack <build|package-zip|package-setup|package-inno> [--repo <path>] [--out <path>]")
|
||||
}
|
||||
cmd := strings.ToLower(strings.TrimSpace(args[0]))
|
||||
|
||||
repoRoot, err := resolveRepoRoot(repoDir)
|
||||
if err != nil {
|
||||
die(err.Error())
|
||||
}
|
||||
distRoot := outDir
|
||||
if strings.TrimSpace(distRoot) == "" {
|
||||
distRoot = filepath.Join(repoRoot, "dist")
|
||||
}
|
||||
binRoot := filepath.Join(repoRoot, "bin")
|
||||
if err := os.MkdirAll(binRoot, 0o755); err != nil {
|
||||
die(err.Error())
|
||||
}
|
||||
if err := os.MkdirAll(distRoot, 0o755); err != nil {
|
||||
die(err.Error())
|
||||
}
|
||||
|
||||
switch cmd {
|
||||
case "build":
|
||||
if err := buildBinaries(repoRoot, binRoot); err != nil {
|
||||
die(err.Error())
|
||||
}
|
||||
case "package-zip":
|
||||
if err := buildBinaries(repoRoot, binRoot); err != nil {
|
||||
die(err.Error())
|
||||
}
|
||||
if err := packageZip(repoRoot, binRoot, distRoot); err != nil {
|
||||
die(err.Error())
|
||||
}
|
||||
case "package-setup":
|
||||
// Alias to the recommended Windows installer.
|
||||
if runtime.GOOS != "windows" {
|
||||
die("package-setup is only supported on Windows")
|
||||
}
|
||||
if err := buildBinaries(repoRoot, binRoot); err != nil {
|
||||
die(err.Error())
|
||||
}
|
||||
if err := packageInno(repoRoot, distRoot); err != nil {
|
||||
die(err.Error())
|
||||
}
|
||||
case "package-inno":
|
||||
if runtime.GOOS != "windows" {
|
||||
die("package-inno is only supported on Windows")
|
||||
}
|
||||
if err := buildBinaries(repoRoot, binRoot); err != nil {
|
||||
die(err.Error())
|
||||
}
|
||||
if err := packageInno(repoRoot, distRoot); err != nil {
|
||||
die(err.Error())
|
||||
}
|
||||
case "package-iexpress":
|
||||
if runtime.GOOS != "windows" {
|
||||
die("package-iexpress is only supported on Windows")
|
||||
}
|
||||
if err := buildBinaries(repoRoot, binRoot); err != nil {
|
||||
die(err.Error())
|
||||
}
|
||||
if err := packageSetup(repoRoot, binRoot, distRoot); err != nil {
|
||||
die(err.Error())
|
||||
}
|
||||
default:
|
||||
die(fmt.Sprintf("unknown command: %s", cmd))
|
||||
}
|
||||
}
|
||||
|
||||
func resolveRepoRoot(repoDir string) (string, error) {
|
||||
root := strings.TrimSpace(repoDir)
|
||||
if root == "" {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
root = wd
|
||||
}
|
||||
root, err := filepath.Abs(root)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
// Very small validation: go.mod should exist.
|
||||
if _, err := os.Stat(filepath.Join(root, "go.mod")); err != nil {
|
||||
return "", fmt.Errorf("not a repo root (missing go.mod): %s", root)
|
||||
}
|
||||
return root, nil
|
||||
}
|
||||
|
||||
func buildBinaries(repoRoot, binRoot string) error {
|
||||
proxyExe := filepath.Join(binRoot, "proxypilot-engine.exe")
|
||||
if runtime.GOOS != "windows" {
|
||||
proxyExe = filepath.Join(binRoot, "proxypilot-engine")
|
||||
}
|
||||
trayExe := filepath.Join(binRoot, "ProxyPilot.exe")
|
||||
if runtime.GOOS != "windows" {
|
||||
trayExe = filepath.Join(binRoot, "ProxyPilot")
|
||||
}
|
||||
|
||||
if err := run(repoRoot, "go", "build", "-o", proxyExe, "./cmd/server"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
if err := run(repoRoot, "go", "build", "-ldflags", "-H=windowsgui", "-o", trayExe, "./cmd/proxypilot-tray"); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := run(repoRoot, "go", "build", "-o", trayExe, "./cmd/proxypilot-tray"); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
ico := trayicon.ProxyPilotICO()
|
||||
if len(ico) > 0 {
|
||||
_ = os.WriteFile(filepath.Join(binRoot, "ProxyPilot.ico"), ico, 0o644)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func packageZip(repoRoot, binRoot, distRoot string) error {
|
||||
outZip := filepath.Join(distRoot, "ProxyPilot.zip")
|
||||
_ = os.Remove(outZip)
|
||||
|
||||
files := []struct {
|
||||
src string
|
||||
dst string
|
||||
}{
|
||||
{src: filepath.Join(binRoot, "ProxyPilot.exe"), dst: "ProxyPilot.exe"},
|
||||
{src: filepath.Join(binRoot, "ProxyPilot.ico"), dst: "ProxyPilot.ico"},
|
||||
{src: filepath.Join(binRoot, "proxypilot-engine.exe"), dst: "proxypilot-engine.exe"},
|
||||
// Back-compat: keep a copy under the legacy name for older launchers/scripts.
|
||||
{src: filepath.Join(binRoot, "proxypilot-engine.exe"), dst: "cliproxyapi-latest.exe"},
|
||||
}
|
||||
cfg := filepath.Join(repoRoot, "config.example.yaml")
|
||||
if _, err := os.Stat(cfg); err == nil {
|
||||
files = append(files, struct {
|
||||
src string
|
||||
dst string
|
||||
}{src: cfg, dst: "config.example.yaml"})
|
||||
}
|
||||
|
||||
f, err := os.Create(outZip)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
zw := zip.NewWriter(f)
|
||||
for _, it := range files {
|
||||
b, err := os.ReadFile(it.src)
|
||||
if err != nil {
|
||||
return fmt.Errorf("missing %s (build first): %w", it.src, err)
|
||||
}
|
||||
w, err := zw.Create(it.dst)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := io.Copy(w, bytes.NewReader(b)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := zw.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func packageSetup(repoRoot, binRoot, distRoot string) error {
|
||||
iexpress := filepath.Join(os.Getenv("WINDIR"), "System32", "iexpress.exe")
|
||||
if _, err := os.Stat(iexpress); err != nil {
|
||||
return fmt.Errorf("IExpress not found at %s (use package-zip instead)", iexpress)
|
||||
}
|
||||
|
||||
staging := filepath.Join(distRoot, "ProxyPilot-Staging")
|
||||
_ = os.RemoveAll(staging)
|
||||
if err := os.MkdirAll(staging, 0o755); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Payload files
|
||||
mgrExe := filepath.Join(binRoot, "ProxyPilot.exe")
|
||||
srvExe := filepath.Join(binRoot, "proxypilot-engine.exe")
|
||||
if err := copyFile(mgrExe, filepath.Join(staging, "ProxyPilot.exe")); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := copyFile(srvExe, filepath.Join(staging, "proxypilot-engine.exe")); err != nil {
|
||||
return err
|
||||
}
|
||||
_ = copyFile(srvExe, filepath.Join(staging, "cliproxyapi-latest.exe"))
|
||||
cfgSrc := filepath.Join(repoRoot, "config.example.yaml")
|
||||
if _, err := os.Stat(cfgSrc); err == nil {
|
||||
if err := copyFile(cfgSrc, filepath.Join(staging, "config.example.yaml")); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
installCmd := filepath.Join(staging, "install.cmd")
|
||||
installBody := "" +
|
||||
"@echo off\r\n" +
|
||||
"setlocal\r\n" +
|
||||
"set \"SRC=%~dp0\"\r\n" +
|
||||
"set \"DEST=%LOCALAPPDATA%\\ProxyPilot\"\r\n" +
|
||||
"if not exist \"%DEST%\" mkdir \"%DEST%\" >nul 2>&1\r\n" +
|
||||
"copy /Y \"%SRC%ProxyPilot.exe\" \"%DEST%\\ProxyPilot.exe\" >nul\r\n" +
|
||||
"copy /Y \"%SRC%proxypilot-engine.exe\" \"%DEST%\\proxypilot-engine.exe\" >nul\r\n" +
|
||||
"copy /Y \"%SRC%proxypilot-engine.exe\" \"%DEST%\\cliproxyapi-latest.exe\" >nul\r\n" +
|
||||
"if exist \"%SRC%config.example.yaml\" copy /Y \"%SRC%config.example.yaml\" \"%DEST%\\config.example.yaml\" >nul\r\n" +
|
||||
"if not exist \"%DEST%\\config.yaml\" if exist \"%DEST%\\config.example.yaml\" copy /Y \"%DEST%\\config.example.yaml\" \"%DEST%\\config.yaml\" >nul\r\n" +
|
||||
"\r\n" +
|
||||
"REM Create Start Menu + Desktop shortcuts\r\n" +
|
||||
"powershell -NoProfile -ExecutionPolicy Bypass -Command \"$dest=Join-Path $env:LOCALAPPDATA 'ProxyPilot'; $sm=Join-Path $env:APPDATA 'Microsoft\\\\Windows\\\\Start Menu\\\\Programs\\\\ProxyPilot'; New-Item -ItemType Directory -Force -Path $sm | Out-Null; $ws=New-Object -ComObject WScript.Shell; $lnk=$ws.CreateShortcut((Join-Path $sm 'ProxyPilot.lnk')); $lnk.TargetPath=(Join-Path $dest 'ProxyPilot.exe'); $lnk.WorkingDirectory=$dest; $lnk.IconLocation=$lnk.TargetPath+',0'; $lnk.Save(); $desk=[Environment]::GetFolderPath('Desktop'); $dlnk=$ws.CreateShortcut((Join-Path $desk 'ProxyPilot.lnk')); $dlnk.TargetPath=(Join-Path $dest 'ProxyPilot.exe'); $dlnk.WorkingDirectory=$dest; $dlnk.IconLocation=$dlnk.TargetPath+',0'; $dlnk.Save()\" >nul 2>&1\r\n" +
|
||||
"\r\n" +
|
||||
"start \"\" \"%DEST%\\ProxyPilot.exe\"\r\n"
|
||||
if err := os.WriteFile(installCmd, []byte(installBody), 0o644); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
outExe := filepath.Join(distRoot, "ProxyPilot-Setup.exe")
|
||||
if err := os.Remove(outExe); err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
// If the target is locked (common if the user just ran the installer), build to a unique name instead.
|
||||
ext := filepath.Ext(outExe)
|
||||
base := strings.TrimSuffix(filepath.Base(outExe), ext)
|
||||
outExe = filepath.Join(distRoot, fmt.Sprintf("%s-%s%s", base, time.Now().Format("20060102-150405"), ext))
|
||||
}
|
||||
|
||||
sedPath := filepath.Join(staging, "package.sed")
|
||||
sed, err := buildIExpressSed(staging, outExe)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// If config.example.yaml is absent, omit it to avoid IExpress build failure.
|
||||
if _, err := os.Stat(filepath.Join(staging, "config.example.yaml")); errors.Is(err, os.ErrNotExist) {
|
||||
sed = strings.ReplaceAll(sed, "%FILE2%=config.example.yaml\r\n", "")
|
||||
sed = strings.ReplaceAll(sed, "FILE2=config.example.yaml\r\n", "")
|
||||
}
|
||||
if err := os.WriteFile(sedPath, []byte(sed), 0o644); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := run(repoRoot, iexpress, "/n", "/q", sedPath); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := os.Stat(outExe); err != nil {
|
||||
return fmt.Errorf("installer build failed; expected: %s", outExe)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func buildIExpressSed(staging string, outExe string) (string, error) {
|
||||
stagingAbs, err := filepath.Abs(staging)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
outAbs, err := filepath.Abs(outExe)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
// IExpress SED wants backslashes escaped.
|
||||
stagingEsc := strings.ReplaceAll(stagingAbs, `\`, `\\`)
|
||||
outEsc := strings.ReplaceAll(outAbs, `\`, `\\`)
|
||||
|
||||
return fmt.Sprintf(`[Version]
|
||||
Class=IExpress
|
||||
SEDVersion=3
|
||||
[Options]
|
||||
PackagePurpose=InstallApp
|
||||
ShowInstallProgramWindow=0
|
||||
HideExtractAnimation=1
|
||||
UseLongFileName=1
|
||||
InsideCompressed=0
|
||||
CAB_FixedSize=0
|
||||
CAB_ResvCodeSigning=0
|
||||
RebootMode=N
|
||||
InstallPrompt=
|
||||
DisplayLicense=
|
||||
FinishMessage=
|
||||
TargetName=%s
|
||||
FriendlyName=ProxyPilot
|
||||
AppLaunched=cmd.exe /c install.cmd
|
||||
PostInstallCmd=<None>
|
||||
AdminQuietInstCmd=
|
||||
UserQuietInstCmd=
|
||||
SourceFiles=SourceFiles
|
||||
[SourceFiles]
|
||||
SourceFiles0=%s
|
||||
[SourceFiles0]
|
||||
%%FILE0%%=ProxyPilot.exe
|
||||
%%FILE1%%=proxypilot-engine.exe
|
||||
%%FILE2%%=config.example.yaml
|
||||
%%FILE3%%=install.cmd
|
||||
[Strings]
|
||||
FILE0=ProxyPilot.exe
|
||||
FILE1=proxypilot-engine.exe
|
||||
FILE2=config.example.yaml
|
||||
FILE3=install.cmd
|
||||
`, outEsc, stagingEsc), nil
|
||||
}
|
||||
|
||||
func packageInno(repoRoot, distRoot string) error {
|
||||
iscc, err := findISCC()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
iss := filepath.Join(repoRoot, "installer", "proxypilot.iss")
|
||||
if _, err := os.Stat(iss); err != nil {
|
||||
return fmt.Errorf("missing inno script: %s", iss)
|
||||
}
|
||||
|
||||
appVersion := resolveAppVersion(repoRoot)
|
||||
repoAbs, _ := filepath.Abs(repoRoot)
|
||||
outAbs, _ := filepath.Abs(distRoot)
|
||||
|
||||
args := []string{
|
||||
"/Q",
|
||||
"/DAppVersion=" + appVersion,
|
||||
"/DRepoRoot=" + repoAbs,
|
||||
"/DOutDir=" + outAbs,
|
||||
iss,
|
||||
}
|
||||
return run(repoRoot, iscc, args...)
|
||||
}
|
||||
|
||||
func findISCC() (string, error) {
|
||||
if p, err := exec.LookPath("ISCC.exe"); err == nil && strings.TrimSpace(p) != "" {
|
||||
return p, nil
|
||||
}
|
||||
if p, err := exec.LookPath("ISCC"); err == nil && strings.TrimSpace(p) != "" {
|
||||
return p, nil
|
||||
}
|
||||
candidates := []string{
|
||||
filepath.Join(os.Getenv("ProgramFiles(x86)"), "Inno Setup 6", "ISCC.exe"),
|
||||
filepath.Join(os.Getenv("ProgramFiles"), "Inno Setup 6", "ISCC.exe"),
|
||||
filepath.Join(os.Getenv("LOCALAPPDATA"), "Programs", "Inno Setup 6", "ISCC.exe"),
|
||||
}
|
||||
if reg := findInnoInstallLocationFromRegistry(); reg != "" {
|
||||
candidates = append(candidates, filepath.Join(reg, "ISCC.exe"))
|
||||
}
|
||||
for _, c := range candidates {
|
||||
if strings.TrimSpace(c) == "" {
|
||||
continue
|
||||
}
|
||||
if _, err := os.Stat(c); err == nil {
|
||||
return c, nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("Inno Setup compiler (ISCC.exe) not found; install Inno Setup 6 or add ISCC.exe to PATH")
|
||||
}
|
||||
|
||||
func findInnoInstallLocationFromRegistry() string {
|
||||
if runtime.GOOS != "windows" {
|
||||
return ""
|
||||
}
|
||||
// Query uninstall entries for "Inno Setup" and read InstallLocation.
|
||||
out, err := exec.Command("reg", "query", `HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall`, "/s", "/v", "InstallLocation").Output()
|
||||
if err == nil {
|
||||
if loc := parseRegInstallLocation(string(out)); loc != "" {
|
||||
return loc
|
||||
}
|
||||
}
|
||||
out, err = exec.Command("reg", "query", `HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall`, "/s", "/v", "InstallLocation").Output()
|
||||
if err == nil {
|
||||
if loc := parseRegInstallLocation(string(out)); loc != "" {
|
||||
return loc
|
||||
}
|
||||
}
|
||||
out, err = exec.Command("reg", "query", `HKLM\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall`, "/s", "/v", "InstallLocation").Output()
|
||||
if err == nil {
|
||||
if loc := parseRegInstallLocation(string(out)); loc != "" {
|
||||
return loc
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func parseRegInstallLocation(out string) string {
|
||||
// reg.exe output lines look like:
|
||||
// InstallLocation REG_SZ C:\Users\...\Inno Setup 6\
|
||||
lines := strings.Split(out, "\n")
|
||||
for _, line := range lines {
|
||||
line = strings.TrimSpace(line)
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
if !strings.HasPrefix(strings.ToLower(line), "installlocation") {
|
||||
continue
|
||||
}
|
||||
fields := strings.Fields(line)
|
||||
if len(fields) < 3 {
|
||||
continue
|
||||
}
|
||||
loc := strings.TrimSpace(strings.Join(fields[2:], " "))
|
||||
loc = strings.Trim(loc, `"`)
|
||||
loc = strings.TrimSpace(loc)
|
||||
if loc == "" {
|
||||
continue
|
||||
}
|
||||
if _, err := os.Stat(loc); err == nil {
|
||||
return strings.TrimRight(loc, `\`)
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func resolveAppVersion(repoRoot string) string {
|
||||
// Prefer git sha if available. Keep it short and filesystem-safe.
|
||||
out, err := exec.Command("git", "-C", repoRoot, "rev-parse", "--short", "HEAD").Output()
|
||||
if err == nil {
|
||||
sha := strings.TrimSpace(string(out))
|
||||
if sha != "" {
|
||||
return "dev-" + sha
|
||||
}
|
||||
}
|
||||
return "dev-" + time.Now().Format("20060102-150405")
|
||||
}
|
||||
|
||||
func run(dir string, name string, args ...string) error {
|
||||
c := exec.Command(name, args...)
|
||||
c.Dir = dir
|
||||
c.Stdout = os.Stdout
|
||||
c.Stderr = os.Stderr
|
||||
return c.Run()
|
||||
}
|
||||
|
||||
func copyFile(src, dst string) error {
|
||||
in, err := os.Open(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() { _ = in.Close() }()
|
||||
if err := os.MkdirAll(filepath.Dir(dst), 0o755); err != nil {
|
||||
return err
|
||||
}
|
||||
out, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() { _ = out.Close() }()
|
||||
if _, err := io.Copy(out, in); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func die(msg string) {
|
||||
_, _ = fmt.Fprintln(os.Stderr, msg)
|
||||
os.Exit(2)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package assets
|
||||
|
||||
import "embed"
|
||||
|
||||
//go:embed index.html vite.svg logo.png assets/*
|
||||
var FS embed.FS
|
||||
@@ -0,0 +1,20 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="pp-mgmt-key" content="test123" />
|
||||
<title>ProxyPilot</title>
|
||||
<!-- Google Fonts preconnect for performance -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<!-- Google Fonts: Space Grotesk (display/headers), JetBrains Mono (code), IBM Plex Sans (body) -->
|
||||
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<script type="module" crossorigin src="/assets/index.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 194 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -1,4 +1,4 @@
|
||||
// Package main provides the entry point for the CLI Proxy API server.
|
||||
// Package main provides the entry point for the ProxyPilot engine.
|
||||
// This server acts as a proxy that provides OpenAI/Gemini/Claude compatible API interfaces
|
||||
// for CLI models, allowing CLI models to be used with tools and libraries designed for standard AI APIs.
|
||||
package main
|
||||
@@ -21,10 +21,12 @@ import (
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/buildinfo"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/cmd"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/config"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/desktopctl"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/logging"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/managementasset"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/misc"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/registry"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/startupconfig"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/store"
|
||||
_ "github.com/router-for-me/CLIProxyAPI/v6/internal/translator"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/tui"
|
||||
@@ -50,11 +52,24 @@ func init() {
|
||||
buildinfo.BuildDate = BuildDate
|
||||
}
|
||||
|
||||
// setKiroIncognitoMode sets the incognito browser mode for Kiro authentication.
|
||||
// Kiro defaults to incognito mode for multi-account support.
|
||||
// Users can explicitly override with --incognito or --no-incognito flags.
|
||||
func setKiroIncognitoMode(cfg *config.Config, useIncognito, noIncognito bool) {
|
||||
if useIncognito {
|
||||
cfg.IncognitoBrowser = true
|
||||
} else if noIncognito {
|
||||
cfg.IncognitoBrowser = false
|
||||
} else {
|
||||
cfg.IncognitoBrowser = true // Kiro default
|
||||
}
|
||||
}
|
||||
|
||||
// main is the entry point of the application.
|
||||
// It parses command-line flags, loads configuration, and starts the appropriate
|
||||
// service based on the provided flags (login, codex-login, or server mode).
|
||||
func main() {
|
||||
fmt.Printf("CLIProxyAPI Version: %s, Commit: %s, BuiltAt: %s\n", buildinfo.Version, buildinfo.Commit, buildinfo.BuildDate)
|
||||
fmt.Printf("ProxyPilot Engine Version: %s, Commit: %s, BuiltAt: %s\n", buildinfo.Version, buildinfo.Commit, buildinfo.BuildDate)
|
||||
|
||||
// Command-line flags to control the application's behavior.
|
||||
var login bool
|
||||
@@ -67,13 +82,65 @@ func main() {
|
||||
var noBrowser bool
|
||||
var oauthCallbackPort int
|
||||
var antigravityLogin bool
|
||||
var kiroLogin bool
|
||||
var kiroGoogleLogin bool
|
||||
var kiroAWSLogin bool
|
||||
var kiroAWSAuthCode bool
|
||||
var kiroImport bool
|
||||
var antigravityImport bool
|
||||
var minimaxLogin bool
|
||||
var zhipuLogin bool
|
||||
var kimiLogin bool
|
||||
// var githubCopilotLogin bool // REMOVED - GitHub Copilot excluded
|
||||
var detectAgents bool
|
||||
var setupClaude bool
|
||||
var setupCodex bool
|
||||
var setupDroid bool
|
||||
var setupOpenCode bool
|
||||
var setupGemini bool
|
||||
var setupCursor bool
|
||||
var setupKilo bool
|
||||
var setupRooCode bool
|
||||
var setupAll bool
|
||||
var switchAgent string
|
||||
var switchMode string
|
||||
var projectID string
|
||||
var vertexImport string
|
||||
var vertexImportPrefix string
|
||||
var configPath string
|
||||
var password string
|
||||
var tuiMode bool
|
||||
var noIncognito bool
|
||||
var useIncognito bool
|
||||
|
||||
// Account management flags
|
||||
var showVersion bool
|
||||
var showStatus bool
|
||||
var listAccounts bool
|
||||
var cleanupExpired bool
|
||||
var removeAccount string
|
||||
var refreshTokens string
|
||||
var jsonOutput bool
|
||||
var quietMode bool
|
||||
var verboseMode bool
|
||||
|
||||
// Usage and logs flags
|
||||
var showUsage bool
|
||||
var showLogs bool
|
||||
var logLines int
|
||||
|
||||
// Model and export flags
|
||||
var listModels bool
|
||||
var exportAccounts string
|
||||
var importAccounts string
|
||||
var includeTokens bool
|
||||
var forceImport bool
|
||||
|
||||
// Windows service flags
|
||||
var runAsService bool
|
||||
var serviceCmd string
|
||||
|
||||
// TUI flag
|
||||
var launchTUI bool
|
||||
var standalone bool
|
||||
var localModel bool
|
||||
|
||||
@@ -86,18 +153,64 @@ func main() {
|
||||
flag.BoolVar(&iflowLogin, "iflow-login", false, "Login to iFlow using OAuth")
|
||||
flag.BoolVar(&iflowCookie, "iflow-cookie", false, "Login to iFlow using Cookie")
|
||||
flag.BoolVar(&noBrowser, "no-browser", false, "Don't open browser automatically for OAuth")
|
||||
flag.BoolVar(&useIncognito, "incognito", false, "Open browser in incognito/private mode for OAuth (useful for multiple accounts)")
|
||||
flag.BoolVar(&noIncognito, "no-incognito", false, "Force disable incognito mode (uses existing browser session)")
|
||||
flag.IntVar(&oauthCallbackPort, "oauth-callback-port", 0, "Override OAuth callback port (defaults to provider-specific port)")
|
||||
flag.BoolVar(&antigravityLogin, "antigravity-login", false, "Login to Antigravity using OAuth")
|
||||
flag.BoolVar(&kiroLogin, "kiro-login", false, "Login to Kiro using Google OAuth")
|
||||
flag.BoolVar(&kiroGoogleLogin, "kiro-google-login", false, "Login to Kiro using Google OAuth (same as --kiro-login)")
|
||||
flag.BoolVar(&kiroAWSLogin, "kiro-aws-login", false, "Login to Kiro using AWS Builder ID (device code flow)")
|
||||
flag.BoolVar(&kiroAWSAuthCode, "kiro-aws-authcode", false, "Login to Kiro using AWS Builder ID (authorization code flow, better UX)")
|
||||
flag.BoolVar(&kiroImport, "kiro-import", false, "Import Kiro token from Kiro IDE (~/.aws/sso/cache/kiro-auth-token.json)")
|
||||
flag.BoolVar(&antigravityImport, "antigravity-import", false, "Import Antigravity token from Antigravity IDE")
|
||||
flag.BoolVar(&minimaxLogin, "minimax-login", false, "Add MiniMax API key")
|
||||
flag.BoolVar(&zhipuLogin, "zhipu-login", false, "Add Zhipu AI API key")
|
||||
flag.BoolVar(&kimiLogin, "kimi-login", false, "Login to Kimi using OAuth")
|
||||
// GitHub Copilot login removed
|
||||
flag.BoolVar(&detectAgents, "detect-agents", false, "Detect installed CLI agents")
|
||||
flag.BoolVar(&setupClaude, "setup-claude", false, "Configure Claude Code to use ProxyPilot")
|
||||
flag.BoolVar(&setupCodex, "setup-codex", false, "Configure Codex CLI to use ProxyPilot")
|
||||
flag.BoolVar(&setupDroid, "setup-droid", false, "Configure Factory Droid to use ProxyPilot")
|
||||
flag.BoolVar(&setupOpenCode, "setup-opencode", false, "Configure OpenCode to use ProxyPilot")
|
||||
flag.BoolVar(&setupGemini, "setup-gemini", false, "Configure Gemini CLI to use ProxyPilot")
|
||||
flag.BoolVar(&setupCursor, "setup-cursor", false, "Configure Cursor to use ProxyPilot")
|
||||
flag.BoolVar(&setupKilo, "setup-kilo", false, "Configure Kilo Code CLI to use ProxyPilot")
|
||||
flag.BoolVar(&setupRooCode, "setup-roocode", false, "Configure RooCode (VS Code) to use ProxyPilot")
|
||||
flag.BoolVar(&setupAll, "setup-all", false, "Configure all detected CLI agents (with backup)")
|
||||
flag.StringVar(&switchAgent, "switch", "", "Switch agent config mode (e.g., --switch claude)")
|
||||
flag.StringVar(&switchMode, "mode", "", "Switch mode: proxy, native, or status (default: status)")
|
||||
flag.StringVar(&projectID, "project_id", "", "Project ID (Gemini only, not required)")
|
||||
flag.StringVar(&configPath, "config", DefaultConfigPath, "Configure File Path")
|
||||
flag.StringVar(&vertexImport, "vertex-import", "", "Import Vertex service account key JSON file")
|
||||
flag.StringVar(&vertexImportPrefix, "vertex-import-prefix", "", "Prefix for Vertex model namespacing (use with -vertex-import)")
|
||||
flag.StringVar(&password, "password", "", "")
|
||||
flag.BoolVar(&tuiMode, "tui", false, "Start with terminal management UI")
|
||||
flag.BoolVar(&launchTUI, "tui", false, "Start with terminal management UI")
|
||||
flag.BoolVar(&standalone, "standalone", false, "In TUI mode, start an embedded local server")
|
||||
flag.BoolVar(&localModel, "local-model", false, "Use embedded model catalog only, skip remote model fetching")
|
||||
|
||||
flag.BoolVar(&showVersion, "version", false, "Show ProxyPilot version and exit")
|
||||
flag.BoolVar(&showStatus, "status", false, "Show ProxyPilot status and exit")
|
||||
flag.BoolVar(&listAccounts, "list-accounts", false, "List all configured accounts and exit")
|
||||
flag.BoolVar(&cleanupExpired, "cleanup-expired", false, "Remove expired tokens and exit")
|
||||
flag.StringVar(&removeAccount, "remove-account", "", "Remove a specific account by name and exit")
|
||||
flag.StringVar(&refreshTokens, "refresh", "", "Force token refresh (all, or email/id to refresh specific)")
|
||||
flag.BoolVar(&jsonOutput, "json", false, "Output in JSON format (overrides --quiet)")
|
||||
flag.BoolVar(&quietMode, "quiet", false, "Run in quiet mode (overrides --verbose)")
|
||||
flag.BoolVar(&verboseMode, "verbose", false, "Run in verbose mode")
|
||||
|
||||
flag.BoolVar(&listModels, "list-models", false, "List available models per provider and exit")
|
||||
flag.StringVar(&exportAccounts, "export-accounts", "", "Export accounts to JSON file (use - for stdout)")
|
||||
flag.StringVar(&importAccounts, "import-accounts", "", "Import accounts from JSON file")
|
||||
flag.BoolVar(&includeTokens, "include-tokens", false, "Include sensitive tokens in export (use with -export-accounts)")
|
||||
flag.BoolVar(&forceImport, "force", false, "Force overwrite existing accounts on import")
|
||||
flag.BoolVar(&showUsage, "usage", false, "Show token usage statistics and exit")
|
||||
flag.BoolVar(&showLogs, "logs", false, "View recent proxy logs and exit")
|
||||
flag.IntVar(&logLines, "n", 50, "Number of log lines to show (used with -logs)")
|
||||
|
||||
// Windows service flags
|
||||
flag.BoolVar(&runAsService, "service", false, "Run as Windows service (internal)")
|
||||
flag.StringVar(&serviceCmd, "service-cmd", "", "Service command: install, uninstall, start, stop, status")
|
||||
|
||||
flag.CommandLine.Usage = func() {
|
||||
out := flag.CommandLine.Output()
|
||||
_, _ = fmt.Fprintf(out, "Usage of %s\n", os.Args[0])
|
||||
@@ -125,9 +238,66 @@ func main() {
|
||||
})
|
||||
}
|
||||
|
||||
// Check for subcommand-style switch command before flag.Parse()
|
||||
// Supports: proxypilot switch [agent] [mode]
|
||||
// agent can be: claude, gemini, codex, opencode, droid, cursor
|
||||
// mode can be: proxy, native, status (default if omitted)
|
||||
var subcommandSwitch bool
|
||||
args := os.Args[1:]
|
||||
if len(args) > 0 && args[0] == "switch" {
|
||||
subcommandSwitch = true
|
||||
switchArgs := args[1:]
|
||||
// Filter out any flags like --status from positional args
|
||||
var positionalArgs []string
|
||||
for _, arg := range switchArgs {
|
||||
if arg == "--status" {
|
||||
switchMode = "status"
|
||||
} else if !strings.HasPrefix(arg, "-") {
|
||||
positionalArgs = append(positionalArgs, arg)
|
||||
}
|
||||
}
|
||||
// Parse positional arguments: [agent] [mode]
|
||||
if len(positionalArgs) >= 1 {
|
||||
switchAgent = positionalArgs[0]
|
||||
}
|
||||
if len(positionalArgs) >= 2 {
|
||||
switchMode = positionalArgs[1]
|
||||
}
|
||||
// Default mode to "status" if not specified
|
||||
if switchMode == "" {
|
||||
switchMode = "status"
|
||||
}
|
||||
}
|
||||
|
||||
// Pre-process -refresh flag: if -refresh is present without a value, treat as -refresh=all
|
||||
for i, arg := range os.Args[1:] {
|
||||
if arg == "-refresh" || arg == "--refresh" {
|
||||
// Check if next arg exists and is not another flag
|
||||
nextIdx := i + 2 // +1 for 1-based slice, +1 for next
|
||||
if nextIdx >= len(os.Args) || strings.HasPrefix(os.Args[nextIdx], "-") {
|
||||
os.Args[i+1] = "-refresh=all"
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Parse the command-line flags.
|
||||
flag.Parse()
|
||||
|
||||
// Handle Windows service commands early (before config loading)
|
||||
if serviceCmd != "" {
|
||||
if handleServiceCommand([]string{serviceCmd, configPath}) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if runAsService {
|
||||
if err := runService(configPath); err != nil {
|
||||
log.Errorf("service error: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Core application variables.
|
||||
var err error
|
||||
var cfg *config.Config
|
||||
@@ -387,17 +557,28 @@ func main() {
|
||||
configFilePath = configPath
|
||||
cfg, err = config.LoadConfigOptional(configPath, isCloudDeploy)
|
||||
} else {
|
||||
wd, err = os.Getwd()
|
||||
if err != nil {
|
||||
log.Errorf("failed to get working directory: %v", err)
|
||||
return
|
||||
exePath, errExe := os.Executable()
|
||||
if errExe != nil {
|
||||
log.WithError(errExe).Debug("failed to resolve executable path for default config lookup")
|
||||
}
|
||||
configFilePath = filepath.Join(wd, "config.yaml")
|
||||
resolution := startupconfig.ResolveConfigPath("", wd, exePath)
|
||||
if created, errPrepare := startupconfig.EnsureDefaultConfig(resolution); errPrepare != nil {
|
||||
log.Errorf("failed to prepare default config: %v", errPrepare)
|
||||
return
|
||||
} else if created {
|
||||
log.Infof("default config initialized from template: %s", resolution.ConfigPath)
|
||||
}
|
||||
configFilePath = resolution.ConfigPath
|
||||
cfg, err = config.LoadConfigOptional(configFilePath, isCloudDeploy)
|
||||
}
|
||||
if err != nil {
|
||||
log.Errorf("failed to load config: %v", err)
|
||||
return
|
||||
// For switch command and TUI, config is optional - use defaults
|
||||
if subcommandSwitch || switchAgent != "" || launchTUI {
|
||||
cfg = &config.Config{Port: 8318}
|
||||
} else {
|
||||
log.Errorf("failed to load config: %v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
if cfg == nil {
|
||||
cfg = &config.Config{}
|
||||
@@ -423,19 +604,38 @@ func main() {
|
||||
configFileExists = true
|
||||
}
|
||||
}
|
||||
|
||||
// Perform basic semantic validation of the loaded configuration.
|
||||
if warnings, errValidate := config.ValidateConfig(cfg); errValidate != nil {
|
||||
log.Errorf("invalid configuration: %v", errValidate)
|
||||
return
|
||||
} else if len(warnings) > 0 {
|
||||
for _, w := range warnings {
|
||||
log.Warnf("config warning: %s", w)
|
||||
}
|
||||
}
|
||||
|
||||
usage.SetStatisticsEnabled(cfg.UsageStatisticsEnabled)
|
||||
coreauth.SetQuotaCooldownDisabled(cfg.DisableCooling)
|
||||
// AntigravityPrimaryEmail removed - field does not exist
|
||||
|
||||
if err = logging.ConfigureLogOutput(cfg); err != nil {
|
||||
log.Errorf("failed to configure log output: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
log.Infof("CLIProxyAPI Version: %s, Commit: %s, BuiltAt: %s", buildinfo.Version, buildinfo.Commit, buildinfo.BuildDate)
|
||||
log.Infof("ProxyPilot Engine Version: %s, Commit: %s, BuiltAt: %s", buildinfo.Version, buildinfo.Commit, buildinfo.BuildDate)
|
||||
|
||||
// Set the log level based on the configuration.
|
||||
util.SetLogLevel(cfg)
|
||||
|
||||
// CLI flags override config-based log level
|
||||
if quietMode {
|
||||
logging.SetLogLevel("quiet")
|
||||
} else if verboseMode {
|
||||
logging.SetLogLevel("verbose")
|
||||
}
|
||||
|
||||
if resolvedAuthDir, errResolveAuthDir := util.ResolveAuthDir(cfg.AuthDir); errResolveAuthDir != nil {
|
||||
log.Errorf("failed to resolve auth directory: %v", errResolveAuthDir)
|
||||
return
|
||||
@@ -469,6 +669,81 @@ func main() {
|
||||
if vertexImport != "" {
|
||||
// Handle Vertex service account import
|
||||
cmd.DoVertexImport(cfg, vertexImport, vertexImportPrefix)
|
||||
} else if showVersion {
|
||||
// Version already printed at startup, just exit
|
||||
return
|
||||
} else if showStatus {
|
||||
if err := cmd.ShowStatus(jsonOutput); err != nil {
|
||||
log.Errorf("status failed: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
} else if launchTUI {
|
||||
proxyURL := fmt.Sprintf("http://127.0.0.1:%d", cfg.Port)
|
||||
mgmtKey, _ := desktopctl.GetManagementPassword()
|
||||
if err := tui.Run(proxyURL, mgmtKey); err != nil {
|
||||
log.Errorf("tui failed: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
} else if listAccounts {
|
||||
if err := cmd.ListAccounts(jsonOutput); err != nil {
|
||||
log.Errorf("list-accounts failed: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
} else if listModels {
|
||||
if err := cmd.ListModels(jsonOutput); err != nil {
|
||||
log.Errorf("list-models failed: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
} else if exportAccounts != "" {
|
||||
if err := cmd.ExportAccounts(exportAccounts, includeTokens, jsonOutput); err != nil {
|
||||
log.Errorf("export-accounts failed: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
} else if importAccounts != "" {
|
||||
if err := cmd.ImportAccounts(importAccounts, forceImport, jsonOutput); err != nil {
|
||||
log.Errorf("import-accounts failed: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
} else if cleanupExpired {
|
||||
if err := cmd.CleanupExpired(false); err != nil {
|
||||
log.Errorf("cleanup-expired failed: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
} else if removeAccount != "" {
|
||||
if err := cmd.RemoveAccount(removeAccount); err != nil {
|
||||
log.Errorf("remove-account failed: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
} else if refreshTokens != "" {
|
||||
identifier := ""
|
||||
if refreshTokens != "all" {
|
||||
identifier = refreshTokens
|
||||
}
|
||||
if err := cmd.RefreshTokens(cfg, identifier, jsonOutput); err != nil {
|
||||
log.Errorf("refresh failed: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
} else if showUsage {
|
||||
if err := cmd.ShowUsage(jsonOutput); err != nil {
|
||||
log.Errorf("usage failed: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
} else if showLogs {
|
||||
if err := cmd.ShowLogs(logLines, jsonOutput); err != nil {
|
||||
log.Errorf("logs failed: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
} else if login {
|
||||
// Handle Google/Gemini login
|
||||
cmd.DoLogin(cfg, projectID, options)
|
||||
@@ -486,12 +761,67 @@ func main() {
|
||||
cmd.DoClaudeLogin(cfg, options)
|
||||
} else if qwenLogin {
|
||||
cmd.DoQwenLogin(cfg, options)
|
||||
} else if kiroLogin {
|
||||
// For Kiro auth, default to incognito mode for multi-account support
|
||||
// Users can explicitly override with --no-incognito
|
||||
// Note: This config mutation is safe - auth commands exit after completion
|
||||
// and don't share config with StartService (which is in the else branch)
|
||||
setKiroIncognitoMode(cfg, useIncognito, noIncognito)
|
||||
cmd.DoKiroLogin(cfg, options)
|
||||
} else if kiroGoogleLogin {
|
||||
// For Kiro auth, default to incognito mode for multi-account support
|
||||
// Users can explicitly override with --no-incognito
|
||||
// Note: This config mutation is safe - auth commands exit after completion
|
||||
setKiroIncognitoMode(cfg, useIncognito, noIncognito)
|
||||
cmd.DoKiroGoogleLogin(cfg, options)
|
||||
} else if kiroAWSLogin {
|
||||
// For Kiro auth, default to incognito mode for multi-account support
|
||||
// Users can explicitly override with --no-incognito
|
||||
setKiroIncognitoMode(cfg, useIncognito, noIncognito)
|
||||
cmd.DoKiroAWSLogin(cfg, options)
|
||||
} else if kiroAWSAuthCode {
|
||||
// For Kiro auth with authorization code flow (better UX)
|
||||
setKiroIncognitoMode(cfg, useIncognito, noIncognito)
|
||||
cmd.DoKiroAWSAuthCodeLogin(cfg, options)
|
||||
} else if kiroImport {
|
||||
cmd.DoKiroImport(cfg, options)
|
||||
} else if antigravityImport {
|
||||
cmd.DoAntigravityImport(cfg)
|
||||
} else if minimaxLogin {
|
||||
cmd.DoMiniMaxLogin(cfg, options)
|
||||
} else if zhipuLogin {
|
||||
cmd.DoZhipuLogin(cfg, options)
|
||||
} else if iflowLogin {
|
||||
cmd.DoIFlowLogin(cfg, options)
|
||||
} else if iflowCookie {
|
||||
cmd.DoIFlowCookieAuth(cfg, options)
|
||||
} else if kimiLogin {
|
||||
cmd.DoKimiLogin(cfg, options)
|
||||
} else if detectAgents {
|
||||
cmd.DoDetectAgents()
|
||||
} else if setupClaude {
|
||||
cmd.DoSetupClaude(cfg)
|
||||
} else if setupCodex {
|
||||
cmd.DoSetupCodex(cfg)
|
||||
} else if setupDroid {
|
||||
cmd.DoSetupDroid(cfg)
|
||||
} else if setupOpenCode {
|
||||
cmd.DoSetupOpenCode(cfg)
|
||||
} else if setupGemini {
|
||||
cmd.DoSetupGeminiCLI(cfg)
|
||||
} else if setupCursor {
|
||||
cmd.DoSetupCursor(cfg)
|
||||
} else if setupKilo {
|
||||
cmd.DoSetupKiloCode(cfg)
|
||||
} else if setupRooCode {
|
||||
cmd.DoSetupRooCode(cfg)
|
||||
} else if setupAll {
|
||||
cmd.DoSetupAll(cfg)
|
||||
} else if subcommandSwitch || switchAgent != "" || switchMode != "" {
|
||||
// Handle switch command:
|
||||
// - Subcommand style: proxypilot switch claude proxy
|
||||
// - Flag style: proxypilot --switch claude --mode proxy
|
||||
cmd.DoSwitch(cfg, switchAgent, switchMode)
|
||||
} else {
|
||||
// In cloud deploy mode without config file, just wait for shutdown signals
|
||||
if isCloudDeploy && !configFileExists {
|
||||
@@ -499,10 +829,26 @@ func main() {
|
||||
cmd.WaitForCloudDeploy()
|
||||
return
|
||||
}
|
||||
if localModel && (!tuiMode || standalone) {
|
||||
|
||||
if localModel && (!launchTUI || standalone) {
|
||||
log.Info("Local model mode: using embedded model catalog, remote model updates disabled")
|
||||
}
|
||||
if tuiMode {
|
||||
|
||||
// Auto-generate management password if not provided.
|
||||
// This enables browser-based webui access without requiring the -password flag.
|
||||
autoGenPassword := false
|
||||
if password == "" {
|
||||
if pw, err := desktopctl.GetManagementPassword(); err == nil {
|
||||
password = pw
|
||||
autoGenPassword = true
|
||||
log.Info("using auto-generated management password for webui access")
|
||||
} else {
|
||||
log.Warnf("failed to get management password: %v (webui may require manual authentication)", err)
|
||||
}
|
||||
}
|
||||
|
||||
if launchTUI {
|
||||
proxyURL := fmt.Sprintf("http://127.0.0.1:%d", cfg.Port)
|
||||
if standalone {
|
||||
// Standalone mode: start an embedded local server and connect TUI client to it.
|
||||
managementasset.StartAutoUpdater(context.Background(), configFilePath)
|
||||
@@ -510,10 +856,6 @@ func main() {
|
||||
if !localModel {
|
||||
registry.StartModelsUpdater(context.Background())
|
||||
}
|
||||
hook := tui.NewLogHook(2000)
|
||||
hook.SetFormatter(&logging.LogFormatter{})
|
||||
log.AddHook(hook)
|
||||
|
||||
origStdout := os.Stdout
|
||||
origStderr := os.Stderr
|
||||
origLogOutput := log.StandardLogger().Out
|
||||
@@ -534,18 +876,17 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
localMgmtPassword := fmt.Sprintf("tui-%d-%d", os.Getpid(), time.Now().UnixNano())
|
||||
if password == "" {
|
||||
password = localMgmtPassword
|
||||
password = fmt.Sprintf("tui-%d-%d", os.Getpid(), time.Now().UnixNano())
|
||||
}
|
||||
|
||||
cancel, done := cmd.StartServiceBackground(cfg, configFilePath, password)
|
||||
|
||||
client := tui.NewClient(cfg.Port, password)
|
||||
client := tui.NewClient(proxyURL, password)
|
||||
ready := false
|
||||
backoff := 100 * time.Millisecond
|
||||
for i := 0; i < 30; i++ {
|
||||
if _, errGetConfig := client.GetConfig(); errGetConfig == nil {
|
||||
if _, errFetchStatus := client.FetchStatus(); errFetchStatus == nil {
|
||||
ready = true
|
||||
break
|
||||
}
|
||||
@@ -563,7 +904,7 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
if errRun := tui.Run(cfg.Port, password, hook, origStdout); errRun != nil {
|
||||
if errRun := tui.RunWithStdio(proxyURL, password, os.Stdin, origStdout); errRun != nil {
|
||||
restoreIO()
|
||||
fmt.Fprintf(os.Stderr, "TUI error: %v\n", errRun)
|
||||
} else {
|
||||
@@ -575,18 +916,21 @@ func main() {
|
||||
} else {
|
||||
// Default TUI mode: pure management client.
|
||||
// The proxy server must already be running.
|
||||
if errRun := tui.Run(cfg.Port, password, nil, os.Stdout); errRun != nil {
|
||||
if errRun := tui.Run(proxyURL, password); errRun != nil {
|
||||
fmt.Fprintf(os.Stderr, "TUI error: %v\n", errRun)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Start the main proxy service
|
||||
managementasset.StartAutoUpdater(context.Background(), configFilePath)
|
||||
misc.StartAntigravityVersionUpdater(context.Background())
|
||||
if !localModel {
|
||||
registry.StartModelsUpdater(context.Background())
|
||||
}
|
||||
cmd.StartService(cfg, configFilePath, password)
|
||||
if autoGenPassword {
|
||||
cmd.StartServiceStandalone(cfg, configFilePath, password)
|
||||
} else {
|
||||
cmd.StartService(cfg, configFilePath, password)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
//go:build !windows
|
||||
|
||||
package main
|
||||
|
||||
// Service stubs for non-Windows platforms
|
||||
|
||||
func runService(configPath string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func handleServiceCommand(args []string) bool {
|
||||
return false
|
||||
}
|
||||
@@ -0,0 +1,353 @@
|
||||
//go:build windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sys/windows/svc"
|
||||
"golang.org/x/sys/windows/svc/eventlog"
|
||||
"golang.org/x/sys/windows/svc/mgr"
|
||||
|
||||
configaccess "github.com/router-for-me/CLIProxyAPI/v6/internal/access/config_access"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/config"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/logging"
|
||||
sdkAuth "github.com/router-for-me/CLIProxyAPI/v6/sdk/auth"
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy"
|
||||
)
|
||||
|
||||
const serviceName = "ProxyPilot"
|
||||
const serviceDisplayName = "ProxyPilot API Proxy"
|
||||
const serviceDescription = "Local API proxy for AI coding tools"
|
||||
|
||||
// proxyService implements svc.Handler
|
||||
type proxyService struct {
|
||||
configPath string
|
||||
cancelFunc context.CancelFunc
|
||||
}
|
||||
|
||||
func (s *proxyService) Execute(args []string, r <-chan svc.ChangeRequest, changes chan<- svc.Status) (ssec bool, errno uint32) {
|
||||
const cmdsAccepted = svc.AcceptStop | svc.AcceptShutdown
|
||||
changes <- svc.Status{State: svc.StartPending}
|
||||
|
||||
// Initialize logging
|
||||
logging.SetupBaseLogger()
|
||||
|
||||
// Load config
|
||||
cfg, err := config.LoadConfigOptional(s.configPath, false)
|
||||
if err != nil {
|
||||
elog, _ := eventlog.Open(serviceName)
|
||||
if elog != nil {
|
||||
elog.Error(1, fmt.Sprintf("Failed to load config: %v", err))
|
||||
elog.Close()
|
||||
}
|
||||
return
|
||||
}
|
||||
if cfg == nil {
|
||||
cfg = &config.Config{Port: 8318}
|
||||
}
|
||||
|
||||
// Configure logging
|
||||
logging.ConfigureLogOutput(cfg)
|
||||
|
||||
// Register token store
|
||||
sdkAuth.RegisterTokenStore(sdkAuth.NewFileTokenStore())
|
||||
|
||||
// Register access providers
|
||||
configaccess.Register(&cfg.SDKConfig)
|
||||
|
||||
// Build and start service using builder pattern
|
||||
builder := cliproxy.NewBuilder().
|
||||
WithConfig(cfg).
|
||||
WithConfigPath(s.configPath)
|
||||
|
||||
service, err := builder.Build()
|
||||
if err != nil {
|
||||
elog, _ := eventlog.Open(serviceName)
|
||||
if elog != nil {
|
||||
elog.Error(1, fmt.Sprintf("Failed to build service: %v", err))
|
||||
elog.Close()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Create context for graceful shutdown
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
s.cancelFunc = cancel
|
||||
|
||||
// Start service in background
|
||||
go func() {
|
||||
if err := service.Run(ctx); err != nil && err != context.Canceled {
|
||||
elog, _ := eventlog.Open(serviceName)
|
||||
if elog != nil {
|
||||
elog.Error(1, fmt.Sprintf("Service error: %v", err))
|
||||
elog.Close()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
changes <- svc.Status{State: svc.Running, Accepts: cmdsAccepted}
|
||||
|
||||
// Wait for stop signal
|
||||
for {
|
||||
select {
|
||||
case c := <-r:
|
||||
switch c.Cmd {
|
||||
case svc.Stop, svc.Shutdown:
|
||||
changes <- svc.Status{State: svc.StopPending}
|
||||
cancel()
|
||||
return
|
||||
case svc.Interrogate:
|
||||
changes <- c.CurrentStatus
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// runService starts the Windows service
|
||||
func runService(configPath string) error {
|
||||
elog, err := eventlog.Open(serviceName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer elog.Close()
|
||||
|
||||
elog.Info(1, fmt.Sprintf("Starting %s service", serviceName))
|
||||
|
||||
err = svc.Run(serviceName, &proxyService{configPath: configPath})
|
||||
if err != nil {
|
||||
elog.Error(1, fmt.Sprintf("Service failed: %v", err))
|
||||
return err
|
||||
}
|
||||
|
||||
elog.Info(1, fmt.Sprintf("%s service stopped", serviceName))
|
||||
return nil
|
||||
}
|
||||
|
||||
// installService installs ProxyPilot as a Windows service
|
||||
func installService(configPath string) error {
|
||||
exePath, err := os.Executable()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get executable path: %w", err)
|
||||
}
|
||||
exePath = filepath.Clean(exePath)
|
||||
|
||||
m, err := mgr.Connect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to connect to service manager: %w", err)
|
||||
}
|
||||
defer m.Disconnect()
|
||||
|
||||
// Check if service exists
|
||||
s, err := m.OpenService(serviceName)
|
||||
if err == nil {
|
||||
s.Close()
|
||||
return fmt.Errorf("service %s already exists", serviceName)
|
||||
}
|
||||
|
||||
// Build service arguments
|
||||
args := []string{"-service"}
|
||||
if configPath != "" {
|
||||
args = append(args, "-config", configPath)
|
||||
}
|
||||
|
||||
s, err = m.CreateService(serviceName, exePath, mgr.Config{
|
||||
DisplayName: serviceDisplayName,
|
||||
Description: serviceDescription,
|
||||
StartType: mgr.StartAutomatic,
|
||||
ErrorControl: mgr.ErrorNormal,
|
||||
}, args...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create service: %w", err)
|
||||
}
|
||||
defer s.Close()
|
||||
|
||||
// Set recovery options (restart on failure)
|
||||
err = s.SetRecoveryActions([]mgr.RecoveryAction{
|
||||
{Type: mgr.ServiceRestart, Delay: 5 * time.Second},
|
||||
{Type: mgr.ServiceRestart, Delay: 30 * time.Second},
|
||||
{Type: mgr.ServiceRestart, Delay: 60 * time.Second},
|
||||
}, 86400) // Reset failure count after 24 hours
|
||||
if err != nil {
|
||||
// Non-fatal
|
||||
}
|
||||
|
||||
// Install event log source
|
||||
err = eventlog.InstallAsEventCreate(serviceName, eventlog.Error|eventlog.Warning|eventlog.Info)
|
||||
if err != nil {
|
||||
// Non-fatal, may already exist
|
||||
}
|
||||
|
||||
fmt.Printf("Service %s installed successfully\n", serviceName)
|
||||
return nil
|
||||
}
|
||||
|
||||
// uninstallService removes the Windows service
|
||||
func uninstallService() error {
|
||||
m, err := mgr.Connect()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to connect to service manager: %w", err)
|
||||
}
|
||||
defer m.Disconnect()
|
||||
|
||||
s, err := m.OpenService(serviceName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("service %s not found: %w", serviceName, err)
|
||||
}
|
||||
defer s.Close()
|
||||
|
||||
// Stop the service if running
|
||||
status, err := s.Query()
|
||||
if err == nil && status.State != svc.Stopped {
|
||||
_, _ = s.Control(svc.Stop)
|
||||
// Wait for stop
|
||||
for i := 0; i < 10; i++ {
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
status, err = s.Query()
|
||||
if err != nil || status.State == svc.Stopped {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err = s.Delete()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to delete service: %w", err)
|
||||
}
|
||||
|
||||
// Remove event log source
|
||||
_ = eventlog.Remove(serviceName)
|
||||
|
||||
fmt.Printf("Service %s uninstalled successfully\n", serviceName)
|
||||
return nil
|
||||
}
|
||||
|
||||
// startService starts the Windows service
|
||||
func startService() error {
|
||||
m, err := mgr.Connect()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer m.Disconnect()
|
||||
|
||||
s, err := m.OpenService(serviceName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("service %s not found: %w", serviceName, err)
|
||||
}
|
||||
defer s.Close()
|
||||
|
||||
return s.Start()
|
||||
}
|
||||
|
||||
// stopService stops the Windows service
|
||||
func stopService() error {
|
||||
m, err := mgr.Connect()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer m.Disconnect()
|
||||
|
||||
s, err := m.OpenService(serviceName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("service %s not found: %w", serviceName, err)
|
||||
}
|
||||
defer s.Close()
|
||||
|
||||
_, err = s.Control(svc.Stop)
|
||||
return err
|
||||
}
|
||||
|
||||
// serviceStatus returns the current service status
|
||||
func serviceStatus() string {
|
||||
m, err := mgr.Connect()
|
||||
if err != nil {
|
||||
return "unknown"
|
||||
}
|
||||
defer m.Disconnect()
|
||||
|
||||
s, err := m.OpenService(serviceName)
|
||||
if err != nil {
|
||||
return "not installed"
|
||||
}
|
||||
defer s.Close()
|
||||
|
||||
status, err := s.Query()
|
||||
if err != nil {
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
switch status.State {
|
||||
case svc.Stopped:
|
||||
return "stopped"
|
||||
case svc.StartPending:
|
||||
return "starting"
|
||||
case svc.StopPending:
|
||||
return "stopping"
|
||||
case svc.Running:
|
||||
return "running"
|
||||
case svc.ContinuePending:
|
||||
return "resuming"
|
||||
case svc.PausePending:
|
||||
return "pausing"
|
||||
case svc.Paused:
|
||||
return "paused"
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
// handleServiceCommand handles service-related CLI commands
|
||||
func handleServiceCommand(args []string) bool {
|
||||
if len(args) == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
cmd := strings.ToLower(args[0])
|
||||
switch cmd {
|
||||
case "install":
|
||||
configPath := ""
|
||||
if len(args) > 1 {
|
||||
configPath = args[1]
|
||||
}
|
||||
if err := installService(configPath); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return true
|
||||
|
||||
case "uninstall", "remove":
|
||||
if err := uninstallService(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return true
|
||||
|
||||
case "start":
|
||||
if err := startService(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println("Service started")
|
||||
return true
|
||||
|
||||
case "stop":
|
||||
if err := stopService(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println("Service stopped")
|
||||
return true
|
||||
|
||||
case "status":
|
||||
fmt.Printf("Service status: %s\n", serviceStatus())
|
||||
return true
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"FixedFileInfo": {
|
||||
"FileVersion": {
|
||||
"Major": 0,
|
||||
"Minor": 3,
|
||||
"Patch": 0,
|
||||
"Build": 0
|
||||
},
|
||||
"ProductVersion": {
|
||||
"Major": 0,
|
||||
"Minor": 3,
|
||||
"Patch": 0,
|
||||
"Build": 0
|
||||
},
|
||||
"FileFlagsMask": "3f",
|
||||
"FileFlags ": "00",
|
||||
"FileOS": "040004",
|
||||
"FileType": "01",
|
||||
"FileSubType": "00"
|
||||
},
|
||||
"StringFileInfo": {
|
||||
"Comments": "Local AI Proxy Engine",
|
||||
"CompanyName": "ProxyPilot",
|
||||
"FileDescription": "ProxyPilot Engine",
|
||||
"FileVersion": "0.3.0",
|
||||
"InternalName": "proxypilot-engine",
|
||||
"LegalCopyright": "MIT License",
|
||||
"OriginalFilename": "proxypilot-engine.exe",
|
||||
"ProductName": "ProxyPilot",
|
||||
"ProductVersion": "0.3.0"
|
||||
},
|
||||
"VarFileInfo": {
|
||||
"Translation": {
|
||||
"LangID": "0409",
|
||||
"CharsetID": "04B0"
|
||||
}
|
||||
},
|
||||
"IconPath": "../../static/icon.ico",
|
||||
"ManifestPath": ""
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
cli-proxy-api:
|
||||
image: ${CLI_PROXY_IMAGE:-eceasy/cli-proxy-api:latest}
|
||||
image: ${CLI_PROXY_IMAGE:-eceasy/cli-proxy-api-plus:latest}
|
||||
pull_policy: always
|
||||
build:
|
||||
context: .
|
||||
@@ -9,7 +9,7 @@ services:
|
||||
VERSION: ${VERSION:-dev}
|
||||
COMMIT: ${COMMIT:-none}
|
||||
BUILD_DATE: ${BUILD_DATE:-unknown}
|
||||
container_name: cli-proxy-api
|
||||
container_name: cli-proxy-api-plus
|
||||
# env_file:
|
||||
# - .env
|
||||
environment:
|
||||
@@ -22,7 +22,7 @@ services:
|
||||
- "51121:51121"
|
||||
- "11451:11451"
|
||||
volumes:
|
||||
- ${CLI_PROXY_CONFIG_PATH:-./config.yaml}:/CLIProxyAPI/config.yaml
|
||||
- ${CLI_PROXY_CONFIG_PATH:-./config.yaml}:/ProxyPilot/config.yaml
|
||||
- ${CLI_PROXY_AUTH_PATH:-./auths}:/root/.cli-proxy-api
|
||||
- ${CLI_PROXY_LOG_PATH:-./logs}:/CLIProxyAPI/logs
|
||||
- ${CLI_PROXY_LOG_PATH:-./logs}:/ProxyPilot/logs
|
||||
restart: unless-stopped
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# Agentic Harness Demo (ProxyPilot)
|
||||
|
||||
This is a static, copy-paste demo showing how the middleware rewrites requests.
|
||||
|
||||
## Responses API (Codex CLI style)
|
||||
|
||||
Input:
|
||||
```json
|
||||
{
|
||||
"model": "gpt-5-codex",
|
||||
"instructions": "Follow the user's request.",
|
||||
"input": [
|
||||
{ "role": "user", "content": [{ "type": "input_text", "text": "Build a todo app" }] }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Injected (INITIALIZER mode):
|
||||
```json
|
||||
{
|
||||
"model": "gpt-5-codex",
|
||||
"instructions": "Follow the user's request.\n\n<harness_mode>INITIALIZER</harness_mode>\nYou are the **Initializer Agent** in a Long-Running Agent Harness.\nYour ONLY goal is to set up the project environment for future Coding Agents.\n\n**CRITICAL INSTRUCTIONS**:\n1. **Analyze the User's Request**: Understand what feature or app needs to be built.\n2. **Create 'feature_list.json'**:\n - Write a JSON file listing ALL features/requirements as separate items.\n - Mark them all as \"passes\": false.\n - Format:\n Request: \"Build a todo app\"\n File Content:\n [\n { \"category\": \"core\", \"description\": \"User can add a todo\", \"steps\": [\"Open app\", \"Enter text\", \"Press enter\", \"See new item\"], \"passes\": false },\n { \"category\": \"core\", \"description\": \"User can delete a todo\", \"steps\": [\"Open app\", \"Click delete\", \"Item removed\"], \"passes\": false }\n ]\n3. **Create 'claude-progress.txt'**:\n - Create this file with a header \"## Progress Log\".\n - Add an initial entry: \"- [Initializer] Environment setup started.\"\n4. **Create 'init.sh' (Optional)**:\n - If a dev server is needed, create a script to start it (e.g., 'npm run dev').\n5. **Initial Commit**:\n - Initialize git if not present.\n - Commit these foundational files.\n\n**DO NOT** start implementing features yourself. Your job is ONLY to scaffold the harness.",
|
||||
"input": [
|
||||
{ "role": "user", "content": [{ "type": "input_text", "text": "Build a todo app" }] }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Chat Completions (Claude / OAI chat)
|
||||
|
||||
Input:
|
||||
```json
|
||||
{
|
||||
"model": "claude-sonnet-4-5-thinking",
|
||||
"messages": [
|
||||
{ "role": "system", "content": "You are a helpful assistant." },
|
||||
{ "role": "user", "content": "Set up the repo" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Injected (INITIALIZER mode):
|
||||
```json
|
||||
{
|
||||
"model": "claude-sonnet-4-5-thinking",
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "You are a helpful assistant.\n\n<harness_mode>INITIALIZER</harness_mode>\nYou are the **Initializer Agent** in a Long-Running Agent Harness.\nYour ONLY goal is to set up the project environment for future Coding Agents.\n\n**CRITICAL INSTRUCTIONS**:\n... (same initializer prompt) ..."
|
||||
},
|
||||
{ "role": "user", "content": "Set up the repo" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## CODING mode trigger
|
||||
|
||||
If `feature_list.json` or `claude-progress.txt` exists under `harness-root-dir`,
|
||||
the middleware switches to CODING mode and injects the Coding prompt instead.
|
||||
|
||||
The response header will include:
|
||||
```
|
||||
X-ProxyPilot-Harness-Mode: CODING
|
||||
```
|
||||
@@ -0,0 +1,89 @@
|
||||
# Claude Code via CLIProxyAPI (local proxy)
|
||||
|
||||
This documents how to route Claude Code through CLIProxyAPI, and the related server changes made to improve model aliasing and auth error reporting.
|
||||
|
||||
## What we configured (Windows/macOS)
|
||||
|
||||
1. Run CLIProxyAPI locally (default in this repo uses `127.0.0.1:8318`).
|
||||
2. Point Claude Code at the local proxy by setting Anthropic environment variables in your Claude Code user settings.
|
||||
|
||||
Claude Code reads settings from:
|
||||
|
||||
- Windows: `C:\Users\<you>\.claude\settings.json`
|
||||
- macOS/Linux: `~/.claude/settings.json`
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"env": {
|
||||
"ANTHROPIC_BASE_URL": "http://127.0.0.1:8318",
|
||||
"ANTHROPIC_AUTH_TOKEN": "local-dev-key",
|
||||
|
||||
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "gemini-3-pro-preview",
|
||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "antigravity-claude-sonnet-4-5-thinking",
|
||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "antigravity-claude-opus-4-5-thinking"
|
||||
},
|
||||
"model": "opus"
|
||||
}
|
||||
```
|
||||
|
||||
Important:
|
||||
- Avoid Claude Code “Auth conflict”: do **not** set both `ANTHROPIC_AUTH_TOKEN` and `ANTHROPIC_API_KEY` at the same time.
|
||||
- Restart Claude Code after editing settings so the new env vars take effect.
|
||||
|
||||
## Server-side model aliasing (Claude handler)
|
||||
|
||||
CLIProxyAPI rewrites common Claude Code model aliases to locally-available models before routing:
|
||||
|
||||
- `opus` / `claude-opus-*` → `antigravity-claude-opus-4-5-thinking`
|
||||
- `sonnet` / `claude-sonnet-*` → `antigravity-claude-sonnet-4-5-thinking`
|
||||
- `haiku` / `claude-haiku-*` → `gemini-3-pro-preview`
|
||||
|
||||
Implementation: `sdk/api/handlers/claude/code_handlers.go` (`mapClaudeCodeModel`).
|
||||
|
||||
## Auth error reporting improvements
|
||||
|
||||
When all credentials are blocked for a model, CLIProxyAPI now reports more informative HTTP statuses:
|
||||
|
||||
- Quota/rate cooldown: `429` with `code: model_cooldown` and `Retry-After`
|
||||
- Temporarily blocked credentials (non-quota): `503` with `code: auth_unavailable`, `Retry-After`, and a JSON error body including blocked counts and recent upstream HTTP statuses (when known)
|
||||
|
||||
Implementation: `sdk/cliproxy/auth/selector.go`, `sdk/cliproxy/auth/manager.go`.
|
||||
|
||||
## Quick sanity checks
|
||||
|
||||
List models as Claude Code would see them:
|
||||
|
||||
```powershell
|
||||
$hdr=@{ 'User-Agent'='claude-cli'; 'Authorization'='Bearer local-dev-key' }
|
||||
Invoke-RestMethod -Headers $hdr -Uri 'http://127.0.0.1:8318/v1/models' -Method Get
|
||||
```
|
||||
|
||||
Or with `curl` (macOS/Linux):
|
||||
|
||||
```bash
|
||||
curl -s \
|
||||
-H 'User-Agent: claude-cli' \
|
||||
-H 'Authorization: Bearer local-dev-key' \
|
||||
'http://127.0.0.1:8318/v1/models'
|
||||
```
|
||||
|
||||
Send a minimal Claude Messages request through the proxy:
|
||||
|
||||
```powershell
|
||||
$hdr=@{ 'User-Agent'='claude-cli'; 'Authorization'='Bearer local-dev-key'; 'Content-Type'='application/json' }
|
||||
$body=@{ model='opus'; max_tokens=16; stream=$false; messages=@(@{ role='user'; content='hi' }) } | ConvertTo-Json -Depth 6
|
||||
Invoke-RestMethod -Headers $hdr -Uri 'http://127.0.0.1:8318/v1/messages' -Method Post -Body $body
|
||||
```
|
||||
|
||||
Or with `curl` (macOS/Linux):
|
||||
|
||||
```bash
|
||||
curl -s \
|
||||
-H 'User-Agent: claude-cli' \
|
||||
-H 'Authorization: Bearer local-dev-key' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"model":"opus","max_tokens":16,"stream":false,"messages":[{"role":"user","content":"hi"}]}' \
|
||||
'http://127.0.0.1:8318/v1/messages'
|
||||
```
|
||||
@@ -0,0 +1,330 @@
|
||||
# ProxyPilot CLI
|
||||
|
||||
**proxypilot** is the unified command-line interface for the ProxyPilot local AI proxy. It provides both **server** functionality (running the proxy server) and **switch** functionality (toggling AI agents between proxy mode and native mode).
|
||||
|
||||
## Installation
|
||||
|
||||
### Via bun (recommended)
|
||||
|
||||
```bash
|
||||
bun install -g proxypilot
|
||||
```
|
||||
|
||||
### Via npm
|
||||
|
||||
```bash
|
||||
npm install -g proxypilot
|
||||
```
|
||||
|
||||
### Via Go
|
||||
|
||||
```bash
|
||||
go install github.com/Finesssee/ProxyPilot/cmd/server@latest
|
||||
```
|
||||
|
||||
### Manual Download
|
||||
|
||||
Download pre-built binaries from [GitHub Releases](https://github.com/Finesssee/ProxyPilot/releases).
|
||||
|
||||
Available binaries:
|
||||
- `proxypilot-darwin-amd64` - macOS Intel
|
||||
- `proxypilot-darwin-arm64` - macOS Apple Silicon
|
||||
- `proxypilot-linux-amd64` - Linux x64
|
||||
- `proxypilot-linux-arm64` - Linux ARM64
|
||||
- `proxypilot-windows-amd64.exe` - Windows x64
|
||||
|
||||
## Server Mode
|
||||
|
||||
Run ProxyPilot as a local proxy server:
|
||||
|
||||
```bash
|
||||
proxypilot # Start server on default port (8317)
|
||||
proxypilot -config /path/to/config # Use custom config file
|
||||
```
|
||||
|
||||
### Server Features
|
||||
|
||||
- Routes AI requests through configured providers
|
||||
- Automatic model aliasing and translation
|
||||
- OAuth login helpers for various providers
|
||||
- Agent configuration management
|
||||
|
||||
### Login Commands
|
||||
|
||||
```bash
|
||||
proxypilot --login # Login to Google Account (Gemini)
|
||||
proxypilot --codex-login # Login to Codex using OAuth
|
||||
proxypilot --claude-login # Login to Claude using OAuth
|
||||
proxypilot --qwen-login # Login to Qwen using OAuth
|
||||
proxypilot --antigravity-login # Login to Antigravity using OAuth
|
||||
proxypilot --kiro-login # Login to Kiro using Google OAuth
|
||||
proxypilot --kiro-aws-login # Login to Kiro using AWS Builder ID
|
||||
proxypilot --minimax-login # Add MiniMax API key
|
||||
proxypilot --zhipu-login # Add Zhipu AI API key
|
||||
```
|
||||
|
||||
### Login Options
|
||||
|
||||
```bash
|
||||
--no-browser # Don't open browser automatically for OAuth
|
||||
--incognito # Use incognito/private mode (useful for multiple accounts)
|
||||
--no-incognito # Force disable incognito mode
|
||||
```
|
||||
|
||||
### Import Commands
|
||||
|
||||
```bash
|
||||
proxypilot --vertex-import <file> # Import Vertex service account key JSON
|
||||
proxypilot --kiro-import # Import Kiro token from Kiro IDE
|
||||
```
|
||||
|
||||
## Agent Configuration
|
||||
|
||||
ProxyPilot can automatically configure AI CLI tools to use the proxy.
|
||||
|
||||
### Detect Installed Agents
|
||||
|
||||
```bash
|
||||
proxypilot --detect-agents
|
||||
```
|
||||
|
||||
Example output:
|
||||
```
|
||||
Detecting installed CLI agents...
|
||||
|
||||
Claude Code: [+] Installed
|
||||
Binary: /usr/local/bin/claude
|
||||
Config: ~/.claude/settings.json
|
||||
Codex CLI: [+] Installed
|
||||
Binary: /usr/local/bin/codex
|
||||
Config: ~/.codex
|
||||
Gemini CLI: [-] Not found
|
||||
```
|
||||
|
||||
### Setup Commands
|
||||
|
||||
```bash
|
||||
proxypilot --setup-all # Configure all detected agents
|
||||
proxypilot --setup-claude # Configure Claude Code
|
||||
proxypilot --setup-codex # Configure Codex CLI
|
||||
proxypilot --setup-droid # Configure Factory Droid
|
||||
proxypilot --setup-opencode # Configure OpenCode
|
||||
proxypilot --setup-gemini # Configure Gemini CLI
|
||||
proxypilot --setup-cursor # Configure Cursor
|
||||
proxypilot --setup-kilo # Configure Kilo Code CLI
|
||||
proxypilot --setup-roocode # Configure RooCode (VS Code)
|
||||
```
|
||||
|
||||
## Switch Mode
|
||||
|
||||
Switch AI agents between proxy mode (through ProxyPilot) and native mode (direct API access). Think of it like `nvm` for Node versions, but for AI agent configurations.
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
proxypilot --switch <agent> # Show status of specific agent
|
||||
proxypilot --switch <agent> --mode proxy # Switch agent to proxy mode
|
||||
proxypilot --switch <agent> --mode native # Switch agent to native mode
|
||||
proxypilot --switch <agent> --mode status # Show current mode (default)
|
||||
```
|
||||
|
||||
### Supported Agents
|
||||
|
||||
| Agent | CLI Tool | Config Location |
|
||||
|-------|----------|-----------------|
|
||||
| `claude` | Claude Code | `~/.claude/settings.json` |
|
||||
| `gemini` | Gemini CLI | `~/.gemini/settings.json` |
|
||||
| `codex` | Codex CLI | `~/.codex/config.toml` |
|
||||
| `opencode` | OpenCode | `~/.opencode/config.json` |
|
||||
| `droid` | Factory Droid | `~/.factory/settings.json` |
|
||||
| `cursor` | Cursor IDE | `~/.cursor/config.json` |
|
||||
| `kilo` | Kilo Code* | VS Code settings |
|
||||
| `roocode` | RooCode* | VS Code settings |
|
||||
|
||||
*VS Code extensions require manual configuration - proxypilot will display instructions.
|
||||
|
||||
### Modes
|
||||
|
||||
| Mode | Description |
|
||||
|------|-------------|
|
||||
| `proxy` | Route through ProxyPilot (`http://127.0.0.1:8317`) |
|
||||
| `native` | Use direct API access (restore original config) |
|
||||
| `status` | Show current mode (default) |
|
||||
|
||||
### Examples
|
||||
|
||||
#### Check single agent status
|
||||
|
||||
```bash
|
||||
$ proxypilot --switch claude
|
||||
Claude Code: proxy
|
||||
Config: ~/.claude/settings.json
|
||||
```
|
||||
|
||||
#### Switch Claude to proxy mode
|
||||
|
||||
```bash
|
||||
$ proxypilot --switch claude --mode proxy
|
||||
Switched Claude Code to proxy mode
|
||||
Config: ~/.claude/settings.json
|
||||
Backup: ~/.claude/settings.json.native.json
|
||||
```
|
||||
|
||||
#### Switch Gemini back to native mode
|
||||
|
||||
```bash
|
||||
$ proxypilot --switch gemini --mode native
|
||||
Switched Gemini CLI to native mode
|
||||
Restored from: ~/.gemini/settings.json.native.json
|
||||
```
|
||||
|
||||
### How Switch Works
|
||||
|
||||
#### Switching to proxy mode
|
||||
|
||||
1. Backs up current config to `<config>.native.json`
|
||||
2. Updates config to point to `http://127.0.0.1:8317`
|
||||
3. Preserves all other settings (API keys, preferences, etc.)
|
||||
|
||||
#### Switching to native mode
|
||||
|
||||
1. Restores config from `<config>.native.json` backup
|
||||
2. Removes backup file after successful restore
|
||||
3. Original API keys and settings are restored
|
||||
|
||||
#### Config Detection
|
||||
|
||||
ProxyPilot automatically detects which mode an agent is in by checking:
|
||||
- If config contains `127.0.0.1:8317` -> proxy mode
|
||||
- If backup file exists -> was previously in proxy mode
|
||||
- Otherwise -> native mode
|
||||
|
||||
## Agent-Specific Notes
|
||||
|
||||
### Claude Code
|
||||
|
||||
Config location: `~/.claude/settings.json`
|
||||
|
||||
Proxy mode sets:
|
||||
```json
|
||||
{
|
||||
"env": {
|
||||
"ANTHROPIC_BASE_URL": "http://127.0.0.1:8317"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Codex CLI
|
||||
|
||||
Config location: `~/.codex/config.toml`
|
||||
|
||||
Proxy mode sets:
|
||||
```toml
|
||||
[openai]
|
||||
api_base_url = "http://127.0.0.1:8317"
|
||||
```
|
||||
|
||||
### Gemini CLI
|
||||
|
||||
Config location: `~/.gemini/settings.json`
|
||||
|
||||
Proxy mode sets the API endpoint to ProxyPilot.
|
||||
|
||||
### Kilo Code & RooCode
|
||||
|
||||
These are VS Code extensions that require manual configuration:
|
||||
|
||||
1. Open VS Code Settings (Ctrl+,)
|
||||
2. Search for the extension settings
|
||||
3. Update the API base URL to `http://127.0.0.1:8317`
|
||||
|
||||
ProxyPilot will display these instructions when you run:
|
||||
```bash
|
||||
proxypilot --setup-kilo
|
||||
proxypilot --setup-roocode
|
||||
```
|
||||
|
||||
## Backup System
|
||||
|
||||
Before modifying any configuration file, ProxyPilot creates a timestamped backup:
|
||||
|
||||
```
|
||||
~/.claude/.proxypilot-backups/
|
||||
settings.json.20251228-221853.bak
|
||||
|
||||
~/.codex/.proxypilot-backups/
|
||||
config.toml.20251228-221853.bak
|
||||
```
|
||||
|
||||
### Restoring Backups
|
||||
|
||||
```bash
|
||||
# List backups
|
||||
ls ~/.claude/.proxypilot-backups/
|
||||
|
||||
# Restore
|
||||
cp ~/.claude/.proxypilot-backups/settings.json.<timestamp>.bak ~/.claude/settings.json
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "Config not found"
|
||||
|
||||
The agent's config file doesn't exist. Run the agent once to create it, or create the config manually.
|
||||
|
||||
### "Failed to backup config"
|
||||
|
||||
Check file permissions on the config directory.
|
||||
|
||||
### "Already in proxy/native mode"
|
||||
|
||||
The agent is already configured for the requested mode. No changes made.
|
||||
|
||||
### CLI not detected
|
||||
|
||||
If a CLI tool is installed but not detected:
|
||||
1. Ensure the binary is in your `PATH`
|
||||
2. Try running the tool directly to verify it's installed
|
||||
3. Check if the config directory exists
|
||||
|
||||
### Configuration not applied
|
||||
|
||||
1. Restart the CLI tool after running setup
|
||||
2. Verify ProxyPilot is running on port 8317
|
||||
3. Check the backup directory for the original config
|
||||
|
||||
## Full Usage Reference
|
||||
|
||||
```bash
|
||||
proxypilot -h, --help # Show help
|
||||
proxypilot -v, --version # Show version
|
||||
|
||||
# Server
|
||||
proxypilot # Start proxy server
|
||||
proxypilot -config <path> # Use custom config file
|
||||
|
||||
# OAuth Logins
|
||||
proxypilot --login # Google/Gemini login
|
||||
proxypilot --codex-login # Codex OAuth
|
||||
proxypilot --claude-login # Claude OAuth
|
||||
proxypilot --qwen-login # Qwen OAuth
|
||||
proxypilot --antigravity-login # Antigravity OAuth
|
||||
proxypilot --kiro-login # Kiro Google OAuth
|
||||
proxypilot --kiro-aws-login # Kiro AWS Builder ID
|
||||
|
||||
# Agent Detection & Setup
|
||||
proxypilot --detect-agents # Detect installed agents
|
||||
proxypilot --setup-all # Configure all agents
|
||||
proxypilot --setup-<agent> # Configure specific agent
|
||||
|
||||
# Agent Switching
|
||||
proxypilot --switch <agent> # Show agent status
|
||||
proxypilot --switch <agent> --mode proxy # Switch to proxy
|
||||
proxypilot --switch <agent> --mode native # Switch to native
|
||||
```
|
||||
|
||||
## Links
|
||||
|
||||
- [npm package](https://www.npmjs.com/package/proxypilot)
|
||||
- [GitHub Releases](https://github.com/Finesssee/ProxyPilot/releases)
|
||||
- [Source Code](https://github.com/Finesssee/ProxyPilot)
|
||||
@@ -0,0 +1,79 @@
|
||||
# Compatibility Matrix (Quick Reference)
|
||||
|
||||
This project proxies multiple “OpenAI-compatible” clients to multiple upstreams. Small schema differences matter.
|
||||
|
||||
## Clients
|
||||
|
||||
### Codex CLI (`codex_cli_rs/...`)
|
||||
|
||||
- Endpoint: `POST /v1/responses`
|
||||
- Streaming: SSE (`text/event-stream`)
|
||||
- Notes:
|
||||
- `data: [DONE]` sentinel is tolerated/expected by many Codex/OpenAI clients.
|
||||
- Response output ordering and `output_text` fields must be stable.
|
||||
- Routing transparency:
|
||||
- Responses from localhost include:
|
||||
- `X-ProxyPilot-Requested-Model`
|
||||
- `X-ProxyPilot-Resolved-Model`
|
||||
- `X-ProxyPilot-Provider-Candidates`
|
||||
- `X-ProxyPilot-Resolved-Provider`
|
||||
- Add `X-CLIProxyAPI-Debug-Auth: 1` (localhost only) to also receive:
|
||||
- `X-CLIProxyAPI-Selected-Provider`, `X-CLIProxyAPI-Selected-Auth`, `X-CLIProxyAPI-Selected-Label`, `X-CLIProxyAPI-Selected-Account`.
|
||||
|
||||
### Droid / Factory CLI (`factory-cli/...`, Stainless headers)
|
||||
|
||||
- Endpoint: `POST /v1/responses`
|
||||
- Streaming behavior:
|
||||
- Sends `stream: true` but typically uses `Accept: application/json`
|
||||
- CLIProxyAPI uses a non-stream upstream call and **synthesizes SSE** for reliability.
|
||||
- Notes:
|
||||
- Droid attempts to JSON-parse each SSE `data:` line, so `data: [DONE]` must **not** be emitted for this client.
|
||||
- Routing transparency:
|
||||
- For localhost requests, the same headers as Codex apply for underlying routing.
|
||||
- The `/v0/management/routing/preview?model=...` endpoint is the easiest way to debug which provider a `model` will map to before sending a turn from Droid/Factory.
|
||||
|
||||
### OpenAI-compatible SDKs (`openai`, `azure-openai`, etc.)
|
||||
|
||||
- Endpoints: `POST /v1/chat/completions`, `POST /v1/completions`.
|
||||
- Streaming behavior:
|
||||
- If body has `"stream": true` and `Accept` includes `text/event-stream`, ProxyPilot streams SSE.
|
||||
- If `Accept: application/json` **without** `text/event-stream`, ProxyPilot automatically downgrades to non-streaming and returns JSON, even when `stream: true`.
|
||||
- Notes:
|
||||
- Responses from localhost include routing headers as above.
|
||||
- For debugging, you can issue a test request and inspect:
|
||||
- `X-ProxyPilot-Requested-Model` vs `X-ProxyPilot-Resolved-Model` to see alias/`auto`/thinking normalisation.
|
||||
- `X-ProxyPilot-Provider-Candidates` and `X-ProxyPilot-Resolved-Provider` to see which upstream(s) and which provider actually ran.
|
||||
|
||||
## Upstreams
|
||||
|
||||
### Antigravity (`cloudcode-pa.googleapis.com`)
|
||||
|
||||
- Endpoints:
|
||||
- `v1internal:generateContent` (non-stream)
|
||||
- `v1internal:streamGenerateContent?alt=sse` (stream)
|
||||
- Notes:
|
||||
- `request.contents[].parts[].text` must be a **string** (`"text":"..."`), not an object.
|
||||
|
||||
## Model routing rules
|
||||
|
||||
- Quick debugging helpers:
|
||||
- `GET /v0/management/routing/preview?model=<name>`
|
||||
- Returns JSON describing how a given model name will be normalised and which provider candidates will be used.
|
||||
- `POST /v0/management/routing/preview`
|
||||
- Accepts a full request JSON body (OpenAI/OpenAIResponses-compatible), extracts the `model` field, and returns the same routing preview for that model.
|
||||
- `/v0/management/routing/recent`
|
||||
- Returns a small in-memory list of the last few routed requests (timestamp, path, requested/resolved model, provider + candidates).
|
||||
- Both endpoints require a management key and are intended for localhost use.
|
||||
|
||||
### `gemini-3-*` provider preference
|
||||
|
||||
- Primary: `antigravity`
|
||||
- Fallback: `gemini-cli` (only used if antigravity is unavailable/cooling)
|
||||
- Rotation: disabled between these two providers to keep the primary stable.
|
||||
|
||||
## Regression tests
|
||||
|
||||
- Droid SSE parsing: `sdk/api/handlers/openai/openai_responses_handlers_sse_done_test.go`
|
||||
- Codex SSE done sentinel: `sdk/api/handlers/openai/openai_responses_handlers_sse_json_compat_test.go`
|
||||
- Antigravity request shape: `internal/runtime/executor/antigravity_executor_shape_test.go`
|
||||
- Gemini-3-* provider ordering: `internal/util/provider_test.go` and `sdk/cliproxy/auth/provider_rotation_test.go`
|
||||
@@ -0,0 +1,25 @@
|
||||
# Cursor IDE Integration
|
||||
|
||||
CLIProxyAPI can be used as a local OpenAI-compatible endpoint for Cursor.
|
||||
|
||||
## 1) Start CLIProxyAPI
|
||||
|
||||
Run the server and note the listening address (default: `http://localhost:8318`).
|
||||
|
||||
## 2) Configure Cursor
|
||||
|
||||
In Cursor settings:
|
||||
|
||||
- **API base URL**: `http://localhost:8318` (recommended)
|
||||
- Alternatively: `http://localhost:8318/v1` (CLIProxyAPI also provides non-`/v1` aliases for this case)
|
||||
- **API key**: use one of the keys from `config.yaml` under `api-keys`
|
||||
- Example: `your-cli-proxy-api-key`
|
||||
|
||||
## 3) Model selection
|
||||
|
||||
Cursor will query `GET /v1/models` (or `/models` when base URL ends with `/v1`).
|
||||
Pick any model exposed by your configured providers.
|
||||
|
||||
## Notes
|
||||
|
||||
- `POST /v1/embeddings` is implemented and returns deterministic synthetic embeddings to keep IDE features working even when an embeddings backend is not configured.
|
||||
@@ -0,0 +1,300 @@
|
||||
# ProxyPilot CLI + Tray Build Process
|
||||
|
||||
Documentation of the CLI and system tray application build and release process.
|
||||
|
||||
## Overview
|
||||
|
||||
ProxyPilot uses a **CLI + system tray architecture**:
|
||||
- **proxypilot.exe** - CLI executable with all proxy functionality
|
||||
- **ProxyPilot.exe** - System tray app that manages the CLI process and provides quick access to controls
|
||||
|
||||
The dashboard is accessed via web browser at `http://127.0.0.1:<port>/proxypilot.html`.
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ ProxyPilot System │
|
||||
│ │
|
||||
│ ┌─────────────────────┐ ┌─────────────────────────────┐ │
|
||||
│ │ ProxyPilot.exe │ │ proxypilot.exe │ │
|
||||
│ │ (System Tray) │─────▶│ (CLI / Engine) │ │
|
||||
│ │ │ │ │ │
|
||||
│ │ - Start/Stop │ │ - Proxy Engine (port 8317) │ │
|
||||
│ │ - Open Dashboard │ │ - Web Dashboard Server │ │
|
||||
│ │ - Copy API URL │ │ - Provider Auth Mgmt │ │
|
||||
│ │ - Autostart toggle │ │ - Routing Engine │ │
|
||||
│ └─────────────────────┘ └─────────────────────────────┘ │
|
||||
│ │
|
||||
│ ┌─────────────────────┐ │
|
||||
│ │ Web Browser │ │
|
||||
│ │ (Dashboard UI) │ │
|
||||
│ │ proxypilot.html │ │
|
||||
│ └─────────────────────┘ │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### CLI + Tray Separation
|
||||
|
||||
The architecture separates concerns:
|
||||
|
||||
**proxypilot.exe (CLI)**:
|
||||
- All proxy engine functionality
|
||||
- Serves web dashboard at `/proxypilot.html`
|
||||
- Can run standalone from command line
|
||||
- Supports all CLI flags (`--help`, `--setup-claude`, etc.)
|
||||
|
||||
**ProxyPilot.exe (Tray)**:
|
||||
- Lightweight system tray wrapper
|
||||
- Manages CLI process lifecycle (start/stop/restart)
|
||||
- Opens dashboard in default browser
|
||||
- Provides quick-access menu
|
||||
|
||||
Benefits of CLI + tray architecture:
|
||||
- **Flexibility**: Use CLI directly or via tray app
|
||||
- **No WebView2 dependency**: Dashboard runs in any browser
|
||||
- **Simpler debugging**: Inspect network/console in browser DevTools
|
||||
- **Cross-platform dashboard**: Same web UI works on all platforms
|
||||
|
||||
## Build Process
|
||||
|
||||
### Prerequisites
|
||||
|
||||
```bash
|
||||
# Required tools
|
||||
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest
|
||||
```
|
||||
|
||||
Inno Setup 6 must be installed for creating the Windows installer.
|
||||
|
||||
### Step 1: Build Web UI Assets
|
||||
|
||||
```bash
|
||||
cd webui
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
This generates `webui/dist/` with the dashboard assets that are served by the CLI at `/proxypilot.html`.
|
||||
|
||||
### Step 2: Create Multi-Resolution Icon
|
||||
|
||||
The icon must have multiple sizes for proper Windows display (16px to 256px):
|
||||
|
||||
```python
|
||||
from PIL import Image
|
||||
|
||||
img = Image.open('static/icon.png')
|
||||
if img.mode != 'RGBA':
|
||||
img = img.convert('RGBA')
|
||||
|
||||
sizes = [(16,16), (24,24), (32,32), (48,48), (64,64), (128,128), (256,256)]
|
||||
img.save('static/icon.ico', format='ICO', sizes=sizes)
|
||||
```
|
||||
|
||||
Copy to tray icon location:
|
||||
```bash
|
||||
cp static/icon.ico internal/trayicon/icon.ico
|
||||
```
|
||||
|
||||
### Step 3: Generate Windows Resource Files
|
||||
|
||||
Generate `.syso` files for embedding icons in executables:
|
||||
|
||||
```bash
|
||||
cd cmd/proxypilot-tray
|
||||
goversioninfo -icon="../../static/icon.ico"
|
||||
```
|
||||
|
||||
This creates `resource.syso` files that Go automatically includes during build.
|
||||
|
||||
### Step 4: Build Executables
|
||||
|
||||
```bash
|
||||
# Build CLI executable
|
||||
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o dist/proxypilot.exe ./cmd/server
|
||||
|
||||
# Build tray app (with -H windowsgui to hide console)
|
||||
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w -H windowsgui" -o dist/ProxyPilot.exe ./cmd/proxypilot-tray
|
||||
```
|
||||
|
||||
### Step 5: Build Installer
|
||||
|
||||
```bash
|
||||
# Using Inno Setup
|
||||
"C:\Users\FSOS\AppData\Local\Programs\Inno Setup 6\ISCC.exe" installer/proxypilot.iss
|
||||
```
|
||||
|
||||
Output: `dist/ProxyPilot-0.1.0-Setup.exe`
|
||||
|
||||
## Key Files
|
||||
|
||||
### Version Info Configuration
|
||||
|
||||
**cmd/proxypilot-tray/versioninfo.json**
|
||||
```json
|
||||
{
|
||||
"FixedFileInfo": {
|
||||
"FileVersion": {"Major": 0, "Minor": 1, "Patch": 0, "Build": 0},
|
||||
"ProductVersion": {"Major": 0, "Minor": 1, "Patch": 0, "Build": 0}
|
||||
},
|
||||
"StringFileInfo": {
|
||||
"FileDescription": "ProxyPilot System Tray",
|
||||
"ProductName": "ProxyPilot",
|
||||
"ProductVersion": "0.1.0"
|
||||
},
|
||||
"IconPath": "../../static/icon.ico"
|
||||
}
|
||||
```
|
||||
|
||||
### Tray Process Manager
|
||||
|
||||
**cmd/proxypilot-tray/engine.go** - Manages the CLI process:
|
||||
- Spawns/stops `proxypilot.exe` subprocess
|
||||
- Monitors process health
|
||||
- Passes configuration and management password
|
||||
|
||||
### Tray Icon Embedding
|
||||
|
||||
**internal/trayicon/ico.go**
|
||||
```go
|
||||
package trayicon
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
//go:embed icon.ico
|
||||
var proxyPilotICO []byte
|
||||
|
||||
func ProxyPilotICO() []byte {
|
||||
return proxyPilotICO
|
||||
}
|
||||
```
|
||||
|
||||
### Installer Script
|
||||
|
||||
**installer/proxypilot.iss** - Inno Setup script that:
|
||||
- Installs `proxypilot.exe` and `ProxyPilot.exe` to `%LOCALAPPDATA%\ProxyPilot`
|
||||
- Creates Start Menu shortcut
|
||||
- Adds optional Windows startup entry
|
||||
- Copies config.example.yaml and creates config.yaml on first install
|
||||
- Uses ProxyPilot icon for installer and shortcuts
|
||||
|
||||
## System Tray Menu
|
||||
|
||||
Simplified flat menu structure:
|
||||
|
||||
```
|
||||
┌─────────────────────┐
|
||||
│ Open Dashboard │ → Opens browser to proxypilot.html
|
||||
├─────────────────────┤
|
||||
│ Start/Stop │ → Toggle proxy engine (CLI process)
|
||||
│ Copy API URL │ → Copies http://127.0.0.1:8317/v1
|
||||
├─────────────────────┤
|
||||
│ Quit │ → Stop engine and exit
|
||||
└─────────────────────┘
|
||||
```
|
||||
|
||||
## Release Process
|
||||
|
||||
### Create Release on GitHub
|
||||
|
||||
```bash
|
||||
# Tag the release
|
||||
git tag v0.1.0
|
||||
git push origin v0.1.0
|
||||
|
||||
# Create release with assets
|
||||
gh release create v0.1.0 \
|
||||
--title "ProxyPilot v0.1.0" \
|
||||
--notes "Release notes here" \
|
||||
dist/ProxyPilot-0.1.0-Setup.exe \
|
||||
dist/ProxyPilot.exe \
|
||||
config.example.yaml
|
||||
```
|
||||
|
||||
### Update Existing Release
|
||||
|
||||
```bash
|
||||
# Delete old asset
|
||||
gh release delete-asset v0.1.0 ProxyPilot.exe --yes
|
||||
|
||||
# Upload new asset
|
||||
gh release upload v0.1.0 dist/ProxyPilot.exe
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Icon Not Showing in File Explorer
|
||||
|
||||
1. Ensure icon.ico has 256x256 size (required for Windows)
|
||||
2. Clear Windows icon cache: `ie4uinit.exe -show`
|
||||
3. Verify resource.syso was generated after icon update
|
||||
4. Rebuild the executable
|
||||
|
||||
### Dashboard Not Loading in Browser
|
||||
|
||||
1. Ensure the CLI process is running (check tray status)
|
||||
2. Verify the port is correct: `http://127.0.0.1:8317/proxypilot.html`
|
||||
3. Check for port conflicts with another application
|
||||
|
||||
### Tray Icon Shows Wrong Image
|
||||
|
||||
1. Check internal/trayicon/icon.ico is the correct file
|
||||
2. Rebuild the tray app to re-embed the icon
|
||||
3. Restart the application
|
||||
|
||||
### Engine Not Starting
|
||||
|
||||
1. Check if port 8317/8318 are already in use
|
||||
2. Review logs in `%LOCALAPPDATA%\ProxyPilot\logs\`
|
||||
3. Ensure config.yaml is valid YAML
|
||||
|
||||
## File Structure
|
||||
|
||||
```
|
||||
ProxyPilot/
|
||||
├── cmd/
|
||||
│ ├── server/
|
||||
│ │ └── main.go # CLI entry point
|
||||
│ └── proxypilot-tray/
|
||||
│ ├── main_windows.go # Tray app entry point
|
||||
│ ├── engine.go # CLI process manager
|
||||
│ ├── versioninfo.json # Version/icon config
|
||||
│ └── resource.syso # Compiled resources
|
||||
├── internal/
|
||||
│ └── trayicon/
|
||||
│ ├── ico.go # Embeds icon.ico
|
||||
│ └── icon.ico # ProxyPilot logo (multi-res)
|
||||
├── static/
|
||||
│ ├── icon.ico # Source icon (7 sizes)
|
||||
│ └── icon.png # Original PNG logo
|
||||
├── webui/
|
||||
│ ├── src/ # React dashboard source
|
||||
│ └── dist/ # Built assets (served by CLI)
|
||||
├── installer/
|
||||
│ └── proxypilot.iss # Inno Setup script
|
||||
└── dist/ # Distribution files
|
||||
├── proxypilot.exe # CLI executable
|
||||
└── ProxyPilot.exe # Tray app
|
||||
```
|
||||
|
||||
## Version History
|
||||
|
||||
- **v0.3.0** (2025-12-30) - CLI + Tray architecture
|
||||
- Removed WebView2 dependency
|
||||
- Dashboard served by CLI, opened in browser
|
||||
- Tray app manages CLI subprocess
|
||||
- Simplified deployment and debugging
|
||||
|
||||
- **v0.2.0** (2025-12-27) - Single-binary architecture
|
||||
- Embedded proxy engine runs in-process
|
||||
- Removed separate proxypilot-engine.exe
|
||||
- Reduced total size from ~46MB to ~29MB
|
||||
- Faster startup with no process spawning
|
||||
|
||||
- **v0.1.0** (2025-12-27) - Initial release
|
||||
- System tray with minimal menu
|
||||
- Multi-resolution icon support
|
||||
- Single-file Windows installer
|
||||