@backmatter/studio 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/chunks/{UiKitApp-DkuQBiQZ.js → UiKitApp-B1ANqCac.js} +528 -481
  2. package/dist/chunks/{WorkspaceRoutes-DVvb3N-V.js → WorkspaceRoutes-BHNGrf-j.js} +24371 -23915
  3. package/dist/chunks/{dashboard-B4FITg6c.js → dashboard-b-W6dGm5.js} +586 -565
  4. package/dist/chunks/{index-CegtXnEI.js → index-HYioDjux.js} +104 -104
  5. package/dist/dashboard.js +2 -2
  6. package/dist/index.js +166 -159
  7. package/dist/site-widget.css +25 -6
  8. package/dist/site-widget.js +6925 -6840
  9. package/dist/studio.css +159 -36
  10. package/package.json +2 -2
  11. package/src/api.ts +41 -1
  12. package/src/chat/ChatMessage.tsx +4 -4
  13. package/src/chat/ChatProvider.tsx +6 -0
  14. package/src/chat/chat-helpers.ts +54 -2
  15. package/src/chrome/CommandPalette.tsx +3 -3
  16. package/src/chrome/ContentExplorerSidebar.tsx +421 -74
  17. package/src/chrome/WorkspaceStatusBar.tsx +24 -24
  18. package/src/chrome/commit-error.ts +48 -60
  19. package/src/chrome/commit-failure.tsx +2 -2
  20. package/src/chrome/content-path-tree.ts +4 -0
  21. package/src/chrome/explorer-row-menu.ts +28 -0
  22. package/src/chrome/folder-create-context.ts +14 -0
  23. package/src/chrome/use-publish-check.ts +75 -0
  24. package/src/fields/FieldControl.tsx +173 -62
  25. package/src/pages/DocEditorPage.tsx +47 -64
  26. package/src/pages/EmbedPublishPage.tsx +13 -5
  27. package/src/pages/GithubConnectPage.tsx +1 -1
  28. package/src/pages/LoginPage.tsx +67 -5
  29. package/src/pages/MediaFieldInput.tsx +155 -63
  30. package/src/pages/MediaGalleryPage.tsx +56 -3
  31. package/src/pages/PreviewAddress.tsx +30 -0
  32. package/src/pages/WorkspaceHomePage.tsx +1 -1
  33. package/src/pages/ui-kit/colors.tsx +2 -0
  34. package/src/pages/ui-kit/fields.tsx +60 -0
  35. package/src/styles/themes.ts +2 -0
  36. package/src/styles/tokens.stylex.ts +1 -0
  37. package/src/ui/Button.tsx +14 -0
  38. package/src/ui/Field.tsx +12 -1
  39. package/src/ui/Input.tsx +191 -97
  40. package/src/ui/popup.ts +13 -6
package/dist/studio.css CHANGED
@@ -11,6 +11,10 @@
11
11
  inset: 0;
12
12
  }
13
13
 
14
+ .x485pll {
15
+ inset: clamp(12px, 3vw, 32px);
16
+ }
17
+
14
18
  .x184nht {
15
19
  inset: var(--x1o7ezzp);
16
20
  }
@@ -69,6 +73,10 @@
69
73
  border-color: #ffffff1a;
70
74
  }
71
75
 
76
+ .x16s2x7e {
77
+ border-color: #fff9;
78
+ }
79
+
72
80
  .xe0g8ez {
73
81
  border-color: #ffffffb8;
74
82
  }
@@ -411,10 +419,6 @@
411
419
  border-color: var(--x1nzi8h4);
412
420
  }
413
421
 
414
- .xqvbft6:focus-visible {
415
- border-color: var(--xz3qvk5);
416
- }
417
-
418
422
  .xowh0s7:focus-visible {
419
423
  border-radius: var(--x16ewcrl);
420
424
  }
@@ -439,10 +443,6 @@
439
443
  border-color: var(--xw4dauw);
440
444
  }
441
445
 
442
- .xlsk2y3:focus {
443
- border-color: var(--xz3qvk5);
444
- }
445
-
446
446
  .x1uvtmcs:focus {
447
447
  outline: none;
448
448
  }
@@ -489,8 +489,8 @@
489
489
  -webkit-text-fill-color: transparent;
490
490
  }
491
491
 
492
- .x1h22klu {
493
- accent-color: var(--x5y0tk9);
492
+ .x1kb3qnp {
493
+ accent-color: #fafafa;
494
494
  }
495
495
 
496
496
  .x1pha0wt {
@@ -585,6 +585,10 @@
585
585
  animation-timing-function: linear;
586
586
  }
587
587
 
588
+ .xjyslct {
589
+ appearance: none;
590
+ }
591
+
588
592
  .x1plog1 {
589
593
  aspect-ratio: 1;
590
594
  }
@@ -689,6 +693,10 @@
689
693
  background-color: #18181b47;
690
694
  }
691
695
 
696
+ .xz16w0k {
697
+ background-color: #18181bd9;
698
+ }
699
+
692
700
  .x1iprpvx {
693
701
  background-color: #ffffff17;
694
702
  }
@@ -721,6 +729,10 @@
721
729
  background-color: var(--x13g60fp);
722
730
  }
723
731
 
732
+ .x15a9b3o {
733
+ background-color: var(--x13vbpmf);
734
+ }
735
+
724
736
  .xplmcw3 {
725
737
  background-color: var(--x1bx3j4t);
726
738
  }
@@ -801,6 +813,10 @@
801
813
  border-collapse: collapse;
802
814
  }
803
815
 
816
+ .xbf8z7v {
817
+ box-shadow: 0 0 0 2px var(--x1dudhym),0 0 0 4px var(--x1nzi8h4);
818
+ }
819
+
804
820
  .x1s0jfod {
805
821
  box-shadow: 0 10px 28px #18181b29;
806
822
  }
@@ -817,14 +833,30 @@
817
833
  box-shadow: 0 16px 48px #18181b33;
818
834
  }
819
835
 
836
+ .x1hujrgp {
837
+ box-shadow: 0 18px 48px #0000006b, 0 2px 8px #0003;
838
+ }
839
+
820
840
  .x1dej7w9 {
821
841
  box-shadow: 0 1px 2px #00000014;
822
842
  }
823
843
 
844
+ .x600is {
845
+ box-shadow: 0 1px 2px #00000029;
846
+ }
847
+
848
+ .x7fwzwe {
849
+ box-shadow: 0 1px 2px #00000047;
850
+ }
851
+
824
852
  .xtpupu6 {
825
853
  box-shadow: 0 1px 2px #18181b33;
826
854
  }
827
855
 
856
+ .x17u0ql0 {
857
+ box-shadow: 0 24px 64px #00000059;
858
+ }
859
+
828
860
  .xzlluq {
829
861
  box-shadow: 0 28px 80px #18181b29, inset 0 0 0 1px #ffffff8c;
830
862
  }
@@ -1117,14 +1149,14 @@
1117
1149
  grid-template-columns: repeat(2, minmax(0, 1fr));
1118
1150
  }
1119
1151
 
1120
- .xbqmlv7 {
1121
- grid-template-columns: repeat(4, 48px);
1122
- }
1123
-
1124
1152
  .x1sipb5g {
1125
1153
  grid-template-columns: repeat(4, minmax(0, 1fr));
1126
1154
  }
1127
1155
 
1156
+ .x9v2mtg {
1157
+ grid-template-columns: repeat(auto-fill, 72px);
1158
+ }
1159
+
1128
1160
  .x10vl0y4 {
1129
1161
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
1130
1162
  }
@@ -1287,6 +1319,10 @@
1287
1319
  opacity: 1;
1288
1320
  }
1289
1321
 
1322
+ .xj2npx7 {
1323
+ opacity: var(--remove-opacity, 0);
1324
+ }
1325
+
1290
1326
  .x1ljc5jn {
1291
1327
  outline-color: var(--x1nzi8h4);
1292
1328
  }
@@ -1295,10 +1331,18 @@
1295
1331
  outline-color: var(--xz3qvk5);
1296
1332
  }
1297
1333
 
1334
+ .x1hl8ikr {
1335
+ outline-offset: 2px;
1336
+ }
1337
+
1298
1338
  .x1ewu8gn {
1299
1339
  outline-offset: 3px;
1300
1340
  }
1301
1341
 
1342
+ .x107h2d7 {
1343
+ outline-style: dashed;
1344
+ }
1345
+
1302
1346
  .xaatb59 {
1303
1347
  outline-style: solid;
1304
1348
  }
@@ -1431,6 +1475,10 @@
1431
1475
  transform-origin: calc(100% - 60px) 100%;
1432
1476
  }
1433
1477
 
1478
+ .x1g0ag68 {
1479
+ transform-origin: center;
1480
+ }
1481
+
1434
1482
  .xctpfpq {
1435
1483
  transform-origin: var(--transform-origin);
1436
1484
  }
@@ -1531,6 +1579,10 @@
1531
1579
  transition-property: width;
1532
1580
  }
1533
1581
 
1582
+ .x1p0hc1o {
1583
+ transition-timing-function: cubic-bezier(.2, 0, 0, 1);
1584
+ }
1585
+
1534
1586
  .x1ys8gui {
1535
1587
  transition-timing-function: cubic-bezier(.215, .61, .355, 1);
1536
1588
  }
@@ -1626,6 +1678,10 @@
1626
1678
  color: var(--x11n7hvk);
1627
1679
  }
1628
1680
 
1681
+ .x25t5g8:focus-visible {
1682
+ opacity: 1;
1683
+ }
1684
+
1629
1685
  .x1yxvn1h:focus-visible {
1630
1686
  outline-color: var(--x1nzi8h4);
1631
1687
  }
@@ -1746,6 +1802,10 @@
1746
1802
  outline-width: 2px;
1747
1803
  }
1748
1804
 
1805
+ .xch2mbi:active {
1806
+ cursor: grabbing;
1807
+ }
1808
+
1749
1809
  .xd3so5o:active {
1750
1810
  transform: scale(.97);
1751
1811
  }
@@ -1770,6 +1830,12 @@
1770
1830
  }
1771
1831
  }
1772
1832
 
1833
+ @media (hover: hover) {
1834
+ .x5zbl5r.x5zbl5r {
1835
+ color: var(--xw4dauw);
1836
+ }
1837
+ }
1838
+
1773
1839
  @media (width >= 1024px) {
1774
1840
  .x1wecdhn.x1wecdhn {
1775
1841
  cursor: col-resize;
@@ -1833,6 +1899,10 @@
1833
1899
  background-color: #e4e4e7;
1834
1900
  }
1835
1901
 
1902
+ .x9ezvp6.x9ezvp6:hover {
1903
+ background-color: #18181b;
1904
+ }
1905
+
1836
1906
  .x1h6wuyy.x1h6wuyy:hover {
1837
1907
  background-color: #0000;
1838
1908
  }
@@ -2026,6 +2096,10 @@
2026
2096
  height: 28px;
2027
2097
  }
2028
2098
 
2099
+ .x36qwtl {
2100
+ height: 2px;
2101
+ }
2102
+
2029
2103
  .xettwda {
2030
2104
  height: 2rem;
2031
2105
  }
@@ -2090,10 +2164,6 @@
2090
2164
  height: min(640px,calc(100vh - 68px - env(safe-area-inset-bottom, 0px)));
2091
2165
  }
2092
2166
 
2093
- .xpojsfq {
2094
- height: min(720px, 80vh);
2095
- }
2096
-
2097
2167
  .xu96u03 {
2098
2168
  left: 0;
2099
2169
  }
@@ -2106,6 +2176,10 @@
2106
2176
  left: 50%;
2107
2177
  }
2108
2178
 
2179
+ .xx8bi4a {
2180
+ left: 7px;
2181
+ }
2182
+
2109
2183
  .xe5jagu {
2110
2184
  left: var(--x1ft7ks7);
2111
2185
  }
@@ -2170,6 +2244,10 @@
2170
2244
  margin-top: 0;
2171
2245
  }
2172
2246
 
2247
+ .xr9ek0c {
2248
+ margin-top: 2px;
2249
+ }
2250
+
2173
2251
  .x1tfhste {
2174
2252
  margin-top: 40px;
2175
2253
  }
@@ -2398,6 +2476,10 @@
2398
2476
  min-width: 10rem;
2399
2477
  }
2400
2478
 
2479
+ .xbq476d {
2480
+ min-width: 11.5rem;
2481
+ }
2482
+
2401
2483
  .xee1316 {
2402
2484
  min-width: 11rem;
2403
2485
  }
@@ -2526,6 +2608,10 @@
2526
2608
  padding-left: calc(var(--x1ft7ks7) + var(--x1uiwg42));
2527
2609
  }
2528
2610
 
2611
+ .x19qf7k3 {
2612
+ padding-left: calc(var(--x1uiwg42) + var(--x1lzhbes) + 14px + var(--x1o7ezzp));
2613
+ }
2614
+
2529
2615
  .x1g65kkx {
2530
2616
  padding-left: var(--x1ft7ks7);
2531
2617
  }
@@ -2542,6 +2628,10 @@
2542
2628
  padding-right: 8px;
2543
2629
  }
2544
2630
 
2631
+ .x2zv159 {
2632
+ padding-right: var(--x1ft7ks7);
2633
+ }
2634
+
2545
2635
  .xznc5xv {
2546
2636
  padding-right: var(--x1lzhbes);
2547
2637
  }
@@ -2578,6 +2668,10 @@
2578
2668
  right: 0;
2579
2669
  }
2580
2670
 
2671
+ .xlftelb {
2672
+ right: 12px;
2673
+ }
2674
+
2581
2675
  .xn5hqff {
2582
2676
  right: 16px;
2583
2677
  }
@@ -2586,6 +2680,10 @@
2586
2680
  right: 2px;
2587
2681
  }
2588
2682
 
2683
+ .x1d37e2g {
2684
+ right: 7px;
2685
+ }
2686
+
2589
2687
  .xjcl65e {
2590
2688
  right: var(--x1ft7ks7);
2591
2689
  }
@@ -2598,6 +2696,10 @@
2598
2696
  right: var(--x1o7ezzp);
2599
2697
  }
2600
2698
 
2699
+ .x118cjmx {
2700
+ right: var(--x1uiwg42);
2701
+ }
2702
+
2601
2703
  .x1swmuje {
2602
2704
  right: var(--xvc7yhn);
2603
2705
  }
@@ -2606,6 +2708,10 @@
2606
2708
  top: 0;
2607
2709
  }
2608
2710
 
2711
+ .x1tk7jg1 {
2712
+ top: 12px;
2713
+ }
2714
+
2609
2715
  .x1lrs4fz {
2610
2716
  top: 18vh;
2611
2717
  }
@@ -2626,14 +2732,14 @@
2626
2732
  top: 50%;
2627
2733
  }
2628
2734
 
2629
- .x1blgq8 {
2630
- top: 8vh;
2631
- }
2632
-
2633
2735
  .x87tjf4 {
2634
2736
  top: var(--x1ft7ks7);
2635
2737
  }
2636
2738
 
2739
+ .x9rb8gd {
2740
+ top: var(--x1uiwg42);
2741
+ }
2742
+
2637
2743
  .x1agl8dm {
2638
2744
  top: var(--x1y1rrep);
2639
2745
  }
@@ -2766,6 +2872,10 @@
2766
2872
  width: 6px;
2767
2873
  }
2768
2874
 
2875
+ .xni59qk {
2876
+ width: 72px;
2877
+ }
2878
+
2769
2879
  .x1l24a0r {
2770
2880
  width: 7rem;
2771
2881
  }
@@ -2782,12 +2892,12 @@
2782
2892
  width: auto;
2783
2893
  }
2784
2894
 
2785
- .x12pdk5b {
2786
- width: calc(min(360px, 38vw) - 48px);
2895
+ .x18f6uos {
2896
+ width: calc(100% - 14px);
2787
2897
  }
2788
2898
 
2789
- .xeq5yr9 {
2790
- width: fit-content;
2899
+ .x12pdk5b {
2900
+ width: calc(min(360px, 38vw) - 48px);
2791
2901
  }
2792
2902
 
2793
2903
  .x3bfboh {
@@ -2822,10 +2932,6 @@
2822
2932
  width: min(760px, 100%);
2823
2933
  }
2824
2934
 
2825
- .xuxp2mc {
2826
- width: min(960px, 100vw - 32px);
2827
- }
2828
-
2829
2935
  .x1hhjr3y {
2830
2936
  width: var(--anchor-width);
2831
2937
  }
@@ -2854,8 +2960,8 @@
2854
2960
  width: var(--xvc7yhn);
2855
2961
  }
2856
2962
 
2857
- .xo5mw66:focus-visible {
2858
- border-bottom-color: var(--xz3qvk5);
2963
+ .x1nthoga:focus-visible {
2964
+ border-bottom-color: var(--x1nzi8h4);
2859
2965
  }
2860
2966
 
2861
2967
  .x1t1lzn6:last-child {
@@ -2866,8 +2972,8 @@
2866
2972
  margin-bottom: 0;
2867
2973
  }
2868
2974
 
2869
- .xdq5akm:focus {
2870
- border-bottom-color: var(--xz3qvk5);
2975
+ .xqg1kb6:focus {
2976
+ border-bottom-color: var(--x1nzi8h4);
2871
2977
  }
2872
2978
 
2873
2979
  @media (width <= 800px) {
@@ -3093,6 +3199,7 @@
3093
3199
  --x1xbnvpt: #f4f4f5;
3094
3200
  --xbtbsdh: #ececef;
3095
3201
  --x1dudhym: #fff;
3202
+ --x13vbpmf: #fff;
3096
3203
  --xeg52a: #18181b0d;
3097
3204
  --xfamku2: #18181b14;
3098
3205
  --x1fg5qi: #fff;
@@ -3110,7 +3217,7 @@
3110
3217
  --x1nzi8h4: #18181b;
3111
3218
  }
3112
3219
 
3113
- .x145rjjm.x145rjjm, .x145rjjm.x145rjjm:root {
3220
+ .x1qwws05.x1qwws05, .x1qwws05.x1qwws05:root {
3114
3221
  --x11n7hvk: #18181b;
3115
3222
  --x1vnpaut: #3f3f46;
3116
3223
  --x1ljpve6: #f4f4f5;
@@ -3120,6 +3227,7 @@
3120
3227
  --x1fg5qi: #fff;
3121
3228
  --x1xbnvpt: #f4f4f5;
3122
3229
  --xbtbsdh: #ececef;
3230
+ --x13vbpmf: #fff;
3123
3231
  --xoa6ql4: #ececee;
3124
3232
  --x13g60fp: #f4f4f5;
3125
3233
  --x1dudhym: #fff;
@@ -3133,7 +3241,7 @@
3133
3241
  --xw4dauw: #71717a;
3134
3242
  }
3135
3243
 
3136
- .xohh2l7.xohh2l7, .xohh2l7.xohh2l7:root {
3244
+ .x1ht4xdt.x1ht4xdt, .x1ht4xdt.x1ht4xdt:root {
3137
3245
  --x11n7hvk: #fafafa;
3138
3246
  --x1vnpaut: #e4e4e7;
3139
3247
  --x1ljpve6: #ffffff1a;
@@ -3143,6 +3251,7 @@
3143
3251
  --x1fg5qi: #18181b;
3144
3252
  --x1xbnvpt: #131316;
3145
3253
  --xbtbsdh: #0f0f12;
3254
+ --x13vbpmf: #2c2c32;
3146
3255
  --xoa6ql4: #111113;
3147
3256
  --x13g60fp: #111113;
3148
3257
  --x1dudhym: #1f1f23;
@@ -3155,3 +3264,17 @@
3155
3264
  --xadaimi: #18181b;
3156
3265
  --xw4dauw: #a1a1aa;
3157
3266
  }
3267
+
3268
+ .xyim6s9 {
3269
+ --remove-opacity: 0;
3270
+ }
3271
+
3272
+ .x1f1teyk:focus-within, .x172mly1:hover {
3273
+ --remove-opacity: 1;
3274
+ }
3275
+
3276
+ @media (hover: none) {
3277
+ .x1ldwc8i.x1ldwc8i {
3278
+ --remove-opacity: 1;
3279
+ }
3280
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backmatter/studio",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "The Backmatter editing surface: document editor, AI chat, publish. Mounted on your site or hosted on the dashboard.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@ai-sdk/react": "^4.0.100",
59
- "@backmatter/core": "^0.0.35",
59
+ "@backmatter/core": "^0.0.36",
60
60
  "@base-ui/react": "^1.6.0",
61
61
  "@central-icons-react/round-outlined-radius-2-stroke-1.5": "1.2.15",
62
62
  "@dnd-kit/abstract": "^0.5.0",
package/src/api.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  // packages/studio/src/api.ts
2
+ import type { Problem } from "@backmatter/core";
2
3
  import { replicaQuery, type ReplicaCache } from "./replica/cache";
3
4
  import type { ReplicaBody } from "./replica/types";
4
5
  import { apiCredentials, apiHeaders, apiUrl, reportUnauthorized } from "./studio-config";
@@ -7,6 +8,7 @@ export type ApiError = Error & {
7
8
  status: number;
8
9
  code?: string;
9
10
  details?: string[];
11
+ problems?: Problem[];
10
12
  };
11
13
 
12
14
  async function api<T>(path: string, init?: RequestInit): Promise<T> {
@@ -24,6 +26,7 @@ async function api<T>(path: string, init?: RequestInit): Promise<T> {
24
26
  error?: string;
25
27
  details?: string[];
26
28
  paths?: string[];
29
+ problems?: Problem[];
27
30
  };
28
31
  if (res.status === 401 || res.status === 426) reportUnauthorized(res.status, body.error);
29
32
  const code = body.error ?? `request failed: ${res.status}`;
@@ -31,10 +34,12 @@ async function api<T>(path: string, init?: RequestInit): Promise<T> {
31
34
  Array.isArray(body.details) && body.details.length > 0
32
35
  ? `: ${body.details.join(", ")}`
33
36
  : "";
34
- const err = new Error(`${code}${detailSuffix}`) as ApiError;
37
+ const problems = Array.isArray(body.problems) ? body.problems : undefined;
38
+ const err = new Error(problems?.[0]?.message ?? `${code}${detailSuffix}`) as ApiError;
35
39
  err.status = res.status;
36
40
  err.code = body.error;
37
41
  err.details = body.details ?? body.paths;
42
+ err.problems = problems;
38
43
  throw err;
39
44
  }
40
45
  return res.json() as Promise<T>;
@@ -492,6 +497,13 @@ export function commitWorkspace(workspaceId: string, message?: string) {
492
497
  });
493
498
  }
494
499
 
500
+ /** Every problem a publish would hit. Nothing reaches git. */
501
+ export function checkWorkspaceChanges(workspaceId: string) {
502
+ return api<{ problems: Problem[]; checkId: string }>(`/workspaces/${workspaceId}/git/check`, {
503
+ method: "POST",
504
+ });
505
+ }
506
+
495
507
  export type CodeSessionEditList = {
496
508
  files: Array<{ path: string; deleted: boolean }>;
497
509
  skipped: Array<{ path: string; reason: string }>;
@@ -724,6 +736,34 @@ export function saveDoc(
724
736
  });
725
737
  }
726
738
 
739
+ /** Move a document to a new slug in my working tree. The old path is removed. */
740
+ export function renameDoc(
741
+ workspaceId: string,
742
+ type: string,
743
+ slug: string,
744
+ nextSlug: string,
745
+ ) {
746
+ return api<{
747
+ doc: {
748
+ type: string;
749
+ slug: string;
750
+ source: "tree";
751
+ status: DocStatus;
752
+ headSha: string | null;
753
+ };
754
+ }>(docApiPath(workspaceId, type, slug, "/rename"), {
755
+ method: "POST",
756
+ body: JSON.stringify({ slug: nextSlug }),
757
+ });
758
+ }
759
+
760
+ /** Remove a document from my working tree. */
761
+ export function deleteDoc(workspaceId: string, type: string, slug: string) {
762
+ return api<{ ok: true }>(docApiPath(workspaceId, type, slug), {
763
+ method: "DELETE",
764
+ });
765
+ }
766
+
727
767
  /** Drop my uncommitted copy; the doc reads from HEAD again. */
728
768
  export function revertDoc(
729
769
  workspaceId: string,
@@ -11,7 +11,7 @@ import { useChatSession, useChatUI } from "./ChatProvider";
11
11
  import {
12
12
  assistantShowsRow,
13
13
  bindDocsPlaceholders,
14
- isCommitTool,
14
+ toolFailed,
15
15
  isWriteTool,
16
16
  presentedChangeStatus,
17
17
  replaceEchoedDocList,
@@ -74,6 +74,8 @@ function docListFromTool(
74
74
 
75
75
  function ToolIcon({ name }: { name: string }) {
76
76
  if (name === "commit") return <CheckIcon size={12} />;
77
+ if (name === "revertDoc" || name === "resolveConflict") return <UndoIcon size={12} />;
78
+ if (name === "getStatus" || name === "checkChanges") return <EyeIcon size={12} />;
77
79
  if (name === "searchDocs") return <SearchIcon size={12} />;
78
80
  if (name === "readDoc" || name === "listDocs") return <EyeIcon size={12} />;
79
81
  return <FileIcon size={12} />;
@@ -301,10 +303,8 @@ export function ChatMessage({
301
303
  tp.state,
302
304
  );
303
305
  const write = isWriteTool(name);
304
- const commit = isCommitTool(name);
305
306
  const out = tp.state === "output-available" ? (tp.output as WriteToolOutput) : null;
306
- const failed =
307
- tp.state === "output-error" || (out !== null && (write || commit) && !out.ok);
307
+ const failed = tp.state === "output-error" || toolFailed(out);
308
308
  const error = failed
309
309
  ? (tp.state === "output-error"
310
310
  ? tp.errorText
@@ -28,6 +28,7 @@ import {
28
28
  keepAllChanges,
29
29
  keepChange,
30
30
  notifyHeadChanged,
31
+ notifyWorkspaceChanged,
31
32
  notifyTreeChanged,
32
33
  undoAllChanges,
33
34
  undoChange,
@@ -62,6 +63,7 @@ import {
62
63
  changesInToolOutput,
63
64
  detailForTreePatch,
64
65
  treeStatusPatches,
66
+ branchToolReloads,
65
67
  type TreeStatusPatch,
66
68
  } from "./chat-helpers";
67
69
  import {
@@ -734,6 +736,10 @@ function LiveSession({
734
736
  if (part.state === "output-available" && !seen.has(part.toolCallId)) {
735
737
  seen.add(part.toolCallId);
736
738
  if (checkoutWriteReloads(name, part.output)) onCheckoutWrite?.();
739
+ if (branchToolReloads(name, part.output)) {
740
+ notifyWorkspaceChanged();
741
+ notifyHeadChanged();
742
+ }
737
743
  const patches = treeStatusPatches(part.output);
738
744
  if (patches.length > 0) publishTreePatches(workspaceId, patches);
739
745
  const found = write ? changesInToolOutput(part.output) : [];