Compare commits
1359
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ec4749bf7 | ||
|
|
6a76346734 | ||
|
|
78b3000031 | ||
|
|
4c4860fb24 | ||
|
|
5242a1c6b4 | ||
|
|
075f876e6f | ||
|
|
a849812e9f | ||
|
|
d99dde6306 | ||
|
|
becf57ee6a | ||
|
|
f33aec1139 | ||
|
|
1571933096 | ||
|
|
160928a9a9 | ||
|
|
d297c29f22 | ||
|
|
0b498dd448 | ||
|
|
cec9c6122a | ||
|
|
51e310c9ce | ||
|
|
478156456e | ||
|
|
6252412d94 | ||
|
|
c2609cbf04 | ||
|
|
2115df57bf | ||
|
|
29ec07700c | ||
|
|
bcae852d28 | ||
|
|
16ddf5f559 | ||
|
|
8c79c58c4d | ||
|
|
97ed9ba624 | ||
|
|
a6b6395c8a | ||
|
|
21f8027ef7 | ||
|
|
a5aa72bd7d | ||
|
|
563177c6ac | ||
|
|
4eae8ec037 | ||
|
|
08895c396e | ||
|
|
4e451a4b0f | ||
|
|
163290bcf0 | ||
|
|
c68c33d4fe | ||
|
|
3615d8e226 | ||
|
|
2283979199 | ||
|
|
33f7f593ee | ||
|
|
461e7345b3 | ||
|
|
6bd91c68e8 | ||
|
|
ff55a40749 | ||
|
|
8b56d77ea1 | ||
|
|
dd3aa96730 | ||
|
|
8b56d1712f | ||
|
|
3c24d22d42 | ||
|
|
4c70ea28d2 | ||
|
|
5ba68a28c0 | ||
|
|
bce4def2db | ||
|
|
3544ea0244 | ||
|
|
6434918794 | ||
|
|
5984d917dc | ||
|
|
c2a97a7a6c | ||
|
|
a083c88e87 | ||
|
|
ce3b0988c4 | ||
|
|
e8a194a2bb | ||
|
|
8aa8798e07 | ||
|
|
6d4629b566 | ||
|
|
a9d399699e | ||
|
|
bc805b3001 | ||
|
|
668d77bb4e | ||
|
|
5c2e06f353 | ||
|
|
a499fe2b17 | ||
|
|
451650b584 | ||
|
|
1b76bec0e2 | ||
|
|
96f4da1e1d | ||
|
|
96a0dd6b04 | ||
|
|
2dd1f2d453 | ||
|
|
510f01674a | ||
|
|
e3134a2a99 | ||
|
|
8805104b8d | ||
|
|
fc155e9fc5 | ||
|
|
3aaac0098e | ||
|
|
a12333310f | ||
|
|
247284b9af | ||
|
|
e0305e47f3 | ||
|
|
76a0f0f619 | ||
|
|
560baae15d | ||
|
|
5518ecaefe | ||
|
|
924ba97055 | ||
|
|
b80f52f8ad | ||
|
|
feb275d08b | ||
|
|
fbcbd24063 | ||
|
|
3250b814ce | ||
|
|
0e9d9282c6 | ||
|
|
b315a70773 | ||
|
|
cedff6fb89 | ||
|
|
87cd9446d8 | ||
|
|
f4ce240a2e | ||
|
|
320527a3e4 | ||
|
|
19271fca2d | ||
|
|
feeebbe7d4 | ||
|
|
f384675c01 | ||
|
|
ec3ab4a00c | ||
|
|
e4ac936eb9 | ||
|
|
79e23b7eb9 | ||
|
|
92e80b4660 | ||
|
|
ce63ca4d7a | ||
|
|
fef7981942 | ||
|
|
ffe0314c47 | ||
|
|
375444a149 | ||
|
|
65c15afe9f | ||
|
|
8f57a2a462 | ||
|
|
53e9cac383 | ||
|
|
fe0c182747 | ||
|
|
29b1060c67 | ||
|
|
dddfcbf0d8 | ||
|
|
62e1335388 | ||
|
|
908e28175f | ||
|
|
3398fd7719 | ||
|
|
9bddf7f3ef | ||
|
|
8ba374fefa | ||
|
|
3ef0aaf768 | ||
|
|
d7701dbfb6 | ||
|
|
c49bf0b402 | ||
|
|
cee9610d26 | ||
|
|
38adc13295 | ||
|
|
4fe14abb8c | ||
|
|
9052e8a1ba | ||
|
|
de78dedceb | ||
|
|
6f508d574e | ||
|
|
61dfae31e7 | ||
|
|
ac6aa43e3b | ||
|
|
ea89925042 | ||
|
|
12cbfe5b64 | ||
|
|
d7b7be1909 | ||
|
|
a740d2c667 | ||
|
|
588261076a | ||
|
|
639e27c3ce | ||
|
|
1124ae17b4 | ||
|
|
9db5890ce5 | ||
|
|
293877cb7e | ||
|
|
c480006554 | ||
|
|
6aa8e894b1 | ||
|
|
00bb9836a6 | ||
|
|
71f9189607 | ||
|
|
a3f7ea2555 | ||
|
|
d3df8e1180 | ||
|
|
df147b65fd | ||
|
|
6015084fa2 | ||
|
|
65ba1f6c13 | ||
|
|
d37e5af57d | ||
|
|
d71b827d8c | ||
|
|
504ca3d3d8 | ||
|
|
a8c74c04de | ||
|
|
f6b4f54216 | ||
|
|
fc0e3c65b3 | ||
|
|
23b8ed788e | ||
|
|
3bd890f46b | ||
|
|
9fbeafb63e | ||
|
|
91bd295209 | ||
|
|
d4bf70be06 | ||
|
|
ae8904c4ff | ||
|
|
9209c04370 | ||
|
|
379e7f3f20 | ||
|
|
366d11e1f8 | ||
|
|
58836e75f0 | ||
|
|
0acac216ae | ||
|
|
276d162044 | ||
|
|
1b0ed983c5 | ||
|
|
2e8d690ab1 | ||
|
|
1ff8d289af | ||
|
|
d54ffbda1c | ||
|
|
c00058ed7a | ||
|
|
2c2fc3499b | ||
|
|
ea3c6c3481 | ||
|
|
9b68b7195a | ||
|
|
7739cc53b4 | ||
|
|
3fa78a8b01 | ||
|
|
e57d0c2fee | ||
|
|
2a4f2bf527 | ||
|
|
aa07f38b07 | ||
|
|
9d1f17d836 | ||
|
|
b420952e59 | ||
|
|
bb9e445257 | ||
|
|
528fb1d404 | ||
|
|
c8d9f7aa89 | ||
|
|
cd7ec93cdf | ||
|
|
796b652d2b | ||
|
|
4d74849c1a | ||
|
|
937a7c48a5 | ||
|
|
704eb00de4 | ||
|
|
bad4599bf9 | ||
|
|
892fd85ba7 | ||
|
|
0eaa47d857 | ||
|
|
faca24d487 | ||
|
|
c103202ad5 | ||
|
|
ce78a4265d | ||
|
|
c4a2353ac3 | ||
|
|
576efed196 | ||
|
|
dfc0075f90 | ||
|
|
acd15dcc8a | ||
|
|
139c4fd555 | ||
|
|
e0f3df8252 | ||
|
|
9cd2e3a1c3 | ||
|
|
f584f80219 | ||
|
|
45eac589f8 | ||
|
|
fab1768826 | ||
|
|
51fc10e407 | ||
|
|
7a1c8465f5 | ||
|
|
5290e9ca7e | ||
|
|
c361c2953f | ||
|
|
ccb7669736 | ||
|
|
f25f1485d5 | ||
|
|
55ecb06748 | ||
|
|
dc6991e5a8 | ||
|
|
738b3065dc | ||
|
|
26cc537cb1 | ||
|
|
ede354b0e6 | ||
|
|
61eabfc60c | ||
|
|
2789b770aa | ||
|
|
8718b98ee1 | ||
|
|
c8b2f987f9 | ||
|
|
52b55b826f | ||
|
|
e8c20235b8 | ||
|
|
17701628bd | ||
|
|
0efc6163f1 | ||
|
|
1e191ba815 | ||
|
|
f19d863689 | ||
|
|
4a1ef327ca | ||
|
|
025a6392ce | ||
|
|
e578c442be | ||
|
|
0cecb1bff2 | ||
|
|
5d8971c1ed | ||
|
|
a9b62d67df | ||
|
|
3525e61906 | ||
|
|
059e6c46db | ||
|
|
5cf195e0af | ||
|
|
244d1debe4 | ||
|
|
35734b42fe | ||
|
|
a3128e32c5 | ||
|
|
5f8a72bfc4 | ||
|
|
418a1cf5f3 | ||
|
|
60ebd074ac | ||
|
|
216dd363e8 | ||
|
|
141f33d24b | ||
|
|
c4d8a8183e | ||
|
|
58244eb687 | ||
|
|
e9071b0a80 | ||
|
|
c68907ece2 | ||
|
|
af3998c8a6 | ||
|
|
fad2618757 | ||
|
|
21e01dbe04 | ||
|
|
3beadeebff | ||
|
|
dcee1c3642 | ||
|
|
00d1a7e090 | ||
|
|
bbb56c2a88 | ||
|
|
5186c6964b | ||
|
|
79c66e353f | ||
|
|
41f5e8a861 | ||
|
|
c5b67927af | ||
|
|
301ecb185e | ||
|
|
151df05eeb | ||
|
|
55adcdfd07 | ||
|
|
daaa2e5911 | ||
|
|
daff119fe4 | ||
|
|
e0d1ff42c0 | ||
|
|
de413c56ae | ||
|
|
da61b0290a | ||
|
|
d03e6cedde | ||
|
|
7feb6ab962 | ||
|
|
854d4b7a53 | ||
|
|
aa5999b188 | ||
|
|
37c5eab6f8 | ||
|
|
6daa2b9aeb | ||
|
|
5a5a2e5fa0 | ||
|
|
95c43fc675 | ||
|
|
e7053c41f4 | ||
|
|
fc6d4b4010 | ||
|
|
2893588016 | ||
|
|
f2d4d816fb | ||
|
|
097d930668 | ||
|
|
7cab6824d1 | ||
|
|
f77277a69e | ||
|
|
450128f9be | ||
|
|
3e35c974a4 | ||
|
|
a14c22d4e9 | ||
|
|
58c65874ba | ||
|
|
27b0877714 | ||
|
|
5904f599a9 | ||
|
|
df9e1d9854 | ||
|
|
75a22f82bd | ||
|
|
a369130226 | ||
|
|
474024f9e6 | ||
|
|
b4f4134e81 | ||
|
|
cd64b67038 | ||
|
|
9af46df535 | ||
|
|
b749866f0b | ||
|
|
60fa708f0b | ||
|
|
3b74077437 | ||
|
|
95d4bb2130 | ||
|
|
f5dce6d960 | ||
|
|
1e98167b0e | ||
|
|
3eee2f6afa | ||
|
|
ff4b60e1f3 | ||
|
|
f91b73b938 | ||
|
|
05661c60ff | ||
|
|
625aca49de | ||
|
|
3bc0c36ace | ||
|
|
eb0219988b | ||
|
|
705f792e87 | ||
|
|
716cf74190 | ||
|
|
fc8dae2422 | ||
|
|
27353df0cc | ||
|
|
1a734adb4d | ||
|
|
a9740b9133 | ||
|
|
62651c7114 | ||
|
|
1d728fc627 | ||
|
|
62ef2a2207 | ||
|
|
37aa8442dc | ||
|
|
5b0e828c10 | ||
|
|
d5bfaef53d | ||
|
|
bad732c26a | ||
|
|
1b92c95425 | ||
|
|
d748c71845 | ||
|
|
fc88ed1262 | ||
|
|
66f93035b0 | ||
|
|
9ff999cc2b | ||
|
|
4877eccc0d | ||
|
|
f7d527cd28 | ||
|
|
e29058c346 | ||
|
|
49894330d9 | ||
|
|
cdc7d5f2ea | ||
|
|
ec201623fb | ||
|
|
386091b79a | ||
|
|
1e4b7b5451 | ||
|
|
5cd178ba70 | ||
|
|
97eb9fdee8 | ||
|
|
5a04de231e | ||
|
|
bb3509b5ff | ||
|
|
4a67905266 | ||
|
|
c4e33d3168 | ||
|
|
872cdff2ab | ||
|
|
361d7001d0 | ||
|
|
7a02eee0f4 | ||
|
|
cf45a8d807 | ||
|
|
435becbea0 | ||
|
|
0405bc74e9 | ||
|
|
4dab2a8555 | ||
|
|
3776d85e15 | ||
|
|
d01ad4c499 | ||
|
|
28025a0f36 | ||
|
|
1220f784fe | ||
|
|
28f7d31e72 | ||
|
|
66936b0fff | ||
|
|
3a5507de95 | ||
|
|
86715fecc4 | ||
|
|
3062d3e070 | ||
|
|
d89bfc32ac | ||
|
|
011c23761b | ||
|
|
a8c8d2dd79 | ||
|
|
9f7ecd65e5 | ||
|
|
f8e939d96f | ||
|
|
923af96d26 | ||
|
|
a882e958b3 | ||
|
|
2cda629c8d | ||
|
|
f033d2d8fb | ||
|
|
a4bd88ab97 | ||
|
|
f4616c8268 | ||
|
|
4712f0f3c1 | ||
|
|
6c1268f3b1 | ||
|
|
2e156b8990 | ||
|
|
3bfe6a1ef6 | ||
|
|
5c5069b622 | ||
|
|
f8c6ddd4cb | ||
|
|
e50a688ca3 | ||
|
|
334ab4707c | ||
|
|
87321942fe | ||
|
|
a771859362 | ||
|
|
31d01d404a | ||
|
|
814e83ffec | ||
|
|
4c3e65c877 | ||
|
|
98ea5b6e7e | ||
|
|
3f8c659056 | ||
|
|
3910a6e527 | ||
|
|
24892559ae | ||
|
|
cd93533b1f | ||
|
|
0590452456 | ||
|
|
93940a1859 | ||
|
|
1e439b8226 | ||
|
|
8b2f8355b2 | ||
|
|
aed03078f8 | ||
|
|
c50d65b4d6 | ||
|
|
353532b1c1 | ||
|
|
9df7c78ebe | ||
|
|
eb7555d3c6 | ||
|
|
2cd89d64e9 | ||
|
|
0517ab4695 | ||
|
|
bbf67d0fff | ||
|
|
38deb0f3ee | ||
|
|
9b6db08d21 | ||
|
|
3ae74cb047 | ||
|
|
6002500bc0 | ||
|
|
785f3589ab | ||
|
|
a419f1c50f | ||
|
|
871789ce64 | ||
|
|
df27baa00d | ||
|
|
9730008543 | ||
|
|
ac26394fcb | ||
|
|
6387b35a2d | ||
|
|
1cd4c92242 | ||
|
|
e383df4b17 | ||
|
|
58db41b4b9 | ||
|
|
5d133f2785 | ||
|
|
e9b1d3b940 | ||
|
|
3a082a0efd | ||
|
|
504fd1b373 | ||
|
|
574b2c2170 | ||
|
|
fa8b7bc4d2 | ||
|
|
6196b81e0a | ||
|
|
d884ab73d5 | ||
|
|
71d196d3cd | ||
|
|
20756e0ee4 | ||
|
|
894e638914 | ||
|
|
8113a4360e | ||
|
|
c819804638 | ||
|
|
06066dbb7b | ||
|
|
69b8ea0d66 | ||
|
|
b0455583aa | ||
|
|
ed802fd121 | ||
|
|
1593c3ed16 | ||
|
|
e89543811c | ||
|
|
1a76799fd8 | ||
|
|
fa623964a2 | ||
|
|
628102ad04 | ||
|
|
ad7ae7353f | ||
|
|
8043cfa68d | ||
|
|
d2181e9273 | ||
|
|
5e9fb3cc90 | ||
|
|
2da6d860e0 | ||
|
|
df0c1f649c | ||
|
|
d6dea3f3e0 | ||
|
|
0bcf734a67 | ||
|
|
b1c3095edd | ||
|
|
b0f565b74a | ||
|
|
2ae64f426b | ||
|
|
7933657135 | ||
|
|
caaddf0964 | ||
|
|
1a20703469 | ||
|
|
8751f48a75 | ||
|
|
58232d896e | ||
|
|
cd6415f332 | ||
|
|
c9fb8d0ce7 | ||
|
|
1e1a500603 | ||
|
|
ecc06a3d8f | ||
|
|
3205f122eb | ||
|
|
e95474df05 | ||
|
|
96a534d8c6 | ||
|
|
9579429276 | ||
|
|
2486621ca1 | ||
|
|
b5acc2203c | ||
|
|
8cc2c81d57 | ||
|
|
8d2d12d9c6 | ||
|
|
811a7e9a8b | ||
|
|
febadc5589 | ||
|
|
92c005866b | ||
|
|
224548d87d | ||
|
|
8a7bb7c6a9 | ||
|
|
22d33c57af | ||
|
|
1e0137f624 | ||
|
|
38e2f4cdda | ||
|
|
bd54b68c12 | ||
|
|
a08aa21cb3 | ||
|
|
eb9906420f | ||
|
|
4964ce480c | ||
|
|
e5687d646c | ||
|
|
a38d53fe2f | ||
|
|
6278ce51ce | ||
|
|
53b0084ce2 | ||
|
|
f74a255ca9 | ||
|
|
3e8abac625 | ||
|
|
65e99fcc2e | ||
|
|
bad025eba9 | ||
|
|
06dde3afd3 | ||
|
|
ad65af28e7 | ||
|
|
bd1bdc4f04 | ||
|
|
debcff2b6b | ||
|
|
8b3323708d | ||
|
|
3406f18746 | ||
|
|
7e576eea41 | ||
|
|
d68ebee555 | ||
|
|
ae7a3518f7 | ||
|
|
16caaa2229 | ||
|
|
91468fe455 | ||
|
|
7c6948cf6f | ||
|
|
7a568a457f | ||
|
|
3ddc69ec2b | ||
|
|
f3d5a71620 | ||
|
|
c6c56ac2cf | ||
|
|
e539efe2b9 | ||
|
|
687b758882 | ||
|
|
84e322b0fd | ||
|
|
8bc4f91fd9 | ||
|
|
93e633fb7d | ||
|
|
cbe702c09d | ||
|
|
a7a85c94b8 | ||
|
|
6e0178655b | ||
|
|
e4be557928 | ||
|
|
b9640fc7e4 | ||
|
|
29f05cb1ee | ||
|
|
48acab48ad | ||
|
|
5ae74aa881 | ||
|
|
6eddf08244 | ||
|
|
9c7e52b8a1 | ||
|
|
a824064c4c | ||
|
|
33b2795cc8 | ||
|
|
10bd044c55 | ||
|
|
c09bcfe531 | ||
|
|
83227be0ca | ||
|
|
8ee47a0533 | ||
|
|
a546e88f37 | ||
|
|
e998c9e9cb | ||
|
|
889087c966 | ||
|
|
7f3b64c7c4 | ||
|
|
e60a6e3a82 | ||
|
|
135c8f0e99 | ||
|
|
f02504bb80 | ||
|
|
40834fdf2f | ||
|
|
fc0588954b | ||
|
|
75960e3bf3 | ||
|
|
f14ac472a3 | ||
|
|
9ed93715ef | ||
|
|
b34ca44abe | ||
|
|
40ba8f3570 | ||
|
|
e543acf923 | ||
|
|
d183568644 | ||
|
|
f27eb8f09e | ||
|
|
ad0545335a | ||
|
|
cfbbae7323 | ||
|
|
940f971ca0 | ||
|
|
78ca49a1bc | ||
|
|
1d54b0e540 | ||
|
|
7e971d8302 | ||
|
|
54b3b3fe05 | ||
|
|
9d012b0621 | ||
|
|
fbb0a93e12 | ||
|
|
e2e7a8d722 | ||
|
|
ce7923adaf | ||
|
|
a26d53151b | ||
|
|
5eaef6b758 | ||
|
|
c5c38cad9c | ||
|
|
9918f389e7 | ||
|
|
dd8c424806 | ||
|
|
078d8a07cf | ||
|
|
1ee712e549 | ||
|
|
55315bdffa | ||
|
|
882b8e1e75 | ||
|
|
95edbc0ae6 | ||
|
|
11cd4fb639 | ||
|
|
9c16bd1e30 | ||
|
|
5e9d5c734e | ||
|
|
b382d1a467 | ||
|
|
23f31475e7 | ||
|
|
c0eab9e442 | ||
|
|
8a1e85d0c8 | ||
|
|
2793502db2 | ||
|
|
9f7bd0246c | ||
|
|
a6a4350d10 | ||
|
|
471b9f4dc4 | ||
|
|
24fb9b1296 | ||
|
|
3573019916 | ||
|
|
fc5b353144 | ||
|
|
1dd257b76a | ||
|
|
5fa1673341 | ||
|
|
daaa1c7e26 | ||
|
|
1fae784b81 | ||
|
|
81b7b58a5e | ||
|
|
866188a643 | ||
|
|
e6fd57165e | ||
|
|
a5d99e7a3c | ||
|
|
a92c75e5f4 | ||
|
|
826fd3350c | ||
|
|
23a2d01282 | ||
|
|
5181f9b4e1 | ||
|
|
f52ae28432 | ||
|
|
36119ff173 | ||
|
|
bb90f3bbf9 | ||
|
|
05cdb7c107 | ||
|
|
b493dabfe6 | ||
|
|
c4816f944e | ||
|
|
211136e3a8 | ||
|
|
cf0a53c501 | ||
|
|
2899984819 | ||
|
|
eafbe5c57c | ||
|
|
7b98f544ff | ||
|
|
b5aba5807c | ||
|
|
d5c4c26b4b | ||
|
|
a35b8a95c2 | ||
|
|
cded68a2e2 | ||
|
|
0068ccec35 | ||
|
|
89e8994fd1 | ||
|
|
5980b0a5ee | ||
|
|
89029a20ef | ||
|
|
ce69bd97b9 | ||
|
|
999d8651aa | ||
|
|
ed0f022502 | ||
|
|
b1307d5c2a | ||
|
|
dc16013b4f | ||
|
|
e7686dbd64 | ||
|
|
47f553f9ba | ||
|
|
d11268ece7 | ||
|
|
650a13a690 | ||
|
|
54435325b6 | ||
|
|
11fa257549 | ||
|
|
6af8ab0df2 | ||
|
|
984f5ed6eb | ||
|
|
c2061c6bbf | ||
|
|
b708e8431e | ||
|
|
9b6c397171 | ||
|
|
9b0659d4f9 | ||
|
|
f83cecaaf6 | ||
|
|
aa05b9abe5 | ||
|
|
68834cfcc3 | ||
|
|
5621373bc2 | ||
|
|
88582566bf | ||
|
|
d6e1362fee | ||
|
|
b275b8580d | ||
|
|
467be08e67 | ||
|
|
bbb422d125 | ||
|
|
b1f076558c | ||
|
|
992435aaf8 | ||
|
|
2f73e73e9d | ||
|
|
4c30a78cd9 | ||
|
|
a8c78fc005 | ||
|
|
fcb473ff64 | ||
|
|
797953c88d | ||
|
|
ce0cfb0ea5 | ||
|
|
13dfe569ef | ||
|
|
c491161c0c | ||
|
|
fde3d9133b | ||
|
|
0d582f9d3f | ||
|
|
1a59133168 | ||
|
|
803d9eb7ad | ||
|
|
a27d3c1623 | ||
|
|
551216a452 | ||
|
|
38cd3979f2 | ||
|
|
3fe602cda3 | ||
|
|
3a4b49095c | ||
|
|
ac5b395c5d | ||
|
|
8fbbca5f4b | ||
|
|
2415820ecd | ||
|
|
20103eb97b | ||
|
|
10c4ab9a3d | ||
|
|
7e39c9b950 | ||
|
|
cc063d4c32 | ||
|
|
3707e4a49c | ||
|
|
cb425ac927 | ||
|
|
0f80c827ed | ||
|
|
fffc496f41 | ||
|
|
06ae43920b | ||
|
|
e78d75a003 | ||
|
|
ec3ac0c4b0 | ||
|
|
c57c5315c1 | ||
|
|
a726530735 | ||
|
|
d9950598d0 | ||
|
|
81f0885879 | ||
|
|
65b2a10e97 | ||
|
|
7605acff65 | ||
|
|
e7f8f7fa3b | ||
|
|
72d7cb717d | ||
|
|
f0caeb9b25 | ||
|
|
76a141090e | ||
|
|
4bd5a158a5 | ||
|
|
dfaae14544 | ||
|
|
79e9baf55a | ||
|
|
a4882290aa | ||
|
|
9ee89f7868 | ||
|
|
67dbb3cf18 | ||
|
|
4260c40efa | ||
|
|
0bedea52b1 | ||
|
|
fbbab9d6c8 | ||
|
|
cccb907a9b | ||
|
|
ee7339f2c6 | ||
|
|
c51f3e35ca | ||
|
|
7b3bb9a761 | ||
|
|
dc38f22bd8 | ||
|
|
220e3e9a2b | ||
|
|
f135c0b5ee | ||
|
|
ebe6ea580d | ||
|
|
ee708040f6 | ||
|
|
61c4815a37 | ||
|
|
01bb54a94d | ||
|
|
f592c3846b | ||
|
|
c026e25088 | ||
|
|
8ba73bed23 | ||
|
|
4f8986aa48 | ||
|
|
9c87a144e8 | ||
|
|
5b9fa32255 | ||
|
|
f13778215a | ||
|
|
326471a25c | ||
|
|
6405e3a7b1 | ||
|
|
8afb625bab | ||
|
|
c59df636cc | ||
|
|
94878d76f8 | ||
|
|
5022895e2b | ||
|
|
54046e0b98 | ||
|
|
d2cb1613ac | ||
|
|
266fb93422 | ||
|
|
51d8219c46 | ||
|
|
d6af5a686c | ||
|
|
39342b0e75 | ||
|
|
54078c4cae | ||
|
|
c0bfccc15e | ||
|
|
53dc7b1649 | ||
|
|
635970b0a1 | ||
|
|
059b32c212 | ||
|
|
2704ad9110 | ||
|
|
06d247c709 | ||
|
|
974fa1b8b1 | ||
|
|
fb02744460 | ||
|
|
79732ab175 | ||
|
|
f6dbb2f3e0 | ||
|
|
fdd5b77bfd | ||
|
|
cde105e7a8 | ||
|
|
1291e82bb4 | ||
|
|
19d15d9ff7 | ||
|
|
4e27804160 | ||
|
|
bae80af1b4 | ||
|
|
f9aa3d77cd | ||
|
|
5d47ea0918 | ||
|
|
c03fa36257 | ||
|
|
1089fa0415 | ||
|
|
715786bbf9 | ||
|
|
218eca7c2b | ||
|
|
30fc791480 | ||
|
|
e2d161dfdd | ||
|
|
23d48a7cf1 | ||
|
|
cb18f2ef40 | ||
|
|
dbe2ff52b2 | ||
|
|
9db40996cc | ||
|
|
9f201d6370 | ||
|
|
0e86466f99 | ||
|
|
32548bcb4a | ||
|
|
86c54c5acc | ||
|
|
ae584332b3 | ||
|
|
1694c5bfe1 | ||
|
|
cdfbb26c00 | ||
|
|
610c036ef1 | ||
|
|
2638e2acfa | ||
|
|
49bbea5aed | ||
|
|
5fccdc9fc7 | ||
|
|
664b2c36e8 | ||
|
|
964474a1b1 | ||
|
|
ab15fc1575 | ||
|
|
99d392a4fb | ||
|
|
ae9a696607 | ||
|
|
bd51a0d35b | ||
|
|
8c191b10c2 | ||
|
|
cb6a9253fe | ||
|
|
23f97ac49d | ||
|
|
021ab50fb1 | ||
|
|
3fe906f517 | ||
|
|
a8d8a35cd3 | ||
|
|
9b77430d0d | ||
|
|
1045a43603 | ||
|
|
26af77cd1e | ||
|
|
25a9de301a | ||
|
|
e0d71f124e | ||
|
|
1c33b866ba | ||
|
|
5e650fd9e2 | ||
|
|
76275fc3ab | ||
|
|
6c3b28db64 | ||
|
|
2fe9d94470 | ||
|
|
219b473e66 | ||
|
|
7c1b30291c | ||
|
|
47e0e2342c | ||
|
|
bf4c107829 | ||
|
|
9afbdc102c | ||
|
|
370770122c | ||
|
|
143817d44e | ||
|
|
c60862fc9e | ||
|
|
bee5f919fc | ||
|
|
cefa7f04c6 | ||
|
|
03e20e6ac1 | ||
|
|
c5deeee8c7 | ||
|
|
8b1f0e2d90 | ||
|
|
9bf2dfea35 | ||
|
|
33bb847a1d | ||
|
|
bfffc3c2c6 | ||
|
|
b28956f0db | ||
|
|
d82bc3a421 | ||
|
|
06afd33291 | ||
|
|
305460b25f | ||
|
|
8c0205a84a | ||
|
|
378c05f202 | ||
|
|
cc7acd90ab | ||
|
|
a200f6fb8b | ||
|
|
2b1696f1d1 | ||
|
|
8ab17f5ce0 | ||
|
|
6ce481e95b | ||
|
|
42771c1db3 | ||
|
|
2e18a603f0 | ||
|
|
7341718f92 | ||
|
|
ef90b93205 | ||
|
|
3f7df08be9 | ||
|
|
ef6c26c730 | ||
|
|
8b3b608ba9 | ||
|
|
97918500d4 | ||
|
|
e2c0803962 | ||
|
|
f418fd5632 | ||
|
|
675a46e23e | ||
|
|
150ab07a83 | ||
|
|
6b20838981 | ||
|
|
c8af8f96ce | ||
|
|
5011465c81 | ||
|
|
f6cc228684 | ||
|
|
9f4b73b6a3 | ||
|
|
bd29004831 | ||
|
|
8aa0f9fe95 | ||
|
|
c802695ee9 | ||
|
|
225a769411 | ||
|
|
0e20382396 | ||
|
|
509bc11f81 | ||
|
|
f24207844f | ||
|
|
1ca257e356 | ||
|
|
d4cfbd020d | ||
|
|
581d5208ca | ||
|
|
a427a28fa9 | ||
|
|
0beaf04df5 | ||
|
|
80f1f1b5b8 | ||
|
|
343a564183 | ||
|
|
b0eae5e12f | ||
|
|
702f741267 | ||
|
|
665a843086 | ||
|
|
1508196c0f | ||
|
|
f6243603f8 | ||
|
|
379e40d772 | ||
|
|
6c7e9f6f3a | ||
|
|
48f88af9aa | ||
|
|
60c927cf4f | ||
|
|
069cef8a44 | ||
|
|
cf423d2769 | ||
|
|
62ddb9d3ad | ||
|
|
0b975b01fb | ||
|
|
bb90aa6cb2 | ||
|
|
ce4e47a2e3 | ||
|
|
e3677c2ba2 | ||
|
|
a653a4b887 | ||
|
|
f7edffc11a | ||
|
|
dc16488bd7 | ||
|
|
d7a072dd46 | ||
|
|
5ae91aa810 | ||
|
|
18538e359b | ||
|
|
47577ae857 | ||
|
|
d22b5f026d | ||
|
|
26cdbc20b2 | ||
|
|
360d8dd940 | ||
|
|
426815a829 | ||
|
|
c6286d1bb9 | ||
|
|
710c81984a | ||
|
|
a1dbfb5967 | ||
|
|
64cc4623b5 | ||
|
|
5eae926846 | ||
|
|
cce05c1665 | ||
|
|
34213d4446 | ||
|
|
70aeebf2df | ||
|
|
d6b14e2467 | ||
|
|
6625766350 | ||
|
|
7baf998752 | ||
|
|
1d81335ab5 | ||
|
|
f7d4665e40 | ||
|
|
bbdbc107ae | ||
|
|
0fb0135e51 | ||
|
|
02f2cf439e | ||
|
|
6d42f97644 | ||
|
|
307251bf3c | ||
|
|
074ef032ee | ||
|
|
4ca809ef4e | ||
|
|
a147ad68e6 | ||
|
|
ac2fa668cf | ||
|
|
3d6f90cb53 | ||
|
|
a554fad232 | ||
|
|
4dd0d1f67e | ||
|
|
672ee28635 | ||
|
|
e16589f8b5 | ||
|
|
83e257b468 | ||
|
|
916131be19 | ||
|
|
d2ea6700aa | ||
|
|
6bed7d469d | ||
|
|
3b75f16119 | ||
|
|
250e30bc7d | ||
|
|
e83b22159d | ||
|
|
348a84969d | ||
|
|
8ba4799b3e | ||
|
|
9640d889ba | ||
|
|
4ae7c77f8a | ||
|
|
f1751401aa | ||
|
|
f06d82b6e8 | ||
|
|
5fc656e2a0 | ||
|
|
fe01fa7249 | ||
|
|
685d79e953 | ||
|
|
be9432a893 | ||
|
|
af20191d1c | ||
|
|
47af00b245 | ||
|
|
004a9284af | ||
|
|
405b0b037c | ||
|
|
d7718d41d4 | ||
|
|
c98f616385 | ||
|
|
5069cd9798 | ||
|
|
7659321990 | ||
|
|
a992d8b733 | ||
|
|
ccaa12ee79 | ||
|
|
5687d617a3 | ||
|
|
8f1ac2ddf6 | ||
|
|
1bea2a95a8 | ||
|
|
6a7ca45ae6 | ||
|
|
8d89c3417b | ||
|
|
c48a4cc05b | ||
|
|
df9eafa92c | ||
|
|
e24d104e94 | ||
|
|
be3be32bf1 | ||
|
|
66de7bef89 | ||
|
|
d06bc3c2ca | ||
|
|
dfc72838d7 | ||
|
|
4246368a88 | ||
|
|
548d9ac726 | ||
|
|
a60fd89d1e | ||
|
|
d25a7fbb2c | ||
|
|
da0f81d36f | ||
|
|
627159acac | ||
|
|
f44aa02e26 | ||
|
|
1ca9804604 | ||
|
|
ddad871b46 | ||
|
|
d215188e4c | ||
|
|
f73ff781e7 | ||
|
|
68a9a47976 | ||
|
|
fb92bd470c | ||
|
|
02f8a24e23 | ||
|
|
467e5689ec | ||
|
|
fba752a501 | ||
|
|
87b2a9d749 | ||
|
|
8df7ccc304 | ||
|
|
2c36bf9490 | ||
|
|
bddf830083 | ||
|
|
50c1d0a43b | ||
|
|
60b8041ebb | ||
|
|
3b2a2c461d | ||
|
|
6706358a6e | ||
|
|
f6409759e5 | ||
|
|
f9d99f044d | ||
|
|
bbd5faf5cd | ||
|
|
aeb7d99d20 | ||
|
|
3695057bee | ||
|
|
4ed3afea84 | ||
|
|
3cf7c7536b | ||
|
|
85674f4bfd | ||
|
|
f2525a63c9 | ||
|
|
8c42d391f5 | ||
|
|
7f9bf91073 | ||
|
|
6ce5c01b1a | ||
|
|
a53fae1511 | ||
|
|
4626458175 | ||
|
|
9a5178e4ac | ||
|
|
68384613be | ||
|
|
4f967d5bc0 | ||
|
|
ff60859e36 | ||
|
|
020c47a055 | ||
|
|
64171db173 | ||
|
|
ad265797ab | ||
|
|
b1312a3181 | ||
|
|
a8f9f6b705 | ||
|
|
d312c677c5 | ||
|
|
5b60e51c9f | ||
|
|
7cbe1627ec | ||
|
|
d6840868d4 | ||
|
|
9b2648dd57 | ||
|
|
f954854232 | ||
|
|
6a99079012 | ||
|
|
0a8b6298cd | ||
|
|
f40209bdfb | ||
|
|
a2cb4909da | ||
|
|
7a05ba47d1 | ||
|
|
36745caa2a | ||
|
|
c2403d0f15 | ||
|
|
34e2429c49 | ||
|
|
10ba68c772 | ||
|
|
e8471256f2 | ||
|
|
43b37346b6 | ||
|
|
d199648aeb | ||
|
|
a06f40297b | ||
|
|
59c0fc28ee | ||
|
|
b22add292c | ||
|
|
67aaecacac | ||
|
|
29c202e6ab | ||
|
|
dcbf11f41a | ||
|
|
14ccff4037 | ||
|
|
5b8b874732 | ||
|
|
1d81c0266c | ||
|
|
913120759a | ||
|
|
7a6ce05d09 | ||
|
|
1dc69359d5 | ||
|
|
329fcb040b | ||
|
|
bf50d1c028 | ||
|
|
b8801dbd22 | ||
|
|
f7c6943817 | ||
|
|
91fe4db27c | ||
|
|
21d7a85e76 | ||
|
|
663e798e76 | ||
|
|
5bc2d2498d | ||
|
|
c22e34853d | ||
|
|
6825b0bbc7 | ||
|
|
3644581b55 | ||
|
|
79cc15335e | ||
|
|
ca6200121b | ||
|
|
7239b38b7f | ||
|
|
9ae8dc2d01 | ||
|
|
7164662be2 | ||
|
|
94f71f59a3 | ||
|
|
3eb6508a64 | ||
|
|
6fdb8ab90d | ||
|
|
321bf1f8e1 | ||
|
|
62bd023086 | ||
|
|
cb1a50055c | ||
|
|
65e3348232 | ||
|
|
a6b9f0dac1 | ||
|
|
34f5bdbc99 | ||
|
|
0b4fe14b0a | ||
|
|
7230cd2683 | ||
|
|
a915fe74be | ||
|
|
26d35583c5 | ||
|
|
ae17b416b8 | ||
|
|
8ffadde85c | ||
|
|
3c0ad70653 | ||
|
|
264418c0cd | ||
|
|
fa2c69f09c | ||
|
|
113304a058 | ||
|
|
8c4d49c2bc | ||
|
|
2aa6110c6e | ||
|
|
8b9b9ad31e | ||
|
|
3729fd5706 | ||
|
|
74b14a2d4e | ||
|
|
cdb951ec2f | ||
|
|
fc01cad2b8 | ||
|
|
c1ddc0ea2d | ||
|
|
319b7655b7 | ||
|
|
824c12c01a | ||
|
|
17b2900884 | ||
|
|
003010bdb6 | ||
|
|
82a4292934 | ||
|
|
eea4253d67 | ||
|
|
1eacc3c339 | ||
|
|
1a509d62a0 | ||
|
|
4c4eef46f1 | ||
|
|
d62ec7776e | ||
|
|
cb1e5d9e41 | ||
|
|
ca5f086759 | ||
|
|
57c40eb7c2 | ||
|
|
63035f977f | ||
|
|
514d2a36bc | ||
|
|
0b6fd5f612 | ||
|
|
029e7135b7 | ||
|
|
c43591f8a2 | ||
|
|
a2c22714cb | ||
|
|
312f10f797 | ||
|
|
d1f05b0f3a | ||
|
|
ccb0b320e1 | ||
|
|
5ee7edaf9e | ||
|
|
27190635ea | ||
|
|
2e340d976f | ||
|
|
fe4dfb9f6f | ||
|
|
5e3dc80999 | ||
|
|
d84cc33742 | ||
|
|
c92c462148 | ||
|
|
9ca06e0336 | ||
|
|
3b523b32f5 | ||
|
|
ba3600a515 | ||
|
|
03ce2e5288 | ||
|
|
87e23abb10 | ||
|
|
2868000c20 | ||
|
|
f38f415bf0 | ||
|
|
4341ab838e | ||
|
|
cd004cf0b2 | ||
|
|
19ae8c88b0 | ||
|
|
3dd09147c2 | ||
|
|
9581bf0670 | ||
|
|
af8aff3788 | ||
|
|
2a8a59ded9 | ||
|
|
5917ac2162 | ||
|
|
b6af4d0dc6 | ||
|
|
577139c626 | ||
|
|
c5fb6281f0 | ||
|
|
f99812443c | ||
|
|
b898c6d0ea | ||
|
|
9e7045eaec | ||
|
|
a17ac02061 | ||
|
|
57f9397677 | ||
|
|
a4c686025c | ||
|
|
face879100 | ||
|
|
605559b165 | ||
|
|
5cd4c6eb22 | ||
|
|
40358d60a0 | ||
|
|
96c1c0363d | ||
|
|
33819932ec | ||
|
|
5d6fe01465 | ||
|
|
cf27a73397 | ||
|
|
f2c492a8e6 | ||
|
|
0556774097 | ||
|
|
d9d5a0615e | ||
|
|
d72ddd71fa | ||
|
|
fb26308bc7 | ||
|
|
b41fa8e318 | ||
|
|
57b2e64345 | ||
|
|
346b3e1b8d | ||
|
|
b139bc2ef3 | ||
|
|
378b8ca241 | ||
|
|
f63bdc8e08 | ||
|
|
ce26120205 | ||
|
|
d2d5d84d1e | ||
|
|
847f1d99c9 | ||
|
|
59d08683ea | ||
|
|
f7514d9eca | ||
|
|
180ded6a27 | ||
|
|
bf601628db | ||
|
|
00e39d2114 | ||
|
|
46b74e0873 | ||
|
|
aedc4e964f | ||
|
|
e83404367c | ||
|
|
42206da1f8 | ||
|
|
44f38193c0 | ||
|
|
9a6b455bfe | ||
|
|
8063e0b5c6 | ||
|
|
157c5d77f8 | ||
|
|
ce19c051be | ||
|
|
9819eb0461 | ||
|
|
aa86fb75ad | ||
|
|
6f5a3d30fd | ||
|
|
91786d2fc1 | ||
|
|
eca11ca71a | ||
|
|
17bd16667c | ||
|
|
16c60c9ee7 | ||
|
|
0970b102e1 | ||
|
|
04074d3f4a | ||
|
|
b16ee08fd5 | ||
|
|
98874a09f7 | ||
|
|
877be7e8e0 | ||
|
|
eac50f9151 | ||
|
|
1a902b291c | ||
|
|
bbe4a04f9f | ||
|
|
b2f621b897 | ||
|
|
7202b3a325 | ||
|
|
35b44df94a | ||
|
|
10441efad1 | ||
|
|
3199383eef | ||
|
|
9f54115c5d | ||
|
|
2ecc6ae65f | ||
|
|
02b32e1ba7 | ||
|
|
34b9792654 | ||
|
|
537160dbc0 | ||
|
|
b0600664ab | ||
|
|
581a7692ff | ||
|
|
f73e4d5d31 | ||
|
|
a7743e6467 | ||
|
|
5d3dba666c | ||
|
|
bd53b651a3 | ||
|
|
46da801f30 | ||
|
|
58a99916bb | ||
|
|
c29392d085 | ||
|
|
46f243fea7 | ||
|
|
847fc9d268 | ||
|
|
489f57974d | ||
|
|
3fc3974cbc | ||
|
|
ca57248246 | ||
|
|
ee23043d64 | ||
|
|
9c1c061b84 | ||
|
|
d82b163e56 | ||
|
|
cd8e8a9928 | ||
|
|
8bdcc22541 | ||
|
|
2bdd279467 | ||
|
|
51535d8ef3 | ||
|
|
38f8714c09 | ||
|
|
4961d72c0f | ||
|
|
00cb8839ae | ||
|
|
689b1a4b3a | ||
|
|
d98be39344 | ||
|
|
039c60170d | ||
|
|
cd87d4f9d3 | ||
|
|
988c9894f2 | ||
|
|
ae614d919f | ||
|
|
65cde7f494 | ||
|
|
98325dcdc6 | ||
|
|
0788a535e2 | ||
|
|
b7fab49b64 | ||
|
|
463318486f | ||
|
|
7afb517a1a | ||
|
|
c589724729 | ||
|
|
9385714373 | ||
|
|
c90fc6a486 | ||
|
|
bc1840b196 | ||
|
|
095aeba0a7 | ||
|
|
e945436b6f | ||
|
|
6bfa82de65 | ||
|
|
d83fe4b540 | ||
|
|
81bdffc81c | ||
|
|
2549a38a71 | ||
|
|
5d48e7bd44 | ||
|
|
ec8b9810b4 | ||
|
|
65318a80f7 | ||
|
|
6a5aae9a84 | ||
|
|
1f94c48bdd | ||
|
|
01c5eb679c | ||
|
|
41612b3dbe | ||
|
|
c2d2ca3522 | ||
|
|
3a1ec27feb | ||
|
|
3c96bf8468 | ||
|
|
3ea6413407 | ||
|
|
885df8eb54 | ||
|
|
f4975ef32a | ||
|
|
37883a9f3a | ||
|
|
3c31d04666 | ||
|
|
e64548fb4d | ||
|
|
31f6f43cfc | ||
|
|
090ad8290e | ||
|
|
d1258ac19c | ||
|
|
48c1b6b338 | ||
|
|
40e4cd27a1 | ||
|
|
5a6d10cd53 | ||
|
|
527b51477d | ||
|
|
535343bf56 | ||
|
|
4394e42615 | ||
|
|
2e4c43c1cf | ||
|
|
965c751522 | ||
|
|
24bdd3c9fb | ||
|
|
01f0319192 | ||
|
|
517e6c9aa4 | ||
|
|
a4a9ea4ab0 | ||
|
|
eaa272ef7f | ||
|
|
70b636a360 | ||
|
|
a8fd0159be | ||
|
|
342436dfc4 | ||
|
|
77a462c930 | ||
|
|
9965d385de | ||
|
|
f0f1e51c5c | ||
|
|
4712c18a58 | ||
|
|
9e156ea168 | ||
|
|
68f4aa220e | ||
|
|
3a0e00dd7f | ||
|
|
66b4e5e020 | ||
|
|
8b8d4fa066 | ||
|
|
6253ef0c27 | ||
|
|
c6ebc7ff7c | ||
|
|
985663620f | ||
|
|
c796b9a19e | ||
|
|
6ea108a03b | ||
|
|
280eb16e77 | ||
|
|
930e94a3ea | ||
|
|
629e866ff0 | ||
|
|
c08fa5675f | ||
|
|
cc50b778eb | ||
|
|
00fa68b3a7 | ||
|
|
288eb044cb | ||
|
|
59ca4543d8 | ||
|
|
650d0dbe54 | ||
|
|
a5ec741cff | ||
|
|
fff98636f7 | ||
|
|
c72642dd35 | ||
|
|
f2d4ced8ea | ||
|
|
ae7e2eb3fb | ||
|
|
a32ffaba35 | ||
|
|
a4e75a0794 | ||
|
|
35350b1d25 | ||
|
|
263dcf75b5 | ||
|
|
7994dce0f2 | ||
|
|
fbfa148e4e | ||
|
|
9d57f21f9f | ||
|
|
3deee3a02b | ||
|
|
2002f08f2e | ||
|
|
c307505f8b | ||
|
|
6359d00fb4 | ||
|
|
b969066a20 | ||
|
|
500dcfc586 | ||
|
|
7b8dc8065e | ||
|
|
e89527c9f0 | ||
|
|
aa2239d5de | ||
|
|
8daeacc989 | ||
|
|
81d3ac3bf0 | ||
|
|
eb6f1dada8 | ||
|
|
8e9e79d276 | ||
|
|
38014fe448 | ||
|
|
8942fc21aa | ||
|
|
7f45943a9e | ||
|
|
6e1400fc45 | ||
|
|
bf26c08d51 | ||
|
|
29f7dc073b | ||
|
|
5e1b513527 | ||
|
|
f549fde874 | ||
|
|
6dfb30448c | ||
|
|
b5b5f7e019 | ||
|
|
ae7b49b034 | ||
|
|
f151c660b1 | ||
|
|
c3ef69c866 | ||
|
|
363891126c | ||
|
|
1989704abe | ||
|
|
f0a9ebfed4 | ||
|
|
7e32f80d82 | ||
|
|
966d9cfa41 | ||
|
|
92e820fdc8 | ||
|
|
c4b3971548 | ||
|
|
3faabdadb7 | ||
|
|
93a139315c | ||
|
|
10ca1ace6b | ||
|
|
c3dfd08ba8 | ||
|
|
510a1e8140 | ||
|
|
159ede2d5c | ||
|
|
291a857fb8 | ||
|
|
57a5236e71 | ||
|
|
23c8656080 | ||
|
|
ec3ae17e4d | ||
|
|
69d047ae7d | ||
|
|
327f62526a | ||
|
|
d540d363a7 | ||
|
|
db93891373 | ||
|
|
0f488996b3 | ||
|
|
a6f524ca08 | ||
|
|
811c7e2494 | ||
|
|
ebaa99aba2 | ||
|
|
d66e6dc25f | ||
|
|
336d28f112 | ||
|
|
916afb5220 | ||
|
|
5daf2fa7f0 | ||
|
|
733a3bd031 | ||
|
|
2e8e278441 | ||
|
|
0bae38c062 | ||
|
|
a09b086729 | ||
|
|
df1c6c9e8d | ||
|
|
789d86f7b0 | ||
|
|
e148b318b7 | ||
|
|
0cad775427 | ||
|
|
00d6841f84 | ||
|
|
8a8f7b3e90 | ||
|
|
c526caae7b | ||
|
|
b1c07488bd | ||
|
|
92f8e03160 | ||
|
|
f6fd43e574 | ||
|
|
854484babf | ||
|
|
e4ff1ea778 | ||
|
|
26fb6b8788 | ||
|
|
4214ae205d | ||
|
|
d9d4f895bc | ||
|
|
48db7cf07a | ||
|
|
802d165572 | ||
|
|
f7f41dc3a0 | ||
|
|
1fcfb69bf7 | ||
|
|
fa96cb9c6e | ||
|
|
cc30bfc94b | ||
|
|
880c0a7477 | ||
|
|
eabf3caeb9 | ||
|
|
c9326fc199 | ||
|
|
d7481f4593 | ||
|
|
f3f728ec27 | ||
|
|
c619caefdd | ||
|
|
c559af51ce | ||
|
|
d1e0a4640c | ||
|
|
f9e71ec515 | ||
|
|
ef538c9707 | ||
|
|
2f405daa98 | ||
|
|
a9c85b7c27 | ||
|
|
897d83c589 | ||
|
|
0a125e5d4d | ||
|
|
38d2276592 | ||
|
|
d58004a864 | ||
|
|
5fd833aa18 |
@@ -13,3 +13,4 @@ R44VC0RP
|
|||||||
rekram1-node
|
rekram1-node
|
||||||
RhysSullivan
|
RhysSullivan
|
||||||
thdxr
|
thdxr
|
||||||
|
simonklee
|
||||||
|
|||||||
@@ -11,9 +11,14 @@ adamdotdevin
|
|||||||
-agusbasari29 AI PR slop
|
-agusbasari29 AI PR slop
|
||||||
ariane-emory
|
ariane-emory
|
||||||
-atharvau AI review spamming literally every PR
|
-atharvau AI review spamming literally every PR
|
||||||
|
-borealbytes
|
||||||
|
-carycooper777
|
||||||
-danieljoshuanazareth
|
-danieljoshuanazareth
|
||||||
-danieljoshuanazareth
|
-danieljoshuanazareth
|
||||||
|
-davidbernat looks to be a clawdbot that spams team and sends super weird emails, doesnt appear to be a real person
|
||||||
|
dmtrkovalenko
|
||||||
edemaine
|
edemaine
|
||||||
|
fahreddinozcan
|
||||||
-florianleibert
|
-florianleibert
|
||||||
fwang
|
fwang
|
||||||
iamdavidhill
|
iamdavidhill
|
||||||
@@ -24,7 +29,13 @@ kommander
|
|||||||
-opencodeengineer bot that spams issues
|
-opencodeengineer bot that spams issues
|
||||||
r44vc0rp
|
r44vc0rp
|
||||||
rekram1-node
|
rekram1-node
|
||||||
|
-ricardo-m-l
|
||||||
-robinmordasiewicz
|
-robinmordasiewicz
|
||||||
|
rubdos
|
||||||
|
-saisharan0103 spamming ai prs
|
||||||
|
shantur
|
||||||
|
simonklee
|
||||||
-spider-yamet clawdbot/llm psychosis, spam pinging the team
|
-spider-yamet clawdbot/llm psychosis, spam pinging the team
|
||||||
|
-terisuke
|
||||||
thdxr
|
thdxr
|
||||||
-toastythebot
|
-toastythebot
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
name: "Setup Bun"
|
name: "Setup Bun"
|
||||||
description: "Setup Bun with caching and install dependencies"
|
description: "Setup Bun with caching and install dependencies"
|
||||||
|
inputs:
|
||||||
|
install-flags:
|
||||||
|
description: "Additional flags to pass to 'bun install'"
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@@ -46,8 +51,8 @@ runs:
|
|||||||
# e.g. ./patches/ for standard-openapi
|
# e.g. ./patches/ for standard-openapi
|
||||||
# https://github.com/oven-sh/bun/issues/28147
|
# https://github.com/oven-sh/bun/issues/28147
|
||||||
if [ "$RUNNER_OS" = "Windows" ]; then
|
if [ "$RUNNER_OS" = "Windows" ]; then
|
||||||
bun install --linker hoisted
|
bun install --linker hoisted ${{ inputs.install-flags }}
|
||||||
else
|
else
|
||||||
bun install
|
bun install ${{ inputs.install-flags }}
|
||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -36,3 +36,9 @@ jobs:
|
|||||||
PLANETSCALE_SERVICE_TOKEN_NAME: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_NAME }}
|
PLANETSCALE_SERVICE_TOKEN_NAME: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_NAME }}
|
||||||
PLANETSCALE_SERVICE_TOKEN: ${{ secrets.PLANETSCALE_SERVICE_TOKEN }}
|
PLANETSCALE_SERVICE_TOKEN: ${{ secrets.PLANETSCALE_SERVICE_TOKEN }}
|
||||||
STRIPE_SECRET_KEY: ${{ github.ref_name == 'production' && secrets.STRIPE_SECRET_KEY_PROD || secrets.STRIPE_SECRET_KEY_DEV }}
|
STRIPE_SECRET_KEY: ${{ github.ref_name == 'production' && secrets.STRIPE_SECRET_KEY_PROD || secrets.STRIPE_SECRET_KEY_DEV }}
|
||||||
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
|
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
|
||||||
|
SENTRY_PROJECT: ${{ vars.WEB_SENTRY_PROJECT }}
|
||||||
|
SENTRY_RELEASE: web@${{ github.sha }}
|
||||||
|
VITE_SENTRY_DSN: ${{ vars.WEB_SENTRY_DSN }}
|
||||||
|
VITE_SENTRY_RELEASE: web@${{ github.sha }}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
id: build
|
id: build
|
||||||
run: |
|
run: |
|
||||||
./packages/opencode/script/build.ts
|
./packages/opencode/script/build.ts ${{ (github.ref_name == 'beta' && '--sourcemaps') || '' }}
|
||||||
env:
|
env:
|
||||||
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
|
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
|
||||||
OPENCODE_RELEASE: ${{ needs.version.outputs.release }}
|
OPENCODE_RELEASE: ${{ needs.version.outputs.release }}
|
||||||
@@ -389,6 +389,7 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- build-cli
|
- build-cli
|
||||||
- version
|
- version
|
||||||
|
if: github.repository == 'anomalyco/opencode'
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
env:
|
env:
|
||||||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
|
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
@@ -401,12 +402,14 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
settings:
|
settings:
|
||||||
- host: macos-latest
|
- host: macos-26-intel
|
||||||
target: x86_64-apple-darwin
|
target: x86_64-apple-darwin
|
||||||
platform_flag: --mac --x64
|
platform_flag: --mac --x64
|
||||||
- host: macos-latest
|
bun_install_flags: --os=darwin --cpu=x64
|
||||||
|
- host: macos-26
|
||||||
target: aarch64-apple-darwin
|
target: aarch64-apple-darwin
|
||||||
platform_flag: --mac --arm64
|
platform_flag: --mac --arm64
|
||||||
|
bun_install_flags: --os=darwin --cpu=arm64
|
||||||
# github-hosted: blacksmith lacks ARM64 MSVC cross-compilation toolchain
|
# github-hosted: blacksmith lacks ARM64 MSVC cross-compilation toolchain
|
||||||
- host: "windows-2025"
|
- host: "windows-2025"
|
||||||
target: aarch64-pc-windows-msvc
|
target: aarch64-pc-windows-msvc
|
||||||
@@ -421,7 +424,6 @@ jobs:
|
|||||||
target: aarch64-unknown-linux-gnu
|
target: aarch64-unknown-linux-gnu
|
||||||
platform_flag: --linux
|
platform_flag: --linux
|
||||||
runs-on: ${{ matrix.settings.host }}
|
runs-on: ${{ matrix.settings.host }}
|
||||||
# if: github.ref_name == 'beta'
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
@@ -437,6 +439,8 @@ jobs:
|
|||||||
run: echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
|
run: echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
|
||||||
|
|
||||||
- uses: ./.github/actions/setup-bun
|
- uses: ./.github/actions/setup-bun
|
||||||
|
with:
|
||||||
|
install-flags: ${{ matrix.settings.bun_install_flags }}
|
||||||
|
|
||||||
- name: Azure login
|
- name: Azure login
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
@@ -490,6 +494,13 @@ jobs:
|
|||||||
working-directory: packages/desktop-electron
|
working-directory: packages/desktop-electron
|
||||||
env:
|
env:
|
||||||
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
|
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
|
||||||
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
|
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
|
||||||
|
SENTRY_PROJECT: ${{ vars.WEB_SENTRY_PROJECT }}
|
||||||
|
SENTRY_RELEASE: desktop@${{ needs.version.outputs.version }}
|
||||||
|
VITE_SENTRY_DSN: ${{ vars.WEB_SENTRY_DSN }}
|
||||||
|
VITE_SENTRY_ENVIRONMENT: ${{ (github.ref_name == 'beta' && 'beta') || 'production' }}
|
||||||
|
VITE_SENTRY_RELEASE: desktop@${{ needs.version.outputs.version }}
|
||||||
|
|
||||||
- name: Package and publish
|
- name: Package and publish
|
||||||
if: needs.version.outputs.release
|
if: needs.version.outputs.release
|
||||||
@@ -547,6 +558,7 @@ jobs:
|
|||||||
- sign-cli-windows
|
- sign-cli-windows
|
||||||
- build-tauri
|
- build-tauri
|
||||||
- build-electron
|
- build-electron
|
||||||
|
if: always() && !failure() && !cancelled()
|
||||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Check PR guidelines compliance
|
- name: Check PR guidelines compliance
|
||||||
env:
|
env:
|
||||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
OPENCODE_PERMISSION: '{ "bash": { "*": "deny", "gh*": "allow", "gh pr review*": "deny" } }'
|
OPENCODE_PERMISSION: '{ "bash": { "*": "deny", "gh*": "allow", "gh pr review*": "deny" } }'
|
||||||
PR_TITLE: ${{ steps.pr-details.outputs.title }}
|
PR_TITLE: ${{ steps.pr-details.outputs.title }}
|
||||||
run: |
|
run: |
|
||||||
PR_BODY=$(jq -r .body pr_data.json)
|
PR_BODY=$(jq -r .body pr_data.json)
|
||||||
opencode run -m anthropic/claude-opus-4-5 "A new pull request has been created: '${PR_TITLE}'
|
opencode run -m opencode/gpt-5.5 --variant medium "A new pull request has been created: '${PR_TITLE}'
|
||||||
|
|
||||||
<pr-number>
|
<pr-number>
|
||||||
${{ steps.pr-number.outputs.number }}
|
${{ steps.pr-number.outputs.number }}
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ concurrency:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
checks: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unit:
|
unit:
|
||||||
@@ -37,6 +41,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "24"
|
||||||
|
|
||||||
- name: Setup Bun
|
- name: Setup Bun
|
||||||
uses: ./.github/actions/setup-bun
|
uses: ./.github/actions/setup-bun
|
||||||
|
|
||||||
@@ -45,8 +54,39 @@ jobs:
|
|||||||
git config --global user.email "bot@opencode.ai"
|
git config --global user.email "bot@opencode.ai"
|
||||||
git config --global user.name "opencode"
|
git config --global user.name "opencode"
|
||||||
|
|
||||||
|
- name: Cache Turbo
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: node_modules/.cache/turbo
|
||||||
|
key: turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-
|
||||||
|
turbo-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: bun turbo test
|
run: bun turbo test:ci
|
||||||
|
env:
|
||||||
|
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
|
||||||
|
|
||||||
|
- name: Publish unit reports
|
||||||
|
if: always()
|
||||||
|
uses: mikepenz/action-junit-report@v6
|
||||||
|
with:
|
||||||
|
report_paths: packages/*/.artifacts/unit/junit.xml
|
||||||
|
check_name: "unit results (${{ matrix.settings.name }})"
|
||||||
|
detailed_summary: true
|
||||||
|
include_time_in_summary: true
|
||||||
|
fail_on_failure: false
|
||||||
|
|
||||||
|
- name: Upload unit artifacts
|
||||||
|
if: always()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: unit-${{ matrix.settings.name }}-${{ github.run_attempt }}
|
||||||
|
include-hidden-files: true
|
||||||
|
if-no-files-found: ignore
|
||||||
|
retention-days: 7
|
||||||
|
path: packages/*/.artifacts/unit/junit.xml
|
||||||
|
|
||||||
e2e:
|
e2e:
|
||||||
name: e2e (${{ matrix.settings.name }})
|
name: e2e (${{ matrix.settings.name }})
|
||||||
@@ -70,13 +110,18 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "24"
|
||||||
|
|
||||||
- name: Setup Bun
|
- name: Setup Bun
|
||||||
uses: ./.github/actions/setup-bun
|
uses: ./.github/actions/setup-bun
|
||||||
|
|
||||||
- name: Read Playwright version
|
- name: Read Playwright version
|
||||||
id: playwright-version
|
id: playwright-version
|
||||||
run: |
|
run: |
|
||||||
version=$(node -e 'console.log(require("./packages/app/package.json").devDependencies["@playwright/test"])')
|
version=$(node -e 'console.log(require("./package.json").workspaces.catalog["@playwright/test"])')
|
||||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Cache Playwright browsers
|
- name: Cache Playwright browsers
|
||||||
@@ -100,18 +145,17 @@ jobs:
|
|||||||
run: bun --cwd packages/app test:e2e:local
|
run: bun --cwd packages/app test:e2e:local
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
|
PLAYWRIGHT_JUNIT_OUTPUT: e2e/junit-${{ matrix.settings.name }}.xml
|
||||||
OPENCODE_E2E_MODEL: opencode/claude-haiku-4-5
|
|
||||||
OPENCODE_E2E_REQUIRE_PAID: "true"
|
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
|
|
||||||
- name: Upload Playwright artifacts
|
- name: Upload Playwright artifacts
|
||||||
if: failure()
|
if: always()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
|
name: playwright-${{ matrix.settings.name }}-${{ github.run_attempt }}
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
path: |
|
path: |
|
||||||
|
packages/app/e2e/junit-*.xml
|
||||||
packages/app/e2e/test-results
|
packages/app/e2e/test-results
|
||||||
packages/app/e2e/playwright-report
|
packages/app/e2e/playwright-report
|
||||||
|
|||||||
@@ -3,4 +3,5 @@ plans
|
|||||||
package.json
|
package.json
|
||||||
bun.lock
|
bun.lock
|
||||||
.gitignore
|
.gitignore
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
references/
|
||||||
|
|||||||
@@ -1,900 +0,0 @@
|
|||||||
---
|
|
||||||
description: Translate content for a specified locale while preserving technical terms
|
|
||||||
mode: subagent
|
|
||||||
model: opencode/gpt-5.4
|
|
||||||
---
|
|
||||||
|
|
||||||
You are a professional translator and localization specialist.
|
|
||||||
|
|
||||||
Translate the user's content into the requested target locale (language + region, e.g. fr-FR, de-DE).
|
|
||||||
|
|
||||||
Requirements:
|
|
||||||
|
|
||||||
- Preserve meaning, intent, tone, and formatting (including Markdown/MDX structure).
|
|
||||||
- Preserve all technical terms and artifacts exactly: product/company names, API names, identifiers, code, commands/flags, file paths, URLs, versions, error messages, config keys/values, and anything inside inline code or code blocks.
|
|
||||||
- Also preserve every term listed in the Do-Not-Translate glossary below.
|
|
||||||
- Also apply locale-specific guidance from `.opencode/glossary/<locale>.md` when available (for example, `zh-cn.md`).
|
|
||||||
- Do not modify fenced code blocks.
|
|
||||||
- Output ONLY the translation (no commentary).
|
|
||||||
|
|
||||||
If the target locale is missing, ask the user to provide it.
|
|
||||||
If no locale-specific glossary exists, use the global glossary only.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Locale-Specific Glossaries
|
|
||||||
|
|
||||||
When a locale glossary exists, use it to:
|
|
||||||
|
|
||||||
- Apply preferred wording for recurring UI/docs terms in that locale
|
|
||||||
- Preserve locale-specific do-not-translate terms and casing decisions
|
|
||||||
- Prefer natural phrasing over literal translation when the locale file calls it out
|
|
||||||
- If the repo uses a locale alias slug, apply that file too (for example, `pt-BR` maps to `br.md` in this repo)
|
|
||||||
|
|
||||||
Locale guidance does not override code/command preservation rules or the global Do-Not-Translate glossary below.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Do-Not-Translate Terms (OpenCode Docs)
|
|
||||||
|
|
||||||
Generated from: `packages/web/src/content/docs/*.mdx` (default English docs)
|
|
||||||
Generated on: 2026-02-10
|
|
||||||
|
|
||||||
Use this as a translation QA checklist / glossary. Preserve listed terms exactly (spelling, casing, punctuation).
|
|
||||||
|
|
||||||
General rules (verbatim, even if not listed below):
|
|
||||||
|
|
||||||
- Anything inside inline code (single backticks) or fenced code blocks (triple backticks)
|
|
||||||
- MDX/JS code in docs: `import ... from "..."`, component tags, identifiers
|
|
||||||
- CLI commands, flags, config keys/values, file paths, URLs/domains, and env vars
|
|
||||||
|
|
||||||
## Proper nouns and product names
|
|
||||||
|
|
||||||
Additional (not reliably captured via link text):
|
|
||||||
|
|
||||||
```text
|
|
||||||
Astro
|
|
||||||
Bun
|
|
||||||
Chocolatey
|
|
||||||
Cursor
|
|
||||||
Docker
|
|
||||||
Git
|
|
||||||
GitHub Actions
|
|
||||||
GitLab CI
|
|
||||||
GNOME Terminal
|
|
||||||
Homebrew
|
|
||||||
Mise
|
|
||||||
Neovim
|
|
||||||
Node.js
|
|
||||||
npm
|
|
||||||
Obsidian
|
|
||||||
opencode
|
|
||||||
opencode-ai
|
|
||||||
Paru
|
|
||||||
pnpm
|
|
||||||
ripgrep
|
|
||||||
Scoop
|
|
||||||
SST
|
|
||||||
Starlight
|
|
||||||
Visual Studio Code
|
|
||||||
VS Code
|
|
||||||
VSCodium
|
|
||||||
Windsurf
|
|
||||||
Windows Terminal
|
|
||||||
Yarn
|
|
||||||
Zellij
|
|
||||||
Zed
|
|
||||||
anomalyco
|
|
||||||
```
|
|
||||||
|
|
||||||
Extracted from link labels in the English docs (review and prune as desired):
|
|
||||||
|
|
||||||
```text
|
|
||||||
@openspoon/subtask2
|
|
||||||
302.AI console
|
|
||||||
ACP progress report
|
|
||||||
Agent Client Protocol
|
|
||||||
Agent Skills
|
|
||||||
Agentic
|
|
||||||
AGENTS.md
|
|
||||||
AI SDK
|
|
||||||
Alacritty
|
|
||||||
Anthropic
|
|
||||||
Anthropic's Data Policies
|
|
||||||
Atom One
|
|
||||||
Avante.nvim
|
|
||||||
Ayu
|
|
||||||
Azure AI Foundry
|
|
||||||
Azure portal
|
|
||||||
Baseten
|
|
||||||
built-in GITHUB_TOKEN
|
|
||||||
Bun.$
|
|
||||||
Catppuccin
|
|
||||||
Cerebras console
|
|
||||||
ChatGPT Plus or Pro
|
|
||||||
Cloudflare dashboard
|
|
||||||
CodeCompanion.nvim
|
|
||||||
CodeNomad
|
|
||||||
Configuring Adapters: Environment Variables
|
|
||||||
Context7 MCP server
|
|
||||||
Cortecs console
|
|
||||||
Deep Infra dashboard
|
|
||||||
DeepSeek console
|
|
||||||
Duo Agent Platform
|
|
||||||
Everforest
|
|
||||||
Fireworks AI console
|
|
||||||
Firmware dashboard
|
|
||||||
Ghostty
|
|
||||||
GitLab CLI agents docs
|
|
||||||
GitLab docs
|
|
||||||
GitLab User Settings > Access Tokens
|
|
||||||
Granular Rules (Object Syntax)
|
|
||||||
Grep by Vercel
|
|
||||||
Groq console
|
|
||||||
Gruvbox
|
|
||||||
Helicone
|
|
||||||
Helicone documentation
|
|
||||||
Helicone Header Directory
|
|
||||||
Helicone's Model Directory
|
|
||||||
Hugging Face Inference Providers
|
|
||||||
Hugging Face settings
|
|
||||||
install WSL
|
|
||||||
IO.NET console
|
|
||||||
JetBrains IDE
|
|
||||||
Kanagawa
|
|
||||||
Kitty
|
|
||||||
MiniMax API Console
|
|
||||||
Models.dev
|
|
||||||
Moonshot AI console
|
|
||||||
Nebius Token Factory console
|
|
||||||
Nord
|
|
||||||
OAuth
|
|
||||||
Ollama integration docs
|
|
||||||
OpenAI's Data Policies
|
|
||||||
OpenChamber
|
|
||||||
OpenCode
|
|
||||||
OpenCode config
|
|
||||||
OpenCode Config
|
|
||||||
OpenCode TUI with the opencode theme
|
|
||||||
OpenCode Web - Active Session
|
|
||||||
OpenCode Web - New Session
|
|
||||||
OpenCode Web - See Servers
|
|
||||||
OpenCode Zen
|
|
||||||
OpenCode-Obsidian
|
|
||||||
OpenRouter dashboard
|
|
||||||
OpenWork
|
|
||||||
OVHcloud panel
|
|
||||||
Pro+ subscription
|
|
||||||
SAP BTP Cockpit
|
|
||||||
Scaleway Console IAM settings
|
|
||||||
Scaleway Generative APIs
|
|
||||||
SDK documentation
|
|
||||||
Sentry MCP server
|
|
||||||
shell API
|
|
||||||
Together AI console
|
|
||||||
Tokyonight
|
|
||||||
Unified Billing
|
|
||||||
Venice AI console
|
|
||||||
Vercel dashboard
|
|
||||||
WezTerm
|
|
||||||
Windows Subsystem for Linux (WSL)
|
|
||||||
WSL
|
|
||||||
WSL (Windows Subsystem for Linux)
|
|
||||||
WSL extension
|
|
||||||
xAI console
|
|
||||||
Z.AI API console
|
|
||||||
Zed
|
|
||||||
ZenMux dashboard
|
|
||||||
Zod
|
|
||||||
```
|
|
||||||
|
|
||||||
## Acronyms and initialisms
|
|
||||||
|
|
||||||
```text
|
|
||||||
ACP
|
|
||||||
AGENTS
|
|
||||||
AI
|
|
||||||
AI21
|
|
||||||
ANSI
|
|
||||||
API
|
|
||||||
AST
|
|
||||||
AWS
|
|
||||||
BTP
|
|
||||||
CD
|
|
||||||
CDN
|
|
||||||
CI
|
|
||||||
CLI
|
|
||||||
CMD
|
|
||||||
CORS
|
|
||||||
DEBUG
|
|
||||||
EKS
|
|
||||||
ERROR
|
|
||||||
FAQ
|
|
||||||
GLM
|
|
||||||
GNOME
|
|
||||||
GPT
|
|
||||||
HTML
|
|
||||||
HTTP
|
|
||||||
HTTPS
|
|
||||||
IAM
|
|
||||||
ID
|
|
||||||
IDE
|
|
||||||
INFO
|
|
||||||
IO
|
|
||||||
IP
|
|
||||||
IRSA
|
|
||||||
JS
|
|
||||||
JSON
|
|
||||||
JSONC
|
|
||||||
K2
|
|
||||||
LLM
|
|
||||||
LM
|
|
||||||
LSP
|
|
||||||
M2
|
|
||||||
MCP
|
|
||||||
MR
|
|
||||||
NET
|
|
||||||
NPM
|
|
||||||
NTLM
|
|
||||||
OIDC
|
|
||||||
OS
|
|
||||||
PAT
|
|
||||||
PATH
|
|
||||||
PHP
|
|
||||||
PR
|
|
||||||
PTY
|
|
||||||
README
|
|
||||||
RFC
|
|
||||||
RPC
|
|
||||||
SAP
|
|
||||||
SDK
|
|
||||||
SKILL
|
|
||||||
SSE
|
|
||||||
SSO
|
|
||||||
TS
|
|
||||||
TTY
|
|
||||||
TUI
|
|
||||||
UI
|
|
||||||
URL
|
|
||||||
US
|
|
||||||
UX
|
|
||||||
VCS
|
|
||||||
VPC
|
|
||||||
VPN
|
|
||||||
VS
|
|
||||||
WARN
|
|
||||||
WSL
|
|
||||||
X11
|
|
||||||
YAML
|
|
||||||
```
|
|
||||||
|
|
||||||
## Code identifiers used in prose (CamelCase, mixedCase)
|
|
||||||
|
|
||||||
```text
|
|
||||||
apiKey
|
|
||||||
AppleScript
|
|
||||||
AssistantMessage
|
|
||||||
baseURL
|
|
||||||
BurntSushi
|
|
||||||
ChatGPT
|
|
||||||
ClangFormat
|
|
||||||
CodeCompanion
|
|
||||||
CodeNomad
|
|
||||||
DeepSeek
|
|
||||||
DefaultV2
|
|
||||||
FileContent
|
|
||||||
FileDiff
|
|
||||||
FileNode
|
|
||||||
fineGrained
|
|
||||||
FormatterStatus
|
|
||||||
GitHub
|
|
||||||
GitLab
|
|
||||||
iTerm2
|
|
||||||
JavaScript
|
|
||||||
JetBrains
|
|
||||||
macOS
|
|
||||||
mDNS
|
|
||||||
MiniMax
|
|
||||||
NeuralNomadsAI
|
|
||||||
NickvanDyke
|
|
||||||
NoeFabris
|
|
||||||
OpenAI
|
|
||||||
OpenAPI
|
|
||||||
OpenChamber
|
|
||||||
OpenCode
|
|
||||||
OpenRouter
|
|
||||||
OpenTUI
|
|
||||||
OpenWork
|
|
||||||
ownUserPermissions
|
|
||||||
PowerShell
|
|
||||||
ProviderAuthAuthorization
|
|
||||||
ProviderAuthMethod
|
|
||||||
ProviderInitError
|
|
||||||
SessionStatus
|
|
||||||
TabItem
|
|
||||||
tokenType
|
|
||||||
ToolIDs
|
|
||||||
ToolList
|
|
||||||
TypeScript
|
|
||||||
typesUrl
|
|
||||||
UserMessage
|
|
||||||
VcsInfo
|
|
||||||
WebView2
|
|
||||||
WezTerm
|
|
||||||
xAI
|
|
||||||
ZenMux
|
|
||||||
```
|
|
||||||
|
|
||||||
## OpenCode CLI commands (as shown in docs)
|
|
||||||
|
|
||||||
```text
|
|
||||||
opencode
|
|
||||||
opencode [project]
|
|
||||||
opencode /path/to/project
|
|
||||||
opencode acp
|
|
||||||
opencode agent [command]
|
|
||||||
opencode agent create
|
|
||||||
opencode agent list
|
|
||||||
opencode attach [url]
|
|
||||||
opencode attach http://10.20.30.40:4096
|
|
||||||
opencode attach http://localhost:4096
|
|
||||||
opencode auth [command]
|
|
||||||
opencode auth list
|
|
||||||
opencode auth login
|
|
||||||
opencode auth logout
|
|
||||||
opencode auth ls
|
|
||||||
opencode export [sessionID]
|
|
||||||
opencode github [command]
|
|
||||||
opencode github install
|
|
||||||
opencode github run
|
|
||||||
opencode import <file>
|
|
||||||
opencode import https://opncd.ai/s/abc123
|
|
||||||
opencode import session.json
|
|
||||||
opencode mcp [command]
|
|
||||||
opencode mcp add
|
|
||||||
opencode mcp auth [name]
|
|
||||||
opencode mcp auth list
|
|
||||||
opencode mcp auth ls
|
|
||||||
opencode mcp auth my-oauth-server
|
|
||||||
opencode mcp auth sentry
|
|
||||||
opencode mcp debug <name>
|
|
||||||
opencode mcp debug my-oauth-server
|
|
||||||
opencode mcp list
|
|
||||||
opencode mcp logout [name]
|
|
||||||
opencode mcp logout my-oauth-server
|
|
||||||
opencode mcp ls
|
|
||||||
opencode models --refresh
|
|
||||||
opencode models [provider]
|
|
||||||
opencode models anthropic
|
|
||||||
opencode run [message..]
|
|
||||||
opencode run Explain the use of context in Go
|
|
||||||
opencode serve
|
|
||||||
opencode serve --cors http://localhost:5173 --cors https://app.example.com
|
|
||||||
opencode serve --hostname 0.0.0.0 --port 4096
|
|
||||||
opencode serve [--port <number>] [--hostname <string>] [--cors <origin>]
|
|
||||||
opencode session [command]
|
|
||||||
opencode session list
|
|
||||||
opencode session delete <sessionID>
|
|
||||||
opencode stats
|
|
||||||
opencode uninstall
|
|
||||||
opencode upgrade
|
|
||||||
opencode upgrade [target]
|
|
||||||
opencode upgrade v0.1.48
|
|
||||||
opencode web
|
|
||||||
opencode web --cors https://example.com
|
|
||||||
opencode web --hostname 0.0.0.0
|
|
||||||
opencode web --mdns
|
|
||||||
opencode web --mdns --mdns-domain myproject.local
|
|
||||||
opencode web --port 4096
|
|
||||||
opencode web --port 4096 --hostname 0.0.0.0
|
|
||||||
opencode.server.close()
|
|
||||||
```
|
|
||||||
|
|
||||||
## Slash commands and routes
|
|
||||||
|
|
||||||
```text
|
|
||||||
/agent
|
|
||||||
/auth/:id
|
|
||||||
/clear
|
|
||||||
/command
|
|
||||||
/config
|
|
||||||
/config/providers
|
|
||||||
/connect
|
|
||||||
/continue
|
|
||||||
/doc
|
|
||||||
/editor
|
|
||||||
/event
|
|
||||||
/experimental/tool?provider=<p>&model=<m>
|
|
||||||
/experimental/tool/ids
|
|
||||||
/export
|
|
||||||
/file?path=<path>
|
|
||||||
/file/content?path=<p>
|
|
||||||
/file/status
|
|
||||||
/find?pattern=<pat>
|
|
||||||
/find/file
|
|
||||||
/find/file?query=<q>
|
|
||||||
/find/symbol?query=<q>
|
|
||||||
/formatter
|
|
||||||
/global/event
|
|
||||||
/global/health
|
|
||||||
/help
|
|
||||||
/init
|
|
||||||
/instance/dispose
|
|
||||||
/log
|
|
||||||
/lsp
|
|
||||||
/mcp
|
|
||||||
/mnt/
|
|
||||||
/mnt/c/
|
|
||||||
/mnt/d/
|
|
||||||
/models
|
|
||||||
/oc
|
|
||||||
/opencode
|
|
||||||
/path
|
|
||||||
/project
|
|
||||||
/project/current
|
|
||||||
/provider
|
|
||||||
/provider/{id}/oauth/authorize
|
|
||||||
/provider/{id}/oauth/callback
|
|
||||||
/provider/auth
|
|
||||||
/q
|
|
||||||
/quit
|
|
||||||
/redo
|
|
||||||
/resume
|
|
||||||
/session
|
|
||||||
/session/:id
|
|
||||||
/session/:id/abort
|
|
||||||
/session/:id/children
|
|
||||||
/session/:id/command
|
|
||||||
/session/:id/diff
|
|
||||||
/session/:id/fork
|
|
||||||
/session/:id/init
|
|
||||||
/session/:id/message
|
|
||||||
/session/:id/message/:messageID
|
|
||||||
/session/:id/permissions/:permissionID
|
|
||||||
/session/:id/prompt_async
|
|
||||||
/session/:id/revert
|
|
||||||
/session/:id/share
|
|
||||||
/session/:id/shell
|
|
||||||
/session/:id/summarize
|
|
||||||
/session/:id/todo
|
|
||||||
/session/:id/unrevert
|
|
||||||
/session/status
|
|
||||||
/share
|
|
||||||
/summarize
|
|
||||||
/theme
|
|
||||||
/tui
|
|
||||||
/tui/append-prompt
|
|
||||||
/tui/clear-prompt
|
|
||||||
/tui/control/next
|
|
||||||
/tui/control/response
|
|
||||||
/tui/execute-command
|
|
||||||
/tui/open-help
|
|
||||||
/tui/open-models
|
|
||||||
/tui/open-sessions
|
|
||||||
/tui/open-themes
|
|
||||||
/tui/show-toast
|
|
||||||
/tui/submit-prompt
|
|
||||||
/undo
|
|
||||||
/Users/username
|
|
||||||
/Users/username/projects/*
|
|
||||||
/vcs
|
|
||||||
```
|
|
||||||
|
|
||||||
## CLI flags and short options
|
|
||||||
|
|
||||||
```text
|
|
||||||
--agent
|
|
||||||
--attach
|
|
||||||
--command
|
|
||||||
--continue
|
|
||||||
--cors
|
|
||||||
--cwd
|
|
||||||
--days
|
|
||||||
--dir
|
|
||||||
--dry-run
|
|
||||||
--event
|
|
||||||
--file
|
|
||||||
--force
|
|
||||||
--fork
|
|
||||||
--format
|
|
||||||
--help
|
|
||||||
--hostname
|
|
||||||
--hostname 0.0.0.0
|
|
||||||
--keep-config
|
|
||||||
--keep-data
|
|
||||||
--log-level
|
|
||||||
--max-count
|
|
||||||
--mdns
|
|
||||||
--mdns-domain
|
|
||||||
--method
|
|
||||||
--model
|
|
||||||
--models
|
|
||||||
--port
|
|
||||||
--print-logs
|
|
||||||
--project
|
|
||||||
--prompt
|
|
||||||
--refresh
|
|
||||||
--session
|
|
||||||
--share
|
|
||||||
--title
|
|
||||||
--token
|
|
||||||
--tools
|
|
||||||
--verbose
|
|
||||||
--version
|
|
||||||
--wait
|
|
||||||
|
|
||||||
-c
|
|
||||||
-d
|
|
||||||
-f
|
|
||||||
-h
|
|
||||||
-m
|
|
||||||
-n
|
|
||||||
-s
|
|
||||||
-v
|
|
||||||
```
|
|
||||||
|
|
||||||
## Environment variables
|
|
||||||
|
|
||||||
```text
|
|
||||||
AI_API_URL
|
|
||||||
AI_FLOW_CONTEXT
|
|
||||||
AI_FLOW_EVENT
|
|
||||||
AI_FLOW_INPUT
|
|
||||||
AICORE_DEPLOYMENT_ID
|
|
||||||
AICORE_RESOURCE_GROUP
|
|
||||||
AICORE_SERVICE_KEY
|
|
||||||
ANTHROPIC_API_KEY
|
|
||||||
AWS_ACCESS_KEY_ID
|
|
||||||
AWS_BEARER_TOKEN_BEDROCK
|
|
||||||
AWS_PROFILE
|
|
||||||
AWS_REGION
|
|
||||||
AWS_ROLE_ARN
|
|
||||||
AWS_SECRET_ACCESS_KEY
|
|
||||||
AWS_WEB_IDENTITY_TOKEN_FILE
|
|
||||||
AZURE_COGNITIVE_SERVICES_RESOURCE_NAME
|
|
||||||
AZURE_RESOURCE_NAME
|
|
||||||
CI_PROJECT_DIR
|
|
||||||
CI_SERVER_FQDN
|
|
||||||
CI_WORKLOAD_REF
|
|
||||||
CLOUDFLARE_ACCOUNT_ID
|
|
||||||
CLOUDFLARE_API_TOKEN
|
|
||||||
CLOUDFLARE_GATEWAY_ID
|
|
||||||
CONTEXT7_API_KEY
|
|
||||||
GITHUB_TOKEN
|
|
||||||
GITLAB_AI_GATEWAY_URL
|
|
||||||
GITLAB_HOST
|
|
||||||
GITLAB_INSTANCE_URL
|
|
||||||
GITLAB_OAUTH_CLIENT_ID
|
|
||||||
GITLAB_TOKEN
|
|
||||||
GITLAB_TOKEN_OPENCODE
|
|
||||||
GOOGLE_APPLICATION_CREDENTIALS
|
|
||||||
GOOGLE_CLOUD_PROJECT
|
|
||||||
HTTP_PROXY
|
|
||||||
HTTPS_PROXY
|
|
||||||
K2_
|
|
||||||
MY_API_KEY
|
|
||||||
MY_ENV_VAR
|
|
||||||
MY_MCP_CLIENT_ID
|
|
||||||
MY_MCP_CLIENT_SECRET
|
|
||||||
NO_PROXY
|
|
||||||
NODE_ENV
|
|
||||||
NODE_EXTRA_CA_CERTS
|
|
||||||
NPM_AUTH_TOKEN
|
|
||||||
OC_ALLOW_WAYLAND
|
|
||||||
OPENCODE_API_KEY
|
|
||||||
OPENCODE_AUTH_JSON
|
|
||||||
OPENCODE_AUTO_SHARE
|
|
||||||
OPENCODE_CLIENT
|
|
||||||
OPENCODE_CONFIG
|
|
||||||
OPENCODE_CONFIG_CONTENT
|
|
||||||
OPENCODE_CONFIG_DIR
|
|
||||||
OPENCODE_DISABLE_AUTOCOMPACT
|
|
||||||
OPENCODE_DISABLE_AUTOUPDATE
|
|
||||||
OPENCODE_DISABLE_CLAUDE_CODE
|
|
||||||
OPENCODE_DISABLE_CLAUDE_CODE_PROMPT
|
|
||||||
OPENCODE_DISABLE_CLAUDE_CODE_SKILLS
|
|
||||||
OPENCODE_DISABLE_DEFAULT_PLUGINS
|
|
||||||
OPENCODE_DISABLE_FILETIME_CHECK
|
|
||||||
OPENCODE_DISABLE_LSP_DOWNLOAD
|
|
||||||
OPENCODE_DISABLE_MODELS_FETCH
|
|
||||||
OPENCODE_DISABLE_PRUNE
|
|
||||||
OPENCODE_DISABLE_TERMINAL_TITLE
|
|
||||||
OPENCODE_ENABLE_EXA
|
|
||||||
OPENCODE_ENABLE_EXPERIMENTAL_MODELS
|
|
||||||
OPENCODE_EXPERIMENTAL
|
|
||||||
OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS
|
|
||||||
OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT
|
|
||||||
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER
|
|
||||||
OPENCODE_EXPERIMENTAL_EXA
|
|
||||||
OPENCODE_EXPERIMENTAL_FILEWATCHER
|
|
||||||
OPENCODE_EXPERIMENTAL_ICON_DISCOVERY
|
|
||||||
OPENCODE_EXPERIMENTAL_LSP_TOOL
|
|
||||||
OPENCODE_EXPERIMENTAL_LSP_TY
|
|
||||||
OPENCODE_EXPERIMENTAL_MARKDOWN
|
|
||||||
OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX
|
|
||||||
OPENCODE_EXPERIMENTAL_OXFMT
|
|
||||||
OPENCODE_EXPERIMENTAL_PLAN_MODE
|
|
||||||
OPENCODE_ENABLE_QUESTION_TOOL
|
|
||||||
OPENCODE_FAKE_VCS
|
|
||||||
OPENCODE_GIT_BASH_PATH
|
|
||||||
OPENCODE_MODEL
|
|
||||||
OPENCODE_MODELS_URL
|
|
||||||
OPENCODE_PERMISSION
|
|
||||||
OPENCODE_PORT
|
|
||||||
OPENCODE_SERVER_PASSWORD
|
|
||||||
OPENCODE_SERVER_USERNAME
|
|
||||||
PROJECT_ROOT
|
|
||||||
RESOURCE_NAME
|
|
||||||
RUST_LOG
|
|
||||||
VARIABLE_NAME
|
|
||||||
VERTEX_LOCATION
|
|
||||||
XDG_CONFIG_HOME
|
|
||||||
```
|
|
||||||
|
|
||||||
## Package/module identifiers
|
|
||||||
|
|
||||||
```text
|
|
||||||
../../../config.mjs
|
|
||||||
@astrojs/starlight/components
|
|
||||||
@opencode-ai/plugin
|
|
||||||
@opencode-ai/sdk
|
|
||||||
path
|
|
||||||
shescape
|
|
||||||
zod
|
|
||||||
|
|
||||||
@
|
|
||||||
@ai-sdk/anthropic
|
|
||||||
@ai-sdk/cerebras
|
|
||||||
@ai-sdk/google
|
|
||||||
@ai-sdk/openai
|
|
||||||
@ai-sdk/openai-compatible
|
|
||||||
@File#L37-42
|
|
||||||
@modelcontextprotocol/server-everything
|
|
||||||
@opencode
|
|
||||||
```
|
|
||||||
|
|
||||||
## GitHub owner/repo slugs referenced in docs
|
|
||||||
|
|
||||||
```text
|
|
||||||
24601/opencode-zellij-namer
|
|
||||||
angristan/opencode-wakatime
|
|
||||||
anomalyco/opencode
|
|
||||||
apps/opencode-agent
|
|
||||||
athal7/opencode-devcontainers
|
|
||||||
awesome-opencode/awesome-opencode
|
|
||||||
backnotprop/plannotator
|
|
||||||
ben-vargas/ai-sdk-provider-opencode-sdk
|
|
||||||
btriapitsyn/openchamber
|
|
||||||
BurntSushi/ripgrep
|
|
||||||
Cluster444/agentic
|
|
||||||
code-yeongyu/oh-my-opencode
|
|
||||||
darrenhinde/opencode-agents
|
|
||||||
different-ai/opencode-scheduler
|
|
||||||
different-ai/openwork
|
|
||||||
features/copilot
|
|
||||||
folke/tokyonight.nvim
|
|
||||||
franlol/opencode-md-table-formatter
|
|
||||||
ggml-org/llama.cpp
|
|
||||||
ghoulr/opencode-websearch-cited.git
|
|
||||||
H2Shami/opencode-helicone-session
|
|
||||||
hosenur/portal
|
|
||||||
jamesmurdza/daytona
|
|
||||||
jenslys/opencode-gemini-auth
|
|
||||||
JRedeker/opencode-morph-fast-apply
|
|
||||||
JRedeker/opencode-shell-strategy
|
|
||||||
kdcokenny/ocx
|
|
||||||
kdcokenny/opencode-background-agents
|
|
||||||
kdcokenny/opencode-notify
|
|
||||||
kdcokenny/opencode-workspace
|
|
||||||
kdcokenny/opencode-worktree
|
|
||||||
login/device
|
|
||||||
mohak34/opencode-notifier
|
|
||||||
morhetz/gruvbox
|
|
||||||
mtymek/opencode-obsidian
|
|
||||||
NeuralNomadsAI/CodeNomad
|
|
||||||
nick-vi/opencode-type-inject
|
|
||||||
NickvanDyke/opencode.nvim
|
|
||||||
NoeFabris/opencode-antigravity-auth
|
|
||||||
nordtheme/nord
|
|
||||||
numman-ali/opencode-openai-codex-auth
|
|
||||||
olimorris/codecompanion.nvim
|
|
||||||
panta82/opencode-notificator
|
|
||||||
rebelot/kanagawa.nvim
|
|
||||||
remorses/kimaki
|
|
||||||
sainnhe/everforest
|
|
||||||
shekohex/opencode-google-antigravity-auth
|
|
||||||
shekohex/opencode-pty.git
|
|
||||||
spoons-and-mirrors/subtask2
|
|
||||||
sudo-tee/opencode.nvim
|
|
||||||
supermemoryai/opencode-supermemory
|
|
||||||
Tarquinen/opencode-dynamic-context-pruning
|
|
||||||
Th3Whit3Wolf/one-nvim
|
|
||||||
upstash/context7
|
|
||||||
vtemian/micode
|
|
||||||
vtemian/octto
|
|
||||||
yetone/avante.nvim
|
|
||||||
zenobi-us/opencode-plugin-template
|
|
||||||
zenobi-us/opencode-skillful
|
|
||||||
```
|
|
||||||
|
|
||||||
## Paths, filenames, globs, and URLs
|
|
||||||
|
|
||||||
```text
|
|
||||||
./.opencode/themes/*.json
|
|
||||||
./<project-slug>/storage/
|
|
||||||
./config/#custom-directory
|
|
||||||
./global/storage/
|
|
||||||
.agents/skills/*/SKILL.md
|
|
||||||
.agents/skills/<name>/SKILL.md
|
|
||||||
.clang-format
|
|
||||||
.claude
|
|
||||||
.claude/skills
|
|
||||||
.claude/skills/*/SKILL.md
|
|
||||||
.claude/skills/<name>/SKILL.md
|
|
||||||
.env
|
|
||||||
.github/workflows/opencode.yml
|
|
||||||
.gitignore
|
|
||||||
.gitlab-ci.yml
|
|
||||||
.ignore
|
|
||||||
.NET SDK
|
|
||||||
.npmrc
|
|
||||||
.ocamlformat
|
|
||||||
.opencode
|
|
||||||
.opencode/
|
|
||||||
.opencode/agents/
|
|
||||||
.opencode/commands/
|
|
||||||
.opencode/commands/test.md
|
|
||||||
.opencode/modes/
|
|
||||||
.opencode/plans/*.md
|
|
||||||
.opencode/plugins/
|
|
||||||
.opencode/skills/<name>/SKILL.md
|
|
||||||
.opencode/skills/git-release/SKILL.md
|
|
||||||
.opencode/tools/
|
|
||||||
.well-known/opencode
|
|
||||||
{ type: "raw" \| "patch", content: string }
|
|
||||||
{file:path/to/file}
|
|
||||||
**/*.js
|
|
||||||
%USERPROFILE%/intelephense/license.txt
|
|
||||||
%USERPROFILE%\.cache\opencode
|
|
||||||
%USERPROFILE%\.config\opencode\opencode.jsonc
|
|
||||||
%USERPROFILE%\.config\opencode\plugins
|
|
||||||
%USERPROFILE%\.local\share\opencode
|
|
||||||
%USERPROFILE%\.local\share\opencode\log
|
|
||||||
<project-root>/.opencode/themes/*.json
|
|
||||||
<providerId>/<modelId>
|
|
||||||
<your-project>/.opencode/plugins/
|
|
||||||
~
|
|
||||||
~/...
|
|
||||||
~/.agents/skills/*/SKILL.md
|
|
||||||
~/.agents/skills/<name>/SKILL.md
|
|
||||||
~/.aws/credentials
|
|
||||||
~/.bashrc
|
|
||||||
~/.cache/opencode
|
|
||||||
~/.cache/opencode/node_modules/
|
|
||||||
~/.claude/CLAUDE.md
|
|
||||||
~/.claude/skills/
|
|
||||||
~/.claude/skills/*/SKILL.md
|
|
||||||
~/.claude/skills/<name>/SKILL.md
|
|
||||||
~/.config/opencode
|
|
||||||
~/.config/opencode/AGENTS.md
|
|
||||||
~/.config/opencode/agents/
|
|
||||||
~/.config/opencode/commands/
|
|
||||||
~/.config/opencode/modes/
|
|
||||||
~/.config/opencode/opencode.json
|
|
||||||
~/.config/opencode/opencode.jsonc
|
|
||||||
~/.config/opencode/plugins/
|
|
||||||
~/.config/opencode/skills/*/SKILL.md
|
|
||||||
~/.config/opencode/skills/<name>/SKILL.md
|
|
||||||
~/.config/opencode/themes/*.json
|
|
||||||
~/.config/opencode/tools/
|
|
||||||
~/.config/zed/settings.json
|
|
||||||
~/.local/share
|
|
||||||
~/.local/share/opencode/
|
|
||||||
~/.local/share/opencode/auth.json
|
|
||||||
~/.local/share/opencode/log/
|
|
||||||
~/.local/share/opencode/mcp-auth.json
|
|
||||||
~/.local/share/opencode/opencode.jsonc
|
|
||||||
~/.npmrc
|
|
||||||
~/.zshrc
|
|
||||||
~/code/
|
|
||||||
~/Library/Application Support
|
|
||||||
~/projects/*
|
|
||||||
~/projects/personal/
|
|
||||||
${config.github}/blob/dev/packages/sdk/js/src/gen/types.gen.ts
|
|
||||||
$HOME/intelephense/license.txt
|
|
||||||
$HOME/projects/*
|
|
||||||
$XDG_CONFIG_HOME/opencode/themes/*.json
|
|
||||||
agent/
|
|
||||||
agents/
|
|
||||||
build/
|
|
||||||
commands/
|
|
||||||
dist/
|
|
||||||
http://<wsl-ip>:4096
|
|
||||||
http://127.0.0.1:8080/callback
|
|
||||||
http://localhost:<port>
|
|
||||||
http://localhost:4096
|
|
||||||
http://localhost:4096/doc
|
|
||||||
https://app.example.com
|
|
||||||
https://AZURE_COGNITIVE_SERVICES_RESOURCE_NAME.cognitiveservices.azure.com/
|
|
||||||
https://opencode.ai/zen/v1/chat/completions
|
|
||||||
https://opencode.ai/zen/v1/messages
|
|
||||||
https://opencode.ai/zen/v1/models/gemini-3-flash
|
|
||||||
https://opencode.ai/zen/v1/models/gemini-3-pro
|
|
||||||
https://opencode.ai/zen/v1/responses
|
|
||||||
https://RESOURCE_NAME.openai.azure.com/
|
|
||||||
laravel/pint
|
|
||||||
log/
|
|
||||||
model: "anthropic/claude-sonnet-4-5"
|
|
||||||
modes/
|
|
||||||
node_modules/
|
|
||||||
openai/gpt-4.1
|
|
||||||
opencode.ai/config.json
|
|
||||||
opencode/<model-id>
|
|
||||||
opencode/gpt-5.1-codex
|
|
||||||
opencode/gpt-5.2-codex
|
|
||||||
opencode/kimi-k2
|
|
||||||
openrouter/google/gemini-2.5-flash
|
|
||||||
opncd.ai/s/<share-id>
|
|
||||||
packages/*/AGENTS.md
|
|
||||||
plugins/
|
|
||||||
project/
|
|
||||||
provider_id/model_id
|
|
||||||
provider/model
|
|
||||||
provider/model-id
|
|
||||||
rm -rf ~/.cache/opencode
|
|
||||||
skills/
|
|
||||||
skills/*/SKILL.md
|
|
||||||
src/**/*.ts
|
|
||||||
themes/
|
|
||||||
tools/
|
|
||||||
```
|
|
||||||
|
|
||||||
## Keybind strings
|
|
||||||
|
|
||||||
```text
|
|
||||||
alt+b
|
|
||||||
Alt+Ctrl+K
|
|
||||||
alt+d
|
|
||||||
alt+f
|
|
||||||
Cmd+Esc
|
|
||||||
Cmd+Option+K
|
|
||||||
Cmd+Shift+Esc
|
|
||||||
Cmd+Shift+G
|
|
||||||
Cmd+Shift+P
|
|
||||||
ctrl+a
|
|
||||||
ctrl+b
|
|
||||||
ctrl+d
|
|
||||||
ctrl+e
|
|
||||||
Ctrl+Esc
|
|
||||||
ctrl+f
|
|
||||||
ctrl+g
|
|
||||||
ctrl+k
|
|
||||||
Ctrl+Shift+Esc
|
|
||||||
Ctrl+Shift+P
|
|
||||||
ctrl+t
|
|
||||||
ctrl+u
|
|
||||||
ctrl+w
|
|
||||||
ctrl+x
|
|
||||||
DELETE
|
|
||||||
Shift+Enter
|
|
||||||
WIN+R
|
|
||||||
```
|
|
||||||
|
|
||||||
## Model ID strings referenced
|
|
||||||
|
|
||||||
```text
|
|
||||||
{env:OPENCODE_MODEL}
|
|
||||||
anthropic/claude-3-5-sonnet-20241022
|
|
||||||
anthropic/claude-haiku-4-20250514
|
|
||||||
anthropic/claude-haiku-4-5
|
|
||||||
anthropic/claude-sonnet-4-20250514
|
|
||||||
anthropic/claude-sonnet-4-5
|
|
||||||
gitlab/duo-chat-haiku-4-5
|
|
||||||
lmstudio/google/gemma-3n-e4b
|
|
||||||
openai/gpt-4.1
|
|
||||||
openai/gpt-5
|
|
||||||
opencode/gpt-5.1-codex
|
|
||||||
opencode/gpt-5.2-codex
|
|
||||||
opencode/kimi-k2
|
|
||||||
openrouter/google/gemini-2.5-flash
|
|
||||||
```
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
description: translate English to other languages
|
||||||
|
model: opencode/claude-opus-4-7
|
||||||
|
---
|
||||||
|
|
||||||
|
run git diff and translate changed english doc and UI copy files to other international languages. Translate all languages in parallel to save time.
|
||||||
|
|
||||||
|
Requirements:
|
||||||
|
|
||||||
|
- Preserve meaning, intent, tone, and formatting (including Markdown/MDX structure).
|
||||||
|
- Preserve all technical terms and artifacts exactly: product/company names, API names, identifiers, code, commands/flags, file paths, URLs, versions, error messages, config keys/values, and anything inside inline code or code blocks.
|
||||||
|
- Also preserve every term listed in the Do-Not-Translate glossary below.
|
||||||
|
- Also apply locale-specific guidance from `.opencode/glossary/<locale>.md` when available (for example, `zh-cn.md`).
|
||||||
|
- Do not modify fenced code blocks.
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://opencode.ai/config.json",
|
"$schema": "https://opencode.ai/config.json",
|
||||||
"provider": {
|
"provider": {},
|
||||||
"opencode": {
|
|
||||||
"options": {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"permission": {
|
"permission": {
|
||||||
"edit": {
|
"edit": {
|
||||||
"packages/opencode/migration/*": "deny",
|
"packages/opencode/migration/*": "deny",
|
||||||
|
|||||||
@@ -653,23 +653,30 @@ const home = (api: TuiPluginApi, input: Cfg) => ({
|
|||||||
const skin = look(ctx.theme.current)
|
const skin = look(ctx.theme.current)
|
||||||
type Prompt = (props: {
|
type Prompt = (props: {
|
||||||
workspaceID?: string
|
workspaceID?: string
|
||||||
|
visible?: boolean
|
||||||
|
disabled?: boolean
|
||||||
|
onSubmit?: () => void
|
||||||
hint?: JSX.Element
|
hint?: JSX.Element
|
||||||
|
right?: JSX.Element
|
||||||
|
showPlaceholder?: boolean
|
||||||
placeholders?: {
|
placeholders?: {
|
||||||
normal?: string[]
|
normal?: string[]
|
||||||
shell?: string[]
|
shell?: string[]
|
||||||
}
|
}
|
||||||
}) => JSX.Element
|
}) => JSX.Element
|
||||||
if (!("Prompt" in api.ui)) return null
|
type Slot = (
|
||||||
const view = api.ui.Prompt
|
props: { name: string; mode?: unknown; children?: JSX.Element } & Record<string, unknown>,
|
||||||
if (typeof view !== "function") return null
|
) => JSX.Element | null
|
||||||
const Prompt = view as Prompt
|
const ui = api.ui as TuiPluginApi["ui"] & { Prompt: Prompt; Slot: Slot }
|
||||||
|
const Prompt = ui.Prompt
|
||||||
|
const Slot = ui.Slot
|
||||||
const normal = [
|
const normal = [
|
||||||
`[SMOKE] route check for ${input.label}`,
|
`[SMOKE] route check for ${input.label}`,
|
||||||
"[SMOKE] confirm home_prompt slot override",
|
"[SMOKE] confirm home_prompt slot override",
|
||||||
"[SMOKE] verify api.ui.Prompt rendering",
|
"[SMOKE] verify prompt-right slot passthrough",
|
||||||
]
|
]
|
||||||
const shell = ["printf '[SMOKE] home prompt\n'", "git status --short", "bun --version"]
|
const shell = ["printf '[SMOKE] home prompt\n'", "git status --short", "bun --version"]
|
||||||
const Hint = (
|
const hint = (
|
||||||
<box flexShrink={0} flexDirection="row" gap={1}>
|
<box flexShrink={0} flexDirection="row" gap={1}>
|
||||||
<text fg={skin.muted}>
|
<text fg={skin.muted}>
|
||||||
<span style={{ fg: skin.accent }}>•</span> smoke home prompt
|
<span style={{ fg: skin.accent }}>•</span> smoke home prompt
|
||||||
@@ -677,7 +684,46 @@ const home = (api: TuiPluginApi, input: Cfg) => ({
|
|||||||
</box>
|
</box>
|
||||||
)
|
)
|
||||||
|
|
||||||
return <Prompt workspaceID={value.workspace_id} hint={Hint} placeholders={{ normal, shell }} />
|
return (
|
||||||
|
<Prompt
|
||||||
|
workspaceID={value.workspace_id}
|
||||||
|
hint={hint}
|
||||||
|
right={
|
||||||
|
<box flexDirection="row" gap={1}>
|
||||||
|
<Slot name="home_prompt_right" workspace_id={value.workspace_id} />
|
||||||
|
<Slot name="smoke_prompt_right" workspace_id={value.workspace_id} label={input.label} />
|
||||||
|
</box>
|
||||||
|
}
|
||||||
|
placeholders={{ normal, shell }}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
home_prompt_right(ctx, value) {
|
||||||
|
const skin = look(ctx.theme.current)
|
||||||
|
const id = value.workspace_id?.slice(0, 8) ?? "none"
|
||||||
|
return (
|
||||||
|
<text fg={skin.muted}>
|
||||||
|
<span style={{ fg: skin.accent }}>{input.label}</span> home:{id}
|
||||||
|
</text>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
session_prompt_right(ctx, value) {
|
||||||
|
const skin = look(ctx.theme.current)
|
||||||
|
return (
|
||||||
|
<text fg={skin.muted}>
|
||||||
|
<span style={{ fg: skin.accent }}>{input.label}</span> session:{value.session_id.slice(0, 8)}
|
||||||
|
</text>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
smoke_prompt_right(ctx, value) {
|
||||||
|
const skin = look(ctx.theme.current)
|
||||||
|
const id = typeof value.workspace_id === "string" ? value.workspace_id.slice(0, 8) : "none"
|
||||||
|
const label = typeof value.label === "string" ? value.label : input.label
|
||||||
|
return (
|
||||||
|
<text fg={skin.muted}>
|
||||||
|
<span style={{ fg: skin.accent }}>{label}</span> custom:{id}
|
||||||
|
</text>
|
||||||
|
)
|
||||||
},
|
},
|
||||||
home_bottom(ctx) {
|
home_bottom(ctx) {
|
||||||
const skin = look(ctx.theme.current)
|
const skin = look(ctx.theme.current)
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: effect
|
||||||
|
description: Work with Effect v4 / effect-smol TypeScript code in this repo
|
||||||
|
---
|
||||||
|
|
||||||
|
# Effect
|
||||||
|
|
||||||
|
This codebase uses Effect for typed, composable TypeScript services, schemas, and workflows.
|
||||||
|
|
||||||
|
## Source Of Truth
|
||||||
|
|
||||||
|
Use the current Effect v4 / effect-smol source, not memory or older Effect v2/v3 examples.
|
||||||
|
|
||||||
|
1. If `.opencode/references/effect-smol` is missing, clone `https://github.com/Effect-TS/effect-smol` there. Do this in the project, not in the skill folder.
|
||||||
|
2. Search `.opencode/references/effect-smol` for exact APIs, examples, tests, and naming patterns before answering or implementing Effect-specific code.
|
||||||
|
3. Also inspect existing repo code for local house style before introducing new patterns.
|
||||||
|
4. Prefer answers and implementations backed by specific source files or nearby repo examples.
|
||||||
|
|
||||||
|
## Guidelines
|
||||||
|
|
||||||
|
- Prefer current Effect v4 APIs and project-local patterns over old blog posts, examples, or package-memory guesses.
|
||||||
|
- Use `Effect.gen(function* () { ... })` for multi-step workflows.
|
||||||
|
- Use `Effect.fn("Name")` or `Effect.fnUntraced(...)` for named effects when adding reusable service methods or important workflows.
|
||||||
|
- Prefer Effect `Schema` for API and domain data shapes. Use branded schemas for IDs and `Schema.TaggedErrorClass` for typed domain errors when modeling new error surfaces.
|
||||||
|
- Keep HTTP handlers thin: decode input, read request context, call services, and map transport errors. Put business rules in services.
|
||||||
|
- In Effect service code, prefer Effect-aware platform abstractions and dependencies over ad hoc promises where the surrounding code already does so.
|
||||||
|
- Keep layer composition explicit. Avoid broad hidden provisioning that makes missing dependencies hard to see.
|
||||||
|
- In tests, prefer the repo's existing Effect test helpers and live tests for filesystem, git, child process, locks, or timing behavior.
|
||||||
|
- Do not introduce `any`, non-null assertions, unchecked casts, or older Effect APIs just to satisfy types.
|
||||||
|
- Do not answer from memory. Verify against `.opencode/references/effect-smol` or nearby code first.
|
||||||
|
|
||||||
|
## Testing Patterns
|
||||||
|
|
||||||
|
- Use `testEffect(...)` from `packages/opencode/test/lib/effect.ts` for tests that exercise Effect services, layers, runtime context, scoped resources, or platform integrations.
|
||||||
|
- Use `it.live(...)` for filesystem, git repositories, HTTP servers, sockets, child processes, locks, real time, and other live platform behavior.
|
||||||
|
- Run tests from package directories such as `packages/opencode`; never run package tests from the repo root.
|
||||||
|
- Prefer explicit test layers over ad hoc managed runtimes. Keep dependency provisioning visible in the test file.
|
||||||
|
- Use scoped fixtures and finalizers for resources that must be cleaned up, including temporary directories, flags, databases, fibers, servers, and global state.
|
||||||
@@ -116,8 +116,8 @@
|
|||||||
"light": "nord5"
|
"light": "nord5"
|
||||||
},
|
},
|
||||||
"diffLineNumber": {
|
"diffLineNumber": {
|
||||||
"dark": "nord2",
|
"dark": "#abafb7",
|
||||||
"light": "nord4"
|
"light": "textMuted"
|
||||||
},
|
},
|
||||||
"diffAddedLineNumberBg": {
|
"diffAddedLineNumberBg": {
|
||||||
"dark": "#3B4252",
|
"dark": "#3B4252",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ async function githubFetch(endpoint: string, options: RequestInit = {}) {
|
|||||||
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
|
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
|
||||||
Accept: "application/vnd.github+json",
|
Accept: "application/vnd.github+json",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
...options.headers,
|
...(options.headers instanceof Headers ? Object.fromEntries(options.headers.entries()) : options.headers),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { tool } from "@opencode-ai/plugin"
|
|||||||
const TEAM = {
|
const TEAM = {
|
||||||
desktop: ["adamdotdevin", "iamdavidhill", "Brendonovich", "nexxeln"],
|
desktop: ["adamdotdevin", "iamdavidhill", "Brendonovich", "nexxeln"],
|
||||||
zen: ["fwang", "MrMushrooooom"],
|
zen: ["fwang", "MrMushrooooom"],
|
||||||
tui: ["thdxr", "kommander", "rekram1-node"],
|
tui: ["kommander", "rekram1-node", "simonklee"],
|
||||||
core: ["thdxr", "rekram1-node", "jlongster"],
|
core: ["kitlangton", "rekram1-node", "jlongster"],
|
||||||
docs: ["R44VC0RP"],
|
docs: ["R44VC0RP"],
|
||||||
windows: ["Hona"],
|
windows: ["Hona"],
|
||||||
} as const
|
} as const
|
||||||
@@ -28,7 +28,7 @@ async function githubFetch(endpoint: string, options: RequestInit = {}) {
|
|||||||
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
|
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
|
||||||
Accept: "application/vnd.github+json",
|
Accept: "application/vnd.github+json",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
...options.headers,
|
...(options.headers instanceof Headers ? Object.fromEntries(options.headers.entries()) : options.headers),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/nicolo-ribaudo/oxc-project.github.io/refs/heads/json-schema/src/public/.oxlintrc.schema.json",
|
||||||
|
"options": {
|
||||||
|
"typeAware": true
|
||||||
|
},
|
||||||
|
"categories": {
|
||||||
|
"suspicious": "warn"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"typescript/no-base-to-string": "warn",
|
||||||
|
// Effect uses `function*` with Effect.gen/Effect.fnUntraced that don't always yield
|
||||||
|
"require-yield": "off",
|
||||||
|
// SolidJS uses `let ref: T | undefined` for JSX ref bindings assigned at runtime
|
||||||
|
"no-unassigned-vars": "off",
|
||||||
|
// SolidJS tracks reactive deps by reading properties inside createEffect
|
||||||
|
"no-unused-expressions": "off",
|
||||||
|
// Intentional control char matching (ANSI escapes, null byte sanitization)
|
||||||
|
"no-control-regex": "off",
|
||||||
|
// SST and plugin tools require triple-slash references
|
||||||
|
"triple-slash-reference": "off",
|
||||||
|
|
||||||
|
// Suspicious category: suppress noisy rules
|
||||||
|
// Effect's nested function* closures inherently shadow outer scope
|
||||||
|
"no-shadow": "off",
|
||||||
|
// Namespace-heavy codebase makes this too noisy
|
||||||
|
"unicorn/consistent-function-scoping": "off",
|
||||||
|
// Opinionated — .sort()/.reverse() mutation is fine in this codebase
|
||||||
|
"unicorn/no-array-sort": "off",
|
||||||
|
"unicorn/no-array-reverse": "off",
|
||||||
|
// Not relevant — this isn't a DOM event handler codebase
|
||||||
|
"unicorn/prefer-add-event-listener": "off",
|
||||||
|
// Bundler handles module resolution
|
||||||
|
"unicorn/require-module-specifiers": "off",
|
||||||
|
// postMessage target origin not relevant for this codebase
|
||||||
|
"unicorn/require-post-message-target-origin": "off",
|
||||||
|
// Side-effectful constructors are intentional in some places
|
||||||
|
"no-new": "off",
|
||||||
|
|
||||||
|
// Type-aware: catch unhandled promises
|
||||||
|
"typescript/no-floating-promises": "warn",
|
||||||
|
// Warn when spreading non-plain objects (Headers, class instances, etc.)
|
||||||
|
"typescript/no-misused-spread": "warn"
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"typeAware": true
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"typeAware": true
|
||||||
|
},
|
||||||
|
"ignorePatterns": ["**/node_modules", "**/dist", "**/.build", "**/.sst", "**/*.d.ts", "**/sdk.gen.ts"]
|
||||||
|
}
|
||||||
@@ -11,35 +11,10 @@
|
|||||||
- Keep things in one function unless composable or reusable
|
- Keep things in one function unless composable or reusable
|
||||||
- Avoid `try`/`catch` where possible
|
- Avoid `try`/`catch` where possible
|
||||||
- Avoid using the `any` type
|
- Avoid using the `any` type
|
||||||
- Prefer single word variable names where possible
|
|
||||||
- Use Bun APIs when possible, like `Bun.file()`
|
- Use Bun APIs when possible, like `Bun.file()`
|
||||||
- Rely on type inference when possible; avoid explicit type annotations or interfaces unless necessary for exports or clarity
|
- Rely on type inference when possible; avoid explicit type annotations or interfaces unless necessary for exports or clarity
|
||||||
- Prefer functional array methods (flatMap, filter, map) over for loops; use type guards on filter to maintain type inference downstream
|
- Prefer functional array methods (flatMap, filter, map) over for loops; use type guards on filter to maintain type inference downstream
|
||||||
|
- In `src/config`, follow the existing self-export pattern at the top of the file (for example `export * as ConfigAgent from "./agent"`) when adding a new config module.
|
||||||
### Naming
|
|
||||||
|
|
||||||
Prefer single word names for variables and functions. Only use multiple words if necessary.
|
|
||||||
|
|
||||||
### Naming Enforcement (Read This)
|
|
||||||
|
|
||||||
THIS RULE IS MANDATORY FOR AGENT WRITTEN CODE.
|
|
||||||
|
|
||||||
- Use single word names by default for new locals, params, and helper functions.
|
|
||||||
- Multi-word names are allowed only when a single word would be unclear or ambiguous.
|
|
||||||
- Do not introduce new camelCase compounds when a short single-word alternative is clear.
|
|
||||||
- Before finishing edits, review touched lines and shorten newly introduced identifiers where possible.
|
|
||||||
- Good short names to prefer: `pid`, `cfg`, `err`, `opts`, `dir`, `root`, `child`, `state`, `timeout`.
|
|
||||||
- Examples to avoid unless truly required: `inputPID`, `existingClient`, `connectTimeout`, `workerPath`.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// Good
|
|
||||||
const foo = 1
|
|
||||||
function journal(dir: string) {}
|
|
||||||
|
|
||||||
// Bad
|
|
||||||
const fooBar = 1
|
|
||||||
function prepareJournal(dir: string) {}
|
|
||||||
```
|
|
||||||
|
|
||||||
Reduce total variable count by inlining when a value is only used once.
|
Reduce total variable count by inlining when a value is only used once.
|
||||||
|
|
||||||
|
|||||||
Generated
+3
-3
@@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773909469,
|
"lastModified": 1776683584,
|
||||||
"narHash": "sha256-vglVrLfHjFIzIdV9A27Ugul6rh3I1qHbbitGW7dk420=",
|
"narHash": "sha256-NuTLMrr10Tng72hurYG8jYQ4XKK8wnpJmOGcPiis96g=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "7149c06513f335be57f26fcbbbe34afda923882b",
|
"rev": "9dd5558b06dbdacbf635a3dd36dce1b1a7ee3a89",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
+6
-6
@@ -281,7 +281,7 @@ async function assertOpencodeConnected() {
|
|||||||
})
|
})
|
||||||
connected = true
|
connected = true
|
||||||
break
|
break
|
||||||
} catch (e) {}
|
} catch {}
|
||||||
await sleep(300)
|
await sleep(300)
|
||||||
} while (retry++ < 30)
|
} while (retry++ < 30)
|
||||||
|
|
||||||
@@ -513,7 +513,7 @@ async function subscribeSessionEvents() {
|
|||||||
const decoder = new TextDecoder()
|
const decoder = new TextDecoder()
|
||||||
|
|
||||||
let text = ""
|
let text = ""
|
||||||
;(async () => {
|
void (async () => {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
const { done, value } = await reader.read()
|
const { done, value } = await reader.read()
|
||||||
@@ -542,7 +542,7 @@ async function subscribeSessionEvents() {
|
|||||||
? JSON.stringify(part.state.input)
|
? JSON.stringify(part.state.input)
|
||||||
: "Unknown"
|
: "Unknown"
|
||||||
console.log()
|
console.log()
|
||||||
console.log(color + `|`, "\x1b[0m\x1b[2m" + ` ${tool.padEnd(7, " ")}`, "", "\x1b[0m" + title)
|
console.log(`${color}|`, `\x1b[0m\x1b[2m ${tool.padEnd(7, " ")}`, "", `\x1b[0m${title}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (part.type === "text") {
|
if (part.type === "text") {
|
||||||
@@ -561,7 +561,7 @@ async function subscribeSessionEvents() {
|
|||||||
if (evt.properties.info.id !== session.id) continue
|
if (evt.properties.info.id !== session.id) continue
|
||||||
session = evt.properties.info
|
session = evt.properties.info
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
// Ignore parse errors
|
// Ignore parse errors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -576,7 +576,7 @@ async function subscribeSessionEvents() {
|
|||||||
async function summarize(response: string) {
|
async function summarize(response: string) {
|
||||||
try {
|
try {
|
||||||
return await chat(`Summarize the following in less than 40 characters:\n\n${response}`)
|
return await chat(`Summarize the following in less than 40 characters:\n\n${response}`)
|
||||||
} catch (e) {
|
} catch {
|
||||||
if (isScheduleEvent()) {
|
if (isScheduleEvent()) {
|
||||||
return "Scheduled task changes"
|
return "Scheduled task changes"
|
||||||
}
|
}
|
||||||
@@ -776,7 +776,7 @@ async function assertPermissions() {
|
|||||||
console.log(` permission: ${permission}`)
|
console.log(` permission: ${permission}`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Failed to check permissions: ${error}`)
|
console.error(`Failed to check permissions: ${error}`)
|
||||||
throw new Error(`Failed to check permissions for user ${actor}: ${error}`)
|
throw new Error(`Failed to check permissions for user ${actor}: ${error}`, { cause: error })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!["admin", "write"].includes(permission)) throw new Error(`User ${actor} does not have write permissions`)
|
if (!["admin", "write"].includes(permission)) throw new Error(`User ${actor} does not have write permissions`)
|
||||||
|
|||||||
@@ -109,6 +109,33 @@ const zenLiteCouponFirstMonth50 = new stripe.Coupon("ZenLiteCouponFirstMonth50",
|
|||||||
appliesToProducts: [zenLiteProduct.id],
|
appliesToProducts: [zenLiteProduct.id],
|
||||||
duration: "once",
|
duration: "once",
|
||||||
})
|
})
|
||||||
|
const zenLiteCouponFirstMonth100 = new stripe.Coupon("ZenLiteCouponFirstMonth100", {
|
||||||
|
name: "First month 100% off",
|
||||||
|
percentOff: 100,
|
||||||
|
appliesToProducts: [zenLiteProduct.id],
|
||||||
|
duration: "once",
|
||||||
|
})
|
||||||
|
const zenLiteCouponThreeMonths100 = new stripe.Coupon("ZenLiteCoupon3Months100", {
|
||||||
|
name: "3 months 100% off",
|
||||||
|
percentOff: 100,
|
||||||
|
appliesToProducts: [zenLiteProduct.id],
|
||||||
|
duration: "repeating",
|
||||||
|
durationInMonths: 3,
|
||||||
|
})
|
||||||
|
const zenLiteCouponSixMonths100 = new stripe.Coupon("ZenLiteCoupon6Months100", {
|
||||||
|
name: "6 months 100% off",
|
||||||
|
percentOff: 100,
|
||||||
|
appliesToProducts: [zenLiteProduct.id],
|
||||||
|
duration: "repeating",
|
||||||
|
durationInMonths: 6,
|
||||||
|
})
|
||||||
|
const zenLiteCouponTwelveMonths100 = new stripe.Coupon("ZenLiteCoupon12Months100", {
|
||||||
|
name: "12 months 100% off",
|
||||||
|
percentOff: 100,
|
||||||
|
appliesToProducts: [zenLiteProduct.id],
|
||||||
|
duration: "repeating",
|
||||||
|
durationInMonths: 12,
|
||||||
|
})
|
||||||
const zenLitePrice = new stripe.Price("ZenLitePrice", {
|
const zenLitePrice = new stripe.Price("ZenLitePrice", {
|
||||||
product: zenLiteProduct.id,
|
product: zenLiteProduct.id,
|
||||||
currency: "usd",
|
currency: "usd",
|
||||||
@@ -124,6 +151,10 @@ const ZEN_LITE_PRICE = new sst.Linkable("ZEN_LITE_PRICE", {
|
|||||||
price: zenLitePrice.id,
|
price: zenLitePrice.id,
|
||||||
priceInr: 92900,
|
priceInr: 92900,
|
||||||
firstMonth50Coupon: zenLiteCouponFirstMonth50.id,
|
firstMonth50Coupon: zenLiteCouponFirstMonth50.id,
|
||||||
|
firstMonth100Coupon: zenLiteCouponFirstMonth100.id,
|
||||||
|
threeMonths100Coupon: zenLiteCouponThreeMonths100.id,
|
||||||
|
sixMonths100Coupon: zenLiteCouponSixMonths100.id,
|
||||||
|
twelveMonths100Coupon: zenLiteCouponTwelveMonths100.id,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
import { SECRET } from "./secret"
|
import { SECRET } from "./secret"
|
||||||
import { domain, shortDomain } from "./stage"
|
import { shortDomain } from "./stage"
|
||||||
|
|
||||||
const storage = new sst.cloudflare.Bucket("EnterpriseStorage")
|
const storage = new sst.cloudflare.Bucket("EnterpriseStorage")
|
||||||
|
|
||||||
const teams = new sst.cloudflare.x.SolidStart("Teams", {
|
new sst.cloudflare.x.SolidStart("Teams", {
|
||||||
domain: shortDomain,
|
domain: shortDomain,
|
||||||
path: "packages/enterprise",
|
path: "packages/enterprise",
|
||||||
buildCommand: "bun run build:cloudflare",
|
buildCommand: "bun run build:cloudflare",
|
||||||
|
|||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"nodeModules": {
|
"nodeModules": {
|
||||||
"x86_64-linux": "sha256-C7y5FMI1pGEgMw/vcPoBhK9tw5uGg1bk0gPXPUUVhgU=",
|
"x86_64-linux": "sha256-OtyfKTBEHsJpjzAjN9vCR0PzGzdK6CDHdyU7eZ6Gl1s=",
|
||||||
"aarch64-linux": "sha256-cUlQ9jp4WIaJkd4GRoHMWc+REG/OnnGCmsQUNmvg4is=",
|
"aarch64-linux": "sha256-3eHJs3S/+uDUPAouWPsdBOlEvAOhOYx5bJzahL0tAJk=",
|
||||||
"aarch64-darwin": "sha256-3GXmqG7yihJ91wS/jlW19qxGI62b1bFJnpGB4LcMlpY=",
|
"aarch64-darwin": "sha256-rFXzrkhPVb3yM20J8R8m7GqroNNk1vAEz+o/Ks+iAI4=",
|
||||||
"x86_64-darwin": "sha256-cUF0TfYg2nXnU80kWFpr9kNHlu9txiatIgrHTltgx4g="
|
"x86_64-darwin": "sha256-lb1IGgbpxg723Qxj2WVPkxKUUmyOIsFOAhA5LoZ8GwY="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ stdenvNoCC.mkDerivation {
|
|||||||
--filter './packages/opencode' \
|
--filter './packages/opencode' \
|
||||||
--filter './packages/desktop' \
|
--filter './packages/desktop' \
|
||||||
--filter './packages/app' \
|
--filter './packages/app' \
|
||||||
|
--filter './packages/shared' \
|
||||||
--frozen-lockfile \
|
--frozen-lockfile \
|
||||||
--ignore-scripts \
|
--ignore-scripts \
|
||||||
--no-progress
|
--no-progress
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
|||||||
[
|
[
|
||||||
ripgrep
|
ripgrep
|
||||||
]
|
]
|
||||||
# bun runs sysctl to detect if dunning on rosetta2
|
# bun runs sysctl to detect if running on rosetta2
|
||||||
++ lib.optional stdenvNoCC.hostPlatform.isDarwin sysctl
|
++ lib.optional stdenvNoCC.hostPlatform.isDarwin sysctl
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-11
@@ -4,14 +4,16 @@
|
|||||||
"description": "AI-powered development tool",
|
"description": "AI-powered development tool",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"packageManager": "bun@1.3.11",
|
"packageManager": "bun@1.3.13",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun run --cwd packages/opencode --conditions=browser src/index.ts",
|
"dev": "bun run --cwd packages/opencode --conditions=browser src/index.ts",
|
||||||
"dev:desktop": "bun --cwd packages/desktop tauri dev",
|
"dev:desktop": "bun --cwd packages/desktop-electron dev",
|
||||||
"dev:web": "bun --cwd packages/app dev",
|
"dev:web": "bun --cwd packages/app dev",
|
||||||
"dev:console": "ulimit -n 10240 2>/dev/null; bun run --cwd packages/console/app dev",
|
"dev:console": "ulimit -n 10240 2>/dev/null; bun run --cwd packages/console/app dev",
|
||||||
"dev:storybook": "bun --cwd packages/storybook storybook",
|
"dev:storybook": "bun --cwd packages/storybook storybook",
|
||||||
|
"lint": "oxlint",
|
||||||
"typecheck": "bun turbo typecheck",
|
"typecheck": "bun turbo typecheck",
|
||||||
|
"postinstall": "bun run --cwd packages/opencode fix-node-pty",
|
||||||
"prepare": "husky",
|
"prepare": "husky",
|
||||||
"random": "echo 'Random script'",
|
"random": "echo 'Random script'",
|
||||||
"hello": "echo 'Hello World!'",
|
"hello": "echo 'Hello World!'",
|
||||||
@@ -25,10 +27,15 @@
|
|||||||
"packages/slack"
|
"packages/slack"
|
||||||
],
|
],
|
||||||
"catalog": {
|
"catalog": {
|
||||||
"@effect/platform-node": "4.0.0-beta.42",
|
"@effect/opentelemetry": "4.0.0-beta.57",
|
||||||
"@types/bun": "1.3.11",
|
"@effect/platform-node": "4.0.0-beta.57",
|
||||||
|
"@npmcli/arborist": "9.4.0",
|
||||||
|
"@types/bun": "1.3.12",
|
||||||
|
"@types/cross-spawn": "6.0.6",
|
||||||
"@octokit/rest": "22.0.0",
|
"@octokit/rest": "22.0.0",
|
||||||
"@hono/zod-validator": "0.4.2",
|
"@hono/zod-validator": "0.4.2",
|
||||||
|
"@opentui/core": "0.2.2",
|
||||||
|
"@opentui/solid": "0.2.2",
|
||||||
"ulid": "3.0.1",
|
"ulid": "3.0.1",
|
||||||
"@kobalte/core": "0.13.11",
|
"@kobalte/core": "0.13.11",
|
||||||
"@types/luxon": "3.7.1",
|
"@types/luxon": "3.7.1",
|
||||||
@@ -39,14 +46,16 @@
|
|||||||
"@cloudflare/workers-types": "4.20251008.0",
|
"@cloudflare/workers-types": "4.20251008.0",
|
||||||
"@openauthjs/openauth": "0.0.0-20250322224806",
|
"@openauthjs/openauth": "0.0.0-20250322224806",
|
||||||
"@pierre/diffs": "1.1.0-beta.18",
|
"@pierre/diffs": "1.1.0-beta.18",
|
||||||
|
"opentui-spinner": "0.0.6",
|
||||||
"@solid-primitives/storage": "4.3.3",
|
"@solid-primitives/storage": "4.3.3",
|
||||||
"@tailwindcss/vite": "4.1.11",
|
"@tailwindcss/vite": "4.1.11",
|
||||||
"diff": "8.0.2",
|
"diff": "8.0.2",
|
||||||
"dompurify": "3.3.1",
|
"dompurify": "3.3.1",
|
||||||
"drizzle-kit": "1.0.0-beta.19-d95b7a4",
|
"drizzle-kit": "1.0.0-beta.19-d95b7a4",
|
||||||
"drizzle-orm": "1.0.0-beta.19-d95b7a4",
|
"drizzle-orm": "1.0.0-beta.19-d95b7a4",
|
||||||
"effect": "4.0.0-beta.42",
|
"effect": "4.0.0-beta.57",
|
||||||
"ai": "6.0.138",
|
"ai": "6.0.168",
|
||||||
|
"cross-spawn": "7.0.6",
|
||||||
"hono": "4.10.7",
|
"hono": "4.10.7",
|
||||||
"hono-openapi": "1.1.2",
|
"hono-openapi": "1.1.2",
|
||||||
"fuzzysort": "3.1.0",
|
"fuzzysort": "3.1.0",
|
||||||
@@ -54,7 +63,8 @@
|
|||||||
"marked": "17.0.1",
|
"marked": "17.0.1",
|
||||||
"marked-shiki": "1.2.1",
|
"marked-shiki": "1.2.1",
|
||||||
"remend": "1.3.0",
|
"remend": "1.3.0",
|
||||||
"@playwright/test": "1.51.0",
|
"@playwright/test": "1.59.1",
|
||||||
|
"semver": "7.7.4",
|
||||||
"typescript": "5.8.2",
|
"typescript": "5.8.2",
|
||||||
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
||||||
"zod": "4.1.8",
|
"zod": "4.1.8",
|
||||||
@@ -67,8 +77,11 @@
|
|||||||
"@solidjs/meta": "0.29.4",
|
"@solidjs/meta": "0.29.4",
|
||||||
"@solidjs/router": "0.15.4",
|
"@solidjs/router": "0.15.4",
|
||||||
"@solidjs/start": "https://pkg.pr.new/@solidjs/start@dfb2020",
|
"@solidjs/start": "https://pkg.pr.new/@solidjs/start@dfb2020",
|
||||||
|
"@sentry/solid": "10.36.0",
|
||||||
|
"@sentry/vite-plugin": "4.6.0",
|
||||||
"solid-js": "1.9.10",
|
"solid-js": "1.9.10",
|
||||||
"vite-plugin-solid": "2.11.10"
|
"vite-plugin-solid": "2.11.10",
|
||||||
|
"@lydell/node-pty": "1.2.0-beta.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -78,6 +91,8 @@
|
|||||||
"@typescript/native-preview": "catalog:",
|
"@typescript/native-preview": "catalog:",
|
||||||
"glob": "13.0.5",
|
"glob": "13.0.5",
|
||||||
"husky": "9.1.7",
|
"husky": "9.1.7",
|
||||||
|
"oxlint": "1.60.0",
|
||||||
|
"oxlint-tsgolint": "0.21.0",
|
||||||
"prettier": "3.6.2",
|
"prettier": "3.6.2",
|
||||||
"semver": "^7.6.0",
|
"semver": "^7.6.0",
|
||||||
"sst": "3.18.10",
|
"sst": "3.18.10",
|
||||||
@@ -88,6 +103,7 @@
|
|||||||
"@opencode-ai/plugin": "workspace:*",
|
"@opencode-ai/plugin": "workspace:*",
|
||||||
"@opencode-ai/script": "workspace:*",
|
"@opencode-ai/script": "workspace:*",
|
||||||
"@opencode-ai/sdk": "workspace:*",
|
"@opencode-ai/sdk": "workspace:*",
|
||||||
|
"heap-snapshot-toolkit": "1.1.3",
|
||||||
"typescript": "catalog:"
|
"typescript": "catalog:"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -101,6 +117,7 @@
|
|||||||
},
|
},
|
||||||
"trustedDependencies": [
|
"trustedDependencies": [
|
||||||
"esbuild",
|
"esbuild",
|
||||||
|
"node-pty",
|
||||||
"protobufjs",
|
"protobufjs",
|
||||||
"tree-sitter",
|
"tree-sitter",
|
||||||
"tree-sitter-bash",
|
"tree-sitter-bash",
|
||||||
@@ -113,9 +130,8 @@
|
|||||||
"@types/node": "catalog:"
|
"@types/node": "catalog:"
|
||||||
},
|
},
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
|
"@npmcli/agent@4.0.0": "patches/@npmcli%2Fagent@4.0.0.patch",
|
||||||
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
|
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
|
||||||
"solid-js@1.9.10": "patches/solid-js@1.9.10.patch",
|
"solid-js@1.9.10": "patches/solid-js@1.9.10.patch"
|
||||||
"@ai-sdk/provider-utils@4.0.21": "patches/@ai-sdk%2Fprovider-utils@4.0.21.patch",
|
|
||||||
"@ai-sdk/anthropic@3.0.64": "patches/@ai-sdk%2Fanthropic@3.0.64.patch"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,11 +31,10 @@ Your app is ready to be deployed!
|
|||||||
|
|
||||||
## E2E Testing
|
## E2E Testing
|
||||||
|
|
||||||
Playwright starts the Vite dev server automatically via `webServer`, and UI tests need an opencode backend (defaults to `localhost:4096`).
|
Playwright starts the Vite dev server automatically via `webServer`, and UI tests expect an opencode backend at `localhost:4096` by default.
|
||||||
Use the local runner to create a temp sandbox, seed data, and run the tests.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bunx playwright install
|
bunx playwright install chromium
|
||||||
bun run test:e2e:local
|
bun run test:e2e:local
|
||||||
bun run test:e2e:local -- --grep "settings"
|
bun run test:e2e:local -- --grep "settings"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,226 +0,0 @@
|
|||||||
# E2E Testing Guide
|
|
||||||
|
|
||||||
## Build/Lint/Test Commands
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Run all e2e tests
|
|
||||||
bun test:e2e
|
|
||||||
|
|
||||||
# Run specific test file
|
|
||||||
bun test:e2e -- app/home.spec.ts
|
|
||||||
|
|
||||||
# Run single test by title
|
|
||||||
bun test:e2e -- -g "home renders and shows core entrypoints"
|
|
||||||
|
|
||||||
# Run tests with UI mode (for debugging)
|
|
||||||
bun test:e2e:ui
|
|
||||||
|
|
||||||
# Run tests locally with full server setup
|
|
||||||
bun test:e2e:local
|
|
||||||
|
|
||||||
# View test report
|
|
||||||
bun test:e2e:report
|
|
||||||
|
|
||||||
# Typecheck
|
|
||||||
bun typecheck
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test Structure
|
|
||||||
|
|
||||||
All tests live in `packages/app/e2e/`:
|
|
||||||
|
|
||||||
```
|
|
||||||
e2e/
|
|
||||||
├── fixtures.ts # Test fixtures (test, expect, gotoSession, sdk)
|
|
||||||
├── actions.ts # Reusable action helpers
|
|
||||||
├── selectors.ts # DOM selectors
|
|
||||||
├── utils.ts # Utilities (serverUrl, modKey, path helpers)
|
|
||||||
└── [feature]/
|
|
||||||
└── *.spec.ts # Test files
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test Patterns
|
|
||||||
|
|
||||||
### Basic Test Structure
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { withSession } from "../actions"
|
|
||||||
|
|
||||||
test("test description", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await gotoSession() // or gotoSession(sessionID)
|
|
||||||
|
|
||||||
// Your test code
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using Fixtures
|
|
||||||
|
|
||||||
- `page` - Playwright page
|
|
||||||
- `sdk` - OpenCode SDK client for API calls
|
|
||||||
- `gotoSession(sessionID?)` - Navigate to session
|
|
||||||
|
|
||||||
### Helper Functions
|
|
||||||
|
|
||||||
**Actions** (`actions.ts`):
|
|
||||||
|
|
||||||
- `openPalette(page)` - Open command palette
|
|
||||||
- `openSettings(page)` - Open settings dialog
|
|
||||||
- `closeDialog(page, dialog)` - Close any dialog
|
|
||||||
- `openSidebar(page)` / `closeSidebar(page)` - Toggle sidebar
|
|
||||||
- `waitTerminalReady(page, { term? })` - Wait for a mounted terminal to connect and finish rendering output
|
|
||||||
- `runTerminal(page, { cmd, token, term?, timeout? })` - Type into the terminal via the browser and wait for rendered output
|
|
||||||
- `withSession(sdk, title, callback)` - Create temp session
|
|
||||||
- `withProject(...)` - Create temp project/workspace
|
|
||||||
- `sessionIDFromUrl(url)` - Read session ID from URL
|
|
||||||
- `slugFromUrl(url)` - Read workspace slug from URL
|
|
||||||
- `waitSlug(page, skip?)` - Wait for resolved workspace slug
|
|
||||||
- `trackSession(sessionID, directory?)` - Register session for fixture cleanup
|
|
||||||
- `trackDirectory(directory)` - Register directory for fixture cleanup
|
|
||||||
- `clickListItem(container, filter)` - Click list item by key/text
|
|
||||||
|
|
||||||
**Selectors** (`selectors.ts`):
|
|
||||||
|
|
||||||
- `promptSelector` - Prompt input
|
|
||||||
- `terminalSelector` - Terminal panel
|
|
||||||
- `sessionItemSelector(id)` - Session in sidebar
|
|
||||||
- `listItemSelector` - Generic list items
|
|
||||||
|
|
||||||
**Utils** (`utils.ts`):
|
|
||||||
|
|
||||||
- `modKey` - Meta (Mac) or Control (Linux/Win)
|
|
||||||
- `serverUrl` - Backend server URL
|
|
||||||
- `sessionPath(dir, id?)` - Build session URL
|
|
||||||
|
|
||||||
## Code Style Guidelines
|
|
||||||
|
|
||||||
### Imports
|
|
||||||
|
|
||||||
Always import from `../fixtures`, not `@playwright/test`:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// ✅ Good
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
|
|
||||||
// ❌ Bad
|
|
||||||
import { test, expect } from "@playwright/test"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Naming Conventions
|
|
||||||
|
|
||||||
- Test files: `feature-name.spec.ts`
|
|
||||||
- Test names: lowercase, descriptive: `"sidebar can be toggled"`
|
|
||||||
- Variables: camelCase
|
|
||||||
- Constants: SCREAMING_SNAKE_CASE
|
|
||||||
|
|
||||||
### Error Handling
|
|
||||||
|
|
||||||
Tests should clean up after themselves. Prefer fixture-managed cleanup:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
test("test with cleanup", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withSession(sdk, "test session", async (session) => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
// Test code...
|
|
||||||
}) // Auto-deletes session
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
- Prefer `withSession(...)` for temp sessions
|
|
||||||
- In `withProject(...)` tests that create sessions or extra workspaces, call `trackSession(sessionID, directory?)` and `trackDirectory(directory)`
|
|
||||||
- This lets fixture teardown abort, wait for idle, and clean up safely under CI concurrency
|
|
||||||
- Avoid calling `sdk.session.delete(...)` directly
|
|
||||||
|
|
||||||
### Timeouts
|
|
||||||
|
|
||||||
Default: 60s per test, 10s per assertion. Override when needed:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
test.setTimeout(120_000) // For long LLM operations
|
|
||||||
test("slow test", async () => {
|
|
||||||
await expect.poll(() => check(), { timeout: 90_000 }).toBe(true)
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
### Selectors
|
|
||||||
|
|
||||||
Use `data-component`, `data-action`, or semantic roles:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// ✅ Good
|
|
||||||
await page.locator('[data-component="prompt-input"]').click()
|
|
||||||
await page.getByRole("button", { name: "Open settings" }).click()
|
|
||||||
|
|
||||||
// ❌ Bad
|
|
||||||
await page.locator(".css-class-name").click()
|
|
||||||
await page.locator("#id-name").click()
|
|
||||||
```
|
|
||||||
|
|
||||||
### Keyboard Shortcuts
|
|
||||||
|
|
||||||
Use `modKey` for cross-platform compatibility:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import { modKey } from "../utils"
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+B`) // Toggle sidebar
|
|
||||||
await page.keyboard.press(`${modKey}+Comma`) // Open settings
|
|
||||||
```
|
|
||||||
|
|
||||||
### Terminal Tests
|
|
||||||
|
|
||||||
- In terminal tests, type through the browser. Do not write to the PTY through the SDK.
|
|
||||||
- Use `waitTerminalReady(page, { term? })` and `runTerminal(page, { cmd, token, term?, timeout? })` from `actions.ts`.
|
|
||||||
- These helpers use the fixture-enabled test-only terminal driver and wait for output after the terminal writer settles.
|
|
||||||
- After opening the terminal, use `waitTerminalFocusIdle(...)` before the next keyboard action when prompt focus or keyboard routing matters.
|
|
||||||
- This avoids racing terminal mount, focus handoff, and prompt readiness when the next step types or sends shortcuts.
|
|
||||||
- Avoid `waitForTimeout` and custom DOM or `data-*` readiness checks.
|
|
||||||
|
|
||||||
### Wait on state
|
|
||||||
|
|
||||||
- Never use wall-clock waits like `page.waitForTimeout(...)` to make a test pass
|
|
||||||
- Avoid race-prone flows that assume work is finished after an action
|
|
||||||
- Wait or poll on observable state with `expect(...)`, `expect.poll(...)`, or existing helpers
|
|
||||||
- Prefer locator assertions like `toBeVisible()`, `toHaveCount(0)`, and `toHaveAttribute(...)` for normal UI state, and reserve `expect.poll(...)` for probe, mock, or backend state
|
|
||||||
- Prefer semantic app state over transient DOM visibility when behavior depends on active selection, focus ownership, or async retry loops
|
|
||||||
- Do not treat a visible element as proof that the app will route the next action to it
|
|
||||||
- When fixing a flake, validate with `--repeat-each` and multiple workers when practical
|
|
||||||
|
|
||||||
### Add hooks
|
|
||||||
|
|
||||||
- If required state is not observable from the UI, add a small test-only driver or probe in app code instead of sleeps or fragile DOM checks
|
|
||||||
- Keep these hooks minimal and purpose-built, following the style of `packages/app/src/testing/terminal.ts`
|
|
||||||
- Test-only hooks must be inert unless explicitly enabled; do not add normal-runtime listeners, reactive subscriptions, or per-update allocations for e2e ceremony
|
|
||||||
- When mocking routes or APIs, expose explicit mock state and wait on that before asserting post-action UI
|
|
||||||
- Add minimal test-only probes for semantic state like the active list item or selected command when DOM intermediates are unstable
|
|
||||||
- Prefer probing committed app state over asserting on transient highlight, visibility, or animation states
|
|
||||||
|
|
||||||
### Prefer helpers
|
|
||||||
|
|
||||||
- Prefer fluent helpers and drivers when they make intent obvious and reduce locator-heavy noise
|
|
||||||
- Use direct locators when the interaction is simple and a helper would not add clarity
|
|
||||||
- Prefer helpers that both perform an action and verify the app consumed it
|
|
||||||
- Avoid composing helpers redundantly when one already includes the other or already waits for the resulting state
|
|
||||||
- If a helper already covers the required wait or verification, use it directly instead of layering extra clicks, keypresses, or assertions
|
|
||||||
|
|
||||||
## Writing New Tests
|
|
||||||
|
|
||||||
1. Choose appropriate folder or create new one
|
|
||||||
2. Import from `../fixtures`
|
|
||||||
3. Use helper functions from `../actions` and `../selectors`
|
|
||||||
4. When validating routing, use shared helpers from `../actions`. Workspace URL slugs can be canonicalized on Windows, so assert against canonical or resolved workspace slugs.
|
|
||||||
5. Clean up any created resources
|
|
||||||
6. Use specific selectors (avoid CSS classes)
|
|
||||||
7. Test one feature per test file
|
|
||||||
|
|
||||||
## Local Development
|
|
||||||
|
|
||||||
For UI debugging, use:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bun test:e2e:ui
|
|
||||||
```
|
|
||||||
|
|
||||||
This opens Playwright's interactive UI for step-through debugging.
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,24 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { serverNamePattern } from "../utils"
|
|
||||||
|
|
||||||
test("home renders and shows core entrypoints", async ({ page }) => {
|
|
||||||
await page.goto("/")
|
|
||||||
const nav = page.locator('[data-component="sidebar-nav-desktop"]')
|
|
||||||
|
|
||||||
await expect(page.getByRole("button", { name: "Open project" }).first()).toBeVisible()
|
|
||||||
await expect(nav.getByText("No projects open")).toBeVisible()
|
|
||||||
await expect(nav.getByText("Open a project to get started")).toBeVisible()
|
|
||||||
await expect(page.getByRole("button", { name: serverNamePattern })).toBeVisible()
|
|
||||||
})
|
|
||||||
|
|
||||||
test("server picker dialog opens from home", async ({ page }) => {
|
|
||||||
await page.goto("/")
|
|
||||||
|
|
||||||
const trigger = page.getByRole("button", { name: serverNamePattern })
|
|
||||||
await expect(trigger).toBeVisible()
|
|
||||||
await trigger.click()
|
|
||||||
|
|
||||||
const dialog = page.getByRole("dialog")
|
|
||||||
await expect(dialog).toBeVisible()
|
|
||||||
await expect(dialog.getByRole("textbox").first()).toBeVisible()
|
|
||||||
})
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { dirPath } from "../utils"
|
|
||||||
|
|
||||||
test("project route redirects to /session", async ({ page, directory, slug }) => {
|
|
||||||
await page.goto(dirPath(directory))
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${slug}/session`))
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
})
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { closeDialog, openPalette } from "../actions"
|
|
||||||
|
|
||||||
test("search palette opens and closes", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openPalette(page)
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(dialog).toHaveCount(0)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("search palette also opens with cmd+p", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openPalette(page, "P")
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
await expect(dialog).toHaveCount(0)
|
|
||||||
})
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { serverNamePattern, serverUrls } from "../utils"
|
|
||||||
import { closeDialog, clickMenuItem } from "../actions"
|
|
||||||
|
|
||||||
const DEFAULT_SERVER_URL_KEY = "opencode.settings.dat:defaultServerUrl"
|
|
||||||
|
|
||||||
test("can set a default server on web", async ({ page, gotoSession }) => {
|
|
||||||
await page.addInitScript((key: string) => {
|
|
||||||
try {
|
|
||||||
localStorage.removeItem(key)
|
|
||||||
} catch {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}, DEFAULT_SERVER_URL_KEY)
|
|
||||||
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const status = page.getByRole("button", { name: "Status" })
|
|
||||||
await expect(status).toBeVisible()
|
|
||||||
const popover = page.locator('[data-component="popover-content"]').filter({ hasText: "Manage servers" })
|
|
||||||
|
|
||||||
const ensurePopoverOpen = async () => {
|
|
||||||
if (await popover.isVisible()) return
|
|
||||||
await status.click()
|
|
||||||
await expect(popover).toBeVisible()
|
|
||||||
}
|
|
||||||
|
|
||||||
await ensurePopoverOpen()
|
|
||||||
await popover.getByRole("button", { name: "Manage servers" }).click()
|
|
||||||
|
|
||||||
const dialog = page.getByRole("dialog")
|
|
||||||
await expect(dialog).toBeVisible()
|
|
||||||
|
|
||||||
await expect(dialog.getByText(serverNamePattern).first()).toBeVisible()
|
|
||||||
|
|
||||||
const menuTrigger = dialog.locator('[data-slot="dropdown-menu-trigger"]').first()
|
|
||||||
await expect(menuTrigger).toBeVisible()
|
|
||||||
await menuTrigger.click({ force: true })
|
|
||||||
|
|
||||||
const menu = page.locator('[data-component="dropdown-menu-content"]').first()
|
|
||||||
await expect(menu).toBeVisible()
|
|
||||||
await clickMenuItem(menu, /set as default/i)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () =>
|
|
||||||
serverUrls.includes((await page.evaluate((key) => localStorage.getItem(key), DEFAULT_SERVER_URL_KEY)) ?? ""),
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
await expect(dialog.getByText("Default", { exact: true })).toBeVisible()
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
|
|
||||||
await ensurePopoverOpen()
|
|
||||||
|
|
||||||
const serverRow = popover.locator("button").filter({ hasText: serverNamePattern }).first()
|
|
||||||
await expect(serverRow).toBeVisible()
|
|
||||||
await expect(serverRow.getByText("Default", { exact: true })).toBeVisible()
|
|
||||||
})
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { withSession } from "../actions"
|
|
||||||
|
|
||||||
test("can open an existing session and type into the prompt", async ({ page, sdk, gotoSession }) => {
|
|
||||||
const title = `e2e smoke ${Date.now()}`
|
|
||||||
|
|
||||||
await withSession(sdk, title, async (session) => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type("hello from e2e")
|
|
||||||
await expect(prompt).toContainText("hello from e2e")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { defocus, openSidebar, withSession } from "../actions"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { modKey } from "../utils"
|
|
||||||
|
|
||||||
test("titlebar back/forward navigates between sessions", async ({ page, slug, sdk, gotoSession }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
const stamp = Date.now()
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e titlebar history 1 ${stamp}`, async (one) => {
|
|
||||||
await withSession(sdk, `e2e titlebar history 2 ${stamp}`, async (two) => {
|
|
||||||
await gotoSession(one.id)
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
const link = page.locator(`[data-session-id="${two.id}"] a`).first()
|
|
||||||
await expect(link).toBeVisible()
|
|
||||||
await link.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${slug}/session/${two.id}(?:\\?|#|$)`))
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
|
|
||||||
const back = page.getByRole("button", { name: "Back" })
|
|
||||||
const forward = page.getByRole("button", { name: "Forward" })
|
|
||||||
|
|
||||||
await expect(back).toBeVisible()
|
|
||||||
await expect(back).toBeEnabled()
|
|
||||||
await back.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${slug}/session/${one.id}(?:\\?|#|$)`))
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
|
|
||||||
await expect(forward).toBeVisible()
|
|
||||||
await expect(forward).toBeEnabled()
|
|
||||||
await forward.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${slug}/session/${two.id}(?:\\?|#|$)`))
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("titlebar forward is cleared after branching history from sidebar", async ({ page, slug, sdk, gotoSession }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
const stamp = Date.now()
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e titlebar history a ${stamp}`, async (a) => {
|
|
||||||
await withSession(sdk, `e2e titlebar history b ${stamp}`, async (b) => {
|
|
||||||
await withSession(sdk, `e2e titlebar history c ${stamp}`, async (c) => {
|
|
||||||
await gotoSession(a.id)
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
const second = page.locator(`[data-session-id="${b.id}"] a`).first()
|
|
||||||
await expect(second).toBeVisible()
|
|
||||||
await second.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${slug}/session/${b.id}(?:\\?|#|$)`))
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
|
|
||||||
const back = page.getByRole("button", { name: "Back" })
|
|
||||||
const forward = page.getByRole("button", { name: "Forward" })
|
|
||||||
|
|
||||||
await expect(back).toBeVisible()
|
|
||||||
await expect(back).toBeEnabled()
|
|
||||||
await back.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${slug}/session/${a.id}(?:\\?|#|$)`))
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
const third = page.locator(`[data-session-id="${c.id}"] a`).first()
|
|
||||||
await expect(third).toBeVisible()
|
|
||||||
await third.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${slug}/session/${c.id}(?:\\?|#|$)`))
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
|
|
||||||
await expect(forward).toBeVisible()
|
|
||||||
await expect(forward).toBeDisabled()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("keyboard shortcuts navigate titlebar history", async ({ page, slug, sdk, gotoSession }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
const stamp = Date.now()
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e titlebar shortcuts 1 ${stamp}`, async (one) => {
|
|
||||||
await withSession(sdk, `e2e titlebar shortcuts 2 ${stamp}`, async (two) => {
|
|
||||||
await gotoSession(one.id)
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
const link = page.locator(`[data-session-id="${two.id}"] a`).first()
|
|
||||||
await expect(link).toBeVisible()
|
|
||||||
await link.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${slug}/session/${two.id}(?:\\?|#|$)`))
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
|
|
||||||
await defocus(page)
|
|
||||||
await page.keyboard.press(`${modKey}+[`)
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${slug}/session/${one.id}(?:\\?|#|$)`))
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
|
|
||||||
await defocus(page)
|
|
||||||
await page.keyboard.press(`${modKey}+]`)
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${slug}/session/${two.id}(?:\\?|#|$)`))
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
|
|
||||||
test("ctrl+l focuses the prompt", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
await expect(prompt).toBeVisible()
|
|
||||||
|
|
||||||
await page.locator("main").click({ position: { x: 5, y: 5 } })
|
|
||||||
await expect(prompt).not.toBeFocused()
|
|
||||||
|
|
||||||
await page.keyboard.press("Control+L")
|
|
||||||
await expect(prompt).toBeFocused()
|
|
||||||
})
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { modKey } from "../utils"
|
|
||||||
|
|
||||||
const expanded = async (el: { getAttribute: (name: string) => Promise<string | null> }) => {
|
|
||||||
const value = await el.getAttribute("aria-expanded")
|
|
||||||
if (value !== "true" && value !== "false") throw new Error(`Expected aria-expanded to be true|false, got: ${value}`)
|
|
||||||
return value === "true"
|
|
||||||
}
|
|
||||||
|
|
||||||
test("review panel can be toggled via keybind", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const reviewPanel = page.locator("#review-panel")
|
|
||||||
|
|
||||||
const treeToggle = page.getByRole("button", { name: "Toggle file tree" }).first()
|
|
||||||
await expect(treeToggle).toBeVisible()
|
|
||||||
if (await expanded(treeToggle)) await treeToggle.click()
|
|
||||||
await expect(treeToggle).toHaveAttribute("aria-expanded", "false")
|
|
||||||
|
|
||||||
const reviewToggle = page.getByRole("button", { name: "Toggle review" }).first()
|
|
||||||
await expect(reviewToggle).toBeVisible()
|
|
||||||
if (await expanded(reviewToggle)) await reviewToggle.click()
|
|
||||||
await expect(reviewToggle).toHaveAttribute("aria-expanded", "false")
|
|
||||||
await expect(reviewPanel).toHaveAttribute("aria-hidden", "true")
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+R`)
|
|
||||||
await expect(reviewToggle).toHaveAttribute("aria-expanded", "true")
|
|
||||||
await expect(reviewPanel).toHaveAttribute("aria-hidden", "false")
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+R`)
|
|
||||||
await expect(reviewToggle).toHaveAttribute("aria-expanded", "false")
|
|
||||||
await expect(reviewPanel).toHaveAttribute("aria-hidden", "true")
|
|
||||||
})
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { modKey } from "../utils"
|
|
||||||
|
|
||||||
test("mod+w closes the active file tab", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/open")
|
|
||||||
await expect(page.locator('[data-slash-id="file.open"]').first()).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const dialog = page
|
|
||||||
.getByRole("dialog")
|
|
||||||
.filter({ has: page.getByPlaceholder(/search files/i) })
|
|
||||||
.first()
|
|
||||||
await expect(dialog).toBeVisible()
|
|
||||||
|
|
||||||
await dialog.getByRole("textbox").first().fill("package.json")
|
|
||||||
const item = dialog.locator('[data-slot="list-item"][data-key^="file:"]').first()
|
|
||||||
await expect(item).toBeVisible({ timeout: 30_000 })
|
|
||||||
await item.click()
|
|
||||||
await expect(dialog).toHaveCount(0)
|
|
||||||
|
|
||||||
const tab = page.getByRole("tab", { name: "package.json" }).first()
|
|
||||||
await expect(tab).toBeVisible()
|
|
||||||
await tab.click()
|
|
||||||
await expect(tab).toHaveAttribute("aria-selected", "true")
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+W`)
|
|
||||||
await expect(page.getByRole("tab", { name: "package.json" })).toHaveCount(0)
|
|
||||||
})
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
|
|
||||||
test("can open a file tab from the search palette", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/open")
|
|
||||||
|
|
||||||
const command = page.locator('[data-slash-id="file.open"]').first()
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const dialog = page
|
|
||||||
.getByRole("dialog")
|
|
||||||
.filter({ has: page.getByPlaceholder(/search files/i) })
|
|
||||||
.first()
|
|
||||||
await expect(dialog).toBeVisible()
|
|
||||||
|
|
||||||
const input = dialog.getByRole("textbox").first()
|
|
||||||
await input.fill("package.json")
|
|
||||||
|
|
||||||
const item = dialog.locator('[data-slot="list-item"][data-key^="file:"]').first()
|
|
||||||
await expect(item).toBeVisible({ timeout: 30_000 })
|
|
||||||
await item.click()
|
|
||||||
|
|
||||||
await expect(dialog).toHaveCount(0)
|
|
||||||
|
|
||||||
const tabs = page.locator('[data-component="tabs"][data-variant="normal"]')
|
|
||||||
await expect(tabs.locator('[data-slot="tabs-trigger"]').first()).toBeVisible()
|
|
||||||
})
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
|
|
||||||
test("file tree can expand folders and open a file", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const toggle = page.getByRole("button", { name: "Toggle file tree" })
|
|
||||||
const panel = page.locator("#file-tree-panel")
|
|
||||||
const treeTabs = panel.locator('[data-component="tabs"][data-variant="pill"][data-scope="filetree"]')
|
|
||||||
|
|
||||||
await expect(toggle).toBeVisible()
|
|
||||||
if ((await toggle.getAttribute("aria-expanded")) !== "true") await toggle.click()
|
|
||||||
await expect(toggle).toHaveAttribute("aria-expanded", "true")
|
|
||||||
await expect(panel).toBeVisible()
|
|
||||||
await expect(treeTabs).toBeVisible()
|
|
||||||
|
|
||||||
const allTab = treeTabs.getByRole("tab", { name: /^all files$/i })
|
|
||||||
await expect(allTab).toBeVisible()
|
|
||||||
await allTab.click()
|
|
||||||
await expect(allTab).toHaveAttribute("aria-selected", "true")
|
|
||||||
|
|
||||||
const tree = treeTabs.locator('[data-slot="tabs-content"]:not([hidden])')
|
|
||||||
await expect(tree).toBeVisible()
|
|
||||||
|
|
||||||
const expand = async (name: string) => {
|
|
||||||
const folder = tree.getByRole("button", { name, exact: true }).first()
|
|
||||||
await expect(folder).toBeVisible()
|
|
||||||
await expect(folder).toHaveAttribute("aria-expanded", /true|false/)
|
|
||||||
if ((await folder.getAttribute("aria-expanded")) === "false") await folder.click()
|
|
||||||
await expect(folder).toHaveAttribute("aria-expanded", "true")
|
|
||||||
}
|
|
||||||
|
|
||||||
await expand("packages")
|
|
||||||
await expand("app")
|
|
||||||
await expand("src")
|
|
||||||
await expand("components")
|
|
||||||
|
|
||||||
const file = tree.getByRole("button", { name: "file-tree.tsx", exact: true }).first()
|
|
||||||
await expect(file).toBeVisible()
|
|
||||||
await file.click()
|
|
||||||
|
|
||||||
const tab = page.getByRole("tab", { name: "file-tree.tsx" })
|
|
||||||
await expect(tab).toBeVisible()
|
|
||||||
await tab.click()
|
|
||||||
await expect(tab).toHaveAttribute("aria-selected", "true")
|
|
||||||
|
|
||||||
await toggle.click()
|
|
||||||
await expect(toggle).toHaveAttribute("aria-expanded", "false")
|
|
||||||
|
|
||||||
await toggle.click()
|
|
||||||
await expect(toggle).toHaveAttribute("aria-expanded", "true")
|
|
||||||
await expect(allTab).toHaveAttribute("aria-selected", "true")
|
|
||||||
|
|
||||||
const viewer = page.locator('[data-component="file"][data-mode="text"]').first()
|
|
||||||
await expect(viewer).toBeVisible()
|
|
||||||
await expect(viewer).toContainText("export default function FileTree")
|
|
||||||
})
|
|
||||||
@@ -1,156 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { modKey } from "../utils"
|
|
||||||
|
|
||||||
test("smoke file viewer renders real file content", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/open")
|
|
||||||
|
|
||||||
const command = page.locator('[data-slash-id="file.open"]').first()
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const dialog = page
|
|
||||||
.getByRole("dialog")
|
|
||||||
.filter({ has: page.getByPlaceholder(/search files/i) })
|
|
||||||
.first()
|
|
||||||
await expect(dialog).toBeVisible()
|
|
||||||
|
|
||||||
const input = dialog.getByRole("textbox").first()
|
|
||||||
await input.fill("package.json")
|
|
||||||
|
|
||||||
const items = dialog.locator('[data-slot="list-item"][data-key^="file:"]')
|
|
||||||
let index = -1
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const keys = await items.evaluateAll((nodes) => nodes.map((node) => node.getAttribute("data-key") ?? ""))
|
|
||||||
index = keys.findIndex((key) => /packages[\\/]+app[\\/]+package\.json$/i.test(key.replace(/^file:/, "")))
|
|
||||||
return index >= 0
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
|
|
||||||
const item = items.nth(index)
|
|
||||||
await expect(item).toBeVisible()
|
|
||||||
await item.click()
|
|
||||||
|
|
||||||
await expect(dialog).toHaveCount(0)
|
|
||||||
|
|
||||||
const tab = page.getByRole("tab", { name: "package.json" })
|
|
||||||
await expect(tab).toBeVisible()
|
|
||||||
await tab.click()
|
|
||||||
|
|
||||||
const viewer = page.locator('[data-component="file"][data-mode="text"]').first()
|
|
||||||
await expect(viewer).toBeVisible()
|
|
||||||
await expect(viewer.getByText(/"name"\s*:\s*"@opencode-ai\/app"/)).toBeVisible()
|
|
||||||
})
|
|
||||||
|
|
||||||
test("cmd+f opens text viewer search while prompt is focused", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/open")
|
|
||||||
|
|
||||||
const command = page.locator('[data-slash-id="file.open"]').first()
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const dialog = page
|
|
||||||
.getByRole("dialog")
|
|
||||||
.filter({ has: page.getByPlaceholder(/search files/i) })
|
|
||||||
.first()
|
|
||||||
await expect(dialog).toBeVisible()
|
|
||||||
|
|
||||||
const input = dialog.getByRole("textbox").first()
|
|
||||||
await input.fill("package.json")
|
|
||||||
|
|
||||||
const items = dialog.locator('[data-slot="list-item"][data-key^="file:"]')
|
|
||||||
let index = -1
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const keys = await items.evaluateAll((nodes) => nodes.map((node) => node.getAttribute("data-key") ?? ""))
|
|
||||||
index = keys.findIndex((key) => /packages[\\/]+app[\\/]+package\.json$/i.test(key.replace(/^file:/, "")))
|
|
||||||
return index >= 0
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
|
|
||||||
const item = items.nth(index)
|
|
||||||
await expect(item).toBeVisible()
|
|
||||||
await item.click()
|
|
||||||
|
|
||||||
await expect(dialog).toHaveCount(0)
|
|
||||||
|
|
||||||
const tab = page.getByRole("tab", { name: "package.json" })
|
|
||||||
await expect(tab).toBeVisible()
|
|
||||||
await tab.click()
|
|
||||||
|
|
||||||
const viewer = page.locator('[data-component="file"][data-mode="text"]').first()
|
|
||||||
await expect(viewer).toBeVisible()
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.press(`${modKey}+f`)
|
|
||||||
|
|
||||||
const findInput = page.getByPlaceholder("Find")
|
|
||||||
await expect(findInput).toBeVisible()
|
|
||||||
await expect(findInput).toBeFocused()
|
|
||||||
})
|
|
||||||
|
|
||||||
test("cmd+f opens text viewer search while prompt is not focused", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/open")
|
|
||||||
|
|
||||||
const command = page.locator('[data-slash-id="file.open"]').first()
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const dialog = page
|
|
||||||
.getByRole("dialog")
|
|
||||||
.filter({ has: page.getByPlaceholder(/search files/i) })
|
|
||||||
.first()
|
|
||||||
await expect(dialog).toBeVisible()
|
|
||||||
|
|
||||||
const input = dialog.getByRole("textbox").first()
|
|
||||||
await input.fill("package.json")
|
|
||||||
|
|
||||||
const items = dialog.locator('[data-slot="list-item"][data-key^="file:"]')
|
|
||||||
let index = -1
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const keys = await items.evaluateAll((nodes) => nodes.map((node) => node.getAttribute("data-key") ?? ""))
|
|
||||||
index = keys.findIndex((key) => /packages[\\/]+app[\\/]+package\.json$/i.test(key.replace(/^file:/, "")))
|
|
||||||
return index >= 0
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
|
|
||||||
const item = items.nth(index)
|
|
||||||
await expect(item).toBeVisible()
|
|
||||||
await item.click()
|
|
||||||
|
|
||||||
await expect(dialog).toHaveCount(0)
|
|
||||||
|
|
||||||
const tab = page.getByRole("tab", { name: "package.json" })
|
|
||||||
await expect(tab).toBeVisible()
|
|
||||||
await tab.click()
|
|
||||||
|
|
||||||
const viewer = page.locator('[data-component="file"][data-mode="text"]').first()
|
|
||||||
await expect(viewer).toBeVisible()
|
|
||||||
|
|
||||||
await viewer.click()
|
|
||||||
await page.keyboard.press(`${modKey}+f`)
|
|
||||||
|
|
||||||
const findInput = page.getByPlaceholder("Find")
|
|
||||||
await expect(findInput).toBeVisible()
|
|
||||||
await expect(findInput).toBeFocused()
|
|
||||||
})
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
import { test as base, expect, type Page } from "@playwright/test"
|
|
||||||
import { ManagedRuntime } from "effect"
|
|
||||||
import type { E2EWindow } from "../src/testing/terminal"
|
|
||||||
import type { Item, Reply, Usage } from "../../opencode/test/lib/llm-server"
|
|
||||||
import { TestLLMServer } from "../../opencode/test/lib/llm-server"
|
|
||||||
import {
|
|
||||||
healthPhase,
|
|
||||||
cleanupSession,
|
|
||||||
cleanupTestProject,
|
|
||||||
createTestProject,
|
|
||||||
setHealthPhase,
|
|
||||||
seedProjects,
|
|
||||||
sessionIDFromUrl,
|
|
||||||
waitSlug,
|
|
||||||
waitSession,
|
|
||||||
} from "./actions"
|
|
||||||
import { createSdk, dirSlug, getWorktree, sessionPath } from "./utils"
|
|
||||||
|
|
||||||
type LLMFixture = {
|
|
||||||
url: string
|
|
||||||
push: (...input: (Item | Reply)[]) => Promise<void>
|
|
||||||
text: (value: string, opts?: { usage?: Usage }) => Promise<void>
|
|
||||||
tool: (name: string, input: unknown) => Promise<void>
|
|
||||||
toolHang: (name: string, input: unknown) => Promise<void>
|
|
||||||
reason: (value: string, opts?: { text?: string; usage?: Usage }) => Promise<void>
|
|
||||||
fail: (message?: unknown) => Promise<void>
|
|
||||||
error: (status: number, body: unknown) => Promise<void>
|
|
||||||
hang: () => Promise<void>
|
|
||||||
hold: (value: string, wait: PromiseLike<unknown>) => Promise<void>
|
|
||||||
hits: () => Promise<Array<{ url: URL; body: Record<string, unknown> }>>
|
|
||||||
calls: () => Promise<number>
|
|
||||||
wait: (count: number) => Promise<void>
|
|
||||||
inputs: () => Promise<Record<string, unknown>[]>
|
|
||||||
pending: () => Promise<number>
|
|
||||||
}
|
|
||||||
|
|
||||||
export const settingsKey = "settings.v3"
|
|
||||||
|
|
||||||
const seedModel = (() => {
|
|
||||||
const [providerID = "opencode", modelID = "big-pickle"] = (
|
|
||||||
process.env.OPENCODE_E2E_MODEL ?? "opencode/big-pickle"
|
|
||||||
).split("/")
|
|
||||||
return {
|
|
||||||
providerID: providerID || "opencode",
|
|
||||||
modelID: modelID || "big-pickle",
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
|
|
||||||
type TestFixtures = {
|
|
||||||
llm: LLMFixture
|
|
||||||
sdk: ReturnType<typeof createSdk>
|
|
||||||
gotoSession: (sessionID?: string) => Promise<void>
|
|
||||||
withProject: <T>(
|
|
||||||
callback: (project: {
|
|
||||||
directory: string
|
|
||||||
slug: string
|
|
||||||
gotoSession: (sessionID?: string) => Promise<void>
|
|
||||||
trackSession: (sessionID: string, directory?: string) => void
|
|
||||||
trackDirectory: (directory: string) => void
|
|
||||||
}) => Promise<T>,
|
|
||||||
options?: {
|
|
||||||
extra?: string[]
|
|
||||||
model?: { providerID: string; modelID: string }
|
|
||||||
setup?: (directory: string) => Promise<void>
|
|
||||||
},
|
|
||||||
) => Promise<T>
|
|
||||||
}
|
|
||||||
|
|
||||||
type WorkerFixtures = {
|
|
||||||
directory: string
|
|
||||||
slug: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export const test = base.extend<TestFixtures, WorkerFixtures>({
|
|
||||||
llm: async ({}, use) => {
|
|
||||||
const rt = ManagedRuntime.make(TestLLMServer.layer)
|
|
||||||
try {
|
|
||||||
const svc = await rt.runPromise(TestLLMServer.asEffect())
|
|
||||||
await use({
|
|
||||||
url: svc.url,
|
|
||||||
push: (...input) => rt.runPromise(svc.push(...input)),
|
|
||||||
text: (value, opts) => rt.runPromise(svc.text(value, opts)),
|
|
||||||
tool: (name, input) => rt.runPromise(svc.tool(name, input)),
|
|
||||||
toolHang: (name, input) => rt.runPromise(svc.toolHang(name, input)),
|
|
||||||
reason: (value, opts) => rt.runPromise(svc.reason(value, opts)),
|
|
||||||
fail: (message) => rt.runPromise(svc.fail(message)),
|
|
||||||
error: (status, body) => rt.runPromise(svc.error(status, body)),
|
|
||||||
hang: () => rt.runPromise(svc.hang),
|
|
||||||
hold: (value, wait) => rt.runPromise(svc.hold(value, wait)),
|
|
||||||
hits: () => rt.runPromise(svc.hits),
|
|
||||||
calls: () => rt.runPromise(svc.calls),
|
|
||||||
wait: (count) => rt.runPromise(svc.wait(count)),
|
|
||||||
inputs: () => rt.runPromise(svc.inputs),
|
|
||||||
pending: () => rt.runPromise(svc.pending),
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
await rt.dispose()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
page: async ({ page }, use) => {
|
|
||||||
let boundary: string | undefined
|
|
||||||
setHealthPhase(page, "test")
|
|
||||||
const consoleHandler = (msg: { text(): string }) => {
|
|
||||||
const text = msg.text()
|
|
||||||
if (!text.includes("[e2e:error-boundary]")) return
|
|
||||||
if (healthPhase(page) === "cleanup") {
|
|
||||||
console.warn(`[e2e:error-boundary][cleanup-warning]\n${text}`)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
boundary ||= text
|
|
||||||
console.log(text)
|
|
||||||
}
|
|
||||||
const pageErrorHandler = (err: Error) => {
|
|
||||||
console.log(`[e2e:pageerror] ${err.stack || err.message}`)
|
|
||||||
}
|
|
||||||
page.on("console", consoleHandler)
|
|
||||||
page.on("pageerror", pageErrorHandler)
|
|
||||||
await use(page)
|
|
||||||
page.off("console", consoleHandler)
|
|
||||||
page.off("pageerror", pageErrorHandler)
|
|
||||||
if (boundary) throw new Error(boundary)
|
|
||||||
},
|
|
||||||
directory: [
|
|
||||||
async ({}, use) => {
|
|
||||||
const directory = await getWorktree()
|
|
||||||
await use(directory)
|
|
||||||
},
|
|
||||||
{ scope: "worker" },
|
|
||||||
],
|
|
||||||
slug: [
|
|
||||||
async ({ directory }, use) => {
|
|
||||||
await use(dirSlug(directory))
|
|
||||||
},
|
|
||||||
{ scope: "worker" },
|
|
||||||
],
|
|
||||||
sdk: async ({ directory }, use) => {
|
|
||||||
await use(createSdk(directory))
|
|
||||||
},
|
|
||||||
gotoSession: async ({ page, directory }, use) => {
|
|
||||||
await seedStorage(page, { directory })
|
|
||||||
|
|
||||||
const gotoSession = async (sessionID?: string) => {
|
|
||||||
await page.goto(sessionPath(directory, sessionID))
|
|
||||||
await waitSession(page, { directory, sessionID })
|
|
||||||
}
|
|
||||||
await use(gotoSession)
|
|
||||||
},
|
|
||||||
withProject: async ({ page }, use) => {
|
|
||||||
await use(async (callback, options) => {
|
|
||||||
const root = await createTestProject()
|
|
||||||
const sessions = new Map<string, string>()
|
|
||||||
const dirs = new Set<string>()
|
|
||||||
await options?.setup?.(root)
|
|
||||||
await seedStorage(page, { directory: root, extra: options?.extra, model: options?.model })
|
|
||||||
|
|
||||||
const gotoSession = async (sessionID?: string) => {
|
|
||||||
await page.goto(sessionPath(root, sessionID))
|
|
||||||
await waitSession(page, { directory: root, sessionID })
|
|
||||||
const current = sessionIDFromUrl(page.url())
|
|
||||||
if (current) trackSession(current)
|
|
||||||
}
|
|
||||||
|
|
||||||
const trackSession = (sessionID: string, directory?: string) => {
|
|
||||||
sessions.set(sessionID, directory ?? root)
|
|
||||||
}
|
|
||||||
|
|
||||||
const trackDirectory = (directory: string) => {
|
|
||||||
if (directory !== root) dirs.add(directory)
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await gotoSession()
|
|
||||||
const slug = await waitSlug(page)
|
|
||||||
return await callback({ directory: root, slug, gotoSession, trackSession, trackDirectory })
|
|
||||||
} finally {
|
|
||||||
setHealthPhase(page, "cleanup")
|
|
||||||
await Promise.allSettled(
|
|
||||||
Array.from(sessions, ([sessionID, directory]) => cleanupSession({ sessionID, directory })),
|
|
||||||
)
|
|
||||||
await Promise.allSettled(Array.from(dirs, (directory) => cleanupTestProject(directory)))
|
|
||||||
await cleanupTestProject(root)
|
|
||||||
setHealthPhase(page, "test")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
async function seedStorage(
|
|
||||||
page: Page,
|
|
||||||
input: {
|
|
||||||
directory: string
|
|
||||||
extra?: string[]
|
|
||||||
model?: { providerID: string; modelID: string }
|
|
||||||
},
|
|
||||||
) {
|
|
||||||
await seedProjects(page, input)
|
|
||||||
await page.addInitScript((model: { providerID: string; modelID: string }) => {
|
|
||||||
const win = window as E2EWindow
|
|
||||||
win.__opencode_e2e = {
|
|
||||||
...win.__opencode_e2e,
|
|
||||||
model: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
prompt: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
terminal: {
|
|
||||||
enabled: true,
|
|
||||||
terminals: {},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
localStorage.setItem(
|
|
||||||
"opencode.global.dat:model",
|
|
||||||
JSON.stringify({
|
|
||||||
recent: [model],
|
|
||||||
user: [],
|
|
||||||
variant: {},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}, input.model ?? seedModel)
|
|
||||||
}
|
|
||||||
|
|
||||||
export { expect }
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { clickListItem } from "../actions"
|
|
||||||
|
|
||||||
test("smoke model selection updates prompt footer", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/model")
|
|
||||||
|
|
||||||
const command = page.locator('[data-slash-id="model.choose"]')
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await command.hover()
|
|
||||||
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const dialog = page.getByRole("dialog")
|
|
||||||
await expect(dialog).toBeVisible()
|
|
||||||
|
|
||||||
const input = dialog.getByRole("textbox").first()
|
|
||||||
|
|
||||||
const selected = dialog.locator('[data-slot="list-item"][data-selected="true"]').first()
|
|
||||||
await expect(selected).toBeVisible()
|
|
||||||
|
|
||||||
const other = dialog.locator('[data-slot="list-item"]:not([data-selected="true"])').first()
|
|
||||||
const target = (await other.count()) > 0 ? other : selected
|
|
||||||
|
|
||||||
const key = await target.getAttribute("data-key")
|
|
||||||
if (!key) throw new Error("Failed to resolve model key from list item")
|
|
||||||
|
|
||||||
const model = key.split(":").slice(1).join(":")
|
|
||||||
|
|
||||||
await input.fill(model)
|
|
||||||
|
|
||||||
await clickListItem(dialog, { key })
|
|
||||||
|
|
||||||
await expect(dialog).toHaveCount(0)
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/model")
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await command.hover()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const dialogAgain = page.getByRole("dialog")
|
|
||||||
await expect(dialogAgain).toBeVisible()
|
|
||||||
await expect(dialogAgain.locator(`[data-slot="list-item"][data-key="${key}"][data-selected="true"]`)).toBeVisible()
|
|
||||||
})
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { closeDialog, openSettings, clickListItem } from "../actions"
|
|
||||||
|
|
||||||
test("hiding a model removes it from the model picker", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/model")
|
|
||||||
|
|
||||||
const command = page.locator('[data-slash-id="model.choose"]')
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await command.hover()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const picker = page.getByRole("dialog")
|
|
||||||
await expect(picker).toBeVisible()
|
|
||||||
|
|
||||||
const target = picker.locator('[data-slot="list-item"]').first()
|
|
||||||
await expect(target).toBeVisible()
|
|
||||||
|
|
||||||
const key = await target.getAttribute("data-key")
|
|
||||||
if (!key) throw new Error("Failed to resolve model key from list item")
|
|
||||||
|
|
||||||
const name = (await target.locator("span").first().innerText()).trim()
|
|
||||||
if (!name) throw new Error("Failed to resolve model name from list item")
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(picker).toHaveCount(0)
|
|
||||||
|
|
||||||
const settings = await openSettings(page)
|
|
||||||
|
|
||||||
await settings.getByRole("tab", { name: "Models" }).click()
|
|
||||||
const search = settings.getByPlaceholder("Search models")
|
|
||||||
await expect(search).toBeVisible()
|
|
||||||
await search.fill(name)
|
|
||||||
|
|
||||||
const toggle = settings.locator('[data-component="switch"]').filter({ hasText: name }).first()
|
|
||||||
const input = toggle.locator('[data-slot="switch-input"]')
|
|
||||||
await expect(toggle).toBeVisible()
|
|
||||||
await expect(input).toHaveAttribute("aria-checked", "true")
|
|
||||||
await toggle.locator('[data-slot="switch-control"]').click()
|
|
||||||
await expect(input).toHaveAttribute("aria-checked", "false")
|
|
||||||
|
|
||||||
await closeDialog(page, settings)
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/model")
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await command.hover()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const pickerAgain = page.getByRole("dialog")
|
|
||||||
await expect(pickerAgain).toBeVisible()
|
|
||||||
await expect(pickerAgain.locator('[data-slot="list-item"]').first()).toBeVisible()
|
|
||||||
|
|
||||||
await expect(pickerAgain.locator(`[data-slot="list-item"][data-key="${key}"]`)).toHaveCount(0)
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(pickerAgain).toHaveCount(0)
|
|
||||||
})
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { clickMenuItem, openProjectMenu, openSidebar } from "../actions"
|
|
||||||
|
|
||||||
test("dialog edit project updates name and startup script", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
await withProject(async ({ slug }) => {
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
const open = async () => {
|
|
||||||
const menu = await openProjectMenu(page, slug)
|
|
||||||
await clickMenuItem(menu, /^Edit$/i, { force: true })
|
|
||||||
|
|
||||||
const dialog = page.getByRole("dialog")
|
|
||||||
await expect(dialog).toBeVisible()
|
|
||||||
await expect(dialog.getByRole("heading", { level: 2 })).toHaveText("Edit project")
|
|
||||||
return dialog
|
|
||||||
}
|
|
||||||
|
|
||||||
const name = `e2e project ${Date.now()}`
|
|
||||||
const startup = `echo e2e_${Date.now()}`
|
|
||||||
|
|
||||||
const dialog = await open()
|
|
||||||
|
|
||||||
const nameInput = dialog.getByLabel("Name")
|
|
||||||
await nameInput.fill(name)
|
|
||||||
|
|
||||||
const startupInput = dialog.getByLabel("Workspace startup script")
|
|
||||||
await startupInput.fill(startup)
|
|
||||||
|
|
||||||
await dialog.getByRole("button", { name: "Save" }).click()
|
|
||||||
await expect(dialog).toHaveCount(0)
|
|
||||||
|
|
||||||
const header = page.locator(".group\\/project").first()
|
|
||||||
await expect(header).toContainText(name)
|
|
||||||
|
|
||||||
const reopened = await open()
|
|
||||||
await expect(reopened.getByLabel("Name")).toHaveValue(name)
|
|
||||||
await expect(reopened.getByLabel("Workspace startup script")).toHaveValue(startup)
|
|
||||||
await reopened.getByRole("button", { name: "Cancel" }).click()
|
|
||||||
await expect(reopened).toHaveCount(0)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { createTestProject, cleanupTestProject, openSidebar, clickMenuItem, openProjectMenu } from "../actions"
|
|
||||||
import { projectSwitchSelector } from "../selectors"
|
|
||||||
import { dirSlug } from "../utils"
|
|
||||||
|
|
||||||
test("closing active project navigates to another open project", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
const other = await createTestProject()
|
|
||||||
const otherSlug = dirSlug(other)
|
|
||||||
|
|
||||||
try {
|
|
||||||
await withProject(
|
|
||||||
async ({ slug }) => {
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
const otherButton = page.locator(projectSwitchSelector(otherSlug)).first()
|
|
||||||
await expect(otherButton).toBeVisible()
|
|
||||||
await otherButton.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${otherSlug}/session`))
|
|
||||||
|
|
||||||
const menu = await openProjectMenu(page, otherSlug)
|
|
||||||
|
|
||||||
await clickMenuItem(menu, /^Close$/i, { force: true })
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
() => {
|
|
||||||
const pathname = new URL(page.url()).pathname
|
|
||||||
if (new RegExp(`^/${slug}/session(?:/[^/]+)?/?$`).test(pathname)) return "project"
|
|
||||||
if (pathname === "/") return "home"
|
|
||||||
return ""
|
|
||||||
},
|
|
||||||
{ timeout: 15_000 },
|
|
||||||
)
|
|
||||||
.toMatch(/^(project|home)$/)
|
|
||||||
|
|
||||||
await expect(page).not.toHaveURL(new RegExp(`/${otherSlug}/session(?:[/?#]|$)`))
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
return await page.locator(projectSwitchSelector(otherSlug)).count()
|
|
||||||
},
|
|
||||||
{ timeout: 15_000 },
|
|
||||||
)
|
|
||||||
.toBe(0)
|
|
||||||
},
|
|
||||||
{ extra: [other] },
|
|
||||||
)
|
|
||||||
} finally {
|
|
||||||
await cleanupTestProject(other)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
import { base64Decode } from "@opencode-ai/util/encode"
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
import {
|
|
||||||
defocus,
|
|
||||||
createTestProject,
|
|
||||||
cleanupTestProject,
|
|
||||||
openSidebar,
|
|
||||||
sessionIDFromUrl,
|
|
||||||
setWorkspacesEnabled,
|
|
||||||
waitSession,
|
|
||||||
waitSessionSaved,
|
|
||||||
waitSlug,
|
|
||||||
} from "../actions"
|
|
||||||
import { projectSwitchSelector, promptSelector, workspaceItemSelector, workspaceNewSessionSelector } from "../selectors"
|
|
||||||
import { dirSlug, resolveDirectory } from "../utils"
|
|
||||||
|
|
||||||
test("can switch between projects from sidebar", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
const other = await createTestProject()
|
|
||||||
const otherSlug = dirSlug(other)
|
|
||||||
|
|
||||||
try {
|
|
||||||
await withProject(
|
|
||||||
async ({ directory }) => {
|
|
||||||
await defocus(page)
|
|
||||||
|
|
||||||
const currentSlug = dirSlug(directory)
|
|
||||||
const otherButton = page.locator(projectSwitchSelector(otherSlug)).first()
|
|
||||||
await expect(otherButton).toBeVisible()
|
|
||||||
await otherButton.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${otherSlug}/session`))
|
|
||||||
|
|
||||||
const currentButton = page.locator(projectSwitchSelector(currentSlug)).first()
|
|
||||||
await expect(currentButton).toBeVisible()
|
|
||||||
await currentButton.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${currentSlug}/session`))
|
|
||||||
},
|
|
||||||
{ extra: [other] },
|
|
||||||
)
|
|
||||||
} finally {
|
|
||||||
await cleanupTestProject(other)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
test("switching back to a project opens the latest workspace session", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
const other = await createTestProject()
|
|
||||||
const otherSlug = dirSlug(other)
|
|
||||||
try {
|
|
||||||
await withProject(
|
|
||||||
async ({ directory, slug, trackSession, trackDirectory }) => {
|
|
||||||
await defocus(page)
|
|
||||||
await setWorkspacesEnabled(page, slug, true)
|
|
||||||
await openSidebar(page)
|
|
||||||
await expect(page.getByRole("button", { name: "New workspace" }).first()).toBeVisible()
|
|
||||||
|
|
||||||
await page.getByRole("button", { name: "New workspace" }).first().click()
|
|
||||||
|
|
||||||
const raw = await waitSlug(page, [slug])
|
|
||||||
const dir = base64Decode(raw)
|
|
||||||
if (!dir) throw new Error(`Failed to decode workspace slug: ${raw}`)
|
|
||||||
const space = await resolveDirectory(dir)
|
|
||||||
const next = dirSlug(space)
|
|
||||||
trackDirectory(space)
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
const item = page.locator(`${workspaceItemSelector(next)}, ${workspaceItemSelector(raw)}`).first()
|
|
||||||
await expect(item).toBeVisible()
|
|
||||||
await item.hover()
|
|
||||||
|
|
||||||
const btn = page.locator(`${workspaceNewSessionSelector(next)}, ${workspaceNewSessionSelector(raw)}`).first()
|
|
||||||
await expect(btn).toBeVisible()
|
|
||||||
await btn.click({ force: true })
|
|
||||||
|
|
||||||
await waitSession(page, { directory: space })
|
|
||||||
|
|
||||||
// Create a session by sending a prompt
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
await expect(prompt).toBeVisible()
|
|
||||||
await prompt.fill("test")
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
// Wait for the URL to update with the new session ID
|
|
||||||
await expect.poll(() => sessionIDFromUrl(page.url()) ?? "", { timeout: 15_000 }).not.toBe("")
|
|
||||||
|
|
||||||
const created = sessionIDFromUrl(page.url())
|
|
||||||
if (!created) throw new Error(`Failed to get session ID from url: ${page.url()}`)
|
|
||||||
trackSession(created, space)
|
|
||||||
await waitSessionSaved(space, created)
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${next}/session/${created}(?:[/?#]|$)`))
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
const otherButton = page.locator(projectSwitchSelector(otherSlug)).first()
|
|
||||||
await expect(otherButton).toBeVisible()
|
|
||||||
await otherButton.click({ force: true })
|
|
||||||
await waitSession(page, { directory: other })
|
|
||||||
|
|
||||||
const rootButton = page.locator(projectSwitchSelector(slug)).first()
|
|
||||||
await expect(rootButton).toBeVisible()
|
|
||||||
await rootButton.click({ force: true })
|
|
||||||
|
|
||||||
await waitSession(page, { directory: space, sessionID: created })
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/session/${created}(?:[/?#]|$)`))
|
|
||||||
},
|
|
||||||
{ extra: [other] },
|
|
||||||
)
|
|
||||||
} finally {
|
|
||||||
await cleanupTestProject(other)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
import type { Page } from "@playwright/test"
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
import {
|
|
||||||
openSidebar,
|
|
||||||
resolveSlug,
|
|
||||||
sessionIDFromUrl,
|
|
||||||
setWorkspacesEnabled,
|
|
||||||
waitDir,
|
|
||||||
waitSession,
|
|
||||||
waitSessionSaved,
|
|
||||||
waitSlug,
|
|
||||||
} from "../actions"
|
|
||||||
import { promptSelector, workspaceItemSelector, workspaceNewSessionSelector } from "../selectors"
|
|
||||||
import { createSdk } from "../utils"
|
|
||||||
|
|
||||||
function item(space: { slug: string; raw: string }) {
|
|
||||||
return `${workspaceItemSelector(space.slug)}, ${workspaceItemSelector(space.raw)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
function button(space: { slug: string; raw: string }) {
|
|
||||||
return `${workspaceNewSessionSelector(space.slug)}, ${workspaceNewSessionSelector(space.raw)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
async function waitWorkspaceReady(page: Page, space: { slug: string; raw: string }) {
|
|
||||||
await openSidebar(page)
|
|
||||||
await expect(page.locator(item(space)).first()).toBeVisible({ timeout: 60_000 })
|
|
||||||
}
|
|
||||||
|
|
||||||
async function createWorkspace(page: Page, root: string, seen: string[]) {
|
|
||||||
await openSidebar(page)
|
|
||||||
await page.getByRole("button", { name: "New workspace" }).first().click()
|
|
||||||
|
|
||||||
const next = await resolveSlug(await waitSlug(page, [root, ...seen]))
|
|
||||||
await waitDir(page, next.directory)
|
|
||||||
return next
|
|
||||||
}
|
|
||||||
|
|
||||||
async function openWorkspaceNewSession(page: Page, space: { slug: string; raw: string; directory: string }) {
|
|
||||||
await waitWorkspaceReady(page, space)
|
|
||||||
|
|
||||||
const row = page.locator(item(space)).first()
|
|
||||||
await row.hover()
|
|
||||||
|
|
||||||
const next = page.locator(button(space)).first()
|
|
||||||
await expect(next).toBeVisible()
|
|
||||||
await next.click({ force: true })
|
|
||||||
|
|
||||||
await waitSession(page, { directory: space.directory })
|
|
||||||
await expect.poll(() => sessionIDFromUrl(page.url()) ?? "").toBe("")
|
|
||||||
}
|
|
||||||
|
|
||||||
async function createSessionFromWorkspace(
|
|
||||||
page: Page,
|
|
||||||
space: { slug: string; raw: string; directory: string },
|
|
||||||
text: string,
|
|
||||||
) {
|
|
||||||
await openWorkspaceNewSession(page, space)
|
|
||||||
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
await expect(prompt).toBeVisible()
|
|
||||||
await prompt.fill(text)
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect.poll(() => sessionIDFromUrl(page.url()) ?? "", { timeout: 15_000 }).not.toBe("")
|
|
||||||
const sessionID = sessionIDFromUrl(page.url())
|
|
||||||
if (!sessionID) throw new Error(`Failed to parse session id from url: ${page.url()}`)
|
|
||||||
|
|
||||||
await waitSessionSaved(space.directory, sessionID)
|
|
||||||
await createSdk(space.directory)
|
|
||||||
.session.abort({ sessionID })
|
|
||||||
.catch(() => undefined)
|
|
||||||
return sessionID
|
|
||||||
}
|
|
||||||
|
|
||||||
test("new sessions from sidebar workspace actions stay in selected workspace", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
await withProject(async ({ slug: root, trackDirectory, trackSession }) => {
|
|
||||||
await openSidebar(page)
|
|
||||||
await setWorkspacesEnabled(page, root, true)
|
|
||||||
|
|
||||||
const first = await createWorkspace(page, root, [])
|
|
||||||
trackDirectory(first.directory)
|
|
||||||
await waitWorkspaceReady(page, first)
|
|
||||||
|
|
||||||
const second = await createWorkspace(page, root, [first.slug])
|
|
||||||
trackDirectory(second.directory)
|
|
||||||
await waitWorkspaceReady(page, second)
|
|
||||||
|
|
||||||
trackSession(await createSessionFromWorkspace(page, first, `workspace one ${Date.now()}`), first.directory)
|
|
||||||
trackSession(await createSessionFromWorkspace(page, second, `workspace two ${Date.now()}`), second.directory)
|
|
||||||
trackSession(await createSessionFromWorkspace(page, first, `workspace one again ${Date.now()}`), first.directory)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,375 +0,0 @@
|
|||||||
import fs from "node:fs/promises"
|
|
||||||
import os from "node:os"
|
|
||||||
import path from "node:path"
|
|
||||||
import { base64Decode } from "@opencode-ai/util/encode"
|
|
||||||
import type { Page } from "@playwright/test"
|
|
||||||
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
|
|
||||||
test.describe.configure({ mode: "serial" })
|
|
||||||
import {
|
|
||||||
cleanupTestProject,
|
|
||||||
clickMenuItem,
|
|
||||||
confirmDialog,
|
|
||||||
openSidebar,
|
|
||||||
openWorkspaceMenu,
|
|
||||||
resolveSlug,
|
|
||||||
setWorkspacesEnabled,
|
|
||||||
slugFromUrl,
|
|
||||||
waitDir,
|
|
||||||
waitSlug,
|
|
||||||
} from "../actions"
|
|
||||||
import { dropdownMenuContentSelector, inlineInputSelector, workspaceItemSelector } from "../selectors"
|
|
||||||
import { createSdk, dirSlug } from "../utils"
|
|
||||||
|
|
||||||
async function setupWorkspaceTest(page: Page, project: { slug: string }) {
|
|
||||||
const rootSlug = project.slug
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
await setWorkspacesEnabled(page, rootSlug, true)
|
|
||||||
|
|
||||||
await page.getByRole("button", { name: "New workspace" }).first().click()
|
|
||||||
const next = await resolveSlug(await waitSlug(page, [rootSlug]))
|
|
||||||
await waitDir(page, next.directory)
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const item = page.locator(workspaceItemSelector(next.slug)).first()
|
|
||||||
try {
|
|
||||||
await item.hover({ timeout: 500 })
|
|
||||||
return true
|
|
||||||
} catch {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
|
|
||||||
return { rootSlug, slug: next.slug, directory: next.directory }
|
|
||||||
}
|
|
||||||
|
|
||||||
test("can enable and disable workspaces from project menu", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
await withProject(async ({ slug }) => {
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
await expect(page.getByRole("button", { name: "New session" }).first()).toBeVisible()
|
|
||||||
await expect(page.getByRole("button", { name: "New workspace" })).toHaveCount(0)
|
|
||||||
|
|
||||||
await setWorkspacesEnabled(page, slug, true)
|
|
||||||
await expect(page.getByRole("button", { name: "New workspace" }).first()).toBeVisible()
|
|
||||||
await expect(page.locator(workspaceItemSelector(slug)).first()).toBeVisible()
|
|
||||||
|
|
||||||
await setWorkspacesEnabled(page, slug, false)
|
|
||||||
await expect(page.getByRole("button", { name: "New session" }).first()).toBeVisible()
|
|
||||||
await expect(page.locator(workspaceItemSelector(slug))).toHaveCount(0)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("can create a workspace", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
await withProject(async ({ slug }) => {
|
|
||||||
await openSidebar(page)
|
|
||||||
await setWorkspacesEnabled(page, slug, true)
|
|
||||||
|
|
||||||
await expect(page.getByRole("button", { name: "New workspace" }).first()).toBeVisible()
|
|
||||||
|
|
||||||
await page.getByRole("button", { name: "New workspace" }).first().click()
|
|
||||||
const next = await resolveSlug(await waitSlug(page, [slug]))
|
|
||||||
await waitDir(page, next.directory)
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const item = page.locator(workspaceItemSelector(next.slug)).first()
|
|
||||||
try {
|
|
||||||
await item.hover({ timeout: 500 })
|
|
||||||
return true
|
|
||||||
} catch {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
|
|
||||||
await expect(page.locator(workspaceItemSelector(next.slug)).first()).toBeVisible()
|
|
||||||
|
|
||||||
await cleanupTestProject(next.directory)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("non-git projects keep workspace mode disabled", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
const nonGit = await fs.mkdtemp(path.join(os.tmpdir(), "opencode-e2e-project-nongit-"))
|
|
||||||
const nonGitSlug = dirSlug(nonGit)
|
|
||||||
|
|
||||||
await fs.writeFile(path.join(nonGit, "README.md"), "# e2e nongit\n")
|
|
||||||
|
|
||||||
try {
|
|
||||||
await withProject(async () => {
|
|
||||||
await page.goto(`/${nonGitSlug}/session`)
|
|
||||||
|
|
||||||
await expect.poll(() => slugFromUrl(page.url()), { timeout: 30_000 }).not.toBe("")
|
|
||||||
|
|
||||||
const activeDir = await resolveSlug(slugFromUrl(page.url())).then((item) => item.directory)
|
|
||||||
expect(path.basename(activeDir)).toContain("opencode-e2e-project-nongit-")
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
await expect(page.getByRole("button", { name: "New workspace" })).toHaveCount(0)
|
|
||||||
|
|
||||||
const trigger = page.locator('[data-action="project-menu"]').first()
|
|
||||||
const hasMenu = await trigger
|
|
||||||
.isVisible()
|
|
||||||
.then((x) => x)
|
|
||||||
.catch(() => false)
|
|
||||||
if (!hasMenu) return
|
|
||||||
|
|
||||||
await trigger.click({ force: true })
|
|
||||||
|
|
||||||
const menu = page.locator(dropdownMenuContentSelector).first()
|
|
||||||
await expect(menu).toBeVisible()
|
|
||||||
|
|
||||||
const toggle = menu.locator('[data-action="project-workspaces-toggle"]').first()
|
|
||||||
|
|
||||||
await expect(toggle).toBeVisible()
|
|
||||||
await expect(toggle).toBeDisabled()
|
|
||||||
await expect(menu.getByRole("menuitem", { name: "New workspace" })).toHaveCount(0)
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
await cleanupTestProject(nonGit)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
test("can rename a workspace", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
await withProject(async (project) => {
|
|
||||||
const { slug } = await setupWorkspaceTest(page, project)
|
|
||||||
|
|
||||||
const rename = `e2e workspace ${Date.now()}`
|
|
||||||
const menu = await openWorkspaceMenu(page, slug)
|
|
||||||
await clickMenuItem(menu, /^Rename$/i, { force: true })
|
|
||||||
|
|
||||||
await expect(menu).toHaveCount(0)
|
|
||||||
|
|
||||||
const item = page.locator(workspaceItemSelector(slug)).first()
|
|
||||||
await expect(item).toBeVisible()
|
|
||||||
const input = item.locator(inlineInputSelector).first()
|
|
||||||
await expect(input).toBeVisible()
|
|
||||||
await input.fill(rename)
|
|
||||||
await input.press("Enter")
|
|
||||||
await expect(item).toContainText(rename)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("can reset a workspace", async ({ page, sdk, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
await withProject(async (project) => {
|
|
||||||
const { slug, directory: createdDir } = await setupWorkspaceTest(page, project)
|
|
||||||
|
|
||||||
const readme = path.join(createdDir, "README.md")
|
|
||||||
const extra = path.join(createdDir, `e2e_reset_${Date.now()}.txt`)
|
|
||||||
const original = await fs.readFile(readme, "utf8")
|
|
||||||
const dirty = `${original.trimEnd()}\n\nchange_${Date.now()}\n`
|
|
||||||
await fs.writeFile(readme, dirty, "utf8")
|
|
||||||
await fs.writeFile(extra, `created_${Date.now()}\n`, "utf8")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await fs
|
|
||||||
.stat(extra)
|
|
||||||
.then(() => true)
|
|
||||||
.catch(() => false)
|
|
||||||
})
|
|
||||||
.toBe(true)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
const files = await sdk.file
|
|
||||||
.status({ directory: createdDir })
|
|
||||||
.then((r) => r.data ?? [])
|
|
||||||
.catch(() => [])
|
|
||||||
return files.length
|
|
||||||
})
|
|
||||||
.toBeGreaterThan(0)
|
|
||||||
|
|
||||||
const menu = await openWorkspaceMenu(page, slug)
|
|
||||||
await clickMenuItem(menu, /^Reset$/i, { force: true })
|
|
||||||
await confirmDialog(page, /^Reset workspace$/i)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const files = await sdk.file
|
|
||||||
.status({ directory: createdDir })
|
|
||||||
.then((r) => r.data ?? [])
|
|
||||||
.catch(() => [])
|
|
||||||
return files.length
|
|
||||||
},
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
.toBe(0)
|
|
||||||
|
|
||||||
await expect.poll(() => fs.readFile(readme, "utf8"), { timeout: 60_000 }).toBe(original)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await fs
|
|
||||||
.stat(extra)
|
|
||||||
.then(() => true)
|
|
||||||
.catch(() => false)
|
|
||||||
})
|
|
||||||
.toBe(false)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("can delete a workspace", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
await withProject(async (project) => {
|
|
||||||
const sdk = createSdk(project.directory)
|
|
||||||
const { rootSlug, slug, directory } = await setupWorkspaceTest(page, project)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const worktrees = await sdk.worktree
|
|
||||||
.list()
|
|
||||||
.then((r) => r.data ?? [])
|
|
||||||
.catch(() => [] as string[])
|
|
||||||
return worktrees.includes(directory)
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
|
|
||||||
const menu = await openWorkspaceMenu(page, slug)
|
|
||||||
await clickMenuItem(menu, /^Delete$/i, { force: true })
|
|
||||||
await confirmDialog(page, /^Delete workspace$/i)
|
|
||||||
|
|
||||||
await expect.poll(() => base64Decode(slugFromUrl(page.url()))).toBe(project.directory)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const worktrees = await sdk.worktree
|
|
||||||
.list()
|
|
||||||
.then((r) => r.data ?? [])
|
|
||||||
.catch(() => [] as string[])
|
|
||||||
return worktrees.includes(directory)
|
|
||||||
},
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
.toBe(false)
|
|
||||||
|
|
||||||
await project.gotoSession()
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
await expect(page.locator(workspaceItemSelector(slug))).toHaveCount(0, { timeout: 60_000 })
|
|
||||||
await expect(page.locator(workspaceItemSelector(rootSlug)).first()).toBeVisible()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("can reorder workspaces by drag and drop", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
await withProject(async ({ slug: rootSlug }) => {
|
|
||||||
const workspaces = [] as { directory: string; slug: string }[]
|
|
||||||
|
|
||||||
const listSlugs = async () => {
|
|
||||||
const nodes = page.locator('[data-component="sidebar-nav-desktop"] [data-component="workspace-item"]')
|
|
||||||
const slugs = await nodes.evaluateAll((els) => {
|
|
||||||
return els.map((el) => el.getAttribute("data-workspace") ?? "").filter((x) => x.length > 0)
|
|
||||||
})
|
|
||||||
return slugs
|
|
||||||
}
|
|
||||||
|
|
||||||
const waitReady = async (slug: string) => {
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const item = page.locator(workspaceItemSelector(slug)).first()
|
|
||||||
try {
|
|
||||||
await item.hover({ timeout: 500 })
|
|
||||||
return true
|
|
||||||
} catch {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
const drag = async (from: string, to: string) => {
|
|
||||||
const src = page.locator(workspaceItemSelector(from)).first()
|
|
||||||
const dst = page.locator(workspaceItemSelector(to)).first()
|
|
||||||
|
|
||||||
const a = await src.boundingBox()
|
|
||||||
const b = await dst.boundingBox()
|
|
||||||
if (!a || !b) throw new Error("Failed to resolve workspace drag bounds")
|
|
||||||
|
|
||||||
await page.mouse.move(a.x + a.width / 2, a.y + a.height / 2)
|
|
||||||
await page.mouse.down()
|
|
||||||
await page.mouse.move(b.x + b.width / 2, b.y + b.height / 2, { steps: 12 })
|
|
||||||
await page.mouse.up()
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
await setWorkspacesEnabled(page, rootSlug, true)
|
|
||||||
|
|
||||||
for (const _ of [0, 1]) {
|
|
||||||
const prev = slugFromUrl(page.url())
|
|
||||||
await page.getByRole("button", { name: "New workspace" }).first().click()
|
|
||||||
const next = await resolveSlug(await waitSlug(page, [rootSlug, prev]))
|
|
||||||
await waitDir(page, next.directory)
|
|
||||||
workspaces.push(next)
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (workspaces.length !== 2) throw new Error("Expected two created workspaces")
|
|
||||||
|
|
||||||
const a = workspaces[0].slug
|
|
||||||
const b = workspaces[1].slug
|
|
||||||
|
|
||||||
await waitReady(a)
|
|
||||||
await waitReady(b)
|
|
||||||
|
|
||||||
const list = async () => {
|
|
||||||
const slugs = await listSlugs()
|
|
||||||
return slugs.filter((s) => s !== rootSlug && (s === a || s === b)).slice(0, 2)
|
|
||||||
}
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
const slugs = await list()
|
|
||||||
return slugs.length === 2
|
|
||||||
})
|
|
||||||
.toBe(true)
|
|
||||||
|
|
||||||
const before = await list()
|
|
||||||
const from = before[1]
|
|
||||||
const to = before[0]
|
|
||||||
if (!from || !to) throw new Error("Failed to resolve initial workspace order")
|
|
||||||
|
|
||||||
await drag(from, to)
|
|
||||||
|
|
||||||
await expect.poll(async () => await list()).toEqual([from, to])
|
|
||||||
} finally {
|
|
||||||
await Promise.all(workspaces.map((w) => cleanupTestProject(w.directory)))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import type { Page } from "@playwright/test"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { withSession } from "../actions"
|
|
||||||
|
|
||||||
function contextButton(page: Page) {
|
|
||||||
return page
|
|
||||||
.locator('[data-component="button"]')
|
|
||||||
.filter({ has: page.locator('[data-component="progress-circle"]').first() })
|
|
||||||
.first()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function seedContextSession(input: { sessionID: string; sdk: Parameters<typeof withSession>[0] }) {
|
|
||||||
await input.sdk.session.promptAsync({
|
|
||||||
sessionID: input.sessionID,
|
|
||||||
noReply: true,
|
|
||||||
parts: [
|
|
||||||
{
|
|
||||||
type: "text",
|
|
||||||
text: "seed context",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
const messages = await input.sdk.session
|
|
||||||
.messages({ sessionID: input.sessionID, limit: 1 })
|
|
||||||
.then((r) => r.data ?? [])
|
|
||||||
return messages.length
|
|
||||||
})
|
|
||||||
.toBeGreaterThan(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
test("context panel can be opened from the prompt", async ({ page, sdk, gotoSession }) => {
|
|
||||||
const title = `e2e smoke context ${Date.now()}`
|
|
||||||
|
|
||||||
await withSession(sdk, title, async (session) => {
|
|
||||||
await seedContextSession({ sessionID: session.id, sdk })
|
|
||||||
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
const trigger = contextButton(page)
|
|
||||||
await expect(trigger).toBeVisible()
|
|
||||||
await trigger.click()
|
|
||||||
|
|
||||||
const tabs = page.locator('[data-component="tabs"][data-variant="normal"]')
|
|
||||||
await expect(tabs.getByRole("tab", { name: "Context" })).toBeVisible()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("context panel can be closed from the context tab close action", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withSession(sdk, `e2e context toggle ${Date.now()}`, async (session) => {
|
|
||||||
await seedContextSession({ sessionID: session.id, sdk })
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
|
|
||||||
const trigger = contextButton(page)
|
|
||||||
await expect(trigger).toBeVisible()
|
|
||||||
await trigger.click()
|
|
||||||
|
|
||||||
const tabs = page.locator('[data-component="tabs"][data-variant="normal"]')
|
|
||||||
const context = tabs.getByRole("tab", { name: "Context" })
|
|
||||||
await expect(context).toBeVisible()
|
|
||||||
|
|
||||||
await page.getByRole("button", { name: "Close tab" }).first().click()
|
|
||||||
await expect(context).toHaveCount(0)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("context panel can open file picker from context actions", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withSession(sdk, `e2e context tabs ${Date.now()}`, async (session) => {
|
|
||||||
await seedContextSession({ sessionID: session.id, sdk })
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
|
|
||||||
const trigger = contextButton(page)
|
|
||||||
await expect(trigger).toBeVisible()
|
|
||||||
await trigger.click()
|
|
||||||
|
|
||||||
await expect(page.getByRole("tab", { name: "Context" })).toBeVisible()
|
|
||||||
await page.getByRole("button", { name: "Open file" }).first().click()
|
|
||||||
|
|
||||||
const dialog = page
|
|
||||||
.getByRole("dialog")
|
|
||||||
.filter({ has: page.getByPlaceholder(/search files/i) })
|
|
||||||
.first()
|
|
||||||
await expect(dialog).toBeVisible()
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(dialog).toHaveCount(0)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { cleanupSession, sessionIDFromUrl, withSession } from "../actions"
|
|
||||||
|
|
||||||
const text = (value: string | null) => (value ?? "").replace(/\u200B/g, "").trim()
|
|
||||||
|
|
||||||
// Regression test for Issue #12453: the synchronous POST /message endpoint holds
|
|
||||||
// the connection open while the agent works, causing "Failed to fetch" over
|
|
||||||
// VPN/Tailscale. The fix switches to POST /prompt_async which returns immediately.
|
|
||||||
test("prompt succeeds when sync message endpoint is unreachable", async ({ page, sdk, gotoSession }) => {
|
|
||||||
test.setTimeout(120_000)
|
|
||||||
|
|
||||||
// Simulate Tailscale/VPN killing the long-lived sync connection
|
|
||||||
await page.route("**/session/*/message", (route) => route.abort("connectionfailed"))
|
|
||||||
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const token = `E2E_ASYNC_${Date.now()}`
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type(`Reply with exactly: ${token}`)
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(/\/session\/[^/?#]+/, { timeout: 30_000 })
|
|
||||||
const sessionID = sessionIDFromUrl(page.url())!
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Agent response arrives via SSE despite sync endpoint being dead
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const messages = await sdk.session.messages({ sessionID, limit: 50 }).then((r) => r.data ?? [])
|
|
||||||
return messages
|
|
||||||
.filter((m) => m.info.role === "assistant")
|
|
||||||
.flatMap((m) => m.parts)
|
|
||||||
.filter((p) => p.type === "text")
|
|
||||||
.map((p) => p.text)
|
|
||||||
.join("\n")
|
|
||||||
},
|
|
||||||
{ timeout: 90_000 },
|
|
||||||
)
|
|
||||||
.toContain(token)
|
|
||||||
} finally {
|
|
||||||
await cleanupSession({ sdk, sessionID })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
test("failed prompt send restores the composer input", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withSession(sdk, `e2e prompt failure ${Date.now()}`, async (session) => {
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
const value = `restore ${Date.now()}`
|
|
||||||
|
|
||||||
await page.route(`**/session/${session.id}/prompt_async`, (route) =>
|
|
||||||
route.fulfill({
|
|
||||||
status: 500,
|
|
||||||
contentType: "application/json",
|
|
||||||
body: JSON.stringify({ message: "e2e prompt failure" }),
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
await gotoSession(session.id)
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type(value)
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect.poll(async () => text(await prompt.textContent())).toBe(value)
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const messages = await sdk.session.messages({ sessionID: session.id, limit: 50 }).then((r) => r.data ?? [])
|
|
||||||
return messages.length
|
|
||||||
},
|
|
||||||
{ timeout: 15_000 },
|
|
||||||
)
|
|
||||||
.toBe(0)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
|
|
||||||
test("dropping text/plain file: uri inserts a file pill", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
await prompt.click()
|
|
||||||
|
|
||||||
const path = process.platform === "win32" ? "C:\\opencode-e2e-drop.txt" : "/tmp/opencode-e2e-drop.txt"
|
|
||||||
const dt = await page.evaluateHandle((text) => {
|
|
||||||
const dt = new DataTransfer()
|
|
||||||
dt.setData("text/plain", text)
|
|
||||||
return dt
|
|
||||||
}, `file:${path}`)
|
|
||||||
|
|
||||||
await page.dispatchEvent("body", "drop", { dataTransfer: dt })
|
|
||||||
|
|
||||||
const pill = page.locator(`${promptSelector} [data-type="file"]`).first()
|
|
||||||
await expect(pill).toBeVisible()
|
|
||||||
await expect(pill).toHaveAttribute("data-path", path)
|
|
||||||
})
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
|
|
||||||
test("dropping an image file adds an attachment", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
await prompt.click()
|
|
||||||
|
|
||||||
const png = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO3+4uQAAAAASUVORK5CYII="
|
|
||||||
const dt = await page.evaluateHandle((b64) => {
|
|
||||||
const dt = new DataTransfer()
|
|
||||||
const bytes = Uint8Array.from(atob(b64), (c) => c.charCodeAt(0))
|
|
||||||
const file = new File([bytes], "drop.png", { type: "image/png" })
|
|
||||||
dt.items.add(file)
|
|
||||||
return dt
|
|
||||||
}, png)
|
|
||||||
|
|
||||||
await page.dispatchEvent("body", "drop", { dataTransfer: dt })
|
|
||||||
|
|
||||||
const img = page.locator('img[alt="drop.png"]').first()
|
|
||||||
await expect(img).toBeVisible()
|
|
||||||
|
|
||||||
const remove = page.getByRole("button", { name: "Remove attachment" }).first()
|
|
||||||
await expect(remove).toBeVisible()
|
|
||||||
|
|
||||||
await img.hover()
|
|
||||||
await remove.click()
|
|
||||||
await expect(page.locator('img[alt="drop.png"]')).toHaveCount(0)
|
|
||||||
})
|
|
||||||
@@ -1,184 +0,0 @@
|
|||||||
import type { ToolPart } from "@opencode-ai/sdk/v2/client"
|
|
||||||
import type { Page } from "@playwright/test"
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { withSession } from "../actions"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
|
|
||||||
const text = (value: string | null) => (value ?? "").replace(/\u200B/g, "").trim()
|
|
||||||
|
|
||||||
const isBash = (part: unknown): part is ToolPart => {
|
|
||||||
if (!part || typeof part !== "object") return false
|
|
||||||
if (!("type" in part) || part.type !== "tool") return false
|
|
||||||
if (!("tool" in part) || part.tool !== "bash") return false
|
|
||||||
return "state" in part
|
|
||||||
}
|
|
||||||
|
|
||||||
async function edge(page: Page, pos: "start" | "end") {
|
|
||||||
await page.locator(promptSelector).evaluate((el: HTMLDivElement, pos: "start" | "end") => {
|
|
||||||
const selection = window.getSelection()
|
|
||||||
if (!selection) return
|
|
||||||
|
|
||||||
const walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT)
|
|
||||||
const nodes: Text[] = []
|
|
||||||
for (let node = walk.nextNode(); node; node = walk.nextNode()) {
|
|
||||||
nodes.push(node as Text)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nodes.length === 0) {
|
|
||||||
const node = document.createTextNode("")
|
|
||||||
el.appendChild(node)
|
|
||||||
nodes.push(node)
|
|
||||||
}
|
|
||||||
|
|
||||||
const node = pos === "start" ? nodes[0]! : nodes[nodes.length - 1]!
|
|
||||||
const range = document.createRange()
|
|
||||||
range.setStart(node, pos === "start" ? 0 : (node.textContent ?? "").length)
|
|
||||||
range.collapse(true)
|
|
||||||
selection.removeAllRanges()
|
|
||||||
selection.addRange(range)
|
|
||||||
}, pos)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function wait(page: Page, value: string) {
|
|
||||||
await expect.poll(async () => text(await page.locator(promptSelector).textContent())).toBe(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function reply(sdk: Parameters<typeof withSession>[0], sessionID: string, token: string) {
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const messages = await sdk.session.messages({ sessionID, limit: 50 }).then((r) => r.data ?? [])
|
|
||||||
return messages
|
|
||||||
.filter((item) => item.info.role === "assistant")
|
|
||||||
.flatMap((item) => item.parts)
|
|
||||||
.filter((item) => item.type === "text")
|
|
||||||
.map((item) => item.text)
|
|
||||||
.join("\n")
|
|
||||||
},
|
|
||||||
{ timeout: 90_000 },
|
|
||||||
)
|
|
||||||
.toContain(token)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function shell(sdk: Parameters<typeof withSession>[0], sessionID: string, cmd: string, token: string) {
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const messages = await sdk.session.messages({ sessionID, limit: 50 }).then((r) => r.data ?? [])
|
|
||||||
const part = messages
|
|
||||||
.filter((item) => item.info.role === "assistant")
|
|
||||||
.flatMap((item) => item.parts)
|
|
||||||
.filter(isBash)
|
|
||||||
.find((item) => item.state.input?.command === cmd && item.state.status === "completed")
|
|
||||||
|
|
||||||
if (!part || part.state.status !== "completed") return
|
|
||||||
return typeof part.state.metadata?.output === "string" ? part.state.metadata.output : part.state.output
|
|
||||||
},
|
|
||||||
{ timeout: 90_000 },
|
|
||||||
)
|
|
||||||
.toContain(token)
|
|
||||||
}
|
|
||||||
|
|
||||||
test("prompt history restores unsent draft with arrow navigation", async ({ page, sdk, gotoSession }) => {
|
|
||||||
test.setTimeout(120_000)
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e prompt history ${Date.now()}`, async (session) => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
const firstToken = `E2E_HISTORY_ONE_${Date.now()}`
|
|
||||||
const secondToken = `E2E_HISTORY_TWO_${Date.now()}`
|
|
||||||
const first = `Reply with exactly: ${firstToken}`
|
|
||||||
const second = `Reply with exactly: ${secondToken}`
|
|
||||||
const draft = `draft ${Date.now()}`
|
|
||||||
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type(first)
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
await wait(page, "")
|
|
||||||
await reply(sdk, session.id, firstToken)
|
|
||||||
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type(second)
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
await wait(page, "")
|
|
||||||
await reply(sdk, session.id, secondToken)
|
|
||||||
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type(draft)
|
|
||||||
await wait(page, draft)
|
|
||||||
|
|
||||||
// Clear the draft before navigating history (ArrowUp only works when prompt is empty)
|
|
||||||
await prompt.fill("")
|
|
||||||
await wait(page, "")
|
|
||||||
|
|
||||||
await page.keyboard.press("ArrowUp")
|
|
||||||
await wait(page, second)
|
|
||||||
|
|
||||||
await page.keyboard.press("ArrowUp")
|
|
||||||
await wait(page, first)
|
|
||||||
|
|
||||||
await page.keyboard.press("ArrowDown")
|
|
||||||
await wait(page, second)
|
|
||||||
|
|
||||||
await page.keyboard.press("ArrowDown")
|
|
||||||
await wait(page, "")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("shell history stays separate from normal prompt history", async ({ page, sdk, gotoSession }) => {
|
|
||||||
test.setTimeout(120_000)
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e shell history ${Date.now()}`, async (session) => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
const firstToken = `E2E_SHELL_ONE_${Date.now()}`
|
|
||||||
const secondToken = `E2E_SHELL_TWO_${Date.now()}`
|
|
||||||
const normalToken = `E2E_NORMAL_${Date.now()}`
|
|
||||||
const first = `echo ${firstToken}`
|
|
||||||
const second = `echo ${secondToken}`
|
|
||||||
const normal = `Reply with exactly: ${normalToken}`
|
|
||||||
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type("!")
|
|
||||||
await page.keyboard.type(first)
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
await wait(page, "")
|
|
||||||
await shell(sdk, session.id, first, firstToken)
|
|
||||||
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type("!")
|
|
||||||
await page.keyboard.type(second)
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
await wait(page, "")
|
|
||||||
await shell(sdk, session.id, second, secondToken)
|
|
||||||
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type("!")
|
|
||||||
await page.keyboard.press("ArrowUp")
|
|
||||||
await wait(page, second)
|
|
||||||
|
|
||||||
await page.keyboard.press("ArrowUp")
|
|
||||||
await wait(page, first)
|
|
||||||
|
|
||||||
await page.keyboard.press("ArrowDown")
|
|
||||||
await wait(page, second)
|
|
||||||
|
|
||||||
await page.keyboard.press("ArrowDown")
|
|
||||||
await wait(page, "")
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await wait(page, "")
|
|
||||||
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type(normal)
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
await wait(page, "")
|
|
||||||
await reply(sdk, session.id, normalToken)
|
|
||||||
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.press("ArrowUp")
|
|
||||||
await wait(page, normal)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
|
|
||||||
test("smoke @mention inserts file pill token", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
const sep = process.platform === "win32" ? "\\" : "/"
|
|
||||||
const file = ["packages", "app", "package.json"].join(sep)
|
|
||||||
const filePattern = /packages[\\/]+app[\\/]+\s*package\.json/
|
|
||||||
|
|
||||||
await page.keyboard.type(`@${file}`)
|
|
||||||
|
|
||||||
const suggestion = page.getByRole("button", { name: filePattern }).first()
|
|
||||||
await expect(suggestion).toBeVisible()
|
|
||||||
await suggestion.hover()
|
|
||||||
|
|
||||||
await page.keyboard.press("Tab")
|
|
||||||
|
|
||||||
const pill = page.locator(`${promptSelector} [data-type="file"]`).first()
|
|
||||||
await expect(pill).toBeVisible()
|
|
||||||
await expect(pill).toHaveAttribute("data-path", filePattern)
|
|
||||||
|
|
||||||
await page.keyboard.type(" ok")
|
|
||||||
await expect(page.locator(promptSelector)).toContainText("ok")
|
|
||||||
})
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
|
|
||||||
test("shift+enter inserts a newline without submitting", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(/\/session\/?$/)
|
|
||||||
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
await prompt.focus()
|
|
||||||
await expect(prompt).toBeFocused()
|
|
||||||
|
|
||||||
await prompt.pressSequentially("line one")
|
|
||||||
await expect(prompt).toBeFocused()
|
|
||||||
|
|
||||||
await prompt.press("Shift+Enter")
|
|
||||||
await expect(page).toHaveURL(/\/session\/?$/)
|
|
||||||
await expect(prompt).toBeFocused()
|
|
||||||
|
|
||||||
await prompt.pressSequentially("line two")
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(/\/session\/?$/)
|
|
||||||
await expect.poll(() => prompt.evaluate((el) => el.innerText)).toBe("line one\nline two")
|
|
||||||
})
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
import type { ToolPart } from "@opencode-ai/sdk/v2/client"
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { sessionIDFromUrl } from "../actions"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { createSdk } from "../utils"
|
|
||||||
|
|
||||||
const isBash = (part: unknown): part is ToolPart => {
|
|
||||||
if (!part || typeof part !== "object") return false
|
|
||||||
if (!("type" in part) || part.type !== "tool") return false
|
|
||||||
if (!("tool" in part) || part.tool !== "bash") return false
|
|
||||||
return "state" in part
|
|
||||||
}
|
|
||||||
|
|
||||||
test("shell mode runs a command in the project directory", async ({ page, withProject }) => {
|
|
||||||
test.setTimeout(120_000)
|
|
||||||
|
|
||||||
await withProject(async ({ directory, gotoSession, trackSession }) => {
|
|
||||||
const sdk = createSdk(directory)
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
const cmd = process.platform === "win32" ? "dir" : "ls"
|
|
||||||
|
|
||||||
await gotoSession()
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type("!")
|
|
||||||
await expect(prompt).toHaveAttribute("aria-label", /enter shell command/i)
|
|
||||||
|
|
||||||
await page.keyboard.type(cmd)
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(/\/session\/[^/?#]+/, { timeout: 30_000 })
|
|
||||||
|
|
||||||
const id = sessionIDFromUrl(page.url())
|
|
||||||
if (!id) throw new Error(`Failed to parse session id from url: ${page.url()}`)
|
|
||||||
trackSession(id, directory)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const list = await sdk.session.messages({ sessionID: id, limit: 50 }).then((x) => x.data ?? [])
|
|
||||||
const msg = list.findLast(
|
|
||||||
(item) => item.info.role === "assistant" && "path" in item.info && item.info.path.cwd === directory,
|
|
||||||
)
|
|
||||||
if (!msg) return
|
|
||||||
|
|
||||||
const part = msg.parts
|
|
||||||
.filter(isBash)
|
|
||||||
.find((item) => item.state.input?.command === cmd && item.state.status === "completed")
|
|
||||||
|
|
||||||
if (!part || part.state.status !== "completed") return
|
|
||||||
const output =
|
|
||||||
typeof part.state.metadata?.output === "string" ? part.state.metadata.output : part.state.output
|
|
||||||
if (!output.includes("README.md")) return
|
|
||||||
|
|
||||||
return { cwd: directory, output }
|
|
||||||
},
|
|
||||||
{ timeout: 90_000 },
|
|
||||||
)
|
|
||||||
.toEqual(expect.objectContaining({ cwd: directory, output: expect.stringContaining("README.md") }))
|
|
||||||
|
|
||||||
await expect(prompt).toHaveText("")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
|
|
||||||
test("smoke /open opens file picker dialog", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/open")
|
|
||||||
|
|
||||||
const command = page.locator('[data-slash-id="file.open"]')
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await command.hover()
|
|
||||||
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const dialog = page.getByRole("dialog")
|
|
||||||
await expect(dialog).toBeVisible()
|
|
||||||
await expect(dialog.getByRole("textbox").first()).toBeVisible()
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(dialog).toHaveCount(0)
|
|
||||||
})
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { withSession } from "../actions"
|
|
||||||
|
|
||||||
const shareDisabled = process.env.OPENCODE_DISABLE_SHARE === "true" || process.env.OPENCODE_DISABLE_SHARE === "1"
|
|
||||||
|
|
||||||
async function seed(sdk: Parameters<typeof withSession>[0], sessionID: string) {
|
|
||||||
await sdk.session.promptAsync({
|
|
||||||
sessionID,
|
|
||||||
noReply: true,
|
|
||||||
parts: [{ type: "text", text: "e2e share seed" }],
|
|
||||||
})
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const messages = await sdk.session.messages({ sessionID, limit: 1 }).then((r) => r.data ?? [])
|
|
||||||
return messages.length
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBeGreaterThan(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
test("/share and /unshare update session share state", async ({ page, sdk, gotoSession }) => {
|
|
||||||
test.skip(shareDisabled, "Share is disabled in this environment (OPENCODE_DISABLE_SHARE).")
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e slash share ${Date.now()}`, async (session) => {
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
|
|
||||||
await seed(sdk, session.id)
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type("/share")
|
|
||||||
await expect(page.locator('[data-slash-id="session.share"]').first()).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const data = await sdk.session.get({ sessionID: session.id }).then((r) => r.data)
|
|
||||||
return data?.share?.url || undefined
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.not.toBeUndefined()
|
|
||||||
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type("/unshare")
|
|
||||||
await expect(page.locator('[data-slash-id="session.unshare"]').first()).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const data = await sdk.session.get({ sessionID: session.id }).then((r) => r.data)
|
|
||||||
return data?.share?.url || undefined
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBeUndefined()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { runPromptSlash, waitTerminalFocusIdle } from "../actions"
|
|
||||||
import { promptSelector, terminalSelector } from "../selectors"
|
|
||||||
|
|
||||||
test("/terminal toggles the terminal panel", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
const terminal = page.locator(terminalSelector)
|
|
||||||
|
|
||||||
await expect(terminal).not.toBeVisible()
|
|
||||||
|
|
||||||
await runPromptSlash(page, { prompt, text: "/terminal", id: "terminal.toggle" })
|
|
||||||
await waitTerminalFocusIdle(page, { term: terminal })
|
|
||||||
|
|
||||||
await runPromptSlash(page, { prompt, text: "/terminal", id: "terminal.toggle" })
|
|
||||||
await expect(terminal).not.toBeVisible()
|
|
||||||
})
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
import fs from "node:fs/promises"
|
|
||||||
import path from "node:path"
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { sessionIDFromUrl } from "../actions"
|
|
||||||
import { createSdk } from "../utils"
|
|
||||||
|
|
||||||
async function config(dir: string, url: string) {
|
|
||||||
await fs.writeFile(
|
|
||||||
path.join(dir, "opencode.json"),
|
|
||||||
JSON.stringify({
|
|
||||||
$schema: "https://opencode.ai/config.json",
|
|
||||||
enabled_providers: ["e2e-llm"],
|
|
||||||
provider: {
|
|
||||||
"e2e-llm": {
|
|
||||||
name: "E2E LLM",
|
|
||||||
npm: "@ai-sdk/openai-compatible",
|
|
||||||
env: [],
|
|
||||||
models: {
|
|
||||||
"test-model": {
|
|
||||||
name: "Test Model",
|
|
||||||
tool_call: true,
|
|
||||||
limit: { context: 128000, output: 32000 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
apiKey: "test-key",
|
|
||||||
baseURL: url,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
agent: {
|
|
||||||
build: {
|
|
||||||
model: "e2e-llm/test-model",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
test("can send a prompt and receive a reply", async ({ page, llm, withProject }) => {
|
|
||||||
test.setTimeout(120_000)
|
|
||||||
|
|
||||||
const pageErrors: string[] = []
|
|
||||||
const onPageError = (err: Error) => {
|
|
||||||
pageErrors.push(err.message)
|
|
||||||
}
|
|
||||||
page.on("pageerror", onPageError)
|
|
||||||
|
|
||||||
try {
|
|
||||||
await withProject(
|
|
||||||
async (project) => {
|
|
||||||
const sdk = createSdk(project.directory)
|
|
||||||
const token = `E2E_OK_${Date.now()}`
|
|
||||||
|
|
||||||
await llm.text(token)
|
|
||||||
await project.gotoSession()
|
|
||||||
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
await prompt.click()
|
|
||||||
await page.keyboard.type(`Reply with exactly: ${token}`)
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(/\/session\/[^/?#]+/, { timeout: 30_000 })
|
|
||||||
|
|
||||||
const sessionID = (() => {
|
|
||||||
const id = sessionIDFromUrl(page.url())
|
|
||||||
if (!id) throw new Error(`Failed to parse session id from url: ${page.url()}`)
|
|
||||||
return id
|
|
||||||
})()
|
|
||||||
project.trackSession(sessionID)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const messages = await sdk.session.messages({ sessionID, limit: 50 }).then((r) => r.data ?? [])
|
|
||||||
return messages
|
|
||||||
.filter((m) => m.info.role === "assistant")
|
|
||||||
.flatMap((m) => m.parts)
|
|
||||||
.filter((p) => p.type === "text")
|
|
||||||
.map((p) => p.text)
|
|
||||||
.join("\n")
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toContain(token)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
model: { providerID: "e2e-llm", modelID: "test-model" },
|
|
||||||
setup: (dir) => config(dir, llm.url),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
} finally {
|
|
||||||
page.off("pageerror", onPageError)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pageErrors.length > 0) {
|
|
||||||
throw new Error(`Page error(s):\n${pageErrors.join("\n")}`)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
export const promptSelector = '[data-component="prompt-input"]'
|
|
||||||
export const terminalPanelSelector = '#terminal-panel[aria-hidden="false"]'
|
|
||||||
export const terminalSelector = `${terminalPanelSelector} [data-component="terminal"]`
|
|
||||||
export const sessionComposerDockSelector = '[data-component="session-prompt-dock"]'
|
|
||||||
export const questionDockSelector = '[data-component="dock-prompt"][data-kind="question"]'
|
|
||||||
export const permissionDockSelector = '[data-component="dock-prompt"][data-kind="permission"]'
|
|
||||||
export const permissionRejectSelector = `${permissionDockSelector} [data-slot="permission-footer-actions"] [data-component="button"]:nth-child(1)`
|
|
||||||
export const permissionAllowAlwaysSelector = `${permissionDockSelector} [data-slot="permission-footer-actions"] [data-component="button"]:nth-child(2)`
|
|
||||||
export const permissionAllowOnceSelector = `${permissionDockSelector} [data-slot="permission-footer-actions"] [data-component="button"]:nth-child(3)`
|
|
||||||
export const sessionTodoDockSelector = '[data-component="session-todo-dock"]'
|
|
||||||
export const sessionTodoToggleSelector = '[data-action="session-todo-toggle"]'
|
|
||||||
export const sessionTodoToggleButtonSelector = '[data-action="session-todo-toggle-button"]'
|
|
||||||
export const sessionTodoListSelector = '[data-slot="session-todo-list"]'
|
|
||||||
|
|
||||||
export const modelVariantCycleSelector = '[data-action="model-variant-cycle"]'
|
|
||||||
export const promptAgentSelector = '[data-component="prompt-agent-control"]'
|
|
||||||
export const promptModelSelector = '[data-component="prompt-model-control"]'
|
|
||||||
export const promptVariantSelector = '[data-component="prompt-variant-control"]'
|
|
||||||
export const settingsLanguageSelectSelector = '[data-action="settings-language"]'
|
|
||||||
export const settingsColorSchemeSelector = '[data-action="settings-color-scheme"]'
|
|
||||||
export const settingsThemeSelector = '[data-action="settings-theme"]'
|
|
||||||
export const settingsCodeFontSelector = '[data-action="settings-code-font"]'
|
|
||||||
export const settingsUIFontSelector = '[data-action="settings-ui-font"]'
|
|
||||||
export const settingsNotificationsAgentSelector = '[data-action="settings-notifications-agent"]'
|
|
||||||
export const settingsNotificationsPermissionsSelector = '[data-action="settings-notifications-permissions"]'
|
|
||||||
export const settingsNotificationsErrorsSelector = '[data-action="settings-notifications-errors"]'
|
|
||||||
export const settingsSoundsAgentSelector = '[data-action="settings-sounds-agent"]'
|
|
||||||
export const settingsSoundsPermissionsSelector = '[data-action="settings-sounds-permissions"]'
|
|
||||||
export const settingsSoundsErrorsSelector = '[data-action="settings-sounds-errors"]'
|
|
||||||
export const settingsUpdatesStartupSelector = '[data-action="settings-updates-startup"]'
|
|
||||||
export const settingsReleaseNotesSelector = '[data-action="settings-release-notes"]'
|
|
||||||
|
|
||||||
export const sidebarNavSelector = '[data-component="sidebar-nav-desktop"]'
|
|
||||||
|
|
||||||
export const projectSwitchSelector = (slug: string) =>
|
|
||||||
`${sidebarNavSelector} [data-action="project-switch"][data-project="${slug}"]`
|
|
||||||
|
|
||||||
export const projectMenuTriggerSelector = (slug: string) =>
|
|
||||||
`${sidebarNavSelector} [data-action="project-menu"][data-project="${slug}"]`
|
|
||||||
|
|
||||||
export const projectCloseMenuSelector = (slug: string) => `[data-action="project-close-menu"][data-project="${slug}"]`
|
|
||||||
|
|
||||||
export const projectClearNotificationsSelector = (slug: string) =>
|
|
||||||
`[data-action="project-clear-notifications"][data-project="${slug}"]`
|
|
||||||
|
|
||||||
export const projectWorkspacesToggleSelector = (slug: string) =>
|
|
||||||
`[data-action="project-workspaces-toggle"][data-project="${slug}"]`
|
|
||||||
|
|
||||||
export const titlebarRightSelector = "#opencode-titlebar-right"
|
|
||||||
|
|
||||||
export const popoverBodySelector = '[data-slot="popover-body"]'
|
|
||||||
|
|
||||||
export const dropdownMenuTriggerSelector = '[data-slot="dropdown-menu-trigger"]'
|
|
||||||
|
|
||||||
export const dropdownMenuContentSelector = '[data-component="dropdown-menu-content"]'
|
|
||||||
|
|
||||||
export const inlineInputSelector = '[data-component="inline-input"]'
|
|
||||||
|
|
||||||
export const sessionItemSelector = (sessionID: string) => `${sidebarNavSelector} [data-session-id="${sessionID}"]`
|
|
||||||
|
|
||||||
export const workspaceItemSelector = (slug: string) =>
|
|
||||||
`${sidebarNavSelector} [data-component="workspace-item"][data-workspace="${slug}"]`
|
|
||||||
|
|
||||||
export const workspaceMenuTriggerSelector = (slug: string) =>
|
|
||||||
`${sidebarNavSelector} [data-action="workspace-menu"][data-workspace="${slug}"]`
|
|
||||||
|
|
||||||
export const workspaceNewSessionSelector = (slug: string) =>
|
|
||||||
`${sidebarNavSelector} [data-action="workspace-new-session"][data-workspace="${slug}"]`
|
|
||||||
|
|
||||||
export const listItemSelector = '[data-slot="list-item"]'
|
|
||||||
|
|
||||||
export const listItemKeyStartsWithSelector = (prefix: string) => `${listItemSelector}[data-key^="${prefix}"]`
|
|
||||||
|
|
||||||
export const listItemKeySelector = (key: string) => `${listItemSelector}[data-key="${key}"]`
|
|
||||||
|
|
||||||
export const keybindButtonSelector = (id: string) => `[data-keybind-id="${id}"]`
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
import { seedSessionTask, withSession } from "../actions"
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
|
|
||||||
test("task tool child-session link does not trigger stale show errors", async ({ page, sdk, gotoSession }) => {
|
|
||||||
test.setTimeout(120_000)
|
|
||||||
|
|
||||||
const errs: string[] = []
|
|
||||||
const onError = (err: Error) => {
|
|
||||||
errs.push(err.message)
|
|
||||||
}
|
|
||||||
page.on("pageerror", onError)
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e child nav ${Date.now()}`, async (session) => {
|
|
||||||
const child = await seedSessionTask(sdk, {
|
|
||||||
sessionID: session.id,
|
|
||||||
description: "Open child session",
|
|
||||||
prompt: "Search the repository for AssistantParts and then reply with exactly CHILD_OK.",
|
|
||||||
})
|
|
||||||
|
|
||||||
try {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
const link = page
|
|
||||||
.locator("a.subagent-link")
|
|
||||||
.filter({ hasText: /open child session/i })
|
|
||||||
.first()
|
|
||||||
await expect(link).toBeVisible({ timeout: 30_000 })
|
|
||||||
await link.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/session/${child.sessionID}(?:[/?#]|$)`), { timeout: 30_000 })
|
|
||||||
await page.waitForTimeout(1000)
|
|
||||||
expect(errs).toEqual([])
|
|
||||||
} finally {
|
|
||||||
page.off("pageerror", onError)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,605 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import {
|
|
||||||
composerEvent,
|
|
||||||
type ComposerDriverState,
|
|
||||||
type ComposerProbeState,
|
|
||||||
type ComposerWindow,
|
|
||||||
} from "../../src/testing/session-composer"
|
|
||||||
import { cleanupSession, clearSessionDockSeed, seedSessionQuestion } from "../actions"
|
|
||||||
import {
|
|
||||||
permissionDockSelector,
|
|
||||||
promptSelector,
|
|
||||||
questionDockSelector,
|
|
||||||
sessionComposerDockSelector,
|
|
||||||
sessionTodoToggleButtonSelector,
|
|
||||||
} from "../selectors"
|
|
||||||
import { modKey } from "../utils"
|
|
||||||
|
|
||||||
type Sdk = Parameters<typeof clearSessionDockSeed>[0]
|
|
||||||
type PermissionRule = { permission: string; pattern: string; action: "allow" | "deny" | "ask" }
|
|
||||||
|
|
||||||
async function withDockSession<T>(
|
|
||||||
sdk: Sdk,
|
|
||||||
title: string,
|
|
||||||
fn: (session: { id: string; title: string }) => Promise<T>,
|
|
||||||
opts?: { permission?: PermissionRule[] },
|
|
||||||
) {
|
|
||||||
const session = await sdk.session
|
|
||||||
.create(opts?.permission ? { title, permission: opts.permission } : { title })
|
|
||||||
.then((r) => r.data)
|
|
||||||
if (!session?.id) throw new Error("Session create did not return an id")
|
|
||||||
try {
|
|
||||||
return await fn(session)
|
|
||||||
} finally {
|
|
||||||
await cleanupSession({ sdk, sessionID: session.id })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
test.setTimeout(120_000)
|
|
||||||
|
|
||||||
async function withDockSeed<T>(sdk: Sdk, sessionID: string, fn: () => Promise<T>) {
|
|
||||||
try {
|
|
||||||
return await fn()
|
|
||||||
} finally {
|
|
||||||
await clearSessionDockSeed(sdk, sessionID).catch(() => undefined)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function clearPermissionDock(page: any, label: RegExp) {
|
|
||||||
const dock = page.locator(permissionDockSelector)
|
|
||||||
await expect(dock).toBeVisible()
|
|
||||||
await dock.getByRole("button", { name: label }).click()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function setAutoAccept(page: any, enabled: boolean) {
|
|
||||||
const button = page.locator('[data-action="prompt-permissions"]').first()
|
|
||||||
await expect(button).toBeVisible()
|
|
||||||
const pressed = (await button.getAttribute("aria-pressed")) === "true"
|
|
||||||
if (pressed === enabled) return
|
|
||||||
await button.click()
|
|
||||||
await expect(button).toHaveAttribute("aria-pressed", enabled ? "true" : "false")
|
|
||||||
}
|
|
||||||
|
|
||||||
async function expectQuestionBlocked(page: any) {
|
|
||||||
await expect(page.locator(questionDockSelector)).toBeVisible()
|
|
||||||
await expect(page.locator(promptSelector)).toHaveCount(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function expectQuestionOpen(page: any) {
|
|
||||||
await expect(page.locator(questionDockSelector)).toHaveCount(0)
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function expectPermissionBlocked(page: any) {
|
|
||||||
await expect(page.locator(permissionDockSelector)).toBeVisible()
|
|
||||||
await expect(page.locator(promptSelector)).toHaveCount(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function expectPermissionOpen(page: any) {
|
|
||||||
await expect(page.locator(permissionDockSelector)).toHaveCount(0)
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function todoDock(page: any, sessionID: string) {
|
|
||||||
await page.addInitScript(() => {
|
|
||||||
const win = window as ComposerWindow
|
|
||||||
win.__opencode_e2e = {
|
|
||||||
...win.__opencode_e2e,
|
|
||||||
composer: {
|
|
||||||
enabled: true,
|
|
||||||
sessions: {},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const write = async (driver: ComposerDriverState | undefined) => {
|
|
||||||
await page.evaluate(
|
|
||||||
(input: { event: string; sessionID: string; driver: ComposerDriverState | undefined }) => {
|
|
||||||
const win = window as ComposerWindow
|
|
||||||
const composer = win.__opencode_e2e?.composer
|
|
||||||
if (!composer?.enabled) throw new Error("Composer e2e driver is not enabled")
|
|
||||||
composer.sessions ??= {}
|
|
||||||
const prev = composer.sessions[input.sessionID] ?? {}
|
|
||||||
if (!input.driver) {
|
|
||||||
if (!prev.probe) {
|
|
||||||
delete composer.sessions[input.sessionID]
|
|
||||||
} else {
|
|
||||||
composer.sessions[input.sessionID] = { probe: prev.probe }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
composer.sessions[input.sessionID] = {
|
|
||||||
...prev,
|
|
||||||
driver: input.driver,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
window.dispatchEvent(new CustomEvent(input.event, { detail: { sessionID: input.sessionID } }))
|
|
||||||
},
|
|
||||||
{ event: composerEvent, sessionID, driver },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const read = () =>
|
|
||||||
page.evaluate((sessionID: string) => {
|
|
||||||
const win = window as ComposerWindow
|
|
||||||
return win.__opencode_e2e?.composer?.sessions?.[sessionID]?.probe ?? null
|
|
||||||
}, sessionID) as Promise<ComposerProbeState | null>
|
|
||||||
|
|
||||||
const api = {
|
|
||||||
async clear() {
|
|
||||||
await write(undefined)
|
|
||||||
return api
|
|
||||||
},
|
|
||||||
async open(todos: NonNullable<ComposerDriverState["todos"]>) {
|
|
||||||
await write({ live: true, todos })
|
|
||||||
return api
|
|
||||||
},
|
|
||||||
async finish(todos: NonNullable<ComposerDriverState["todos"]>) {
|
|
||||||
await write({ live: false, todos })
|
|
||||||
return api
|
|
||||||
},
|
|
||||||
async expectOpen(states: ComposerProbeState["states"]) {
|
|
||||||
await expect.poll(read, { timeout: 10_000 }).toMatchObject({
|
|
||||||
mounted: true,
|
|
||||||
collapsed: false,
|
|
||||||
hidden: false,
|
|
||||||
count: states.length,
|
|
||||||
states,
|
|
||||||
})
|
|
||||||
return api
|
|
||||||
},
|
|
||||||
async expectCollapsed(states: ComposerProbeState["states"]) {
|
|
||||||
await expect.poll(read, { timeout: 10_000 }).toMatchObject({
|
|
||||||
mounted: true,
|
|
||||||
collapsed: true,
|
|
||||||
hidden: true,
|
|
||||||
count: states.length,
|
|
||||||
states,
|
|
||||||
})
|
|
||||||
return api
|
|
||||||
},
|
|
||||||
async expectClosed() {
|
|
||||||
await expect.poll(read, { timeout: 10_000 }).toMatchObject({ mounted: false })
|
|
||||||
return api
|
|
||||||
},
|
|
||||||
async collapse() {
|
|
||||||
await page.locator(sessionTodoToggleButtonSelector).click()
|
|
||||||
return api
|
|
||||||
},
|
|
||||||
async expand() {
|
|
||||||
await page.locator(sessionTodoToggleButtonSelector).click()
|
|
||||||
return api
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
return api
|
|
||||||
}
|
|
||||||
|
|
||||||
async function withMockPermission<T>(
|
|
||||||
page: any,
|
|
||||||
request: {
|
|
||||||
id: string
|
|
||||||
sessionID: string
|
|
||||||
permission: string
|
|
||||||
patterns: string[]
|
|
||||||
metadata?: Record<string, unknown>
|
|
||||||
always?: string[]
|
|
||||||
},
|
|
||||||
opts: { child?: any } | undefined,
|
|
||||||
fn: (state: { resolved: () => Promise<void> }) => Promise<T>,
|
|
||||||
) {
|
|
||||||
const listUrl = /\/permission(?:\?.*)?$/
|
|
||||||
const replyUrls = [/\/session\/[^/]+\/permissions\/[^/?]+(?:\?.*)?$/, /\/permission\/[^/]+\/reply(?:\?.*)?$/]
|
|
||||||
let pending = [
|
|
||||||
{
|
|
||||||
...request,
|
|
||||||
always: request.always ?? ["*"],
|
|
||||||
metadata: request.metadata ?? {},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const list = async (route: any) => {
|
|
||||||
await route.fulfill({
|
|
||||||
status: 200,
|
|
||||||
contentType: "application/json",
|
|
||||||
body: JSON.stringify(pending),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const reply = async (route: any) => {
|
|
||||||
const url = new URL(route.request().url())
|
|
||||||
const parts = url.pathname.split("/").filter(Boolean)
|
|
||||||
const id = parts.at(-1) === "reply" ? parts.at(-2) : parts.at(-1)
|
|
||||||
pending = pending.filter((item) => item.id !== id)
|
|
||||||
await route.fulfill({
|
|
||||||
status: 200,
|
|
||||||
contentType: "application/json",
|
|
||||||
body: JSON.stringify(true),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
await page.route(listUrl, list)
|
|
||||||
for (const item of replyUrls) {
|
|
||||||
await page.route(item, reply)
|
|
||||||
}
|
|
||||||
|
|
||||||
const sessionList = opts?.child
|
|
||||||
? async (route: any) => {
|
|
||||||
const res = await route.fetch()
|
|
||||||
const json = await res.json()
|
|
||||||
const list = Array.isArray(json) ? json : Array.isArray(json?.data) ? json.data : undefined
|
|
||||||
if (Array.isArray(list) && !list.some((item) => item?.id === opts.child?.id)) list.push(opts.child)
|
|
||||||
await route.fulfill({
|
|
||||||
status: res.status(),
|
|
||||||
headers: res.headers(),
|
|
||||||
contentType: "application/json",
|
|
||||||
body: JSON.stringify(json),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
: undefined
|
|
||||||
|
|
||||||
if (sessionList) await page.route("**/session?*", sessionList)
|
|
||||||
|
|
||||||
const state = {
|
|
||||||
async resolved() {
|
|
||||||
await expect.poll(() => pending.length, { timeout: 10_000 }).toBe(0)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return await fn(state)
|
|
||||||
} finally {
|
|
||||||
await page.unroute(listUrl, list)
|
|
||||||
for (const item of replyUrls) {
|
|
||||||
await page.unroute(item, reply)
|
|
||||||
}
|
|
||||||
if (sessionList) await page.unroute("**/session?*", sessionList)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
test("default dock shows prompt input", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withDockSession(sdk, "e2e composer dock default", async (session) => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
await expect(page.locator(sessionComposerDockSelector)).toBeVisible()
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
await expect(page.locator(questionDockSelector)).toHaveCount(0)
|
|
||||||
await expect(page.locator(permissionDockSelector)).toHaveCount(0)
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await expect(page.locator(promptSelector)).toBeFocused()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("auto-accept toggle works before first submit", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const button = page.locator('[data-action="prompt-permissions"]').first()
|
|
||||||
await expect(button).toBeVisible()
|
|
||||||
await expect(button).toHaveAttribute("aria-pressed", "false")
|
|
||||||
|
|
||||||
await setAutoAccept(page, true)
|
|
||||||
await setAutoAccept(page, false)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("blocked question flow unblocks after submit", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withDockSession(sdk, "e2e composer dock question", async (session) => {
|
|
||||||
await withDockSeed(sdk, session.id, async () => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
await seedSessionQuestion(sdk, {
|
|
||||||
sessionID: session.id,
|
|
||||||
questions: [
|
|
||||||
{
|
|
||||||
header: "Need input",
|
|
||||||
question: "Pick one option",
|
|
||||||
options: [
|
|
||||||
{ label: "Continue", description: "Continue now" },
|
|
||||||
{ label: "Stop", description: "Stop here" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
const dock = page.locator(questionDockSelector)
|
|
||||||
await expectQuestionBlocked(page)
|
|
||||||
|
|
||||||
await dock.locator('[data-slot="question-option"]').first().click()
|
|
||||||
await dock.getByRole("button", { name: /submit/i }).click()
|
|
||||||
|
|
||||||
await expectQuestionOpen(page)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("blocked question flow supports keyboard shortcuts", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withDockSession(sdk, "e2e composer dock question keyboard", async (session) => {
|
|
||||||
await withDockSeed(sdk, session.id, async () => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
await seedSessionQuestion(sdk, {
|
|
||||||
sessionID: session.id,
|
|
||||||
questions: [
|
|
||||||
{
|
|
||||||
header: "Need input",
|
|
||||||
question: "Pick one option",
|
|
||||||
options: [
|
|
||||||
{ label: "Continue", description: "Continue now" },
|
|
||||||
{ label: "Stop", description: "Stop here" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
const dock = page.locator(questionDockSelector)
|
|
||||||
const first = dock.locator('[data-slot="question-option"]').first()
|
|
||||||
const second = dock.locator('[data-slot="question-option"]').nth(1)
|
|
||||||
|
|
||||||
await expectQuestionBlocked(page)
|
|
||||||
await expect(first).toBeFocused()
|
|
||||||
|
|
||||||
await page.keyboard.press("ArrowDown")
|
|
||||||
await expect(second).toBeFocused()
|
|
||||||
|
|
||||||
await page.keyboard.press("Space")
|
|
||||||
await page.keyboard.press(`${modKey}+Enter`)
|
|
||||||
await expectQuestionOpen(page)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("blocked question flow supports escape dismiss", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withDockSession(sdk, "e2e composer dock question escape", async (session) => {
|
|
||||||
await withDockSeed(sdk, session.id, async () => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
await seedSessionQuestion(sdk, {
|
|
||||||
sessionID: session.id,
|
|
||||||
questions: [
|
|
||||||
{
|
|
||||||
header: "Need input",
|
|
||||||
question: "Pick one option",
|
|
||||||
options: [
|
|
||||||
{ label: "Continue", description: "Continue now" },
|
|
||||||
{ label: "Stop", description: "Stop here" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
const dock = page.locator(questionDockSelector)
|
|
||||||
const first = dock.locator('[data-slot="question-option"]').first()
|
|
||||||
|
|
||||||
await expectQuestionBlocked(page)
|
|
||||||
await expect(first).toBeFocused()
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expectQuestionOpen(page)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("blocked permission flow supports allow once", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withDockSession(sdk, "e2e composer dock permission once", async (session) => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
await setAutoAccept(page, false)
|
|
||||||
await withMockPermission(
|
|
||||||
page,
|
|
||||||
{
|
|
||||||
id: "per_e2e_once",
|
|
||||||
sessionID: session.id,
|
|
||||||
permission: "bash",
|
|
||||||
patterns: ["/tmp/opencode-e2e-perm-once"],
|
|
||||||
metadata: { description: "Need permission for command" },
|
|
||||||
},
|
|
||||||
undefined,
|
|
||||||
async (state) => {
|
|
||||||
await page.goto(page.url())
|
|
||||||
await expectPermissionBlocked(page)
|
|
||||||
|
|
||||||
await clearPermissionDock(page, /allow once/i)
|
|
||||||
await state.resolved()
|
|
||||||
await page.goto(page.url())
|
|
||||||
await expectPermissionOpen(page)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("blocked permission flow supports reject", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withDockSession(sdk, "e2e composer dock permission reject", async (session) => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
await setAutoAccept(page, false)
|
|
||||||
await withMockPermission(
|
|
||||||
page,
|
|
||||||
{
|
|
||||||
id: "per_e2e_reject",
|
|
||||||
sessionID: session.id,
|
|
||||||
permission: "bash",
|
|
||||||
patterns: ["/tmp/opencode-e2e-perm-reject"],
|
|
||||||
},
|
|
||||||
undefined,
|
|
||||||
async (state) => {
|
|
||||||
await page.goto(page.url())
|
|
||||||
await expectPermissionBlocked(page)
|
|
||||||
|
|
||||||
await clearPermissionDock(page, /deny/i)
|
|
||||||
await state.resolved()
|
|
||||||
await page.goto(page.url())
|
|
||||||
await expectPermissionOpen(page)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("blocked permission flow supports allow always", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withDockSession(sdk, "e2e composer dock permission always", async (session) => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
await setAutoAccept(page, false)
|
|
||||||
await withMockPermission(
|
|
||||||
page,
|
|
||||||
{
|
|
||||||
id: "per_e2e_always",
|
|
||||||
sessionID: session.id,
|
|
||||||
permission: "bash",
|
|
||||||
patterns: ["/tmp/opencode-e2e-perm-always"],
|
|
||||||
metadata: { description: "Need permission for command" },
|
|
||||||
},
|
|
||||||
undefined,
|
|
||||||
async (state) => {
|
|
||||||
await page.goto(page.url())
|
|
||||||
await expectPermissionBlocked(page)
|
|
||||||
|
|
||||||
await clearPermissionDock(page, /allow always/i)
|
|
||||||
await state.resolved()
|
|
||||||
await page.goto(page.url())
|
|
||||||
await expectPermissionOpen(page)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("child session question request blocks parent dock and unblocks after submit", async ({
|
|
||||||
page,
|
|
||||||
sdk,
|
|
||||||
gotoSession,
|
|
||||||
}) => {
|
|
||||||
await withDockSession(sdk, "e2e composer dock child question parent", async (session) => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
const child = await sdk.session
|
|
||||||
.create({
|
|
||||||
title: "e2e composer dock child question",
|
|
||||||
parentID: session.id,
|
|
||||||
})
|
|
||||||
.then((r) => r.data)
|
|
||||||
if (!child?.id) throw new Error("Child session create did not return an id")
|
|
||||||
|
|
||||||
try {
|
|
||||||
await withDockSeed(sdk, child.id, async () => {
|
|
||||||
await seedSessionQuestion(sdk, {
|
|
||||||
sessionID: child.id,
|
|
||||||
questions: [
|
|
||||||
{
|
|
||||||
header: "Child input",
|
|
||||||
question: "Pick one child option",
|
|
||||||
options: [
|
|
||||||
{ label: "Continue", description: "Continue child" },
|
|
||||||
{ label: "Stop", description: "Stop child" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
const dock = page.locator(questionDockSelector)
|
|
||||||
await expectQuestionBlocked(page)
|
|
||||||
|
|
||||||
await dock.locator('[data-slot="question-option"]').first().click()
|
|
||||||
await dock.getByRole("button", { name: /submit/i }).click()
|
|
||||||
|
|
||||||
await expectQuestionOpen(page)
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
await cleanupSession({ sdk, sessionID: child.id })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("child session permission request blocks parent dock and supports allow once", async ({
|
|
||||||
page,
|
|
||||||
sdk,
|
|
||||||
gotoSession,
|
|
||||||
}) => {
|
|
||||||
await withDockSession(sdk, "e2e composer dock child permission parent", async (session) => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
await setAutoAccept(page, false)
|
|
||||||
|
|
||||||
const child = await sdk.session
|
|
||||||
.create({
|
|
||||||
title: "e2e composer dock child permission",
|
|
||||||
parentID: session.id,
|
|
||||||
})
|
|
||||||
.then((r) => r.data)
|
|
||||||
if (!child?.id) throw new Error("Child session create did not return an id")
|
|
||||||
|
|
||||||
try {
|
|
||||||
await withMockPermission(
|
|
||||||
page,
|
|
||||||
{
|
|
||||||
id: "per_e2e_child",
|
|
||||||
sessionID: child.id,
|
|
||||||
permission: "bash",
|
|
||||||
patterns: ["/tmp/opencode-e2e-perm-child"],
|
|
||||||
metadata: { description: "Need child permission" },
|
|
||||||
},
|
|
||||||
{ child },
|
|
||||||
async (state) => {
|
|
||||||
await page.goto(page.url())
|
|
||||||
await expectPermissionBlocked(page)
|
|
||||||
|
|
||||||
await clearPermissionDock(page, /allow once/i)
|
|
||||||
await state.resolved()
|
|
||||||
await page.goto(page.url())
|
|
||||||
|
|
||||||
await expectPermissionOpen(page)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
} finally {
|
|
||||||
await cleanupSession({ sdk, sessionID: child.id })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("todo dock transitions and collapse behavior", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withDockSession(sdk, "e2e composer dock todo", async (session) => {
|
|
||||||
const dock = await todoDock(page, session.id)
|
|
||||||
await gotoSession(session.id)
|
|
||||||
await expect(page.locator(sessionComposerDockSelector)).toBeVisible()
|
|
||||||
|
|
||||||
try {
|
|
||||||
await dock.open([
|
|
||||||
{ content: "first task", status: "pending", priority: "high" },
|
|
||||||
{ content: "second task", status: "in_progress", priority: "medium" },
|
|
||||||
])
|
|
||||||
await dock.expectOpen(["pending", "in_progress"])
|
|
||||||
|
|
||||||
await dock.collapse()
|
|
||||||
await dock.expectCollapsed(["pending", "in_progress"])
|
|
||||||
|
|
||||||
await dock.expand()
|
|
||||||
await dock.expectOpen(["pending", "in_progress"])
|
|
||||||
|
|
||||||
await dock.finish([
|
|
||||||
{ content: "first task", status: "completed", priority: "high" },
|
|
||||||
{ content: "second task", status: "cancelled", priority: "medium" },
|
|
||||||
])
|
|
||||||
await dock.expectClosed()
|
|
||||||
} finally {
|
|
||||||
await dock.clear()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("keyboard focus stays off prompt while blocked", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withDockSession(sdk, "e2e composer dock keyboard", async (session) => {
|
|
||||||
await withDockSeed(sdk, session.id, async () => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
await seedSessionQuestion(sdk, {
|
|
||||||
sessionID: session.id,
|
|
||||||
questions: [
|
|
||||||
{
|
|
||||||
header: "Need input",
|
|
||||||
question: "Pick one option",
|
|
||||||
options: [{ label: "Continue", description: "Continue now" }],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
await expectQuestionBlocked(page)
|
|
||||||
|
|
||||||
await page.locator("main").click({ position: { x: 5, y: 5 } })
|
|
||||||
await page.keyboard.type("abc")
|
|
||||||
await expect(page.locator(promptSelector)).toHaveCount(0)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,405 +0,0 @@
|
|||||||
import type { Locator, Page } from "@playwright/test"
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
import {
|
|
||||||
openSidebar,
|
|
||||||
resolveSlug,
|
|
||||||
sessionIDFromUrl,
|
|
||||||
setWorkspacesEnabled,
|
|
||||||
waitSession,
|
|
||||||
waitSessionIdle,
|
|
||||||
waitSlug,
|
|
||||||
} from "../actions"
|
|
||||||
import {
|
|
||||||
promptAgentSelector,
|
|
||||||
promptModelSelector,
|
|
||||||
promptSelector,
|
|
||||||
promptVariantSelector,
|
|
||||||
workspaceItemSelector,
|
|
||||||
workspaceNewSessionSelector,
|
|
||||||
} from "../selectors"
|
|
||||||
import { createSdk, sessionPath } from "../utils"
|
|
||||||
|
|
||||||
type Footer = {
|
|
||||||
agent: string
|
|
||||||
model: string
|
|
||||||
variant: string
|
|
||||||
}
|
|
||||||
|
|
||||||
type Probe = {
|
|
||||||
dir?: string
|
|
||||||
sessionID?: string
|
|
||||||
agent?: string
|
|
||||||
model?: { providerID: string; modelID: string; name?: string }
|
|
||||||
variant?: string | null
|
|
||||||
pick?: {
|
|
||||||
agent?: string
|
|
||||||
model?: { providerID: string; modelID: string }
|
|
||||||
variant?: string | null
|
|
||||||
}
|
|
||||||
variants?: string[]
|
|
||||||
models?: Array<{ providerID: string; modelID: string; name: string }>
|
|
||||||
agents?: Array<{ name: string }>
|
|
||||||
}
|
|
||||||
|
|
||||||
const escape = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
|
|
||||||
|
|
||||||
const text = async (locator: Locator) => ((await locator.textContent()) ?? "").trim()
|
|
||||||
|
|
||||||
const modelKey = (state: Probe | null) => (state?.model ? `${state.model.providerID}:${state.model.modelID}` : null)
|
|
||||||
|
|
||||||
async function probe(page: Page): Promise<Probe | null> {
|
|
||||||
return page.evaluate(() => {
|
|
||||||
const win = window as Window & {
|
|
||||||
__opencode_e2e?: {
|
|
||||||
model?: {
|
|
||||||
current?: Probe
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return win.__opencode_e2e?.model?.current ?? null
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function currentModel(page: Page) {
|
|
||||||
await expect.poll(() => probe(page).then(modelKey), { timeout: 30_000 }).not.toBe(null)
|
|
||||||
const value = await probe(page).then(modelKey)
|
|
||||||
if (!value) throw new Error("Failed to resolve current model key")
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
|
|
||||||
async function waitControl(page: Page, key: "setAgent" | "setModel" | "setVariant") {
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
() =>
|
|
||||||
page.evaluate((key) => {
|
|
||||||
const win = window as Window & {
|
|
||||||
__opencode_e2e?: {
|
|
||||||
model?: {
|
|
||||||
controls?: Record<string, unknown>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return !!win.__opencode_e2e?.model?.controls?.[key]
|
|
||||||
}, key),
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function pickAgent(page: Page, value: string) {
|
|
||||||
await waitControl(page, "setAgent")
|
|
||||||
await page.evaluate((value) => {
|
|
||||||
const win = window as Window & {
|
|
||||||
__opencode_e2e?: {
|
|
||||||
model?: {
|
|
||||||
controls?: {
|
|
||||||
setAgent?: (value: string | undefined) => void
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const fn = win.__opencode_e2e?.model?.controls?.setAgent
|
|
||||||
if (!fn) throw new Error("Model e2e agent control is not enabled")
|
|
||||||
fn(value)
|
|
||||||
}, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function pickModel(page: Page, value: { providerID: string; modelID: string }) {
|
|
||||||
await waitControl(page, "setModel")
|
|
||||||
await page.evaluate((value) => {
|
|
||||||
const win = window as Window & {
|
|
||||||
__opencode_e2e?: {
|
|
||||||
model?: {
|
|
||||||
controls?: {
|
|
||||||
setModel?: (value: { providerID: string; modelID: string } | undefined) => void
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const fn = win.__opencode_e2e?.model?.controls?.setModel
|
|
||||||
if (!fn) throw new Error("Model e2e model control is not enabled")
|
|
||||||
fn(value)
|
|
||||||
}, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function pickVariant(page: Page, value: string) {
|
|
||||||
await waitControl(page, "setVariant")
|
|
||||||
await page.evaluate((value) => {
|
|
||||||
const win = window as Window & {
|
|
||||||
__opencode_e2e?: {
|
|
||||||
model?: {
|
|
||||||
controls?: {
|
|
||||||
setVariant?: (value: string | undefined) => void
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const fn = win.__opencode_e2e?.model?.controls?.setVariant
|
|
||||||
if (!fn) throw new Error("Model e2e variant control is not enabled")
|
|
||||||
fn(value)
|
|
||||||
}, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function read(page: Page): Promise<Footer> {
|
|
||||||
return {
|
|
||||||
agent: await text(page.locator(`${promptAgentSelector} [data-slot="select-select-trigger-value"]`).first()),
|
|
||||||
model: await text(page.locator(`${promptModelSelector} [data-action="prompt-model"] span`).first()),
|
|
||||||
variant: await text(page.locator(`${promptVariantSelector} [data-slot="select-select-trigger-value"]`).first()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function waitFooter(page: Page, expected: Partial<Footer>) {
|
|
||||||
let hit: Footer | null = null
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const state = await read(page)
|
|
||||||
const ok = Object.entries(expected).every(([key, value]) => state[key as keyof Footer] === value)
|
|
||||||
if (ok) hit = state
|
|
||||||
return ok
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
if (!hit) throw new Error("Failed to resolve prompt footer state")
|
|
||||||
return hit
|
|
||||||
}
|
|
||||||
|
|
||||||
async function waitModel(page: Page, value: string) {
|
|
||||||
await expect.poll(() => probe(page).then(modelKey), { timeout: 30_000 }).toBe(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function choose(page: Page, root: string, value: string) {
|
|
||||||
const select = page.locator(root)
|
|
||||||
await expect(select).toBeVisible()
|
|
||||||
await pickAgent(page, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function variantCount(page: Page) {
|
|
||||||
return (await probe(page))?.variants?.length ?? 0
|
|
||||||
}
|
|
||||||
|
|
||||||
async function agents(page: Page) {
|
|
||||||
return ((await probe(page))?.agents ?? []).map((item) => item.name).filter(Boolean)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function ensureVariant(page: Page, directory: string): Promise<Footer> {
|
|
||||||
const current = await read(page)
|
|
||||||
if ((await variantCount(page)) >= 2) return current
|
|
||||||
|
|
||||||
const cfg = await createSdk(directory)
|
|
||||||
.config.get()
|
|
||||||
.then((x) => x.data)
|
|
||||||
const visible = new Set(await agents(page))
|
|
||||||
const entry = Object.entries(cfg?.agent ?? {}).find((item) => {
|
|
||||||
const value = item[1]
|
|
||||||
return !!value && typeof value === "object" && "variant" in value && "model" in value && visible.has(item[0])
|
|
||||||
})
|
|
||||||
const name = entry?.[0]
|
|
||||||
test.skip(!name, "no agent with alternate variants available")
|
|
||||||
if (!name) return current
|
|
||||||
|
|
||||||
await choose(page, promptAgentSelector, name)
|
|
||||||
await expect.poll(() => variantCount(page), { timeout: 30_000 }).toBeGreaterThanOrEqual(2)
|
|
||||||
return waitFooter(page, { agent: name })
|
|
||||||
}
|
|
||||||
|
|
||||||
async function chooseDifferentVariant(page: Page): Promise<Footer> {
|
|
||||||
const current = await read(page)
|
|
||||||
const next = (await probe(page))?.variants?.find((item) => item !== current.variant)
|
|
||||||
if (!next) throw new Error("Current model has no alternate variant to select")
|
|
||||||
|
|
||||||
await pickVariant(page, next)
|
|
||||||
return waitFooter(page, { agent: current.agent, model: current.model, variant: next })
|
|
||||||
}
|
|
||||||
|
|
||||||
async function chooseOtherModel(page: Page, skip: string[] = []): Promise<Footer> {
|
|
||||||
const current = await currentModel(page)
|
|
||||||
const next = (await probe(page))?.models?.find((item) => {
|
|
||||||
const key = `${item.providerID}:${item.modelID}`
|
|
||||||
return key !== current && !skip.includes(key)
|
|
||||||
})
|
|
||||||
if (!next) throw new Error("Failed to choose a different model")
|
|
||||||
await pickModel(page, { providerID: next.providerID, modelID: next.modelID })
|
|
||||||
await expect.poll(async () => (await read(page)).model, { timeout: 30_000 }).toBe(next.name)
|
|
||||||
return read(page)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function goto(page: Page, directory: string, sessionID?: string) {
|
|
||||||
await page.goto(sessionPath(directory, sessionID))
|
|
||||||
await waitSession(page, { directory, sessionID })
|
|
||||||
}
|
|
||||||
|
|
||||||
async function submit(page: Page, value: string) {
|
|
||||||
const prompt = page.locator(promptSelector)
|
|
||||||
await expect(prompt).toBeVisible()
|
|
||||||
await prompt.click()
|
|
||||||
await prompt.fill(value)
|
|
||||||
await prompt.press("Enter")
|
|
||||||
|
|
||||||
await expect.poll(() => sessionIDFromUrl(page.url()) ?? "", { timeout: 30_000 }).not.toBe("")
|
|
||||||
const id = sessionIDFromUrl(page.url())
|
|
||||||
if (!id) throw new Error(`Failed to resolve session id from ${page.url()}`)
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
async function waitUser(directory: string, sessionID: string) {
|
|
||||||
const sdk = createSdk(directory)
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const items = await sdk.session.messages({ sessionID, limit: 20 }).then((x) => x.data ?? [])
|
|
||||||
return items.some((item) => item.info.role === "user")
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
await sdk.session.abort({ sessionID }).catch(() => undefined)
|
|
||||||
await waitSessionIdle(sdk, sessionID, 30_000).catch(() => undefined)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function createWorkspace(page: Page, root: string, seen: string[]) {
|
|
||||||
await openSidebar(page)
|
|
||||||
await page.getByRole("button", { name: "New workspace" }).first().click()
|
|
||||||
|
|
||||||
const next = await resolveSlug(await waitSlug(page, [root, ...seen]))
|
|
||||||
await waitSession(page, { directory: next.directory })
|
|
||||||
return next
|
|
||||||
}
|
|
||||||
|
|
||||||
async function waitWorkspace(page: Page, slug: string) {
|
|
||||||
await openSidebar(page)
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const item = page.locator(workspaceItemSelector(slug)).first()
|
|
||||||
try {
|
|
||||||
await item.hover({ timeout: 500 })
|
|
||||||
return true
|
|
||||||
} catch {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function newWorkspaceSession(page: Page, slug: string) {
|
|
||||||
await waitWorkspace(page, slug)
|
|
||||||
const item = page.locator(workspaceItemSelector(slug)).first()
|
|
||||||
await item.hover()
|
|
||||||
|
|
||||||
const button = page.locator(workspaceNewSessionSelector(slug)).first()
|
|
||||||
await expect(button).toBeVisible()
|
|
||||||
await button.click({ force: true })
|
|
||||||
|
|
||||||
const next = await resolveSlug(await waitSlug(page))
|
|
||||||
return waitSession(page, { directory: next.directory }).then((item) => item.directory)
|
|
||||||
}
|
|
||||||
|
|
||||||
test("session model restore per session without leaking into new sessions", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1440, height: 900 })
|
|
||||||
|
|
||||||
await withProject(async ({ directory, gotoSession, trackSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const firstState = await chooseOtherModel(page)
|
|
||||||
const firstKey = await currentModel(page)
|
|
||||||
const first = await submit(page, `session variant ${Date.now()}`)
|
|
||||||
trackSession(first)
|
|
||||||
await waitUser(directory, first)
|
|
||||||
|
|
||||||
await page.reload()
|
|
||||||
await waitSession(page, { directory, sessionID: first })
|
|
||||||
await waitFooter(page, firstState)
|
|
||||||
|
|
||||||
await gotoSession()
|
|
||||||
const fresh = await read(page)
|
|
||||||
expect(fresh.model).not.toBe(firstState.model)
|
|
||||||
|
|
||||||
const secondState = await chooseOtherModel(page, [firstKey])
|
|
||||||
const second = await submit(page, `session model ${Date.now()}`)
|
|
||||||
trackSession(second)
|
|
||||||
await waitUser(directory, second)
|
|
||||||
|
|
||||||
await goto(page, directory, first)
|
|
||||||
await waitFooter(page, firstState)
|
|
||||||
|
|
||||||
await goto(page, directory, second)
|
|
||||||
await waitFooter(page, secondState)
|
|
||||||
|
|
||||||
await gotoSession()
|
|
||||||
await waitFooter(page, fresh)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("session model restore across workspaces", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1440, height: 900 })
|
|
||||||
|
|
||||||
await withProject(async ({ directory: root, slug, gotoSession, trackDirectory, trackSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const firstState = await chooseOtherModel(page)
|
|
||||||
const firstKey = await currentModel(page)
|
|
||||||
const first = await submit(page, `root session ${Date.now()}`)
|
|
||||||
trackSession(first, root)
|
|
||||||
await waitUser(root, first)
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
await setWorkspacesEnabled(page, slug, true)
|
|
||||||
|
|
||||||
const one = await createWorkspace(page, slug, [])
|
|
||||||
const oneDir = await newWorkspaceSession(page, one.slug)
|
|
||||||
trackDirectory(oneDir)
|
|
||||||
|
|
||||||
const secondState = await chooseOtherModel(page, [firstKey])
|
|
||||||
const secondKey = await currentModel(page)
|
|
||||||
const second = await submit(page, `workspace one ${Date.now()}`)
|
|
||||||
trackSession(second, oneDir)
|
|
||||||
await waitUser(oneDir, second)
|
|
||||||
|
|
||||||
const two = await createWorkspace(page, slug, [one.slug])
|
|
||||||
const twoDir = await newWorkspaceSession(page, two.slug)
|
|
||||||
trackDirectory(twoDir)
|
|
||||||
|
|
||||||
const thirdState = await chooseOtherModel(page, [firstKey, secondKey])
|
|
||||||
const third = await submit(page, `workspace two ${Date.now()}`)
|
|
||||||
trackSession(third, twoDir)
|
|
||||||
await waitUser(twoDir, third)
|
|
||||||
|
|
||||||
await goto(page, root, first)
|
|
||||||
await waitFooter(page, firstState)
|
|
||||||
|
|
||||||
await goto(page, oneDir, second)
|
|
||||||
await waitFooter(page, secondState)
|
|
||||||
|
|
||||||
await goto(page, twoDir, third)
|
|
||||||
await waitFooter(page, thirdState)
|
|
||||||
|
|
||||||
await goto(page, root, first)
|
|
||||||
await waitFooter(page, firstState)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("variant preserved when switching agent modes", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1440, height: 900 })
|
|
||||||
|
|
||||||
await withProject(async ({ directory, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await ensureVariant(page, directory)
|
|
||||||
const updated = await chooseDifferentVariant(page)
|
|
||||||
|
|
||||||
const available = await agents(page)
|
|
||||||
const other = available.find((name) => name !== updated.agent)
|
|
||||||
test.skip(!other, "only one agent available")
|
|
||||||
if (!other) return
|
|
||||||
|
|
||||||
await choose(page, promptAgentSelector, other)
|
|
||||||
await waitFooter(page, { agent: other, variant: updated.variant })
|
|
||||||
|
|
||||||
await choose(page, promptAgentSelector, updated.agent)
|
|
||||||
await waitFooter(page, { agent: updated.agent, variant: updated.variant })
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,428 +0,0 @@
|
|||||||
import { waitSessionIdle, withSession } from "../actions"
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { createSdk } from "../utils"
|
|
||||||
|
|
||||||
const count = 14
|
|
||||||
|
|
||||||
function body(mark: string) {
|
|
||||||
return [
|
|
||||||
`title ${mark}`,
|
|
||||||
`mark ${mark}`,
|
|
||||||
...Array.from({ length: 32 }, (_, i) => `line ${String(i + 1).padStart(2, "0")} ${mark}`),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
function files(tag: string) {
|
|
||||||
return Array.from({ length: count }, (_, i) => {
|
|
||||||
const id = String(i).padStart(2, "0")
|
|
||||||
return {
|
|
||||||
file: `review-scroll-${id}.txt`,
|
|
||||||
mark: `${tag}-${id}`,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function seed(list: ReturnType<typeof files>) {
|
|
||||||
const out = ["*** Begin Patch"]
|
|
||||||
|
|
||||||
for (const item of list) {
|
|
||||||
out.push(`*** Add File: ${item.file}`)
|
|
||||||
for (const line of body(item.mark)) out.push(`+${line}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
out.push("*** End Patch")
|
|
||||||
return out.join("\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
function edit(file: string, prev: string, next: string) {
|
|
||||||
return ["*** Begin Patch", `*** Update File: ${file}`, "@@", `-mark ${prev}`, `+mark ${next}`, "*** End Patch"].join(
|
|
||||||
"\n",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function patch(sdk: ReturnType<typeof createSdk>, sessionID: string, patchText: string) {
|
|
||||||
await sdk.session.promptAsync({
|
|
||||||
sessionID,
|
|
||||||
agent: "build",
|
|
||||||
system: [
|
|
||||||
"You are seeding deterministic e2e UI state.",
|
|
||||||
"Your only valid response is one apply_patch tool call.",
|
|
||||||
`Use this JSON input: ${JSON.stringify({ patchText })}`,
|
|
||||||
"Do not call any other tools.",
|
|
||||||
"Do not output plain text.",
|
|
||||||
].join("\n"),
|
|
||||||
parts: [{ type: "text", text: "Apply the provided patch exactly once." }],
|
|
||||||
})
|
|
||||||
|
|
||||||
await waitSessionIdle(sdk, sessionID, 120_000)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function show(page: Parameters<typeof test>[0]["page"]) {
|
|
||||||
const btn = page.getByRole("button", { name: "Toggle review" }).first()
|
|
||||||
await expect(btn).toBeVisible()
|
|
||||||
if ((await btn.getAttribute("aria-expanded")) !== "true") await btn.click()
|
|
||||||
await expect(btn).toHaveAttribute("aria-expanded", "true")
|
|
||||||
}
|
|
||||||
|
|
||||||
async function expand(page: Parameters<typeof test>[0]["page"]) {
|
|
||||||
const close = page.getByRole("button", { name: /^Collapse all$/i }).first()
|
|
||||||
const open = await close
|
|
||||||
.isVisible()
|
|
||||||
.then((value) => value)
|
|
||||||
.catch(() => false)
|
|
||||||
|
|
||||||
const btn = page.getByRole("button", { name: /^Expand all$/i }).first()
|
|
||||||
if (open) {
|
|
||||||
await close.click()
|
|
||||||
await expect(btn).toBeVisible()
|
|
||||||
}
|
|
||||||
|
|
||||||
await expect(btn).toBeVisible()
|
|
||||||
await btn.click()
|
|
||||||
await expect(close).toBeVisible()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function waitMark(page: Parameters<typeof test>[0]["page"], file: string, mark: string) {
|
|
||||||
await page.waitForFunction(
|
|
||||||
({ file, mark }) => {
|
|
||||||
const view = document.querySelector('[data-slot="session-review-scroll"] .scroll-view__viewport')
|
|
||||||
if (!(view instanceof HTMLElement)) return false
|
|
||||||
|
|
||||||
const head = Array.from(view.querySelectorAll("h3")).find(
|
|
||||||
(node) => node instanceof HTMLElement && node.textContent?.includes(file),
|
|
||||||
)
|
|
||||||
if (!(head instanceof HTMLElement)) return false
|
|
||||||
|
|
||||||
return Array.from(head.parentElement?.querySelectorAll("diffs-container") ?? []).some((host) => {
|
|
||||||
if (!(host instanceof HTMLElement)) return false
|
|
||||||
const root = host.shadowRoot
|
|
||||||
return root?.textContent?.includes(`mark ${mark}`) ?? false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ file, mark },
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function spot(page: Parameters<typeof test>[0]["page"], file: string) {
|
|
||||||
return page.evaluate((file) => {
|
|
||||||
const view = document.querySelector('[data-slot="session-review-scroll"] .scroll-view__viewport')
|
|
||||||
if (!(view instanceof HTMLElement)) return null
|
|
||||||
|
|
||||||
const row = Array.from(view.querySelectorAll("h3")).find(
|
|
||||||
(node) => node instanceof HTMLElement && node.textContent?.includes(file),
|
|
||||||
)
|
|
||||||
if (!(row instanceof HTMLElement)) return null
|
|
||||||
|
|
||||||
const a = row.getBoundingClientRect()
|
|
||||||
const b = view.getBoundingClientRect()
|
|
||||||
return {
|
|
||||||
top: a.top - b.top,
|
|
||||||
y: view.scrollTop,
|
|
||||||
}
|
|
||||||
}, file)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function comment(page: Parameters<typeof test>[0]["page"], file: string, note: string) {
|
|
||||||
const row = page.locator(`[data-file="${file}"]`).first()
|
|
||||||
await expect(row).toBeVisible()
|
|
||||||
|
|
||||||
const line = row.locator('diffs-container [data-line="2"]').first()
|
|
||||||
await expect(line).toBeVisible()
|
|
||||||
await line.hover()
|
|
||||||
|
|
||||||
const add = row.getByRole("button", { name: /^Comment$/ }).first()
|
|
||||||
await expect(add).toBeVisible()
|
|
||||||
await add.click()
|
|
||||||
|
|
||||||
const area = row.locator('[data-slot="line-comment-textarea"]').first()
|
|
||||||
await expect(area).toBeVisible()
|
|
||||||
await area.fill(note)
|
|
||||||
|
|
||||||
const submit = row.locator('[data-slot="line-comment-action"][data-variant="primary"]').first()
|
|
||||||
await expect(submit).toBeEnabled()
|
|
||||||
await submit.click()
|
|
||||||
|
|
||||||
await expect(row.locator('[data-slot="line-comment-content"]').filter({ hasText: note }).first()).toBeVisible()
|
|
||||||
await expect(row.locator('[data-slot="line-comment-tools"]').first()).toBeVisible()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function overflow(page: Parameters<typeof test>[0]["page"], file: string) {
|
|
||||||
const row = page.locator(`[data-file="${file}"]`).first()
|
|
||||||
const view = page.locator('[data-slot="session-review-scroll"] .scroll-view__viewport').first()
|
|
||||||
const pop = row.locator('[data-slot="line-comment-popover"][data-inline-body]').first()
|
|
||||||
const tools = row.locator('[data-slot="line-comment-tools"]').first()
|
|
||||||
|
|
||||||
const [width, viewBox, popBox, toolsBox] = await Promise.all([
|
|
||||||
view.evaluate((el) => el.scrollWidth - el.clientWidth),
|
|
||||||
view.boundingBox(),
|
|
||||||
pop.boundingBox(),
|
|
||||||
tools.boundingBox(),
|
|
||||||
])
|
|
||||||
|
|
||||||
if (!viewBox || !popBox || !toolsBox) return null
|
|
||||||
|
|
||||||
return {
|
|
||||||
width,
|
|
||||||
pop: popBox.x + popBox.width - (viewBox.x + viewBox.width),
|
|
||||||
tools: toolsBox.x + toolsBox.width - (viewBox.x + viewBox.width),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function openReviewFile(page: Parameters<typeof test>[0]["page"], file: string) {
|
|
||||||
const row = page.locator(`[data-file="${file}"]`).first()
|
|
||||||
await expect(row).toBeVisible()
|
|
||||||
await row.hover()
|
|
||||||
|
|
||||||
const open = row.getByRole("button", { name: /^Open file$/i }).first()
|
|
||||||
await expect(open).toBeVisible()
|
|
||||||
await open.click()
|
|
||||||
|
|
||||||
const tab = page.getByRole("tab", { name: file }).first()
|
|
||||||
await expect(tab).toBeVisible()
|
|
||||||
await tab.click()
|
|
||||||
|
|
||||||
const viewer = page.locator('[data-component="file"][data-mode="text"]').first()
|
|
||||||
await expect(viewer).toBeVisible()
|
|
||||||
return viewer
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fileComment(page: Parameters<typeof test>[0]["page"], note: string) {
|
|
||||||
const viewer = page.locator('[data-component="file"][data-mode="text"]').first()
|
|
||||||
await expect(viewer).toBeVisible()
|
|
||||||
|
|
||||||
const line = viewer.locator('diffs-container [data-line="2"]').first()
|
|
||||||
await expect(line).toBeVisible()
|
|
||||||
await line.hover()
|
|
||||||
|
|
||||||
const add = viewer.getByRole("button", { name: /^Comment$/ }).first()
|
|
||||||
await expect(add).toBeVisible()
|
|
||||||
await add.click()
|
|
||||||
|
|
||||||
const area = viewer.locator('[data-slot="line-comment-textarea"]').first()
|
|
||||||
await expect(area).toBeVisible()
|
|
||||||
await area.fill(note)
|
|
||||||
|
|
||||||
const submit = viewer.locator('[data-slot="line-comment-action"][data-variant="primary"]').first()
|
|
||||||
await expect(submit).toBeEnabled()
|
|
||||||
await submit.click()
|
|
||||||
|
|
||||||
await expect(viewer.locator('[data-slot="line-comment-content"]').filter({ hasText: note }).first()).toBeVisible()
|
|
||||||
await expect(viewer.locator('[data-slot="line-comment-tools"]').first()).toBeVisible()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fileOverflow(page: Parameters<typeof test>[0]["page"]) {
|
|
||||||
const viewer = page.locator('[data-component="file"][data-mode="text"]').first()
|
|
||||||
const view = page.locator('[role="tabpanel"] .scroll-view__viewport').first()
|
|
||||||
const pop = viewer.locator('[data-slot="line-comment-popover"][data-inline-body]').first()
|
|
||||||
const tools = viewer.locator('[data-slot="line-comment-tools"]').first()
|
|
||||||
|
|
||||||
const [width, viewBox, popBox, toolsBox] = await Promise.all([
|
|
||||||
view.evaluate((el) => el.scrollWidth - el.clientWidth),
|
|
||||||
view.boundingBox(),
|
|
||||||
pop.boundingBox(),
|
|
||||||
tools.boundingBox(),
|
|
||||||
])
|
|
||||||
|
|
||||||
if (!viewBox || !popBox || !toolsBox) return null
|
|
||||||
|
|
||||||
return {
|
|
||||||
width,
|
|
||||||
pop: popBox.x + popBox.width - (viewBox.x + viewBox.width),
|
|
||||||
tools: toolsBox.x + toolsBox.width - (viewBox.x + viewBox.width),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
test("review applies inline comment clicks without horizontal overflow", async ({ page, withProject }) => {
|
|
||||||
test.skip(true, "Flaky in CI for now.")
|
|
||||||
test.setTimeout(180_000)
|
|
||||||
|
|
||||||
const tag = `review-comment-${Date.now()}`
|
|
||||||
const file = `review-comment-${tag}.txt`
|
|
||||||
const note = `comment ${tag}`
|
|
||||||
|
|
||||||
await page.setViewportSize({ width: 1280, height: 900 })
|
|
||||||
|
|
||||||
await withProject(async (project) => {
|
|
||||||
const sdk = createSdk(project.directory)
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e review comment ${tag}`, async (session) => {
|
|
||||||
await patch(sdk, session.id, seed([{ file, mark: tag }]))
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const diff = await sdk.session.diff({ sessionID: session.id }).then((res) => res.data ?? [])
|
|
||||||
return diff.length
|
|
||||||
},
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
.toBe(1)
|
|
||||||
|
|
||||||
await project.gotoSession(session.id)
|
|
||||||
await show(page)
|
|
||||||
|
|
||||||
const tab = page.getByRole("tab", { name: /Review/i }).first()
|
|
||||||
await expect(tab).toBeVisible()
|
|
||||||
await tab.click()
|
|
||||||
|
|
||||||
await expand(page)
|
|
||||||
await waitMark(page, file, tag)
|
|
||||||
await comment(page, file, note)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => (await overflow(page, file))?.width ?? Number.POSITIVE_INFINITY, { timeout: 10_000 })
|
|
||||||
.toBeLessThanOrEqual(1)
|
|
||||||
await expect
|
|
||||||
.poll(async () => (await overflow(page, file))?.pop ?? Number.POSITIVE_INFINITY, { timeout: 10_000 })
|
|
||||||
.toBeLessThanOrEqual(1)
|
|
||||||
await expect
|
|
||||||
.poll(async () => (await overflow(page, file))?.tools ?? Number.POSITIVE_INFINITY, { timeout: 10_000 })
|
|
||||||
.toBeLessThanOrEqual(1)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("review file comments submit on click without clipping actions", async ({ page, withProject }) => {
|
|
||||||
test.skip(true, "Flaky in CI for now.")
|
|
||||||
test.setTimeout(180_000)
|
|
||||||
|
|
||||||
const tag = `review-file-comment-${Date.now()}`
|
|
||||||
const file = `review-file-comment-${tag}.txt`
|
|
||||||
const note = `comment ${tag}`
|
|
||||||
|
|
||||||
await page.setViewportSize({ width: 1280, height: 900 })
|
|
||||||
|
|
||||||
await withProject(async (project) => {
|
|
||||||
const sdk = createSdk(project.directory)
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e review file comment ${tag}`, async (session) => {
|
|
||||||
await patch(sdk, session.id, seed([{ file, mark: tag }]))
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const diff = await sdk.session.diff({ sessionID: session.id }).then((res) => res.data ?? [])
|
|
||||||
return diff.length
|
|
||||||
},
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
.toBe(1)
|
|
||||||
|
|
||||||
await project.gotoSession(session.id)
|
|
||||||
await show(page)
|
|
||||||
|
|
||||||
const tab = page.getByRole("tab", { name: /Review/i }).first()
|
|
||||||
await expect(tab).toBeVisible()
|
|
||||||
await tab.click()
|
|
||||||
|
|
||||||
await expand(page)
|
|
||||||
await waitMark(page, file, tag)
|
|
||||||
await openReviewFile(page, file)
|
|
||||||
await fileComment(page, note)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => (await fileOverflow(page))?.width ?? Number.POSITIVE_INFINITY, { timeout: 10_000 })
|
|
||||||
.toBeLessThanOrEqual(1)
|
|
||||||
await expect
|
|
||||||
.poll(async () => (await fileOverflow(page))?.pop ?? Number.POSITIVE_INFINITY, { timeout: 10_000 })
|
|
||||||
.toBeLessThanOrEqual(1)
|
|
||||||
await expect
|
|
||||||
.poll(async () => (await fileOverflow(page))?.tools ?? Number.POSITIVE_INFINITY, { timeout: 10_000 })
|
|
||||||
.toBeLessThanOrEqual(1)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("review keeps scroll position after a live diff update", async ({ page, withProject }) => {
|
|
||||||
test.skip(Boolean(process.env.CI), "Flaky in CI for now.")
|
|
||||||
test.setTimeout(180_000)
|
|
||||||
|
|
||||||
const tag = `review-${Date.now()}`
|
|
||||||
const list = files(tag)
|
|
||||||
const hit = list[list.length - 4]!
|
|
||||||
const next = `${tag}-live`
|
|
||||||
|
|
||||||
await page.setViewportSize({ width: 1600, height: 1000 })
|
|
||||||
|
|
||||||
await withProject(async (project) => {
|
|
||||||
const sdk = createSdk(project.directory)
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e review ${tag}`, async (session) => {
|
|
||||||
await patch(sdk, session.id, seed(list))
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const info = await sdk.session.get({ sessionID: session.id }).then((res) => res.data)
|
|
||||||
return info?.summary?.files ?? 0
|
|
||||||
},
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
.toBe(list.length)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const diff = await sdk.session.diff({ sessionID: session.id }).then((res) => res.data ?? [])
|
|
||||||
return diff.length
|
|
||||||
},
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
.toBe(list.length)
|
|
||||||
|
|
||||||
await project.gotoSession(session.id)
|
|
||||||
await show(page)
|
|
||||||
|
|
||||||
const tab = page.getByRole("tab", { name: /Review/i }).first()
|
|
||||||
await expect(tab).toBeVisible()
|
|
||||||
await tab.click()
|
|
||||||
|
|
||||||
const view = page.locator('[data-slot="session-review-scroll"] .scroll-view__viewport').first()
|
|
||||||
await expect(view).toBeVisible()
|
|
||||||
const heads = page.getByRole("heading", { level: 3 }).filter({ hasText: /^review-scroll-/ })
|
|
||||||
await expect(heads).toHaveCount(list.length, {
|
|
||||||
timeout: 60_000,
|
|
||||||
})
|
|
||||||
|
|
||||||
await expand(page)
|
|
||||||
await waitMark(page, hit.file, hit.mark)
|
|
||||||
|
|
||||||
const row = page
|
|
||||||
.getByRole("heading", { level: 3, name: new RegExp(hit.file.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) })
|
|
||||||
.first()
|
|
||||||
await expect(row).toBeVisible()
|
|
||||||
await row.evaluate((el) => el.scrollIntoView({ block: "center" }))
|
|
||||||
|
|
||||||
await expect.poll(async () => (await spot(page, hit.file))?.y ?? 0).toBeGreaterThan(200)
|
|
||||||
const prev = await spot(page, hit.file)
|
|
||||||
if (!prev) throw new Error(`missing review row for ${hit.file}`)
|
|
||||||
|
|
||||||
await patch(sdk, session.id, edit(hit.file, hit.mark, next))
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const diff = await sdk.session.diff({ sessionID: session.id }).then((res) => res.data ?? [])
|
|
||||||
const item = diff.find((item) => item.file === hit.file)
|
|
||||||
return typeof item?.after === "string" ? item.after : ""
|
|
||||||
},
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
.toContain(`mark ${next}`)
|
|
||||||
|
|
||||||
await waitMark(page, hit.file, next)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const next = await spot(page, hit.file)
|
|
||||||
if (!next) return Number.POSITIVE_INFINITY
|
|
||||||
return Math.max(Math.abs(next.top - prev.top), Math.abs(next.y - prev.y))
|
|
||||||
},
|
|
||||||
{ timeout: 60_000 },
|
|
||||||
)
|
|
||||||
.toBeLessThanOrEqual(32)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,233 +0,0 @@
|
|||||||
import type { Page } from "@playwright/test"
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { withSession } from "../actions"
|
|
||||||
import { createSdk, modKey } from "../utils"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
|
|
||||||
async function seedConversation(input: {
|
|
||||||
page: Page
|
|
||||||
sdk: ReturnType<typeof createSdk>
|
|
||||||
sessionID: string
|
|
||||||
token: string
|
|
||||||
}) {
|
|
||||||
const messages = async () =>
|
|
||||||
await input.sdk.session.messages({ sessionID: input.sessionID, limit: 100 }).then((r) => r.data ?? [])
|
|
||||||
const seeded = await messages()
|
|
||||||
const userIDs = new Set(seeded.filter((m) => m.info.role === "user").map((m) => m.info.id))
|
|
||||||
|
|
||||||
const prompt = input.page.locator(promptSelector)
|
|
||||||
await expect(prompt).toBeVisible()
|
|
||||||
await input.sdk.session.promptAsync({
|
|
||||||
sessionID: input.sessionID,
|
|
||||||
noReply: true,
|
|
||||||
parts: [{ type: "text", text: input.token }],
|
|
||||||
})
|
|
||||||
|
|
||||||
let userMessageID: string | undefined
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const users = (await messages()).filter(
|
|
||||||
(m) =>
|
|
||||||
!userIDs.has(m.info.id) &&
|
|
||||||
m.info.role === "user" &&
|
|
||||||
m.parts.filter((p) => p.type === "text").some((p) => p.text.includes(input.token)),
|
|
||||||
)
|
|
||||||
if (users.length === 0) return false
|
|
||||||
|
|
||||||
const user = users[users.length - 1]
|
|
||||||
if (!user) return false
|
|
||||||
userMessageID = user.info.id
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
{ timeout: 90_000, intervals: [250, 500, 1_000] },
|
|
||||||
)
|
|
||||||
.toBe(true)
|
|
||||||
|
|
||||||
if (!userMessageID) throw new Error("Expected a user message id")
|
|
||||||
await expect(input.page.locator(`[data-message-id="${userMessageID}"]`)).toHaveCount(1, { timeout: 30_000 })
|
|
||||||
return { prompt, userMessageID }
|
|
||||||
}
|
|
||||||
|
|
||||||
test("slash undo sets revert and restores prior prompt", async ({ page, withProject }) => {
|
|
||||||
test.setTimeout(120_000)
|
|
||||||
|
|
||||||
const token = `undo_${Date.now()}`
|
|
||||||
|
|
||||||
await withProject(async (project) => {
|
|
||||||
const sdk = createSdk(project.directory)
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e undo ${Date.now()}`, async (session) => {
|
|
||||||
await project.gotoSession(session.id)
|
|
||||||
|
|
||||||
const seeded = await seedConversation({ page, sdk, sessionID: session.id, token })
|
|
||||||
|
|
||||||
await seeded.prompt.click()
|
|
||||||
await page.keyboard.type("/undo")
|
|
||||||
|
|
||||||
const undo = page.locator('[data-slash-id="session.undo"]').first()
|
|
||||||
await expect(undo).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => await sdk.session.get({ sessionID: session.id }).then((r) => r.data?.revert?.messageID), {
|
|
||||||
timeout: 30_000,
|
|
||||||
})
|
|
||||||
.toBe(seeded.userMessageID)
|
|
||||||
|
|
||||||
await expect(seeded.prompt).toContainText(token)
|
|
||||||
await expect(page.locator(`[data-message-id="${seeded.userMessageID}"]`)).toHaveCount(0)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("slash redo clears revert and restores latest state", async ({ page, withProject }) => {
|
|
||||||
test.setTimeout(120_000)
|
|
||||||
|
|
||||||
const token = `redo_${Date.now()}`
|
|
||||||
|
|
||||||
await withProject(async (project) => {
|
|
||||||
const sdk = createSdk(project.directory)
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e redo ${Date.now()}`, async (session) => {
|
|
||||||
await project.gotoSession(session.id)
|
|
||||||
|
|
||||||
const seeded = await seedConversation({ page, sdk, sessionID: session.id, token })
|
|
||||||
|
|
||||||
await seeded.prompt.click()
|
|
||||||
await page.keyboard.type("/undo")
|
|
||||||
|
|
||||||
const undo = page.locator('[data-slash-id="session.undo"]').first()
|
|
||||||
await expect(undo).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => await sdk.session.get({ sessionID: session.id }).then((r) => r.data?.revert?.messageID), {
|
|
||||||
timeout: 30_000,
|
|
||||||
})
|
|
||||||
.toBe(seeded.userMessageID)
|
|
||||||
|
|
||||||
await seeded.prompt.click()
|
|
||||||
await page.keyboard.press(`${modKey}+A`)
|
|
||||||
await page.keyboard.press("Backspace")
|
|
||||||
await page.keyboard.type("/redo")
|
|
||||||
|
|
||||||
const redo = page.locator('[data-slash-id="session.redo"]').first()
|
|
||||||
await expect(redo).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => await sdk.session.get({ sessionID: session.id }).then((r) => r.data?.revert?.messageID), {
|
|
||||||
timeout: 30_000,
|
|
||||||
})
|
|
||||||
.toBeUndefined()
|
|
||||||
|
|
||||||
await expect(seeded.prompt).not.toContainText(token)
|
|
||||||
await expect(page.locator(`[data-message-id="${seeded.userMessageID}"]`)).toHaveCount(1)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("slash undo/redo traverses multi-step revert stack", async ({ page, withProject }) => {
|
|
||||||
test.setTimeout(120_000)
|
|
||||||
|
|
||||||
const firstToken = `undo_redo_first_${Date.now()}`
|
|
||||||
const secondToken = `undo_redo_second_${Date.now()}`
|
|
||||||
|
|
||||||
await withProject(async (project) => {
|
|
||||||
const sdk = createSdk(project.directory)
|
|
||||||
|
|
||||||
await withSession(sdk, `e2e undo redo stack ${Date.now()}`, async (session) => {
|
|
||||||
await project.gotoSession(session.id)
|
|
||||||
|
|
||||||
const first = await seedConversation({
|
|
||||||
page,
|
|
||||||
sdk,
|
|
||||||
sessionID: session.id,
|
|
||||||
token: firstToken,
|
|
||||||
})
|
|
||||||
const second = await seedConversation({
|
|
||||||
page,
|
|
||||||
sdk,
|
|
||||||
sessionID: session.id,
|
|
||||||
token: secondToken,
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(first.userMessageID).not.toBe(second.userMessageID)
|
|
||||||
|
|
||||||
const firstMessage = page.locator(`[data-message-id="${first.userMessageID}"]`)
|
|
||||||
const secondMessage = page.locator(`[data-message-id="${second.userMessageID}"]`)
|
|
||||||
|
|
||||||
await expect(firstMessage).toHaveCount(1)
|
|
||||||
await expect(secondMessage).toHaveCount(1)
|
|
||||||
|
|
||||||
await second.prompt.click()
|
|
||||||
await page.keyboard.press(`${modKey}+A`)
|
|
||||||
await page.keyboard.press("Backspace")
|
|
||||||
await page.keyboard.type("/undo")
|
|
||||||
|
|
||||||
const undo = page.locator('[data-slash-id="session.undo"]').first()
|
|
||||||
await expect(undo).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => await sdk.session.get({ sessionID: session.id }).then((r) => r.data?.revert?.messageID), {
|
|
||||||
timeout: 30_000,
|
|
||||||
})
|
|
||||||
.toBe(second.userMessageID)
|
|
||||||
|
|
||||||
await expect(firstMessage).toHaveCount(1)
|
|
||||||
await expect(secondMessage).toHaveCount(0)
|
|
||||||
|
|
||||||
await second.prompt.click()
|
|
||||||
await page.keyboard.press(`${modKey}+A`)
|
|
||||||
await page.keyboard.press("Backspace")
|
|
||||||
await page.keyboard.type("/undo")
|
|
||||||
await expect(undo).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => await sdk.session.get({ sessionID: session.id }).then((r) => r.data?.revert?.messageID), {
|
|
||||||
timeout: 30_000,
|
|
||||||
})
|
|
||||||
.toBe(first.userMessageID)
|
|
||||||
|
|
||||||
await expect(firstMessage).toHaveCount(0)
|
|
||||||
await expect(secondMessage).toHaveCount(0)
|
|
||||||
|
|
||||||
await second.prompt.click()
|
|
||||||
await page.keyboard.press(`${modKey}+A`)
|
|
||||||
await page.keyboard.press("Backspace")
|
|
||||||
await page.keyboard.type("/redo")
|
|
||||||
|
|
||||||
const redo = page.locator('[data-slash-id="session.redo"]').first()
|
|
||||||
await expect(redo).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => await sdk.session.get({ sessionID: session.id }).then((r) => r.data?.revert?.messageID), {
|
|
||||||
timeout: 30_000,
|
|
||||||
})
|
|
||||||
.toBe(second.userMessageID)
|
|
||||||
|
|
||||||
await expect(firstMessage).toHaveCount(1)
|
|
||||||
await expect(secondMessage).toHaveCount(0)
|
|
||||||
|
|
||||||
await second.prompt.click()
|
|
||||||
await page.keyboard.press(`${modKey}+A`)
|
|
||||||
await page.keyboard.press("Backspace")
|
|
||||||
await page.keyboard.type("/redo")
|
|
||||||
await expect(redo).toBeVisible()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => await sdk.session.get({ sessionID: session.id }).then((r) => r.data?.revert?.messageID), {
|
|
||||||
timeout: 30_000,
|
|
||||||
})
|
|
||||||
.toBeUndefined()
|
|
||||||
|
|
||||||
await expect(firstMessage).toHaveCount(1)
|
|
||||||
await expect(secondMessage).toHaveCount(1)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import {
|
|
||||||
openSidebar,
|
|
||||||
openSessionMoreMenu,
|
|
||||||
clickMenuItem,
|
|
||||||
confirmDialog,
|
|
||||||
openSharePopover,
|
|
||||||
withSession,
|
|
||||||
} from "../actions"
|
|
||||||
import { sessionItemSelector, inlineInputSelector } from "../selectors"
|
|
||||||
|
|
||||||
const shareDisabled = process.env.OPENCODE_DISABLE_SHARE === "true" || process.env.OPENCODE_DISABLE_SHARE === "1"
|
|
||||||
|
|
||||||
type Sdk = Parameters<typeof withSession>[0]
|
|
||||||
|
|
||||||
async function seedMessage(sdk: Sdk, sessionID: string) {
|
|
||||||
await sdk.session.promptAsync({
|
|
||||||
sessionID,
|
|
||||||
noReply: true,
|
|
||||||
parts: [{ type: "text", text: "e2e seed" }],
|
|
||||||
})
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const messages = await sdk.session.messages({ sessionID, limit: 1 }).then((r) => r.data ?? [])
|
|
||||||
return messages.length
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBeGreaterThan(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
test("session can be renamed via header menu", async ({ page, sdk, gotoSession }) => {
|
|
||||||
const stamp = Date.now()
|
|
||||||
const originalTitle = `e2e rename test ${stamp}`
|
|
||||||
const renamedTitle = `e2e renamed ${stamp}`
|
|
||||||
|
|
||||||
await withSession(sdk, originalTitle, async (session) => {
|
|
||||||
await seedMessage(sdk, session.id)
|
|
||||||
await gotoSession(session.id)
|
|
||||||
await expect(page.getByRole("heading", { level: 1 }).first()).toHaveText(originalTitle)
|
|
||||||
|
|
||||||
const menu = await openSessionMoreMenu(page, session.id)
|
|
||||||
await clickMenuItem(menu, /rename/i)
|
|
||||||
|
|
||||||
const input = page.locator(".scroll-view__viewport").locator(inlineInputSelector).first()
|
|
||||||
await expect(input).toBeVisible()
|
|
||||||
await expect(input).toBeFocused()
|
|
||||||
await input.fill(renamedTitle)
|
|
||||||
await expect(input).toHaveValue(renamedTitle)
|
|
||||||
await input.press("Enter")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const data = await sdk.session.get({ sessionID: session.id }).then((r) => r.data)
|
|
||||||
return data?.title
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBe(renamedTitle)
|
|
||||||
|
|
||||||
await expect(page.getByRole("heading", { level: 1 }).first()).toHaveText(renamedTitle)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("session can be archived via header menu", async ({ page, sdk, gotoSession }) => {
|
|
||||||
const stamp = Date.now()
|
|
||||||
const title = `e2e archive test ${stamp}`
|
|
||||||
|
|
||||||
await withSession(sdk, title, async (session) => {
|
|
||||||
await seedMessage(sdk, session.id)
|
|
||||||
await gotoSession(session.id)
|
|
||||||
const menu = await openSessionMoreMenu(page, session.id)
|
|
||||||
await clickMenuItem(menu, /archive/i)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const data = await sdk.session.get({ sessionID: session.id }).then((r) => r.data)
|
|
||||||
return data?.time?.archived
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.not.toBeUndefined()
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
await expect(page.locator(sessionItemSelector(session.id))).toHaveCount(0)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("session can be deleted via header menu", async ({ page, sdk, gotoSession }) => {
|
|
||||||
const stamp = Date.now()
|
|
||||||
const title = `e2e delete test ${stamp}`
|
|
||||||
|
|
||||||
await withSession(sdk, title, async (session) => {
|
|
||||||
await seedMessage(sdk, session.id)
|
|
||||||
await gotoSession(session.id)
|
|
||||||
const menu = await openSessionMoreMenu(page, session.id)
|
|
||||||
await clickMenuItem(menu, /delete/i)
|
|
||||||
await confirmDialog(page, /delete/i)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const data = await sdk.session
|
|
||||||
.get({ sessionID: session.id })
|
|
||||||
.then((r) => r.data)
|
|
||||||
.catch(() => undefined)
|
|
||||||
return data?.id
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBeUndefined()
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
await expect(page.locator(sessionItemSelector(session.id))).toHaveCount(0)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("session can be shared and unshared via header button", async ({ page, sdk, gotoSession }) => {
|
|
||||||
test.skip(shareDisabled, "Share is disabled in this environment (OPENCODE_DISABLE_SHARE).")
|
|
||||||
|
|
||||||
const stamp = Date.now()
|
|
||||||
const title = `e2e share test ${stamp}`
|
|
||||||
|
|
||||||
await withSession(sdk, title, async (session) => {
|
|
||||||
await seedMessage(sdk, session.id)
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
const shared = await openSharePopover(page)
|
|
||||||
const publish = shared.popoverBody.getByRole("button", { name: "Publish" }).first()
|
|
||||||
await expect(publish).toBeVisible({ timeout: 30_000 })
|
|
||||||
await publish.click()
|
|
||||||
|
|
||||||
await expect(shared.popoverBody.getByRole("button", { name: "Unpublish" }).first()).toBeVisible({
|
|
||||||
timeout: 30_000,
|
|
||||||
})
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const data = await sdk.session.get({ sessionID: session.id }).then((r) => r.data)
|
|
||||||
return data?.share?.url || undefined
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.not.toBeUndefined()
|
|
||||||
|
|
||||||
const unpublish = shared.popoverBody.getByRole("button", { name: "Unpublish" }).first()
|
|
||||||
await expect(unpublish).toBeVisible({ timeout: 30_000 })
|
|
||||||
await unpublish.click()
|
|
||||||
|
|
||||||
await expect(shared.popoverBody.getByRole("button", { name: "Publish" }).first()).toBeVisible({
|
|
||||||
timeout: 30_000,
|
|
||||||
})
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const data = await sdk.session.get({ sessionID: session.id }).then((r) => r.data)
|
|
||||||
return data?.share?.url || undefined
|
|
||||||
},
|
|
||||||
{ timeout: 30_000 },
|
|
||||||
)
|
|
||||||
.toBeUndefined()
|
|
||||||
|
|
||||||
const unshared = await openSharePopover(page)
|
|
||||||
await expect(unshared.popoverBody.getByRole("button", { name: "Publish" }).first()).toBeVisible({
|
|
||||||
timeout: 30_000,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,389 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { openSettings, closeDialog, waitTerminalFocusIdle, withSession } from "../actions"
|
|
||||||
import { keybindButtonSelector, terminalSelector } from "../selectors"
|
|
||||||
import { modKey } from "../utils"
|
|
||||||
|
|
||||||
test("changing sidebar toggle keybind works", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
await dialog.getByRole("tab", { name: "Shortcuts" }).click()
|
|
||||||
|
|
||||||
const keybindButton = dialog.locator(keybindButtonSelector("sidebar.toggle")).first()
|
|
||||||
await expect(keybindButton).toBeVisible()
|
|
||||||
|
|
||||||
const initialKeybind = await keybindButton.textContent()
|
|
||||||
expect(initialKeybind).toContain("B")
|
|
||||||
|
|
||||||
await keybindButton.click()
|
|
||||||
await expect(keybindButton).toHaveText(/press/i)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+KeyH`)
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const newKeybind = await keybindButton.textContent()
|
|
||||||
expect(newKeybind).toContain("H")
|
|
||||||
|
|
||||||
const stored = await page.evaluate(() => {
|
|
||||||
const raw = localStorage.getItem("settings.v3")
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
})
|
|
||||||
expect(stored?.keybinds?.["sidebar.toggle"]).toBe("mod+shift+h")
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
|
|
||||||
const button = page.getByRole("button", { name: /toggle sidebar/i }).first()
|
|
||||||
const initiallyClosed = (await button.getAttribute("aria-expanded")) !== "true"
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+H`)
|
|
||||||
await expect(button).toHaveAttribute("aria-expanded", initiallyClosed ? "true" : "false")
|
|
||||||
|
|
||||||
const afterToggleClosed = (await button.getAttribute("aria-expanded")) !== "true"
|
|
||||||
expect(afterToggleClosed).toBe(!initiallyClosed)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+H`)
|
|
||||||
await expect(button).toHaveAttribute("aria-expanded", initiallyClosed ? "false" : "true")
|
|
||||||
|
|
||||||
const finalClosed = (await button.getAttribute("aria-expanded")) !== "true"
|
|
||||||
expect(finalClosed).toBe(initiallyClosed)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("sidebar toggle keybind guards against shortcut conflicts", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
await dialog.getByRole("tab", { name: "Shortcuts" }).click()
|
|
||||||
|
|
||||||
const keybindButton = dialog.locator(keybindButtonSelector("sidebar.toggle"))
|
|
||||||
await expect(keybindButton).toBeVisible()
|
|
||||||
|
|
||||||
const initialKeybind = await keybindButton.textContent()
|
|
||||||
expect(initialKeybind).toContain("B")
|
|
||||||
|
|
||||||
await keybindButton.click()
|
|
||||||
await expect(keybindButton).toHaveText(/press/i)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+KeyP`)
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const toast = page.locator('[data-component="toast"]').last()
|
|
||||||
await expect(toast).toBeVisible()
|
|
||||||
await expect(toast).toContainText(/already/i)
|
|
||||||
|
|
||||||
await keybindButton.click()
|
|
||||||
await expect(keybindButton).toContainText("B")
|
|
||||||
|
|
||||||
const stored = await page.evaluate(() => {
|
|
||||||
const raw = localStorage.getItem("settings.v3")
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
})
|
|
||||||
expect(stored?.keybinds?.["sidebar.toggle"]).toBeUndefined()
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("resetting all keybinds to defaults works", async ({ page, gotoSession }) => {
|
|
||||||
await page.addInitScript(() => {
|
|
||||||
localStorage.setItem("settings.v3", JSON.stringify({ keybinds: { "sidebar.toggle": "mod+shift+x" } }))
|
|
||||||
})
|
|
||||||
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
await dialog.getByRole("tab", { name: "Shortcuts" }).click()
|
|
||||||
|
|
||||||
const keybindButton = dialog.locator(keybindButtonSelector("sidebar.toggle"))
|
|
||||||
await expect(keybindButton).toBeVisible()
|
|
||||||
|
|
||||||
const customKeybind = await keybindButton.textContent()
|
|
||||||
expect(customKeybind).toContain("X")
|
|
||||||
|
|
||||||
const resetButton = dialog.getByRole("button", { name: "Reset to defaults" })
|
|
||||||
await expect(resetButton).toBeVisible()
|
|
||||||
await expect(resetButton).toBeEnabled()
|
|
||||||
await resetButton.click()
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const restoredKeybind = await keybindButton.textContent()
|
|
||||||
expect(restoredKeybind).toContain("B")
|
|
||||||
|
|
||||||
const stored = await page.evaluate(() => {
|
|
||||||
const raw = localStorage.getItem("settings.v3")
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
})
|
|
||||||
expect(stored?.keybinds?.["sidebar.toggle"]).toBeUndefined()
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("clearing a keybind works", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
await dialog.getByRole("tab", { name: "Shortcuts" }).click()
|
|
||||||
|
|
||||||
const keybindButton = dialog.locator(keybindButtonSelector("sidebar.toggle"))
|
|
||||||
await expect(keybindButton).toBeVisible()
|
|
||||||
|
|
||||||
const initialKeybind = await keybindButton.textContent()
|
|
||||||
expect(initialKeybind).toContain("B")
|
|
||||||
|
|
||||||
await keybindButton.click()
|
|
||||||
await expect(keybindButton).toHaveText(/press/i)
|
|
||||||
|
|
||||||
await page.keyboard.press("Delete")
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const clearedKeybind = await keybindButton.textContent()
|
|
||||||
expect(clearedKeybind).toMatch(/unassigned|press/i)
|
|
||||||
|
|
||||||
const stored = await page.evaluate(() => {
|
|
||||||
const raw = localStorage.getItem("settings.v3")
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
})
|
|
||||||
expect(stored?.keybinds?.["sidebar.toggle"]).toBe("none")
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+B`)
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const stillOnSession = page.url().includes("/session")
|
|
||||||
expect(stillOnSession).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("changing settings open keybind works", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
await dialog.getByRole("tab", { name: "Shortcuts" }).click()
|
|
||||||
|
|
||||||
const keybindButton = dialog.locator(keybindButtonSelector("settings.open"))
|
|
||||||
await expect(keybindButton).toBeVisible()
|
|
||||||
|
|
||||||
const initialKeybind = await keybindButton.textContent()
|
|
||||||
expect(initialKeybind).toContain(",")
|
|
||||||
|
|
||||||
await keybindButton.click()
|
|
||||||
await expect(keybindButton).toHaveText(/press/i)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Slash`)
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const newKeybind = await keybindButton.textContent()
|
|
||||||
expect(newKeybind).toContain("/")
|
|
||||||
|
|
||||||
const stored = await page.evaluate(() => {
|
|
||||||
const raw = localStorage.getItem("settings.v3")
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
})
|
|
||||||
expect(stored?.keybinds?.["settings.open"]).toBe("mod+/")
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
|
|
||||||
const settingsDialog = page.getByRole("dialog")
|
|
||||||
await expect(settingsDialog).toHaveCount(0)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Slash`)
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
await expect(settingsDialog).toBeVisible()
|
|
||||||
|
|
||||||
await closeDialog(page, settingsDialog)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("changing new session keybind works", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withSession(sdk, "test session for keybind", async (session) => {
|
|
||||||
await gotoSession(session.id)
|
|
||||||
|
|
||||||
const initialUrl = page.url()
|
|
||||||
expect(initialUrl).toContain(`/session/${session.id}`)
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
await dialog.getByRole("tab", { name: "Shortcuts" }).click()
|
|
||||||
|
|
||||||
const keybindButton = dialog.locator(keybindButtonSelector("session.new"))
|
|
||||||
await expect(keybindButton).toBeVisible()
|
|
||||||
|
|
||||||
await keybindButton.click()
|
|
||||||
await expect(keybindButton).toHaveText(/press/i)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+KeyN`)
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const newKeybind = await keybindButton.textContent()
|
|
||||||
expect(newKeybind).toContain("N")
|
|
||||||
|
|
||||||
const stored = await page.evaluate(() => {
|
|
||||||
const raw = localStorage.getItem("settings.v3")
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
})
|
|
||||||
expect(stored?.keybinds?.["session.new"]).toBe("mod+shift+n")
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+N`)
|
|
||||||
await page.waitForTimeout(200)
|
|
||||||
|
|
||||||
const newUrl = page.url()
|
|
||||||
expect(newUrl).toMatch(/\/session\/?$/)
|
|
||||||
expect(newUrl).not.toContain(session.id)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("changing file open keybind works", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
await dialog.getByRole("tab", { name: "Shortcuts" }).click()
|
|
||||||
|
|
||||||
const keybindButton = dialog.locator(keybindButtonSelector("file.open"))
|
|
||||||
await expect(keybindButton).toBeVisible()
|
|
||||||
|
|
||||||
const initialKeybind = await keybindButton.textContent()
|
|
||||||
expect(initialKeybind).toContain("K")
|
|
||||||
|
|
||||||
await keybindButton.click()
|
|
||||||
await expect(keybindButton).toHaveText(/press/i)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+KeyF`)
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const newKeybind = await keybindButton.textContent()
|
|
||||||
expect(newKeybind).toContain("F")
|
|
||||||
|
|
||||||
const stored = await page.evaluate(() => {
|
|
||||||
const raw = localStorage.getItem("settings.v3")
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
})
|
|
||||||
expect(stored?.keybinds?.["file.open"]).toBe("mod+shift+f")
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
|
|
||||||
const filePickerDialog = page.getByRole("dialog").filter({ has: page.getByPlaceholder(/search files/i) })
|
|
||||||
await expect(filePickerDialog).toHaveCount(0)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+F`)
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
await expect(filePickerDialog).toBeVisible()
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(filePickerDialog).toHaveCount(0)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("changing terminal toggle keybind works", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
await dialog.getByRole("tab", { name: "Shortcuts" }).click()
|
|
||||||
|
|
||||||
const keybindButton = dialog.locator(keybindButtonSelector("terminal.toggle"))
|
|
||||||
await expect(keybindButton).toBeVisible()
|
|
||||||
|
|
||||||
await keybindButton.click()
|
|
||||||
await expect(keybindButton).toHaveText(/press/i)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+KeyY`)
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const newKeybind = await keybindButton.textContent()
|
|
||||||
expect(newKeybind).toContain("Y")
|
|
||||||
|
|
||||||
const stored = await page.evaluate(() => {
|
|
||||||
const raw = localStorage.getItem("settings.v3")
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
})
|
|
||||||
expect(stored?.keybinds?.["terminal.toggle"]).toBe("mod+y")
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
|
|
||||||
const terminal = page.locator(terminalSelector)
|
|
||||||
await expect(terminal).not.toBeVisible()
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Y`)
|
|
||||||
await waitTerminalFocusIdle(page, { term: terminal })
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Y`)
|
|
||||||
await expect(terminal).not.toBeVisible()
|
|
||||||
})
|
|
||||||
|
|
||||||
test("terminal toggle keybind persists after reload", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
await dialog.getByRole("tab", { name: "Shortcuts" }).click()
|
|
||||||
|
|
||||||
const keybindButton = dialog.locator(keybindButtonSelector("terminal.toggle"))
|
|
||||||
await expect(keybindButton).toBeVisible()
|
|
||||||
|
|
||||||
await keybindButton.click()
|
|
||||||
await expect(keybindButton).toHaveText(/press/i)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+KeyY`)
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
await expect(keybindButton).toContainText("Y")
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
|
|
||||||
await page.reload()
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate(() => {
|
|
||||||
const raw = localStorage.getItem("settings.v3")
|
|
||||||
if (!raw) return
|
|
||||||
const parsed = JSON.parse(raw)
|
|
||||||
return parsed?.keybinds?.["terminal.toggle"]
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.toBe("mod+shift+y")
|
|
||||||
|
|
||||||
const reloaded = await openSettings(page)
|
|
||||||
await reloaded.getByRole("tab", { name: "Shortcuts" }).click()
|
|
||||||
const reloadedKeybind = reloaded.locator(keybindButtonSelector("terminal.toggle")).first()
|
|
||||||
await expect(reloadedKeybind).toContainText("Y")
|
|
||||||
await closeDialog(page, reloaded)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("changing command palette keybind works", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
await dialog.getByRole("tab", { name: "Shortcuts" }).click()
|
|
||||||
|
|
||||||
const keybindButton = dialog.locator(keybindButtonSelector("command.palette"))
|
|
||||||
await expect(keybindButton).toBeVisible()
|
|
||||||
|
|
||||||
const initialKeybind = await keybindButton.textContent()
|
|
||||||
expect(initialKeybind).toContain("P")
|
|
||||||
|
|
||||||
await keybindButton.click()
|
|
||||||
await expect(keybindButton).toHaveText(/press/i)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+KeyK`)
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const newKeybind = await keybindButton.textContent()
|
|
||||||
expect(newKeybind).toContain("K")
|
|
||||||
|
|
||||||
const stored = await page.evaluate(() => {
|
|
||||||
const raw = localStorage.getItem("settings.v3")
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
})
|
|
||||||
expect(stored?.keybinds?.["command.palette"]).toBe("mod+shift+k")
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
|
|
||||||
const palette = page.getByRole("dialog").filter({ has: page.getByRole("textbox").first() })
|
|
||||||
await expect(palette).toHaveCount(0)
|
|
||||||
|
|
||||||
await page.keyboard.press(`${modKey}+Shift+K`)
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
await expect(palette).toBeVisible()
|
|
||||||
await expect(palette.getByRole("textbox").first()).toBeVisible()
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(palette).toHaveCount(0)
|
|
||||||
})
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
import { closeDialog, openSettings } from "../actions"
|
|
||||||
|
|
||||||
test("hiding a model removes it from the model picker", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/model")
|
|
||||||
|
|
||||||
const command = page.locator('[data-slash-id="model.choose"]')
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await command.hover()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const picker = page.getByRole("dialog")
|
|
||||||
await expect(picker).toBeVisible()
|
|
||||||
|
|
||||||
const target = picker.locator('[data-slot="list-item"]').first()
|
|
||||||
await expect(target).toBeVisible()
|
|
||||||
|
|
||||||
const key = await target.getAttribute("data-key")
|
|
||||||
if (!key) throw new Error("Failed to resolve model key from list item")
|
|
||||||
|
|
||||||
const name = (await target.locator("span").first().innerText()).trim()
|
|
||||||
if (!name) throw new Error("Failed to resolve model name from list item")
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(picker).toHaveCount(0)
|
|
||||||
|
|
||||||
const settings = await openSettings(page)
|
|
||||||
|
|
||||||
await settings.getByRole("tab", { name: "Models" }).click()
|
|
||||||
const search = settings.getByPlaceholder("Search models")
|
|
||||||
await expect(search).toBeVisible()
|
|
||||||
await search.fill(name)
|
|
||||||
|
|
||||||
const toggle = settings.locator('[data-component="switch"]').filter({ hasText: name }).first()
|
|
||||||
const input = toggle.locator('[data-slot="switch-input"]')
|
|
||||||
await expect(toggle).toBeVisible()
|
|
||||||
await expect(input).toHaveAttribute("aria-checked", "true")
|
|
||||||
await toggle.locator('[data-slot="switch-control"]').click()
|
|
||||||
await expect(input).toHaveAttribute("aria-checked", "false")
|
|
||||||
|
|
||||||
await closeDialog(page, settings)
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/model")
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await command.hover()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const pickerAgain = page.getByRole("dialog")
|
|
||||||
await expect(pickerAgain).toBeVisible()
|
|
||||||
await expect(pickerAgain.locator('[data-slot="list-item"]').first()).toBeVisible()
|
|
||||||
|
|
||||||
await expect(pickerAgain.locator(`[data-slot="list-item"][data-key="${key}"]`)).toHaveCount(0)
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(pickerAgain).toHaveCount(0)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("showing a hidden model restores it to the model picker", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/model")
|
|
||||||
|
|
||||||
const command = page.locator('[data-slash-id="model.choose"]')
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await command.hover()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const picker = page.getByRole("dialog")
|
|
||||||
await expect(picker).toBeVisible()
|
|
||||||
|
|
||||||
const target = picker.locator('[data-slot="list-item"]').first()
|
|
||||||
await expect(target).toBeVisible()
|
|
||||||
|
|
||||||
const key = await target.getAttribute("data-key")
|
|
||||||
if (!key) throw new Error("Failed to resolve model key from list item")
|
|
||||||
|
|
||||||
const name = (await target.locator("span").first().innerText()).trim()
|
|
||||||
if (!name) throw new Error("Failed to resolve model name from list item")
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(picker).toHaveCount(0)
|
|
||||||
|
|
||||||
const settings = await openSettings(page)
|
|
||||||
|
|
||||||
await settings.getByRole("tab", { name: "Models" }).click()
|
|
||||||
const search = settings.getByPlaceholder("Search models")
|
|
||||||
await expect(search).toBeVisible()
|
|
||||||
await search.fill(name)
|
|
||||||
|
|
||||||
const toggle = settings.locator('[data-component="switch"]').filter({ hasText: name }).first()
|
|
||||||
const input = toggle.locator('[data-slot="switch-input"]')
|
|
||||||
await expect(toggle).toBeVisible()
|
|
||||||
await expect(input).toHaveAttribute("aria-checked", "true")
|
|
||||||
|
|
||||||
await toggle.locator('[data-slot="switch-control"]').click()
|
|
||||||
await expect(input).toHaveAttribute("aria-checked", "false")
|
|
||||||
|
|
||||||
await toggle.locator('[data-slot="switch-control"]').click()
|
|
||||||
await expect(input).toHaveAttribute("aria-checked", "true")
|
|
||||||
|
|
||||||
await closeDialog(page, settings)
|
|
||||||
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.type("/model")
|
|
||||||
await expect(command).toBeVisible()
|
|
||||||
await command.hover()
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
|
|
||||||
const pickerAgain = page.getByRole("dialog")
|
|
||||||
await expect(pickerAgain).toBeVisible()
|
|
||||||
|
|
||||||
await expect(pickerAgain.locator(`[data-slot="list-item"][data-key="${key}"]`)).toBeVisible()
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(pickerAgain).toHaveCount(0)
|
|
||||||
})
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { closeDialog, openSettings } from "../actions"
|
|
||||||
|
|
||||||
test("custom provider form can be filled and validates input", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const settings = await openSettings(page)
|
|
||||||
await settings.getByRole("tab", { name: "Providers" }).click()
|
|
||||||
|
|
||||||
const customProviderSection = settings.locator('[data-component="custom-provider-section"]')
|
|
||||||
await expect(customProviderSection).toBeVisible()
|
|
||||||
|
|
||||||
const connectButton = customProviderSection.getByRole("button", { name: "Connect" })
|
|
||||||
await connectButton.click()
|
|
||||||
|
|
||||||
const providerDialog = page.getByRole("dialog").filter({ has: page.getByText("Custom provider") })
|
|
||||||
await expect(providerDialog).toBeVisible()
|
|
||||||
|
|
||||||
await providerDialog.getByLabel("Provider ID").fill("test-provider")
|
|
||||||
await providerDialog.getByLabel("Display name").fill("Test Provider")
|
|
||||||
await providerDialog.getByLabel("Base URL").fill("http://localhost:9999/fake")
|
|
||||||
await providerDialog.getByLabel("API key").fill("fake-key")
|
|
||||||
|
|
||||||
await providerDialog.getByPlaceholder("model-id").first().fill("test-model")
|
|
||||||
await providerDialog.getByPlaceholder("Display Name").first().fill("Test Model")
|
|
||||||
|
|
||||||
await expect(providerDialog.getByRole("textbox", { name: "Provider ID" })).toHaveValue("test-provider")
|
|
||||||
await expect(providerDialog.getByRole("textbox", { name: "Display name" })).toHaveValue("Test Provider")
|
|
||||||
await expect(providerDialog.getByRole("textbox", { name: "Base URL" })).toHaveValue("http://localhost:9999/fake")
|
|
||||||
await expect(providerDialog.getByRole("textbox", { name: "API key" })).toHaveValue("fake-key")
|
|
||||||
await expect(providerDialog.getByPlaceholder("model-id").first()).toHaveValue("test-model")
|
|
||||||
await expect(providerDialog.getByPlaceholder("Display Name").first()).toHaveValue("Test Model")
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(providerDialog).toHaveCount(0)
|
|
||||||
|
|
||||||
await closeDialog(page, settings)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("custom provider form shows validation errors", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const settings = await openSettings(page)
|
|
||||||
await settings.getByRole("tab", { name: "Providers" }).click()
|
|
||||||
|
|
||||||
const customProviderSection = settings.locator('[data-component="custom-provider-section"]')
|
|
||||||
await customProviderSection.getByRole("button", { name: "Connect" }).click()
|
|
||||||
|
|
||||||
const providerDialog = page.getByRole("dialog").filter({ has: page.getByText("Custom provider") })
|
|
||||||
await expect(providerDialog).toBeVisible()
|
|
||||||
|
|
||||||
await providerDialog.getByLabel("Provider ID").fill("invalid provider id")
|
|
||||||
await providerDialog.getByLabel("Base URL").fill("not-a-url")
|
|
||||||
|
|
||||||
await providerDialog.getByRole("button", { name: /submit|save/i }).click()
|
|
||||||
|
|
||||||
await expect(providerDialog.locator('[data-slot="input-error"]').filter({ hasText: /lowercase/i })).toBeVisible()
|
|
||||||
await expect(providerDialog.locator('[data-slot="input-error"]').filter({ hasText: /http/i })).toBeVisible()
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(providerDialog).toHaveCount(0)
|
|
||||||
|
|
||||||
await closeDialog(page, settings)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("custom provider form can add and remove models", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const settings = await openSettings(page)
|
|
||||||
await settings.getByRole("tab", { name: "Providers" }).click()
|
|
||||||
|
|
||||||
const customProviderSection = settings.locator('[data-component="custom-provider-section"]')
|
|
||||||
await customProviderSection.getByRole("button", { name: "Connect" }).click()
|
|
||||||
|
|
||||||
const providerDialog = page.getByRole("dialog").filter({ has: page.getByText("Custom provider") })
|
|
||||||
await expect(providerDialog).toBeVisible()
|
|
||||||
|
|
||||||
await providerDialog.getByLabel("Provider ID").fill("multi-model-test")
|
|
||||||
await providerDialog.getByLabel("Display name").fill("Multi Model Test")
|
|
||||||
await providerDialog.getByLabel("Base URL").fill("http://localhost:9999/multi")
|
|
||||||
|
|
||||||
await providerDialog.getByPlaceholder("model-id").first().fill("model-1")
|
|
||||||
await providerDialog.getByPlaceholder("Display Name").first().fill("Model 1")
|
|
||||||
|
|
||||||
const idInputsBefore = await providerDialog.getByPlaceholder("model-id").count()
|
|
||||||
await providerDialog.getByRole("button", { name: "Add model" }).click()
|
|
||||||
const idInputsAfter = await providerDialog.getByPlaceholder("model-id").count()
|
|
||||||
expect(idInputsAfter).toBe(idInputsBefore + 1)
|
|
||||||
|
|
||||||
await providerDialog.getByPlaceholder("model-id").nth(1).fill("model-2")
|
|
||||||
await providerDialog.getByPlaceholder("Display Name").nth(1).fill("Model 2")
|
|
||||||
|
|
||||||
await expect(providerDialog.getByPlaceholder("model-id").nth(1)).toHaveValue("model-2")
|
|
||||||
await expect(providerDialog.getByPlaceholder("Display Name").nth(1)).toHaveValue("Model 2")
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(providerDialog).toHaveCount(0)
|
|
||||||
|
|
||||||
await closeDialog(page, settings)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("custom provider form can add and remove headers", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const settings = await openSettings(page)
|
|
||||||
await settings.getByRole("tab", { name: "Providers" }).click()
|
|
||||||
|
|
||||||
const customProviderSection = settings.locator('[data-component="custom-provider-section"]')
|
|
||||||
await customProviderSection.getByRole("button", { name: "Connect" }).click()
|
|
||||||
|
|
||||||
const providerDialog = page.getByRole("dialog").filter({ has: page.getByText("Custom provider") })
|
|
||||||
await expect(providerDialog).toBeVisible()
|
|
||||||
|
|
||||||
await providerDialog.getByLabel("Provider ID").fill("header-test")
|
|
||||||
await providerDialog.getByLabel("Display name").fill("Header Test")
|
|
||||||
await providerDialog.getByLabel("Base URL").fill("http://localhost:9999/headers")
|
|
||||||
|
|
||||||
await providerDialog.getByPlaceholder("model-id").first().fill("model-x")
|
|
||||||
await providerDialog.getByPlaceholder("Display Name").first().fill("Model X")
|
|
||||||
|
|
||||||
const headerInputsBefore = await providerDialog.getByPlaceholder("Header-Name").count()
|
|
||||||
await providerDialog.getByRole("button", { name: "Add header" }).click()
|
|
||||||
const headerInputsAfter = await providerDialog.getByPlaceholder("Header-Name").count()
|
|
||||||
expect(headerInputsAfter).toBe(headerInputsBefore + 1)
|
|
||||||
|
|
||||||
await providerDialog.getByPlaceholder("Header-Name").first().fill("Authorization")
|
|
||||||
await providerDialog.getByPlaceholder("value").first().fill("Bearer token123")
|
|
||||||
|
|
||||||
await expect(providerDialog.getByPlaceholder("Header-Name").first()).toHaveValue("Authorization")
|
|
||||||
await expect(providerDialog.getByPlaceholder("value").first()).toHaveValue("Bearer token123")
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(providerDialog).toHaveCount(0)
|
|
||||||
|
|
||||||
await closeDialog(page, settings)
|
|
||||||
})
|
|
||||||
@@ -1,708 +0,0 @@
|
|||||||
import { test, expect, settingsKey } from "../fixtures"
|
|
||||||
import { closeDialog, openSettings } from "../actions"
|
|
||||||
import {
|
|
||||||
settingsColorSchemeSelector,
|
|
||||||
settingsCodeFontSelector,
|
|
||||||
settingsLanguageSelectSelector,
|
|
||||||
settingsNotificationsAgentSelector,
|
|
||||||
settingsNotificationsErrorsSelector,
|
|
||||||
settingsNotificationsPermissionsSelector,
|
|
||||||
settingsReleaseNotesSelector,
|
|
||||||
settingsSoundsAgentSelector,
|
|
||||||
settingsSoundsErrorsSelector,
|
|
||||||
settingsSoundsPermissionsSelector,
|
|
||||||
settingsThemeSelector,
|
|
||||||
settingsUIFontSelector,
|
|
||||||
settingsUpdatesStartupSelector,
|
|
||||||
} from "../selectors"
|
|
||||||
|
|
||||||
test("smoke settings dialog opens, switches tabs, closes", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
|
|
||||||
await dialog.getByRole("tab", { name: "Shortcuts" }).click()
|
|
||||||
await expect(dialog.getByRole("button", { name: "Reset to defaults" })).toBeVisible()
|
|
||||||
await expect(dialog.getByPlaceholder("Search shortcuts")).toBeVisible()
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("changing language updates settings labels", async ({ page, gotoSession }) => {
|
|
||||||
await page.addInitScript(() => {
|
|
||||||
localStorage.setItem("opencode.global.dat:language", JSON.stringify({ locale: "en" }))
|
|
||||||
})
|
|
||||||
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
|
|
||||||
const heading = dialog.getByRole("heading", { level: 2 })
|
|
||||||
await expect(heading).toHaveText("General")
|
|
||||||
|
|
||||||
const select = dialog.locator(settingsLanguageSelectSelector)
|
|
||||||
await expect(select).toBeVisible()
|
|
||||||
await select.locator('[data-slot="select-select-trigger"]').click()
|
|
||||||
|
|
||||||
await page.locator('[data-slot="select-select-item"]').filter({ hasText: "Deutsch" }).click()
|
|
||||||
|
|
||||||
await expect(heading).toHaveText("Allgemein")
|
|
||||||
|
|
||||||
await select.locator('[data-slot="select-select-trigger"]').click()
|
|
||||||
await page.locator('[data-slot="select-select-item"]').filter({ hasText: "English" }).click()
|
|
||||||
await expect(heading).toHaveText("General")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("changing color scheme persists in localStorage", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const select = dialog.locator(settingsColorSchemeSelector)
|
|
||||||
await expect(select).toBeVisible()
|
|
||||||
|
|
||||||
await select.locator('[data-slot="select-select-trigger"]').click()
|
|
||||||
await page.locator('[data-slot="select-select-item"]').filter({ hasText: "Dark" }).click()
|
|
||||||
|
|
||||||
const colorScheme = await page.evaluate(() => {
|
|
||||||
return document.documentElement.getAttribute("data-color-scheme")
|
|
||||||
})
|
|
||||||
expect(colorScheme).toBe("dark")
|
|
||||||
|
|
||||||
await select.locator('[data-slot="select-select-trigger"]').click()
|
|
||||||
await page.locator('[data-slot="select-select-item"]').filter({ hasText: "Light" }).click()
|
|
||||||
|
|
||||||
const lightColorScheme = await page.evaluate(() => {
|
|
||||||
return document.documentElement.getAttribute("data-color-scheme")
|
|
||||||
})
|
|
||||||
expect(lightColorScheme).toBe("light")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("changing theme persists in localStorage", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const select = dialog.locator(settingsThemeSelector)
|
|
||||||
await expect(select).toBeVisible()
|
|
||||||
|
|
||||||
const currentThemeId = await page.evaluate(() => {
|
|
||||||
return document.documentElement.getAttribute("data-theme")
|
|
||||||
})
|
|
||||||
const currentTheme = (await select.locator('[data-slot="select-select-trigger-value"]').textContent())?.trim() ?? ""
|
|
||||||
|
|
||||||
await select.locator('[data-slot="select-select-trigger"]').click()
|
|
||||||
|
|
||||||
const items = page.locator('[data-slot="select-select-item"]')
|
|
||||||
const count = await items.count()
|
|
||||||
expect(count).toBeGreaterThan(1)
|
|
||||||
|
|
||||||
const nextTheme = (await items.locator('[data-slot="select-select-item-label"]').allTextContents())
|
|
||||||
.map((x) => x.trim())
|
|
||||||
.find((x) => x && x !== currentTheme)
|
|
||||||
expect(nextTheme).toBeTruthy()
|
|
||||||
|
|
||||||
await items.filter({ hasText: nextTheme! }).first().click()
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
|
|
||||||
const storedThemeId = await page.evaluate(() => {
|
|
||||||
return localStorage.getItem("opencode-theme-id")
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(storedThemeId).not.toBeNull()
|
|
||||||
expect(storedThemeId).not.toBe(currentThemeId)
|
|
||||||
|
|
||||||
const dataTheme = await page.evaluate(() => {
|
|
||||||
return document.documentElement.getAttribute("data-theme")
|
|
||||||
})
|
|
||||||
expect(dataTheme).toBe(storedThemeId)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("legacy oc-1 theme migrates to oc-2", async ({ page, gotoSession }) => {
|
|
||||||
await page.addInitScript(() => {
|
|
||||||
localStorage.setItem("opencode-theme-id", "oc-1")
|
|
||||||
localStorage.setItem("opencode-theme-css-light", "--background-base:#fff;")
|
|
||||||
localStorage.setItem("opencode-theme-css-dark", "--background-base:#000;")
|
|
||||||
})
|
|
||||||
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await expect(page.locator("html")).toHaveAttribute("data-theme", "oc-2")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate(() => {
|
|
||||||
return localStorage.getItem("opencode-theme-id")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.toBe("oc-2")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate(() => {
|
|
||||||
return localStorage.getItem("opencode-theme-css-light")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.toBeNull()
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate(() => {
|
|
||||||
return localStorage.getItem("opencode-theme-css-dark")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.toBeNull()
|
|
||||||
})
|
|
||||||
|
|
||||||
test("typing a code font with spaces persists and updates CSS variable", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const input = dialog.locator(settingsCodeFontSelector)
|
|
||||||
await expect(input).toBeVisible()
|
|
||||||
await expect(input).toHaveAttribute("placeholder", "System Mono")
|
|
||||||
|
|
||||||
const initialFontFamily = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-mono").trim(),
|
|
||||||
)
|
|
||||||
const initialUIFamily = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-sans").trim(),
|
|
||||||
)
|
|
||||||
expect(initialFontFamily).toContain("ui-monospace")
|
|
||||||
|
|
||||||
const next = "Test Mono"
|
|
||||||
|
|
||||||
await input.click()
|
|
||||||
await input.clear()
|
|
||||||
await input.pressSequentially(next)
|
|
||||||
await expect(input).toHaveValue(next)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
})
|
|
||||||
.toMatchObject({
|
|
||||||
appearance: {
|
|
||||||
mono: next,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const newFontFamily = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-mono").trim(),
|
|
||||||
)
|
|
||||||
const newUIFamily = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-sans").trim(),
|
|
||||||
)
|
|
||||||
expect(newFontFamily).toContain(next)
|
|
||||||
expect(newFontFamily).not.toBe(initialFontFamily)
|
|
||||||
expect(newUIFamily).toBe(initialUIFamily)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("typing a UI font with spaces persists and updates CSS variable", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const input = dialog.locator(settingsUIFontSelector)
|
|
||||||
await expect(input).toBeVisible()
|
|
||||||
await expect(input).toHaveAttribute("placeholder", "System Sans")
|
|
||||||
|
|
||||||
const initialFontFamily = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-sans").trim(),
|
|
||||||
)
|
|
||||||
const initialCodeFamily = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-mono").trim(),
|
|
||||||
)
|
|
||||||
expect(initialFontFamily).toContain("ui-sans-serif")
|
|
||||||
|
|
||||||
const next = "Test Sans"
|
|
||||||
|
|
||||||
await input.click()
|
|
||||||
await input.clear()
|
|
||||||
await input.pressSequentially(next)
|
|
||||||
await expect(input).toHaveValue(next)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
})
|
|
||||||
.toMatchObject({
|
|
||||||
appearance: {
|
|
||||||
sans: next,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const newFontFamily = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-sans").trim(),
|
|
||||||
)
|
|
||||||
const newCodeFamily = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-mono").trim(),
|
|
||||||
)
|
|
||||||
expect(newFontFamily).toContain(next)
|
|
||||||
expect(newFontFamily).not.toBe(initialFontFamily)
|
|
||||||
expect(newCodeFamily).toBe(initialCodeFamily)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("clearing the code font field restores the default placeholder and stack", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const input = dialog.locator(settingsCodeFontSelector)
|
|
||||||
await expect(input).toBeVisible()
|
|
||||||
|
|
||||||
await input.click()
|
|
||||||
await input.clear()
|
|
||||||
await input.pressSequentially("Reset Mono")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
})
|
|
||||||
.toMatchObject({
|
|
||||||
appearance: {
|
|
||||||
mono: "Reset Mono",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
await input.clear()
|
|
||||||
await input.press("Space")
|
|
||||||
await expect(input).toHaveValue("")
|
|
||||||
await expect(input).toHaveAttribute("placeholder", "System Mono")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
})
|
|
||||||
.toMatchObject({
|
|
||||||
appearance: {
|
|
||||||
mono: "",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const fontFamily = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-mono").trim(),
|
|
||||||
)
|
|
||||||
expect(fontFamily).toContain("ui-monospace")
|
|
||||||
expect(fontFamily).not.toContain("Reset Mono")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("clearing the UI font field restores the default placeholder and stack", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const input = dialog.locator(settingsUIFontSelector)
|
|
||||||
await expect(input).toBeVisible()
|
|
||||||
|
|
||||||
await input.click()
|
|
||||||
await input.clear()
|
|
||||||
await input.pressSequentially("Reset Sans")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
})
|
|
||||||
.toMatchObject({
|
|
||||||
appearance: {
|
|
||||||
sans: "Reset Sans",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
await input.clear()
|
|
||||||
await input.press("Space")
|
|
||||||
await expect(input).toHaveValue("")
|
|
||||||
await expect(input).toHaveAttribute("placeholder", "System Sans")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
})
|
|
||||||
.toMatchObject({
|
|
||||||
appearance: {
|
|
||||||
sans: "",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const fontFamily = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-sans").trim(),
|
|
||||||
)
|
|
||||||
expect(fontFamily).toContain("ui-sans-serif")
|
|
||||||
expect(fontFamily).not.toContain("Reset Sans")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("color scheme, code font, and UI font rehydrate after reload", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
|
|
||||||
const colorSchemeSelect = dialog.locator(settingsColorSchemeSelector)
|
|
||||||
await expect(colorSchemeSelect).toBeVisible()
|
|
||||||
await colorSchemeSelect.locator('[data-slot="select-select-trigger"]').click()
|
|
||||||
await page.locator('[data-slot="select-select-item"]').filter({ hasText: "Dark" }).click()
|
|
||||||
await expect(page.locator("html")).toHaveAttribute("data-color-scheme", "dark")
|
|
||||||
|
|
||||||
const code = dialog.locator(settingsCodeFontSelector)
|
|
||||||
const ui = dialog.locator(settingsUIFontSelector)
|
|
||||||
await expect(code).toBeVisible()
|
|
||||||
await expect(ui).toBeVisible()
|
|
||||||
|
|
||||||
const initialMono = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-mono").trim(),
|
|
||||||
)
|
|
||||||
const initialSans = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-sans").trim(),
|
|
||||||
)
|
|
||||||
|
|
||||||
const initialSettings = await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
|
|
||||||
const mono = initialSettings?.appearance?.mono === "Reload Mono" ? "Reload Mono 2" : "Reload Mono"
|
|
||||||
const sans = initialSettings?.appearance?.sans === "Reload Sans" ? "Reload Sans 2" : "Reload Sans"
|
|
||||||
|
|
||||||
await code.click()
|
|
||||||
await code.clear()
|
|
||||||
await code.pressSequentially(mono)
|
|
||||||
await expect(code).toHaveValue(mono)
|
|
||||||
|
|
||||||
await ui.click()
|
|
||||||
await ui.clear()
|
|
||||||
await ui.pressSequentially(sans)
|
|
||||||
await expect(ui).toHaveValue(sans)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
})
|
|
||||||
.toMatchObject({
|
|
||||||
appearance: {
|
|
||||||
mono,
|
|
||||||
sans,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const updatedSettings = await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
|
|
||||||
const updatedMono = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-mono").trim(),
|
|
||||||
)
|
|
||||||
const updatedSans = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-sans").trim(),
|
|
||||||
)
|
|
||||||
expect(updatedMono).toContain(mono)
|
|
||||||
expect(updatedMono).not.toBe(initialMono)
|
|
||||||
expect(updatedSans).toContain(sans)
|
|
||||||
expect(updatedSans).not.toBe(initialSans)
|
|
||||||
expect(updatedSettings?.appearance?.mono).toBe(mono)
|
|
||||||
expect(updatedSettings?.appearance?.sans).toBe(sans)
|
|
||||||
|
|
||||||
await closeDialog(page, dialog)
|
|
||||||
await page.reload()
|
|
||||||
|
|
||||||
await expect(page.locator("html")).toHaveAttribute("data-color-scheme", "dark")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
})
|
|
||||||
.toMatchObject({
|
|
||||||
appearance: {
|
|
||||||
mono,
|
|
||||||
sans,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const rehydratedSettings = await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-mono").trim(),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.toContain(mono)
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-sans").trim(),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.toContain(sans)
|
|
||||||
|
|
||||||
const rehydratedMono = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-mono").trim(),
|
|
||||||
)
|
|
||||||
const rehydratedSans = await page.evaluate(() =>
|
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-family-sans").trim(),
|
|
||||||
)
|
|
||||||
expect(rehydratedMono).toContain(mono)
|
|
||||||
expect(rehydratedMono).not.toBe(initialMono)
|
|
||||||
expect(rehydratedSans).toContain(sans)
|
|
||||||
expect(rehydratedSans).not.toBe(initialSans)
|
|
||||||
expect(rehydratedSettings?.appearance?.mono).toBe(mono)
|
|
||||||
expect(rehydratedSettings?.appearance?.sans).toBe(sans)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("toggling notification agent switch updates localStorage", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const switchContainer = dialog.locator(settingsNotificationsAgentSelector)
|
|
||||||
await expect(switchContainer).toBeVisible()
|
|
||||||
|
|
||||||
const toggleInput = switchContainer.locator('[data-slot="switch-input"]')
|
|
||||||
const initialState = await toggleInput.evaluate((el: HTMLInputElement) => el.checked)
|
|
||||||
expect(initialState).toBe(true)
|
|
||||||
|
|
||||||
await switchContainer.locator('[data-slot="switch-control"]').click()
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const newState = await toggleInput.evaluate((el: HTMLInputElement) => el.checked)
|
|
||||||
expect(newState).toBe(false)
|
|
||||||
|
|
||||||
const stored = await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
|
|
||||||
expect(stored?.notifications?.agent).toBe(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("toggling notification permissions switch updates localStorage", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const switchContainer = dialog.locator(settingsNotificationsPermissionsSelector)
|
|
||||||
await expect(switchContainer).toBeVisible()
|
|
||||||
|
|
||||||
const toggleInput = switchContainer.locator('[data-slot="switch-input"]')
|
|
||||||
const initialState = await toggleInput.evaluate((el: HTMLInputElement) => el.checked)
|
|
||||||
expect(initialState).toBe(true)
|
|
||||||
|
|
||||||
await switchContainer.locator('[data-slot="switch-control"]').click()
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const newState = await toggleInput.evaluate((el: HTMLInputElement) => el.checked)
|
|
||||||
expect(newState).toBe(false)
|
|
||||||
|
|
||||||
const stored = await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
|
|
||||||
expect(stored?.notifications?.permissions).toBe(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("toggling notification errors switch updates localStorage", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const switchContainer = dialog.locator(settingsNotificationsErrorsSelector)
|
|
||||||
await expect(switchContainer).toBeVisible()
|
|
||||||
|
|
||||||
const toggleInput = switchContainer.locator('[data-slot="switch-input"]')
|
|
||||||
const initialState = await toggleInput.evaluate((el: HTMLInputElement) => el.checked)
|
|
||||||
expect(initialState).toBe(false)
|
|
||||||
|
|
||||||
await switchContainer.locator('[data-slot="switch-control"]').click()
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const newState = await toggleInput.evaluate((el: HTMLInputElement) => el.checked)
|
|
||||||
expect(newState).toBe(true)
|
|
||||||
|
|
||||||
const stored = await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
|
|
||||||
expect(stored?.notifications?.errors).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("changing sound agent selection persists in localStorage", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const select = dialog.locator(settingsSoundsAgentSelector)
|
|
||||||
await expect(select).toBeVisible()
|
|
||||||
|
|
||||||
await select.locator('[data-slot="select-select-trigger"]').click()
|
|
||||||
|
|
||||||
const items = page.locator('[data-slot="select-select-item"]')
|
|
||||||
await items.nth(2).click()
|
|
||||||
|
|
||||||
const stored = await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
|
|
||||||
expect(stored?.sounds?.agent).not.toBe("staplebops-01")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("selecting none disables agent sound", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const select = dialog.locator(settingsSoundsAgentSelector)
|
|
||||||
const trigger = select.locator('[data-slot="select-select-trigger"]')
|
|
||||||
await expect(select).toBeVisible()
|
|
||||||
await expect(trigger).toBeEnabled()
|
|
||||||
|
|
||||||
await trigger.click()
|
|
||||||
const items = page.locator('[data-slot="select-select-item"]')
|
|
||||||
await expect(items.first()).toBeVisible()
|
|
||||||
await items.first().click()
|
|
||||||
|
|
||||||
const stored = await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
|
|
||||||
expect(stored?.sounds?.agentEnabled).toBe(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("changing permissions and errors sounds updates localStorage", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const permissionsSelect = dialog.locator(settingsSoundsPermissionsSelector)
|
|
||||||
const errorsSelect = dialog.locator(settingsSoundsErrorsSelector)
|
|
||||||
await expect(permissionsSelect).toBeVisible()
|
|
||||||
await expect(errorsSelect).toBeVisible()
|
|
||||||
|
|
||||||
const initial = await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
|
|
||||||
const permissionsCurrent =
|
|
||||||
(await permissionsSelect.locator('[data-slot="select-select-trigger-value"]').textContent())?.trim() ?? ""
|
|
||||||
await permissionsSelect.locator('[data-slot="select-select-trigger"]').click()
|
|
||||||
const permissionItems = page.locator('[data-slot="select-select-item"]')
|
|
||||||
expect(await permissionItems.count()).toBeGreaterThan(1)
|
|
||||||
if (permissionsCurrent) {
|
|
||||||
await permissionItems.filter({ hasNotText: permissionsCurrent }).first().click()
|
|
||||||
}
|
|
||||||
if (!permissionsCurrent) {
|
|
||||||
await permissionItems.nth(1).click()
|
|
||||||
}
|
|
||||||
|
|
||||||
const errorsCurrent =
|
|
||||||
(await errorsSelect.locator('[data-slot="select-select-trigger-value"]').textContent())?.trim() ?? ""
|
|
||||||
await errorsSelect.locator('[data-slot="select-select-trigger"]').click()
|
|
||||||
const errorItems = page.locator('[data-slot="select-select-item"]')
|
|
||||||
expect(await errorItems.count()).toBeGreaterThan(1)
|
|
||||||
if (errorsCurrent) {
|
|
||||||
await errorItems.filter({ hasNotText: errorsCurrent }).first().click()
|
|
||||||
}
|
|
||||||
if (!errorsCurrent) {
|
|
||||||
await errorItems.nth(1).click()
|
|
||||||
}
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(async () => {
|
|
||||||
return await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
})
|
|
||||||
.toMatchObject({
|
|
||||||
sounds: {
|
|
||||||
permissions: expect.any(String),
|
|
||||||
errors: expect.any(String),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const stored = await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
|
|
||||||
expect(stored?.sounds?.permissions).not.toBe(initial?.sounds?.permissions)
|
|
||||||
expect(stored?.sounds?.errors).not.toBe(initial?.sounds?.errors)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("toggling updates startup switch updates localStorage", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const switchContainer = dialog.locator(settingsUpdatesStartupSelector)
|
|
||||||
await expect(switchContainer).toBeVisible()
|
|
||||||
|
|
||||||
const toggleInput = switchContainer.locator('[data-slot="switch-input"]')
|
|
||||||
|
|
||||||
const isDisabled = await toggleInput.evaluate((el: HTMLInputElement) => el.disabled)
|
|
||||||
if (isDisabled) {
|
|
||||||
test.skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const initialState = await toggleInput.evaluate((el: HTMLInputElement) => el.checked)
|
|
||||||
expect(initialState).toBe(true)
|
|
||||||
|
|
||||||
await switchContainer.locator('[data-slot="switch-control"]').click()
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const newState = await toggleInput.evaluate((el: HTMLInputElement) => el.checked)
|
|
||||||
expect(newState).toBe(false)
|
|
||||||
|
|
||||||
const stored = await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
|
|
||||||
expect(stored?.updates?.startup).toBe(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("toggling release notes switch updates localStorage", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const dialog = await openSettings(page)
|
|
||||||
const switchContainer = dialog.locator(settingsReleaseNotesSelector)
|
|
||||||
await expect(switchContainer).toBeVisible()
|
|
||||||
|
|
||||||
const toggleInput = switchContainer.locator('[data-slot="switch-input"]')
|
|
||||||
const initialState = await toggleInput.evaluate((el: HTMLInputElement) => el.checked)
|
|
||||||
expect(initialState).toBe(true)
|
|
||||||
|
|
||||||
await switchContainer.locator('[data-slot="switch-control"]').click()
|
|
||||||
await page.waitForTimeout(100)
|
|
||||||
|
|
||||||
const newState = await toggleInput.evaluate((el: HTMLInputElement) => el.checked)
|
|
||||||
expect(newState).toBe(false)
|
|
||||||
|
|
||||||
const stored = await page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
return raw ? JSON.parse(raw) : null
|
|
||||||
}, settingsKey)
|
|
||||||
|
|
||||||
expect(stored?.general?.releaseNotes).toBe(false)
|
|
||||||
})
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import {
|
|
||||||
defocus,
|
|
||||||
cleanupSession,
|
|
||||||
cleanupTestProject,
|
|
||||||
closeSidebar,
|
|
||||||
createTestProject,
|
|
||||||
hoverSessionItem,
|
|
||||||
openSidebar,
|
|
||||||
waitSession,
|
|
||||||
} from "../actions"
|
|
||||||
import { projectSwitchSelector } from "../selectors"
|
|
||||||
import { dirSlug } from "../utils"
|
|
||||||
|
|
||||||
test("collapsed sidebar popover stays open when archiving a session", async ({ page, slug, sdk, gotoSession }) => {
|
|
||||||
const stamp = Date.now()
|
|
||||||
|
|
||||||
const one = await sdk.session.create({ title: `e2e sidebar popover archive 1 ${stamp}` }).then((r) => r.data)
|
|
||||||
const two = await sdk.session.create({ title: `e2e sidebar popover archive 2 ${stamp}` }).then((r) => r.data)
|
|
||||||
|
|
||||||
if (!one?.id) throw new Error("Session create did not return an id")
|
|
||||||
if (!two?.id) throw new Error("Session create did not return an id")
|
|
||||||
|
|
||||||
try {
|
|
||||||
await gotoSession(one.id)
|
|
||||||
await closeSidebar(page)
|
|
||||||
|
|
||||||
const oneItem = page.locator(`[data-session-id="${one.id}"]`).last()
|
|
||||||
const twoItem = page.locator(`[data-session-id="${two.id}"]`).last()
|
|
||||||
|
|
||||||
const project = page.locator(projectSwitchSelector(slug)).first()
|
|
||||||
await expect(project).toBeVisible()
|
|
||||||
await project.hover()
|
|
||||||
|
|
||||||
await expect(oneItem).toBeVisible()
|
|
||||||
await expect(twoItem).toBeVisible()
|
|
||||||
|
|
||||||
const item = await hoverSessionItem(page, one.id)
|
|
||||||
await item
|
|
||||||
.getByRole("button", { name: /archive/i })
|
|
||||||
.first()
|
|
||||||
.click()
|
|
||||||
|
|
||||||
await expect(twoItem).toBeVisible()
|
|
||||||
} finally {
|
|
||||||
await cleanupSession({ sdk, sessionID: one.id })
|
|
||||||
await cleanupSession({ sdk, sessionID: two.id })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
test("open sidebar project popover stays closed after clicking avatar", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
const other = await createTestProject()
|
|
||||||
const slug = dirSlug(other)
|
|
||||||
|
|
||||||
try {
|
|
||||||
await withProject(
|
|
||||||
async () => {
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
const project = page.locator(projectSwitchSelector(slug)).first()
|
|
||||||
const card = page.locator('[data-component="hover-card-content"]')
|
|
||||||
|
|
||||||
await expect(project).toBeVisible()
|
|
||||||
await project.hover()
|
|
||||||
await expect(card.getByText(/recent sessions/i)).toBeVisible()
|
|
||||||
|
|
||||||
await page.mouse.down()
|
|
||||||
await expect(card).toHaveCount(0)
|
|
||||||
await page.mouse.up()
|
|
||||||
|
|
||||||
await waitSession(page, { directory: other })
|
|
||||||
await expect(card).toHaveCount(0)
|
|
||||||
},
|
|
||||||
{ extra: [other] },
|
|
||||||
)
|
|
||||||
} finally {
|
|
||||||
await cleanupTestProject(other)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
test("open sidebar project switch activates on first tabbed enter", async ({ page, withProject }) => {
|
|
||||||
await page.setViewportSize({ width: 1400, height: 800 })
|
|
||||||
|
|
||||||
const other = await createTestProject()
|
|
||||||
const slug = dirSlug(other)
|
|
||||||
|
|
||||||
try {
|
|
||||||
await withProject(
|
|
||||||
async () => {
|
|
||||||
await openSidebar(page)
|
|
||||||
await defocus(page)
|
|
||||||
|
|
||||||
const project = page.locator(projectSwitchSelector(slug)).first()
|
|
||||||
|
|
||||||
await expect(project).toBeVisible()
|
|
||||||
|
|
||||||
let hit = false
|
|
||||||
for (let i = 0; i < 20; i++) {
|
|
||||||
hit = await project.evaluate((el) => {
|
|
||||||
return el.matches(":focus") || !!el.parentElement?.matches(":focus")
|
|
||||||
})
|
|
||||||
if (hit) break
|
|
||||||
await page.keyboard.press("Tab")
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(hit).toBe(true)
|
|
||||||
|
|
||||||
await page.keyboard.press("Enter")
|
|
||||||
await waitSession(page, { directory: other })
|
|
||||||
},
|
|
||||||
{ extra: [other] },
|
|
||||||
)
|
|
||||||
} finally {
|
|
||||||
await cleanupTestProject(other)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { cleanupSession, openSidebar, withSession } from "../actions"
|
|
||||||
import { promptSelector } from "../selectors"
|
|
||||||
|
|
||||||
test("sidebar session links navigate to the selected session", async ({ page, slug, sdk, gotoSession }) => {
|
|
||||||
const stamp = Date.now()
|
|
||||||
|
|
||||||
const one = await sdk.session.create({ title: `e2e sidebar nav 1 ${stamp}` }).then((r) => r.data)
|
|
||||||
const two = await sdk.session.create({ title: `e2e sidebar nav 2 ${stamp}` }).then((r) => r.data)
|
|
||||||
|
|
||||||
if (!one?.id) throw new Error("Session create did not return an id")
|
|
||||||
if (!two?.id) throw new Error("Session create did not return an id")
|
|
||||||
|
|
||||||
try {
|
|
||||||
await gotoSession(one.id)
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
|
|
||||||
const target = page.locator(`[data-session-id="${two.id}"] a`).first()
|
|
||||||
await expect(target).toBeVisible()
|
|
||||||
await target.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/${slug}/session/${two.id}(?:\\?|#|$)`))
|
|
||||||
await expect(page.locator(promptSelector)).toBeVisible()
|
|
||||||
await expect(page.locator(`[data-session-id="${two.id}"] a`).first()).toHaveClass(/\bactive\b/)
|
|
||||||
} finally {
|
|
||||||
await cleanupSession({ sdk, sessionID: one.id })
|
|
||||||
await cleanupSession({ sdk, sessionID: two.id })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { openSidebar, toggleSidebar, withSession } from "../actions"
|
|
||||||
|
|
||||||
test("sidebar can be collapsed and expanded", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
const button = page.getByRole("button", { name: /toggle sidebar/i }).first()
|
|
||||||
await expect(button).toHaveAttribute("aria-expanded", "true")
|
|
||||||
|
|
||||||
await toggleSidebar(page)
|
|
||||||
await expect(button).toHaveAttribute("aria-expanded", "false")
|
|
||||||
|
|
||||||
await toggleSidebar(page)
|
|
||||||
await expect(button).toHaveAttribute("aria-expanded", "true")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("sidebar collapsed state persists across navigation and reload", async ({ page, sdk, gotoSession }) => {
|
|
||||||
await withSession(sdk, "sidebar persist session 1", async (session1) => {
|
|
||||||
await withSession(sdk, "sidebar persist session 2", async (session2) => {
|
|
||||||
await gotoSession(session1.id)
|
|
||||||
|
|
||||||
await openSidebar(page)
|
|
||||||
const button = page.getByRole("button", { name: /toggle sidebar/i }).first()
|
|
||||||
await toggleSidebar(page)
|
|
||||||
await expect(button).toHaveAttribute("aria-expanded", "false")
|
|
||||||
|
|
||||||
await gotoSession(session2.id)
|
|
||||||
await expect(button).toHaveAttribute("aria-expanded", "false")
|
|
||||||
|
|
||||||
await page.reload()
|
|
||||||
await expect(button).toHaveAttribute("aria-expanded", "false")
|
|
||||||
|
|
||||||
const opened = await page.evaluate(
|
|
||||||
() => JSON.parse(localStorage.getItem("opencode.global.dat:layout") ?? "{}").sidebar?.opened,
|
|
||||||
)
|
|
||||||
await expect(opened).toBe(false)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { openStatusPopover } from "../actions"
|
|
||||||
|
|
||||||
test("status popover opens and shows tabs", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const { popoverBody } = await openStatusPopover(page)
|
|
||||||
|
|
||||||
await expect(popoverBody.getByRole("tab", { name: /servers/i })).toBeVisible()
|
|
||||||
await expect(popoverBody.getByRole("tab", { name: /mcp/i })).toBeVisible()
|
|
||||||
await expect(popoverBody.getByRole("tab", { name: /lsp/i })).toBeVisible()
|
|
||||||
await expect(popoverBody.getByRole("tab", { name: /plugins/i })).toBeVisible()
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(popoverBody).toHaveCount(0)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("status popover servers tab shows current server", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const { popoverBody } = await openStatusPopover(page)
|
|
||||||
|
|
||||||
const serversTab = popoverBody.getByRole("tab", { name: /servers/i })
|
|
||||||
await expect(serversTab).toHaveAttribute("aria-selected", "true")
|
|
||||||
|
|
||||||
const serverList = popoverBody.locator('[role="tabpanel"]').first()
|
|
||||||
await expect(serverList.locator("button").first()).toBeVisible()
|
|
||||||
})
|
|
||||||
|
|
||||||
test("status popover can switch to mcp tab", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const { popoverBody } = await openStatusPopover(page)
|
|
||||||
|
|
||||||
const mcpTab = popoverBody.getByRole("tab", { name: /mcp/i })
|
|
||||||
await mcpTab.click()
|
|
||||||
|
|
||||||
const ariaSelected = await mcpTab.getAttribute("aria-selected")
|
|
||||||
expect(ariaSelected).toBe("true")
|
|
||||||
|
|
||||||
const mcpContent = popoverBody.locator('[role="tabpanel"]:visible').first()
|
|
||||||
await expect(mcpContent).toBeVisible()
|
|
||||||
})
|
|
||||||
|
|
||||||
test("status popover can switch to lsp tab", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const { popoverBody } = await openStatusPopover(page)
|
|
||||||
|
|
||||||
const lspTab = popoverBody.getByRole("tab", { name: /lsp/i })
|
|
||||||
await lspTab.click()
|
|
||||||
|
|
||||||
const ariaSelected = await lspTab.getAttribute("aria-selected")
|
|
||||||
expect(ariaSelected).toBe("true")
|
|
||||||
|
|
||||||
const lspContent = popoverBody.locator('[role="tabpanel"]:visible').first()
|
|
||||||
await expect(lspContent).toBeVisible()
|
|
||||||
})
|
|
||||||
|
|
||||||
test("status popover can switch to plugins tab", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const { popoverBody } = await openStatusPopover(page)
|
|
||||||
|
|
||||||
const pluginsTab = popoverBody.getByRole("tab", { name: /plugins/i })
|
|
||||||
await pluginsTab.click()
|
|
||||||
|
|
||||||
const ariaSelected = await pluginsTab.getAttribute("aria-selected")
|
|
||||||
expect(ariaSelected).toBe("true")
|
|
||||||
|
|
||||||
const pluginsContent = popoverBody.locator('[role="tabpanel"]:visible').first()
|
|
||||||
await expect(pluginsContent).toBeVisible()
|
|
||||||
})
|
|
||||||
|
|
||||||
test("status popover closes on escape", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const { popoverBody } = await openStatusPopover(page)
|
|
||||||
await expect(popoverBody).toBeVisible()
|
|
||||||
|
|
||||||
await page.keyboard.press("Escape")
|
|
||||||
await expect(popoverBody).toHaveCount(0)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("status popover closes when clicking outside", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const { popoverBody } = await openStatusPopover(page)
|
|
||||||
await expect(popoverBody).toBeVisible()
|
|
||||||
|
|
||||||
await page.getByRole("main").click({ position: { x: 5, y: 5 } })
|
|
||||||
|
|
||||||
await expect(popoverBody).toHaveCount(0)
|
|
||||||
})
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { waitTerminalFocusIdle, waitTerminalReady } from "../actions"
|
|
||||||
import { promptSelector, terminalSelector } from "../selectors"
|
|
||||||
import { terminalToggleKey } from "../utils"
|
|
||||||
|
|
||||||
test("smoke terminal mounts and can create a second tab", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const terminals = page.locator(terminalSelector)
|
|
||||||
const tabs = page.locator('#terminal-panel [data-slot="tabs-trigger"]')
|
|
||||||
const opened = await terminals.first().isVisible()
|
|
||||||
|
|
||||||
if (!opened) {
|
|
||||||
await page.keyboard.press(terminalToggleKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
await waitTerminalFocusIdle(page, { term: terminals.first() })
|
|
||||||
await expect(terminals).toHaveCount(1)
|
|
||||||
|
|
||||||
// Ghostty captures a lot of keybinds when focused; move focus back
|
|
||||||
// to the app shell before triggering `terminal.new`.
|
|
||||||
await page.locator(promptSelector).click()
|
|
||||||
await page.keyboard.press("Control+Alt+T")
|
|
||||||
|
|
||||||
await expect(tabs).toHaveCount(2)
|
|
||||||
await expect(terminals).toHaveCount(1)
|
|
||||||
await waitTerminalReady(page, { term: terminals.first() })
|
|
||||||
})
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
import type { Page } from "@playwright/test"
|
|
||||||
import { disconnectTerminal, runTerminal, terminalConnects, waitTerminalReady } from "../actions"
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { terminalSelector } from "../selectors"
|
|
||||||
import { terminalToggleKey } from "../utils"
|
|
||||||
|
|
||||||
async function open(page: Page) {
|
|
||||||
const term = page.locator(terminalSelector).first()
|
|
||||||
const visible = await term.isVisible().catch(() => false)
|
|
||||||
if (!visible) await page.keyboard.press(terminalToggleKey)
|
|
||||||
await waitTerminalReady(page, { term })
|
|
||||||
return term
|
|
||||||
}
|
|
||||||
|
|
||||||
test("terminal reconnects without replacing the pty", async ({ page, withProject }) => {
|
|
||||||
await withProject(async ({ gotoSession }) => {
|
|
||||||
const name = `OPENCODE_E2E_RECONNECT_${Date.now()}`
|
|
||||||
const token = `E2E_RECONNECT_${Date.now()}`
|
|
||||||
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const term = await open(page)
|
|
||||||
const id = await term.getAttribute("data-pty-id")
|
|
||||||
if (!id) throw new Error("Active terminal missing data-pty-id")
|
|
||||||
|
|
||||||
const prev = await terminalConnects(page, { term })
|
|
||||||
|
|
||||||
await runTerminal(page, {
|
|
||||||
term,
|
|
||||||
cmd: `export ${name}=${token}; echo ${token}`,
|
|
||||||
token,
|
|
||||||
})
|
|
||||||
|
|
||||||
await disconnectTerminal(page, { term })
|
|
||||||
|
|
||||||
await expect.poll(() => terminalConnects(page, { term }), { timeout: 15_000 }).toBeGreaterThan(prev)
|
|
||||||
await expect.poll(() => term.getAttribute("data-pty-id"), { timeout: 5_000 }).toBe(id)
|
|
||||||
|
|
||||||
await runTerminal(page, {
|
|
||||||
term,
|
|
||||||
cmd: `echo $${name}`,
|
|
||||||
token,
|
|
||||||
timeout: 15_000,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,168 +0,0 @@
|
|||||||
import type { Page } from "@playwright/test"
|
|
||||||
import { runTerminal, waitTerminalReady } from "../actions"
|
|
||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { dropdownMenuContentSelector, terminalSelector } from "../selectors"
|
|
||||||
import { terminalToggleKey, workspacePersistKey } from "../utils"
|
|
||||||
|
|
||||||
type State = {
|
|
||||||
active?: string
|
|
||||||
all: Array<{
|
|
||||||
id: string
|
|
||||||
title: string
|
|
||||||
titleNumber: number
|
|
||||||
buffer?: string
|
|
||||||
}>
|
|
||||||
}
|
|
||||||
|
|
||||||
async function open(page: Page) {
|
|
||||||
const terminal = page.locator(terminalSelector)
|
|
||||||
const visible = await terminal.isVisible().catch(() => false)
|
|
||||||
if (!visible) await page.keyboard.press(terminalToggleKey)
|
|
||||||
await waitTerminalReady(page, { term: terminal })
|
|
||||||
}
|
|
||||||
|
|
||||||
async function store(page: Page, key: string) {
|
|
||||||
return page.evaluate((key) => {
|
|
||||||
const raw = localStorage.getItem(key)
|
|
||||||
if (raw) return JSON.parse(raw) as State
|
|
||||||
|
|
||||||
for (let i = 0; i < localStorage.length; i++) {
|
|
||||||
const next = localStorage.key(i)
|
|
||||||
if (!next?.endsWith(":workspace:terminal")) continue
|
|
||||||
const value = localStorage.getItem(next)
|
|
||||||
if (!value) continue
|
|
||||||
return JSON.parse(value) as State
|
|
||||||
}
|
|
||||||
}, key)
|
|
||||||
}
|
|
||||||
|
|
||||||
test("inactive terminal tab buffers persist across tab switches", async ({ page, withProject }) => {
|
|
||||||
await withProject(async ({ directory, gotoSession }) => {
|
|
||||||
const key = workspacePersistKey(directory, "terminal")
|
|
||||||
const one = `E2E_TERM_ONE_${Date.now()}`
|
|
||||||
const two = `E2E_TERM_TWO_${Date.now()}`
|
|
||||||
const tabs = page.locator('#terminal-panel [data-slot="tabs-trigger"]')
|
|
||||||
const first = tabs.filter({ hasText: /Terminal 1/ }).first()
|
|
||||||
const second = tabs.filter({ hasText: /Terminal 2/ }).first()
|
|
||||||
|
|
||||||
await gotoSession()
|
|
||||||
await open(page)
|
|
||||||
|
|
||||||
await runTerminal(page, { cmd: `echo ${one}`, token: one })
|
|
||||||
|
|
||||||
await page.getByRole("button", { name: /new terminal/i }).click()
|
|
||||||
await expect(tabs).toHaveCount(2)
|
|
||||||
|
|
||||||
await runTerminal(page, { cmd: `echo ${two}`, token: two })
|
|
||||||
|
|
||||||
await first.click()
|
|
||||||
await expect(first).toHaveAttribute("aria-selected", "true")
|
|
||||||
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const state = await store(page, key)
|
|
||||||
const first = state?.all.find((item) => item.titleNumber === 1)?.buffer ?? ""
|
|
||||||
const second = state?.all.find((item) => item.titleNumber === 2)?.buffer ?? ""
|
|
||||||
return {
|
|
||||||
first: first.includes(one),
|
|
||||||
second: second.includes(two),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ timeout: 5_000 },
|
|
||||||
)
|
|
||||||
.toEqual({ first: false, second: true })
|
|
||||||
|
|
||||||
await second.click()
|
|
||||||
await expect(second).toHaveAttribute("aria-selected", "true")
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const state = await store(page, key)
|
|
||||||
const first = state?.all.find((item) => item.titleNumber === 1)?.buffer ?? ""
|
|
||||||
const second = state?.all.find((item) => item.titleNumber === 2)?.buffer ?? ""
|
|
||||||
return {
|
|
||||||
first: first.includes(one),
|
|
||||||
second: second.includes(two),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ timeout: 5_000 },
|
|
||||||
)
|
|
||||||
.toEqual({ first: true, second: false })
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("closing the active terminal tab falls back to the previous tab", async ({ page, withProject }) => {
|
|
||||||
await withProject(async ({ directory, gotoSession }) => {
|
|
||||||
const key = workspacePersistKey(directory, "terminal")
|
|
||||||
const tabs = page.locator('#terminal-panel [data-slot="tabs-trigger"]')
|
|
||||||
|
|
||||||
await gotoSession()
|
|
||||||
await open(page)
|
|
||||||
|
|
||||||
await page.getByRole("button", { name: /new terminal/i }).click()
|
|
||||||
await expect(tabs).toHaveCount(2)
|
|
||||||
|
|
||||||
const second = tabs.filter({ hasText: /Terminal 2/ }).first()
|
|
||||||
await second.click()
|
|
||||||
await expect(second).toHaveAttribute("aria-selected", "true")
|
|
||||||
|
|
||||||
await second.hover()
|
|
||||||
await page
|
|
||||||
.getByRole("button", { name: /close terminal/i })
|
|
||||||
.nth(1)
|
|
||||||
.click({ force: true })
|
|
||||||
|
|
||||||
const first = tabs.filter({ hasText: /Terminal 1/ }).first()
|
|
||||||
await expect(tabs).toHaveCount(1)
|
|
||||||
await expect(first).toHaveAttribute("aria-selected", "true")
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const state = await store(page, key)
|
|
||||||
return {
|
|
||||||
count: state?.all.length ?? 0,
|
|
||||||
first: state?.all.some((item) => item.titleNumber === 1) ?? false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ timeout: 15_000 },
|
|
||||||
)
|
|
||||||
.toEqual({ count: 1, first: true })
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("terminal tab can be renamed from the context menu", async ({ page, withProject }) => {
|
|
||||||
await withProject(async ({ directory, gotoSession }) => {
|
|
||||||
const key = workspacePersistKey(directory, "terminal")
|
|
||||||
const rename = `E2E term ${Date.now()}`
|
|
||||||
const tab = page.locator('#terminal-panel [data-slot="tabs-trigger"]').first()
|
|
||||||
|
|
||||||
await gotoSession()
|
|
||||||
await open(page)
|
|
||||||
|
|
||||||
await expect(tab).toContainText(/Terminal 1/)
|
|
||||||
await tab.click({ button: "right" })
|
|
||||||
|
|
||||||
const menu = page.locator(dropdownMenuContentSelector).first()
|
|
||||||
await expect(menu).toBeVisible()
|
|
||||||
await menu.getByRole("menuitem", { name: /^Rename$/i }).click()
|
|
||||||
await expect(menu).toHaveCount(0)
|
|
||||||
|
|
||||||
const input = page.locator('#terminal-panel input[type="text"]').first()
|
|
||||||
await expect(input).toBeVisible()
|
|
||||||
await input.fill(rename)
|
|
||||||
await input.press("Enter")
|
|
||||||
|
|
||||||
await expect(input).toHaveCount(0)
|
|
||||||
await expect(tab).toContainText(rename)
|
|
||||||
await expect
|
|
||||||
.poll(
|
|
||||||
async () => {
|
|
||||||
const state = await store(page, key)
|
|
||||||
return state?.all[0]?.title
|
|
||||||
},
|
|
||||||
{ timeout: 5_000 },
|
|
||||||
)
|
|
||||||
.toBe(rename)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import { test, expect } from "../fixtures"
|
|
||||||
import { waitTerminalReady } from "../actions"
|
|
||||||
import { terminalSelector } from "../selectors"
|
|
||||||
import { terminalToggleKey } from "../utils"
|
|
||||||
|
|
||||||
test("terminal panel can be toggled", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
const terminal = page.locator(terminalSelector)
|
|
||||||
const initiallyOpen = await terminal.isVisible()
|
|
||||||
if (initiallyOpen) {
|
|
||||||
await page.keyboard.press(terminalToggleKey)
|
|
||||||
await expect(terminal).toHaveCount(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
await page.keyboard.press(terminalToggleKey)
|
|
||||||
await waitTerminalReady(page, { term: terminal })
|
|
||||||
})
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
import { test, expect } from "./fixtures"
|
|
||||||
import { modelVariantCycleSelector } from "./selectors"
|
|
||||||
|
|
||||||
test("smoke model variant cycle updates label", async ({ page, gotoSession }) => {
|
|
||||||
await gotoSession()
|
|
||||||
|
|
||||||
await page.addStyleTag({
|
|
||||||
content: `${modelVariantCycleSelector} { display: inline-block !important; }`,
|
|
||||||
})
|
|
||||||
|
|
||||||
const button = page.locator(modelVariantCycleSelector)
|
|
||||||
const exists = (await button.count()) > 0
|
|
||||||
test.skip(!exists, "current model has no variants")
|
|
||||||
if (!exists) return
|
|
||||||
|
|
||||||
await expect(button).toBeVisible()
|
|
||||||
|
|
||||||
const before = (await button.innerText()).trim()
|
|
||||||
await button.click()
|
|
||||||
await expect(button).not.toHaveText(before)
|
|
||||||
|
|
||||||
const after = (await button.innerText()).trim()
|
|
||||||
await button.click()
|
|
||||||
await expect(button).not.toHaveText(after)
|
|
||||||
})
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { test } from "@playwright/test"
|
||||||
|
|
||||||
|
test(
|
||||||
|
"test something cool",
|
||||||
|
{
|
||||||
|
annotation: { type: "todo" },
|
||||||
|
},
|
||||||
|
async () => {
|
||||||
|
test.fixme()
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -5,5 +5,5 @@
|
|||||||
"rootDir": "..",
|
"rootDir": "..",
|
||||||
"types": ["node", "bun"]
|
"types": ["node", "bun"]
|
||||||
},
|
},
|
||||||
"include": ["./**/*.ts", "../src/testing/terminal.ts"]
|
"include": ["./**/*.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
import { createOpencodeClient } from "@opencode-ai/sdk/v2/client"
|
|
||||||
import { base64Encode, checksum } from "@opencode-ai/util/encode"
|
|
||||||
|
|
||||||
export const serverHost = process.env.PLAYWRIGHT_SERVER_HOST ?? "127.0.0.1"
|
|
||||||
export const serverPort = process.env.PLAYWRIGHT_SERVER_PORT ?? "4096"
|
|
||||||
|
|
||||||
export const serverUrl = `http://${serverHost}:${serverPort}`
|
|
||||||
export const serverName = `${serverHost}:${serverPort}`
|
|
||||||
|
|
||||||
const localHosts = ["127.0.0.1", "localhost"]
|
|
||||||
|
|
||||||
const serverLabels = (() => {
|
|
||||||
const url = new URL(serverUrl)
|
|
||||||
if (!localHosts.includes(url.hostname)) return [serverName]
|
|
||||||
return localHosts.map((host) => `${host}:${url.port}`)
|
|
||||||
})()
|
|
||||||
|
|
||||||
export const serverNames = [...new Set(serverLabels)]
|
|
||||||
|
|
||||||
export const serverUrls = serverNames.map((name) => `http://${name}`)
|
|
||||||
|
|
||||||
const escape = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
|
|
||||||
|
|
||||||
export const serverNamePattern = new RegExp(`(?:${serverNames.map(escape).join("|")})`)
|
|
||||||
|
|
||||||
export const modKey = process.platform === "darwin" ? "Meta" : "Control"
|
|
||||||
export const terminalToggleKey = "Control+Backquote"
|
|
||||||
|
|
||||||
export function createSdk(directory?: string) {
|
|
||||||
return createOpencodeClient({ baseUrl: serverUrl, directory, throwOnError: true })
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function resolveDirectory(directory: string) {
|
|
||||||
return createSdk(directory)
|
|
||||||
.path.get()
|
|
||||||
.then((x) => x.data?.directory ?? directory)
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getWorktree() {
|
|
||||||
const sdk = createSdk()
|
|
||||||
const result = await sdk.path.get()
|
|
||||||
const data = result.data
|
|
||||||
if (!data?.worktree) throw new Error(`Failed to resolve a worktree from ${serverUrl}/path`)
|
|
||||||
return data.worktree
|
|
||||||
}
|
|
||||||
|
|
||||||
export function dirSlug(directory: string) {
|
|
||||||
return base64Encode(directory)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function dirPath(directory: string) {
|
|
||||||
return `/${dirSlug(directory)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
export function sessionPath(directory: string, sessionID?: string) {
|
|
||||||
return `${dirPath(directory)}/session${sessionID ? `/${sessionID}` : ""}`
|
|
||||||
}
|
|
||||||
|
|
||||||
export function workspacePersistKey(directory: string, key: string) {
|
|
||||||
const head = (directory.slice(0, 12) || "workspace").replace(/[^a-zA-Z0-9._-]/g, "-")
|
|
||||||
const sum = checksum(directory) ?? "0"
|
|
||||||
return `opencode.workspace.${head}.${sum}.dat:workspace:${key}`
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@opencode-ai/app",
|
"name": "@opencode-ai/app",
|
||||||
"version": "1.3.13",
|
"version": "1.14.32",
|
||||||
"description": "",
|
"description": "",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exports": {
|
"exports": {
|
||||||
@@ -15,17 +15,19 @@
|
|||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"serve": "vite preview",
|
"serve": "vite preview",
|
||||||
"test": "bun run test:unit",
|
"test": "bun run test:unit",
|
||||||
|
"test:ci": "mkdir -p .artifacts/unit && bun test --preload ./happydom.ts ./src --reporter=junit --reporter-outfile=.artifacts/unit/junit.xml",
|
||||||
"test:unit": "bun test --preload ./happydom.ts ./src",
|
"test:unit": "bun test --preload ./happydom.ts ./src",
|
||||||
"test:unit:watch": "bun test --watch --preload ./happydom.ts ./src",
|
"test:unit:watch": "bun test --watch --preload ./happydom.ts ./src",
|
||||||
"test:e2e": "playwright test",
|
"test:e2e": "playwright test",
|
||||||
"test:e2e:local": "bun script/e2e-local.ts",
|
"test:e2e:local": "playwright test",
|
||||||
"test:e2e:ui": "playwright test --ui",
|
"test:e2e:ui": "playwright test --ui",
|
||||||
"test:e2e:report": "playwright show-report e2e/playwright-report"
|
"test:e2e:report": "playwright show-report e2e/playwright-report"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@happy-dom/global-registrator": "20.0.11",
|
"@happy-dom/global-registrator": "20.0.11",
|
||||||
"@playwright/test": "1.57.0",
|
"@playwright/test": "catalog:",
|
||||||
|
"@sentry/vite-plugin": "catalog:",
|
||||||
"@tailwindcss/vite": "catalog:",
|
"@tailwindcss/vite": "catalog:",
|
||||||
"@tsconfig/bun": "1.0.9",
|
"@tsconfig/bun": "1.0.9",
|
||||||
"@types/bun": "catalog:",
|
"@types/bun": "catalog:",
|
||||||
@@ -39,16 +41,18 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@kobalte/core": "catalog:",
|
"@kobalte/core": "catalog:",
|
||||||
|
"@sentry/solid": "catalog:",
|
||||||
"@opencode-ai/sdk": "workspace:*",
|
"@opencode-ai/sdk": "workspace:*",
|
||||||
"@opencode-ai/ui": "workspace:*",
|
"@opencode-ai/ui": "workspace:*",
|
||||||
"@opencode-ai/util": "workspace:*",
|
"@opencode-ai/core": "workspace:*",
|
||||||
"@shikijs/transformers": "3.9.2",
|
"@shikijs/transformers": "3.9.2",
|
||||||
"@solid-primitives/active-element": "2.1.3",
|
"@solid-primitives/active-element": "2.1.3",
|
||||||
"@solid-primitives/audio": "1.4.2",
|
"@solid-primitives/audio": "1.4.2",
|
||||||
"@solid-primitives/event-bus": "1.1.2",
|
"@solid-primitives/event-bus": "1.1.2",
|
||||||
|
"@solid-primitives/event-listener": "2.4.5",
|
||||||
"@solid-primitives/i18n": "2.2.1",
|
"@solid-primitives/i18n": "2.2.1",
|
||||||
"@solid-primitives/media": "2.3.3",
|
"@solid-primitives/media": "2.3.3",
|
||||||
"@solid-primitives/resize-observer": "2.1.3",
|
"@solid-primitives/resize-observer": "2.1.5",
|
||||||
"@solid-primitives/scroll": "2.1.3",
|
"@solid-primitives/scroll": "2.1.3",
|
||||||
"@solid-primitives/storage": "catalog:",
|
"@solid-primitives/storage": "catalog:",
|
||||||
"@solid-primitives/timer": "1.4.4",
|
"@solid-primitives/timer": "1.4.4",
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ const serverPort = process.env.PLAYWRIGHT_SERVER_PORT ?? "4096"
|
|||||||
const command = `bun run dev -- --host 0.0.0.0 --port ${port}`
|
const command = `bun run dev -- --host 0.0.0.0 --port ${port}`
|
||||||
const reuse = !process.env.CI
|
const reuse = !process.env.CI
|
||||||
const workers = Number(process.env.PLAYWRIGHT_WORKERS ?? (process.env.CI ? 5 : 0)) || undefined
|
const workers = Number(process.env.PLAYWRIGHT_WORKERS ?? (process.env.CI ? 5 : 0)) || undefined
|
||||||
|
const reporter = [["html", { outputFolder: "e2e/playwright-report", open: "never" }], ["line"]] as const
|
||||||
|
|
||||||
|
if (process.env.PLAYWRIGHT_JUNIT_OUTPUT) {
|
||||||
|
reporter.push(["junit", { outputFile: process.env.PLAYWRIGHT_JUNIT_OUTPUT }])
|
||||||
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
testDir: "./e2e",
|
testDir: "./e2e",
|
||||||
@@ -19,7 +24,7 @@ export default defineConfig({
|
|||||||
forbidOnly: !!process.env.CI,
|
forbidOnly: !!process.env.CI,
|
||||||
retries: process.env.CI ? 2 : 0,
|
retries: process.env.CI ? 2 : 0,
|
||||||
workers,
|
workers,
|
||||||
reporter: [["html", { outputFolder: "e2e/playwright-report", open: "never" }], ["line"]],
|
reporter,
|
||||||
webServer: {
|
webServer: {
|
||||||
command,
|
command,
|
||||||
url: baseURL,
|
url: baseURL,
|
||||||
|
|||||||
Binary file not shown.
@@ -1,180 +0,0 @@
|
|||||||
import fs from "node:fs/promises"
|
|
||||||
import net from "node:net"
|
|
||||||
import os from "node:os"
|
|
||||||
import path from "node:path"
|
|
||||||
|
|
||||||
async function freePort() {
|
|
||||||
return await new Promise<number>((resolve, reject) => {
|
|
||||||
const server = net.createServer()
|
|
||||||
server.once("error", reject)
|
|
||||||
server.listen(0, () => {
|
|
||||||
const address = server.address()
|
|
||||||
if (!address || typeof address === "string") {
|
|
||||||
server.close(() => reject(new Error("Failed to acquire a free port")))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
server.close((err) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resolve(address.port)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function waitForHealth(url: string) {
|
|
||||||
const timeout = Date.now() + 120_000
|
|
||||||
const errors: string[] = []
|
|
||||||
while (Date.now() < timeout) {
|
|
||||||
const result = await fetch(url)
|
|
||||||
.then((r) => ({ ok: r.ok, error: undefined }))
|
|
||||||
.catch((error) => ({
|
|
||||||
ok: false,
|
|
||||||
error: error instanceof Error ? error.message : String(error),
|
|
||||||
}))
|
|
||||||
if (result.ok) return
|
|
||||||
if (result.error) errors.push(result.error)
|
|
||||||
await new Promise((r) => setTimeout(r, 250))
|
|
||||||
}
|
|
||||||
const last = errors.length ? ` (last error: ${errors[errors.length - 1]})` : ""
|
|
||||||
throw new Error(`Timed out waiting for server health: ${url}${last}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
const appDir = process.cwd()
|
|
||||||
const repoDir = path.resolve(appDir, "../..")
|
|
||||||
const opencodeDir = path.join(repoDir, "packages", "opencode")
|
|
||||||
|
|
||||||
const extraArgs = (() => {
|
|
||||||
const args = process.argv.slice(2)
|
|
||||||
if (args[0] === "--") return args.slice(1)
|
|
||||||
return args
|
|
||||||
})()
|
|
||||||
|
|
||||||
const [serverPort, webPort] = await Promise.all([freePort(), freePort()])
|
|
||||||
|
|
||||||
const sandbox = await fs.mkdtemp(path.join(os.tmpdir(), "opencode-e2e-"))
|
|
||||||
const keepSandbox = process.env.OPENCODE_E2E_KEEP_SANDBOX === "1"
|
|
||||||
|
|
||||||
const serverEnv = {
|
|
||||||
...process.env,
|
|
||||||
OPENCODE_DISABLE_SHARE: process.env.OPENCODE_DISABLE_SHARE ?? "true",
|
|
||||||
OPENCODE_DISABLE_LSP_DOWNLOAD: "true",
|
|
||||||
OPENCODE_DISABLE_DEFAULT_PLUGINS: "true",
|
|
||||||
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: "true",
|
|
||||||
OPENCODE_TEST_HOME: path.join(sandbox, "home"),
|
|
||||||
XDG_DATA_HOME: path.join(sandbox, "share"),
|
|
||||||
XDG_CACHE_HOME: path.join(sandbox, "cache"),
|
|
||||||
XDG_CONFIG_HOME: path.join(sandbox, "config"),
|
|
||||||
XDG_STATE_HOME: path.join(sandbox, "state"),
|
|
||||||
OPENCODE_E2E_PROJECT_DIR: repoDir,
|
|
||||||
OPENCODE_E2E_SESSION_TITLE: "E2E Session",
|
|
||||||
OPENCODE_E2E_MESSAGE: "Seeded for UI e2e",
|
|
||||||
OPENCODE_E2E_MODEL: process.env.OPENCODE_E2E_MODEL ?? "opencode/gpt-5-nano",
|
|
||||||
OPENCODE_CLIENT: "app",
|
|
||||||
OPENCODE_STRICT_CONFIG_DEPS: "true",
|
|
||||||
} satisfies Record<string, string>
|
|
||||||
|
|
||||||
const runnerEnv = {
|
|
||||||
...serverEnv,
|
|
||||||
PLAYWRIGHT_SERVER_HOST: "127.0.0.1",
|
|
||||||
PLAYWRIGHT_SERVER_PORT: String(serverPort),
|
|
||||||
VITE_OPENCODE_SERVER_HOST: "127.0.0.1",
|
|
||||||
VITE_OPENCODE_SERVER_PORT: String(serverPort),
|
|
||||||
PLAYWRIGHT_PORT: String(webPort),
|
|
||||||
} satisfies Record<string, string>
|
|
||||||
|
|
||||||
let seed: ReturnType<typeof Bun.spawn> | undefined
|
|
||||||
let runner: ReturnType<typeof Bun.spawn> | undefined
|
|
||||||
let server: { stop: () => Promise<void> | void } | undefined
|
|
||||||
let inst: { Instance: { disposeAll: () => Promise<void> | void } } | undefined
|
|
||||||
let cleaned = false
|
|
||||||
|
|
||||||
const cleanup = async () => {
|
|
||||||
if (cleaned) return
|
|
||||||
cleaned = true
|
|
||||||
|
|
||||||
if (seed && seed.exitCode === null) seed.kill("SIGTERM")
|
|
||||||
if (runner && runner.exitCode === null) runner.kill("SIGTERM")
|
|
||||||
|
|
||||||
const jobs = [
|
|
||||||
inst?.Instance.disposeAll(),
|
|
||||||
server?.stop(),
|
|
||||||
keepSandbox ? undefined : fs.rm(sandbox, { recursive: true, force: true }),
|
|
||||||
].filter(Boolean)
|
|
||||||
await Promise.allSettled(jobs)
|
|
||||||
}
|
|
||||||
|
|
||||||
const shutdown = (code: number, reason: string) => {
|
|
||||||
process.exitCode = code
|
|
||||||
void cleanup().finally(() => {
|
|
||||||
console.error(`e2e-local shutdown: ${reason}`)
|
|
||||||
process.exit(code)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const reportInternalError = (reason: string, error: unknown) => {
|
|
||||||
console.warn(`e2e-local ignored server error: ${reason}`)
|
|
||||||
console.warn(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
process.once("SIGINT", () => shutdown(130, "SIGINT"))
|
|
||||||
process.once("SIGTERM", () => shutdown(143, "SIGTERM"))
|
|
||||||
process.once("SIGHUP", () => shutdown(129, "SIGHUP"))
|
|
||||||
process.once("uncaughtException", (error) => {
|
|
||||||
reportInternalError("uncaughtException", error)
|
|
||||||
})
|
|
||||||
process.once("unhandledRejection", (error) => {
|
|
||||||
reportInternalError("unhandledRejection", error)
|
|
||||||
})
|
|
||||||
|
|
||||||
let code = 1
|
|
||||||
|
|
||||||
try {
|
|
||||||
seed = Bun.spawn(["bun", "script/seed-e2e.ts"], {
|
|
||||||
cwd: opencodeDir,
|
|
||||||
env: serverEnv,
|
|
||||||
stdout: "inherit",
|
|
||||||
stderr: "inherit",
|
|
||||||
})
|
|
||||||
|
|
||||||
const seedExit = await seed.exited
|
|
||||||
if (seedExit !== 0) {
|
|
||||||
code = seedExit
|
|
||||||
} else {
|
|
||||||
Object.assign(process.env, serverEnv)
|
|
||||||
process.env.AGENT = "1"
|
|
||||||
process.env.OPENCODE = "1"
|
|
||||||
process.env.OPENCODE_PID = String(process.pid)
|
|
||||||
|
|
||||||
const log = await import("../../opencode/src/util/log")
|
|
||||||
const install = await import("../../opencode/src/installation")
|
|
||||||
await log.Log.init({
|
|
||||||
print: true,
|
|
||||||
dev: install.Installation.isLocal(),
|
|
||||||
level: "WARN",
|
|
||||||
})
|
|
||||||
|
|
||||||
const servermod = await import("../../opencode/src/server/server")
|
|
||||||
inst = await import("../../opencode/src/project/instance")
|
|
||||||
server = servermod.Server.listen({ port: serverPort, hostname: "127.0.0.1" })
|
|
||||||
console.log(`opencode server listening on http://127.0.0.1:${serverPort}`)
|
|
||||||
|
|
||||||
await waitForHealth(`http://127.0.0.1:${serverPort}/global/health`)
|
|
||||||
runner = Bun.spawn(["bun", "test:e2e", ...extraArgs], {
|
|
||||||
cwd: appDir,
|
|
||||||
env: runnerEnv,
|
|
||||||
stdout: "inherit",
|
|
||||||
stderr: "inherit",
|
|
||||||
})
|
|
||||||
code = await runner.exited
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
code = 1
|
|
||||||
} finally {
|
|
||||||
await cleanup()
|
|
||||||
}
|
|
||||||
|
|
||||||
process.exit(code)
|
|
||||||
@@ -180,8 +180,8 @@ describe("SerializeAddon", () => {
|
|||||||
await writeAndWait(term, input)
|
await writeAndWait(term, input)
|
||||||
|
|
||||||
const origLine = term.buffer.active.getLine(0)
|
const origLine = term.buffer.active.getLine(0)
|
||||||
const origFg = origLine!.getCell(0)!.getFgColor()
|
const _origFg = origLine!.getCell(0)!.getFgColor()
|
||||||
const origBg = origLine!.getCell(0)!.getBgColor()
|
const _origBg = origLine!.getCell(0)!.getBgColor()
|
||||||
expect(origLine!.getCell(0)!.isBold()).toBe(1)
|
expect(origLine!.getCell(0)!.isBold()).toBe(1)
|
||||||
|
|
||||||
const serialized = addon.serialize({ range: { start: 0, end: 0 } })
|
const serialized = addon.serialize({ range: { start: 0, end: 0 } })
|
||||||
|
|||||||
@@ -258,8 +258,8 @@ class StringSerializeHandler extends BaseSerializeHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected _beforeSerialize(rows: number, start: number, _end: number): void {
|
protected _beforeSerialize(rows: number, start: number, _end: number): void {
|
||||||
this._allRows = new Array<string>(rows)
|
this._allRows = Array.from<string>({ length: rows })
|
||||||
this._allRowSeparators = new Array<string>(rows)
|
this._allRowSeparators = Array.from<string>({ length: rows })
|
||||||
this._rowIndex = 0
|
this._rowIndex = 0
|
||||||
|
|
||||||
this._currentRow = ""
|
this._currentRow = ""
|
||||||
|
|||||||
+51
-32
@@ -1,4 +1,5 @@
|
|||||||
import "@/index.css"
|
import "@/index.css"
|
||||||
|
import * as Sentry from "@sentry/solid"
|
||||||
import { I18nProvider } from "@opencode-ai/ui/context"
|
import { I18nProvider } from "@opencode-ai/ui/context"
|
||||||
import { DialogProvider } from "@opencode-ai/ui/context/dialog"
|
import { DialogProvider } from "@opencode-ai/ui/context/dialog"
|
||||||
import { FileComponentProvider } from "@opencode-ai/ui/context/file"
|
import { FileComponentProvider } from "@opencode-ai/ui/context/file"
|
||||||
@@ -10,7 +11,7 @@ import { ThemeProvider } from "@opencode-ai/ui/theme/context"
|
|||||||
import { MetaProvider } from "@solidjs/meta"
|
import { MetaProvider } from "@solidjs/meta"
|
||||||
import { type BaseRouterProps, Navigate, Route, Router } from "@solidjs/router"
|
import { type BaseRouterProps, Navigate, Route, Router } from "@solidjs/router"
|
||||||
import { QueryClient, QueryClientProvider } from "@tanstack/solid-query"
|
import { QueryClient, QueryClientProvider } from "@tanstack/solid-query"
|
||||||
import { type Duration, Effect } from "effect"
|
import { Effect } from "effect"
|
||||||
import {
|
import {
|
||||||
type Component,
|
type Component,
|
||||||
createMemo,
|
createMemo,
|
||||||
@@ -82,7 +83,15 @@ declare global {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function QueryProvider(props: ParentProps) {
|
function QueryProvider(props: ParentProps) {
|
||||||
const client = new QueryClient()
|
const client = new QueryClient({
|
||||||
|
defaultOptions: {
|
||||||
|
queries: {
|
||||||
|
refetchOnReconnect: false,
|
||||||
|
refetchOnMount: false,
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
return <QueryClientProvider client={client}>{props.children}</QueryClientProvider>
|
return <QueryClientProvider client={client}>{props.children}</QueryClientProvider>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,10 +130,10 @@ function SessionProviders(props: ParentProps) {
|
|||||||
function RouterRoot(props: ParentProps<{ appChildren?: JSX.Element }>) {
|
function RouterRoot(props: ParentProps<{ appChildren?: JSX.Element }>) {
|
||||||
return (
|
return (
|
||||||
<AppShellProviders>
|
<AppShellProviders>
|
||||||
<Suspense fallback={<Loading />}>
|
{/*<Suspense fallback={<Loading />}>*/}
|
||||||
{props.appChildren}
|
{props.appChildren}
|
||||||
{props.children}
|
{props.children}
|
||||||
</Suspense>
|
{/*</Suspense>*/}
|
||||||
</AppShellProviders>
|
</AppShellProviders>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -140,7 +149,12 @@ export function AppBaseProviders(props: ParentProps<{ locale?: Locale }>) {
|
|||||||
>
|
>
|
||||||
<LanguageProvider locale={props.locale}>
|
<LanguageProvider locale={props.locale}>
|
||||||
<UiI18nBridge>
|
<UiI18nBridge>
|
||||||
<ErrorBoundary fallback={(error) => <ErrorPage error={error} />}>
|
<ErrorBoundary
|
||||||
|
fallback={(error) => {
|
||||||
|
Sentry.captureException(error)
|
||||||
|
return <ErrorPage error={error} />
|
||||||
|
}}
|
||||||
|
>
|
||||||
<QueryProvider>
|
<QueryProvider>
|
||||||
<DialogProvider>
|
<DialogProvider>
|
||||||
<MarkedProvider>
|
<MarkedProvider>
|
||||||
@@ -156,11 +170,6 @@ export function AppBaseProviders(props: ParentProps<{ locale?: Locale }>) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const effectMinDuration =
|
|
||||||
(duration: Duration.Input) =>
|
|
||||||
<A, E, R>(e: Effect.Effect<A, E, R>) =>
|
|
||||||
Effect.all([e, Effect.sleep(duration)], { concurrency: "unbounded" }).pipe(Effect.map((v) => v[0]))
|
|
||||||
|
|
||||||
function ConnectionGate(props: ParentProps<{ disableHealthCheck?: boolean }>) {
|
function ConnectionGate(props: ParentProps<{ disableHealthCheck?: boolean }>) {
|
||||||
const server = useServer()
|
const server = useServer()
|
||||||
const checkServerHealth = useCheckServerHealth()
|
const checkServerHealth = useCheckServerHealth()
|
||||||
@@ -182,7 +191,6 @@ function ConnectionGate(props: ParentProps<{ disableHealthCheck?: boolean }>) {
|
|||||||
if (checkMode() === "background" || type === "http") return false
|
if (checkMode() === "background" || type === "http") return false
|
||||||
}
|
}
|
||||||
}).pipe(
|
}).pipe(
|
||||||
effectMinDuration(checkMode() === "blocking" ? "1.2 seconds" : 0),
|
|
||||||
Effect.timeoutOrElse({ duration: "10 seconds", orElse: () => Effect.succeed(false) }),
|
Effect.timeoutOrElse({ duration: "10 seconds", orElse: () => Effect.succeed(false) }),
|
||||||
Effect.ensuring(Effect.sync(() => setCheckMode("background"))),
|
Effect.ensuring(Effect.sync(() => setCheckMode("background"))),
|
||||||
Effect.runPromise,
|
Effect.runPromise,
|
||||||
@@ -190,32 +198,41 @@ function ConnectionGate(props: ParentProps<{ disableHealthCheck?: boolean }>) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Show
|
<Suspense
|
||||||
when={checkMode() === "blocking" ? !startupHealthCheck.loading : startupHealthCheck.state !== "pending"}
|
|
||||||
fallback={
|
fallback={
|
||||||
<div class="h-dvh w-screen flex flex-col items-center justify-center bg-background-base">
|
<div class="h-dvh w-screen flex flex-col items-center justify-center bg-background-base">
|
||||||
<Splash class="w-16 h-20 opacity-50 animate-pulse" />
|
<Splash class="w-16 h-20 opacity-50 animate-pulse" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
{/*<Show
|
||||||
|
when={checkMode() === "blocking" ? !startupHealthCheck.loading : startupHealthCheck.state !== "pending"}
|
||||||
|
fallback={
|
||||||
|
<div class="h-dvh w-screen flex flex-col items-center justify-center bg-background-base">
|
||||||
|
<Splash class="w-16 h-20 opacity-50 animate-pulse" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>*/}
|
||||||
|
{checkMode() === "blocking" ? startupHealthCheck() : startupHealthCheck.latest}
|
||||||
<Show
|
<Show
|
||||||
when={startupHealthCheck()}
|
when={startupHealthCheck()}
|
||||||
fallback={
|
fallback={
|
||||||
<ConnectionError
|
<ConnectionError
|
||||||
onRetry={() => {
|
onRetry={() => {
|
||||||
if (checkMode() === "background") healthCheckActions.refetch()
|
if (checkMode() === "background") void healthCheckActions.refetch()
|
||||||
}}
|
}}
|
||||||
onServerSelected={(key) => {
|
onServerSelected={(key) => {
|
||||||
setCheckMode("blocking")
|
setCheckMode("blocking")
|
||||||
server.setActive(key)
|
server.setActive(key)
|
||||||
healthCheckActions.refetch()
|
void healthCheckActions.refetch()
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</Show>
|
</Show>
|
||||||
</Show>
|
{/*</Show>*/}
|
||||||
|
</Suspense>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,20 +307,22 @@ export function AppInterface(props: {
|
|||||||
>
|
>
|
||||||
<ConnectionGate disableHealthCheck={props.disableHealthCheck}>
|
<ConnectionGate disableHealthCheck={props.disableHealthCheck}>
|
||||||
<ServerKey>
|
<ServerKey>
|
||||||
<GlobalSDKProvider>
|
<QueryProvider>
|
||||||
<GlobalSyncProvider>
|
<GlobalSDKProvider>
|
||||||
<Dynamic
|
<GlobalSyncProvider>
|
||||||
component={props.router ?? Router}
|
<Dynamic
|
||||||
root={(routerProps) => <RouterRoot appChildren={props.children}>{routerProps.children}</RouterRoot>}
|
component={props.router ?? Router}
|
||||||
>
|
root={(routerProps) => <RouterRoot appChildren={props.children}>{routerProps.children}</RouterRoot>}
|
||||||
<Route path="/" component={HomeRoute} />
|
>
|
||||||
<Route path="/:dir" component={DirectoryLayout}>
|
<Route path="/" component={HomeRoute} />
|
||||||
<Route path="/" component={SessionIndexRoute} />
|
<Route path="/:dir" component={DirectoryLayout}>
|
||||||
<Route path="/session/:id?" component={SessionRoute} />
|
<Route path="/" component={SessionIndexRoute} />
|
||||||
</Route>
|
<Route path="/session/:id?" component={SessionRoute} />
|
||||||
</Dynamic>
|
</Route>
|
||||||
</GlobalSyncProvider>
|
</Dynamic>
|
||||||
</GlobalSDKProvider>
|
</GlobalSyncProvider>
|
||||||
|
</GlobalSDKProvider>
|
||||||
|
</QueryProvider>
|
||||||
</ServerKey>
|
</ServerKey>
|
||||||
</ConnectionGate>
|
</ConnectionGate>
|
||||||
</ServerProvider>
|
</ServerProvider>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useIsRouting, useLocation } from "@solidjs/router"
|
import { useIsRouting, useLocation } from "@solidjs/router"
|
||||||
import { batch, createEffect, onCleanup, onMount } from "solid-js"
|
import { batch, createEffect, onCleanup, onMount } from "solid-js"
|
||||||
import { createStore } from "solid-js/store"
|
import { createStore } from "solid-js/store"
|
||||||
|
import { makeEventListener } from "@solid-primitives/event-listener"
|
||||||
import { Tooltip } from "@opencode-ai/ui/tooltip"
|
import { Tooltip } from "@opencode-ai/ui/tooltip"
|
||||||
import { useLanguage } from "@/context/language"
|
import { useLanguage } from "@/context/language"
|
||||||
|
|
||||||
@@ -349,13 +350,12 @@ export function DebugBar() {
|
|||||||
|
|
||||||
syncHeap()
|
syncHeap()
|
||||||
start()
|
start()
|
||||||
document.addEventListener("visibilitychange", vis)
|
makeEventListener(document, "visibilitychange", vis)
|
||||||
|
|
||||||
onCleanup(() => {
|
onCleanup(() => {
|
||||||
if (one !== 0) cancelAnimationFrame(one)
|
if (one !== 0) cancelAnimationFrame(one)
|
||||||
if (two !== 0) cancelAnimationFrame(two)
|
if (two !== 0) cancelAnimationFrame(two)
|
||||||
stop()
|
stop()
|
||||||
document.removeEventListener("visibilitychange", vis)
|
|
||||||
for (const ob of obs) ob.disconnect()
|
for (const ob of obs) ob.disconnect()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ export function DialogConnectProvider(props: { provider: string }) {
|
|||||||
if (loading()) return
|
if (loading()) return
|
||||||
if (methods().length === 1) {
|
if (methods().length === 1) {
|
||||||
auto = true
|
auto = true
|
||||||
selectMethod(0)
|
void selectMethod(0)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -373,7 +373,7 @@ export function DialogConnectProvider(props: { provider: string }) {
|
|||||||
key={(m) => m?.label}
|
key={(m) => m?.label}
|
||||||
onSelect={async (selected, index) => {
|
onSelect={async (selected, index) => {
|
||||||
if (!selected) return
|
if (!selected) return
|
||||||
selectMethod(index)
|
void selectMethod(index)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{(i) => (
|
{(i) => (
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ import { createStore } from "solid-js/store"
|
|||||||
import { useGlobalSDK } from "@/context/global-sdk"
|
import { useGlobalSDK } from "@/context/global-sdk"
|
||||||
import { useGlobalSync } from "@/context/global-sync"
|
import { useGlobalSync } from "@/context/global-sync"
|
||||||
import { type LocalProject, getAvatarColors } from "@/context/layout"
|
import { type LocalProject, getAvatarColors } from "@/context/layout"
|
||||||
import { getFilename } from "@opencode-ai/util/path"
|
import { getFilename } from "@opencode-ai/core/util/path"
|
||||||
import { Avatar } from "@opencode-ai/ui/avatar"
|
import { Avatar } from "@opencode-ai/ui/avatar"
|
||||||
import { useLanguage } from "@/context/language"
|
import { useLanguage } from "@/context/language"
|
||||||
|
import { getProjectAvatarSource } from "@/pages/layout/sidebar-items"
|
||||||
|
|
||||||
const AVATAR_COLOR_KEYS = ["pink", "mint", "orange", "purple", "cyan", "lime"] as const
|
const AVATAR_COLOR_KEYS = ["pink", "mint", "orange", "purple", "cyan", "lime"] as const
|
||||||
|
|
||||||
@@ -26,8 +27,8 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
|
|
||||||
const [store, setStore] = createStore({
|
const [store, setStore] = createStore({
|
||||||
name: defaultName(),
|
name: defaultName(),
|
||||||
color: props.project.icon?.color || "pink",
|
color: props.project.icon?.color,
|
||||||
iconUrl: props.project.icon?.override || "",
|
iconOverride: props.project.icon?.override,
|
||||||
startup: props.project.commands?.start ?? "",
|
startup: props.project.commands?.start ?? "",
|
||||||
dragOver: false,
|
dragOver: false,
|
||||||
iconHover: false,
|
iconHover: false,
|
||||||
@@ -39,7 +40,7 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
if (!file.type.startsWith("image/")) return
|
if (!file.type.startsWith("image/")) return
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
setStore("iconUrl", e.target?.result as string)
|
setStore("iconOverride", e.target?.result as string)
|
||||||
setStore("iconHover", false)
|
setStore("iconHover", false)
|
||||||
}
|
}
|
||||||
reader.readAsDataURL(file)
|
reader.readAsDataURL(file)
|
||||||
@@ -68,7 +69,7 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearIcon() {
|
function clearIcon() {
|
||||||
setStore("iconUrl", "")
|
setStore("iconOverride", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveMutation = useMutation(() => ({
|
const saveMutation = useMutation(() => ({
|
||||||
@@ -81,17 +82,17 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
projectID: props.project.id,
|
projectID: props.project.id,
|
||||||
directory: props.project.worktree,
|
directory: props.project.worktree,
|
||||||
name,
|
name,
|
||||||
icon: { color: store.color, override: store.iconUrl },
|
icon: { color: store.color || "", override: store.iconOverride || "" },
|
||||||
commands: { start },
|
commands: { start },
|
||||||
})
|
})
|
||||||
globalSync.project.icon(props.project.worktree, store.iconUrl || undefined)
|
globalSync.project.icon(props.project.worktree, store.iconOverride || undefined)
|
||||||
dialog.close()
|
dialog.close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
globalSync.project.meta(props.project.worktree, {
|
globalSync.project.meta(props.project.worktree, {
|
||||||
name,
|
name,
|
||||||
icon: { color: store.color, override: store.iconUrl || undefined },
|
icon: { color: store.color || undefined, override: store.iconOverride || undefined },
|
||||||
commands: { start: start || undefined },
|
commands: { start: start || undefined },
|
||||||
})
|
})
|
||||||
dialog.close()
|
dialog.close()
|
||||||
@@ -130,13 +131,13 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
classList={{
|
classList={{
|
||||||
"border-text-interactive-base bg-surface-info-base/20": store.dragOver,
|
"border-text-interactive-base bg-surface-info-base/20": store.dragOver,
|
||||||
"border-border-base hover:border-border-strong": !store.dragOver,
|
"border-border-base hover:border-border-strong": !store.dragOver,
|
||||||
"overflow-hidden": !!store.iconUrl,
|
"overflow-hidden": !!store.iconOverride,
|
||||||
}}
|
}}
|
||||||
onDrop={handleDrop}
|
onDrop={handleDrop}
|
||||||
onDragOver={handleDragOver}
|
onDragOver={handleDragOver}
|
||||||
onDragLeave={handleDragLeave}
|
onDragLeave={handleDragLeave}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (store.iconUrl && store.iconHover) {
|
if (store.iconOverride && store.iconHover) {
|
||||||
clearIcon()
|
clearIcon()
|
||||||
} else {
|
} else {
|
||||||
iconInput?.click()
|
iconInput?.click()
|
||||||
@@ -144,7 +145,11 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Show
|
<Show
|
||||||
when={store.iconUrl}
|
when={getProjectAvatarSource(props.project.id, {
|
||||||
|
color: store.color,
|
||||||
|
url: props.project.icon?.url,
|
||||||
|
override: store.iconOverride,
|
||||||
|
})}
|
||||||
fallback={
|
fallback={
|
||||||
<div class="size-full flex items-center justify-center">
|
<div class="size-full flex items-center justify-center">
|
||||||
<Avatar
|
<Avatar
|
||||||
@@ -155,18 +160,20 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<img
|
{(src) => (
|
||||||
src={store.iconUrl}
|
<img
|
||||||
alt={language.t("dialog.project.edit.icon.alt")}
|
src={src()}
|
||||||
class="size-full object-cover"
|
alt={language.t("dialog.project.edit.icon.alt")}
|
||||||
/>
|
class="size-full object-cover"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"
|
class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"
|
||||||
classList={{
|
classList={{
|
||||||
"opacity-100": store.iconHover && !store.iconUrl,
|
"opacity-100": store.iconHover && !store.iconOverride,
|
||||||
"opacity-0": !(store.iconHover && !store.iconUrl),
|
"opacity-0": !(store.iconHover && !store.iconOverride),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon name="cloud-upload" size="large" class="text-icon-on-interactive-base drop-shadow-sm" />
|
<Icon name="cloud-upload" size="large" class="text-icon-on-interactive-base drop-shadow-sm" />
|
||||||
@@ -174,8 +181,8 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
<div
|
<div
|
||||||
class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"
|
class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"
|
||||||
classList={{
|
classList={{
|
||||||
"opacity-100": store.iconHover && !!store.iconUrl,
|
"opacity-100": store.iconHover && !!store.iconOverride,
|
||||||
"opacity-0": !(store.iconHover && !!store.iconUrl),
|
"opacity-0": !(store.iconHover && !!store.iconOverride),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon name="trash" size="large" class="text-icon-on-interactive-base drop-shadow-sm" />
|
<Icon name="trash" size="large" class="text-icon-on-interactive-base drop-shadow-sm" />
|
||||||
@@ -198,7 +205,7 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Show when={!store.iconUrl}>
|
<Show when={!store.iconOverride}>
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<label class="text-12-medium text-text-weak">{language.t("dialog.project.edit.color")}</label>
|
<label class="text-12-medium text-text-weak">{language.t("dialog.project.edit.color")}</label>
|
||||||
<div class="flex gap-1.5">
|
<div class="flex gap-1.5">
|
||||||
@@ -215,7 +222,10 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
"bg-transparent border border-transparent hover:bg-surface-base-hover hover:border-border-weak-base":
|
"bg-transparent border border-transparent hover:bg-surface-base-hover hover:border-border-weak-base":
|
||||||
store.color !== color,
|
store.color !== color,
|
||||||
}}
|
}}
|
||||||
onClick={() => setStore("color", color)}
|
onClick={() => {
|
||||||
|
if (store.color === color && !props.project.icon?.url) return
|
||||||
|
setStore("color", store.color === color ? undefined : color)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Avatar
|
<Avatar
|
||||||
fallback={store.name || defaultName()}
|
fallback={store.name || defaultName()}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { List } from "@opencode-ai/ui/list"
|
|||||||
import { showToast } from "@opencode-ai/ui/toast"
|
import { showToast } from "@opencode-ai/ui/toast"
|
||||||
import { extractPromptFromParts } from "@/utils/prompt"
|
import { extractPromptFromParts } from "@/utils/prompt"
|
||||||
import type { TextPart as SDKTextPart } from "@opencode-ai/sdk/v2/client"
|
import type { TextPart as SDKTextPart } from "@opencode-ai/sdk/v2/client"
|
||||||
import { base64Encode } from "@opencode-ai/util/encode"
|
import { base64Encode } from "@opencode-ai/core/util/encode"
|
||||||
import { useLanguage } from "@/context/language"
|
import { useLanguage } from "@/context/language"
|
||||||
|
|
||||||
interface ForkableMessage {
|
interface ForkableMessage {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Dialog } from "@opencode-ai/ui/dialog"
|
|||||||
import { FileIcon } from "@opencode-ai/ui/file-icon"
|
import { FileIcon } from "@opencode-ai/ui/file-icon"
|
||||||
import { List } from "@opencode-ai/ui/list"
|
import { List } from "@opencode-ai/ui/list"
|
||||||
import type { ListRef } from "@opencode-ai/ui/list"
|
import type { ListRef } from "@opencode-ai/ui/list"
|
||||||
import { getDirectory, getFilename } from "@opencode-ai/util/path"
|
import { getDirectory, getFilename } from "@opencode-ai/core/util/path"
|
||||||
import fuzzysort from "fuzzysort"
|
import fuzzysort from "fuzzysort"
|
||||||
import { createMemo, createResource, createSignal } from "solid-js"
|
import { createMemo, createResource, createSignal } from "solid-js"
|
||||||
import { useGlobalSDK } from "@/context/global-sdk"
|
import { useGlobalSDK } from "@/context/global-sdk"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { FileIcon } from "@opencode-ai/ui/file-icon"
|
|||||||
import { Icon } from "@opencode-ai/ui/icon"
|
import { Icon } from "@opencode-ai/ui/icon"
|
||||||
import { Keybind } from "@opencode-ai/ui/keybind"
|
import { Keybind } from "@opencode-ai/ui/keybind"
|
||||||
import { List } from "@opencode-ai/ui/list"
|
import { List } from "@opencode-ai/ui/list"
|
||||||
import { base64Encode } from "@opencode-ai/util/encode"
|
import { base64Encode } from "@opencode-ai/core/util/encode"
|
||||||
import { getDirectory, getFilename } from "@opencode-ai/util/path"
|
import { getDirectory, getFilename } from "@opencode-ai/core/util/path"
|
||||||
import { useNavigate } from "@solidjs/router"
|
import { useNavigate } from "@solidjs/router"
|
||||||
import { createMemo, createSignal, Match, onCleanup, Show, Switch } from "solid-js"
|
import { createMemo, createSignal, Match, onCleanup, Show, Switch } from "solid-js"
|
||||||
import { formatKeybind, useCommand, type CommandOption } from "@/context/command"
|
import { formatKeybind, useCommand, type CommandOption } from "@/context/command"
|
||||||
@@ -348,8 +348,8 @@ export function DialogSelectFile(props: { mode?: DialogSelectFileMode; onOpenFil
|
|||||||
|
|
||||||
const open = (path: string) => {
|
const open = (path: string) => {
|
||||||
const value = file.tab(path)
|
const value = file.tab(path)
|
||||||
tabs().open(value)
|
void tabs().open(value)
|
||||||
file.load(path)
|
void file.load(path)
|
||||||
if (!view().reviewPanel.opened()) view().reviewPanel.open()
|
if (!view().reviewPanel.opened()) view().reviewPanel.open()
|
||||||
layout.fileTree.setTab("all")
|
layout.fileTree.setTab("all")
|
||||||
props.onOpenFile?.(path)
|
props.onOpenFile?.(path)
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { useMutation } from "@tanstack/solid-query"
|
import { useMutation, useQueryClient } from "@tanstack/solid-query"
|
||||||
import { Component, createEffect, createMemo, on, Show } from "solid-js"
|
import { Component, createMemo, Show } from "solid-js"
|
||||||
import { createStore } from "solid-js/store"
|
|
||||||
import { useSync } from "@/context/sync"
|
import { useSync } from "@/context/sync"
|
||||||
import { useSDK } from "@/context/sdk"
|
import { useSDK } from "@/context/sdk"
|
||||||
import { Dialog } from "@opencode-ai/ui/dialog"
|
import { Dialog } from "@opencode-ai/ui/dialog"
|
||||||
import { List } from "@opencode-ai/ui/list"
|
import { List } from "@opencode-ai/ui/list"
|
||||||
import { Switch } from "@opencode-ai/ui/switch"
|
import { Switch } from "@opencode-ai/ui/switch"
|
||||||
import { showToast } from "@opencode-ai/ui/toast"
|
|
||||||
import { useLanguage } from "@/context/language"
|
import { useLanguage } from "@/context/language"
|
||||||
|
import { loadMcpQuery } from "@/context/global-sync"
|
||||||
|
|
||||||
const statusLabels = {
|
const statusLabels = {
|
||||||
connected: "mcp.status.connected",
|
connected: "mcp.status.connected",
|
||||||
@@ -20,48 +19,7 @@ export const DialogSelectMcp: Component = () => {
|
|||||||
const sync = useSync()
|
const sync = useSync()
|
||||||
const sdk = useSDK()
|
const sdk = useSDK()
|
||||||
const language = useLanguage()
|
const language = useLanguage()
|
||||||
const [state, setState] = createStore({
|
const queryClient = useQueryClient()
|
||||||
done: false,
|
|
||||||
loading: false,
|
|
||||||
})
|
|
||||||
|
|
||||||
createEffect(
|
|
||||||
on(
|
|
||||||
() => sync.data.mcp_ready,
|
|
||||||
(ready, prev) => {
|
|
||||||
if (!ready && prev) setState("done", false)
|
|
||||||
},
|
|
||||||
{ defer: true },
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
createEffect(() => {
|
|
||||||
if (state.done || state.loading) return
|
|
||||||
if (sync.data.mcp_ready) {
|
|
||||||
setState("done", true)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
setState("loading", true)
|
|
||||||
void sdk.client.mcp
|
|
||||||
.status()
|
|
||||||
.then((result) => {
|
|
||||||
sync.set("mcp", result.data ?? {})
|
|
||||||
sync.set("mcp_ready", true)
|
|
||||||
setState("done", true)
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
setState("done", true)
|
|
||||||
showToast({
|
|
||||||
variant: "error",
|
|
||||||
title: language.t("common.requestFailed"),
|
|
||||||
description: err instanceof Error ? err.message : String(err),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
setState("loading", false)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
const items = createMemo(() =>
|
const items = createMemo(() =>
|
||||||
Object.entries(sync.data.mcp ?? {})
|
Object.entries(sync.data.mcp ?? {})
|
||||||
@@ -71,16 +29,10 @@ export const DialogSelectMcp: Component = () => {
|
|||||||
|
|
||||||
const toggle = useMutation(() => ({
|
const toggle = useMutation(() => ({
|
||||||
mutationFn: async (name: string) => {
|
mutationFn: async (name: string) => {
|
||||||
const status = sync.data.mcp[name]
|
if (sync.data.mcp[name]?.status === "connected") await sdk.client.mcp.disconnect({ name })
|
||||||
if (status?.status === "connected") {
|
else await sdk.client.mcp.connect({ name })
|
||||||
await sdk.client.mcp.disconnect({ name })
|
|
||||||
} else {
|
|
||||||
await sdk.client.mcp.connect({ name })
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await sdk.client.mcp.status()
|
|
||||||
if (result.data) sync.set("mcp", result.data)
|
|
||||||
},
|
},
|
||||||
|
onSuccess: () => queryClient.refetchQueries({ queryKey: loadMcpQuery(sync.directory).queryKey }),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const enabledCount = createMemo(() => items().filter((i) => i.status === "connected").length)
|
const enabledCount = createMemo(() => items().filter((i) => i.status === "connected").length)
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ const ModelList: Component<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ModelSelectorTriggerProps = Omit<ComponentProps<typeof Kobalte.Trigger>, "as" | "ref">
|
type ModelSelectorTriggerProps = Omit<ComponentProps<typeof Kobalte.Trigger>, "as" | "ref">
|
||||||
|
type Dismiss = "escape" | "outside" | "select" | "manage" | "provider"
|
||||||
|
|
||||||
export function ModelSelectorPopover(props: {
|
export function ModelSelectorPopover(props: {
|
||||||
provider?: string
|
provider?: string
|
||||||
@@ -93,25 +94,31 @@ export function ModelSelectorPopover(props: {
|
|||||||
children?: JSX.Element
|
children?: JSX.Element
|
||||||
triggerAs?: ValidComponent
|
triggerAs?: ValidComponent
|
||||||
triggerProps?: ModelSelectorTriggerProps
|
triggerProps?: ModelSelectorTriggerProps
|
||||||
|
onClose?: (cause: "escape" | "select") => void
|
||||||
}) {
|
}) {
|
||||||
const [store, setStore] = createStore<{
|
const [store, setStore] = createStore<{
|
||||||
open: boolean
|
open: boolean
|
||||||
dismiss: "escape" | "outside" | null
|
dismiss: Dismiss | null
|
||||||
}>({
|
}>({
|
||||||
open: false,
|
open: false,
|
||||||
dismiss: null,
|
dismiss: null,
|
||||||
})
|
})
|
||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
|
|
||||||
const handleManage = () => {
|
const close = (dismiss: Dismiss) => {
|
||||||
|
setStore("dismiss", dismiss)
|
||||||
setStore("open", false)
|
setStore("open", false)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleManage = () => {
|
||||||
|
close("manage")
|
||||||
void import("./dialog-manage-models").then((x) => {
|
void import("./dialog-manage-models").then((x) => {
|
||||||
dialog.show(() => <x.DialogManageModels />)
|
dialog.show(() => <x.DialogManageModels />)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleConnectProvider = () => {
|
const handleConnectProvider = () => {
|
||||||
setStore("open", false)
|
close("provider")
|
||||||
void import("./dialog-select-provider").then((x) => {
|
void import("./dialog-select-provider").then((x) => {
|
||||||
dialog.show(() => <x.DialogSelectProvider />)
|
dialog.show(() => <x.DialogSelectProvider />)
|
||||||
})
|
})
|
||||||
@@ -136,21 +143,19 @@ export function ModelSelectorPopover(props: {
|
|||||||
<Kobalte.Content
|
<Kobalte.Content
|
||||||
class="w-72 h-80 flex flex-col p-2 rounded-md border border-border-base bg-surface-raised-stronger-non-alpha shadow-md z-50 outline-none overflow-hidden"
|
class="w-72 h-80 flex flex-col p-2 rounded-md border border-border-base bg-surface-raised-stronger-non-alpha shadow-md z-50 outline-none overflow-hidden"
|
||||||
onEscapeKeyDown={(event) => {
|
onEscapeKeyDown={(event) => {
|
||||||
setStore("dismiss", "escape")
|
close("escape")
|
||||||
setStore("open", false)
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
}}
|
}}
|
||||||
onPointerDownOutside={() => {
|
onPointerDownOutside={() => close("outside")}
|
||||||
setStore("dismiss", "outside")
|
onFocusOutside={() => close("outside")}
|
||||||
setStore("open", false)
|
|
||||||
}}
|
|
||||||
onFocusOutside={() => {
|
|
||||||
setStore("dismiss", "outside")
|
|
||||||
setStore("open", false)
|
|
||||||
}}
|
|
||||||
onCloseAutoFocus={(event) => {
|
onCloseAutoFocus={(event) => {
|
||||||
if (store.dismiss === "outside") event.preventDefault()
|
const dismiss = store.dismiss
|
||||||
|
if (dismiss === "outside") event.preventDefault()
|
||||||
|
if (dismiss === "escape" || dismiss === "select") {
|
||||||
|
event.preventDefault()
|
||||||
|
props.onClose?.(dismiss)
|
||||||
|
}
|
||||||
setStore("dismiss", null)
|
setStore("dismiss", null)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -158,7 +163,7 @@ export function ModelSelectorPopover(props: {
|
|||||||
<ModelList
|
<ModelList
|
||||||
provider={props.provider}
|
provider={props.provider}
|
||||||
model={props.model}
|
model={props.model}
|
||||||
onSelect={() => setStore("open", false)}
|
onSelect={() => close("select")}
|
||||||
class="p-1"
|
class="p-1"
|
||||||
action={
|
action={
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user