@truefoundry/trueforge-ui 0.3.0-rc.9 → 0.3.1

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 (93) hide show
  1. package/CHANGELOG.md +190 -4
  2. package/dist/{AgentCodeSnippets-ARHIK2T6.js → AgentCodeSnippets-DAZWEBJS.js} +7 -7
  3. package/dist/AgentMetricChart-VDIE3S2P.js +15 -0
  4. package/dist/AgentOverview-5JIVYXPX.js +314 -0
  5. package/dist/AgentOverview-5JIVYXPX.js.map +1 -0
  6. package/dist/{AgentSessionEventTimeline-7QM7QKIQ.js → AgentSessionEventTimeline-WELJSS6O.js} +7 -7
  7. package/dist/{AgentSessionEventTimelineChart-PIDYWLYT.js → AgentSessionEventTimelineChart-ADB3KICM.js} +7 -7
  8. package/dist/{AgentSessions-MR2DREKN.js → AgentSessions-NSN4LIGJ.js} +81 -16
  9. package/dist/AgentSessions-NSN4LIGJ.js.map +1 -0
  10. package/dist/{ConnectorSettings-YBGANZOG.js → ConnectorSettings-C6MFCKYX.js} +12 -10
  11. package/dist/ConnectorSettings-C6MFCKYX.js.map +1 -0
  12. package/dist/{DockLayout-O5TS4YZH.js → DockLayout-VY7OZ55R.js} +10 -10
  13. package/dist/{DrawerLayout-7R3XONK2.js → DrawerLayout-B2UA3CZO.js} +11 -11
  14. package/dist/{ModelSettings-UXPL4E6X.js → ModelSettings-3YAHICJ3.js} +9 -9
  15. package/dist/ModelSettings-3YAHICJ3.js.map +1 -0
  16. package/dist/OpenUiFenceBlock-BZPFNXWZ.js +9 -0
  17. package/dist/{SandboxSettings-5MMPJHBH.js → SandboxSettings-ALR6F5KU.js} +7 -7
  18. package/dist/SchedulesPage-TIS3BH67.js +15 -0
  19. package/dist/{SettingsBuilder-JAP4QGMY.js → SettingsBuilder-G5CP5X6Q.js} +8 -8
  20. package/dist/{ShellRouteSync-SJXFKUAJ.js → ShellRouteSync-G7IJ5VIW.js} +4 -4
  21. package/dist/{SidebarLayout-MYZTVWWE.js → SidebarLayout-FKRLGEDB.js} +13 -13
  22. package/dist/SidebarLayout-FKRLGEDB.js.map +1 -0
  23. package/dist/{SkillSettings-6C5PH3NN.js → SkillSettings-E5SJ4U3T.js} +7 -7
  24. package/dist/{TrueForgeUIWithRouter-3J5G62O5.js → TrueForgeUIWithRouter-WD7O3TWR.js} +9 -9
  25. package/dist/{WidgetLayout-24ZL3QWT.js → WidgetLayout-KQZTQNE7.js} +10 -10
  26. package/dist/{chunk-UBQYRCCH.js → chunk-2XFOONKH.js} +251 -97
  27. package/dist/chunk-2XFOONKH.js.map +1 -0
  28. package/dist/{chunk-2GIZY3JJ.js → chunk-2XT2VUT4.js} +58 -5
  29. package/dist/chunk-2XT2VUT4.js.map +1 -0
  30. package/dist/{chunk-3ZW74FHC.js → chunk-4OZFQVSR.js} +23 -19
  31. package/dist/chunk-4OZFQVSR.js.map +1 -0
  32. package/dist/chunk-6UACSIIY.js +587 -0
  33. package/dist/chunk-6UACSIIY.js.map +1 -0
  34. package/dist/{chunk-RI6TIYWL.js → chunk-7UE7LZS2.js} +45 -15
  35. package/dist/chunk-7UE7LZS2.js.map +1 -0
  36. package/dist/{chunk-T6QQV5LK.js → chunk-AO23SZBG.js} +2 -2
  37. package/dist/{chunk-MACHU4OO.js → chunk-AU4BJQMK.js} +60 -25
  38. package/dist/chunk-AU4BJQMK.js.map +1 -0
  39. package/dist/{chunk-2QTH6JHX.js → chunk-B76JC5B2.js} +3 -3
  40. package/dist/{chunk-JTQU2N2Q.js → chunk-G7BT4OKG.js} +7 -5
  41. package/dist/{chunk-JTQU2N2Q.js.map → chunk-G7BT4OKG.js.map} +1 -1
  42. package/dist/{chunk-JF4IELMW.js → chunk-IGYCJIU7.js} +9 -9
  43. package/dist/{chunk-CG75X77Q.js → chunk-QKFMAQ7O.js} +2 -2
  44. package/dist/{chunk-JKUYG6HV.js → chunk-SAYUMANU.js} +9 -15
  45. package/dist/chunk-SAYUMANU.js.map +1 -0
  46. package/dist/{chunk-FEHL45EB.js → chunk-XHPIJ77Q.js} +2 -2
  47. package/dist/{chunk-4OEAJKLJ.js → chunk-XR4S7B2K.js} +2528 -1923
  48. package/dist/chunk-XR4S7B2K.js.map +1 -0
  49. package/dist/index.d.ts +53 -11
  50. package/dist/index.js +16 -12
  51. package/dist/index.js.map +1 -1
  52. package/dist/plugins/trueforge-agent-server-adapter/index.d.ts +10 -3
  53. package/dist/plugins/trueforge-agent-server-adapter/index.js +43 -14
  54. package/dist/plugins/trueforge-agent-server-adapter/index.js.map +1 -1
  55. package/dist/styles.css +1 -1
  56. package/package.json +3 -3
  57. package/dist/AgentMetricChart-ZQIRBCZL.js +0 -15
  58. package/dist/AgentOverview-7GJJV2OU.js +0 -169
  59. package/dist/AgentOverview-7GJJV2OU.js.map +0 -1
  60. package/dist/AgentSessions-MR2DREKN.js.map +0 -1
  61. package/dist/ConnectorSettings-YBGANZOG.js.map +0 -1
  62. package/dist/ModelSettings-UXPL4E6X.js.map +0 -1
  63. package/dist/OpenUiFenceBlock-KPZFLUSC.js +0 -9
  64. package/dist/SchedulesPage-5XZRDA5O.js +0 -15
  65. package/dist/SidebarLayout-MYZTVWWE.js.map +0 -1
  66. package/dist/chunk-2GIZY3JJ.js.map +0 -1
  67. package/dist/chunk-3ZW74FHC.js.map +0 -1
  68. package/dist/chunk-4OEAJKLJ.js.map +0 -1
  69. package/dist/chunk-JCL3Q7RW.js +0 -587
  70. package/dist/chunk-JCL3Q7RW.js.map +0 -1
  71. package/dist/chunk-JKUYG6HV.js.map +0 -1
  72. package/dist/chunk-MACHU4OO.js.map +0 -1
  73. package/dist/chunk-RI6TIYWL.js.map +0 -1
  74. package/dist/chunk-UBQYRCCH.js.map +0 -1
  75. /package/dist/{AgentCodeSnippets-ARHIK2T6.js.map → AgentCodeSnippets-DAZWEBJS.js.map} +0 -0
  76. /package/dist/{AgentMetricChart-ZQIRBCZL.js.map → AgentMetricChart-VDIE3S2P.js.map} +0 -0
  77. /package/dist/{AgentSessionEventTimeline-7QM7QKIQ.js.map → AgentSessionEventTimeline-WELJSS6O.js.map} +0 -0
  78. /package/dist/{AgentSessionEventTimelineChart-PIDYWLYT.js.map → AgentSessionEventTimelineChart-ADB3KICM.js.map} +0 -0
  79. /package/dist/{DockLayout-O5TS4YZH.js.map → DockLayout-VY7OZ55R.js.map} +0 -0
  80. /package/dist/{DrawerLayout-7R3XONK2.js.map → DrawerLayout-B2UA3CZO.js.map} +0 -0
  81. /package/dist/{OpenUiFenceBlock-KPZFLUSC.js.map → OpenUiFenceBlock-BZPFNXWZ.js.map} +0 -0
  82. /package/dist/{SandboxSettings-5MMPJHBH.js.map → SandboxSettings-ALR6F5KU.js.map} +0 -0
  83. /package/dist/{SchedulesPage-5XZRDA5O.js.map → SchedulesPage-TIS3BH67.js.map} +0 -0
  84. /package/dist/{SettingsBuilder-JAP4QGMY.js.map → SettingsBuilder-G5CP5X6Q.js.map} +0 -0
  85. /package/dist/{ShellRouteSync-SJXFKUAJ.js.map → ShellRouteSync-G7IJ5VIW.js.map} +0 -0
  86. /package/dist/{SkillSettings-6C5PH3NN.js.map → SkillSettings-E5SJ4U3T.js.map} +0 -0
  87. /package/dist/{TrueForgeUIWithRouter-3J5G62O5.js.map → TrueForgeUIWithRouter-WD7O3TWR.js.map} +0 -0
  88. /package/dist/{WidgetLayout-24ZL3QWT.js.map → WidgetLayout-KQZTQNE7.js.map} +0 -0
  89. /package/dist/{chunk-T6QQV5LK.js.map → chunk-AO23SZBG.js.map} +0 -0
  90. /package/dist/{chunk-2QTH6JHX.js.map → chunk-B76JC5B2.js.map} +0 -0
  91. /package/dist/{chunk-JF4IELMW.js.map → chunk-IGYCJIU7.js.map} +0 -0
  92. /package/dist/{chunk-CG75X77Q.js.map → chunk-QKFMAQ7O.js.map} +0 -0
  93. /package/dist/{chunk-FEHL45EB.js.map → chunk-XHPIJ77Q.js.map} +0 -0
@@ -1,28 +1,28 @@
1
1
  "use client";
2
2
  import {
3
3
  StackChatPanel
4
- } from "./chunk-JF4IELMW.js";
5
- import "./chunk-JTQU2N2Q.js";
6
- import "./chunk-MACHU4OO.js";
4
+ } from "./chunk-IGYCJIU7.js";
5
+ import "./chunk-G7BT4OKG.js";
6
+ import "./chunk-AU4BJQMK.js";
7
7
  import {
8
8
  useWidgetVisibility
9
9
  } from "./chunk-DJUFS2BW.js";
10
10
  import "./chunk-BSIPI3KV.js";
11
11
  import {
12
12
  useSlot
13
- } from "./chunk-4OEAJKLJ.js";
14
- import "./chunk-T6QQV5LK.js";
13
+ } from "./chunk-XR4S7B2K.js";
14
+ import "./chunk-AO23SZBG.js";
15
15
  import {
16
16
  CompactLayoutProvider,
17
17
  Icon,
18
18
  auiButtonClass
19
- } from "./chunk-3ZW74FHC.js";
20
- import "./chunk-2GIZY3JJ.js";
19
+ } from "./chunk-4OZFQVSR.js";
20
+ import "./chunk-2XT2VUT4.js";
21
21
  import "./chunk-M6MHLVSO.js";
22
- import "./chunk-CG75X77Q.js";
22
+ import "./chunk-QKFMAQ7O.js";
23
23
  import {
24
24
  cn
25
- } from "./chunk-JCL3Q7RW.js";
25
+ } from "./chunk-6UACSIIY.js";
26
26
 
27
27
  // src/layouts/WidgetLayout.tsx
28
28
  import { useEffect, useRef } from "react";
@@ -104,4 +104,4 @@ function WidgetLayout({ className }) {
104
104
  export {
105
105
  WidgetLayout
106
106
  };
107
- //# sourceMappingURL=WidgetLayout-24ZL3QWT.js.map
107
+ //# sourceMappingURL=WidgetLayout-KQZTQNE7.js.map
@@ -1,7 +1,11 @@
1
1
  import {
2
2
  BottomSheet,
3
+ Button,
4
+ CenteredModal,
3
5
  DropdownMenuItem,
6
+ MAX_SESSION_TITLE_LENGTH,
4
7
  SearchInput_default,
8
+ auiInputClass,
5
9
  canReuseMutableShell,
6
10
  readThreadAgentName,
7
11
  themePortalRoot,
@@ -9,24 +13,25 @@ import {
9
13
  threadListItemIsMutable,
10
14
  useIsMobile,
11
15
  useResourcePermissions,
12
- useSlot
13
- } from "./chunk-4OEAJKLJ.js";
16
+ useSlot,
17
+ useToasterOptional
18
+ } from "./chunk-XR4S7B2K.js";
14
19
  import {
15
20
  useSearchAgentsList
16
- } from "./chunk-T6QQV5LK.js";
21
+ } from "./chunk-AO23SZBG.js";
17
22
  import {
18
23
  Icon,
19
24
  auiButtonClass,
20
25
  useCompactLayout
21
- } from "./chunk-3ZW74FHC.js";
26
+ } from "./chunk-4OZFQVSR.js";
22
27
  import {
23
28
  libraryAgentId,
24
29
  useOptionalServer,
25
30
  useOptionalShellMode
26
- } from "./chunk-2GIZY3JJ.js";
31
+ } from "./chunk-2XT2VUT4.js";
27
32
  import {
28
33
  cn
29
- } from "./chunk-JCL3Q7RW.js";
34
+ } from "./chunk-6UACSIIY.js";
30
35
 
31
36
  // src/containers/ThreadListContainer.tsx
32
37
  import {
@@ -37,7 +42,7 @@ import {
37
42
  useAui,
38
43
  useAuiState
39
44
  } from "@assistant-ui/react";
40
- import { useCallback, useEffect as useEffect2, useMemo, useRef as useRef2, useState as useState2 } from "react";
45
+ import { useCallback, useEffect as useEffect3, useMemo, useRef as useRef3, useState as useState3 } from "react";
41
46
 
42
47
  // src/atoms/AgentHistoryFilterButton.tsx
43
48
  import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
@@ -205,15 +210,89 @@ function AgentHistoryFilterButton() {
205
210
  ] });
206
211
  }
207
212
 
213
+ // src/atoms/RenameSessionModal.tsx
214
+ import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
215
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
216
+ function RenameSessionModal({
217
+ open,
218
+ initialTitle,
219
+ saving = false,
220
+ onOpenChange,
221
+ onSave
222
+ }) {
223
+ const [value, setValue] = useState2(initialTitle);
224
+ const inputRef = useRef2(null);
225
+ useEffect2(() => {
226
+ if (open) setValue(initialTitle);
227
+ }, [open, initialTitle]);
228
+ useEffect2(() => {
229
+ if (!open) return;
230
+ const input = inputRef.current;
231
+ if (input == null) return;
232
+ input.focus();
233
+ input.select();
234
+ }, [open]);
235
+ const trimmed = value.trim();
236
+ const isValid = trimmed.length > 0 && trimmed.length <= MAX_SESSION_TITLE_LENGTH;
237
+ const canSave = isValid && !saving;
238
+ const handleSave = () => {
239
+ if (!canSave) return;
240
+ onSave(trimmed);
241
+ };
242
+ const handleOpenChange = (next) => {
243
+ if (saving) return;
244
+ onOpenChange(next);
245
+ };
246
+ return /* @__PURE__ */ jsx2(
247
+ CenteredModal,
248
+ {
249
+ open,
250
+ onOpenChange: handleOpenChange,
251
+ title: "Rename session",
252
+ contentSized: true,
253
+ "aria-label": "Rename session",
254
+ footer: /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-end gap-2", children: [
255
+ /* @__PURE__ */ jsx2(Button.Secondary, { type: "button", disabled: saving, onClick: () => handleOpenChange(false), children: "Cancel" }),
256
+ /* @__PURE__ */ jsx2(Button.Primary, { type: "button", disabled: !canSave, onClick: handleSave, children: "Save" })
257
+ ] }),
258
+ children: /* @__PURE__ */ jsx2("div", { className: "px-5 py-4", children: /* @__PURE__ */ jsx2(
259
+ "input",
260
+ {
261
+ ref: inputRef,
262
+ "aria-label": "Session title",
263
+ value,
264
+ readOnly: saving,
265
+ maxLength: MAX_SESSION_TITLE_LENGTH,
266
+ className: auiInputClass("h-9"),
267
+ onChange: (event) => setValue(event.target.value),
268
+ onKeyDown: (event) => {
269
+ if (event.key === "Enter") {
270
+ event.preventDefault();
271
+ handleSave();
272
+ }
273
+ }
274
+ }
275
+ ) })
276
+ }
277
+ );
278
+ }
279
+
208
280
  // src/containers/ThreadListContainer.tsx
209
- import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
281
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
282
+ var actionItemClass = "flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium outline-none transition-colors hover:bg-ghost-button-hover focus:bg-ghost-button-hover data-[highlighted]:bg-ghost-button-hover";
210
283
  var deleteItemClass = "flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-failure-bg outline-none transition-colors hover:bg-failure-bg/12 hover:text-failure-bg focus:bg-failure-bg/12 focus:text-failure-bg data-[highlighted]:bg-failure-bg/12 data-[highlighted]:text-failure-bg";
211
- function ThreadListItemDeleteMenu({ disabled }) {
284
+ function ThreadListItemActionsMenu({
285
+ canRename,
286
+ renameDisabled,
287
+ canDelete,
288
+ deleteDisabled,
289
+ onRename
290
+ }) {
212
291
  const PermissionGuard = useSlot("PermissionGuard");
213
292
  const compact = useCompactLayout();
214
293
  const isMobile = useIsMobile();
215
- const [sheetOpen, setSheetOpen] = useState2(false);
216
- const [portalContainer, setPortalContainer] = useState2();
294
+ const [sheetOpen, setSheetOpen] = useState3(false);
295
+ const [portalContainer, setPortalContainer] = useState3();
217
296
  const useSheet = isMobile || compact;
218
297
  const setTriggerElement = useCallback((element) => {
219
298
  const themeRoot = element?.closest(".aui-theme-root");
@@ -224,9 +303,39 @@ function ThreadListItemDeleteMenu({ disabled }) {
224
303
  size: "icon",
225
304
  className: "size-7 shrink-0 text-text-secondary hover:bg-transparent hover:text-text-primary"
226
305
  });
306
+ const renameButton = canRename ? /* @__PURE__ */ jsx3(PermissionGuard, { allowed: !renameDisabled, children: /* @__PURE__ */ jsxs3(
307
+ "button",
308
+ {
309
+ type: "button",
310
+ className: actionItemClass,
311
+ disabled: renameDisabled,
312
+ onClick: () => {
313
+ if (renameDisabled) return;
314
+ setSheetOpen(false);
315
+ onRename();
316
+ },
317
+ children: [
318
+ /* @__PURE__ */ jsx3(Icon, { name: "pencil", className: "size-3.5" }),
319
+ "Rename"
320
+ ]
321
+ }
322
+ ) }) : null;
323
+ const deleteButton = canDelete ? /* @__PURE__ */ jsx3(PermissionGuard, { allowed: !deleteDisabled, children: /* @__PURE__ */ jsxs3(
324
+ ThreadListItemPrimitive.Delete,
325
+ {
326
+ className: deleteItemClass,
327
+ onClick: () => {
328
+ if (!deleteDisabled) setSheetOpen(false);
329
+ },
330
+ children: [
331
+ /* @__PURE__ */ jsx3(Icon, { name: "trash", className: "size-3.5" }),
332
+ "Delete"
333
+ ]
334
+ }
335
+ ) }) : null;
227
336
  if (useSheet) {
228
- return /* @__PURE__ */ jsxs2(Fragment2, { children: [
229
- /* @__PURE__ */ jsx2(
337
+ return /* @__PURE__ */ jsxs3(Fragment2, { children: [
338
+ /* @__PURE__ */ jsx3(
230
339
  "button",
231
340
  {
232
341
  type: "button",
@@ -236,57 +345,51 @@ function ThreadListItemDeleteMenu({ disabled }) {
236
345
  "aria-expanded": sheetOpen,
237
346
  className: moreButtonClass,
238
347
  onClick: () => setSheetOpen(true),
239
- children: /* @__PURE__ */ jsx2(Icon, { name: "ellipsis", className: "size-3.5" })
348
+ children: /* @__PURE__ */ jsx3(Icon, { name: "ellipsis", className: "size-3.5" })
240
349
  }
241
350
  ),
242
- sheetOpen ? /* @__PURE__ */ jsx2(BottomSheet, { open: true, onOpenChange: setSheetOpen, "aria-label": "Session actions", children: /* @__PURE__ */ jsx2("div", { className: "flex flex-col gap-1 p-2 *:w-full", role: "menu", children: /* @__PURE__ */ jsx2(PermissionGuard, { allowed: !disabled, children: /* @__PURE__ */ jsxs2(
243
- ThreadListItemPrimitive.Delete,
244
- {
245
- className: deleteItemClass,
246
- onClick: () => {
247
- if (!disabled) setSheetOpen(false);
248
- },
249
- children: [
250
- /* @__PURE__ */ jsx2(Icon, { name: "trash", className: "size-3.5" }),
251
- "Delete"
252
- ]
253
- }
254
- ) }) }) }) : null
351
+ sheetOpen ? /* @__PURE__ */ jsx3(BottomSheet, { open: true, onOpenChange: setSheetOpen, "aria-label": "Session actions", children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-1 p-2 *:w-full", role: "menu", children: [
352
+ renameButton,
353
+ deleteButton
354
+ ] }) }) : null
255
355
  ] });
256
356
  }
257
- return /* @__PURE__ */ jsxs2(ThreadListItemMorePrimitive.Root, { sharedFocusGroup: true, children: [
258
- /* @__PURE__ */ jsx2(
357
+ return /* @__PURE__ */ jsxs3(ThreadListItemMorePrimitive.Root, { sharedFocusGroup: true, children: [
358
+ /* @__PURE__ */ jsx3(
259
359
  ThreadListItemMorePrimitive.Trigger,
260
360
  {
261
361
  ref: setTriggerElement,
262
362
  "aria-label": "Session actions",
263
363
  title: "Session actions",
264
364
  className: moreButtonClass,
265
- children: /* @__PURE__ */ jsx2(Icon, { name: "ellipsis", className: "size-3.5" })
365
+ children: /* @__PURE__ */ jsx3(Icon, { name: "ellipsis", className: "size-3.5" })
266
366
  }
267
367
  ),
268
- /* @__PURE__ */ jsx2(
368
+ /* @__PURE__ */ jsxs3(
269
369
  ThreadListItemMorePrimitive.Content,
270
370
  {
271
371
  portalProps: { container: portalContainer },
272
372
  align: "end",
273
373
  sideOffset: 4,
274
- className: "aui-popup-enter font-sans-flex z-50 min-w-[8rem] rounded-md border border-border bg-card-bg p-1 text-text-primary shadow-md *:w-full",
275
- children: /* @__PURE__ */ jsx2(PermissionGuard, { allowed: !disabled, children: /* @__PURE__ */ jsxs2(ThreadListItemPrimitive.Delete, { className: deleteItemClass, children: [
276
- /* @__PURE__ */ jsx2(Icon, { name: "trash", className: "size-3.5" }),
277
- "Delete"
278
- ] }) })
374
+ className: "aui-popup-enter font-sans-flex z-50 min-w-32 rounded-md border border-border bg-card-bg p-1 text-text-primary shadow-md *:w-full",
375
+ children: [
376
+ renameButton,
377
+ deleteButton
378
+ ]
279
379
  }
280
380
  )
281
381
  ] });
282
382
  }
283
383
  function ThreadListItemRow({
284
384
  onThreadOpen,
385
+ canRenameSession,
285
386
  canDeleteSession,
387
+ canManageResource,
286
388
  canDeleteResource
287
389
  }) {
288
390
  const aui = useAui();
289
391
  const shell = useOptionalShellMode();
392
+ const toaster = useToasterOptional();
290
393
  const ThreadListRow = useSlot("ThreadListRow");
291
394
  const id = useAuiState((s) => s.threadListItem.id);
292
395
  const remoteId = useAuiState((s) => s.threadListItem.remoteId);
@@ -295,48 +398,92 @@ function ThreadListItemRow({
295
398
  const custom = useAuiState((s) => s.threadListItem.custom);
296
399
  const mainThreadId = useAuiState((s) => s.threads.mainThreadId);
297
400
  const agentName = readThreadAgentName(custom);
401
+ const showRename = canRenameSession && remoteId != null;
298
402
  const showDelete = canDeleteSession && remoteId != null;
403
+ const showActions = showRename || showDelete;
404
+ const renameDisabled = remoteId != null && !canManageResource(remoteId);
299
405
  const deleteDisabled = remoteId != null && !canDeleteResource(remoteId);
300
406
  const sidebarNavOpen = shell?.libraryOpen === true || shell?.sessionsOpen === true || shell?.schedulesOpen === true;
301
- return /* @__PURE__ */ jsx2(ThreadListItemPrimitive.Root, { className: "min-w-0", children: /* @__PURE__ */ jsx2(
302
- ThreadListRow,
303
- {
304
- title: title ?? "New Chat",
305
- active: id === mainThreadId && !sidebarNavOpen,
306
- agentName,
307
- lastMessageAt,
308
- onSelect: () => {
309
- onThreadOpen?.();
310
- shell?.setSettingsOpen(false);
311
- shell?.setLibraryOpen(false);
312
- shell?.setSessionsOpen(false);
313
- shell?.setSchedulesOpen(false);
314
- const sessionMutable = threadListItemIsMutable(custom);
315
- const sameImmutable = !sessionMutable && shell?.mode.status === "active" && !shell.mode.isMutable && (agentName == null ? shell.mode.agentName == null && shell.mode.agentId == null : shell.mode.agentName === agentName || shell.mode.agentId === agentName);
316
- const sameMutable = canReuseMutableShell({
317
- sessionMutable,
318
- shellMutable: shell?.mode.status === "active" && shell.mode.isMutable,
319
- ...shell?.mode.status === "active" && shell.mode.isMutable ? { shellAgentName: shell.mode.agentName, shellAgentId: shell.mode.agentId } : {},
320
- remoteId,
321
- pendingSessionId: shell?.pendingSessionId
322
- });
323
- if ((sameImmutable || sameMutable) && remoteId != null) {
324
- void Promise.resolve(aui.threads().switchToThread(id)).catch(() => void 0);
325
- return;
326
- }
327
- if (remoteId != null) {
328
- shell?.openHistorySession({
329
- sessionId: remoteId,
330
- isMutable: sessionMutable,
331
- ...agentName != null ? { agentName } : {}
407
+ const [renameOpen, setRenameOpen] = useState3(false);
408
+ const [renameSaving, setRenameSaving] = useState3(false);
409
+ const displayTitle = title ?? "New Chat";
410
+ const persistRename = async (trimmed) => {
411
+ if (trimmed === (title ?? "").trim()) {
412
+ setRenameOpen(false);
413
+ return;
414
+ }
415
+ setRenameSaving(true);
416
+ try {
417
+ await aui.threadListItem().rename(trimmed);
418
+ setRenameOpen(false);
419
+ } catch (caught) {
420
+ toaster?.showError(caught);
421
+ } finally {
422
+ setRenameSaving(false);
423
+ }
424
+ };
425
+ return /* @__PURE__ */ jsxs3(ThreadListItemPrimitive.Root, { className: "min-w-0", children: [
426
+ /* @__PURE__ */ jsx3(
427
+ ThreadListRow,
428
+ {
429
+ title: displayTitle,
430
+ active: id === mainThreadId && !sidebarNavOpen,
431
+ agentName,
432
+ lastMessageAt,
433
+ onSelect: () => {
434
+ onThreadOpen?.();
435
+ shell?.setSettingsOpen(false);
436
+ shell?.setLibraryOpen(false);
437
+ shell?.setSessionsOpen(false);
438
+ shell?.setSchedulesOpen(false);
439
+ const sessionMutable = threadListItemIsMutable(custom);
440
+ const sameImmutable = !sessionMutable && shell?.mode.status === "active" && !shell.mode.isMutable && (agentName == null ? shell.mode.agentName == null && shell.mode.agentId == null : shell.mode.agentName === agentName || shell.mode.agentId === agentName);
441
+ const sameMutable = canReuseMutableShell({
442
+ sessionMutable,
443
+ shellMutable: shell?.mode.status === "active" && shell.mode.isMutable,
444
+ ...shell?.mode.status === "active" && shell.mode.isMutable ? { shellAgentName: shell.mode.agentName, shellAgentId: shell.mode.agentId } : {},
445
+ remoteId,
446
+ pendingSessionId: shell?.pendingSessionId
332
447
  });
333
- return;
448
+ if ((sameImmutable || sameMutable) && remoteId != null) {
449
+ void Promise.resolve(aui.threads().switchToThread(id)).catch(() => void 0);
450
+ return;
451
+ }
452
+ if (remoteId != null) {
453
+ shell?.openHistorySession({
454
+ sessionId: remoteId,
455
+ isMutable: sessionMutable,
456
+ ...agentName != null ? { agentName } : {}
457
+ });
458
+ return;
459
+ }
460
+ void Promise.resolve(aui.threads().switchToThread(id)).catch(() => void 0);
461
+ },
462
+ actions: showActions ? /* @__PURE__ */ jsx3(
463
+ ThreadListItemActionsMenu,
464
+ {
465
+ canRename: showRename,
466
+ renameDisabled,
467
+ canDelete: showDelete,
468
+ deleteDisabled,
469
+ onRename: () => setRenameOpen(true)
470
+ }
471
+ ) : void 0
472
+ }
473
+ ),
474
+ /* @__PURE__ */ jsx3(
475
+ RenameSessionModal,
476
+ {
477
+ open: renameOpen,
478
+ initialTitle: title ?? "",
479
+ saving: renameSaving,
480
+ onOpenChange: setRenameOpen,
481
+ onSave: (nextTitle) => {
482
+ void persistRename(nextTitle);
334
483
  }
335
- void Promise.resolve(aui.threads().switchToThread(id)).catch(() => void 0);
336
- },
337
- actions: showDelete ? /* @__PURE__ */ jsx2(ThreadListItemDeleteMenu, { disabled: deleteDisabled }) : void 0
338
- }
339
- ) });
484
+ }
485
+ )
486
+ ] });
340
487
  }
341
488
  function useThreadListIndicesByRecency(variant) {
342
489
  const threadIds = useAuiState((s) => s.threads.threadIds);
@@ -360,17 +507,21 @@ function useThreadListIndicesByRecency(variant) {
360
507
  function ThreadListItemsByRecency({
361
508
  indices,
362
509
  onThreadOpen,
510
+ canRenameSession,
363
511
  canDeleteSession,
512
+ canManageResource,
364
513
  canDeleteResource
365
514
  }) {
366
515
  const threadIds = useAuiState((s) => s.threads.threadIds);
367
- return /* @__PURE__ */ jsx2(Fragment2, { children: indices.map((index) => {
516
+ return /* @__PURE__ */ jsx3(Fragment2, { children: indices.map((index) => {
368
517
  const key = threadIds[index] ?? String(index);
369
- return /* @__PURE__ */ jsx2(ThreadListItemByIndexProvider, { index, archived: false, children: /* @__PURE__ */ jsx2(
518
+ return /* @__PURE__ */ jsx3(ThreadListItemByIndexProvider, { index, archived: false, children: /* @__PURE__ */ jsx3(
370
519
  ThreadListItemRow,
371
520
  {
372
521
  onThreadOpen,
522
+ canRenameSession,
373
523
  canDeleteSession,
524
+ canManageResource,
374
525
  canDeleteResource
375
526
  }
376
527
  ) }, key);
@@ -388,12 +539,12 @@ function RecentChatsSection({
388
539
  const historyFilterIntent = shell?.historyAgentFilter?.intent;
389
540
  const showFilter = shell?.isLibraryEnabled === true && historyFilterIntent !== "try-agent" && (historyFilterIntent === "history" || shell.mode.status !== "active" || shell.mode.isMutable || shell.pendingSessionId != null || activeRemoteId != null);
390
541
  const heading = shell?.historyAgentFilter == null ? "Chat History" : `Chats for ${shell.historyAgentFilter.agentName}`;
391
- return /* @__PURE__ */ jsxs2("div", { className: "flex min-h-0 flex-1 flex-col", children: [
392
- /* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center gap-1 px-1 py-1", children: [
393
- /* @__PURE__ */ jsx2("h2", { className: "min-w-0 flex-1 truncate px-1.5 py-1 text-sm font-medium text-text-secondary", children: heading }),
394
- showFilter ? /* @__PURE__ */ jsx2(AgentHistoryFilterButton, {}) : null
542
+ return /* @__PURE__ */ jsxs3("div", { className: "flex min-h-0 flex-1 flex-col", children: [
543
+ /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-1 px-1 py-1", children: [
544
+ /* @__PURE__ */ jsx3("h2", { className: "min-w-0 flex-1 truncate px-1.5 py-1 text-sm font-medium text-text-secondary", children: heading }),
545
+ showFilter ? /* @__PURE__ */ jsx3(AgentHistoryFilterButton, {}) : null
395
546
  ] }),
396
- /* @__PURE__ */ jsx2(
547
+ /* @__PURE__ */ jsx3(
397
548
  "div",
398
549
  {
399
550
  ref: viewportRef,
@@ -421,21 +572,22 @@ function ThreadListContainer({ onThreadOpen, variant = "default" } = {}) {
421
572
  const ThreadListRowSkeleton = useSlot("ThreadListRowSkeleton");
422
573
  const ThreadListEmptyState = useSlot("ThreadListEmptyState");
423
574
  const indices = useThreadListIndicesByRecency(variant);
424
- const viewportRef = useRef2(null);
425
- const hasMoreRef = useRef2(hasMore);
426
- const auiRef = useRef2(aui);
575
+ const viewportRef = useRef3(null);
576
+ const hasMoreRef = useRef3(hasMore);
577
+ const auiRef = useRef3(aui);
427
578
  hasMoreRef.current = hasMore;
428
579
  auiRef.current = aui;
429
580
  const showNewChat = shell?.isNewChatEnabled !== false;
430
581
  const isIdle = shell?.mode.status === "idle";
431
582
  const isRecentHistory = variant === "recent-history";
583
+ const canRenameSession = typeof server?.renameSession === "function";
432
584
  const canDeleteSession = typeof server?.deleteSession === "function";
433
585
  const remoteSessionIds = useMemo(
434
586
  () => threadItems.flatMap((item) => item.remoteId == null ? [] : [item.remoteId]),
435
587
  [threadItems]
436
588
  );
437
589
  const { allows } = useResourcePermissions({ resourceType: "session", resourceIds: remoteSessionIds });
438
- useEffect2(() => {
590
+ useEffect3(() => {
439
591
  if (isIdle || isLoading || isLoadingMore) return;
440
592
  const viewport = viewportRef.current;
441
593
  if (!viewport) return;
@@ -478,34 +630,36 @@ function ThreadListContainer({ onThreadOpen, variant = "default" } = {}) {
478
630
  };
479
631
  let listBody;
480
632
  if (isIdle) {
481
- listBody = /* @__PURE__ */ jsx2(ThreadListEmptyState, { message: isRecentHistory ? "No recent chats" : void 0 });
633
+ listBody = /* @__PURE__ */ jsx3(ThreadListEmptyState, { message: isRecentHistory ? "No recent chats" : void 0 });
482
634
  } else if (isLoading) {
483
- listBody = /* @__PURE__ */ jsx2(ThreadListRowSkeleton, {});
635
+ listBody = /* @__PURE__ */ jsx3(ThreadListRowSkeleton, {});
484
636
  } else if (indices.length === 0) {
485
- listBody = /* @__PURE__ */ jsx2(ThreadListEmptyState, { message: isRecentHistory ? "No recent chats" : void 0 });
637
+ listBody = /* @__PURE__ */ jsx3(ThreadListEmptyState, { message: isRecentHistory ? "No recent chats" : void 0 });
486
638
  } else {
487
- listBody = /* @__PURE__ */ jsx2(ThreadListPrimitive.Root, { className: "flex min-h-0 flex-col gap-0.5", children: /* @__PURE__ */ jsx2(
639
+ listBody = /* @__PURE__ */ jsx3(ThreadListPrimitive.Root, { className: "flex min-h-0 flex-col gap-0.5", children: /* @__PURE__ */ jsx3(
488
640
  ThreadListItemsByRecency,
489
641
  {
490
642
  indices,
491
643
  onThreadOpen,
644
+ canRenameSession,
492
645
  canDeleteSession,
646
+ canManageResource: (sessionId) => allows(sessionId, "MANAGE"),
493
647
  canDeleteResource: (sessionId) => allows(sessionId, "DELETE")
494
648
  }
495
649
  ) });
496
650
  }
497
- return /* @__PURE__ */ jsx2(
651
+ return /* @__PURE__ */ jsx3(
498
652
  ThreadListShell,
499
653
  {
500
- header: isRecentHistory ? null : /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-1", children: [
501
- showNewChat ? /* @__PURE__ */ jsx2(ThreadListNewButton, { onClick: handleNewChat }) : null,
502
- /* @__PURE__ */ jsx2(AgentsLibraryButton, {}),
503
- /* @__PURE__ */ jsx2(SessionsBrowserButton, {}),
504
- /* @__PURE__ */ jsx2(SchedulesButton, {})
654
+ header: isRecentHistory ? null : /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-1", children: [
655
+ showNewChat ? /* @__PURE__ */ jsx3(ThreadListNewButton, { onClick: handleNewChat }) : null,
656
+ /* @__PURE__ */ jsx3(AgentsLibraryButton, {}),
657
+ /* @__PURE__ */ jsx3(SessionsBrowserButton, {}),
658
+ /* @__PURE__ */ jsx3(SchedulesButton, {})
505
659
  ] }),
506
- children: /* @__PURE__ */ jsxs2(RecentChatsSection, { viewportRef, hideScrollbar: isRecentHistory, children: [
660
+ children: /* @__PURE__ */ jsxs3(RecentChatsSection, { viewportRef, hideScrollbar: isRecentHistory, children: [
507
661
  listBody,
508
- !isIdle && hasMore ? /* @__PURE__ */ jsx2("div", { className: "h-4 shrink-0", "aria-hidden": true }) : null
662
+ !isIdle && hasMore ? /* @__PURE__ */ jsx3("div", { className: "h-4 shrink-0", "aria-hidden": true }) : null
509
663
  ] })
510
664
  }
511
665
  );
@@ -514,4 +668,4 @@ function ThreadListContainer({ onThreadOpen, variant = "default" } = {}) {
514
668
  export {
515
669
  ThreadListContainer
516
670
  };
517
- //# sourceMappingURL=chunk-UBQYRCCH.js.map
671
+ //# sourceMappingURL=chunk-2XFOONKH.js.map