pathbase-client 0.2.0

Auto-generated typed client for the Pathbase HTTP API (derived from openapi.json via progenitor).
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
{
  "openapi": "3.1.0",
  "info": {
    "title": "Pathbase API",
    "description": "HTTP API for Pathbase — repositories, agent trace paths, computation graphs, and anonymous share links.\n\n**Stability.** v1 endpoints are stable in shape; additive changes (new fields, new endpoints, broader query params) ship without a version bump. Breaking changes get a new prefix (`/api/v2/...`) and a deprecation window.\n\n**Spec format.** OpenAPI 3.1, served live at `/api/v1/openapi.json`.\n\n**Versioning header.** Every response carries an `X-Pathbase-Version` header with the running build's identifier (`<semver>+<git-sha>`). The spec does not enumerate it per operation; consumers may read it from any response to pin or correlate.\n\n**Auth.** Most endpoints require a `pat_…` bearer token (see `bearerAuth`). Obtain one through the CLI grant flow (`POST /api/v1/auth/cli/request-grant` then `POST /api/v1/auth/cli/redeem`). Unauthenticated endpoints — the `Anon` namespace, public profile reads — are clearly tagged. Per-operation `security` annotations reflect the actual gate.",
    "license": {
      "name": ""
    },
    "version": "1.1.0"
  },
  "servers": [
    {
      "url": "https://pathbase.dev",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/v1/auth/cli/redeem": {
      "post": {
        "tags": [
          "Auth: CLI"
        ],
        "summary": "Redeem a CLI pairing grant for a long-lived bearer token.",
        "description": "Second leg of the CLI pairing flow (see\n`/api/v1/auth/cli/request-grant` for the full sequence). The CLI\nposts the code the user typed; the server normalizes case and\nwhitespace, consumes the grant, and — on a still-valid grant —\nreturns the bearer token plus user. Single-use; subsequent\nredemptions of the same code return 401.\n\nNo authentication is required to call this endpoint; the grant code\nIS the authentication. A code that is unknown, expired, or already\nredeemed all collapse to `401 Unauthorized` so the response cannot\nbe used to probe for valid codes — the three failure modes are\ndeliberately indistinguishable.",
        "operationId": "cli_redeem",
        "requestBody": {
          "description": "The grant code the user pasted into the CLI. Case and surrounding whitespace are normalized server-side.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RedeemBody"
              },
              "example": {
                "code": "AB12CD34"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Grant redeemed. Store `token` securely and send it as `Authorization: Bearer <token>` on subsequent API calls; it is shown only once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RedeemResponse"
                }
              }
            }
          },
          "400": {
            "description": "Code is the wrong length after normalization (must be exactly 8 alphanumeric characters).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Code is unknown, expired, or has already been redeemed. The three failure modes are deliberately indistinguishable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/cli/request-grant": {
      "post": {
        "tags": [
          "Auth: CLI"
        ],
        "summary": "Mint a short-lived grant code for pairing the pathbase CLI to this\nbrowser session.",
        "description": "**Pairing flow.**\n1. Browser (already authenticated) calls this endpoint and displays\n   the returned `code` to the user.\n2. User pastes the code into a CLI prompt (`pathbase login`).\n3. CLI POSTs the code to `/api/v1/auth/cli/redeem`.\n4. Server consumes the grant and returns `{ token, user }` to the\n   CLI.\n5. CLI stores `token` and sends it as `Authorization: Bearer\n   <token>` on every subsequent API call.\n\nThe grant is single-use and expires after a short window. Multiple\ngrants may be active concurrently; redeeming one has no effect on\nexisting tokens.",
        "operationId": "cli_request_grant",
        "responses": {
          "200": {
            "description": "Grant issued. Display `code` to the user so they can paste it into the CLI before `expires_in` seconds elapse.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliGrantResponse"
                }
              }
            }
          },
          "401": {
            "description": "Caller is not authenticated. Grants can only be minted by an already-logged-in browser session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/auth/sessions": {
      "get": {
        "tags": [
          "Auth: Sessions"
        ],
        "summary": "List the authenticated user's active sessions.",
        "description": "Returns one entry per session owned by the caller — both browser\nlogins and CLI tokens. Includes an `is_current` flag so the UI can\nmark which entry is the caller's own session.\n\nUsed by the settings UI to render \"active devices/CLIs\" with a\nper-entry revoke button (which calls\n`DELETE /api/v1/auth/sessions/{id}`).",
        "operationId": "list_sessions",
        "responses": {
          "200": {
            "description": "All active sessions for the current user, including the one that issued this request (marked with `is_current: true`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SessionSummary"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/auth/sessions/{id}": {
      "delete": {
        "tags": [
          "Auth: Sessions"
        ],
        "summary": "Revoke one of the caller's sessions.",
        "description": "Ends the session identified by `{id}`, immediately invalidating\nits token. The caller can revoke any of their own sessions,\nincluding the one that issued this request — doing so will end\nthe current login. Sessions belonging to other users are reported\nas `404 Not Found` (no leakage of \"exists but isn't yours\").",
        "operationId": "revoke_session",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "ID of the session to revoke. Obtain from `GET /api/v1/auth/sessions`. Revoking your current session ends the request's own login.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Session revoked. The associated token is no longer accepted."
          },
          "401": {
            "description": "Not authenticated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No session with this ID exists, or it belongs to another user. The two cases are deliberately conflated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/u/anon/repos/pathstash/graphs": {
      "post": {
        "tags": [
          "Anon"
        ],
        "summary": "Upload a graph anonymously as the `anon` user. No authentication\nrequired; the resulting graph is always `Unlisted` and reachable\nonly via the returned share URL.",
        "operationId": "create_anon_graph",
        "requestBody": {
          "description": "Toolpath Graph document. The body's `visibility` field is ignored; anon uploads are always `Unlisted`.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadGraphBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Graph stored; the `url` in the response is the share link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GraphDocumentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Document failed to parse as a toolpath Graph.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "Request body too large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded; retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/u/me": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Return the authenticated user's full profile.",
        "description": "Canonical \"who am I?\" endpoint. Returns the user matching the\ncaller's bearer token. The returned shape matches the public\n`GET /api/v1/u/{username}` response with one difference: `email`\nis included here because the caller is reading their own profile.",
        "operationId": "get_me",
        "responses": {
          "200": {
            "description": "The authenticated user, including the private `email` field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. Send `Authorization: Bearer <token>`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "tags": [
          "Users"
        ],
        "summary": "Replace the authenticated user's editable profile fields.",
        "description": "PUT semantics: the body is the new state. Fields not present\n(or `null`) are cleared. Username and email are not editable\nhere. Returns the updated user.",
        "operationId": "update_me",
        "requestBody": {
          "description": "Complete new state of the editable profile fields. Missing or `null` clears the field — send the current value to preserve it.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProfileBody"
              },
              "example": {
                "bio": "Wonderland correspondent.",
                "display_name": "Alice Liddell"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Profile updated; returns the post-update user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/u/{owner}/repos": {
      "get": {
        "tags": [
          "Repos"
        ],
        "summary": "List repositories owned by `{owner}`. The DB layer applies the\nvisibility filter in SQL using the resolved `Viewer`: owners get\nall three states (Public + Unlisted + Private); non-owners get\n`Public` only. There is no caller-side branching, and no helper\nthat returns \"everything\" without a viewer.",
        "operationId": "list_repos",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "description": "Owner username",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Optional. Server-bounded; out-of-range values are clamped silently.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Owner's repositories. Owners see all repos; other viewers see only public repos.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Repo"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Owner not found"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ]
      },
      "post": {
        "tags": [
          "Repos"
        ],
        "summary": "Create a new repository owned by the authenticated user.",
        "description": "The new repo's owner is taken from the session — there is no way\nto create a repo on behalf of someone else through this endpoint.\n(Owner usernames in URLs are read-only metadata; ownership is set\nonce at creation.) The repo defaults to public visibility.\n\nReturns the created `Repo` with its server-assigned UUID and\ntimestamps.",
        "operationId": "create_repo",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "description": "Owner username",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Name and optional description for the new repo. Owner is implicit (the authenticated user).",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRepoBody"
              },
              "example": {
                "description": "Captured runs of my coding agent.",
                "name": "agent-traces"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Repository created. Body is the new `Repo`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Repo"
                }
              }
            }
          },
          "401": {
            "description": "Not authorized to create under this owner.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "An owner already has a repo with this `name`. Names are unique per owner.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/u/{owner}/repos/{repo}": {
      "get": {
        "tags": [
          "Repos"
        ],
        "summary": "Fetch a repository by `(owner, name)`.",
        "description": "Public read; no authentication required. Returns the `Repo`\nincluding description, README, visibility flag, and timestamps. To\nlist a repo's paths or graphs, follow up with the corresponding\n`/paths` and `/graphs` collection endpoints.\n\n**Owner aliases.** The literal `me` resolves to the authenticated\nviewer (401 if unauthenticated) — `/u/me/repos/{repo}` is the\nsame as `/u/{your-username}/repos/{repo}` without needing your\nown username. `anon` is the seeded system namespace; its\n`pathstash` repo is reachable here like any other `Unlisted`\nrepo.\n\n**Visibility.** `can_read` is enforced: `Public` returns to anyone,\n`Unlisted` (system-managed; URL-addressable) returns to anyone,\n`Private` returns only to the owner — others get `404`. Repos are\naddressed by guessable name, so there's no share-by-link at this\nlevel for `Private` repos. (Per-graph/per-path share-by-link inside\n`Public` repos is unaffected — those still gate on their own\nvisibility.)",
        "operationId": "get_repo",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "description": "Owner username. The literal `me` resolves to the authenticated viewer (401 if unauthenticated).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "description": "Repository name (unique per owner).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Repository.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Repo"
                }
              }
            }
          },
          "404": {
            "description": "Owner unknown, repo unknown, repo is secret and the viewer is not the owner, or `anon` (no profile).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ]
      },
      "put": {
        "tags": [
          "Repos"
        ],
        "summary": "Replace a repository's editable fields (name, description, README).",
        "description": "Owner-only: the authenticated user must match `{owner}`. The\nliteral `me` resolves to the authenticated viewer's own\nnamespace.\n\nPUT semantics: the body is the new state. To preserve any field,\nsend its current value; missing or `null` clears the nullable\nfields. Visibility is changed through the separate `/visibility`\nsub-resource. Renaming changes the canonical URL of the repo (and\nevery nested resource), so callers should expect old links to 404\nafterward.",
        "operationId": "update_repo",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "description": "Owner username; must match the authenticated user. The literal `me` resolves to the authenticated viewer.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "description": "Repository name (current — pre-rename).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Complete new state of the editable repo fields. `name` is required; missing/`null` clears `description` and `readme`. Send back the current values to preserve them.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateRepoBody"
              },
              "example": {
                "description": "Captured runs of my coding agent (now with vendor labels).",
                "name": "agent-traces",
                "readme": "# agent-traces\n\nUploaded via `pathbase push`."
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Repository updated; returns the post-update `Repo`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Repo"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated, or the caller is not the owner.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Owner unknown, repo unknown, or `\u0007non` (no profile).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Renaming to a name already used by another of this owner's repos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Repos"
        ],
        "summary": "Delete a repository and all its contents.",
        "description": "Owner-only. Removes the repo and all paths and graphs in it.\nIrreversible. The literal `me` resolves to the authenticated\nviewer's own namespace.",
        "operationId": "delete_repo",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "description": "Owner username; must match the authenticated user. The literal `me` resolves to the authenticated viewer.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "description": "Repository name.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Repository (and all paths and graphs in it) deleted."
          },
          "401": {
            "description": "Not authenticated, or the caller is not the owner.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Owner unknown, repo unknown, or `\u0007non` (no profile).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/u/{owner}/repos/{repo}/graphs": {
      "get": {
        "tags": [
          "Graphs"
        ],
        "summary": "List graphs in a repository.",
        "description": "Returns up to `?limit=` graphs under `{owner}/{repo}`, ordered by\ncreation time. The DB layer applies the visibility filter in SQL\nusing the resolved `Viewer`: the owner sees all three states\n(`Public` + `Unlisted` + `Private`) so the UI can render the\n`unlisted` pill and offer a show/hide toggle; everyone else sees\nonly `Public`. Non-public graphs remain reachable by direct UUID\nshare-link regardless of listing visibility.",
        "operationId": "list_graphs",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "description": "Username of the repository's owner.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "description": "Repository name within the owner's namespace.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Optional. Server-bounded; out-of-range values are clamped silently.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of graphs in the repository, capped by `?limit=`. Each entry carries the graph row plus `path_count` and the `url` clients should link to. Owners see all graphs; other viewers see only public graphs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GraphSummaryResponse"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Owner unknown, repo unknown for that owner, or `\u0007non` (no profile).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ]
      },
      "post": {
        "tags": [
          "Graphs"
        ],
        "summary": "Create a graph from a multi-path toolpath document.",
        "description": "Inline path entries (full path objects) are admitted into the same\nworkspace as the graph (deduped by toolpath ID; an existing match\nis linked rather than re-created). Refs to existing paths\n(`{ \"$ref\": \"...\" }` entries) are kept as ID references and not\nre-stored.\n\nCaller must own `{owner}/{repo}`. The `document` field must parse\nas a toolpath v1 `Graph`.",
        "operationId": "create_graph",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "description": "Username of the repository's owner. Must match the authenticated caller.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "description": "Repository name within the owner's namespace.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Multi-path toolpath Graph document, optional display name, and visibility (`public`/`unlisted`/`private`, default `unlisted`). Inline paths are admitted into the workspace; refs are kept as ID references.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadGraphBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The newly created graph with its server-assigned UUID, the reconstructed multi-path `document`, and the canonical `url`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GraphDocumentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Document failed to parse as a toolpath Graph.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing/invalid bearer token, or the authenticated user does not own the target repository.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/u/{owner}/repos/{repo}/graphs/{id}": {
      "get": {
        "tags": [
          "Graphs"
        ],
        "summary": "Fetch a single graph with its full reconstructed multi-path\ndocument. `Public` and `Unlisted` graphs are readable by anyone\n(possession of the UUID is the share token for `Unlisted`);\n`Private` graphs require the caller to authenticate as the owner.\nNon-owner reads of a `Private` graph return `404` — same response as\n\"doesn't exist\" so the gate doesn't leak existence.",
        "description": "Responses carry an `ETag`; conditional requests using\n`If-None-Match` return `304 Not Modified` when the representation\nis unchanged.",
        "operationId": "get_graph",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "description": "Username of the repository's owner.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "description": "Repository name within the owner's namespace.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Graph UUID. For `Unlisted` graphs the UUID is the share token; `Private` graphs additionally require owner authentication.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The graph row, its `path_count`, the reconstructed multi-path `document`, and the canonical `url`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GraphDocumentResponse"
                }
              }
            }
          },
          "304": {
            "description": "If-None-Match matched the current ETag."
          },
          "404": {
            "description": "Owner, repository, or graph not found — or graph is `Private` and the caller isn't the owner.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Graphs"
        ],
        "summary": "Delete a graph. Owner only — knowing the UUID is enough to *read*\n(it's the share token) but not enough to mutate.",
        "operationId": "delete_graph",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "description": "Owner username — must match the authenticated caller.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "description": "Repository name.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Graph UUID.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Graph deleted; constituent paths remain in the workspace."
          },
          "401": {
            "description": "Not authorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/u/{owner}/repos/{repo}/graphs/{id}/download": {
      "get": {
        "tags": [
          "Graphs"
        ],
        "summary": "Stream the graph's reconstructed Graph document as raw JSON — the\ninverse of `POST .../graphs`. `Public` and `Unlisted` graphs\ndownload for anyone with the UUID; `Private` graphs require owner\nauthentication and 404 for everyone else (mirrors \"doesn't exist\").",
        "operationId": "download_graph",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Toolpath Graph JSON file download. Send the returned `ETag` back as `If-None-Match` on a subsequent request to receive 304 when unchanged.",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                },
                "description": "`attachment; filename=\"…\"`. Filename derives from the graph's display `name` when set, otherwise the graph UUID."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Strong ETag for conditional GETs. Echo as `If-None-Match` on subsequent requests."
              }
            },
            "content": {
              "application/json": {}
            }
          },
          "304": {
            "description": "If-None-Match matched the current ETag."
          },
          "404": {
            "description": "Owner, repository, or graph not found — or graph is `Private` and the caller isn't the owner.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/u/{owner}/repos/{repo}/graphs/{id}/paths": {
      "get": {
        "tags": [
          "Graphs"
        ],
        "summary": "List the paths that belong to a graph, in graph-defined order.\nIf the parent graph is readable to the caller (`Public`/`Unlisted`,\nor `Private` for the owner), all of its constituent paths are\nreturned; the parent's UUID is the share token. A `Private` graph\n404s for non-owners — same as the per-graph GET.",
        "operationId": "list_graph_paths",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Optional. Server-bounded; out-of-range values are clamped silently.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of constituent paths in graph-defined order. Each entry carries the path row, `step_count`, and the `url` clients should link to.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TracePathSummaryResponse"
                  }
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/u/{owner}/repos/{repo}/graphs/{id}/paths/{path_id}": {
      "get": {
        "tags": [
          "Graphs"
        ],
        "summary": "Fetch a constituent path with its full reconstructed document.\nConditional via `If-None-Match`.",
        "operationId": "get_graph_path",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "path_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Path row plus `step_count`, the reconstructed Graph `document`, and the canonical `url`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TracePathDocumentResponse"
                }
              }
            }
          },
          "304": {
            "description": "If-None-Match matched the current ETag."
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Graphs"
        ],
        "summary": "Delete a constituent path. Owner only. Cascades to its step rows\nAND removes the junction row from this graph.",
        "operationId": "delete_graph_path",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "path_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": ""
          },
          "401": {
            "description": ""
          },
          "404": {
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "patch": {
        "tags": [
          "Graphs"
        ],
        "summary": "Patch a constituent path's mutable fields — currently just\n`visibility`. Owner only.",
        "operationId": "update_graph_path",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "path_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateGraphPathBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Path updated; returns the path row plus its canonical `url`. Re-fetch the path's full document via the GET endpoint when needed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TracePathResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/u/{owner}/repos/{repo}/graphs/{id}/paths/{path_id}/chat": {
      "get": {
        "tags": [
          "Graphs"
        ],
        "summary": "Render the path's HEAD-ancestor chain as a chat-projection — a\ndensely-indexed, pre-classified, optionally pre-rendered\ntranscript.",
        "operationId": "get_graph_path_chat",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "path_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "include_html",
            "in": "query",
            "description": "Render `text` and `thinking` fields to sanitized HTML\nserver-side. Defaults to true; set false for lighter payloads\nwhen the client renders markdown lazily.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatProjection"
                }
              }
            }
          },
          "404": {
            "description": ""
          }
        }
      }
    },
    "/api/v1/u/{owner}/repos/{repo}/graphs/{id}/visibility": {
      "patch": {
        "tags": [
          "Graphs"
        ],
        "summary": "Toggle a graph's public/secret visibility. Owner only.",
        "operationId": "update_graph_visibility",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateGraphVisibilityBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Visibility updated; returns the graph row plus its canonical `url`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GraphResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/u/{owner}/repos/{repo}/visibility": {
      "patch": {
        "tags": [
          "Repos"
        ],
        "summary": "Flip a repo's visibility between `public` and `private`. The\n`unlisted` state is system-only — owner cannot set it, and any\nrepo currently `unlisted` (e.g., the seeded `pathstash`) is locked.",
        "operationId": "update_repo_visibility",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "description": "Owner username; must match the authenticated user. The literal `me` resolves to the authenticated viewer.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "description": "Repository name.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "New visibility. Repos accept `public` or `private` only — `unlisted` is system-only.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RepoVisibilityBody"
              },
              "example": {
                "visibility": "public"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Visibility updated; returns the post-update `Repo`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Repo"
                }
              }
            }
          },
          "400": {
            "description": "Body contained `unlisted`, which is not accepted on repos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated, or the caller is not the owner.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Repo's current visibility is `Unlisted` (system-pinned); user cannot modify.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Owner unknown, repo unknown, or owner is reserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/api/v1/u/{username}": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Look up a user's public profile by username.",
        "description": "No authentication required. Returns the same `User` shape as\n`/u/me` with one guarantee: `email` is always `null` here — that\nfield is only ever populated for the caller's own profile via\n`GET /api/v1/u/me`.\n\n**Reserved namespaces.** The literal usernames `me` and `anon` are\nreserved and always return 404 from this endpoint. Use\n`GET /api/v1/u/me` for the calling user and `/api/v1/u/anon/...`\nfor anonymous content.",
        "operationId": "get_user",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "description": "Public username. Lowercase ASCII alphanumerics with `-`/`_`. The literal `me` resolves to the authenticated viewer (401 if unauthenticated). `anon` is the seeded system namespace; its profile is not browseable.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public user profile. `email` is always null here; use `/api/v1/u/me` to read your own email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "404": {
            "description": "No user with that username, or the username is the `anon` system namespace (which has no profile).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ActorView": {
        "type": "object",
        "description": "Resolved actor identity for a turn. Lookup happens once on the\nserver against the document's `meta.actors` block; turns reference\nthe actor by `u32` index into the projection's `actors` array.",
        "required": [
          "id",
          "kind",
          "display"
        ],
        "properties": {
          "display": {
            "type": "string",
            "description": "Display name resolved against `meta.actors` if present, else the\nsuffix after `:`."
          },
          "id": {
            "type": "string",
            "description": "Canonical actor string (e.g. `\"claude:opus-4-7\"`)."
          },
          "kind": {
            "type": "string",
            "description": "Prefix before `:` — `\"claude\"`, `\"human\"`, etc."
          },
          "model": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "ApiErrorCode": {
        "type": "string",
        "description": "Closed set of error codes the API can emit. Renders as a snake_case\nstring on the wire (`not_found`, `unauthorized`, …) and is declared\nas an OpenAPI enum so generated clients can switch on it\nexhaustively. Add a variant here, never a free-form string in\nthe `code` field of `ApiErrorResponse`.",
        "enum": [
          "not_found",
          "unauthorized",
          "bad_request",
          "conflict",
          "visibility_locked",
          "internal_error"
        ]
      },
      "ApiErrorResponse": {
        "type": "object",
        "description": "Standard error response envelope for all 4xx/5xx responses.\n\nEvery non-2xx response from the API has this shape. The `code`\nis a short, stable token from a closed enum suitable for\nprogrammatic dispatch; the `error` is a human-readable message\nsuitable for log/UI display.",
        "required": [
          "code",
          "error"
        ],
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ApiErrorCode",
            "description": "Stable token identifying the error class. Clients should\nbranch on this rather than parsing `error`."
          },
          "error": {
            "type": "string",
            "description": "Human-readable error message. Suitable for log/UI display; do\nnot parse for branching."
          }
        }
      },
      "AppendStepsResponse": {
        "type": "object",
        "required": [
          "inserted",
          "path"
        ],
        "properties": {
          "inserted": {
            "type": "integer",
            "description": "Number of steps newly inserted (existing `step_id`s are skipped).",
            "minimum": 0
          },
          "path": {
            "$ref": "#/components/schemas/TracePathDocumentResponse",
            "description": "The path's full HATEOAS-decorated document after the append."
          }
        }
      },
      "ChatCursor": {
        "type": "object",
        "description": "Pagination cursor for fetching older turns. Reserved for future\n`?before=<step_id>` requests; currently every projection returns the\nfull chain in one shot.",
        "properties": {
          "before": {
            "type": "string",
            "description": "Canonical step ID one step older than `turns[0]`. `None` when the\nchain reaches a root step in this projection.",
            "nullable": true
          }
        }
      },
      "ChatProjection": {
        "type": "object",
        "description": "Top-level chat-projection response. Densely-indexed (`u32` IDs into\n`turns` / `actors`) so JSON parsing is cheap and the wire shape\navoids duplicating actor strings on every turn.",
        "required": [
          "path_id",
          "actors",
          "turns",
          "step_ids",
          "cursor"
        ],
        "properties": {
          "actors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActorView"
            }
          },
          "cursor": {
            "$ref": "#/components/schemas/ChatCursor"
          },
          "head": {
            "type": "integer",
            "format": "int32",
            "description": "Index into `turns` — the latest turn along the HEAD chain. `None`\nwhen the document has no head.",
            "minimum": 0,
            "nullable": true
          },
          "path_id": {
            "type": "string"
          },
          "step_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Canonical step IDs parallel to `turns`, for deep-links and\n`/step/{id}` fetches."
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "turns": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatTurn"
            }
          }
        }
      },
      "ChatTurn": {
        "type": "object",
        "description": "One linearized turn along the HEAD-ancestor chain. Already\nclassified, optionally pre-rendered to HTML, with tool invocations\ninlined — the renderer drops in `text_html` and renders no further.",
        "required": [
          "actor_id",
          "is_head",
          "kind",
          "text_html",
          "thinking_html",
          "tool_uses",
          "invocations"
        ],
        "properties": {
          "actor_id": {
            "type": "integer",
            "format": "int32",
            "description": "Index into `actors`.",
            "minimum": 0
          },
          "intent": {
            "type": "string",
            "nullable": true
          },
          "invocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ToolInvocation"
            },
            "description": "`tool.invoke` siblings of an assistant step, spliced inline."
          },
          "is_head": {
            "type": "boolean"
          },
          "kind": {
            "$ref": "#/components/schemas/ChatTurnKind"
          },
          "model": {
            "type": "string",
            "nullable": true
          },
          "parent_id": {
            "type": "integer",
            "format": "int32",
            "description": "Index into `turns` — `i - 1` along the HEAD chain, `None` at the root.",
            "minimum": 0,
            "nullable": true
          },
          "text": {
            "type": "string",
            "nullable": true
          },
          "text_html": {
            "type": "string",
            "description": "Sanitized HTML for `text`. Empty when `include_html` is false or\n`text` is empty."
          },
          "thinking": {
            "type": "string",
            "nullable": true
          },
          "thinking_html": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "nullable": true
          },
          "tool_diff": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/ToolDiff"
              }
            ],
            "description": "For `kind = \"tool\"` only: the first non-empty `change[k].raw`,\npre-split into lines."
          },
          "tool_name": {
            "type": "string",
            "description": "For `kind = \"tool\"` only: the tool name (`extra.name`).",
            "nullable": true
          },
          "tool_uses": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Tool names from `extra.tool_uses` (string list)."
          }
        }
      },
      "ChatTurnKind": {
        "type": "string",
        "description": "Pre-classified turn kind. Server-side classification follows the\nprecedence rules in `packages/frontend/src/classify.ts`; the client\nrenders verbatim without re-deriving.",
        "enum": [
          "user",
          "assistant",
          "tool",
          "system"
        ]
      },
      "CliGrantResponse": {
        "type": "object",
        "description": "Response body for `POST /api/v1/auth/cli/request-grant`.\n\nCarries the human-typeable grant `code` that the user pastes into\nthe pathbase CLI, plus its lifetime. Display the code prominently\nin the UI; do not store it in the URL or log files.",
        "required": [
          "code",
          "expires_in"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "Short, visually unambiguous alphanumeric code. Single-use;\nconsumed by the next call to `/api/v1/auth/cli/redeem`.\nComparison is case-insensitive on redeem."
          },
          "expires_in": {
            "type": "integer",
            "format": "int64",
            "description": "Lifetime of the grant in seconds, set by the server."
          }
        }
      },
      "CreateRepoBody": {
        "type": "object",
        "description": "Request body for `POST /api/v1/u/{owner}/repos`.\n\nCreates a repository owned by the authenticated user. The (owner,\nname) pair must be unique; collisions return 409.",
        "required": [
          "name"
        ],
        "properties": {
          "description": {
            "type": "string",
            "description": "Optional short description shown next to the repo name in\nlistings. Free-form; no length cap.",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "Repository name. Must be unique among the authenticated user's\nexisting repos. Used as the URL slug at\n`/api/v1/u/{owner}/repos/{repo}`."
          },
          "visibility": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/RepoVisibilityInput"
              }
            ],
            "description": "Initial visibility. Defaults to `public` if omitted. The\n`unlisted` state is not accepted on repos — it's reserved for\nthe system-managed pathstash repo and seeded directly in the DB."
          }
        },
        "additionalProperties": false
      },
      "Graph": {
        "type": "object",
        "description": "A computation graph — a named ordered collection of paths within\na repo. Pure storage shape — the columns on `graphs`. Derived\nproperties (path count, reconstructed document) live on the response\nwrappers that need them (`GraphSummary`, `GraphDocument`).",
        "required": [
          "id",
          "repo_id",
          "toolpath_id",
          "visibility",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "header": {
            "type": "object",
            "description": "Graph metadata: `{graph: GraphIdentity, meta?: GraphMeta}` —\nthe toolpath `Graph` shape minus its `paths`. Absent when not set.",
            "nullable": true
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Optional human-readable label for display. Free-form; no URL\nimplications — graphs are addressed by `id` (UUID) at the wire\nboundary. Defaults from the uploader (filename or caller-\nprovided) and can be edited.",
            "nullable": true
          },
          "repo_id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "toolpath_id": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility",
            "description": "Visibility — `Public` is listed and world-readable; `Unlisted`\nis link-share (UUID grants read); `Private` is owner-only."
          }
        }
      },
      "GraphDocumentResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Graph"
          },
          {
            "type": "object",
            "required": [
              "path_count",
              "document",
              "url"
            ],
            "properties": {
              "document": {
                "type": "object",
                "description": "Reconstructed `{ graph, paths: [{path, steps, meta?}, …] }`."
              },
              "path_count": {
                "type": "integer",
                "format": "int32"
              },
              "url": {
                "type": "string"
              }
            }
          }
        ],
        "description": "Wraps a `Graph` with its path count, reconstructed multi-path\ndocument, and the URL. Used by endpoints that promise the full\ndocument on the wire."
      },
      "GraphResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Graph"
          },
          {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string"
              }
            }
          }
        ],
        "description": "`Graph` plus the absolute URL clients should link to."
      },
      "GraphSummaryResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Graph"
          },
          {
            "type": "object",
            "required": [
              "path_count",
              "url"
            ],
            "properties": {
              "path_count": {
                "type": "integer",
                "format": "int32",
                "description": "Number of constituent paths in this graph."
              },
              "url": {
                "type": "string"
              }
            }
          }
        ],
        "description": "Wraps a `Graph` with its path count plus the URL. Used by listing\nendpoints."
      },
      "RedeemBody": {
        "type": "object",
        "description": "Request body for `POST /api/v1/auth/cli/redeem`.\n\nCarries the grant code that the user pasted from the browser into\nthe CLI. Whitespace and case-folding are tolerated server-side.",
        "required": [
          "code"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "The grant code displayed by the browser. Whitespace, dashes,\nand case differences are normalized away (server uppercases and\nstrips non-alphanumerics) before lookup; submit it however the\nuser typed it."
          }
        },
        "additionalProperties": false
      },
      "RedeemResponse": {
        "type": "object",
        "description": "Response body for `POST /api/v1/auth/cli/redeem`.\n\nReturns the new bearer token plus the authenticated user. The token\nis shown to the API ONCE; pathbase cannot recover the plaintext if\nit is lost.",
        "required": [
          "token",
          "user"
        ],
        "properties": {
          "token": {
            "type": "string",
            "description": "Opaque session bearer token, prefixed `pat_…`. Send as\n`Authorization: Bearer <token>` on subsequent API calls. Treat\nas a secret; only its hash is retained server-side, so it\ncannot be re-shown if lost — the user must re-pair the CLI."
          },
          "user": {
            "$ref": "#/components/schemas/User",
            "description": "The user the CLI is now authenticated as."
          }
        }
      },
      "Repo": {
        "type": "object",
        "description": "A repository — a named workspace of paths and graphs owned by a\nsingle user. `name` is unique per owner and serves as the URL\nsegment in `/{owner}/{name}` and nested resources.",
        "required": [
          "id",
          "owner_id",
          "name",
          "visibility",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "owner_id": {
            "type": "string",
            "format": "uuid"
          },
          "readme": {
            "type": "string",
            "nullable": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility",
            "description": "Repository visibility. See `Visibility` for the state semantics.\nRepos are user-controllable as `Public`/`Private`; `Unlisted`\nis system-set (e.g., the seeded `pathstash` repo)."
          }
        }
      },
      "RepoVisibilityBody": {
        "type": "object",
        "description": "Body for `PATCH /api/v1/u/{owner}/repos/{repo}/visibility`.",
        "required": [
          "visibility"
        ],
        "properties": {
          "visibility": {
            "$ref": "#/components/schemas/RepoVisibilityInput"
          }
        },
        "additionalProperties": false
      },
      "RepoVisibilityInput": {
        "type": "string",
        "description": "Write-side narrowing of `Visibility` for repo\nbodies. The repo *read* shape (`Repo.visibility`) still uses the\nfull three-state enum — a `GET` on the seeded `pathstash` repo\nreturns `\"unlisted\"` like always. This type only constrains what\nthe API will *accept* from a client: `Unlisted` is system-pinned,\nusers can't enter or leave it through the API, so it doesn't\nappear in `POST /repos` or `PATCH .../visibility` bodies.\nGenerated clients see only `public | private` on inputs and the\n`Unlisted` write is unreachable by construction. Graph and path\nbodies use the full `Visibility` enum; all three values are legal\nthere.",
        "enum": [
          "public",
          "private"
        ]
      },
      "SessionSummary": {
        "type": "object",
        "description": "One entry of the session list returned by `GET /api/v1/auth/sessions`.\n\nA session is the durable side of an authentication: one entry\nexists for every browser login (`kind = \"web\"`) and every redeemed\nCLI grant (`kind = \"cli\"`). Sessions can be inspected and revoked\nfrom the user's settings UI.",
        "required": [
          "id",
          "kind",
          "created_at",
          "expires_at",
          "is_current"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "description": "RFC 3339 timestamp of session creation."
          },
          "expires_at": {
            "type": "string",
            "description": "RFC 3339 timestamp at which the session token stops being\naccepted."
          },
          "id": {
            "type": "string",
            "description": "Stable session ID. Use this with\n`DELETE /api/v1/auth/sessions/{id}` to revoke."
          },
          "is_current": {
            "type": "boolean",
            "description": "`true` if this entry corresponds to the session that issued\nthe current request — useful for the UI to mark the \"this\ndevice\" entry and warn before revoking it."
          },
          "kind": {
            "type": "string",
            "description": "`\"web\"` for browser logins (password, GitHub OAuth, dev login),\n`\"cli\"` for CLI tokens minted via `/api/v1/auth/cli/redeem`."
          },
          "user_agent": {
            "type": "string",
            "description": "`User-Agent` header captured at session creation. Useful for\n\"is that you on Firefox?\" recognition. May be absent for\nclients that omit the header.",
            "nullable": true
          }
        }
      },
      "ToolDiff": {
        "type": "object",
        "description": "Pre-split diff payload — picked from the first non-empty\n`change[k].raw` on a structural step. Lines are pre-split so the\nrenderer doesn't repeat the work.",
        "required": [
          "path",
          "lines"
        ],
        "properties": {
          "lines": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "path": {
            "type": "string"
          }
        }
      },
      "ToolInvocation": {
        "type": "object",
        "description": "A `tool.invoke` step spliced inline next to its parent assistant\nturn. Saves the client a second pass over the path's step graph.",
        "required": [
          "step_id",
          "actor_id",
          "text_html"
        ],
        "properties": {
          "actor_id": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "input": {
            "type": "string",
            "description": "Tool input args from the structural payload (`extra.input`),\nJSON-stringified when not already a string.",
            "nullable": true
          },
          "result": {
            "type": "string",
            "description": "Tool output from the structural payload (`extra.result`),\nJSON-stringified when not already a string.",
            "nullable": true
          },
          "step_id": {
            "type": "string",
            "description": "Canonical step ID of the tool.invoke step."
          },
          "text": {
            "type": "string",
            "nullable": true
          },
          "text_html": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "nullable": true
          },
          "tool_diff": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/ToolDiff"
              }
            ]
          },
          "tool_name": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "ToolpathDocument": {
        "type": "object",
        "description": "A toolpath v1 Graph document. See <https://github.com/empathic/toolpath>\nfor the full schema; the wire format is JSON with top-level fields\n`graph`, `paths`, and optional `meta`.\n\nThis schema is a permissive object placeholder — generated clients\nsee free-form JSON for `graph`, each entry of `paths`, and `meta`,\nand should defer real validation to the toolpath project.",
        "required": [
          "graph",
          "paths"
        ],
        "properties": {
          "graph": {
            "type": "object",
            "description": "Graph identity and head pointer."
          },
          "meta": {
            "type": "object",
            "description": "Optional document metadata (title, description). Free-form\nobject; clients should defer real validation to the toolpath\nproject.",
            "nullable": true
          },
          "paths": {
            "type": "array",
            "items": {},
            "description": "One or more entries — each is either a full inline path object\nor a `{ \"$ref\": \"...\" }` reference to an external path."
          }
        }
      },
      "TracePath": {
        "type": "object",
        "description": "A single agent trace path within a repo. Pure storage shape — the\ncolumns on `paths`. Derived properties (step count, reconstructed\ndocument) live on the response wrappers that need them\n(`TracePathSummary`, `TracePathDocument`).",
        "required": [
          "id",
          "repo_id",
          "toolpath_id",
          "visibility",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "header": {
            "type": "object",
            "description": "Path metadata: `{path: PathIdentity, meta?: PathMeta}` — the\ntoolpath `Path` shape minus its `steps`. Absent when not set.",
            "nullable": true
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "Optional human-readable label for display. Free-form; no URL\nimplications — paths are addressed by `id` (UUID) at the wire\nboundary. Defaults from the uploader (filename or caller-\nprovided) and can be edited.",
            "nullable": true
          },
          "repo_id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "toolpath_id": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "visibility": {
            "$ref": "#/components/schemas/Visibility",
            "description": "Visibility — `Public` is listed and world-readable; `Unlisted`\nis link-share (UUID grants read); `Private` is owner-only."
          }
        }
      },
      "TracePathDocumentResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/TracePath"
          },
          {
            "type": "object",
            "required": [
              "step_count",
              "document",
              "url"
            ],
            "properties": {
              "document": {
                "type": "object",
                "description": "Reconstructed `{ graph, paths: [{path, steps, meta?}] }`."
              },
              "step_count": {
                "type": "integer",
                "format": "int32"
              },
              "url": {
                "type": "string"
              }
            }
          }
        ],
        "description": "Wraps a `TracePath` with its step count, reconstructed Graph\ndocument, and the URL. Used by endpoints that promise the full\ndocument (single-path GET, append-steps response)."
      },
      "TracePathResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/TracePath"
          },
          {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string",
                "description": "Absolute URL for this path's web page. UUID-addressed: works\nregardless of visibility (knowing the UUID is the share\ntoken for secret resources)."
              }
            }
          }
        ],
        "description": "`TracePath` plus the absolute URL clients should link to."
      },
      "TracePathSummaryResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/TracePath"
          },
          {
            "type": "object",
            "required": [
              "step_count",
              "url"
            ],
            "properties": {
              "step_count": {
                "type": "integer",
                "format": "int32",
                "description": "Number of steps in this path."
              },
              "url": {
                "type": "string"
              }
            }
          }
        ],
        "description": "Wraps a `TracePath` with its step count plus the URL. Used by\nlisting endpoints and any single-row reads that surface the count."
      },
      "UpdateGraphPathBody": {
        "type": "object",
        "properties": {
          "visibility": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/Visibility"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "UpdateGraphVisibilityBody": {
        "type": "object",
        "description": "Body for `PATCH /api/v1/u/{owner}/repos/{repo}/graphs/{id}/visibility`.",
        "required": [
          "visibility"
        ],
        "properties": {
          "visibility": {
            "$ref": "#/components/schemas/Visibility",
            "description": "New graph visibility. `public` lists in feeds and is anonymously\nreadable; `unlisted` hides from listings but stays reachable via\nthe UUID share link; `private` restricts read to the owner."
          }
        },
        "additionalProperties": false
      },
      "UpdateProfileBody": {
        "type": "object",
        "description": "Body for `PUT /api/v1/u/me`.\n\nCarries the complete replacement state of the editable profile\nfields. PUT semantics: the body IS the new value — fields not\npresent (or set to `null`) are cleared. To preserve an existing\nvalue, send it back. Read the current values from `GET /u/me`.\n\nUsername and email are NOT editable here — username is immutable\nand email is bound to the auth provider.",
        "properties": {
          "bio": {
            "type": "string",
            "description": "Free-form short biography rendered on the user's public\nprofile. Missing or `null` clears the field. No length cap is\nenforced at the API layer; expect Markdown but no rendering\nguarantees.",
            "nullable": true
          },
          "display_name": {
            "type": "string",
            "description": "Human-readable display name shown next to the username on\nprofile pages and trace headers. Missing or `null` clears the\nfield (the UI then falls back to the bare username).",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateRepoBody": {
        "type": "object",
        "description": "Request body for `PUT /api/v1/u/{owner}/repos/{repo}`.\n\nCarries the complete replacement state of the editable repo\nfields. PUT semantics: every field is written. To preserve an\nexisting value, send it back; missing or `null` for the nullable\nfields clears them. Read the current state from `GET /repos/{repo}`\nfirst if the form doesn't already have it.\n\nVisibility is NOT editable here — it lives at the sub-resource\n`/repos/{repo}/visibility` for two reasons: (1) it's a single\nwell-defined op clients flip independently of content edits, and\n(2) `Unlisted` is system-only and that gate is cleaner to enforce\non its own endpoint.",
        "required": [
          "name"
        ],
        "properties": {
          "description": {
            "type": "string",
            "description": "New description. Missing or `null` clears the field.",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "New repository name. Required (the column is non-nullable —\nthere is no \"no name\" state). Renames must be unique among\nthis owner's repos (409 on collision). Renaming changes the\nURL of the repo and every nested resource — clients holding\nold URLs will 404 afterward."
          },
          "readme": {
            "type": "string",
            "description": "New README body (free-form text/Markdown). Missing or `null`\nclears the field. No length cap is enforced at the API layer.",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UploadGraphBody": {
        "type": "object",
        "description": "Request body for `POST /api/v1/u/{owner}/repos/{repo}/graphs`.\n\nThe `document` field carries a multi-path toolpath Graph; inline\npath entries are admitted into the workspace and deduped by their\ntoolpath ID, refs are kept as ID references.",
        "required": [
          "document"
        ],
        "properties": {
          "document": {
            "$ref": "#/components/schemas/ToolpathDocument",
            "description": "The toolpath v1 Graph document with one or more `PathOrRef`\nentries. Inline paths are admitted into the same workspace as\nthe graph; refs are kept as ID references to existing paths."
          },
          "name": {
            "type": "string",
            "description": "Optional human-readable display label. Free-form; no URL or\nuniqueness implications — the server addresses the created\ngraph by its UUID `id` in the response. Defaults to whatever\nthe uploader (web/CLI) chose to send, typically the filename.",
            "nullable": true
          },
          "visibility": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/Visibility"
              }
            ],
            "description": "Graph visibility. Omitted defaults to `unlisted` —\nreachable only via the graph's UUID share link or to the\nauthenticated owner. Flip later via `PATCH\n/graphs/{id}/visibility`."
          }
        },
        "additionalProperties": false
      },
      "User": {
        "type": "object",
        "description": "A registered Pathbase account. `email` is optional because GitHub\nOAuth users can have a private email; CLI / API consumers see the\ncaller's own email via `/u/me` but never another user's.",
        "required": [
          "id",
          "username",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "bio": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "display_name": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "description": "Caller's own email. Populated only by `GET /api/v1/u/me` (the\nauthenticated self-read). The public profile endpoint\n`GET /api/v1/u/{username}` always returns `null` here; emails\nare never exposed across users.",
            "nullable": true
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "username": {
            "type": "string"
          }
        }
      },
      "Visibility": {
        "type": "string",
        "description": "The visibility state of a `Repo`, `TracePath`, or `Graph`. Used uniformly\nacross the three entities at the storage and wire layers.\n\n- `Public`: appears in public and owner listings, readable by anyone.\n- `Unlisted`: hidden from default listings (even from the owner), but\n  readable by anyone in possession of the resource's URL/ID. The\n  resource ID is the access gate — for paths/graphs that's the UUID;\n  for repos it's a system-pinned state used by `pathstash` only.\n- `Private`: hidden from public listings, listed only to the owner,\n  readable only by the owner.",
        "enum": [
          "public",
          "unlisted",
          "private"
        ]
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Pathbase personal access token (`pat_…`) obtained via the CLI grant flow (`POST /auth/cli/request-grant` then `POST /auth/cli/redeem`). Send as `Authorization: Bearer <token>`."
      }
    }
  },
  "tags": [
    {
      "name": "Auth: CLI",
      "description": "CLI pairing — request a short-lived grant code and redeem it for a `pat_…` bearer token."
    },
    {
      "name": "Auth: Sessions",
      "description": "Inspect and revoke the caller's active sessions (browser logins and CLI tokens)."
    },
    {
      "name": "Users",
      "description": "User profiles and ownership listings."
    },
    {
      "name": "Repos",
      "description": "Repositories: create, list, update, delete."
    },
    {
      "name": "Graphs",
      "description": "Computation graphs and their constituent trace paths."
    },
    {
      "name": "Anon",
      "description": "Unauthenticated share-by-link uploads under the `anon` user. Always `Unlisted`."
    }
  ]
}