@justanarthur/modo-ui-ai 0.2.0 → 0.3.0

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 (74) hide show
  1. package/blocks/conversation/agent-prompt/index.tsx +3 -3
  2. package/blocks/conversation/composer/examples.mdx +50 -0
  3. package/blocks/conversation/composer/index.tsx +182 -48
  4. package/blocks/conversation/transcript/index.tsx +8 -6
  5. package/blocks/dialogs/command-palette/examples.mdx +17 -0
  6. package/blocks/dialogs/command-palette/index.tsx +12 -5
  7. package/blocks/panes/usage-pane/examples.mdx +10 -0
  8. package/blocks/panes/usage-pane/index.tsx +8 -5
  9. package/blocks/profiles/profile-switcher/examples.mdx +11 -0
  10. package/blocks/profiles/profile-switcher/index.tsx +18 -3
  11. package/blocks/profiles/profile-usage/examples.mdx +20 -0
  12. package/blocks/profiles/profile-usage/index.tsx +22 -8
  13. package/blocks/sessions/session-sidebar/examples.mdx +53 -3
  14. package/blocks/sessions/session-sidebar/index.tsx +133 -78
  15. package/components/conversation/agent-run/examples.mdx +8 -0
  16. package/components/conversation/agent-run/index.tsx +4 -3
  17. package/components/conversation/message/index.tsx +8 -6
  18. package/components/conversation/reasoning/examples.mdx +10 -0
  19. package/components/conversation/reasoning/index.tsx +5 -4
  20. package/dist/blocks/conversation/agent-prompt/index.d.ts +1 -1
  21. package/dist/blocks/conversation/agent-prompt/index.js +1 -1
  22. package/dist/blocks/conversation/composer/index.d.ts +1 -1
  23. package/dist/blocks/conversation/composer/index.js +3 -2
  24. package/dist/blocks/conversation/transcript/index.d.ts +11 -11
  25. package/dist/blocks/conversation/transcript/index.js +3 -3
  26. package/dist/blocks/dialogs/command-palette/index.d.ts +1 -1
  27. package/dist/blocks/dialogs/command-palette/index.js +4 -4
  28. package/dist/blocks/panes/side-pane/index.js +3 -3
  29. package/dist/blocks/panes/usage-pane/index.d.ts +1 -1
  30. package/dist/blocks/panes/usage-pane/index.js +2 -2
  31. package/dist/blocks/profiles/profile-switcher/index.d.ts +1 -1
  32. package/dist/blocks/profiles/profile-switcher/index.js +2 -1
  33. package/dist/blocks/profiles/profile-usage/index.d.ts +1 -1
  34. package/dist/blocks/profiles/profile-usage/index.js +2 -2
  35. package/dist/blocks/sessions/session-board/index.js +8 -7
  36. package/dist/blocks/sessions/session-sidebar/index.d.ts +1 -1
  37. package/dist/blocks/sessions/session-sidebar/index.js +4 -4
  38. package/dist/components/conversation/agent-run/index.d.ts +1 -1
  39. package/dist/components/conversation/message/index.d.ts +2 -2
  40. package/dist/components/conversation/message/index.js +5 -5
  41. package/dist/components/conversation/reasoning/index.d.ts +1 -1
  42. package/dist/components/conversation/reasoning/index.js +1 -1
  43. package/dist/index.d.ts +12 -12
  44. package/dist/index.js +17 -17
  45. package/dist/lib/pace-bar.d.ts +1 -1
  46. package/dist/lib/pace.d.ts +2 -2
  47. package/dist/lib/pace.js +3 -1
  48. package/dist/shared/{chunk-rzajcn44.d.ts → chunk-1hzrm8r5.d.ts} +3 -1
  49. package/dist/shared/{chunk-k5zegxje.d.ts → chunk-1qdwg7w5.d.ts} +10 -10
  50. package/dist/shared/{chunk-cd4f87as.d.ts → chunk-3ps5h55t.d.ts} +2 -0
  51. package/dist/shared/{chunk-45rqgey6.d.ts → chunk-3yaftgh0.d.ts} +6 -3
  52. package/dist/shared/{chunk-1f96cz69.js → chunk-58jh3mje.js} +3 -2
  53. package/dist/shared/{chunk-1aq2xzv5.js → chunk-6kwk9vag.js} +4 -4
  54. package/dist/shared/{chunk-4248zvmh.js → chunk-6rdwkymk.js} +1 -1
  55. package/dist/shared/{chunk-gkyk663q.d.ts → chunk-71j8qzvb.d.ts} +8 -4
  56. package/dist/shared/{chunk-6g4970a6.d.ts → chunk-74bvf3tw.d.ts} +3 -2
  57. package/dist/shared/{chunk-w5z8qnf8.js → chunk-7mfer3tp.js} +4 -3
  58. package/dist/shared/{chunk-bzs6amnv.js → chunk-94grzz9f.js} +4 -4
  59. package/dist/shared/{chunk-g28hweee.d.ts → chunk-b4dz15em.d.ts} +4 -3
  60. package/dist/shared/{chunk-8xg5gwwy.js → chunk-b5ccp5de.js} +2 -5
  61. package/dist/shared/{chunk-rjfwje37.d.ts → chunk-dxzrtvt9.d.ts} +58 -9
  62. package/dist/shared/{chunk-fbn0h7cr.js → chunk-fapc805j.js} +11 -4
  63. package/dist/shared/{chunk-sfqvyzcs.d.ts → chunk-fm1qyrae.d.ts} +6 -6
  64. package/dist/shared/{chunk-5k6xwqfj.d.ts → chunk-gb5ee5dw.d.ts} +27 -7
  65. package/dist/shared/{chunk-a4s440b6.js → chunk-mnzw0bav.js} +4 -3
  66. package/dist/shared/{chunk-wgvzavx1.js → chunk-n31qwnj2.js} +88 -32
  67. package/dist/shared/{chunk-kw9npka5.js → chunk-njf851p1.js} +44 -23
  68. package/dist/shared/{chunk-hd4gtj5z.d.ts → chunk-nkbgg7bw.d.ts} +4 -3
  69. package/dist/shared/{chunk-cmwby8f9.js → chunk-nvh33x9x.js} +112 -91
  70. package/dist/shared/{chunk-4n0v64qx.js → chunk-qt31n444.js} +7 -8
  71. package/dist/shared/{chunk-szkvrqg1.d.ts → chunk-ty2ccknv.d.ts} +4 -4
  72. package/dist/shared/{chunk-vd59gzzd.js → chunk-wq9h37gy.js} +3 -3
  73. package/lib/pace.ts +7 -3
  74. package/package.json +3 -3
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-n4742y54.js";
9
9
  import {
10
10
  ProfileSwitcher2
11
- } from "./chunk-kw9npka5.js";
11
+ } from "./chunk-njf851p1.js";
12
12
 
13
13
  // blocks/conversation/composer/index.tsx
14
14
  import { SurfaceProvider as SurfaceProvider2, useSurface } from "@justanarthur/modo-ui";
@@ -23,9 +23,9 @@ import Switch from "@justanarthur/modo-ui/components/inputs/switch";
23
23
  import Dropdown from "@justanarthur/modo-ui/components/overlays/dropdown";
24
24
  import Popover from "@justanarthur/modo-ui/components/overlays/popover";
25
25
  import { SURFACE_BG } from "@justanarthur/modo-ui/lib/surface-classes";
26
+ import { useControllableState as useControllableState4 } from "@justanarthur/modo-ui/lib/use-controllable-state";
26
27
  import { cn as cn5 } from "@justanarthur/modo-ui/lib/utils";
27
28
  import { SizeProvider } from "@justanarthur/modo-ui/primitives/systems/sizes";
28
- import { useState as useState6 } from "react";
29
29
 
30
30
  // blocks/conversation/composer/draft.tsx
31
31
  import { SurfaceProvider, useAutosizeTextarea, useReduceMotion, useTouchPrimary } from "@justanarthur/modo-ui";
@@ -1086,21 +1086,29 @@ function AddPalette({ files, commands, onAttach }) {
1086
1086
  ]
1087
1087
  });
1088
1088
  }
1089
+ function inList(value, options, fallback = options[0] ?? "") {
1090
+ return options.includes(value) ? value : fallback;
1091
+ }
1089
1092
  function ProjectPicker({
1090
1093
  projects,
1091
1094
  branches,
1092
1095
  branch,
1093
- locked
1096
+ locked,
1097
+ project,
1098
+ onProjectChange,
1099
+ worktree,
1100
+ onWorktreeChange,
1101
+ baseBranch,
1102
+ onBaseBranchChange
1094
1103
  }) {
1095
- const [project, setProject] = useState6(projects[0]?.label ?? "");
1096
- const [worktree, setWorktree] = useState6(true);
1104
+ const label = projects.find((p) => p.path === project)?.label ?? "";
1097
1105
  const Folder = useIcon2("folder");
1098
1106
  const Branch = useIcon2("git-branch");
1099
1107
  return /* @__PURE__ */ jsxs6(Popover, {
1100
1108
  children: [
1101
1109
  /* @__PURE__ */ jsx6(Popover.Trigger, {
1102
1110
  render: /* @__PURE__ */ jsxs6(RowTrigger2, {
1103
- "aria-label": `Project: ${project}${worktree ? ", new worktree" : ""}`,
1111
+ "aria-label": `Project: ${label}${worktree ? ", new worktree" : ""}`,
1104
1112
  children: [
1105
1113
  /* @__PURE__ */ jsx6(Folder, {
1106
1114
  size: 14,
@@ -1109,7 +1117,7 @@ function ProjectPicker({
1109
1117
  }),
1110
1118
  /* @__PURE__ */ jsx6("span", {
1111
1119
  className: "min-w-0 truncate",
1112
- children: project
1120
+ children: label
1113
1121
  }),
1114
1122
  worktree && /* @__PURE__ */ jsx6(Branch, {
1115
1123
  size: 14,
@@ -1132,11 +1140,11 @@ function ProjectPicker({
1132
1140
  children: /* @__PURE__ */ jsx6(ChoiceList, {
1133
1141
  label: "Project",
1134
1142
  value: project,
1135
- onValueChange: setProject,
1143
+ onValueChange: onProjectChange,
1136
1144
  options: projects.map((g) => ({
1137
- value: g.label,
1145
+ value: g.path,
1138
1146
  label: g.label,
1139
- disabled: locked && g.label !== project,
1147
+ disabled: locked && g.path !== project,
1140
1148
  content: /* @__PURE__ */ jsxs6("span", {
1141
1149
  className: "flex min-w-0 flex-1 items-baseline justify-between gap-2",
1142
1150
  children: [
@@ -1168,7 +1176,7 @@ function ProjectPicker({
1168
1176
  children: /* @__PURE__ */ jsx6(Switch, {
1169
1177
  label: "New worktree",
1170
1178
  checked: worktree,
1171
- onCheckedChange: setWorktree,
1179
+ onCheckedChange: onWorktreeChange,
1172
1180
  disabled: locked,
1173
1181
  className: LIST_SWITCH
1174
1182
  })
@@ -1185,7 +1193,8 @@ function ProjectPicker({
1185
1193
  /* @__PURE__ */ jsx6(List.Row, {
1186
1194
  label: "Base branch",
1187
1195
  children: /* @__PURE__ */ jsxs6(Select, {
1188
- defaultValue: branches[0],
1196
+ value: baseBranch,
1197
+ onValueChange: onBaseBranchChange,
1189
1198
  disabled: locked,
1190
1199
  children: [
1191
1200
  /* @__PURE__ */ jsx6(Select.Trigger, {
@@ -1217,16 +1226,17 @@ function RunSettings({
1217
1226
  outputStyles,
1218
1227
  context,
1219
1228
  compacting,
1220
- defaultModel,
1221
- defaultEffort,
1222
- defaultMode,
1223
- defaultFast
1229
+ model,
1230
+ onModelChange,
1231
+ effort,
1232
+ onEffortChange,
1233
+ mode,
1234
+ onModeChange,
1235
+ fast,
1236
+ onFastChange,
1237
+ style,
1238
+ onStyleChange
1224
1239
  }) {
1225
- const [model, setModel] = useState6(defaultModel);
1226
- const [effort, setEffort] = useState6(defaultEffort);
1227
- const [mode, setMode] = useState6(defaultMode);
1228
- const [fast, setFast] = useState6(defaultFast);
1229
- const [style, setStyle] = useState6(outputStyles[0] ?? "");
1230
1240
  const activeMode = permissionModes.find((m) => m.label === mode);
1231
1241
  const ModeIcon = useIcon2(activeMode?.icon ?? "shield-check");
1232
1242
  const Zap = useIcon2("zap");
@@ -1279,7 +1289,7 @@ function RunSettings({
1279
1289
  children: /* @__PURE__ */ jsx6(ChoiceList, {
1280
1290
  label: "Model",
1281
1291
  value: model,
1282
- onValueChange: setModel,
1292
+ onValueChange: onModelChange,
1283
1293
  options: models.map((m) => ({
1284
1294
  value: m.name,
1285
1295
  label: m.name,
@@ -1308,7 +1318,7 @@ function RunSettings({
1308
1318
  max: efforts.length - 1,
1309
1319
  step: 1,
1310
1320
  value: Math.max(efforts.indexOf(effort), 0),
1311
- onValueChange: (v) => setEffort(efforts[typeof v === "number" ? v : v[0]] ?? effort),
1321
+ onValueChange: (v) => onEffortChange(efforts[typeof v === "number" ? v : v[0]] ?? effort),
1312
1322
  formatValue: (v) => efforts[v] ?? ""
1313
1323
  })
1314
1324
  }),
@@ -1319,7 +1329,7 @@ function RunSettings({
1319
1329
  label: "Permissions",
1320
1330
  children: /* @__PURE__ */ jsxs6(Select, {
1321
1331
  value: mode,
1322
- onValueChange: setMode,
1332
+ onValueChange: onModeChange,
1323
1333
  children: [
1324
1334
  /* @__PURE__ */ jsx6(Select.Trigger, {
1325
1335
  variant: "borderless",
@@ -1342,7 +1352,7 @@ function RunSettings({
1342
1352
  children: /* @__PURE__ */ jsx6(Switch, {
1343
1353
  label: "Fast mode",
1344
1354
  checked: fast,
1345
- onCheckedChange: setFast,
1355
+ onCheckedChange: onFastChange,
1346
1356
  className: LIST_SWITCH
1347
1357
  })
1348
1358
  }),
@@ -1350,7 +1360,7 @@ function RunSettings({
1350
1360
  label: "Output style",
1351
1361
  children: /* @__PURE__ */ jsxs6(Select, {
1352
1362
  value: style,
1353
- onValueChange: setStyle,
1363
+ onValueChange: onStyleChange,
1354
1364
  children: [
1355
1365
  /* @__PURE__ */ jsx6(Select.Trigger, {
1356
1366
  variant: "borderless",
@@ -1417,21 +1427,54 @@ var Composer2 = Object.assign(function Composer({
1417
1427
  projects,
1418
1428
  branches,
1419
1429
  branch,
1430
+ project: projectProp,
1431
+ defaultProject,
1432
+ onProjectChange,
1433
+ worktree: worktreeProp,
1434
+ defaultWorktree = true,
1435
+ onWorktreeChange,
1436
+ baseBranch: baseBranchProp,
1437
+ defaultBaseBranch,
1438
+ onBaseBranchChange,
1420
1439
  profiles,
1440
+ model: modelProp,
1421
1441
  defaultModel,
1422
- defaultPermissionMode,
1442
+ onModelChange,
1443
+ effort: effortProp,
1423
1444
  defaultEffort,
1445
+ onEffortChange,
1446
+ permissionMode: permissionModeProp,
1447
+ defaultPermissionMode,
1448
+ onPermissionModeChange,
1449
+ fast: fastProp,
1424
1450
  defaultFast = false,
1451
+ onFastChange,
1452
+ outputStyle: outputStyleProp,
1453
+ defaultOutputStyle,
1454
+ onOutputStyleChange,
1425
1455
  context = 0.62,
1426
1456
  compacting = false,
1427
1457
  defaultStatus = "idle",
1428
1458
  target = false,
1459
+ profile,
1429
1460
  defaultProfile,
1430
1461
  onProfileChange,
1431
1462
  placeholder = "Ask, or type / for commands",
1432
1463
  className,
1433
1464
  ...draft
1434
1465
  }) {
1466
+ const projectPaths = projects.map((p) => p.path);
1467
+ const modelNames = models.map((m) => m.name);
1468
+ const modeLabels = permissionModes.map((m) => m.label);
1469
+ const middleEffort = efforts[Math.floor(efforts.length / 2)] ?? "";
1470
+ const [project, setProject] = useControllableState4(projectProp, defaultProject ?? "", onProjectChange);
1471
+ const [worktree, setWorktree] = useControllableState4(worktreeProp, defaultWorktree, onWorktreeChange);
1472
+ const [baseBranch, setBaseBranch] = useControllableState4(baseBranchProp, defaultBaseBranch ?? "", onBaseBranchChange);
1473
+ const [model, setModel] = useControllableState4(modelProp, defaultModel ?? "", onModelChange);
1474
+ const [effort, setEffort] = useControllableState4(effortProp, defaultEffort ?? middleEffort, onEffortChange);
1475
+ const [mode, setMode] = useControllableState4(permissionModeProp, defaultPermissionMode ?? "", onPermissionModeChange);
1476
+ const [fast, setFast] = useControllableState4(fastProp, defaultFast, onFastChange);
1477
+ const [style, setStyle] = useControllableState4(outputStyleProp, defaultOutputStyle ?? "", onOutputStyleChange);
1435
1478
  return /* @__PURE__ */ jsx6(ShellCard, {
1436
1479
  variant: "elevated",
1437
1480
  className: cn5("w-full", className),
@@ -1444,10 +1487,17 @@ var Composer2 = Object.assign(function Composer({
1444
1487
  projects,
1445
1488
  branches,
1446
1489
  branch,
1447
- locked: !target
1490
+ locked: !target,
1491
+ project: inList(project, projectPaths),
1492
+ onProjectChange: setProject,
1493
+ worktree,
1494
+ onWorktreeChange: setWorktree,
1495
+ baseBranch: inList(baseBranch, branches),
1496
+ onBaseBranchChange: setBaseBranch
1448
1497
  }),
1449
1498
  /* @__PURE__ */ jsx6(ProfileSwitcher2, {
1450
1499
  profiles,
1500
+ value: profile,
1451
1501
  defaultValue: defaultProfile,
1452
1502
  onValueChange: onProfileChange,
1453
1503
  side: "top"
@@ -1461,10 +1511,16 @@ var Composer2 = Object.assign(function Composer({
1461
1511
  outputStyles,
1462
1512
  context,
1463
1513
  compacting,
1464
- defaultModel: defaultModel ?? models[0]?.name ?? "",
1465
- defaultEffort: defaultEffort ?? efforts[Math.floor(efforts.length / 2)] ?? "",
1466
- defaultMode: defaultPermissionMode ?? permissionModes[0]?.label ?? "",
1467
- defaultFast
1514
+ model: inList(model, modelNames),
1515
+ onModelChange: setModel,
1516
+ effort: inList(effort, efforts, middleEffort),
1517
+ onEffortChange: setEffort,
1518
+ mode: inList(mode, modeLabels),
1519
+ onModeChange: setMode,
1520
+ fast,
1521
+ onFastChange: setFast,
1522
+ style: inList(style, outputStyles),
1523
+ onStyleChange: setStyle
1468
1524
  })
1469
1525
  })
1470
1526
  ]
@@ -3,6 +3,10 @@
3
3
  import {
4
4
  useIcon2
5
5
  } from "./chunk-xkchhs2z.js";
6
+ import {
7
+ NO_USAGE2,
8
+ percent2
9
+ } from "./chunk-58jh3mje.js";
6
10
  import {
7
11
  RowTrigger2
8
12
  } from "./chunk-n4742y54.js";
@@ -18,7 +22,7 @@ import Popover from "@justanarthur/modo-ui/components/overlays/popover";
18
22
  import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable-state";
19
23
  import { cn } from "@justanarthur/modo-ui/lib/utils";
20
24
  import { SizeProvider } from "@justanarthur/modo-ui/primitives/systems/sizes";
21
- import { jsx, jsxs } from "react/jsx-runtime";
25
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
22
26
  /*!
23
27
  * Local addition: the AI app's profile switcher. A profile is one
24
28
  * Claude config dir (its own `claude` process, sign-in and limits) or an
@@ -47,7 +51,7 @@ function ProfileTile2({ profile, size = "md", className }) {
47
51
  });
48
52
  }
49
53
  function ProfileRow({ profile }) {
50
- const top = Math.max(...profile.limits.map((l) => l.value));
54
+ const top = profile.limits.length > 0 ? Math.max(...profile.limits.map((l) => l.value)) : undefined;
51
55
  return /* @__PURE__ */ jsxs("span", {
52
56
  className: "flex min-w-0 flex-1 items-center gap-2",
53
57
  children: [
@@ -71,12 +75,20 @@ function ProfileRow({ profile }) {
71
75
  value: limit.value
72
76
  }, limit.label))
73
77
  }),
74
- /* @__PURE__ */ jsxs("span", {
78
+ /* @__PURE__ */ jsx("span", {
75
79
  className: "w-8 shrink-0 text-right text-caption tabular-nums text-muted-foreground",
76
- children: [
77
- Math.round(top * 100),
78
- "%"
79
- ]
80
+ children: top === undefined ? /* @__PURE__ */ jsxs(Fragment, {
81
+ children: [
82
+ /* @__PURE__ */ jsx("span", {
83
+ "aria-hidden": "true",
84
+ children: "–"
85
+ }),
86
+ /* @__PURE__ */ jsx("span", {
87
+ className: "sr-only",
88
+ children: NO_USAGE2
89
+ })
90
+ ]
91
+ }) : percent2(top)
80
92
  })
81
93
  ]
82
94
  });
@@ -170,24 +182,33 @@ function ProfileSwitcher2({
170
182
  }) }))
171
183
  })
172
184
  }),
173
- /* @__PURE__ */ jsx(List.Section, {
185
+ /* @__PURE__ */ jsxs(List.Section, {
174
186
  title: `Limits · ${active.name}`,
175
187
  aside: active.provider === "compatible" ? active.baseUrl : active.configDir,
176
- children: active.limits.map((limit) => /* @__PURE__ */ jsxs(List.Row, {
177
- label: limit.label,
178
- children: [
179
- /* @__PURE__ */ jsx(Meter, {
180
- variant: "line",
181
- className: "w-16",
182
- label: limit.label,
183
- value: limit.value
184
- }),
185
- /* @__PURE__ */ jsx("span", {
186
- className: "w-28 pr-[var(--space-3)] text-right text-caption tabular-nums text-muted-foreground",
187
- children: limit.detail
188
- })
189
- ]
190
- }, limit.label))
188
+ children: [
189
+ active.limits.length === 0 && /* @__PURE__ */ jsxs("p", {
190
+ className: "m-0 px-[var(--space-2)] text-caption text-muted-foreground",
191
+ children: [
192
+ NO_USAGE2,
193
+ ": limits show once a session under this profile reports usage."
194
+ ]
195
+ }),
196
+ active.limits.map((limit) => /* @__PURE__ */ jsxs(List.Row, {
197
+ label: limit.label,
198
+ children: [
199
+ /* @__PURE__ */ jsx(Meter, {
200
+ variant: "line",
201
+ className: "w-16",
202
+ label: limit.label,
203
+ value: limit.value
204
+ }),
205
+ /* @__PURE__ */ jsx("span", {
206
+ className: "w-28 pr-[var(--space-3)] text-right text-caption tabular-nums text-muted-foreground",
207
+ children: limit.detail
208
+ })
209
+ ]
210
+ }, limit.label))
211
+ ]
191
212
  }),
192
213
  /* @__PURE__ */ jsxs("div", {
193
214
  className: "flex items-center gap-[var(--space-1)]",
@@ -1,8 +1,8 @@
1
1
  import { ReactNode } from "react";
2
2
  import { JSX as JSX_1kxb } from "react";
3
3
  interface ReasoningProps2 {
4
- /** How long it thought, shown in the row: `"12s"`. */
5
- duration: string;
4
+ /** How long it thought, shown in the row: `"12s"` reads "Thought for 12s". Omit when the timing is unknown: the row reads "Thought". */
5
+ duration?: string;
6
6
  /** The reasoning text, folded until opened. */
7
7
  children: ReactNode;
8
8
  /** Start unfolded. Defaults to `false`. */
@@ -10,7 +10,8 @@ interface ReasoningProps2 {
10
10
  }
11
11
  type Element_12xgc = JSX_1kxb["Element"];
12
12
  /**
13
- * The reasoning behind a reply, folded to one row: "Thought for 12s".
13
+ * The reasoning behind a reply, folded to one row: "Thought for 12s", or
14
+ * "Thought" when the timing is unknown.
14
15
  *
15
16
  * Press the row and the reasoning morphs out of it (see Accordion), set in
16
17
  * the muted color behind a hairline so it reads as an aside, not the answer.
@@ -9,10 +9,10 @@ import {
9
9
  } from "./chunk-ejtknc0w.js";
10
10
  import {
11
11
  ProfileTile2
12
- } from "./chunk-kw9npka5.js";
12
+ } from "./chunk-njf851p1.js";
13
13
  import {
14
14
  ProfileUsage2
15
- } from "./chunk-fbn0h7cr.js";
15
+ } from "./chunk-fapc805j.js";
16
16
  import {
17
17
  inbox_default
18
18
  } from "./chunk-x9jf26yb.js";
@@ -63,7 +63,8 @@ function ReorderAction() {
63
63
  children: /* @__PURE__ */ jsx(Grip, {})
64
64
  });
65
65
  }
66
- function SessionRow({ session, reorder, onOpenSplit }) {
66
+ function SessionRow({ session, reorder, archived = false, actions }) {
67
+ const { onOpenSplit, onPin, onArchive, onRename, onMarkUnread, onFork } = actions;
67
68
  const Pin = useIcon2("pin");
68
69
  const Archive = useIcon2("archive");
69
70
  const More = useIcon2("more-vertical");
@@ -73,6 +74,72 @@ function SessionRow({ session, reorder, onOpenSplit }) {
73
74
  const Branch = useIcon2("git-branch");
74
75
  const glyph = STATUS_GLYPH2[session.status];
75
76
  const children = session.children ?? [];
77
+ const pinLabel = session.pinned ? "Unpin" : "Pin";
78
+ const archiveLabel = archived ? "Unarchive" : "Archive";
79
+ const menu = [
80
+ onOpenSplit && /* @__PURE__ */ jsx(MenuItem, {
81
+ icon: Columns,
82
+ label: "Open in split view",
83
+ onSelect: () => onOpenSplit(session.id)
84
+ }, "split"),
85
+ onRename && /* @__PURE__ */ jsx(MenuItem, {
86
+ icon: Pencil,
87
+ label: "Rename",
88
+ onSelect: () => onRename(session.id)
89
+ }, "rename"),
90
+ onMarkUnread && session.status !== "unread" && /* @__PURE__ */ jsx(MenuItem, {
91
+ icon: Dot,
92
+ label: "Mark as unread",
93
+ onSelect: () => onMarkUnread(session.id)
94
+ }, "unread"),
95
+ onFork && /* @__PURE__ */ jsx(MenuItem, {
96
+ icon: Branch,
97
+ label: "Fork into a new session",
98
+ onSelect: () => onFork(session.id)
99
+ }, "fork"),
100
+ reorder && onArchive && /* @__PURE__ */ jsx(MenuItem, {
101
+ icon: Archive,
102
+ label: archiveLabel,
103
+ onSelect: () => onArchive(session.id, !archived)
104
+ }, "archive")
105
+ ].filter(Boolean);
106
+ const cluster = [
107
+ reorder && /* @__PURE__ */ jsx(ReorderAction, {}, "reorder"),
108
+ onPin && /* @__PURE__ */ jsx(Tooltip, {
109
+ content: pinLabel,
110
+ side: "top",
111
+ children: /* @__PURE__ */ jsx(Sidebar.MenuAction, {
112
+ "aria-label": pinLabel,
113
+ onClick: () => onPin(session.id, !session.pinned),
114
+ children: /* @__PURE__ */ jsx(Pin, {})
115
+ })
116
+ }, "pin"),
117
+ !reorder && onArchive && /* @__PURE__ */ jsx(Tooltip, {
118
+ content: archiveLabel,
119
+ side: "top",
120
+ children: /* @__PURE__ */ jsx(Sidebar.MenuAction, {
121
+ "aria-label": archiveLabel,
122
+ onClick: () => onArchive(session.id, !archived),
123
+ children: /* @__PURE__ */ jsx(Archive, {})
124
+ })
125
+ }, "archive"),
126
+ menu.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, {
127
+ children: [
128
+ /* @__PURE__ */ jsx(DropdownTrigger, {
129
+ render: /* @__PURE__ */ jsx(Sidebar.MenuAction, {
130
+ "aria-label": "More options",
131
+ children: /* @__PURE__ */ jsx(More, {})
132
+ })
133
+ }),
134
+ /* @__PURE__ */ jsx(DropdownContent, {
135
+ className: "w-[240px] min-w-0",
136
+ align: "start",
137
+ sideOffset: 4,
138
+ children: menu
139
+ })
140
+ ]
141
+ }, "more")
142
+ ].filter(Boolean);
76
143
  return /* @__PURE__ */ jsxs(Sidebar.MenuItem, {
77
144
  collapsible: children.length > 0 ? true : undefined,
78
145
  defaultOpen: children.length > 0 ? true : undefined,
@@ -90,70 +157,9 @@ function SessionRow({ session, reorder, onOpenSplit }) {
90
157
  /* @__PURE__ */ jsx(Sidebar.MenuBadge, {
91
158
  children: session.updated
92
159
  }),
93
- /* @__PURE__ */ jsx(Sidebar.MenuActions, {
160
+ cluster.length > 0 && /* @__PURE__ */ jsx(Sidebar.MenuActions, {
94
161
  showOnHover: true,
95
- children: [
96
- reorder && /* @__PURE__ */ jsx(ReorderAction, {}, "reorder"),
97
- /* @__PURE__ */ jsx(Tooltip, {
98
- content: session.pinned ? "Unpin" : "Pin",
99
- side: "top",
100
- children: /* @__PURE__ */ jsx(Sidebar.MenuAction, {
101
- "aria-label": session.pinned ? "Unpin" : "Pin",
102
- children: /* @__PURE__ */ jsx(Pin, {})
103
- })
104
- }, "pin"),
105
- !reorder && /* @__PURE__ */ jsx(Tooltip, {
106
- content: "Archive",
107
- side: "top",
108
- children: /* @__PURE__ */ jsx(Sidebar.MenuAction, {
109
- "aria-label": "Archive",
110
- children: /* @__PURE__ */ jsx(Archive, {})
111
- })
112
- }, "archive"),
113
- /* @__PURE__ */ jsxs(DropdownMenu, {
114
- children: [
115
- /* @__PURE__ */ jsx(DropdownTrigger, {
116
- render: /* @__PURE__ */ jsx(Sidebar.MenuAction, {
117
- "aria-label": "More options",
118
- children: /* @__PURE__ */ jsx(More, {})
119
- })
120
- }),
121
- /* @__PURE__ */ jsxs(DropdownContent, {
122
- className: "w-[240px] min-w-0",
123
- align: "start",
124
- sideOffset: 4,
125
- children: [
126
- /* @__PURE__ */ jsx(MenuItem, {
127
- index: 0,
128
- icon: Columns,
129
- label: "Open in split view",
130
- onSelect: () => onOpenSplit?.(session.id)
131
- }),
132
- /* @__PURE__ */ jsx(MenuItem, {
133
- index: 1,
134
- icon: Pencil,
135
- label: "Rename"
136
- }),
137
- /* @__PURE__ */ jsx(MenuItem, {
138
- index: 2,
139
- icon: Dot,
140
- label: "Mark as unread"
141
- }),
142
- /* @__PURE__ */ jsx(MenuItem, {
143
- index: 3,
144
- icon: Branch,
145
- label: "Fork into a new session"
146
- }),
147
- reorder && /* @__PURE__ */ jsx(MenuItem, {
148
- index: 4,
149
- icon: Archive,
150
- label: "Archive"
151
- })
152
- ]
153
- })
154
- ]
155
- }, "more")
156
- ].filter(Boolean)
162
+ children: cluster
157
163
  }),
158
164
  children.length > 0 && /* @__PURE__ */ jsx(Sidebar.MenuSub, {
159
165
  children: children.map((child) => /* @__PURE__ */ jsx(Sidebar.MenuSubItem, {
@@ -261,6 +267,13 @@ function SessionSidebar2({
261
267
  defaultValue,
262
268
  onValueChange,
263
269
  onOpenSplit,
270
+ onPin,
271
+ onArchive,
272
+ onRename,
273
+ onMarkUnread,
274
+ onFork,
275
+ onNewSessionIn,
276
+ onFilterSection,
264
277
  onOpenSettings,
265
278
  inbox,
266
279
  onInboxAction,
@@ -275,6 +288,7 @@ function SessionSidebar2({
275
288
  const Bell = useIcon2("bell");
276
289
  const unread = inbox?.filter((item) => !item.read).length ?? 0;
277
290
  const waiting = everySession(pinned, groups).filter((s) => s.status === "waiting").length;
291
+ const actions = { onOpenSplit, onPin, onArchive, onRename, onMarkUnread, onFork };
278
292
  return /* @__PURE__ */ jsxs(Sidebar, {
279
293
  variant,
280
294
  className,
@@ -378,7 +392,7 @@ function SessionSidebar2({
378
392
  content: /* @__PURE__ */ jsx(SessionRow, {
379
393
  session,
380
394
  reorder: true,
381
- onOpenSplit
395
+ actions
382
396
  })
383
397
  })),
384
398
  onOrderChange: onPinnedOrderChange
@@ -386,30 +400,36 @@ function SessionSidebar2({
386
400
  })
387
401
  ]
388
402
  }),
389
- groups.map((group) => /* @__PURE__ */ jsxs(Sidebar.Group, {
390
- collapsible: true,
391
- children: [
392
- /* @__PURE__ */ jsx(Sidebar.GroupLabel, {
393
- children: group.label
394
- }),
395
- /* @__PURE__ */ jsx(Sidebar.GroupActions, {
396
- children: /* @__PURE__ */ jsx(Tooltip, {
397
- content: group.kind === "project" ? `New session in ${group.label}` : "Filter",
398
- side: "top",
399
- children: /* @__PURE__ */ jsx(Sidebar.GroupAction, {
400
- "aria-label": group.kind === "project" ? `New session in ${group.label}` : "Filter",
401
- children: group.kind === "project" ? /* @__PURE__ */ jsx(Plus, {}) : /* @__PURE__ */ jsx(Filter, {})
403
+ groups.map((group) => {
404
+ const isProject = group.kind === "project";
405
+ const onAction = isProject ? onNewSessionIn : onFilterSection;
406
+ const label = isProject ? `New session in ${group.label}` : "Filter";
407
+ return /* @__PURE__ */ jsxs(Sidebar.Group, {
408
+ collapsible: true,
409
+ children: [
410
+ /* @__PURE__ */ jsx(Sidebar.GroupLabel, {
411
+ children: group.label
412
+ }),
413
+ onAction && /* @__PURE__ */ jsx(Sidebar.GroupActions, {
414
+ children: /* @__PURE__ */ jsx(Tooltip, {
415
+ content: label,
416
+ side: "top",
417
+ children: /* @__PURE__ */ jsx(Sidebar.GroupAction, {
418
+ "aria-label": label,
419
+ onClick: () => onAction(group),
420
+ children: isProject ? /* @__PURE__ */ jsx(Plus, {}) : /* @__PURE__ */ jsx(Filter, {})
421
+ })
402
422
  })
423
+ }),
424
+ /* @__PURE__ */ jsx(Sidebar.Menu, {
425
+ children: group.sessions.map((session) => /* @__PURE__ */ jsx(SessionRow, {
426
+ session,
427
+ actions
428
+ }, session.id))
403
429
  })
404
- }),
405
- /* @__PURE__ */ jsx(Sidebar.Menu, {
406
- children: group.sessions.map((session) => /* @__PURE__ */ jsx(SessionRow, {
407
- session,
408
- onOpenSplit
409
- }, session.id))
410
- })
411
- ]
412
- }, group.label)),
430
+ ]
431
+ }, group.label);
432
+ }),
413
433
  /* @__PURE__ */ jsxs(Sidebar.Group, {
414
434
  collapsible: true,
415
435
  defaultOpen: false,
@@ -420,7 +440,8 @@ function SessionSidebar2({
420
440
  /* @__PURE__ */ jsx(Sidebar.Menu, {
421
441
  children: archived.map((session) => /* @__PURE__ */ jsx(SessionRow, {
422
442
  session,
423
- onOpenSplit
443
+ archived: true,
444
+ actions
424
445
  }, session.id))
425
446
  })
426
447
  ]
@@ -443,7 +464,7 @@ function SessionSidebar2({
443
464
  })
444
465
  ]
445
466
  }),
446
- /* @__PURE__ */ jsx(Sidebar.Menu, {
467
+ onOpenSettings && /* @__PURE__ */ jsx(Sidebar.Menu, {
447
468
  children: /* @__PURE__ */ jsx(Sidebar.MenuItem, {
448
469
  children: /* @__PURE__ */ jsxs(Sidebar.MenuButton, {
449
470
  icon: Settings,