@truefoundry/trueforge-ui 0.2.3 → 0.3.0-rc.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 (58) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +41 -17
  3. package/dist/{ConnectorSettings-ODC3LVHN.js → ConnectorSettings-FXQ5B7TN.js} +5 -5
  4. package/dist/{DockLayout-2RWDSUKE.js → DockLayout-LBNQJZNF.js} +9 -9
  5. package/dist/{DrawerLayout-CZLJYMIN.js → DrawerLayout-Q6UK4VMI.js} +9 -9
  6. package/dist/{ModelSettings-CKQ5CVAC.js → ModelSettings-4L4LOQJA.js} +5 -5
  7. package/dist/OpenUiFenceBlock-6UIIAVBX.js +9 -0
  8. package/dist/{SandboxSettings-HSCPYUOC.js → SandboxSettings-Z4ZG6ZX4.js} +5 -5
  9. package/dist/{SettingsBuilder-MYWRFXRI.js → SettingsBuilder-WF7ZWKQW.js} +7 -7
  10. package/dist/{SidebarLayout-WVY54TGZ.js → SidebarLayout-3WZ3CVON.js} +31 -14
  11. package/dist/SidebarLayout-3WZ3CVON.js.map +1 -0
  12. package/dist/{SkillSettings-ECH6SHZ7.js → SkillSettings-3EPPC3IT.js} +5 -5
  13. package/dist/{TrueForgeUIWithRouter-RKZ2E7PV.js → TrueForgeUIWithRouter-NZ4FGPE4.js} +7 -7
  14. package/dist/{WidgetLayout-NWWB2SXI.js → WidgetLayout-3QZ357FL.js} +10 -10
  15. package/dist/{WidgetLayout-NWWB2SXI.js.map → WidgetLayout-3QZ357FL.js.map} +1 -1
  16. package/dist/chunk-36KOSC2J.js +567 -0
  17. package/dist/chunk-36KOSC2J.js.map +1 -0
  18. package/dist/{chunk-HVSUPYX2.js → chunk-3S6KHO7H.js} +311 -238
  19. package/dist/chunk-3S6KHO7H.js.map +1 -0
  20. package/dist/{chunk-TCAVLWYL.js → chunk-7L63OK3O.js} +7 -7
  21. package/dist/{chunk-JRRCAKEP.js → chunk-B52K63AW.js} +2 -2
  22. package/dist/{chunk-FXCYLEFB.js → chunk-BSIPI3KV.js} +18 -2
  23. package/dist/chunk-BSIPI3KV.js.map +1 -0
  24. package/dist/{chunk-IFLE7OMM.js → chunk-FJ5RSSMA.js} +4 -4
  25. package/dist/{chunk-IFLE7OMM.js.map → chunk-FJ5RSSMA.js.map} +1 -1
  26. package/dist/{chunk-XRTTKGKN.js → chunk-OSV3HI5M.js} +746 -680
  27. package/dist/chunk-OSV3HI5M.js.map +1 -0
  28. package/dist/{chunk-KFUBFJR5.js → chunk-WREC7D54.js} +13 -11
  29. package/dist/chunk-WREC7D54.js.map +1 -0
  30. package/dist/{chunk-OZTNBS6V.js → chunk-ZXOADNF3.js} +4 -4
  31. package/dist/index.d.ts +179 -121
  32. package/dist/index.js +17 -9
  33. package/dist/index.js.map +1 -1
  34. package/dist/plugins/trueforge-agent-server-adapter/index.d.ts +1 -5
  35. package/dist/plugins/trueforge-agent-server-adapter/index.js +3 -0
  36. package/dist/plugins/trueforge-agent-server-adapter/index.js.map +1 -1
  37. package/dist/styles.css +1 -1
  38. package/package.json +6 -6
  39. package/dist/OpenUiFenceBlock-3EFPY4JW.js +0 -9
  40. package/dist/SidebarLayout-WVY54TGZ.js.map +0 -1
  41. package/dist/chunk-72LC2M3R.js +0 -567
  42. package/dist/chunk-72LC2M3R.js.map +0 -1
  43. package/dist/chunk-FXCYLEFB.js.map +0 -1
  44. package/dist/chunk-HVSUPYX2.js.map +0 -1
  45. package/dist/chunk-KFUBFJR5.js.map +0 -1
  46. package/dist/chunk-XRTTKGKN.js.map +0 -1
  47. /package/dist/{ConnectorSettings-ODC3LVHN.js.map → ConnectorSettings-FXQ5B7TN.js.map} +0 -0
  48. /package/dist/{DockLayout-2RWDSUKE.js.map → DockLayout-LBNQJZNF.js.map} +0 -0
  49. /package/dist/{DrawerLayout-CZLJYMIN.js.map → DrawerLayout-Q6UK4VMI.js.map} +0 -0
  50. /package/dist/{ModelSettings-CKQ5CVAC.js.map → ModelSettings-4L4LOQJA.js.map} +0 -0
  51. /package/dist/{OpenUiFenceBlock-3EFPY4JW.js.map → OpenUiFenceBlock-6UIIAVBX.js.map} +0 -0
  52. /package/dist/{SandboxSettings-HSCPYUOC.js.map → SandboxSettings-Z4ZG6ZX4.js.map} +0 -0
  53. /package/dist/{SettingsBuilder-MYWRFXRI.js.map → SettingsBuilder-WF7ZWKQW.js.map} +0 -0
  54. /package/dist/{SkillSettings-ECH6SHZ7.js.map → SkillSettings-3EPPC3IT.js.map} +0 -0
  55. /package/dist/{TrueForgeUIWithRouter-RKZ2E7PV.js.map → TrueForgeUIWithRouter-NZ4FGPE4.js.map} +0 -0
  56. /package/dist/{chunk-TCAVLWYL.js.map → chunk-7L63OK3O.js.map} +0 -0
  57. /package/dist/{chunk-JRRCAKEP.js.map → chunk-B52K63AW.js.map} +0 -0
  58. /package/dist/{chunk-OZTNBS6V.js.map → chunk-ZXOADNF3.js.map} +0 -0
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  ComposerBusyProvider,
3
- useComposerBusyState
4
- } from "./chunk-FXCYLEFB.js";
3
+ useComposerBusyState,
4
+ useOptionalCustomActionRenderers
5
+ } from "./chunk-BSIPI3KV.js";
5
6
  import {
6
7
  useAui,
7
8
  useAuiState
@@ -19,25 +20,28 @@ import {
19
20
  threadListIndicesByRecency,
20
21
  threadListItemIsMutable,
21
22
  useIsMobile,
23
+ useMCPAuth,
22
24
  useSearchAgentsList,
23
25
  useSlot,
24
26
  useSlotIsDefault,
25
27
  useToasterOptional
26
- } from "./chunk-XRTTKGKN.js";
28
+ } from "./chunk-OSV3HI5M.js";
27
29
  import {
28
30
  DraftCatalogProvider,
29
31
  Icon,
30
32
  auiButtonClass,
31
- useCompactLayout
32
- } from "./chunk-IFLE7OMM.js";
33
+ useCompactLayout,
34
+ useDraftCatalog
35
+ } from "./chunk-FJ5RSSMA.js";
33
36
  import {
34
37
  libraryAgentId,
38
+ useOptionalCatalogServer,
35
39
  useOptionalServer,
36
40
  useOptionalShellMode
37
41
  } from "./chunk-WQULF5AT.js";
38
42
  import {
39
43
  cn
40
- } from "./chunk-72LC2M3R.js";
44
+ } from "./chunk-36KOSC2J.js";
41
45
 
42
46
  // src/containers/AgentStepsContainer.tsx
43
47
  import { useEffect, useRef, useState } from "react";
@@ -378,137 +382,6 @@ function ReasoningContainer({ group }) {
378
382
 
379
383
  // src/containers/ToolApprovalContainer.tsx
380
384
  import { useCallback as useCallback4, useMemo as useMemo3, useState as useState5 } from "react";
381
- import { jsx as jsx5 } from "react/jsx-runtime";
382
- function ToolApprovalContainer({ toolName = "", options, onSelectOption }) {
383
- const ToolApprovalBar = useSlot("ToolApprovalBar");
384
- const [selectedDenyOptionId, setSelectedDenyOptionId] = useState5(null);
385
- const [denialReason, setDenialReason] = useState5("");
386
- const [showReasonError, setShowReasonError] = useState5(false);
387
- const approveOptions = useMemo3(
388
- () => options.filter((option) => option.isAllow).map((option, index) => ({
389
- ...option,
390
- variant: index === 0 ? "primary" : "secondary",
391
- requiresReason: false
392
- })),
393
- [options]
394
- );
395
- const denyOptions = useMemo3(
396
- () => options.filter((option) => !option.isAllow).map((option) => ({
397
- ...option,
398
- variant: "secondary",
399
- requiresReason: option.confirm != null
400
- })),
401
- [options]
402
- );
403
- const selectedDenyOption = denyOptions.find((option) => option.id === selectedDenyOptionId);
404
- const onDenyOptionChange = useCallback4((optionId) => {
405
- setSelectedDenyOptionId(optionId);
406
- setDenialReason("");
407
- setShowReasonError(false);
408
- }, []);
409
- const onDenialReasonChange = useCallback4((reason) => {
410
- setDenialReason(reason);
411
- setShowReasonError(false);
412
- }, []);
413
- const onReasonSubmit = useCallback4(() => {
414
- const reason = denialReason.trim();
415
- if (!reason) {
416
- setShowReasonError(true);
417
- return;
418
- }
419
- if (selectedDenyOptionId) {
420
- onSelectOption(selectedDenyOptionId, reason);
421
- onDenyOptionChange(null);
422
- }
423
- }, [denialReason, onDenyOptionChange, onSelectOption, selectedDenyOptionId]);
424
- return /* @__PURE__ */ jsx5(
425
- ToolApprovalBar,
426
- {
427
- toolName,
428
- approveOptions: approveOptions.length > 0 ? approveOptions : void 0,
429
- denyOptions: denyOptions.length > 0 ? denyOptions : void 0,
430
- selectedDenyOption,
431
- denialReason,
432
- showReasonError,
433
- onSelect: onSelectOption,
434
- onDenyOptionChange,
435
- onDenialReasonChange,
436
- onReasonSubmit
437
- }
438
- );
439
- }
440
-
441
- // src/containers/ToolCallContentBlockContainer.tsx
442
- import { useCallback as useCallback5, useEffect as useEffect4, useRef as useRef5, useState as useState6 } from "react";
443
- import { jsx as jsx6 } from "react/jsx-runtime";
444
- function ToolCallContentBlockContainer(props) {
445
- const ToolCallContentBlock = useSlot("ToolCallContentBlock");
446
- const { isJson, onContentHeightChange: notifyContentHeightChange, resizable } = props;
447
- const [fullscreen, setFullscreen] = useState6(false);
448
- const [contentHeightRem, setContentHeightRem] = useState6();
449
- const observerRef = useRef5(null);
450
- const contentNodeRef = useRef5(null);
451
- const hasMeasuredRef = useRef5(false);
452
- const contentRef = useCallback5(
453
- (node) => {
454
- observerRef.current?.disconnect();
455
- observerRef.current = null;
456
- contentNodeRef.current = node;
457
- hasMeasuredRef.current = false;
458
- if (node == null) return;
459
- setContentHeightRem(void 0);
460
- if (!resizable) return;
461
- const updateHeight = () => {
462
- if (!hasMeasuredRef.current && isJson !== false) return;
463
- const renderedHeight = node.getBoundingClientRect().height;
464
- const height = hasMeasuredRef.current && renderedHeight > 0 ? renderedHeight : node.scrollHeight;
465
- hasMeasuredRef.current = true;
466
- setContentHeightRem(height / 16);
467
- };
468
- updateHeight();
469
- observerRef.current = new ResizeObserver(updateHeight);
470
- observerRef.current.observe(node);
471
- },
472
- [isJson, resizable]
473
- );
474
- const onContentHeightChange = useCallback5(
475
- (height) => {
476
- const node = contentNodeRef.current;
477
- if (node == null) return;
478
- const renderedHeight = node.getBoundingClientRect().height;
479
- hasMeasuredRef.current = true;
480
- setContentHeightRem((renderedHeight > 0 ? renderedHeight : Math.max(height, node.scrollHeight)) / 16);
481
- notifyContentHeightChange?.(height);
482
- },
483
- [notifyContentHeightChange]
484
- );
485
- useEffect4(
486
- () => () => {
487
- observerRef.current?.disconnect();
488
- },
489
- []
490
- );
491
- return /* @__PURE__ */ jsx6(
492
- ToolCallContentBlock,
493
- {
494
- ...props,
495
- fullscreen,
496
- onFullscreenChange: setFullscreen,
497
- contentHeightRem,
498
- contentRef,
499
- onContentHeightChange
500
- }
501
- );
502
- }
503
-
504
- // src/containers/ToolCallContainer.tsx
505
- import {
506
- MessagePartPrimitive,
507
- MessagePrimitive,
508
- useToolCallElapsed
509
- } from "@assistant-ui/react";
510
- import { useTrueFoundryRespondToToolApproval } from "@truefoundry/assistant-ui-runtime";
511
- import { useState as useState8 } from "react";
512
385
 
513
386
  // src/utils/toolCallParsing.ts
514
387
  import { parse as parsePartialJson } from "partial-json";
@@ -692,6 +565,146 @@ function mcpDisplayName(toolName, mcpServer, innerToolName) {
692
565
  return toolName;
693
566
  }
694
567
 
568
+ // src/containers/ToolApprovalContainer.tsx
569
+ import { jsx as jsx5 } from "react/jsx-runtime";
570
+ function ToolApprovalContainer({
571
+ toolName = "",
572
+ argsText,
573
+ options,
574
+ onSelectOption
575
+ }) {
576
+ const ToolApprovalBar = useSlot("ToolApprovalBar");
577
+ const { mcpServer, innerToolName } = parseMcpToolArgs(argsText);
578
+ const displayToolName = innerToolName && mcpServer ? `${innerToolName} (${mcpServer})` : toolName;
579
+ const [selectedDenyOptionId, setSelectedDenyOptionId] = useState5(null);
580
+ const [denialReason, setDenialReason] = useState5("");
581
+ const [showReasonError, setShowReasonError] = useState5(false);
582
+ const approveOptions = useMemo3(
583
+ () => options.filter((option) => option.isAllow).map((option, index) => ({
584
+ ...option,
585
+ variant: index === 0 ? "primary" : "secondary",
586
+ requiresReason: false
587
+ })),
588
+ [options]
589
+ );
590
+ const denyOptions = useMemo3(
591
+ () => options.filter((option) => !option.isAllow).map((option) => ({
592
+ ...option,
593
+ variant: "secondary",
594
+ requiresReason: option.confirm != null
595
+ })),
596
+ [options]
597
+ );
598
+ const selectedDenyOption = denyOptions.find((option) => option.id === selectedDenyOptionId);
599
+ const onDenyOptionChange = useCallback4((optionId) => {
600
+ setSelectedDenyOptionId(optionId);
601
+ setDenialReason("");
602
+ setShowReasonError(false);
603
+ }, []);
604
+ const onDenialReasonChange = useCallback4((reason) => {
605
+ setDenialReason(reason);
606
+ setShowReasonError(false);
607
+ }, []);
608
+ const onReasonSubmit = useCallback4(() => {
609
+ const reason = denialReason.trim();
610
+ if (!reason) {
611
+ setShowReasonError(true);
612
+ return;
613
+ }
614
+ if (selectedDenyOptionId) {
615
+ onSelectOption(selectedDenyOptionId, reason);
616
+ onDenyOptionChange(null);
617
+ }
618
+ }, [denialReason, onDenyOptionChange, onSelectOption, selectedDenyOptionId]);
619
+ return /* @__PURE__ */ jsx5(
620
+ ToolApprovalBar,
621
+ {
622
+ toolName: displayToolName,
623
+ approveOptions: approveOptions.length > 0 ? approveOptions : void 0,
624
+ denyOptions: denyOptions.length > 0 ? denyOptions : void 0,
625
+ selectedDenyOption,
626
+ denialReason,
627
+ showReasonError,
628
+ onSelect: onSelectOption,
629
+ onDenyOptionChange,
630
+ onDenialReasonChange,
631
+ onReasonSubmit
632
+ }
633
+ );
634
+ }
635
+
636
+ // src/containers/ToolCallContentBlockContainer.tsx
637
+ import { useCallback as useCallback5, useEffect as useEffect4, useRef as useRef5, useState as useState6 } from "react";
638
+ import { jsx as jsx6 } from "react/jsx-runtime";
639
+ function ToolCallContentBlockContainer(props) {
640
+ const ToolCallContentBlock = useSlot("ToolCallContentBlock");
641
+ const { isJson, onContentHeightChange: notifyContentHeightChange, resizable } = props;
642
+ const [fullscreen, setFullscreen] = useState6(false);
643
+ const [contentHeightRem, setContentHeightRem] = useState6();
644
+ const observerRef = useRef5(null);
645
+ const contentNodeRef = useRef5(null);
646
+ const hasMeasuredRef = useRef5(false);
647
+ const contentRef = useCallback5(
648
+ (node) => {
649
+ observerRef.current?.disconnect();
650
+ observerRef.current = null;
651
+ contentNodeRef.current = node;
652
+ hasMeasuredRef.current = false;
653
+ if (node == null) return;
654
+ setContentHeightRem(void 0);
655
+ if (!resizable) return;
656
+ const updateHeight = () => {
657
+ if (!hasMeasuredRef.current && isJson !== false) return;
658
+ const renderedHeight = node.getBoundingClientRect().height;
659
+ const height = hasMeasuredRef.current && renderedHeight > 0 ? renderedHeight : node.scrollHeight;
660
+ hasMeasuredRef.current = true;
661
+ setContentHeightRem(height / 16);
662
+ };
663
+ updateHeight();
664
+ observerRef.current = new ResizeObserver(updateHeight);
665
+ observerRef.current.observe(node);
666
+ },
667
+ [isJson, resizable]
668
+ );
669
+ const onContentHeightChange = useCallback5(
670
+ (height) => {
671
+ const node = contentNodeRef.current;
672
+ if (node == null) return;
673
+ const renderedHeight = node.getBoundingClientRect().height;
674
+ hasMeasuredRef.current = true;
675
+ setContentHeightRem((renderedHeight > 0 ? renderedHeight : Math.max(height, node.scrollHeight)) / 16);
676
+ notifyContentHeightChange?.(height);
677
+ },
678
+ [notifyContentHeightChange]
679
+ );
680
+ useEffect4(
681
+ () => () => {
682
+ observerRef.current?.disconnect();
683
+ },
684
+ []
685
+ );
686
+ return /* @__PURE__ */ jsx6(
687
+ ToolCallContentBlock,
688
+ {
689
+ ...props,
690
+ fullscreen,
691
+ onFullscreenChange: setFullscreen,
692
+ contentHeightRem,
693
+ contentRef,
694
+ onContentHeightChange
695
+ }
696
+ );
697
+ }
698
+
699
+ // src/containers/ToolCallContainer.tsx
700
+ import {
701
+ MessagePartPrimitive,
702
+ MessagePrimitive,
703
+ useToolCallElapsed
704
+ } from "@assistant-ui/react";
705
+ import { useTrueFoundryRespondToToolApproval } from "@truefoundry/assistant-ui-runtime";
706
+ import { useState as useState8 } from "react";
707
+
695
708
  // src/containers/nestedApprovalBridge.ts
696
709
  import { createContext, useContext } from "react";
697
710
  var NestedApprovalBridgeContext = createContext(false);
@@ -763,6 +776,7 @@ function ToolApprovalSlot({ part }) {
763
776
  ToolApprovalContainer,
764
777
  {
765
778
  toolName: part.toolName,
779
+ argsText: part.argsText,
766
780
  options: buildApprovalOptions(part.approval?.options),
767
781
  onSelectOption
768
782
  }
@@ -1158,31 +1172,79 @@ function threadHasPendingMcpAuth(s) {
1158
1172
  function useComposerPauseView() {
1159
1173
  const mcpPending = useAuiState8(threadHasPendingMcpAuth);
1160
1174
  const { pending: toolResponsesPending } = useTrueFoundryToolResponses2();
1175
+ const customActionRenderers = useOptionalCustomActionRenderers();
1161
1176
  if (mcpPending) {
1162
1177
  return { kind: "mcp" };
1163
1178
  }
1164
- if (toolResponsesPending.length > 0) {
1179
+ const firstPending = toolResponsesPending[0];
1180
+ if (firstPending != null) {
1181
+ const toolName = firstPending.toolName;
1182
+ if (toolName != null && customActionRenderers?.[toolName] != null) {
1183
+ return { kind: "custom", toolName };
1184
+ }
1165
1185
  return { kind: "ask-user" };
1166
1186
  }
1167
1187
  return { kind: "compose" };
1168
1188
  }
1169
1189
 
1170
- // src/containers/McpAuthContainer.tsx
1190
+ // src/containers/CustomActionContainer.tsx
1171
1191
  import { useThreadIsRunning as useThreadIsRunning3 } from "@assistant-ui/core/react";
1172
- import { useTrueFoundryMcpAuth } from "@truefoundry/assistant-ui-runtime";
1192
+ import { useTrueFoundryToolResponses as useTrueFoundryToolResponses3 } from "@truefoundry/assistant-ui-runtime";
1193
+ import { useCallback as useCallback6 } from "react";
1173
1194
  import { jsx as jsx12 } from "react/jsx-runtime";
1195
+ function CustomActionContainer() {
1196
+ const renderers = useOptionalCustomActionRenderers();
1197
+ const { pending, respond } = useTrueFoundryToolResponses3();
1198
+ const isRunning = useThreadIsRunning3();
1199
+ const item = pending[0];
1200
+ const onSubmit = useCallback6(
1201
+ (content) => {
1202
+ if (item == null) return;
1203
+ const trimmed = content.trim();
1204
+ if (!trimmed) return;
1205
+ respond({ toolCallId: item.toolCallId, content: trimmed });
1206
+ },
1207
+ [item, respond]
1208
+ );
1209
+ if (item == null || item.toolName == null) return null;
1210
+ const Renderer = renderers?.[item.toolName];
1211
+ if (Renderer == null) return null;
1212
+ return /* @__PURE__ */ jsx12(Renderer, { args: item.args ?? {}, disabled: isRunning, onSubmit });
1213
+ }
1214
+
1215
+ // src/containers/McpAuthContainer.tsx
1216
+ import { useThreadIsRunning as useThreadIsRunning4 } from "@assistant-ui/core/react";
1217
+ import { useTrueFoundryMcpAuth } from "@truefoundry/assistant-ui-runtime";
1218
+ import { jsx as jsx13 } from "react/jsx-runtime";
1219
+ function CatalogMcpAuthPrompt({ servers, onContinue, readOnly }) {
1220
+ const McpAuthPrompt = useSlot("McpAuthPrompt");
1221
+ const { handleAuthorize } = useMCPAuth();
1222
+ const { refreshConnectors } = useDraftCatalog();
1223
+ const handleConnect = (serverId) => {
1224
+ void handleAuthorize(serverId, (isSuccess) => {
1225
+ if (isSuccess) {
1226
+ void refreshConnectors();
1227
+ }
1228
+ });
1229
+ };
1230
+ return /* @__PURE__ */ jsx13(McpAuthPrompt, { servers, onConnect: handleConnect, onContinue, readOnly });
1231
+ }
1174
1232
  function McpAuthContainer() {
1175
1233
  const McpAuthPrompt = useSlot("McpAuthPrompt");
1176
1234
  const { pending, resume } = useTrueFoundryMcpAuth();
1177
- const isRunning = useThreadIsRunning3();
1235
+ const isRunning = useThreadIsRunning4();
1236
+ const catalog = useOptionalCatalogServer();
1178
1237
  if (!pending) return null;
1238
+ if (catalog) {
1239
+ return /* @__PURE__ */ jsx13(CatalogMcpAuthPrompt, { servers: pending.mcpServers, onContinue: () => void resume(), readOnly: isRunning });
1240
+ }
1179
1241
  const handleConnect = (serverId) => {
1180
1242
  const server = pending.mcpServers.find((s) => s.id === serverId);
1181
1243
  if (server?.authUrl) {
1182
1244
  window.open(server.authUrl, "_blank", "noopener,noreferrer");
1183
1245
  }
1184
1246
  };
1185
- return /* @__PURE__ */ jsx12(
1247
+ return /* @__PURE__ */ jsx13(
1186
1248
  McpAuthPrompt,
1187
1249
  {
1188
1250
  servers: pending.mcpServers,
@@ -1197,7 +1259,7 @@ function McpAuthContainer() {
1197
1259
  import { ComposerPrimitive as ComposerPrimitive2, useAui as useAui3, useAuiState as useAuiState9 } from "@assistant-ui/react";
1198
1260
  import { useTrueFoundryAgentSpec, useTrueFoundryCancel } from "@truefoundry/assistant-ui-runtime";
1199
1261
  import { useRef as useRef6 } from "react";
1200
- import { Fragment, jsx as jsx13, jsxs } from "react/jsx-runtime";
1262
+ import { Fragment, jsx as jsx14, jsxs } from "react/jsx-runtime";
1201
1263
  function ComposerBody({ placeholder }) {
1202
1264
  const ComposerShell = useSlot("ComposerShell");
1203
1265
  const aui = useAui3();
@@ -1215,7 +1277,7 @@ function ComposerBody({ placeholder }) {
1215
1277
  send(() => aui.composer().send());
1216
1278
  };
1217
1279
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1218
- /* @__PURE__ */ jsx13(
1280
+ /* @__PURE__ */ jsx14(
1219
1281
  "input",
1220
1282
  {
1221
1283
  ref: fileInputRef,
@@ -1233,13 +1295,13 @@ function ComposerBody({ placeholder }) {
1233
1295
  }
1234
1296
  }
1235
1297
  ),
1236
- /* @__PURE__ */ jsx13(
1298
+ /* @__PURE__ */ jsx14(
1237
1299
  ComposerPrimitive2.AttachmentDropzone,
1238
1300
  {
1239
1301
  disabled: isBusy,
1240
1302
  "data-slot": "aui_composer-attachment-dropzone",
1241
1303
  className: "w-full rounded-[var(--composer-radius,1.5rem)] transition-[box-shadow] data-[dragging=true]:ring-focus-ring/20 data-[dragging=true]:ring-3",
1242
- children: /* @__PURE__ */ jsx13(
1304
+ children: /* @__PURE__ */ jsx14(
1243
1305
  ComposerPrimitive2.Root,
1244
1306
  {
1245
1307
  "data-slot": "aui_composer-root",
@@ -1248,11 +1310,11 @@ function ComposerBody({ placeholder }) {
1248
1310
  event.preventDefault();
1249
1311
  submit();
1250
1312
  },
1251
- children: /* @__PURE__ */ jsx13(
1313
+ children: /* @__PURE__ */ jsx14(
1252
1314
  ComposerShell,
1253
1315
  {
1254
- attachments: /* @__PURE__ */ jsx13(ComposerAttachmentsContainer, {}),
1255
- input: /* @__PURE__ */ jsx13(
1316
+ attachments: /* @__PURE__ */ jsx14(ComposerAttachmentsContainer, {}),
1317
+ input: /* @__PURE__ */ jsx14(
1256
1318
  ComposerPrimitive2.Input,
1257
1319
  {
1258
1320
  "data-slot": "aui_composer-input",
@@ -1293,30 +1355,33 @@ function ComposerContainer({
1293
1355
  const DraftComposerRightSection = useSlot("DraftComposerRightSection");
1294
1356
  const canMutateSpec = shell?.mode.status === "active" && shell.mode.isMutable;
1295
1357
  if (pauseView.kind === "mcp") {
1296
- return /* @__PURE__ */ jsx13(McpAuthContainer, {});
1358
+ return /* @__PURE__ */ jsx14(McpAuthContainer, {});
1359
+ }
1360
+ if (pauseView.kind === "custom") {
1361
+ return /* @__PURE__ */ jsx14(CustomActionContainer, {});
1297
1362
  }
1298
1363
  if (pauseView.kind === "ask-user") {
1299
- return /* @__PURE__ */ jsx13(AskUserContainer, {});
1364
+ return /* @__PURE__ */ jsx14(AskUserContainer, {});
1300
1365
  }
1301
1366
  if (canMutateSpec) {
1302
- return /* @__PURE__ */ jsx13(DraftCatalogProvider, { children: /* @__PURE__ */ jsx13(
1367
+ return /* @__PURE__ */ jsx14(DraftCatalogProvider, { children: /* @__PURE__ */ jsx14(
1303
1368
  SlotsProvider,
1304
1369
  {
1305
1370
  overrides: {
1306
1371
  ComposerLeftSection: usesDefaultLeftSection ? DraftComposerLeftSection : parentLeftSection,
1307
1372
  ComposerRightSection: usesDefaultRightSection ? DraftComposerRightSection : parentRightSection
1308
1373
  },
1309
- children: /* @__PURE__ */ jsx13(ComposerBody, { placeholder })
1374
+ children: /* @__PURE__ */ jsx14(ComposerBody, { placeholder })
1310
1375
  }
1311
1376
  ) });
1312
1377
  }
1313
- return /* @__PURE__ */ jsx13(ComposerBody, { placeholder });
1378
+ return /* @__PURE__ */ jsx14(ComposerBody, { placeholder });
1314
1379
  }
1315
1380
 
1316
1381
  // src/containers/HistoryLoaderContainer.tsx
1317
1382
  import { useTrueFoundryHistoryPagination } from "@truefoundry/assistant-ui-runtime";
1318
- import { useCallback as useCallback6, useEffect as useEffect6, useRef as useRef7, useState as useState10 } from "react";
1319
- import { jsx as jsx14 } from "react/jsx-runtime";
1383
+ import { useCallback as useCallback7, useEffect as useEffect6, useRef as useRef7, useState as useState10 } from "react";
1384
+ import { jsx as jsx15 } from "react/jsx-runtime";
1320
1385
  var TOP_THRESHOLD_PX = 200;
1321
1386
  var VIEWPORT_SELECTOR = '[data-slot="aui_thread-viewport"]';
1322
1387
  function HistoryLoaderContainer() {
@@ -1324,7 +1389,7 @@ function HistoryLoaderContainer() {
1324
1389
  const { hasOlderHistory, isLoadingOlderHistory, loadOlderHistory } = useTrueFoundryHistoryPagination();
1325
1390
  const [sentinel, setSentinel] = useState10(null);
1326
1391
  const inflightRef = useRef7(false);
1327
- const maybeLoadOlder = useCallback6(async () => {
1392
+ const maybeLoadOlder = useCallback7(async () => {
1328
1393
  if (inflightRef.current) return;
1329
1394
  inflightRef.current = true;
1330
1395
  const viewport = sentinel?.closest(VIEWPORT_SELECTOR) ?? null;
@@ -1359,48 +1424,48 @@ function HistoryLoaderContainer() {
1359
1424
  return () => observer.disconnect();
1360
1425
  }, [sentinel, hasOlderHistory, maybeLoadOlder]);
1361
1426
  if (!hasOlderHistory) return null;
1362
- return /* @__PURE__ */ jsx14(HistoryLoader, { ref: setSentinel, isLoading: isLoadingOlderHistory });
1427
+ return /* @__PURE__ */ jsx15(HistoryLoader, { ref: setSentinel, isLoading: isLoadingOlderHistory });
1363
1428
  }
1364
1429
 
1365
1430
  // src/containers/ResumeUnavailableContainer.tsx
1366
1431
  import { useTrueFoundryResumeUnavailable as useTrueFoundryResumeUnavailable2 } from "@truefoundry/assistant-ui-runtime";
1367
- import { jsx as jsx15 } from "react/jsx-runtime";
1432
+ import { jsx as jsx16 } from "react/jsx-runtime";
1368
1433
  function ResumeUnavailableContainer() {
1369
1434
  const ResumeUnavailable = useSlot("ResumeUnavailable");
1370
1435
  const resumeUnavailable = useTrueFoundryResumeUnavailable2();
1371
1436
  if (!resumeUnavailable) return null;
1372
- return /* @__PURE__ */ jsx15(ResumeUnavailable, {});
1437
+ return /* @__PURE__ */ jsx16(ResumeUnavailable, {});
1373
1438
  }
1374
1439
 
1375
1440
  // src/containers/UserEditComposerContainer.tsx
1376
- import { useComposerCancel, useComposerSend, useThreadIsRunning as useThreadIsRunning4 } from "@assistant-ui/core/react";
1441
+ import { useComposerCancel, useComposerSend, useThreadIsRunning as useThreadIsRunning5 } from "@assistant-ui/core/react";
1377
1442
  import { ComposerPrimitive as ComposerPrimitive3, MessagePrimitive as MessagePrimitive4, useAuiState as useAuiState10 } from "@assistant-ui/react";
1378
- import { jsx as jsx16, jsxs as jsxs2 } from "react/jsx-runtime";
1443
+ import { jsx as jsx17, jsxs as jsxs2 } from "react/jsx-runtime";
1379
1444
  function ReadOnlyMessageAttachments() {
1380
1445
  const hasAttachments = useAuiState10((s) => (s.message.attachments?.length ?? 0) > 0);
1381
1446
  if (!hasAttachments) {
1382
1447
  return null;
1383
1448
  }
1384
- return /* @__PURE__ */ jsx16("div", { className: "pointer-events-none mb-2 opacity-90", children: /* @__PURE__ */ jsx16(MessageAttachmentsContainer, {}) });
1449
+ return /* @__PURE__ */ jsx17("div", { className: "pointer-events-none mb-2 opacity-90", children: /* @__PURE__ */ jsx17(MessageAttachmentsContainer, {}) });
1385
1450
  }
1386
1451
  function UserEditComposerContainer() {
1387
1452
  const UserMessageEdit = useSlot("UserMessageEdit");
1388
1453
  const MessageTimestamp = useSlot("MessageTimestamp");
1389
- const isRunning = useThreadIsRunning4();
1454
+ const isRunning = useThreadIsRunning5();
1390
1455
  const createdAt = useAuiState10((s) => s.message.createdAt);
1391
1456
  const { cancel, disabled: cancelDisabled } = useComposerCancel();
1392
1457
  const { disabled: sendDisabled } = useComposerSend();
1393
- return /* @__PURE__ */ jsx16(MessagePrimitive4.Root, { "data-role": "user", children: /* @__PURE__ */ jsx16(
1458
+ return /* @__PURE__ */ jsx17(MessagePrimitive4.Root, { "data-role": "user", children: /* @__PURE__ */ jsx17(
1394
1459
  ComposerPrimitive3.Root,
1395
1460
  {
1396
1461
  "data-slot": "aui_user-edit-composer-root",
1397
1462
  className: "fade-in slide-in-from-bottom-1 animate-in flex w-full justify-end px-2 duration-150",
1398
- children: /* @__PURE__ */ jsx16(
1463
+ children: /* @__PURE__ */ jsx17(
1399
1464
  UserMessageEdit,
1400
1465
  {
1401
- timestamp: /* @__PURE__ */ jsx16(MessageTimestamp, { createdAt }),
1402
- attachments: /* @__PURE__ */ jsx16(ReadOnlyMessageAttachments, {}),
1403
- input: /* @__PURE__ */ jsx16("div", { className: "mt-1 rounded border border-border bg-secondary-bg p-2 text-text-primary", children: /* @__PURE__ */ jsx16(
1466
+ timestamp: /* @__PURE__ */ jsx17(MessageTimestamp, { createdAt }),
1467
+ attachments: /* @__PURE__ */ jsx17(ReadOnlyMessageAttachments, {}),
1468
+ input: /* @__PURE__ */ jsx17("div", { className: "mt-1 rounded border border-border bg-secondary-bg p-2 text-text-primary", children: /* @__PURE__ */ jsx17(
1404
1469
  ComposerPrimitive3.Input,
1405
1470
  {
1406
1471
  "data-slot": "aui_user-edit-input",
@@ -1411,8 +1476,8 @@ function UserEditComposerContainer() {
1411
1476
  }
1412
1477
  ) }),
1413
1478
  footer: /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-end gap-2", children: [
1414
- /* @__PURE__ */ jsx16(Button, { variant: "secondary", type: "button", disabled: cancelDisabled, onClick: cancel, children: "Cancel" }),
1415
- /* @__PURE__ */ jsx16(ComposerPrimitive3.Send, { asChild: true, children: /* @__PURE__ */ jsx16(Button, { type: "submit", disabled: sendDisabled || isRunning, children: "Save & Rerun" }) })
1479
+ /* @__PURE__ */ jsx17(Button, { variant: "secondary", type: "button", disabled: cancelDisabled, onClick: cancel, children: "Cancel" }),
1480
+ /* @__PURE__ */ jsx17(ComposerPrimitive3.Send, { asChild: true, children: /* @__PURE__ */ jsx17(Button, { type: "submit", disabled: sendDisabled || isRunning, children: "Save & Rerun" }) })
1416
1481
  ] })
1417
1482
  }
1418
1483
  )
@@ -1421,13 +1486,13 @@ function UserEditComposerContainer() {
1421
1486
  }
1422
1487
 
1423
1488
  // src/containers/UserMessageContainer.tsx
1424
- import { useActionBarCopy as useActionBarCopy2, useActionBarEdit, useThreadIsRunning as useThreadIsRunning5 } from "@assistant-ui/core/react";
1489
+ import { useActionBarCopy as useActionBarCopy2, useActionBarEdit, useThreadIsRunning as useThreadIsRunning6 } from "@assistant-ui/core/react";
1425
1490
  import { MessagePrimitive as MessagePrimitive5, useAui as useAui4, useAuiState as useAuiState11 } from "@assistant-ui/react";
1426
- import { jsx as jsx17 } from "react/jsx-runtime";
1491
+ import { jsx as jsx18 } from "react/jsx-runtime";
1427
1492
  function UserMessageContainer() {
1428
1493
  const UserMessageBubble = useSlot("UserMessageBubble");
1429
1494
  const UserMessageActionBar = useSlot("UserMessageActionBar");
1430
- const isRunning = useThreadIsRunning5();
1495
+ const isRunning = useThreadIsRunning6();
1431
1496
  const aui = useAui4();
1432
1497
  const createdAt = useAuiState11((s) => s.message.createdAt);
1433
1498
  const text = useAuiState11(
@@ -1437,12 +1502,12 @@ function UserMessageContainer() {
1437
1502
  const { copy, isCopied } = useActionBarCopy2({
1438
1503
  copyToClipboard: (value) => navigator.clipboard.writeText(value)
1439
1504
  });
1440
- return /* @__PURE__ */ jsx17(MessagePrimitive5.Root, { "data-role": "user", children: /* @__PURE__ */ jsx17(
1505
+ return /* @__PURE__ */ jsx18(MessagePrimitive5.Root, { "data-role": "user", children: /* @__PURE__ */ jsx18(
1441
1506
  UserMessageBubble,
1442
1507
  {
1443
1508
  text,
1444
- attachments: /* @__PURE__ */ jsx17(MessageAttachmentsContainer, {}),
1445
- editAction: !isRunning ? /* @__PURE__ */ jsx17(
1509
+ attachments: /* @__PURE__ */ jsx18(MessageAttachmentsContainer, {}),
1510
+ editAction: !isRunning ? /* @__PURE__ */ jsx18(
1446
1511
  UserMessageActionBar,
1447
1512
  {
1448
1513
  isCopied,
@@ -1465,14 +1530,14 @@ import { ThreadPrimitive, useAuiState as useAuiState12 } from "@assistant-ui/rea
1465
1530
  import { useEffect as useEffect8 } from "react";
1466
1531
 
1467
1532
  // src/hooks/useSyncSessionTitle.ts
1468
- import { useThreadIsRunning as useThreadIsRunning6 } from "@assistant-ui/core/react";
1533
+ import { useThreadIsRunning as useThreadIsRunning7 } from "@assistant-ui/core/react";
1469
1534
  import { useEffect as useEffect7, useRef as useRef8 } from "react";
1470
1535
  function useSyncSessionTitle() {
1471
1536
  const server = useOptionalServer();
1472
1537
  const aui = useAui();
1473
1538
  const remoteId = useAuiState((s) => s.threadListItem.remoteId);
1474
1539
  const title = useAuiState((s) => s.threadListItem.title);
1475
- const isRunning = useThreadIsRunning6();
1540
+ const isRunning = useThreadIsRunning7();
1476
1541
  const wasRunningRef = useRef8(false);
1477
1542
  const syncedRemoteIdRef = useRef8(void 0);
1478
1543
  useEffect7(() => {
@@ -1509,19 +1574,19 @@ function useSyncSessionTitle() {
1509
1574
  var isNewChatView = (s) => s.thread.messages.length === 0 && (!s.thread.isLoading || s.threads.isLoading) && s.threadListItem.remoteId == null;
1510
1575
 
1511
1576
  // src/containers/ThreadContainer.tsx
1512
- import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs3 } from "react/jsx-runtime";
1577
+ import { Fragment as Fragment2, jsx as jsx19, jsxs as jsxs3 } from "react/jsx-runtime";
1513
1578
  function AnimatedMessageShell({ children }) {
1514
- return /* @__PURE__ */ jsx18("div", { className: "animate-in fade-in slide-in-from-bottom-1 fill-mode-both duration-200", children });
1579
+ return /* @__PURE__ */ jsx19("div", { className: "animate-in fade-in slide-in-from-bottom-1 fill-mode-both duration-200", children });
1515
1580
  }
1516
1581
  function ThreadMessage({ isEditing }) {
1517
1582
  const role = useAuiState12((s) => s.message.role);
1518
1583
  if (role === "user") {
1519
1584
  if (isEditing) {
1520
- return /* @__PURE__ */ jsx18(UserEditComposerContainer, {});
1585
+ return /* @__PURE__ */ jsx19(UserEditComposerContainer, {});
1521
1586
  }
1522
- return /* @__PURE__ */ jsx18(UserMessageContainer, {});
1587
+ return /* @__PURE__ */ jsx19(UserMessageContainer, {});
1523
1588
  }
1524
- return /* @__PURE__ */ jsx18(AssistantMessageContainer, {});
1589
+ return /* @__PURE__ */ jsx19(AssistantMessageContainer, {});
1525
1590
  }
1526
1591
  function ThreadContainer({ composer }) {
1527
1592
  useEffect8(() => {
@@ -1539,29 +1604,29 @@ function ThreadContainer({ composer }) {
1539
1604
  const isEmpty = useAuiState12(isNewChatView);
1540
1605
  const isLoading = useAuiState12((s) => s.thread.isLoading);
1541
1606
  const welcomeHeading = shell?.mode.status === "active" ? shell.mode.agentName : void 0;
1542
- return /* @__PURE__ */ jsx18(ComposerBusyProvider, { children: /* @__PURE__ */ jsx18(ThreadPrimitive.Root, { asChild: true, children: /* @__PURE__ */ jsxs3(ThreadRootShell, { children: [
1543
- /* @__PURE__ */ jsx18(ThreadPrimitive.Viewport, { asChild: true, autoScroll: true, children: /* @__PURE__ */ jsxs3(ThreadViewportShell, { isEmpty, children: [
1544
- isEmpty && /* @__PURE__ */ jsx18(WelcomeScreen, { heading: welcomeHeading }),
1607
+ return /* @__PURE__ */ jsx19(ComposerBusyProvider, { children: /* @__PURE__ */ jsx19(ThreadPrimitive.Root, { asChild: true, children: /* @__PURE__ */ jsxs3(ThreadRootShell, { children: [
1608
+ /* @__PURE__ */ jsx19(ThreadPrimitive.Viewport, { asChild: true, autoScroll: true, children: /* @__PURE__ */ jsxs3(ThreadViewportShell, { isEmpty, children: [
1609
+ isEmpty && /* @__PURE__ */ jsx19(WelcomeScreen, { heading: welcomeHeading }),
1545
1610
  isEmpty && !isLoading && composer,
1546
- isLoading ? /* @__PURE__ */ jsx18(MessageListSkeleton, {}) : !isEmpty && /* @__PURE__ */ jsxs3(Fragment2, { children: [
1547
- /* @__PURE__ */ jsx18(HistoryLoaderContainer, {}),
1611
+ isLoading ? /* @__PURE__ */ jsx19(MessageListSkeleton, {}) : !isEmpty && /* @__PURE__ */ jsxs3(Fragment2, { children: [
1612
+ /* @__PURE__ */ jsx19(HistoryLoaderContainer, {}),
1548
1613
  /* @__PURE__ */ jsxs3(MessageGroup, { children: [
1549
- /* @__PURE__ */ jsx18(ThreadPrimitive.Messages, { children: ({ message }) => /* @__PURE__ */ jsx18(AnimatedMessageShell, { children: /* @__PURE__ */ jsx18(ThreadMessage, { isEditing: message.role === "user" && message.composer.isEditing }) }) }),
1550
- /* @__PURE__ */ jsx18(ResumeUnavailableContainer, {})
1614
+ /* @__PURE__ */ jsx19(ThreadPrimitive.Messages, { children: ({ message }) => /* @__PURE__ */ jsx19(AnimatedMessageShell, { children: /* @__PURE__ */ jsx19(ThreadMessage, { isEditing: message.role === "user" && message.composer.isEditing }) }) }),
1615
+ /* @__PURE__ */ jsx19(ResumeUnavailableContainer, {})
1551
1616
  ] })
1552
1617
  ] })
1553
1618
  ] }) }),
1554
1619
  !isLoading && !isEmpty && /* @__PURE__ */ jsxs3(ThreadComposerAreaShell, { isEmpty, children: [
1555
- /* @__PURE__ */ jsx18(ThreadPrimitive.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx18(ScrollToBottomButton, {}) }),
1620
+ /* @__PURE__ */ jsx19(ThreadPrimitive.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx19(ScrollToBottomButton, {}) }),
1556
1621
  composer
1557
1622
  ] })
1558
1623
  ] }) }) });
1559
1624
  }
1560
1625
 
1561
1626
  // src/containers/Thread.tsx
1562
- import { jsx as jsx19 } from "react/jsx-runtime";
1627
+ import { jsx as jsx20 } from "react/jsx-runtime";
1563
1628
  function Thread() {
1564
- return /* @__PURE__ */ jsx19(ThreadContainer, { composer: /* @__PURE__ */ jsx19(ComposerContainer, {}) });
1629
+ return /* @__PURE__ */ jsx20(ThreadContainer, { composer: /* @__PURE__ */ jsx20(ComposerContainer, {}) });
1565
1630
  }
1566
1631
 
1567
1632
  // src/containers/ThreadListContainer.tsx
@@ -1573,7 +1638,7 @@ import {
1573
1638
  useAui as useAui5,
1574
1639
  useAuiState as useAuiState13
1575
1640
  } from "@assistant-ui/react";
1576
- import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef11, useState as useState13 } from "react";
1641
+ import { useCallback as useCallback8, useEffect as useEffect11, useMemo as useMemo5, useRef as useRef11, useState as useState13 } from "react";
1577
1642
 
1578
1643
  // src/atoms/AgentHistoryFilterButton.tsx
1579
1644
  import { useEffect as useEffect10, useId as useId2, useLayoutEffect, useRef as useRef10, useState as useState12 } from "react";
@@ -1581,9 +1646,9 @@ import { createPortal } from "react-dom";
1581
1646
 
1582
1647
  // src/atoms/primitives/DropdownMenu.tsx
1583
1648
  import React, { useEffect as useEffect9, useId, useRef as useRef9, useState as useState11 } from "react";
1584
- import { jsx as jsx20, jsxs as jsxs4 } from "react/jsx-runtime";
1649
+ import { jsx as jsx21, jsxs as jsxs4 } from "react/jsx-runtime";
1585
1650
  function DropdownMenuItem({ className, ...props }) {
1586
- return /* @__PURE__ */ jsx20(
1651
+ return /* @__PURE__ */ jsx21(
1587
1652
  "button",
1588
1653
  {
1589
1654
  role: "menuitem",
@@ -1602,7 +1667,7 @@ function DropdownMenuItem({ className, ...props }) {
1602
1667
  }
1603
1668
 
1604
1669
  // src/atoms/AgentHistoryFilterButton.tsx
1605
- import { Fragment as Fragment3, jsx as jsx21, jsxs as jsxs5 } from "react/jsx-runtime";
1670
+ import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs5 } from "react/jsx-runtime";
1606
1671
  function themePortalRoot(from) {
1607
1672
  return from?.closest(".aui-theme-root") ?? document.body;
1608
1673
  }
@@ -1662,8 +1727,8 @@ function AgentHistoryFilterButton() {
1662
1727
  };
1663
1728
  const filterBody = /* @__PURE__ */ jsxs5(Fragment3, { children: [
1664
1729
  /* @__PURE__ */ jsxs5("div", { className: "p-1", onMouseDown: (e) => e.stopPropagation(), children: [
1665
- /* @__PURE__ */ jsx21(SearchInput_default, { query, setQuery, placeholder: "Search agents" }),
1666
- isSearching ? /* @__PURE__ */ jsx21("p", { className: "text-text-secondary px-1 pt-1 text-[11px]", role: "status", children: "Searching\u2026" }) : null
1730
+ /* @__PURE__ */ jsx22(SearchInput_default, { query, setQuery, placeholder: "Search agents" }),
1731
+ isSearching ? /* @__PURE__ */ jsx22("p", { className: "text-text-secondary px-1 pt-1 text-[11px]", role: "status", children: "Searching\u2026" }) : null
1667
1732
  ] }),
1668
1733
  /* @__PURE__ */ jsxs5(
1669
1734
  "div",
@@ -1681,11 +1746,11 @@ function AgentHistoryFilterButton() {
1681
1746
  onClick: () => pick(null),
1682
1747
  children: [
1683
1748
  "All chats",
1684
- selected == null ? /* @__PURE__ */ jsx21(Icon, { name: "check", className: "size-3.5 shrink-0" }) : null
1749
+ selected == null ? /* @__PURE__ */ jsx22(Icon, { name: "check", className: "size-3.5 shrink-0" }) : null
1685
1750
  ]
1686
1751
  }
1687
1752
  ) : null,
1688
- isInitialLoading ? /* @__PURE__ */ jsx21("p", { className: "px-2 py-3 text-center text-xs text-text-secondary", children: "Loading\u2026" }) : agents.length === 0 ? /* @__PURE__ */ jsx21("p", { className: "text-text-secondary px-2 py-6 text-center text-xs", role: "status", children: query.trim() ? `No agents match "${query.trim()}".` : "No agents yet." }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
1753
+ isInitialLoading ? /* @__PURE__ */ jsx22("p", { className: "px-2 py-3 text-center text-xs text-text-secondary", children: "Loading\u2026" }) : agents.length === 0 ? /* @__PURE__ */ jsx22("p", { className: "text-text-secondary px-2 py-6 text-center text-xs", role: "status", children: query.trim() ? `No agents match "${query.trim()}".` : "No agents yet." }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
1689
1754
  agents.map((agent) => {
1690
1755
  const id = libraryAgentId(agent);
1691
1756
  const active = selected === id;
@@ -1698,14 +1763,14 @@ function AgentHistoryFilterButton() {
1698
1763
  ),
1699
1764
  onClick: () => pick(id),
1700
1765
  children: [
1701
- /* @__PURE__ */ jsx21("span", { className: "min-w-0 truncate", children: agent.name }),
1702
- active ? /* @__PURE__ */ jsx21(Icon, { name: "check", className: "size-3.5 shrink-0" }) : null
1766
+ /* @__PURE__ */ jsx22("span", { className: "min-w-0 truncate", children: agent.name }),
1767
+ active ? /* @__PURE__ */ jsx22(Icon, { name: "check", className: "size-3.5 shrink-0" }) : null
1703
1768
  ]
1704
1769
  },
1705
1770
  id
1706
1771
  );
1707
1772
  }),
1708
- hasMore ? /* @__PURE__ */ jsx21("div", { ref: sentinelRef, className: "flex h-6 shrink-0 items-center justify-center", "aria-hidden": true, children: loadingMore ? /* @__PURE__ */ jsx21("span", { className: "text-text-secondary text-[11px]", role: "status", children: "Loading more\u2026" }) : null }) : null
1773
+ hasMore ? /* @__PURE__ */ jsx22("div", { ref: sentinelRef, className: "flex h-6 shrink-0 items-center justify-center", "aria-hidden": true, children: loadingMore ? /* @__PURE__ */ jsx22("span", { className: "text-text-secondary text-[11px]", role: "status", children: "Loading more\u2026" }) : null }) : null
1709
1774
  ] })
1710
1775
  ]
1711
1776
  }
@@ -1732,8 +1797,8 @@ function AgentHistoryFilterButton() {
1732
1797
  }),
1733
1798
  onClick: () => setOpen((v) => !v),
1734
1799
  children: [
1735
- /* @__PURE__ */ jsx21(Icon, { name: "funnel", className: "size-3.5" }),
1736
- selected != null ? /* @__PURE__ */ jsx21(
1800
+ /* @__PURE__ */ jsx22(Icon, { name: "funnel", className: "size-3.5" }),
1801
+ selected != null ? /* @__PURE__ */ jsx22(
1737
1802
  "span",
1738
1803
  {
1739
1804
  className: "bg-primary-button-bg absolute top-1 right-1 size-1.5 rounded-full",
@@ -1744,9 +1809,9 @@ function AgentHistoryFilterButton() {
1744
1809
  ]
1745
1810
  }
1746
1811
  ),
1747
- useSheet && open ? /* @__PURE__ */ jsx21(BottomSheet, { open: true, onOpenChange: setOpen, id: menuId, "aria-label": "Filter agents", children: /* @__PURE__ */ jsx21("div", { className: "flex min-h-0 flex-1 flex-col p-2", role: "menu", children: filterBody }) }) : null,
1812
+ useSheet && open ? /* @__PURE__ */ jsx22(BottomSheet, { open: true, onOpenChange: setOpen, id: menuId, "aria-label": "Filter agents", children: /* @__PURE__ */ jsx22("div", { className: "flex min-h-0 flex-1 flex-col p-2", role: "menu", children: filterBody }) }) : null,
1748
1813
  !useSheet && open && menuPos != null ? createPortal(
1749
- /* @__PURE__ */ jsx21(
1814
+ /* @__PURE__ */ jsx22(
1750
1815
  "div",
1751
1816
  {
1752
1817
  ref: menuRef,
@@ -1764,13 +1829,18 @@ function AgentHistoryFilterButton() {
1764
1829
  }
1765
1830
 
1766
1831
  // src/containers/ThreadListContainer.tsx
1767
- import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs6 } from "react/jsx-runtime";
1768
- var deleteItemClass = "flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none text-failure-bg hover:bg-ghost-button-hover hover:text-failure-bg focus:bg-ghost-button-hover focus:text-failure-bg data-[highlighted]:bg-ghost-button-hover data-[highlighted]:text-failure-bg";
1832
+ import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs6 } from "react/jsx-runtime";
1833
+ 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";
1769
1834
  function ThreadListItemDeleteMenu() {
1770
1835
  const compact = useCompactLayout();
1771
1836
  const isMobile = useIsMobile();
1772
1837
  const [sheetOpen, setSheetOpen] = useState13(false);
1838
+ const [portalContainer, setPortalContainer] = useState13();
1773
1839
  const useSheet = isMobile || compact;
1840
+ const setTriggerElement = useCallback8((element) => {
1841
+ const themeRoot = element?.closest(".aui-theme-root");
1842
+ setPortalContainer(themeRoot instanceof HTMLElement ? themeRoot : void 0);
1843
+ }, []);
1774
1844
  const moreButtonClass = auiButtonClass({
1775
1845
  variant: "ghost",
1776
1846
  size: "icon",
@@ -1778,7 +1848,7 @@ function ThreadListItemDeleteMenu() {
1778
1848
  });
1779
1849
  if (useSheet) {
1780
1850
  return /* @__PURE__ */ jsxs6(Fragment4, { children: [
1781
- /* @__PURE__ */ jsx22(
1851
+ /* @__PURE__ */ jsx23(
1782
1852
  "button",
1783
1853
  {
1784
1854
  type: "button",
@@ -1788,33 +1858,35 @@ function ThreadListItemDeleteMenu() {
1788
1858
  "aria-expanded": sheetOpen,
1789
1859
  className: moreButtonClass,
1790
1860
  onClick: () => setSheetOpen(true),
1791
- children: /* @__PURE__ */ jsx22(Icon, { name: "ellipsis", className: "size-3.5" })
1861
+ children: /* @__PURE__ */ jsx23(Icon, { name: "ellipsis", className: "size-3.5" })
1792
1862
  }
1793
1863
  ),
1794
- sheetOpen ? /* @__PURE__ */ jsx22(BottomSheet, { open: true, onOpenChange: setSheetOpen, "aria-label": "Session actions", children: /* @__PURE__ */ jsx22("div", { className: "flex flex-col gap-1 p-2", role: "menu", children: /* @__PURE__ */ jsxs6(ThreadListItemPrimitive.Delete, { className: deleteItemClass, onClick: () => setSheetOpen(false), children: [
1795
- /* @__PURE__ */ jsx22(Icon, { name: "trash", className: "size-3.5" }),
1864
+ sheetOpen ? /* @__PURE__ */ jsx23(BottomSheet, { open: true, onOpenChange: setSheetOpen, "aria-label": "Session actions", children: /* @__PURE__ */ jsx23("div", { className: "flex flex-col gap-1 p-2", role: "menu", children: /* @__PURE__ */ jsxs6(ThreadListItemPrimitive.Delete, { className: deleteItemClass, onClick: () => setSheetOpen(false), children: [
1865
+ /* @__PURE__ */ jsx23(Icon, { name: "trash", className: "size-3.5" }),
1796
1866
  "Delete"
1797
1867
  ] }) }) }) : null
1798
1868
  ] });
1799
1869
  }
1800
1870
  return /* @__PURE__ */ jsxs6(ThreadListItemMorePrimitive.Root, { sharedFocusGroup: true, children: [
1801
- /* @__PURE__ */ jsx22(
1871
+ /* @__PURE__ */ jsx23(
1802
1872
  ThreadListItemMorePrimitive.Trigger,
1803
1873
  {
1874
+ ref: setTriggerElement,
1804
1875
  "aria-label": "Session actions",
1805
1876
  title: "Session actions",
1806
1877
  className: moreButtonClass,
1807
- children: /* @__PURE__ */ jsx22(Icon, { name: "ellipsis", className: "size-3.5" })
1878
+ children: /* @__PURE__ */ jsx23(Icon, { name: "ellipsis", className: "size-3.5" })
1808
1879
  }
1809
1880
  ),
1810
- /* @__PURE__ */ jsx22(
1881
+ /* @__PURE__ */ jsx23(
1811
1882
  ThreadListItemMorePrimitive.Content,
1812
1883
  {
1884
+ portalProps: { container: portalContainer },
1813
1885
  align: "end",
1814
1886
  sideOffset: 4,
1815
- className: "z-50 min-w-[8rem] rounded-md border border-border bg-card-bg p-1 text-text-primary shadow-md",
1816
- children: /* @__PURE__ */ jsx22(ThreadListItemPrimitive.Delete, { asChild: true, children: /* @__PURE__ */ jsxs6(ThreadListItemMorePrimitive.Item, { className: deleteItemClass, children: [
1817
- /* @__PURE__ */ jsx22(Icon, { name: "trash", className: "size-3.5" }),
1887
+ className: "font-sans-flex z-50 min-w-[8rem] rounded-md border border-border bg-card-bg p-1 text-text-primary shadow-md",
1888
+ children: /* @__PURE__ */ jsx23(ThreadListItemPrimitive.Delete, { asChild: true, children: /* @__PURE__ */ jsxs6(ThreadListItemMorePrimitive.Item, { className: deleteItemClass, children: [
1889
+ /* @__PURE__ */ jsx23(Icon, { name: "trash", className: "size-3.5" }),
1818
1890
  "Delete"
1819
1891
  ] }) })
1820
1892
  }
@@ -1836,7 +1908,7 @@ function ThreadListItemRow({
1836
1908
  const mainThreadId = useAuiState13((s) => s.threads.mainThreadId);
1837
1909
  const agentName = readThreadAgentName(custom);
1838
1910
  const showDelete = canDeleteSession && remoteId != null;
1839
- return /* @__PURE__ */ jsx22(ThreadListItemPrimitive.Root, { className: "min-w-0", children: /* @__PURE__ */ jsx22(
1911
+ return /* @__PURE__ */ jsx23(ThreadListItemPrimitive.Root, { className: "min-w-0", children: /* @__PURE__ */ jsx23(
1840
1912
  ThreadListRow,
1841
1913
  {
1842
1914
  title: title ?? "New Chat",
@@ -1869,7 +1941,7 @@ function ThreadListItemRow({
1869
1941
  }
1870
1942
  void Promise.resolve(aui.threads().switchToThread(id)).catch(() => void 0);
1871
1943
  },
1872
- actions: showDelete ? /* @__PURE__ */ jsx22(ThreadListItemDeleteMenu, {}) : void 0
1944
+ actions: showDelete ? /* @__PURE__ */ jsx23(ThreadListItemDeleteMenu, {}) : void 0
1873
1945
  }
1874
1946
  ) });
1875
1947
  }
@@ -1884,9 +1956,9 @@ function ThreadListItemsByRecency({
1884
1956
  }) {
1885
1957
  const indices = useThreadListIndicesByRecency();
1886
1958
  const threadIds = useAuiState13((s) => s.threads.threadIds);
1887
- return /* @__PURE__ */ jsx22(Fragment4, { children: indices.map((index) => {
1959
+ return /* @__PURE__ */ jsx23(Fragment4, { children: indices.map((index) => {
1888
1960
  const key = threadIds[index] ?? String(index);
1889
- return /* @__PURE__ */ jsx22(ThreadListItemByIndexProvider, { index, archived: false, children: /* @__PURE__ */ jsx22(ThreadListItemRow, { onThreadOpen, canDeleteSession }) }, key);
1961
+ return /* @__PURE__ */ jsx23(ThreadListItemByIndexProvider, { index, archived: false, children: /* @__PURE__ */ jsx23(ThreadListItemRow, { onThreadOpen, canDeleteSession }) }, key);
1890
1962
  }) });
1891
1963
  }
1892
1964
  var THREAD_LIST_VIEWPORT_SLOT = "aui_thread-list-viewport";
@@ -1905,8 +1977,8 @@ function ChatHistorySection({ children, viewportRef }) {
1905
1977
  className: "flex min-w-0 flex-1 items-center gap-1 rounded-md px-1.5 py-1 text-left text-sm font-medium text-text-secondary hover:bg-ghost-button-hover hover:text-text-primary",
1906
1978
  onClick: () => setExpanded((v) => !v),
1907
1979
  children: [
1908
- /* @__PURE__ */ jsx22("span", { className: "truncate", children: "Chat History" }),
1909
- /* @__PURE__ */ jsx22(
1980
+ /* @__PURE__ */ jsx23("span", { className: "truncate", children: "Chat History" }),
1981
+ /* @__PURE__ */ jsx23(
1910
1982
  Icon,
1911
1983
  {
1912
1984
  name: "chevron-down",
@@ -1916,9 +1988,9 @@ function ChatHistorySection({ children, viewportRef }) {
1916
1988
  ]
1917
1989
  }
1918
1990
  ),
1919
- showFilter ? /* @__PURE__ */ jsx22(AgentHistoryFilterButton, {}) : null
1991
+ showFilter ? /* @__PURE__ */ jsx23(AgentHistoryFilterButton, {}) : null
1920
1992
  ] }),
1921
- expanded ? /* @__PURE__ */ jsx22(
1993
+ expanded ? /* @__PURE__ */ jsx23(
1922
1994
  "div",
1923
1995
  {
1924
1996
  ref: viewportRef,
@@ -1990,20 +2062,20 @@ function ThreadListContainer({ onThreadOpen } = {}) {
1990
2062
  };
1991
2063
  let listBody;
1992
2064
  if (isIdle) {
1993
- listBody = /* @__PURE__ */ jsx22(ThreadListEmptyState, {});
2065
+ listBody = /* @__PURE__ */ jsx23(ThreadListEmptyState, {});
1994
2066
  } else if (isLoading) {
1995
- listBody = /* @__PURE__ */ jsx22(ThreadListRowSkeleton, {});
2067
+ listBody = /* @__PURE__ */ jsx23(ThreadListRowSkeleton, {});
1996
2068
  } else if (threadIds.length === 0) {
1997
- listBody = /* @__PURE__ */ jsx22(ThreadListEmptyState, {});
2069
+ listBody = /* @__PURE__ */ jsx23(ThreadListEmptyState, {});
1998
2070
  } else {
1999
- listBody = /* @__PURE__ */ jsx22(ThreadListPrimitive.Root, { className: "flex min-h-0 flex-col gap-0.5", children: /* @__PURE__ */ jsx22(ThreadListItemsByRecency, { onThreadOpen, canDeleteSession }) });
2071
+ listBody = /* @__PURE__ */ jsx23(ThreadListPrimitive.Root, { className: "flex min-h-0 flex-col gap-0.5", children: /* @__PURE__ */ jsx23(ThreadListItemsByRecency, { onThreadOpen, canDeleteSession }) });
2000
2072
  }
2001
- return /* @__PURE__ */ jsx22(
2073
+ return /* @__PURE__ */ jsx23(
2002
2074
  ThreadListShell,
2003
2075
  {
2004
2076
  header: /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1", children: [
2005
- showNewChat ? /* @__PURE__ */ jsx22(ThreadListNewButton, { onClick: handleNewChat }) : null,
2006
- /* @__PURE__ */ jsx22(
2077
+ showNewChat ? /* @__PURE__ */ jsx23(ThreadListNewButton, { onClick: handleNewChat }) : null,
2078
+ /* @__PURE__ */ jsx23(
2007
2079
  AgentsLibraryButton,
2008
2080
  {
2009
2081
  onSelectAgent: () => {
@@ -2014,7 +2086,7 @@ function ThreadListContainer({ onThreadOpen } = {}) {
2014
2086
  ] }),
2015
2087
  children: /* @__PURE__ */ jsxs6(ChatHistorySection, { viewportRef, children: [
2016
2088
  listBody,
2017
- !isIdle && hasMore ? /* @__PURE__ */ jsx22("div", { className: "h-4 shrink-0", "aria-hidden": true }) : null
2089
+ !isIdle && hasMore ? /* @__PURE__ */ jsx23("div", { className: "h-4 shrink-0", "aria-hidden": true }) : null
2018
2090
  ] })
2019
2091
  }
2020
2092
  );
@@ -2035,6 +2107,7 @@ export {
2035
2107
  ComposerAttachmentPickerContainer,
2036
2108
  threadHasPendingMcpAuth,
2037
2109
  useComposerPauseView,
2110
+ CustomActionContainer,
2038
2111
  McpAuthContainer,
2039
2112
  ComposerContainer,
2040
2113
  HistoryLoaderContainer,
@@ -2045,4 +2118,4 @@ export {
2045
2118
  Thread,
2046
2119
  ThreadListContainer
2047
2120
  };
2048
- //# sourceMappingURL=chunk-HVSUPYX2.js.map
2121
+ //# sourceMappingURL=chunk-3S6KHO7H.js.map