oxicode-ai 0.74.0

Unified LLM API — multi-provider streaming interface for AI coding assistants
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
syntax = "proto3";

package agent.v1;

enum AppliedAgentChange_ChangeType {
   CHANGE_TYPE_UNSPECIFIED = 0;
   CHANGE_TYPE_CREATED = 1;
   CHANGE_TYPE_MODIFIED = 2;
   CHANGE_TYPE_DELETED = 3;
}

enum MouseButton {
   MOUSE_BUTTON_UNSPECIFIED = 0;
   MOUSE_BUTTON_LEFT = 1;
   MOUSE_BUTTON_RIGHT = 2;
   MOUSE_BUTTON_MIDDLE = 3;
   MOUSE_BUTTON_BACK = 4;
   MOUSE_BUTTON_FORWARD = 5;
}

enum ScrollDirection {
   SCROLL_DIRECTION_UNSPECIFIED = 0;
   SCROLL_DIRECTION_UP = 1;
   SCROLL_DIRECTION_DOWN = 2;
   SCROLL_DIRECTION_LEFT = 3;
   SCROLL_DIRECTION_RIGHT = 4;
}

enum CursorRuleSource {
   CURSOR_RULE_SOURCE_UNSPECIFIED = 0;
   CURSOR_RULE_SOURCE_TEAM = 1;
   CURSOR_RULE_SOURCE_USER = 2;
}

enum DiagnosticSeverity {
   DIAGNOSTIC_SEVERITY_UNSPECIFIED = 0;
   DIAGNOSTIC_SEVERITY_ERROR = 1;
   DIAGNOSTIC_SEVERITY_WARNING = 2;
   DIAGNOSTIC_SEVERITY_INFORMATION = 3;
   DIAGNOSTIC_SEVERITY_HINT = 4;
}

enum RecordingMode {
   RECORDING_MODE_UNSPECIFIED = 0;
   RECORDING_MODE_START_RECORDING = 1;
   RECORDING_MODE_SAVE_RECORDING = 2;
   RECORDING_MODE_DISCARD_RECORDING = 3;
}

enum RequestedFilePathRejectedReason {
   REQUESTED_FILE_PATH_REJECTED_REASON_UNSPECIFIED = 0;
   REQUESTED_FILE_PATH_REJECTED_REASON_SLASHES_NOT_ALLOWED = 1;
}

enum PackageType {
   PACKAGE_TYPE_UNSPECIFIED = 0;
   PACKAGE_TYPE_CURSOR_PROJECT = 1;
   PACKAGE_TYPE_CURSOR_PERSONAL = 2;
   PACKAGE_TYPE_CLAUDE_SKILL = 3;
   PACKAGE_TYPE_CLAUDE_PLUGIN = 4;
}

enum SandboxPolicy_Type {
   TYPE_UNSPECIFIED = 0;
   TYPE_INSECURE_NONE = 1;
   TYPE_WORKSPACE_READWRITE = 2;
   TYPE_WORKSPACE_READONLY = 3;
}

enum TimeoutBehavior {
   TIMEOUT_BEHAVIOR_UNSPECIFIED = 0;
   TIMEOUT_BEHAVIOR_CANCEL = 1;
   TIMEOUT_BEHAVIOR_BACKGROUND = 2;
}

enum ShellAbortReason {
   SHELL_ABORT_REASON_UNSPECIFIED = 0;
   SHELL_ABORT_REASON_USER_ABORT = 1;
   SHELL_ABORT_REASON_TIMEOUT = 2;
}

enum CustomSubagentPermissionMode {
   CUSTOM_SUBAGENT_PERMISSION_MODE_UNSPECIFIED = 0;
   CUSTOM_SUBAGENT_PERMISSION_MODE_DEFAULT = 1;
   CUSTOM_SUBAGENT_PERMISSION_MODE_READONLY = 2;
}

enum TodoStatus {
   TODO_STATUS_UNSPECIFIED = 0;
   TODO_STATUS_PENDING = 1;
   TODO_STATUS_IN_PROGRESS = 2;
   TODO_STATUS_COMPLETED = 3;
   TODO_STATUS_CANCELLED = 4;
}

enum ClientOS {
   CLIENT_OS_UNSPECIFIED = 0;
   CLIENT_OS_WINDOWS = 1;
   CLIENT_OS_MACOS = 2;
   CLIENT_OS_LINUX = 3;
}

enum ArtifactUploadDispatchStatus {
   ARTIFACT_UPLOAD_DISPATCH_STATUS_UNSPECIFIED = 0;
   ARTIFACT_UPLOAD_DISPATCH_STATUS_ACCEPTED = 1;
   ARTIFACT_UPLOAD_DISPATCH_STATUS_REJECTED = 2;
   ARTIFACT_UPLOAD_DISPATCH_STATUS_SKIPPED_ALREADY_IN_PROGRESS = 3;
}

enum Frame_Kind {
   KIND_UNSPECIFIED = 0;
   KIND_REQUEST = 1;
   KIND_RESPONSE = 2;
   KIND_ERROR = 3;
}

enum BugbotDeeplinkEventKind {
   BUGBOT_DEEPLINK_EVENT_KIND_UNSPECIFIED = 0;
   BUGBOT_DEEPLINK_EVENT_KIND_CLICKED = 1;
   BUGBOT_DEEPLINK_EVENT_KIND_HANDLED_DIALOG_SHOWN = 2;
   BUGBOT_DEEPLINK_EVENT_KIND_HANDLED_CHAT_CREATED = 3;
   BUGBOT_DEEPLINK_EVENT_KIND_ERROR = 4;
   BUGBOT_DEEPLINK_EVENT_KIND_HANDLED_FIX_IN_WEB = 5;
}

message GlobToolResult {
   oneof result {
      GlobToolSuccess success = 1;
      GlobToolError error = 2;
   }
}

message GlobToolError {
   string error = 1;
}

// Only file results are needed for this tool
message GlobToolSuccess {
   string pattern = 1;
   string path = 2;
   repeated string files = 3;
   int32 total_files = 4;
   bool client_truncated = 5;
   bool ripgrep_truncated = 6;
}

message GlobToolCall {
   bytes args = 1;
   GlobToolResult result = 2;
}

message ReadLintsToolCall {
   ReadLintsToolArgs args = 1;
   ReadLintsToolResult result = 2;
}

message ReadLintsToolArgs {
   repeated string paths = 1;
}

message ReadLintsToolResult {
   oneof result {
      ReadLintsToolSuccess success = 1;
      ReadLintsToolError error = 2;
   }
}

message ReadLintsToolSuccess {
   repeated FileDiagnostics file_diagnostics = 1;
   int32 total_files = 2;
   int32 total_diagnostics = 3;
}

message FileDiagnostics {
   string path = 1;
   repeated DiagnosticItem diagnostics = 2;
   int32 diagnostics_count = 3;
}

message DiagnosticItem {
   DiagnosticSeverity severity = 1;
   DiagnosticRange range = 2;
   string message = 3;
   string source = 4;
   string code = 5;
   bool is_stale = 6;
}

message DiagnosticRange {
   Position start = 1;
   Position end = 2;
}

message ReadLintsToolError {
   string error_message = 1;
}

message McpToolError {
   string error = 1;
}

// Result for MCP tool calls (separate from exec results)
message McpToolResult {
   oneof result {
      McpSuccess success = 1;
      McpToolError error = 2;
      McpRejected rejected = 3;
      McpPermissionDenied permission_denied = 4;
   }
}

message McpToolCall {
   McpArgs args = 1;
   McpToolResult result = 2;
}

message SemSearchToolCall {
   SemSearchToolArgs args = 1;
   SemSearchToolResult result = 2;
}

message SemSearchToolArgs {
   string query = 1;
   repeated string target_directories = 2;
   string explanation = 3;
}

message SemSearchToolResult {
   oneof result {
      SemSearchToolSuccess success = 1;
      SemSearchToolError error = 2;
   }
}

message SemSearchToolSuccess {
   string results = 1;
   repeated bytes code_results = 2;
}

message SemSearchToolError {
   string error_message = 1;
}

message ListMcpResourcesToolCall {
   ListMcpResourcesExecArgs args = 1;
   ListMcpResourcesExecResult result = 2;
}

message ReadMcpResourceToolCall {
   ReadMcpResourceExecArgs args = 1;
   ReadMcpResourceExecResult result = 2;
}

message FetchToolCall {
   FetchArgs args = 1;
   FetchResult result = 2;
}

message RecordScreenToolCall {
   RecordScreenArgs args = 1;
   RecordScreenResult result = 2;
}

message WriteShellStdinToolCall {
   WriteShellStdinArgs args = 1;
   WriteShellStdinResult result = 2;
}

message ReflectArgs {
   string unexpected_action_outcomes = 1;
   string relevant_instructions = 2;
   string scenario_analysis = 3;
   string critical_synthesis = 4;
   string next_steps = 5;
   string tool_call_id = 6;
}

message ReflectResult {
   oneof result {
      ReflectSuccess success = 1;
      ReflectError error = 2;
   }
}

message ReflectSuccess {
}

message ReflectError {
   string error = 1;
}

message ReflectToolCall {
   ReflectArgs args = 1;
   ReflectResult result = 2;
}

message StartGrindExecutionArgs {
   // Optional explanation for why the agent is requesting to begin executing.
   optional string explanation = 1;
   string tool_call_id = 2;
}

message StartGrindExecutionResult {
   oneof result {
      StartGrindExecutionSuccess success = 1;
      StartGrindExecutionError error = 2;
   }
}

message StartGrindExecutionSuccess {
}

message StartGrindExecutionError {
   string error = 1;
}

message StartGrindExecutionToolCall {
   StartGrindExecutionArgs args = 1;
   StartGrindExecutionResult result = 2;
}

message StartGrindPlanningArgs {
   // Optional explanation for why the agent is requesting to return to planning.
   optional string explanation = 1;
   string tool_call_id = 2;
}

message StartGrindPlanningResult {
   oneof result {
      StartGrindPlanningSuccess success = 1;
      StartGrindPlanningError error = 2;
   }
}

message StartGrindPlanningSuccess {
}

message StartGrindPlanningError {
   string error = 1;
}

message StartGrindPlanningToolCall {
   StartGrindPlanningArgs args = 1;
   StartGrindPlanningResult result = 2;
}

// var AgentMode; (function (AgentMode) { AgentMode[AgentMode["UNSPECIFIED"] = 0] = "UNSPECIFIED"; AgentMode[AgentMode["AGENT"] = 1] = "AGENT"; AgentMode[AgentMode["ASK"] = 2] = "ASK"; AgentMode[AgentMode["PLAN"] = 3] = "PLAN"; AgentMode[AgentMode["DEBUG"] = 4] = "DEBUG"; AgentMode[AgentMode["TRIAGE"] = 5] = "TRIAGE"; AgentMode[AgentMode["PROJECT"] = 6] = "PROJECT"; })(AgentMode || (AgentMode = {})); // Retrieve enum metadata with: proto3.getEnumType(AgentMode) proto3/* int32 */.C.util.setEnumType(AgentMode, "agent.v1.AgentMode", [ { no: 0, name: "AGENT_MODE_UNSPECIFIED" }, { no: 1, name: "AGENT_MODE_AGENT" }, { no: 2, name: "AGENT_MODE_ASK" }, { no: 3, name: "AGENT_MODE_PLAN" }, { no: 4, name: "AGENT_MODE_DEBUG" }, { no: 5, name: "AGENT_MODE_TRIAGE" }, { no: 6, name: "AGENT_MODE_PROJECT" }, ]);
message TaskArgs {
   string description = 1;
   string prompt = 2;
   SubagentType subagent_type = 3;
   optional string model = 4;
   optional string resume = 5;
}

message TaskSuccess {
   repeated ConversationStep conversation_steps = 1;
   optional string agent_id = 2;
   bool is_background = 3;
   optional uint64 duration_ms = 4;
}

message TaskError {
   string error = 1;
}

message TaskResult {
   oneof result {
      TaskSuccess success = 1;
      TaskError error = 2;
   }
}

message TaskToolCall {
   TaskArgs args = 1;
   TaskResult result = 2;
}

message TaskToolCallDelta {
   InteractionUpdate interaction_update = 1;
}

// Tool messages (from tool.proto)
message ToolCall {
   oneof tool {
      ShellToolCall shell_tool_call = 1;
      DeleteToolCall delete_tool_call = 3;
      GlobToolCall glob_tool_call = 4;
      GrepToolCall grep_tool_call = 5;
      ReadToolCall read_tool_call = 8;
      UpdateTodosToolCall update_todos_tool_call = 9;
      ReadTodosToolCall read_todos_tool_call = 10;
      EditToolCall edit_tool_call = 12;
      LsToolCall ls_tool_call = 13;
      ReadLintsToolCall read_lints_tool_call = 14;
      McpToolCall mcp_tool_call = 15;
      SemSearchToolCall sem_search_tool_call = 16;
      CreatePlanToolCall create_plan_tool_call = 17;
      WebSearchToolCall web_search_tool_call = 18;
      TaskToolCall task_tool_call = 19;
      ListMcpResourcesToolCall list_mcp_resources_tool_call = 20;
      ReadMcpResourceToolCall read_mcp_resource_tool_call = 21;
      ApplyAgentDiffToolCall apply_agent_diff_tool_call = 22;
      AskQuestionToolCall ask_question_tool_call = 23;
      FetchToolCall fetch_tool_call = 24;
      SwitchModeToolCall switch_mode_tool_call = 25;
      ExaSearchToolCall exa_search_tool_call = 26;
      ExaFetchToolCall exa_fetch_tool_call = 27;
      GenerateImageToolCall generate_image_tool_call = 28;
      RecordScreenToolCall record_screen_tool_call = 29;
      ComputerUseToolCall computer_use_tool_call = 30;
      WriteShellStdinToolCall write_shell_stdin_tool_call = 31;
      ReflectToolCall reflect_tool_call = 32;
      SetupVmEnvironmentToolCall setup_vm_environment_tool_call = 33;
      TruncatedToolCall truncated_tool_call = 34;
      StartGrindExecutionToolCall start_grind_execution_tool_call = 35;
      StartGrindPlanningToolCall start_grind_planning_tool_call = 36;
   }
}

message TruncatedToolCallArgs {
}

message TruncatedToolCallSuccess {
}

message TruncatedToolCallError {
   string error = 1;
}

message TruncatedToolCallResult {
   oneof result {
      TruncatedToolCallSuccess success = 1;
      TruncatedToolCallError error = 2;
   }
}

// Placeholder for tool calls that were truncated due to size limits.
message TruncatedToolCall {
   bytes original_step_blob_id = 1;
   // unused, just matches the discriminated union for other tool calls
   TruncatedToolCallArgs args = 2;
   TruncatedToolCallResult result = 3;
}

message ToolCallDelta {
   oneof delta {
      ShellToolCallDelta shell_tool_call_delta = 1;
      TaskToolCallDelta task_tool_call_delta = 2;
      EditToolCallDelta edit_tool_call_delta = 3;
   }
}

message ConversationStep {
   oneof message {
      AssistantMessage assistant_message = 1;
      ToolCall tool_call = 2;
      ThinkingMessage thinking_message = 3;
   }
}

message ConversationAction {
   oneof action {
      UserMessageAction user_message_action = 1;
      ResumeAction resume_action = 2;
      CancelAction cancel_action = 3;
      SummarizeAction summarize_action = 4;
      ShellCommandAction shell_command_action = 5;
      StartPlanAction start_plan_action = 6;
      ExecutePlanAction execute_plan_action = 7;
      AsyncAskQuestionCompletionAction async_ask_question_completion_action = 8;
   }
}

message UserMessageAction {
   UserMessage user_message = 1;
   RequestContext request_context = 2;
   optional bool send_to_interaction_listener = 3;
}

message CancelAction {
}

message ResumeAction {
   RequestContext request_context = 2;
}

message AsyncAskQuestionCompletionAction {
   // Contains the original tool call ID and the result from the user
   string original_tool_call_id = 1;
   AskQuestionArgs original_args = 2;
   AskQuestionResult result = 3;
}

message SummarizeAction {
}

message ShellCommandAction {
   ShellCommand shell_command = 1;
   // unique identifier for preemptive exec attachment
   string exec_id = 2;
}

message StartPlanAction {
   UserMessage user_message = 1;
   RequestContext request_context = 2;
   bool is_spec = 3;
}

message ExecutePlanAction {
   RequestContext request_context = 1;
   optional ConversationPlan plan = 2;
   // e.g., "cursor-plan://composerId/plan.md"
   optional string plan_file_uri = 3;
   // The actual plan content from the file
   optional string plan_file_content = 4;
}

message UserMessage {
   string text = 1;
   string message_id = 2;
   optional SelectedContext selected_context = 3;
   int32 mode = 4;
   optional bool is_simulated_msg = 5;
   optional string best_of_n_group_id = 6;
   optional bool try_use_best_of_n_promotion = 7;
   optional string rich_text = 8;
}

message AssistantMessage {
   string text = 1;
}

message ThinkingMessage {
   string text = 1;
   uint32 duration_ms = 2;
}

message ShellCommand {
   string command = 1;
}

message ShellOutput {
   string stdout = 1;
   string stderr = 2;
   int32 exit_code = 3;
}

message ConversationTurn {
   oneof turn {
      AgentConversationTurn agent_conversation_turn = 1;
      ShellConversationTurn shell_conversation_turn = 2;
   }
}

message ConversationPlan {
   string plan = 1;
}

message ConversationTurnStructure {
   oneof turn {
      AgentConversationTurnStructure agent_conversation_turn = 1;
      ShellConversationTurnStructure shell_conversation_turn = 2;
   }
}

message AgentConversationTurn {
   UserMessage user_message = 1;
   repeated ConversationStep steps = 2;
   // The request ID associated with this turn, used for analytics tracking
   optional string request_id = 3;
}

message AgentConversationTurnStructure {
   bytes user_message = 1;
   repeated bytes steps = 2;
   // The request ID associated with this turn, used for analytics tracking
   optional string request_id = 3;
}

message ShellConversationTurn {
   ShellCommand shell_command = 1;
   ShellOutput shell_output = 2;
}

message ShellConversationTurnStructure {
   bytes shell_command = 1;
   bytes shell_output = 2;
}

message ConversationSummary {
   string summary = 1;
}

message ConversationSummaryArchive {
   repeated bytes summarized_messages = 1;
   string summary = 2;
   uint32 window_tail = 3;
   bytes summary_message = 4;
}

message ConversationTokenDetails {
   uint32 used_tokens = 1;
   uint32 max_tokens = 2;
}

message FileState {
   // Optional content. If not set or undefined, the file is considered deleted.
   optional string content = 1;
   // Optional initial content captured when the file was first tracked. If not set or undefined, the file did not exist when tracking began.
   optional string initial_content = 2;
}

message FileStateStructure {
   // Optional content. If not set or undefined, the file is considered deleted.
   optional bytes content = 1;
   // Optional initial content captured when the file was first tracked. If not set or undefined, the file did not exist when tracking began.
   optional bytes initial_content = 2;
}

message StepTiming {
   uint64 duration_ms = 1;
   uint64 timestamp_ms = 2;
}

message ConversationState {
   repeated string root_prompt_messages_json = 1;
   repeated ConversationTurn turns = 8;
   repeated TodoItem todos = 3;
   // Raw JSON stringified tool-call content parts awaiting execution
   repeated string pending_tool_calls = 4;
   ConversationTokenDetails token_details = 5;
   // only for when the user explicitly asks for a summary through the summary action
   optional ConversationSummary summary = 6;
   optional ConversationPlan plan = 7;
   optional ConversationSummaryArchive summary_archive = 9;
   // Deprecated, use summary_archives instead @deprecated summaryArchive;
   map<string, FileState> file_states = 10;
   repeated ConversationSummaryArchive summary_archives = 11;
}

message SubagentPersistedState {
   // The subagent's conversation state structure
   ConversationStateStructure conversation_state = 1;
   // Timestamp when this subagent was first created
   uint64 created_timestamp_ms = 2;
   // Timestamp when this subagent was last used (by task tool call)
   uint64 last_used_timestamp_ms = 3;
   // The subagent type (e.g., computerUse, custom with name)
   SubagentType subagent_type = 4;
}

message ConversationStateStructure {
   repeated bytes turns_old = 2;
   // @deprecated turnsOld = [];
   repeated bytes root_prompt_messages_json = 1;
   repeated bytes turns = 8;
   repeated bytes todos = 3;
   // Raw JSON stringified tool-call content parts awaiting execution
   repeated string pending_tool_calls = 4;
   ConversationTokenDetails token_details = 5;
   // only for when the user explicitly asks for a summary through the summary action
   optional bytes summary = 6;
   optional bytes plan = 7;
   repeated string previous_workspace_uris = 9;
   // Current mode of the conversation
   optional int32 mode = 10;
   optional bytes summary_archive = 11;
   map<string, bytes> file_states = 12;
   // Deprecated, use summary_archives instead @deprecated summaryArchive; Map of file paths to their latest content (stored as blob IDs in the KV store) Each blob contains a serialized FileState message @deprecated fileStates = {}; Map of file paths to their latest content (stored as FileStateStructure)
   map<string, FileStateStructure> file_states_v2 = 15;
   repeated bytes summary_archives = 13;
   repeated StepTiming turn_timings = 14;
   // Subagent resume tracking Map of subagent ID to the persisted subagent state (stored inline)
   map<string, SubagentPersistedState> subagent_states = 16;
   // Count of self-summaries generated for this conversation
   uint32 self_summary_count = 17;
   // Set of file paths that have been read during this conversation
   repeated string read_paths = 18;
}

message ThinkingDetails {
}

message ApiKeyCredentials {
   string api_key = 1;
   // For OpenAI-compatible endpoints
   optional string base_url = 2;
}

message AzureCredentials {
   string api_key = 1;
   string base_url = 2;
   string deployment = 3;
}

message BedrockCredentials {
   string access_key = 1;
   string secret_key = 2;
   string region = 3;
   optional string session_token = 4;
}

message ModelDetails {
   string model_id = 1;
   string display_model_id = 3;
   string display_name = 4;
   string display_name_short = 5;
   repeated string aliases = 6;
   optional ThinkingDetails thinking_details = 2;
   optional bool max_mode = 7;
   oneof credentials {
      ApiKeyCredentials api_key_credentials = 8;
      AzureCredentials azure_credentials = 9;
      BedrockCredentials bedrock_credentials = 10;
   }
}

message RequestedModel {
   string model_id = 1;
   bool max_mode = 2;
   repeated RequestedModel_ModelParameterbytes parameters = 3;
   oneof credentials {
      ApiKeyCredentials api_key_credentials = 4;
      AzureCredentials azure_credentials = 5;
      BedrockCredentials bedrock_credentials = 6;
   }
}

message RequestedModel_ModelParameterbytes {
   string id = 1;
   // All paramters are encoded as strings. For boolean parameters, the value is either "true" or "false". For enum parameters, the value is one of the values in the enum.
   string value = 2;
}

message AgentRunRequest {
   ConversationStateStructure conversation_state = 1;
   ConversationAction action = 2;
   // TODO: Today we use model_details, but we are getting ready to deprecate that and use requested_model instead.
   ModelDetails model_details = 3;
   optional RequestedModel requested_model = 9;
   McpTools mcp_tools = 4;
   optional string conversation_id = 5;
   optional McpFileSystemOptions mcp_file_system_options = 6;
   // Deprecated, use the one in RequestContext message in request_context_exec.proto instead
   optional SkillOptions skill_options = 7;
   // Custom system prompt override. Allowlisted for specific teams only.
   optional string custom_system_prompt = 8;
}

message TextDeltaUpdate {
   string text = 1;
}

message ToolCallStartedUpdate {
   string call_id = 1;
   ToolCall tool_call = 2;
   // groups tool calls that originate from the same model provider call
   string model_call_id = 3;
}

message ToolCallCompletedUpdate {
   string call_id = 1;
   ToolCall tool_call = 2;
   // groups tool calls that originate from the same model provider call
   string model_call_id = 3;
}

message ToolCallDeltaUpdate {
   string call_id = 1;
   ToolCallDelta tool_call_delta = 2;
   // groups tool calls that originate from the same model provider call
   string model_call_id = 3;
}

// Streaming update for partial tool call arguments
message PartialToolCallUpdate {
   string call_id = 1;
   ToolCall tool_call = 2;
   // Aggregated args text so far (as JSON text). May be incomplete until final tool call.
   string args_text_delta = 3;
   // groups tool calls that originate from the same model provider call
   string model_call_id = 4;
}

message ThinkingDeltaUpdate {
   string text = 1;
}

message ThinkingCompletedUpdate {
   int32 thinking_duration_ms = 1;
}

message TokenDeltaUpdate {
   int32 tokens = 1;
}

message SummaryUpdate {
   string summary = 1;
}

message SummaryStartedUpdate {
}

message HeartbeatUpdate {
}

message SummaryCompletedUpdate {
}

message ShellOutputDeltaUpdate {
   oneof event {
      ShellStreamStdout stdout = 1;
      ShellStreamStderr stderr = 2;
      ShellStreamExit exit = 3;
      ShellStreamStart start = 4;
   }
}

message TurnEndedUpdate {
}

// Only: user message appended update
message UserMessageAppendedUpdate {
   UserMessage user_message = 1;
}

message StepStartedUpdate {
   uint64 step_id = 1;
}

message StepCompletedUpdate {
   uint64 step_id = 1;
   int64 step_duration_ms = 2;
}

message InteractionUpdate {
   oneof message {
      TextDeltaUpdate text_delta = 1;
      PartialToolCallUpdate partial_tool_call = 7;
      ToolCallDeltaUpdate tool_call_delta = 15;
      ToolCallStartedUpdate tool_call_started = 2;
      ToolCallCompletedUpdate tool_call_completed = 3;
      ThinkingDeltaUpdate thinking_delta = 4;
      ThinkingCompletedUpdate thinking_completed = 5;
      UserMessageAppendedUpdate user_message_appended = 6;
      TokenDeltaUpdate token_delta = 8;
      SummaryUpdate summary = 9;
      SummaryStartedUpdate summary_started = 10;
      SummaryCompletedUpdate summary_completed = 11;
      ShellOutputDeltaUpdate shell_output_delta = 12;
      HeartbeatUpdate heartbeat = 13;
      TurnEndedUpdate turn_ended = 14;
      StepStartedUpdate step_started = 16;
      StepCompletedUpdate step_completed = 17;
   }
}

// Interaction query messages for bidirectional communication
message InteractionQuery {
   uint32 id = 1;
   oneof query {
      WebSearchRequestQuery web_search_request_query = 2;
      AskQuestionInteractionQuery ask_question_interaction_query = 3;
      SwitchModeRequestQuery switch_mode_request_query = 4;
      ExaSearchRequestQuery exa_search_request_query = 5;
      ExaFetchRequestQuery exa_fetch_request_query = 6;
      CreatePlanRequestQuery create_plan_request_query = 7;
      SetupVmEnvironmentArgs setup_vm_environment_args = 8;
   }
}

message InteractionResponse {
   uint32 id = 1;
   oneof result {
      WebSearchRequestResponse web_search_request_response = 2;
      AskQuestionInteractionResponse ask_question_interaction_response = 3;
      SwitchModeRequestResponse switch_mode_request_response = 4;
      ExaSearchRequestResponse exa_search_request_response = 5;
      ExaFetchRequestResponse exa_fetch_request_response = 6;
      CreatePlanRequestResponse create_plan_request_response = 7;
      SetupVmEnvironmentResult setup_vm_environment_result = 8;
   }
}

message AskQuestionInteractionQuery {
   AskQuestionArgs args = 1;
   string tool_call_id = 2;
}

message AskQuestionInteractionResponse {
   AskQuestionResult result = 1;
}

message ClientHeartbeat {
}

// Prewarm request - sent before the actual action to prepare the backend Contains all config needed for auth, model routing, and session building The actual ConversationAction is sent separately after prewarming completes
message PrewarmRequest {
   ModelDetails model_details = 1;
   optional RequestedModel requested_model = 9;
   optional string conversation_id = 2;
   ConversationStateStructure conversation_state = 3;
   McpTools mcp_tools = 4;
   optional McpFileSystemOptions mcp_file_system_options = 5;
   // Best-of-N context for usage billing (same fields as UserMessage)
   optional string best_of_n_group_id = 6;
   optional bool try_use_best_of_n_promotion = 7;
   // Custom system prompt override. Allowlisted for specific teams only.
   optional string custom_system_prompt = 8;
}

message ExecServerAbort {
   uint32 id = 1;
}

message ExecServerControlMessage {
   oneof message {
      ExecServerAbort abort = 1;
   }
}

message AgentClientMessage {
   oneof message {
      AgentRunRequest run_request = 1;
      ExecClientMessage exec_client_message = 2;
      ExecClientControlMessage exec_client_control_message = 5;
      KvClientMessage kv_client_message = 3;
      ConversationAction conversation_action = 4;
      InteractionResponse interaction_response = 6;
      ClientHeartbeat client_heartbeat = 7;
      PrewarmRequest prewarm_request = 8;
   }
}

message AgentServerMessage {
   oneof message {
      InteractionUpdate interaction_update = 1;
      ExecServerMessage exec_server_message = 2;
      ExecServerControlMessage exec_server_control_message = 5;
      ConversationStateStructure conversation_checkpoint_update = 3;
      KvServerMessage kv_server_message = 4;
      InteractionQuery interaction_query = 7;
   }
}

// New unary API for naming an agent from a user message
message NameAgentRequest {
   string user_message = 1;
}

message NameAgentResponse {
   string name = 1;
}

message GetUsableModelsRequest {
   // Not used right now, but can use to populate info about custom models the user passes in that we don't send down by default
   repeated string custom_model_ids = 1;
}

message GetUsableModelsResponse {
   repeated ModelDetails models = 1;
}

message GetDefaultModelForCliRequest {
}

message GetDefaultModelForCliResponse {
   ModelDetails model = 1;
}

// Internal endpoint: returns all allowed model intents for devs
message GetAllowedModelIntentsRequest {
}

message GetAllowedModelIntentsResponse {
   repeated string model_intents = 1;
}

// IDE state persistence for clients (CLI / VSCode integration) Mirrors a subset of aiserver.v1.ConversationMessage.IdeEditorsState, but only contains the recently viewed files and avoids any deprecated fields.
message IdeEditorsStateFile {
   string relative_path = 1;
   string absolute_path = 2;
   optional bool is_currently_focused = 3;
   optional int32 current_line_number = 4;
   optional string current_line_text = 5;
   optional int32 line_count = 6;
}

message IdeEditorsStateLite {
   repeated IdeEditorsStateFile recently_viewed_files = 1;
}

message ApplyAgentDiffToolCall {
   ApplyAgentDiffArgs args = 1;
   ApplyAgentDiffResult result = 2;
}

message ApplyAgentDiffArgs {
   string agent_id = 1;
}

message ApplyAgentDiffResult {
   oneof result {
      ApplyAgentDiffSuccess success = 1;
      ApplyAgentDiffError error = 2;
   }
}

message ApplyAgentDiffSuccess {
   repeated AppliedAgentChange applied_changes = 1;
}

message AppliedAgentChange {
   string path = 1;
   int32 change_type = 2;
   optional string before_content = 3;
   optional string after_content = 4;
   optional string error = 5;
   // Detailed result message from the execution (e.g., "Successfully deleted file: path (123 bytes)")
   optional string message_for_model = 6;
}

message ApplyAgentDiffError {
   string error = 1;
   repeated AppliedAgentChange applied_changes = 2;
}

message AskQuestionToolCall {
   AskQuestionArgs args = 1;
   AskQuestionResult result = 2;
}

message AskQuestionArgs {
   // optional form title
   string title = 1;
   // 1+ questions
   repeated AskQuestionArgs_Question questions = 2;
   // if true, return immediately with async marker instead of blocking
   bool run_async = 5;
   // if set, indicates this is a synthetic completion for the original async tool call with this ID
   string async_original_tool_call_id = 6;
}

message AskQuestionArgs_Question {
   // unique, model-provided
   string id = 1;
   // the question text
   string prompt = 2;
   // choices
   repeated AskQuestionArgs_Option options = 3;
   // multi-select vs single-select
   bool allow_multiple = 4;
}

message AskQuestionArgs_Option {
   // stable option id
   string id = 1;
   // display text
   string label = 2;
}

// Marker indicating that questions have been sent asynchronously Answers will arrive later as a separate ask_question tool call
message AskQuestionAsync {
}

message AskQuestionResult {
   oneof result {
      AskQuestionSuccess success = 1;
      AskQuestionError error = 2;
      AskQuestionRejected rejected = 3;
      AskQuestionAsync async = 4;
   }
}

message AskQuestionSuccess {
   repeated AskQuestionSuccess_Answer answers = 1;
}

message AskQuestionSuccess_Answer {
   string question_id = 1;
   // empty if unanswered
   repeated string selected_option_ids = 2;
}

message AskQuestionError {
   string error_message = 1;
}

message AskQuestionRejected {
   string reason = 1;
}

message BackgroundShellSpawnArgs {
   string command = 1;
   string working_directory = 2;
   string tool_call_id = 3;
   ShellCommandParsingResult parsing_result = 4;
   optional SandboxPolicy sandbox_policy = 5;
   bool enable_write_shell_stdin_tool = 6;
}

// Result of spawning a background shell
message BackgroundShellSpawnResult {
   oneof result {
      BackgroundShellSpawnSuccess success = 1;
      BackgroundShellSpawnError error = 2;
      ShellRejected rejected = 3;
      ShellPermissionDenied permission_denied = 4;
   }
}

message BackgroundShellSpawnSuccess {
   uint32 shell_id = 1;
   string command = 2;
   string working_directory = 3;
   // Process ID of the spawned shell
   optional uint32 pid = 4;
}

message BackgroundShellSpawnError {
   string command = 1;
   string working_directory = 2;
   string error = 3;
}

message WriteShellStdinArgs {
   uint32 shell_id = 1;
   string chars = 2;
}

message WriteShellStdinResult {
   oneof result {
      WriteShellStdinSuccess success = 1;
      WriteShellStdinError error = 2;
   }
}

message WriteShellStdinSuccess {
   uint32 shell_id = 1;
   uint32 terminal_file_length_before_input_written = 2;
}

message WriteShellStdinError {
   string error = 1;
}

message Coordinate {
   int32 x = 1;
   int32 y = 2;
}

// Arguments for the computer-use tool
message ComputerUseArgs {
   string tool_call_id = 1;
   repeated ComputerUseAction actions = 2;
}

// A single computer-use action. This is our internal canonical representation. Provider-specific formats are converted to this by adapters.
message ComputerUseAction {
   oneof action {
      MouseMoveAction mouse_move = 1;
      ClickAction click = 2;
      MouseDownAction mouse_down = 3;
      MouseUpAction mouse_up = 4;
      DragAction drag = 5;
      ScrollAction scroll = 6;
      TypeAction type = 7;
      KeyAction key = 8;
      WaitAction wait = 9;
      ScreenshotAction screenshot = 10;
      CursorPositionAction cursor_position = 11;
   }
}

// Move mouse to coordinate (required)
message MouseMoveAction {
   Coordinate coordinate = 1;
}

// Unified click action - coordinate: optional, clicks at current cursor if omitted - button: which mouse button (default: LEFT) - count: click count (1=single, 2=double, 3=triple, default: 1) - modifier_keys: optional, held during click (e.g., "ctrl", "shift", "ctrl+shift")
message ClickAction {
   optional Coordinate coordinate = 1;
   int32 button = 2;
   int32 count = 3;
   optional string modifier_keys = 4;
}

// Press mouse button down (for fine-grained drag control)
message MouseDownAction {
   int32 button = 1;
}

// Release mouse button (for fine-grained drag control)
message MouseUpAction {
   int32 button = 1;
}

// Drag action - path of coordinates (at least 2 points: [start, ..., end])
message DragAction {
   repeated Coordinate path = 1;
   int32 button = 2;
}

// Scroll action - coordinate: optional, scrolls at current cursor if omitted - direction: scroll direction (required) - amount: number of scroll "clicks" (default: 3) - modifier_keys: optional, held during scroll (e.g., "ctrl" for zoom)
message ScrollAction {
   optional Coordinate coordinate = 1;
   int32 direction = 2;
   int32 amount = 3;
   optional string modifier_keys = 4;
}

// Type text
message TypeAction {
   string text = 1;
}

// Press key or key combination (xdotool-style: "ctrl+a", "Return", "Alt+Left") If hold_duration_ms is set, holds the key for that duration
message KeyAction {
   string key = 1;
   optional int32 hold_duration_ms = 2;
}

// Wait for a duration
message WaitAction {
   int32 duration_ms = 1;
}

// Take a screenshot
message ScreenshotAction {
}

// Get current cursor position
message CursorPositionAction {
}

// Result of computer-use execution
message ComputerUseResult {
   oneof result {
      ComputerUseSuccess success = 1;
      ComputerUseError error = 2;
   }
}

message ComputerUseSuccess {
   int32 action_count = 1;
   int32 duration_ms = 2;
   // Base64 WebP at API resolution
   optional string screenshot = 3;
   optional string log = 4;
   optional string screenshot_path = 5;
   // In API resolution
   optional Coordinate cursor_position = 6;
}

message ComputerUseError {
   string error = 1;
   int32 action_count = 2;
   int32 duration_ms = 3;
   optional string log = 4;
   // Base64 WebP of screen state at error time
   optional string screenshot = 5;
   // Path where screenshot was saved
   optional string screenshot_path = 6;
}

message ComputerUseToolCall {
   ComputerUseArgs args = 1;
   ComputerUseResult result = 2;
}

message CreatePlanToolCall {
   CreatePlanArgs args = 1;
   CreatePlanResult result = 2;
}

// A phase groups related todos together for project-mode plans
message Phase {
   string name = 1;
   repeated TodoItem todos = 2;
}

message CreatePlanArgs {
   string plan = 1;
   repeated TodoItem todos = 2;
   string overview = 3;
   string name = 4;
   // When true, uses phases instead of flat todos (mutually exclusive)
   bool is_project = 5;
   // Implementation phases (only valid when is_project=true)
   repeated Phase phases = 6;
}

message CreatePlanResult {
   // URI of the plan file (returned when file_based_plan_edits is enabled)
   string plan_uri = 3;
   oneof result {
      CreatePlanSuccess success = 1;
      CreatePlanError error = 2;
   }
}

message CreatePlanSuccess {
}

message CreatePlanError {
   string error = 1;
}

// Query sent from server to client to create a plan file
message CreatePlanRequestQuery {
   CreatePlanArgs args = 1;
   string tool_call_id = 2;
}

// Response from client with the created plan URI
message CreatePlanRequestResponse {
   CreatePlanResult result = 1;
}

message CursorRuleTypeGlobal {
}

message CursorRuleTypeFileGlobs {
   repeated string globs = 1;
}

message CursorRuleTypeAgentFetched {
   string description = 1;
}

message CursorRuleTypeManuallyAttached {
}

message CursorRuleType {
   oneof type {
      CursorRuleTypeGlobal global = 1;
      CursorRuleTypeFileGlobs file_globbed = 2;
      CursorRuleTypeAgentFetched agent_fetched = 3;
      CursorRuleTypeManuallyAttached manually_attached = 4;
   }
}

message CursorRule {
   // absolute path to the .mdc file
   string full_path = 1;
   // rule body, trimmed to reasonable size if needed by client
   string content = 2;
   // classification of rule
   CursorRuleType type = 3;
   // source of the rule
   int32 source = 4;
   // Git remote origin URL for the repository containing this rule, if available. Normalized to host/path format (e.g., "github.com/owner/repo").
   optional string git_remote_origin = 5;
   optional string parse_error = 6;
}

message DeleteArgs {
   string path = 1;
   string tool_call_id = 2;
}

message DeleteResult {
   oneof result {
      DeleteSuccess success = 1;
      DeleteFileNotFound file_not_found = 2;
      DeleteNotFile not_file = 3;
      DeletePermissionDenied permission_denied = 4;
      DeleteFileBusy file_busy = 5;
      DeleteRejected rejected = 6;
      DeleteError error = 7;
   }
}

message DeleteSuccess {
   string path = 1;
   string deleted_file = 2;
   int64 file_size = 3;
   string prev_content = 4;
}

message DeleteFileNotFound {
   string path = 1;
}

message DeleteNotFile {
   string path = 1;
   // "directory" or "other"
   string actual_type = 2;
}

message DeletePermissionDenied {
   string path = 1;
   string client_visible_error = 2;
   bool is_readonly = 3;
}

message DeleteFileBusy {
   string path = 1;
}

message DeleteRejected {
   string path = 1;
   string reason = 2;
}

message DeleteError {
   string path = 1;
   string error = 2;
}

message DeleteToolCall {
   DeleteArgs args = 1;
   DeleteResult result = 2;
}

message DiagnosticsArgs {
   string path = 1;
   string tool_call_id = 2;
}

message DiagnosticsResult {
   oneof result {
      DiagnosticsSuccess success = 1;
      DiagnosticsError error = 2;
      DiagnosticsRejected rejected = 3;
      DiagnosticsFileNotFound file_not_found = 4;
      DiagnosticsPermissionDenied permission_denied = 5;
   }
}

message DiagnosticsSuccess {
   string path = 1;
   repeated Diagnostic diagnostics = 2;
   int32 total_diagnostics = 3;
}

message Diagnostic {
   int32 severity = 1;
   Range range = 2;
   string message = 3;
   string source = 4;
   string code = 5;
   bool is_stale = 6;
}

message DiagnosticsError {
   string path = 1;
   string error = 2;
}

message DiagnosticsRejected {
   string path = 1;
   string reason = 2;
}

message DiagnosticsFileNotFound {
   string path = 1;
}

message DiagnosticsPermissionDenied {
   string path = 1;
}

message EditArgs {
   string path = 1;
   optional string stream_content = 6;
}

message EditResult {
   oneof result {
      EditSuccess success = 1;
      EditFileNotFound file_not_found = 2;
      EditReadPermissionDenied read_permission_denied = 3;
      EditWritePermissionDenied write_permission_denied = 4;
      EditRejected rejected = 6;
      EditError error = 7;
   }
}

message EditSuccess {
   string path = 1;
   optional int32 lines_added = 3;
   optional int32 lines_removed = 4;
   // Concatenated chunk diff strings separated by "\n...\n"
   optional string diff_string = 5;
   // undefined if file didn't exist before the edit
   optional string before_full_file_content = 6;
   string after_full_file_content = 7;
   // Formatted message for display to model (resultForModel from EditTransformResult)
   optional string message = 8;
}

message EditFileNotFound {
   string path = 1;
}

message EditReadPermissionDenied {
   string path = 1;
}

message EditWritePermissionDenied {
   string path = 1;
   string error = 2;
   bool is_readonly = 3;
}

message EditRejected {
   string path = 1;
   string reason = 2;
}

message EditError {
   string path = 1;
   string error = 2;
   optional string model_visible_error = 5;
}

message EditToolCall {
   EditArgs args = 1;
   EditResult result = 2;
}

message EditToolCallDelta {
   string stream_content_delta = 1;
}

message ExaFetchArgs {
   repeated string ids = 1;
   string tool_call_id = 2;
}

message ExaFetchResult {
   oneof result {
      ExaFetchSuccess success = 1;
      ExaFetchError error = 2;
      ExaFetchRejected rejected = 3;
   }
}

message ExaFetchSuccess {
   repeated ExaFetchContent contents = 1;
}

message ExaFetchError {
   string error = 1;
}

message ExaFetchRejected {
   string reason = 1;
}

message ExaFetchContent {
   string title = 1;
   string url = 2;
   string text = 3;
   string published_date = 4;
}

message ExaFetchToolCall {
   ExaFetchArgs args = 1;
   ExaFetchResult result = 2;
}

message ExaFetchRequestQuery {
   ExaFetchArgs args = 1;
}

message ExaFetchRequestResponse {
   oneof result {
      ExaFetchRequestResponse_Approved approved = 1;
      ExaFetchRequestResponse_Rejected rejected = 2;
   }
}

message ExaFetchRequestResponse_Approved {
}

message ExaFetchRequestResponse_Rejected {
   string reason = 1;
}

message ExaSearchArgs {
   string query = 1;
   // "auto", "neural", or "keyword"
   string type = 2;
   int32 num_results = 3;
   string tool_call_id = 4;
}

message ExaSearchResult {
   oneof result {
      ExaSearchSuccess success = 1;
      ExaSearchError error = 2;
      ExaSearchRejected rejected = 3;
   }
}

message ExaSearchSuccess {
   repeated ExaSearchReference references = 1;
}

message ExaSearchError {
   string error = 1;
}

message ExaSearchRejected {
   string reason = 1;
}

message ExaSearchReference {
   string title = 1;
   string url = 2;
   string text = 3;
   string published_date = 4;
}

message ExaSearchToolCall {
   ExaSearchArgs args = 1;
   ExaSearchResult result = 2;
}

message ExaSearchRequestQuery {
   ExaSearchArgs args = 1;
}

message ExaSearchRequestResponse {
   oneof result {
      ExaSearchRequestResponse_Approved approved = 1;
      ExaSearchRequestResponse_Rejected rejected = 2;
   }
}

message ExaSearchRequestResponse_Approved {
}

message ExaSearchRequestResponse_Rejected {
   string reason = 1;
}

message ExecClientStreamClose {
   uint32 id = 1;
}

message ExecClientThrow {
   uint32 id = 1;
   string error = 2;
   optional string stack_trace = 3;
}

message ExecClientHeartbeat {
   uint32 id = 1;
}

message ExecClientControlMessage {
   oneof message {
      ExecClientStreamClose stream_close = 1;
      ExecClientThrow throw = 2;
      ExecClientHeartbeat heartbeat = 3;
   }
}

// Simplified span context for tracing exec calls
message SpanContext {
   // Trace identifier (128-bit as hex string, same for all spans in a trace)
   string trace_id = 1;
   // Unique span identifier (64-bit as hex string)
   string span_id = 2;
   // Trace flags bit field following OTEL SPAN_FLAGS_* semantics
   optional uint32 trace_flags = 3;
   // W3C trace-state header string (optional)
   optional string trace_state = 4;
}

// Empty abort message for aborting running execs
message AbortArgs {
}

message AbortResult {
}

message ExecServerMessage {
   uint32 id = 1;
   // Optional exec ID for attachable executions
   string exec_id = 15;
   // Optional parent span context for tracing
   optional SpanContext span_context = 19;
   oneof message {
      ShellArgs shell_args = 2;
      WriteArgs write_args = 3;
      DeleteArgs delete_args = 4;
      GrepArgs grep_args = 5;
      ReadArgs read_args = 7;
      LsArgs ls_args = 8;
      DiagnosticsArgs diagnostics_args = 9;
      RequestContextArgs request_context_args = 10;
      McpArgs mcp_args = 11;
      ShellArgs shell_stream_args = 14;
      BackgroundShellSpawnArgs background_shell_spawn_args = 16;
      ListMcpResourcesExecArgs list_mcp_resources_exec_args = 17;
      ReadMcpResourceExecArgs read_mcp_resource_exec_args = 18;
      FetchArgs fetch_args = 20;
      RecordScreenArgs record_screen_args = 21;
      ComputerUseArgs computer_use_args = 22;
      WriteShellStdinArgs write_shell_stdin_args = 23;
   }
}

message ExecClientMessage {
   uint32 id = 1;
   // Optional exec ID for attachable executions
   string exec_id = 15;
   oneof message {
      ShellResult shell_result = 2;
      WriteResult write_result = 3;
      DeleteResult delete_result = 4;
      GrepResult grep_result = 5;
      ReadResult read_result = 7;
      LsResult ls_result = 8;
      DiagnosticsResult diagnostics_result = 9;
      RequestContextResult request_context_result = 10;
      McpResult mcp_result = 11;
      ShellStream shell_stream = 14;
      BackgroundShellSpawnResult background_shell_spawn_result = 16;
      ListMcpResourcesExecResult list_mcp_resources_exec_result = 17;
      ReadMcpResourceExecResult read_mcp_resource_exec_result = 18;
      FetchResult fetch_result = 20;
      RecordScreenResult record_screen_result = 21;
      ComputerUseResult computer_use_result = 22;
      WriteShellStdinResult write_shell_stdin_result = 23;
   }
}

message FetchArgs {
   string url = 1;
   string tool_call_id = 2;
}

message FetchResult {
   oneof result {
      FetchSuccess success = 1;
      FetchError error = 2;
   }
}

message FetchSuccess {
   string url = 1;
   string content = 2;
   int32 status_code = 3;
   string content_type = 4;
}

message FetchError {
   string url = 1;
   string error = 2;
}

message GenerateImageArgs {
   string description = 1;
   optional string file_path = 2;
   // Optional paths to reference images to use as input for image-to-image generation
   repeated string reference_image_paths = 5;
}

message GenerateImageResult {
   oneof result {
      GenerateImageSuccess success = 1;
      GenerateImageError error = 2;
   }
}

message GenerateImageSuccess {
   // Actual file path where the image was saved (e.g., /path/to/project/assets/image.png)
   string file_path = 1;
   // Base64-encoded image data
   string image_data = 2;
}

message GenerateImageError {
   string error = 1;
}

message GenerateImageToolCall {
   GenerateImageArgs args = 1;
   GenerateImageResult result = 2;
}

message GrepArgs {
   string pattern = 1;
   optional string path = 2;
   optional string glob = 3;
   // "content", "files_with_matches", "count"
   optional string output_mode = 4;
   optional int32 context_before = 5;
   optional int32 context_after = 6;
   optional int32 context = 7;
   optional bool case_insensitive = 8;
   // --type
   optional string type = 9;
   // | head -N
   optional int32 head_limit = 10;
   // -U --multiline-dotall
   optional bool multiline = 11;
   // --sort: "none", "path", "modified", "accessed", "created"
   optional string sort = 12;
   // if false, use --sortr for reverse sort
   optional bool sort_ascending = 13;
   string tool_call_id = 14;
   optional SandboxPolicy sandbox_policy = 15;
}

message GrepResult {
   oneof result {
      GrepSuccess success = 1;
      GrepError error = 2;
   }
}

message GrepError {
   string error = 1;
}

message GrepSuccess {
   string pattern = 1;
   string path = 2;
   // "content", "files_with_matches", or "count"
   string output_mode = 3;
   map<string, GrepUnionResult> workspace_results = 4;
   optional GrepUnionResult active_editor_result = 5;
}

message GrepUnionResult {
   oneof result {
      GrepCountResult count = 1;
      GrepFilesResult files = 2;
      GrepContentResult content = 3;
   }
}

message GrepCountResult {
   // ordered by relevance
   repeated GrepFileCount counts = 1;
   // The total count of files that the client found from the ripgrep call This is a lower bound if we truncated the output from the ripgrep call itself, but is accurate if client_truncated is true (but may be more than the number of files returned to the server)
   int32 total_files = 2;
   // The total count of matches that the client found from the ripgrep call This is a lower bound if we truncated the output from the ripgrep call itself, but is accurate if client_truncated is true (but may be more than the number of matches returned to the server)
   int32 total_matches = 3;
   // true if the client truncated the output sent to the server
   bool client_truncated = 4;
   // true if we truncated the output from the ripgrep call itself
   bool ripgrep_truncated = 5;
}

message GrepFileCount {
   string file = 1;
   int32 count = 2;
}

message GrepFilesResult {
   // ordered by relevance
   repeated string files = 1;
   // The total count of files that the client found from the ripgrep call This is a lower bound if we truncated the output from the ripgrep call itself, but is accurate if client_truncated is true (but may be more than the number of files returned to the server)
   int32 total_files = 2;
   // true if the client truncated the output sent to the server
   bool client_truncated = 3;
   // true if we truncated the output from the ripgrep call itself
   bool ripgrep_truncated = 4;
}

message GrepContentResult {
   // ordered by relevance
   repeated GrepFileMatch matches = 1;
   // The total count of lines that the client found from the ripgrep call This is a lower bound if we truncated the output from the ripgrep call itself, but is accurate if client_truncated is true (but may be more than the number of lines returned to the server)
   int32 total_lines = 2;
   // The total count of matches that the client found from the ripgrep call This is a lower bound if we truncated the output from the ripgrep call itself, but is accurate if client_truncated is true (but may be more than the number of matches returned to the server)
   int32 total_matched_lines = 3;
   // true if the client truncated the output sent to the server
   bool client_truncated = 4;
   // true if we truncated the output from the ripgrep call itself
   bool ripgrep_truncated = 5;
}

message GrepFileMatch {
   string file = 1;
   repeated GrepContentMatch matches = 2;
}

message GrepContentMatch {
   int32 line_number = 1;
   string content = 2;
   bool content_truncated = 3;
   // true for context lines (-A/B/C)
   bool is_context_line = 4;
}

message GrepStream {
   string pattern = 1;
}

message GrepToolCall {
   GrepArgs args = 1;
   GrepResult result = 2;
}

message GetBlobArgs {
   bytes blob_id = 1;
}

message GetBlobResult {
   optional bytes blob_data = 1;
}

message SetBlobArgs {
   bytes blob_id = 1;
   bytes blob_data = 2;
}

message SetBlobResult {
   optional Error error = 1;
}

message KvServerMessage {
   uint32 id = 1;
   // Span context for distributed tracing
   optional SpanContext span_context = 4;
   oneof message {
      GetBlobArgs get_blob_args = 2;
      SetBlobArgs set_blob_args = 3;
   }
}

message KvClientMessage {
   uint32 id = 1;
   oneof message {
      GetBlobResult get_blob_result = 2;
      SetBlobResult set_blob_result = 3;
   }
}

message LsArgs {
   string path = 1;
   repeated string ignore = 2;
   string tool_call_id = 3;
   optional SandboxPolicy sandbox_policy = 4;
   // defaults to 5000ms
   optional uint32 timeout_ms = 5;
}

message LsResult {
   oneof result {
      LsSuccess success = 1;
      LsError error = 2;
      LsRejected rejected = 3;
      LsTimeout timeout = 4;
   }
}

message LsSuccess {
   LsDirectoryTreeNode directory_tree_root = 1;
}

message LsDirectoryTreeNode {
   string abs_path = 1;
   repeated LsDirectoryTreeNode children_dirs = 2;
   repeated LsDirectoryTreeNode_File children_files = 3;
   // Proto doesn't allow repeated fields to be optional, so in case of empty children arrays, this fields indicates if it happens: `true` - because directory really doesn't have any children `false` - because we stopped traversal before getting to its children
   bool children_were_processed = 4;
   // Count of extensions in the full sub-tree
   map<string, int32> full_subtree_extension_counts = 5;
   int32 num_files = 6;
}

message LsDirectoryTreeNode_File {
   string name = 1;
   optional TerminalMetadata terminal_metadata = 2;
}

message LsError {
   string path = 1;
   string error = 2;
}

message LsRejected {
   string path = 1;
   string reason = 2;
}

// Returned when ls operation timed out. Contains partial results gathered before timeout.
message LsTimeout {
   LsDirectoryTreeNode directory_tree_root = 1;
}

message TerminalMetadata {
   optional string cwd = 1;
   repeated TerminalMetadata_Command last_commands = 2;
   optional int64 last_modified_ms = 3;
   optional TerminalMetadata_Command current_command = 4;
}

message TerminalMetadata_Command {
   string command = 1;
   optional int32 exit_code = 2;
   optional int64 timestamp_ms = 3;
   optional int64 duration_ms = 4;
}

message LsToolCall {
   LsArgs args = 1;
   LsResult result = 2;
}

message McpArgs {
   string name = 1;
   map<string, bytes> args = 2;
   string tool_call_id = 3;
   string provider_identifier = 4;
   string tool_name = 5;
}

message McpResult {
   oneof result {
      McpSuccess success = 1;
      McpError error = 2;
      McpRejected rejected = 3;
      McpPermissionDenied permission_denied = 4;
      McpToolNotFound tool_not_found = 5;
   }
}

message McpToolNotFound {
   string name = 1;
   repeated string available_tools = 2;
}

// Text content item
message McpTextContent {
   string text = 1;
   // Optional file location for large outputs
   optional OutputLocation output_location = 2;
}

// Image content item
message McpImageContent {
   // Raw bytes of the image. In JSON, this will be base64-encoded.
   bytes data = 1;
   // Optional MIME type, e.g. "image/png"
   string mime_type = 2;
}

// A single tool result content item: either text or image
message McpToolResultContentItem {
   oneof content {
      McpTextContent text = 1;
      McpImageContent image = 2;
   }
}

// Equivalent to the requested McpToolResult TypeScript type
message McpSuccess {
   repeated McpToolResultContentItem content = 1;
   bool is_error = 2;
}

message McpError {
   string error = 1;
}

message McpRejected {
   string reason = 1;
   bool is_readonly = 2;
}

message McpPermissionDenied {
   string error = 1;
   bool is_readonly = 2;
}

// List MCP resources exec args
message ListMcpResourcesExecArgs {
   // Optional server name to filter resources by
   optional string server = 1;
}

// List MCP resources exec result
message ListMcpResourcesExecResult {
   oneof result {
      ListMcpResourcesSuccess success = 1;
      ListMcpResourcesError error = 2;
      ListMcpResourcesRejected rejected = 3;
   }
}

message ListMcpResourcesExecResult_McpResource {
   string uri = 1;
   optional string name = 2;
   optional string description = 3;
   optional string mime_type = 4;
   // Server name that provides this resource
   string server = 5;
   // Additional metadata
   map<string, string> annotations = 6;
}

message ListMcpResourcesSuccess {
   repeated ListMcpResourcesExecResult_McpResource resources = 1;
}

message ListMcpResourcesError {
   string error = 1;
}

message ListMcpResourcesRejected {
   string reason = 1;
}

// Read MCP resource exec args
message ReadMcpResourceExecArgs {
   // Required server name
   string server = 1;
   // Required resource URI
   string uri = 2;
   // Optional: when set, the resource will be downloaded to this path relative to the workspace, and the content will not be returned to the model.
   optional string download_path = 3;
}

// Read MCP resource exec result
message ReadMcpResourceExecResult {
   oneof result {
      ReadMcpResourceSuccess success = 1;
      ReadMcpResourceError error = 2;
      ReadMcpResourceRejected rejected = 3;
      ReadMcpResourceNotFound not_found = 4;
   }
}

message ReadMcpResourceSuccess {
   string uri = 1;
   optional string name = 2;
   optional string description = 3;
   optional string mime_type = 4;
   // Additional metadata
   map<string, string> annotations = 7;
   // If set, resource was downloaded to this path
   optional string download_path = 8;
   oneof content {
      string text = 5;
      bytes blob = 6;
   }
}

message ReadMcpResourceError {
   string uri = 1;
   string error = 2;
}

message ReadMcpResourceRejected {
   string uri = 1;
   string reason = 2;
}

message ReadMcpResourceNotFound {
   string uri = 1;
}

message McpToolDefinition {
   string name = 1;
   string provider_identifier = 4;
   string tool_name = 5;
   string description = 2;
   bytes input_schema = 3;
}

message McpTools {
   repeated McpToolDefinition mcp_tools = 1;
}

// Represents MCP-provided instructions from a specific server
message McpInstructions {
   string server_name = 1;
   string instructions = 2;
}

message McpDescriptor {
   // Display name of the MCP server associated with this folder.
   string server_name = 1;
   string server_identifier = 2;
   // Absolute folder path where MCP tool descriptor JSON files are stored.
   optional string folder_path = 3;
   optional string server_use_instructions = 4;
   repeated McpToolDescriptor tools = 5;
}

message McpToolDescriptor {
   string tool_name = 1;
   optional string definition_path = 2;
}

message McpFileSystemOptions {
   bool enabled = 1;
   string workspace_project_dir = 2;
   repeated McpDescriptor mcp_descriptors = 3;
}

message ReadArgs {
   string path = 1;
   string tool_call_id = 2;
}

message ReadResult {
   oneof result {
      ReadSuccess success = 1;
      ReadError error = 2;
      ReadRejected rejected = 3;
      ReadFileNotFound file_not_found = 4;
      ReadPermissionDenied permission_denied = 5;
      ReadInvalidFile invalid_file = 6;
   }
}

message ReadSuccess {
   string path = 1;
   int32 total_lines = 3;
   int64 file_size = 4;
   // true if the content was truncated due to size limits
   bool truncated = 6;
   // Returns blob ID if the output was stored in the blob store. If provided, the output is stored separately from the rest of the tool result, and since it's already in the blob store, it need not be sent back to the client -- reducing bandwidth.
   optional bytes output_blob_id = 7;
   oneof output {
      string content = 2;
      bytes data = 5;
   }
}

message ReadError {
   string path = 1;
   string error = 2;
}

message ReadRejected {
   string path = 1;
   string reason = 2;
}

message ReadFileNotFound {
   string path = 1;
}

message ReadPermissionDenied {
   string path = 1;
}

message ReadInvalidFile {
   string path = 1;
   // e.g., "Path is a directory, not a file"
   string reason = 2;
}

message ReadToolCall {
   ReadToolArgs args = 1;
   ReadToolResult result = 2;
}

message ReadToolArgs {
   string path = 1;
   optional int32 offset = 2;
   optional int32 limit = 3;
}

message ReadToolResult {
   oneof result {
      ReadToolSuccess success = 1;
      ReadToolError error = 2;
   }
}

message ReadRange {
   uint32 start_line = 1;
   uint32 end_line = 2;
}

message ReadToolSuccess {
   bool is_empty = 2;
   bool exceeded_limit = 3;
   uint32 total_lines = 4;
   uint32 file_size = 5;
   string path = 7;
   optional ReadRange read_range = 8;
   oneof output {
      string content = 1;
      bytes data = 6;
      bytes data_blob_id = 9;
      bytes content_blob_id = 10;
   }
}

message ReadToolError {
   string error_message = 1;
}

message RecordScreenArgs {
   int32 mode = 1;
   string tool_call_id = 2;
   // Custom filename for SAVE_RECORDING mode
   optional string save_as_filename = 3;
}

message RecordScreenResult {
   oneof result {
      RecordScreenStartSuccess start_success = 1;
      RecordScreenSaveSuccess save_success = 2;
      RecordScreenDiscardSuccess discard_success = 3;
      RecordScreenFailure failure = 4;
   }
}

message RecordScreenStartSuccess {
   // True if a prior recording was cancelled, false otherwise
   bool was_prior_recording_cancelled = 1;
   // True if save_as_filename arg was passed to start tool and ignored
   bool was_save_as_filename_ignored = 2;
}

message RecordScreenSaveSuccess {
   // Path to the saved recording file
   string path = 1;
   // Duration of the recording in milliseconds
   int64 recording_duration_ms = 2;
   // Set if save_as_filename was invalid and default path was used instead
   optional int32 requested_file_path_rejected_reason = 3;
}

// Empty message - recording discarded successfully
message RecordScreenDiscardSuccess {
}

message RecordScreenFailure {
   // Error message
   string error = 1;
}

message CursorPackagePrompt {
   string name = 1;
   string file_path = 2;
}

message CursorPackage {
   string name = 1;
   string description = 2;
   string folder_path = 3;
   bool enabled = 4;
   optional string parse_error = 5;
   repeated CursorPackagePrompt prompts = 6;
   string readme_file_path = 7;
   int32 package_type = 8;
}

// TODO: you should be able to override / configure this list in your .vscode settings not exactly sure what that should look like... but i guess you should be able to specify an override URL because we use URLs for identifying repos and maybe you should be able to specify additional buckets too... like in the jane street case: i guess jane street should have some default buckets
message RepositoryIndexingInfo {
   // the relative path in the current workspace this is useful for locating the repo and identifying what repo a given file is in this should be unique for different repositories (I think)
   string relative_workspace_path = 1;
   // a git repo may have multiple remotes at the server we choose the remote (either origin, or the one we have embedded, or something else) invariant: len(remote_urls) == len(remote_names)
   repeated string remote_urls = 2;
   repeated string remote_names = 3;
   string repo_name = 4;
   string repo_owner = 5;
   bool is_tracked = 6;
   // If this is local
   bool is_local = 7;
   // the orthogonal transform seed if sent from the client! if the client sends up the transform seed then we use that for the orthogonal transform instead of the value stored in the database
   optional double orthogonal_transform_seed = 8;
   // The encrypted workspace uri for the repository.
   string workspace_uri = 9;
   // The encryption key for partial paths
   string path_encryption_key = 10;
}

message RequestContextArgs {
   optional string notes_session_id = 2;
   optional string workspace_id = 3;
}

message RequestContextResult {
   oneof result {
      RequestContextSuccess success = 1;
      RequestContextError error = 2;
      RequestContextRejected rejected = 3;
   }
}

message RequestContextSuccess {
   RequestContext request_context = 1;
}

message RequestContextError {
   string error = 1;
}

message RequestContextRejected {
   string reason = 1;
}

// same as SelectedImage, but with the data field is the full image data
message ImageProto {
   bytes data = 1;
   string uuid = 2;
   string path = 3;
   ImageProto_Dimension dimension = 4;
   optional string task_specific_description = 6;
   string mime_type = 7;
}

message ImageProto_Dimension {
   int32 width = 1;
   int32 height = 2;
}

// Git repository information for a workspace
message GitRepoInfo {
   string path = 1;
   string status = 2;
   string branch_name = 3;
   optional string remote_url = 4;
}

// Environment details for system prompt/context
message RequestContextEnv {
   string os_version = 1;
   repeated string workspace_paths = 2;
   string shell = 3;
   bool sandbox_enabled = 5;
   string terminals_folder = 7;
   string agent_shared_notes_folder = 8;
   string agent_conversation_notes_folder = 9;
   string time_zone = 10;
   // Project-specific folder for storing artifacts, computed client-side as ~/.cursor/projects/{slug}/
   string project_folder = 11;
   // Folder where agent conversation transcripts are stored
   string agent_transcripts_folder = 12;
}

message DebugModeConfig {
   string log_path = 1;
   string server_endpoint = 2;
}

message SkillDescriptor {
   string name = 1;
   string description = 2;
   string folder_path = 3;
   bool enabled = 4;
   optional string parse_error = 5;
   string readme_file_path = 6;
   int32 package_type = 7;
}

message SkillOptions {
   repeated SkillDescriptor skill_descriptors = 1;
}

message RequestContext {
   // All rules, categorized by the embedded type
   repeated CursorRule rules = 2;
   RequestContextEnv env = 4;
   repeated RepositoryIndexingInfo repository_info = 6;
   repeated McpToolDefinition tools = 7;
   optional string conversation_notes_listing = 8;
   optional string shared_notes_listing = 9;
   repeated GitRepoInfo git_repos = 11;
   repeated LsDirectoryTreeNode project_layouts = 13;
   repeated McpInstructions mcp_instructions = 14;
   optional DebugModeConfig debug_mode_config = 15;
   optional string cloud_rule = 16;
   optional bool web_search_enabled = 17;
   optional SkillOptions skill_options = 18;
   optional bool repository_info_should_query_prod = 19;
   map<string, string> file_contents = 20;
   // Content of the user-intent/index.md file summarizing past conversations
   optional string user_intent_summary = 21;
   // Local custom subagent definitions loaded from workspace configuration
   repeated CustomSubagent custom_subagents = 22;
   // MCP file system options for agent MCP tool descriptor access
   optional McpFileSystemOptions mcp_file_system_options = 23;
}

message SandboxPolicy {
   int32 type = 1;
   optional bool network_access = 2;
   repeated string additional_readwrite_paths = 3;
   repeated string additional_readonly_paths = 4;
   optional string debug_output_dir = 5;
   optional bool block_git_writes = 6;
   // If true, excludes default tmp paths (/tmp/, /private/tmp/, /var/folders/) from the sandbox writable paths. Useful for testing readonly behavior.
   optional bool disable_tmp_write = 7;
}

message SelectedImage {
   string uuid = 2;
   string path = 3;
   SelectedImage_Dimension dimension = 4;
   string mime_type = 7;
   oneof data_or_blob_id {
      bytes blob_id = 1;
      bytes data = 8;
      SelectedImage_BlobIdWithData blob_id_with_data = 9;
   }
}

// Contains both blob_id and data together, for when the client has both and wants to populate the server-side cache without re-uploading
message SelectedImage_BlobIdWithData {
   bytes blob_id = 1;
   bytes data = 2;
}

message SelectedImage_Dimension {
   int32 width = 1;
   int32 height = 2;
}

// Extra context entry that can be stored inline or as a blob reference
message ExtraContextEntry {
   oneof data_or_blob_id {
      string data = 1;
      bytes blob_id = 2;
   }
}

// A selected file from the UI
message SelectedFile {
   string content = 1;
   // This is the full path
   string path = 2;
   optional string relative_path = 3;
}

// A selected code selection from the UI
message SelectedCodeSelection {
   string content = 1;
   // This is the full path
   string path = 2;
   optional string relative_path = 3;
   Range range = 4;
}

// A selected terminal from the UI
message SelectedTerminal {
   string content = 1;
   optional string title = 2;
   optional string path = 3;
}

// A selected terminal selection from the UI
message SelectedTerminalSelection {
   string content = 1;
   optional string title = 2;
   optional string path = 3;
   Range range = 4;
}

// A selected folder from the UI
message SelectedFolder {
   // This is the full path
   string path = 1;
   optional string relative_path = 2;
   LsDirectoryTreeNode directory_tree = 3;
}

// An external link manually attached by the user
message SelectedExternalLink {
   string url = 1;
   string uuid = 2;
   // For local PDF files Base64-encoded PDF content
   optional string pdf_content = 3;
   optional bool is_pdf = 4;
   optional string filename = 5;
}

// A cursor rule manually attached by the user
message SelectedCursorRule {
   CursorRule rule = 1;
}

// Git diff (uncommitted changes in working tree)
message SelectedGitDiff {
   // Raw git diff output
   string content = 1;
}

// Git diff from branch to main
message SelectedGitDiffFromBranchToMain {
   // Raw git diff output
   string content = 1;
}

// A git commit manually attached by the user
message SelectedGitCommit {
   string sha = 1;
   string message = 2;
   optional string description = 3;
   // Raw git diff output for this commit
   string diff = 4;
}

// A pull request manually attached by the user via @mention Uses the same folder structure as ViewedPullRequest for consistency
message SelectedPullRequest {
   int32 number = 1;
   string url = 2;
   optional string title = 3;
   // Path to the folder containing PR details (diffs, metadata, etc.)
   string folder_path = 4;
   // Summary JSON containing file list and diff sizes (contents of summary.json)
   optional string summary_json = 5;
   // PR description/body
   optional string description = 6;
   // If set, other fields are empty and data should be fetched from the blob
   optional bytes blob_id = 7;
}

// A selection from a pull request diff (for files that may not exist on disk)
message SelectedGitPRDiffSelection {
   // Full URL to the pull request
   string pr_url = 1;
   // Path to the file within the PR
   string file_path = 2;
   // Start line in the diff
   int32 start_line = 3;
   // End line in the diff
   int32 end_line = 4;
   // The diff content for this file (or selection)
   optional string diff_content = 5;
   // If set, other fields are empty and data should be fetched from the blob
   optional bytes blob_id = 6;
}

// A cursor command manually attached by the user
message SelectedCursorCommand {
   string name = 1;
   string content = 2;
}

// A documentation manually attached by the user
message SelectedDocumentation {
   string doc_id = 1;
   string name = 2;
}

// A past chat manually attached by the user (transcript file)
message SelectedPastChat {
   string agent_id = 1;
   string name = 2;
}

// A call frame from a stack trace
message CallFrame {
   optional string function_name = 1;
   optional string url = 2;
   optional int32 line_number = 3;
   optional int32 column_number = 4;
}

// A stack trace
message StackTrace {
   repeated CallFrame call_frames = 1;
   optional string raw_stack_trace = 2;
}

// A console log entry from the runtime
message SelectedConsoleLog {
   string message = 1;
   // * Unix timestamp in milliseconds when this log entry was created
   double timestamp = 2;
   string level = 3;
   string client_name = 4;
   string session_id = 5;
   optional StackTrace stack_trace = 6;
   optional string object_data_json = 7;
}

// A UI element picked by the user from the runtime
message SelectedUIElement {
   string element = 1;
   string xpath = 2;
   string text_content = 3;
   string extra = 4;
   optional string component = 5;
   optional string component_props_json = 6;
}

// A subagent selected by the user from the slash menu
message SelectedSubagent {
   string name = 1;
}

// Container for selected context from the UI
message SelectedContext {
   repeated SelectedImage selected_images = 1;
   optional InvocationContext invocation_context = 2;
   // Temporary hack for IDE-based context (@filename, @Diff, etc.) in background agents only. TODO: remove once proper IDE context format is implemented.
   repeated string extra_context = 3;
   repeated ExtraContextEntry extra_context_entries = 16;
   // New context types
   repeated SelectedFile files = 4;
   repeated SelectedCodeSelection code_selections = 5;
   repeated SelectedTerminal terminals = 6;
   repeated SelectedTerminalSelection terminal_selections = 7;
   repeated SelectedFolder folders = 8;
   repeated SelectedExternalLink external_links = 9;
   repeated SelectedCursorRule cursor_rules = 10;
   optional SelectedGitDiff git_diff = 18;
   optional SelectedGitDiffFromBranchToMain git_diff_from_branch_to_main = 11;
   repeated SelectedCursorCommand cursor_commands = 12;
   repeated SelectedDocumentation documentations = 13;
   repeated SelectedUIElement ui_elements = 14;
   repeated SelectedConsoleLog console_logs = 15;
   repeated SelectedGitCommit git_commits = 17;
   repeated SelectedPastChat past_chats = 19;
   repeated SelectedGitPRDiffSelection git_pr_diff_selections = 20;
   repeated SelectedPullRequest selected_pull_requests = 21;
   repeated SelectedSubagent selected_subagents = 22;
}

// InvocationContext represents the context from the external app/integration that triggered this agent request.
message InvocationContext {
   oneof data {
      InvocationContext_SlackThread slack_thread = 1;
      InvocationContext_GithubPR github_pr = 2;
      InvocationContext_IdeState ide_state = 3;
      bytes blob_id = 10;
   }
}

message InvocationContext_SlackThread {
   string thread = 1;
   optional string channel_name = 2;
   optional string channel_purpose = 3;
   optional string channel_topic = 4;
}

message InvocationContext_GithubPR {
   string title = 1;
   string description = 2;
   string comments = 3;
   optional string ci_failures = 4;
}

message InvocationContext_IdeState {
   repeated InvocationContext_IdeState_File visible_files = 1;
   repeated InvocationContext_IdeState_File recently_viewed_files = 2;
   // PRs currently being viewed in the review editor (if any)
   repeated InvocationContext_IdeState_ViewedPullRequest currently_viewed_prs = 3;
}

message InvocationContext_IdeState_File {
   // This is the full path
   string path = 1;
   optional string relative_path = 2;
   // Present if file is currently focused
   optional InvocationContext_IdeState_File_CursorPosition cursor_position = 3;
   int32 total_lines = 4;
   // Present for terminal files
   optional string active_command = 5;
}

message InvocationContext_IdeState_File_CursorPosition {
   int32 line = 1;
   string text = 2;
}

// Information about a PR currently being viewed in a review editor
message InvocationContext_IdeState_ViewedPullRequest {
   int32 number = 1;
   string url = 2;
   optional string title = 3;
   // Path to the folder containing PR details (diffs, metadata, etc.)
   optional string folder_path = 4;
   // Summary JSON containing file list and diff sizes (contents of summary.json)
   optional string summary_json = 5;
   // PR description/body
   optional string description = 6;
}

message SetupVmEnvironmentArgs {
   // Command to install runtime dependencies (e.g., "npm install")
   string install_command = 2;
   string start_command = 3;
}

// Result of VM environment setup operations
message SetupVmEnvironmentResult {
   oneof result {
      SetupVmEnvironmentSuccess success = 1;
   }
}

// Successful VM environment setup result
message SetupVmEnvironmentSuccess {
}

// Tool call structure for SetupVmEnvironment
message SetupVmEnvironmentToolCall {
   // Arguments for the tool call
   SetupVmEnvironmentArgs args = 1;
   // Result of the tool call (populated after execution)
   SetupVmEnvironmentResult result = 2;
}

message ShellCommandParsingResult {
   bool parsing_failed = 1;
   repeated ShellCommandParsingResult_ExecutableCommand executable_commands = 2;
   bool has_redirects = 3;
   bool has_command_substitution = 4;
}

message ShellCommandParsingResult_ExecutableCommandArg {
   string type = 1;
   string value = 2;
}

message ShellCommandParsingResult_ExecutableCommand {
   string name = 1;
   repeated ShellCommandParsingResult_ExecutableCommandArg args = 2;
   string full_text = 3;
}

message ShellArgs {
   string command = 1;
   string working_directory = 2;
   int32 timeout = 3;
   string tool_call_id = 4;
   repeated string simple_commands = 5;
   bool has_input_redirect = 6;
   bool has_output_redirect = 7;
   // Deprecated: use parsing_result instead @deprecated simpleCommands = []; Deprecated: use parsing_result instead @deprecated hasInputRedirect = false; Deprecated: use parsing_result instead @deprecated hasOutputRedirect = false;
   ShellCommandParsingResult parsing_result = 8;
   optional SandboxPolicy requested_sandbox_policy = 9;
   // If output size exceeds this threshold (in bytes), write to file instead of inline. If unset or 0, always use inline output.
   optional uint64 file_output_threshold_bytes = 10;
   bool is_background = 11;
   bool skip_approval = 12;
   int32 timeout_behavior = 13;
   // Hard timeout: kill the command after this many ms, even if running in background
   optional int32 hard_timeout = 14;
}

message ShellResult {
   optional SandboxPolicy sandbox_policy = 101;
   // Rendering is affected by this flag, pass forward from args.
   optional bool is_background = 102;
   // Rendering is affected by this flag, pass forward from args.
   optional string terminals_folder = 103;
   // Process ID, used for backgrounded shells.
   optional uint32 pid = 104;
   oneof result {
      ShellSuccess success = 1;
      ShellFailure failure = 2;
      ShellTimeout timeout = 3;
      ShellRejected rejected = 4;
      ShellSpawnError spawn_error = 5;
      ShellPermissionDenied permission_denied = 7;
   }
}

message ShellStreamStdout {
   string data = 1;
}

message ShellStreamStderr {
   string data = 1;
}

message ShellStreamExit {
   uint32 code = 1;
   string cwd = 2;
   optional OutputLocation output_location = 3;
   bool aborted = 4;
   // If aborted is true, this field indicates the reason for the abort
   optional int32 abort_reason = 5;
}

message ShellStreamStart {
   optional SandboxPolicy sandbox_policy = 1;
}

message ShellStreamBackgrounded {
   uint32 shell_id = 1;
   string command = 2;
   string working_directory = 3;
   optional uint32 pid = 4;
   // The ms_to_wait value that was used for backgrounding, for display purposes
   optional int32 ms_to_wait = 5;
}

message ShellStream {
   oneof event {
      ShellStreamStdout stdout = 1;
      ShellStreamStderr stderr = 2;
      ShellStreamExit exit = 3;
      ShellStreamStart start = 4;
      ShellRejected rejected = 5;
      ShellPermissionDenied permission_denied = 6;
      ShellStreamBackgrounded backgrounded = 7;
   }
}

message OutputLocation {
   // Absolute path to the output file
   string file_path = 1;
   // Size of the output in bytes
   int64 size_bytes = 2;
   // Number of lines in the output
   int64 line_count = 3;
}

message ShellSuccess {
   string command = 1;
   string working_directory = 2;
   int32 exit_code = 3;
   string signal = 4;
   // Inline stdout - populated when write_output_to_file is false, empty when true
   string stdout = 5;
   // Inline stderr - populated when write_output_to_file is false, empty when true
   string stderr = 6;
   int32 execution_time = 7;
   // File-based output - populated when write_output_to_file is true (chronologically merged stdout+stderr)
   optional OutputLocation output_location = 8;
   // Used by background shell executor
   optional uint32 shell_id = 9;
   optional string interleaved_output = 10;
   // Process ID, used for backgrounded shells
   optional uint32 pid = 11;
   // The ms_to_wait value used for backgrounding (for display in result)
   optional int32 ms_to_wait = 12;
}

message ShellFailure {
   string command = 1;
   string working_directory = 2;
   int32 exit_code = 3;
   string signal = 4;
   // Inline stdout - populated when write_output_to_file is false, empty when true
   string stdout = 5;
   // Inline stderr - populated when write_output_to_file is false, empty when true
   string stderr = 6;
   int32 execution_time = 7;
   // File-based output - populated when write_output_to_file is true (chronologically merged stdout+stderr)
   optional OutputLocation output_location = 8;
   optional string interleaved_output = 9;
   // If the command was aborted, this indicates the reason
   optional int32 abort_reason = 10;
   // Whether the command was aborted (by user or timeout)
   bool aborted = 11;
}

message ShellTimeout {
   string command = 1;
   string working_directory = 2;
   int32 timeout_ms = 3;
}

message ShellRejected {
   string command = 1;
   string working_directory = 2;
   string reason = 3;
   bool is_readonly = 4;
}

message ShellPermissionDenied {
   string command = 1;
   string working_directory = 2;
   string error = 3;
   bool is_readonly = 4;
}

message ShellSpawnError {
   string command = 1;
   string working_directory = 2;
   string error = 3;
}

message ShellPartialResult {
   string stdout_delta = 1;
   string stderr_delta = 2;
}

message ShellToolCall {
   ShellArgs args = 1;
   ShellResult result = 2;
}

message ShellToolCallStdoutDelta {
   string content = 1;
}

message ShellToolCallStderrDelta {
   string content = 1;
}

message ShellToolCallDelta {
   oneof delta {
      ShellToolCallStdoutDelta stdout = 1;
      ShellToolCallStderrDelta stderr = 2;
   }
}

message SubagentType {
   oneof type {
      SubagentTypeUnspecified unspecified = 1;
      SubagentTypeComputerUse computer_use = 2;
      SubagentTypeCustom custom = 3;
      SubagentTypeExplore explore = 4;
   }
}

// Empty message for unspecified subagent type
message SubagentTypeUnspecified {
}

// Empty message for computer use subagent type
message SubagentTypeComputerUse {
}

// Empty message for explore subagent type (read-only codebase exploration)
message SubagentTypeExplore {
}

// Custom subagent type with a name field
message SubagentTypeCustom {
   // unique identifier of the custom subagent
   string name = 1;
}

// Custom subagent definition loaded from local workspace configuration.
message CustomSubagent {
   // absolute path to the markdown definition file
   string full_path = 1;
   // unique identifier of the subagent
   string name = 2;
   // short summary of the agent's specialization
   string description = 3;
   // list of tool names the subagent can access
   repeated string tools = 4;
   // preferred model (or "inherit" to use parent's model)
   string model = 5;
   // full prompt contents from the markdown file
   string prompt = 6;
   // default permission mode for subagent execution
   int32 permission_mode = 7;
}

message SwitchModeArgs {
   // The unified mode id to switch to (agent/chat/plan/spec/debug/triage)
   string target_mode_id = 1;
   // Optional explanation for why the mode switch is requested
   optional string explanation = 2;
   string tool_call_id = 3;
}

message SwitchModeResult {
   oneof result {
      SwitchModeSuccess success = 1;
      SwitchModeError error = 2;
      SwitchModeRejected rejected = 3;
   }
}

message SwitchModeSuccess {
   // The mode we switched from
   string from_mode_id = 1;
   // The mode we switched to
   string to_mode_id = 2;
}

message SwitchModeError {
   string error = 1;
}

message SwitchModeRejected {
   string reason = 1;
}

message SwitchModeToolCall {
   SwitchModeArgs args = 1;
   SwitchModeResult result = 2;
}

message SwitchModeRequestQuery {
   SwitchModeArgs args = 1;
}

message SwitchModeRequestResponse {
   oneof result {
      SwitchModeRequestResponse_Approved approved = 1;
      SwitchModeRequestResponse_Rejected rejected = 2;
   }
}

message SwitchModeRequestResponse_Approved {
}

message SwitchModeRequestResponse_Rejected {
   string reason = 1;
}

message TodoItem {
   string id = 1;
   string content = 2;
   int32 status = 3;
   int64 created_at = 4;
   int64 updated_at = 5;
   // IDs of other TODOs this depends on
   repeated string dependencies = 6;
}

// UpdateTodos tool call
message UpdateTodosToolCall {
   UpdateTodosArgs args = 1;
   UpdateTodosResult result = 2;
}

message UpdateTodosArgs {
   repeated TodoItem todos = 1;
   bool merge = 2;
}

message UpdateTodosResult {
   oneof result {
      UpdateTodosSuccess success = 1;
      UpdateTodosError error = 2;
   }
}

message UpdateTodosSuccess {
   repeated TodoItem todos = 1;
   int32 total_count = 2;
   // Whether this was a merge operation (needed for conditional rendering)
   bool was_merge = 3;
}

message UpdateTodosError {
   string error = 1;
}

// ReadTodos tool call
message ReadTodosToolCall {
   ReadTodosArgs args = 1;
   ReadTodosResult result = 2;
}

message ReadTodosArgs {
   // Optional: filter by status
   repeated int32 status_filter = 1;
   // Optional: filter by IDs
   repeated string id_filter = 2;
}

message ReadTodosResult {
   oneof result {
      ReadTodosSuccess success = 1;
      ReadTodosError error = 2;
   }
}

message ReadTodosSuccess {
   repeated TodoItem todos = 1;
   int32 total_count = 2;
}

message ReadTodosError {
   string error = 1;
}

message Range {
   Position start = 1;
   Position end = 2;
}

message Position {
   uint32 line = 1;
   uint32 column = 2;
}

message Error {
   string message = 1;
}

message WebSearchArgs {
   string search_term = 1;
   string tool_call_id = 2;
}

message WebSearchResult {
   oneof result {
      WebSearchSuccess success = 1;
      WebSearchError error = 2;
      WebSearchRejected rejected = 3;
   }
}

message WebSearchSuccess {
   repeated WebSearchReference references = 1;
}

message WebSearchError {
   string error = 1;
}

message WebSearchRejected {
   string reason = 1;
}

message WebSearchReference {
   string title = 1;
   string url = 2;
   string chunk = 3;
}

message WebSearchToolCall {
   WebSearchArgs args = 1;
   WebSearchResult result = 2;
}

message WebSearchRequestQuery {
   WebSearchArgs args = 1;
}

message WebSearchRequestResponse {
   oneof result {
      WebSearchRequestResponse_Approved approved = 1;
      WebSearchRequestResponse_Rejected rejected = 2;
   }
}

message WebSearchRequestResponse_Approved {
}

message WebSearchRequestResponse_Rejected {
   string reason = 1;
}

message WriteArgs {
   string path = 1;
   string file_text = 2;
   string tool_call_id = 3;
   bool return_file_content_after_write = 4;
   // Raw binary data to write. When set, file_text is ignored and the bytes are written directly without any text processing (e.g., line ending normalization).
   bytes file_bytes = 5;
}

message WriteResult {
   oneof result {
      WriteSuccess success = 1;
      WritePermissionDenied permission_denied = 3;
      WriteNoSpace no_space = 4;
      WriteError error = 5;
      WriteRejected rejected = 6;
   }
}

message WriteSuccess {
   string path = 1;
   int32 lines_created = 2;
   int32 file_size = 3;
   optional string file_content_after_write = 4;
}

message WritePermissionDenied {
   string path = 1;
   string directory = 2;
   // "create_directory" or "create_file"
   string operation = 3;
   string error = 4;
   bool is_readonly = 5;
}

message WriteNoSpace {
   string path = 1;
}

message WriteError {
   string path = 1;
   string error = 2;
}

message WriteRejected {
   string path = 1;
   string reason = 2;
}

message BootstrapStatsigRequest {
   // When true, the server should evaluate gates as if dev/internal status is ignored. This is used by clients to simulate a prod user experience.
   optional bool ignore_dev_status = 1;
   optional int32 operating_system = 2;
}

message PingResponse {
}

message ExecRequest {
   string command = 1;
   optional string cwd = 2;
   repeated string args = 3;
   map<string, string> environment = 4;
}

message ExecResponse {
   oneof event {
      StdoutEvent stdout_event = 1;
      StderrEvent stderr_event = 2;
      ExitEvent exit_event = 3;
   }
}

message StdoutEvent {
   string data = 1;
}

message StderrEvent {
   string data = 1;
}

message ExitEvent {
   int32 exit_code = 1;
}

message ReadTextFileRequest {
   string path = 1;
}

message ReadTextFileResponse {
   string content = 1;
}

message WriteTextFileRequest {
   string path = 1;
   string content = 2;
}

// Empty response - success is implied by RPC completion
message WriteTextFileResponse {
}

message ReadBinaryFileRequest {
   string path = 1;
}

message ReadBinaryFileResponse {
   bytes content = 1;
}

message WriteBinaryFileRequest {
   string path = 1;
   bytes content = 2;
}

// Empty response - success is implied by RPC completion
message WriteBinaryFileResponse {
}

message GetWorkspaceChangesHashRequest {
   string root_path = 1;
   string base_ref = 2;
}

message GetWorkspaceChangesHashResponse {
   string hash = 1;
}

message RefreshGithubAccessTokenRequest {
   string github_access_token = 1;
   // e.g., "github.com", "gitlab.com", "gitlab.example.com"
   string hostname = 2;
}

// Empty response - success is implied by RPC completion
message RefreshGithubAccessTokenResponse {
}

message WarmRemoteAccessServerRequest {
   string commit = 1;
   int32 port = 2;
   string connection_token = 3;
}

// Empty response - success is implied by RPC completion
message WarmRemoteAccessServerResponse {
}

message ListArtifactsRequest {
}

message ArtifactUploadMetadata {
   string absolute_path = 1;
   uint64 size_bytes = 2;
   int64 updated_at_unix_ms = 3;
   int32 status = 4;
   uint64 bytes_uploaded = 5;
   string last_error = 6;
   uint32 upload_attempts = 7;
   int64 last_started_at_unix_ms = 8;
   int64 last_finished_at_unix_ms = 9;
   string upload_id = 10;
}

message ListArtifactsResponse {
   repeated ArtifactUploadMetadata artifacts = 1;
}

message UploadArtifactsRequest {
   repeated ArtifactUploadInstruction uploads = 1;
}

message ArtifactUploadInstruction {
   string absolute_path = 1;
   string upload_url = 2;
   string method = 3;
   map<string, string> headers = 4;
   optional string content_type = 5;
   optional string slack_upload_url = 6;
   optional string slack_file_id = 7;
}

message ArtifactUploadDispatchResult {
   string absolute_path = 1;
   int32 status = 2;
   string message = 3;
   optional string slack_file_id = 4;
}

message UploadArtifactsResponse {
   repeated ArtifactUploadDispatchResult results = 1;
}

message GetMcpRefreshTokensRequest {
}

message GetMcpRefreshTokensResponse {
   // Map from server URL to refresh token
   map<string, string> refresh_tokens = 1;
}

message UpdateEnvironmentVariablesRequest {
   // Environment variables to manage (plaintext values).
   map<string, string> env = 1;
   // If true, unset previously-managed keys that are not present in `env`.
   bool replace = 2;
}

message UpdateEnvironmentVariablesResponse {
   uint32 applied = 1;
   uint32 removed = 2;
}

// Check if an error is caused by the client disconnecting (e.g., due to timeout or abort). This includes errors like ERR_STREAM_DESTROYED which occur when the HTTP response stream is closed by the client while the server is still writing to it. function isClientDisconnectError(error) { if (!(error instanceof Error)) { return false; const code = error.code; return (code === "ERR_STREAM_DESTROYED" || code === "ERR_STREAM_PREMATURE_CLOSE" || code === "ECONNRESET" || code === "EPIPE"); ;// ../proto/dist/generated/aiserver/v1/mcp_pb.js // @ts-nocheck
message McpOAuthStoredData {
   string refresh_token = 1;
   string client_id = 2;
   optional string client_secret = 3;
   repeated string redirect_uris = 4;
}

message Frame {
   // Correlation ID
   string id = 1;
   // RPC method (e.g., "/agent.v1.ControlService/Ping")
   string method = 2;
   // Serialized payload
   bytes data = 3;
   int32 kind = 4;
   // Error message (kind == ERROR)
   string error = 5;
}

// var Frame_Kind; (function (Frame_Kind) { Frame_Kind[Frame_Kind["UNSPECIFIED"] = 0] = "UNSPECIFIED"; Frame_Kind[Frame_Kind["REQUEST"] = 1] = "REQUEST"; Frame_Kind[Frame_Kind["RESPONSE"] = 2] = "RESPONSE"; Frame_Kind[Frame_Kind["ERROR"] = 3] = "ERROR"; })(Frame_Kind || (Frame_Kind = {})); // Retrieve enum metadata with: proto3.getEnumType(Frame_Kind) proto3/* int32 */.C.util.setEnumType(Frame_Kind, "agent.v1.Frame.Kind", [ { no: 0, name: "KIND_UNSPECIFIED" }, { no: 1, name: "KIND_REQUEST" }, { no: 2, name: "KIND_RESPONSE" }, { no: 3, name: "KIND_ERROR" }, ]);
message Empty {
}

message BidiRequestId {
   string request_id = 1;
}

// Agent Service with bidirectional streaming
service AgentService {
   rpc Run(AgentClientMessage) returns (AgentServerMessage);
   rpc RunSSE(BidiRequestId) returns (AgentServerMessage);
   // Generate a very short, succinct agent name from the provided user message.
   rpc NameAgent(NameAgentRequest) returns (NameAgentResponse);
   rpc GetUsableModels(GetUsableModelsRequest) returns (GetUsableModelsResponse);
   rpc GetDefaultModelForCli(GetDefaultModelForCliRequest) returns (GetDefaultModelForCliResponse);
   // Internal endpoint: returns all allowed model intents for devs
   rpc GetAllowedModelIntents(GetAllowedModelIntentsRequest) returns (GetAllowedModelIntentsResponse);
}

service ControlService {
   // Spawn
   // File read / write
   rpc ReadTextFile(ReadTextFileRequest) returns (ReadTextFileResponse);
   rpc WriteTextFile(WriteTextFileRequest) returns (WriteTextFileResponse);
   // Binary file read / write
   rpc ReadBinaryFile(ReadBinaryFileRequest) returns (ReadBinaryFileResponse);
   rpc WriteBinaryFile(WriteBinaryFileRequest) returns (WriteBinaryFileResponse);
   // Git
   rpc GetWorkspaceChangesHash(GetWorkspaceChangesHashRequest) returns (GetWorkspaceChangesHashResponse);
   rpc RefreshGithubAccessToken(RefreshGithubAccessTokenRequest) returns (RefreshGithubAccessTokenResponse);
   // Remote access
   rpc WarmRemoteAccessServer(WarmRemoteAccessServerRequest) returns (WarmRemoteAccessServerResponse);
   // Artifact uploads
   rpc ListArtifacts(ListArtifactsRequest) returns (ListArtifactsResponse);
   rpc UploadArtifacts(UploadArtifactsRequest) returns (UploadArtifactsResponse);
   rpc GetMcpRefreshTokens(GetMcpRefreshTokensRequest) returns (GetMcpRefreshTokensResponse);
   // Update the exec-daemon's environment variables for subsequent process spawns. This does NOT affect already-running processes.
   rpc UpdateEnvironmentVariables(UpdateEnvironmentVariablesRequest) returns (UpdateEnvironmentVariablesResponse);
}

// Agent Service with unary RPC
service ExecService {
}

service PrivateWorkerBridgeExternalService {
   rpc Connect(Frame) returns (Frame);
}

// LifecycleService is exposed by the bridge *client*, in addition to ExecService (tool calls) and ControlService (control operations "within the daemon"). It operates at a similar abstraction level as AnyrunService: it represents operations similar to creating a VM, checking out a repository, etc.
service LifecycleService {
   // Resets a long-lived worker
   rpc ResetInstance(Empty) returns (Empty);
   // Asks worker to exit(0) so that a new worker can take his place
   rpc RenewInstance(Empty) returns (Empty);
}