@dxos/plugin-automation 0.7.5-labs.071a3e2 → 0.7.5-labs.8a82073

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 (104) hide show
  1. package/dist/lib/browser/{AutomationPanel-YPD3AGQN.mjs → AutomationPanel-CL2TWZT5.mjs} +2 -2
  2. package/dist/lib/browser/{ChatContainer-ODZECATM.mjs → ChatContainer-EJ3IWL7Y.mjs} +2 -2
  3. package/dist/lib/browser/{chunk-PQGFC2ZO.mjs → chunk-4M74P6YW.mjs} +4 -4
  4. package/dist/lib/browser/{chunk-Z54KIF6H.mjs → chunk-6KJRL5KV.mjs} +2 -1
  5. package/dist/lib/browser/{chunk-Z54KIF6H.mjs.map → chunk-6KJRL5KV.mjs.map} +2 -2
  6. package/dist/lib/browser/{chunk-DL7XA62G.mjs → chunk-N4SSCQ7P.mjs} +218 -147
  7. package/dist/lib/browser/{chunk-DL7XA62G.mjs.map → chunk-N4SSCQ7P.mjs.map} +4 -4
  8. package/dist/lib/browser/index.mjs +9 -8
  9. package/dist/lib/browser/index.mjs.map +3 -3
  10. package/dist/lib/browser/meta.json +1 -1
  11. package/dist/lib/browser/{react-surface-WRHRCEV5.mjs → react-surface-RRTZFTKR.mjs} +4 -4
  12. package/dist/lib/node/{AutomationPanel-CO26O75P.cjs → AutomationPanel-BCEY3YXO.cjs} +6 -6
  13. package/dist/lib/node/{AutomationPanel-CO26O75P.cjs.map → AutomationPanel-BCEY3YXO.cjs.map} +2 -2
  14. package/dist/lib/node/{ChatContainer-5URBEXQD.cjs → ChatContainer-QUWFEBTI.cjs} +7 -7
  15. package/dist/lib/node/{ChatContainer-5URBEXQD.cjs.map → ChatContainer-QUWFEBTI.cjs.map} +2 -2
  16. package/dist/lib/node/{chunk-NH7STAX6.cjs → chunk-DKGNORZK.cjs} +230 -159
  17. package/dist/lib/node/chunk-DKGNORZK.cjs.map +7 -0
  18. package/dist/lib/node/{chunk-OCW5GAVZ.cjs → chunk-IPCNJYQL.cjs} +5 -4
  19. package/dist/lib/node/{chunk-OCW5GAVZ.cjs.map → chunk-IPCNJYQL.cjs.map} +2 -2
  20. package/dist/lib/node/{chunk-D2QQXWOY.cjs → chunk-LC6KNDPQ.cjs} +8 -8
  21. package/dist/lib/node/index.cjs +19 -18
  22. package/dist/lib/node/index.cjs.map +3 -3
  23. package/dist/lib/node/meta.json +1 -1
  24. package/dist/lib/node/{react-surface-HDAVE6NU.cjs → react-surface-BVZ63QP4.cjs} +10 -10
  25. package/dist/lib/node-esm/{AutomationPanel-VQZUKPK2.mjs → AutomationPanel-YTIZ74RI.mjs} +2 -2
  26. package/dist/lib/node-esm/{ChatContainer-23QIVDG5.mjs → ChatContainer-QSMDZRDU.mjs} +2 -2
  27. package/dist/lib/node-esm/{chunk-VN2AFV25.mjs → chunk-CQPQXIJP.mjs} +4 -4
  28. package/dist/lib/node-esm/{chunk-NSVQZ3EH.mjs → chunk-CZXU4CFK.mjs} +2 -1
  29. package/dist/lib/node-esm/{chunk-NSVQZ3EH.mjs.map → chunk-CZXU4CFK.mjs.map} +2 -2
  30. package/dist/lib/node-esm/{chunk-JJFWFS6P.mjs → chunk-D7RARVTS.mjs} +218 -147
  31. package/dist/lib/node-esm/{chunk-JJFWFS6P.mjs.map → chunk-D7RARVTS.mjs.map} +4 -4
  32. package/dist/lib/node-esm/index.mjs +9 -8
  33. package/dist/lib/node-esm/index.mjs.map +3 -3
  34. package/dist/lib/node-esm/meta.json +1 -1
  35. package/dist/lib/node-esm/{react-surface-FZ5OFRDE.mjs → react-surface-Y5LQHUQN.mjs} +4 -4
  36. package/dist/types/src/components/Box/StatusLine.d.ts.map +1 -0
  37. package/dist/types/src/components/Box/StatusLine.stories.d.ts.map +1 -0
  38. package/dist/types/src/components/Box/Tabbed.d.ts +15 -0
  39. package/dist/types/src/components/Box/Tabbed.d.ts.map +1 -0
  40. package/dist/types/src/components/Box/Tabbed.stories.d.ts.map +1 -0
  41. package/dist/types/src/components/{Thread → Box}/ToggleContainer.d.ts +3 -3
  42. package/dist/types/src/components/Box/ToggleContainer.d.ts.map +1 -0
  43. package/dist/types/src/components/Box/ToggleContainer.stories.d.ts.map +1 -0
  44. package/dist/types/src/components/Box/index.d.ts +4 -0
  45. package/dist/types/src/components/Box/index.d.ts.map +1 -0
  46. package/dist/types/src/components/Prompt/Prompt.d.ts +7 -0
  47. package/dist/types/src/components/Prompt/Prompt.d.ts.map +1 -0
  48. package/dist/types/src/components/Prompt/Prompt.stories.d.ts +8 -0
  49. package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +1 -0
  50. package/dist/types/src/components/Prompt/index.d.ts +2 -0
  51. package/dist/types/src/components/Prompt/index.d.ts.map +1 -0
  52. package/dist/types/src/components/Prompt/prompt-autocomplete.d.ts +20 -0
  53. package/dist/types/src/components/Prompt/prompt-autocomplete.d.ts.map +1 -0
  54. package/dist/types/src/components/Thread/Thread.stories.d.ts +1 -0
  55. package/dist/types/src/components/Thread/Thread.stories.d.ts.map +1 -1
  56. package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +1 -1
  57. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  58. package/dist/types/src/translations.d.ts +3 -0
  59. package/dist/types/src/translations.d.ts.map +1 -1
  60. package/package.json +52 -50
  61. package/src/AutomationPlugin.tsx +5 -5
  62. package/src/components/{Thread → Box}/Tabbed.stories.tsx +1 -2
  63. package/src/components/Box/Tabbed.tsx +89 -0
  64. package/src/components/{Thread → Box}/ToggleContainer.stories.tsx +0 -1
  65. package/src/components/{Thread → Box}/ToggleContainer.tsx +28 -23
  66. package/src/components/Box/index.ts +7 -0
  67. package/src/components/Prompt/Prompt.stories.tsx +50 -0
  68. package/src/components/Prompt/Prompt.tsx +36 -0
  69. package/src/components/Prompt/index.ts +5 -0
  70. package/src/components/Prompt/prompt-autocomplete.ts +200 -0
  71. package/src/components/PromptEditor/PromptEditor.stories.tsx +3 -3
  72. package/src/components/Thread/Thread.stories.tsx +8 -1
  73. package/src/components/Thread/Thread.tsx +1 -1
  74. package/src/components/Thread/ThreadMessage.tsx +41 -19
  75. package/src/components/TriggerEditor/TriggerEditor.tsx +6 -1
  76. package/src/translations.ts +1 -0
  77. package/dist/lib/node/chunk-NH7STAX6.cjs.map +0 -7
  78. package/dist/types/src/components/Thread/ScrollContainer.d.ts +0 -15
  79. package/dist/types/src/components/Thread/ScrollContainer.d.ts.map +0 -1
  80. package/dist/types/src/components/Thread/StatusLine.d.ts.map +0 -1
  81. package/dist/types/src/components/Thread/StatusLine.stories.d.ts.map +0 -1
  82. package/dist/types/src/components/Thread/Tabbed.d.ts +0 -9
  83. package/dist/types/src/components/Thread/Tabbed.d.ts.map +0 -1
  84. package/dist/types/src/components/Thread/Tabbed.stories.d.ts.map +0 -1
  85. package/dist/types/src/components/Thread/ToggleContainer.d.ts.map +0 -1
  86. package/dist/types/src/components/Thread/ToggleContainer.stories.d.ts.map +0 -1
  87. package/src/components/Thread/ScrollContainer.tsx +0 -92
  88. package/src/components/Thread/Tabbed.tsx +0 -72
  89. /package/dist/lib/browser/{AutomationPanel-YPD3AGQN.mjs.map → AutomationPanel-CL2TWZT5.mjs.map} +0 -0
  90. /package/dist/lib/browser/{ChatContainer-ODZECATM.mjs.map → ChatContainer-EJ3IWL7Y.mjs.map} +0 -0
  91. /package/dist/lib/browser/{chunk-PQGFC2ZO.mjs.map → chunk-4M74P6YW.mjs.map} +0 -0
  92. /package/dist/lib/browser/{react-surface-WRHRCEV5.mjs.map → react-surface-RRTZFTKR.mjs.map} +0 -0
  93. /package/dist/lib/node/{chunk-D2QQXWOY.cjs.map → chunk-LC6KNDPQ.cjs.map} +0 -0
  94. /package/dist/lib/node/{react-surface-HDAVE6NU.cjs.map → react-surface-BVZ63QP4.cjs.map} +0 -0
  95. /package/dist/lib/node-esm/{AutomationPanel-VQZUKPK2.mjs.map → AutomationPanel-YTIZ74RI.mjs.map} +0 -0
  96. /package/dist/lib/node-esm/{ChatContainer-23QIVDG5.mjs.map → ChatContainer-QSMDZRDU.mjs.map} +0 -0
  97. /package/dist/lib/node-esm/{chunk-VN2AFV25.mjs.map → chunk-CQPQXIJP.mjs.map} +0 -0
  98. /package/dist/lib/node-esm/{react-surface-FZ5OFRDE.mjs.map → react-surface-Y5LQHUQN.mjs.map} +0 -0
  99. /package/dist/types/src/components/{Thread → Box}/StatusLine.d.ts +0 -0
  100. /package/dist/types/src/components/{Thread → Box}/StatusLine.stories.d.ts +0 -0
  101. /package/dist/types/src/components/{Thread → Box}/Tabbed.stories.d.ts +0 -0
  102. /package/dist/types/src/components/{Thread → Box}/ToggleContainer.stories.d.ts +0 -0
  103. /package/src/components/{Thread → Box}/StatusLine.stories.tsx +0 -0
  104. /package/src/components/{Thread → Box}/StatusLine.tsx +0 -0
@@ -10,8 +10,8 @@ import {
10
10
  } from "./chunk-DQ7ZSYJJ.mjs";
11
11
 
12
12
  // packages/plugins/experimental/plugin-automation/src/components/ChatContainer/ChatContainer.tsx
13
- import React7, { useCallback as useCallback3 } from "react";
14
- import { invariant as invariant7 } from "@dxos/invariant";
13
+ import React7, { useCallback as useCallback2 } from "react";
14
+ import { invariant as invariant6 } from "@dxos/invariant";
15
15
  import { StackItem } from "@dxos/react-ui-stack";
16
16
 
17
17
  // packages/plugins/experimental/plugin-automation/src/hooks/processor.ts
@@ -245,7 +245,7 @@ import { lazy } from "@dxos/app-framework";
245
245
  var AiClient = lazy(() => import("./ai-client-UJLNYP7B.mjs"));
246
246
  var AppGraphBuilder = lazy(() => import("./app-graph-builder-3H5TCRG4.mjs"));
247
247
  var IntentResolver = lazy(() => import("./intent-resolver-5YVZJFS3.mjs"));
248
- var ReactSurface = lazy(() => import("./react-surface-WRHRCEV5.mjs"));
248
+ var ReactSurface = lazy(() => import("./react-surface-RRTZFTKR.mjs"));
249
249
 
250
250
  // packages/plugins/experimental/plugin-automation/src/tools/function.ts
251
251
  import { defineTool, ToolResult } from "@dxos/artifact";
@@ -914,103 +914,34 @@ var useServices = (space, query) => {
914
914
  };
915
915
 
916
916
  // packages/plugins/experimental/plugin-automation/src/components/Thread/Thread.tsx
917
- import React6, { useCallback as useCallback2, useMemo as useMemo4, useRef as useRef3, useState as useState7 } from "react";
917
+ import React6, { useCallback, useMemo as useMemo4, useRef as useRef3, useState as useState7 } from "react";
918
918
  import { IconButton, Input, useTranslation } from "@dxos/react-ui";
919
+ import { ScrollContainer } from "@dxos/react-ui-components";
919
920
  import { Spinner } from "@dxos/react-ui-sfx";
920
921
  import { mx as mx6 } from "@dxos/react-ui-theme";
921
922
 
922
- // packages/plugins/experimental/plugin-automation/src/components/Thread/ScrollContainer.tsx
923
- import React, { forwardRef, useCallback, useEffect as useEffect4, useImperativeHandle, useRef, useState as useState4 } from "react";
924
- import { invariant as invariant5 } from "@dxos/invariant";
925
- import { mx } from "@dxos/react-ui-theme";
926
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/components/Thread/ScrollContainer.tsx";
927
- var ScrollContainer = /* @__PURE__ */ forwardRef(({ children, classNames }, forwardedRef) => {
928
- const containerRef = useRef(null);
929
- const autoScrollRef = useRef(false);
930
- useImperativeHandle(forwardedRef, () => ({
931
- scrollToBottom: () => {
932
- invariant5(containerRef.current, void 0, {
933
- F: __dxlog_file4,
934
- L: 41,
935
- S: void 0,
936
- A: [
937
- "containerRef.current",
938
- ""
939
- ]
940
- });
941
- containerRef.current.scrollTo({
942
- top: containerRef.current.scrollHeight,
943
- behavior: "smooth"
944
- });
945
- autoScrollRef.current = false;
946
- }
947
- }), []);
948
- const [sticky, setSticky] = useState4(true);
949
- useEffect4(() => {
950
- if (!sticky || !containerRef.current) {
951
- return;
952
- }
953
- autoScrollRef.current = true;
954
- containerRef.current.scrollTo({
955
- top: containerRef.current.scrollHeight,
956
- behavior: "smooth"
957
- });
958
- }, [
959
- children
960
- ]);
961
- useEffect4(() => {
962
- invariant5(containerRef.current, void 0, {
963
- F: __dxlog_file4,
964
- L: 62,
965
- S: void 0,
966
- A: [
967
- "containerRef.current",
968
- ""
969
- ]
970
- });
971
- const handleScrollEnd = () => {
972
- autoScrollRef.current = false;
973
- };
974
- containerRef.current.addEventListener("scrollend", handleScrollEnd);
975
- return () => containerRef.current?.removeEventListener("scrollend", handleScrollEnd);
976
- }, []);
977
- const handleScroll = useCallback((ev) => {
978
- if (autoScrollRef.current) {
979
- return;
980
- }
981
- const { scrollTop, clientHeight, scrollHeight } = ev.currentTarget;
982
- const sticky2 = scrollTop + clientHeight >= scrollHeight;
983
- setSticky(sticky2);
984
- }, []);
985
- return /* @__PURE__ */ React.createElement("div", {
986
- ref: containerRef,
987
- onScroll: handleScroll,
988
- className: mx("flex flex-col grow overflow-y-scroll scrollbar-none", classNames)
989
- }, children);
990
- });
991
-
992
923
  // packages/plugins/experimental/plugin-automation/src/components/Thread/ThreadMessage.tsx
993
- import React5 from "react";
994
- import { invariant as invariant6 } from "@dxos/invariant";
924
+ import React5, { useEffect as useEffect6, useRef as useRef2, useState as useState6 } from "react";
925
+ import { invariant as invariant5 } from "@dxos/invariant";
995
926
  import { log as log6 } from "@dxos/log";
996
- import { Button, ButtonGroup, Icon as Icon2 } from "@dxos/react-ui";
927
+ import { Button, ButtonGroup, Icon as Icon3 } from "@dxos/react-ui";
997
928
  import { Json } from "@dxos/react-ui-syntax-highlighter";
998
929
  import { mx as mx5 } from "@dxos/react-ui-theme";
999
930
  import { safeParseJson } from "@dxos/util";
1000
931
 
1001
- // packages/plugins/experimental/plugin-automation/src/components/Thread/StatusLine.tsx
1002
- import React2, { useEffect as useEffect5, useRef as useRef2, useState as useState5 } from "react";
1003
- import { mx as mx2 } from "@dxos/react-ui-theme";
932
+ // packages/plugins/experimental/plugin-automation/src/components/Box/StatusLine.tsx
933
+ import React, { useEffect as useEffect4, useRef, useState as useState4 } from "react";
934
+ import { mx } from "@dxos/react-ui-theme";
1004
935
  var emptyLines = [];
1005
936
  var StatusLine = ({ classNames, line = -1, lines = emptyLines, transition = 300, advance = 1e3, autoAdvance }) => {
1006
- const containerRef = useRef2(null);
1007
- const [currentLine, setCurrentLine] = useState5(line);
1008
- useEffect5(() => {
937
+ const containerRef = useRef(null);
938
+ const [currentLine, setCurrentLine] = useState4(line);
939
+ useEffect4(() => {
1009
940
  setCurrentLine(line);
1010
941
  }, [
1011
942
  line
1012
943
  ]);
1013
- useEffect5(() => {
944
+ useEffect4(() => {
1014
945
  if (!autoAdvance) {
1015
946
  return;
1016
947
  }
@@ -1031,7 +962,7 @@ var StatusLine = ({ classNames, line = -1, lines = emptyLines, transition = 300,
1031
962
  autoAdvance,
1032
963
  advance
1033
964
  ]);
1034
- useEffect5(() => {
965
+ useEffect4(() => {
1035
966
  if (containerRef.current) {
1036
967
  containerRef.current.style.transition = `transform ${transition}ms ease-in-out`;
1037
968
  containerRef.current.style.transform = `translateY(-${currentLine * 24}px)`;
@@ -1039,32 +970,128 @@ var StatusLine = ({ classNames, line = -1, lines = emptyLines, transition = 300,
1039
970
  }, [
1040
971
  currentLine
1041
972
  ]);
1042
- return /* @__PURE__ */ React2.createElement("div", {
1043
- className: mx2("relative h-[24px] overflow-hidden", classNames)
1044
- }, /* @__PURE__ */ React2.createElement("div", {
973
+ return /* @__PURE__ */ React.createElement("div", {
974
+ className: mx("relative h-[24px] overflow-hidden", classNames)
975
+ }, /* @__PURE__ */ React.createElement("div", {
1045
976
  ref: containerRef,
1046
977
  className: "h-[24px]"
1047
- }, /* @__PURE__ */ React2.createElement("div", {
978
+ }, /* @__PURE__ */ React.createElement("div", {
1048
979
  className: "flex flex-col"
1049
- }, lines.map((line2, i) => /* @__PURE__ */ React2.createElement("div", {
980
+ }, lines.map((line2, i) => /* @__PURE__ */ React.createElement("div", {
1050
981
  key: i,
1051
- className: mx2("flex h-[24px] items-center")
1052
- }, /* @__PURE__ */ React2.createElement("span", {
982
+ className: mx("flex h-[24px] items-center")
983
+ }, /* @__PURE__ */ React.createElement("span", {
1053
984
  className: "truncate"
1054
985
  }, line2))))));
1055
986
  };
1056
987
 
1057
- // packages/plugins/experimental/plugin-automation/src/components/Thread/ToggleContainer.tsx
1058
- import React3, { useEffect as useEffect6, useState as useState6 } from "react";
988
+ // packages/plugins/experimental/plugin-automation/src/components/Box/Tabbed.tsx
989
+ import React2, { forwardRef } from "react";
1059
990
  import { Icon } from "@dxos/react-ui";
991
+ import { mx as mx2 } from "@dxos/react-ui-theme";
992
+ var numbers = [
993
+ {
994
+ regular: "ph--number-circle-zero--thin",
995
+ active: "ph--number-circle-zero--duotone"
996
+ },
997
+ {
998
+ regular: "ph--number-circle-one--thin",
999
+ active: "ph--number-circle-one--duotone"
1000
+ },
1001
+ {
1002
+ regular: "ph--number-circle-two--thin",
1003
+ active: "ph--number-circle-two--duotone"
1004
+ },
1005
+ {
1006
+ regular: "ph--number-circle-three--thin",
1007
+ active: "ph--number-circle-three--duotone"
1008
+ },
1009
+ {
1010
+ regular: "ph--number-circle-four--thin",
1011
+ active: "ph--number-circle-four--duotone"
1012
+ },
1013
+ {
1014
+ regular: "ph--number-circle-five--thin",
1015
+ active: "ph--number-circle-five--duotone"
1016
+ },
1017
+ {
1018
+ regular: "ph--number-circle-six--thin",
1019
+ active: "ph--number-circle-six--duotone"
1020
+ },
1021
+ {
1022
+ regular: "ph--number-circle-seven--thin",
1023
+ active: "ph--number-circle-seven--duotone"
1024
+ },
1025
+ {
1026
+ regular: "ph--number-circle-eight--thin",
1027
+ active: "ph--number-circle-eight--duotone"
1028
+ },
1029
+ {
1030
+ regular: "ph--number-circle-nine--thin",
1031
+ active: "ph--number-circle-nine--duotone"
1032
+ }
1033
+ ];
1034
+ var Tabs = /* @__PURE__ */ forwardRef(({ classNames, length, selected = 0, onSelect }, forwardedRef) => {
1035
+ return /* @__PURE__ */ React2.createElement("div", {
1036
+ ref: forwardedRef,
1037
+ className: mx2("flex flex-col overflow-hidden outline-none", classNames),
1038
+ tabIndex: -1,
1039
+ onKeyDown: (ev) => {
1040
+ switch (ev.key) {
1041
+ case "ArrowDown":
1042
+ case "ArrowRight": {
1043
+ ev.preventDefault();
1044
+ ev.stopPropagation();
1045
+ if (selected < length - 1) {
1046
+ onSelect?.(selected + 1);
1047
+ }
1048
+ break;
1049
+ }
1050
+ case "ArrowUp":
1051
+ case "ArrowLeft": {
1052
+ ev.preventDefault();
1053
+ ev.stopPropagation();
1054
+ if (selected > 0) {
1055
+ onSelect?.(selected - 1);
1056
+ }
1057
+ break;
1058
+ }
1059
+ case "Enter": {
1060
+ ev.preventDefault();
1061
+ ev.stopPropagation();
1062
+ onSelect?.(selected);
1063
+ break;
1064
+ }
1065
+ }
1066
+ }
1067
+ }, Array.from({
1068
+ length
1069
+ }).map((_, i) => {
1070
+ const icon = numbers[i + 1];
1071
+ return /* @__PURE__ */ React2.createElement("div", {
1072
+ key: i,
1073
+ className: mx2("relative flex w-[24px] h-[28px] justify-center cursor-pointer text-subdued", selected === i && "!text-cyan-550 !dark:text-cyan-300")
1074
+ }, i < length - 1 && /* @__PURE__ */ React2.createElement("div", {
1075
+ className: "absolute left-[11.5px] top-[21px] w-[1px] h-[10px] bg-neutral-400"
1076
+ }), /* @__PURE__ */ React2.createElement(Icon, {
1077
+ icon: selected === i ? icon.regular : icon.regular,
1078
+ classNames: "z-10 !p-0 !w-[24px] !h-[24px] outline-none",
1079
+ onClick: () => onSelect?.(i)
1080
+ }));
1081
+ }));
1082
+ });
1083
+
1084
+ // packages/plugins/experimental/plugin-automation/src/components/Box/ToggleContainer.tsx
1085
+ import React3, { useEffect as useEffect5, useState as useState5 } from "react";
1086
+ import { Icon as Icon2, useControlledState } from "@dxos/react-ui";
1060
1087
  import { mx as mx3 } from "@dxos/react-ui-theme";
1061
- var ToggleContainer = ({ title, icon, toggle, defaultOpen, duration = 400, shrinkX = false, children, classNames }) => {
1062
- const [expand, setExpand] = useState6(defaultOpen || !toggle);
1063
- const [expandX, setExpandX] = useState6(shrinkX ? expand : true);
1064
- const [expandY, setExpandY] = useState6(expand);
1065
- useEffect6(() => {
1088
+ var ToggleContainer = ({ classNames, title, icon, open: _open, duration = 400, shrinkX = false, children, onChangeOpen }) => {
1089
+ const [open, setOpen] = useControlledState(_open);
1090
+ const [expandX, setExpandX] = useState5(shrinkX ? open : true);
1091
+ const [expandY, setExpandY] = useState5(open);
1092
+ useEffect5(() => {
1066
1093
  let t;
1067
- if (expand) {
1094
+ if (open) {
1068
1095
  if (shrinkX) {
1069
1096
  setExpandX(true);
1070
1097
  }
@@ -1081,16 +1108,23 @@ var ToggleContainer = ({ title, icon, toggle, defaultOpen, duration = 400, shrin
1081
1108
  }
1082
1109
  return () => clearTimeout(t);
1083
1110
  }, [
1084
- expand
1111
+ open
1085
1112
  ]);
1113
+ const handleToggle = () => {
1114
+ if (onChangeOpen) {
1115
+ onChangeOpen(!open);
1116
+ } else {
1117
+ setOpen((open2) => !open2);
1118
+ }
1119
+ };
1086
1120
  return /* @__PURE__ */ React3.createElement("div", {
1087
1121
  className: mx3("overflow-hidden", classNames)
1088
1122
  }, title && /* @__PURE__ */ React3.createElement("div", {
1089
1123
  className: "flex gap-1 py-1 items-center text-sm text-subdued cursor-pointer select-none",
1090
- onClick: toggle ? () => setExpand((open) => !open) : void 0
1091
- }, toggle && /* @__PURE__ */ React3.createElement("div", {
1124
+ onClick: handleToggle
1125
+ }, /* @__PURE__ */ React3.createElement("div", {
1092
1126
  className: "flex w-[24px] h-[24px] items-center justify-center"
1093
- }, /* @__PURE__ */ React3.createElement(Icon, {
1127
+ }, /* @__PURE__ */ React3.createElement(Icon2, {
1094
1128
  size: 4,
1095
1129
  icon: "ph--caret-right--regular",
1096
1130
  style: {
@@ -1098,7 +1132,7 @@ var ToggleContainer = ({ title, icon, toggle, defaultOpen, duration = 400, shrin
1098
1132
  },
1099
1133
  classNames: [
1100
1134
  "transition transition-transform ease-in-out",
1101
- expand ? "rotate-90" : "transform-none"
1135
+ open ? "rotate-90" : "transform-none"
1102
1136
  ]
1103
1137
  })), /* @__PURE__ */ React3.createElement("div", {
1104
1138
  className: "flex-1 pis-1 pie-1 truncate"
@@ -1172,7 +1206,7 @@ var MarkdownViewer = ({ classNames, content = "" }) => {
1172
1206
  };
1173
1207
 
1174
1208
  // packages/plugins/experimental/plugin-automation/src/components/Thread/ThreadMessage.tsx
1175
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/components/Thread/ThreadMessage.tsx";
1209
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/components/Thread/ThreadMessage.tsx";
1176
1210
  var ThreadMessage = ({ classNames, message, collapse, debug, onSuggest, onDelete }) => {
1177
1211
  if (typeof message !== "object") {
1178
1212
  return /* @__PURE__ */ React5.createElement("div", {
@@ -1183,32 +1217,41 @@ var ThreadMessage = ({ classNames, message, collapse, debug, onSuggest, onDelete
1183
1217
  const toolBlocks = content.filter((block) => block.type === "tool_use" || block.type === "tool_result");
1184
1218
  if (collapse && toolBlocks.length > 0) {
1185
1219
  let request;
1186
- const json = [];
1187
- const lines = toolBlocks.map((block) => {
1220
+ const items = toolBlocks.map((block) => {
1188
1221
  switch (block.type) {
1189
1222
  case "tool_use": {
1190
1223
  request = block;
1191
- json.push(block);
1192
- return `Calling ${block.name}...`;
1224
+ return {
1225
+ title: `Calling ${block.name}...`,
1226
+ block
1227
+ };
1193
1228
  }
1194
1229
  case "tool_result": {
1195
1230
  if (!request) {
1196
1231
  log6.warn("unexpected message", {
1197
- tool: block
1232
+ block
1198
1233
  }, {
1199
- F: __dxlog_file5,
1200
- L: 57,
1234
+ F: __dxlog_file4,
1235
+ L: 54,
1201
1236
  S: void 0,
1202
1237
  C: (f, a) => f(...a)
1203
1238
  });
1204
- return "Error";
1239
+ return {
1240
+ title: "Error",
1241
+ block
1242
+ };
1205
1243
  }
1206
- json.push(block);
1207
- return `Processed ${request.name}`;
1244
+ return {
1245
+ title: `Processed ${request.name}`,
1246
+ block
1247
+ };
1208
1248
  }
1209
1249
  default: {
1210
1250
  request = void 0;
1211
- return "Error";
1251
+ return {
1252
+ title: "Error",
1253
+ block
1254
+ };
1212
1255
  }
1213
1256
  }
1214
1257
  });
@@ -1216,16 +1259,9 @@ var ThreadMessage = ({ classNames, message, collapse, debug, onSuggest, onDelete
1216
1259
  className: mx5("flex", classNames)
1217
1260
  }, /* @__PURE__ */ React5.createElement("div", {
1218
1261
  className: "w-full p-1 px-2 overflow-hidden rounded-md bg-baseSurface"
1219
- }, /* @__PURE__ */ React5.createElement(ToggleContainer, {
1220
- title: /* @__PURE__ */ React5.createElement(StatusLine, {
1221
- lines,
1222
- autoAdvance: true
1223
- }),
1224
- toggle: true
1225
- }, /* @__PURE__ */ React5.createElement(Json, {
1226
- data: json,
1227
- classNames: "!p-1 text-xs"
1228
- }))));
1262
+ }, /* @__PURE__ */ React5.createElement(TabbedContainer, {
1263
+ items
1264
+ })));
1229
1265
  }
1230
1266
  return /* @__PURE__ */ React5.createElement("div", {
1231
1267
  className: mx5("flex flex-col shrink-0 gap-2")
@@ -1261,9 +1297,9 @@ var titles = {
1261
1297
  };
1262
1298
  var componentMap = {
1263
1299
  text: ({ block }) => {
1264
- invariant6(block.type === "text", void 0, {
1265
- F: __dxlog_file5,
1266
- L: 134,
1300
+ invariant5(block.type === "text", void 0, {
1301
+ F: __dxlog_file4,
1302
+ L: 128,
1267
1303
  S: void 0,
1268
1304
  A: [
1269
1305
  "block.type === 'text'",
@@ -1281,13 +1317,12 @@ var componentMap = {
1281
1317
  }
1282
1318
  return /* @__PURE__ */ React5.createElement(ToggleContainer, {
1283
1319
  title,
1284
- icon: block.pending ? /* @__PURE__ */ React5.createElement(Icon2, {
1320
+ icon: block.pending ? /* @__PURE__ */ React5.createElement(Icon3, {
1285
1321
  icon: "ph--circle-notch--regular",
1286
1322
  classNames: "text-subdued ml-2 animate-spin",
1287
1323
  size: 4
1288
1324
  }) : void 0,
1289
- defaultOpen: block.disposition === "cot",
1290
- toggle: true
1325
+ open: block.disposition === "cot"
1291
1326
  }, /* @__PURE__ */ React5.createElement(MarkdownViewer, {
1292
1327
  content: block.text,
1293
1328
  classNames: [
@@ -1296,9 +1331,9 @@ var componentMap = {
1296
1331
  }));
1297
1332
  },
1298
1333
  json: ({ block, onSuggest }) => {
1299
- invariant6(block.type === "json", void 0, {
1300
- F: __dxlog_file5,
1301
- L: 159,
1334
+ invariant5(block.type === "json", void 0, {
1335
+ F: __dxlog_file4,
1336
+ L: 152,
1302
1337
  S: void 0,
1303
1338
  A: [
1304
1339
  "block.type === 'json'",
@@ -1322,8 +1357,7 @@ var componentMap = {
1322
1357
  default: {
1323
1358
  const title = block.disposition ? titles[block.disposition] : void 0;
1324
1359
  return /* @__PURE__ */ React5.createElement(ToggleContainer, {
1325
- title: title ?? "JSON",
1326
- toggle: true
1360
+ title: title ?? "JSON"
1327
1361
  }, /* @__PURE__ */ React5.createElement(Json, {
1328
1362
  data: safeParseJson(block.json ?? block),
1329
1363
  classNames: "!p-1 text-xs"
@@ -1337,21 +1371,58 @@ var componentMap = {
1337
1371
  title = `Tool [${block.name}]`;
1338
1372
  }
1339
1373
  return /* @__PURE__ */ React5.createElement(ToggleContainer, {
1340
- title: title ?? "JSON",
1341
- toggle: true
1374
+ title: title ?? "JSON"
1342
1375
  }, /* @__PURE__ */ React5.createElement(Json, {
1343
1376
  data: block,
1344
1377
  classNames: "!p-1 text-xs"
1345
1378
  }));
1346
1379
  }
1347
1380
  };
1381
+ var TabbedContainer = ({ items }) => {
1382
+ const lines = items.map((item) => item.title);
1383
+ const tabsRef = useRef2(null);
1384
+ const [selected, setSelected] = useState6(0);
1385
+ const [open, setOpen] = useState6(false);
1386
+ useEffect6(() => {
1387
+ if (open) {
1388
+ tabsRef.current?.focus();
1389
+ }
1390
+ }, [
1391
+ open
1392
+ ]);
1393
+ const handleSelect = (index) => {
1394
+ if (index === selected) {
1395
+ setOpen(false);
1396
+ } else {
1397
+ setSelected(index);
1398
+ }
1399
+ };
1400
+ return /* @__PURE__ */ React5.createElement(ToggleContainer, {
1401
+ title: /* @__PURE__ */ React5.createElement(StatusLine, {
1402
+ lines,
1403
+ autoAdvance: true
1404
+ }),
1405
+ open,
1406
+ onChangeOpen: setOpen
1407
+ }, /* @__PURE__ */ React5.createElement("div", {
1408
+ className: "flex gap-2 w-full"
1409
+ }, /* @__PURE__ */ React5.createElement(Tabs, {
1410
+ ref: tabsRef,
1411
+ length: items.length,
1412
+ selected,
1413
+ onSelect: handleSelect
1414
+ }), /* @__PURE__ */ React5.createElement(Json, {
1415
+ data: items[selected].block,
1416
+ classNames: "!p-1 text-xs"
1417
+ })));
1418
+ };
1348
1419
 
1349
1420
  // packages/plugins/experimental/plugin-automation/src/components/Thread/Thread.tsx
1350
1421
  var Thread = ({ messages, streaming, collapse, debug, onSubmit, onStop, onSuggest, onDelete }) => {
1351
1422
  const { t } = useTranslation(AUTOMATION_PLUGIN);
1352
1423
  const scroller = useRef3(null);
1353
1424
  const [text, setText] = useState7("");
1354
- const handleKeyDown = useCallback2((ev) => {
1425
+ const handleKeyDown = useCallback((ev) => {
1355
1426
  switch (ev.key) {
1356
1427
  case "Escape": {
1357
1428
  setText("");
@@ -1465,7 +1536,7 @@ var Thread = ({ messages, streaming, collapse, debug, onSubmit, onStop, onSugges
1465
1536
  };
1466
1537
 
1467
1538
  // packages/plugins/experimental/plugin-automation/src/components/ChatContainer/ChatContainer.tsx
1468
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/components/ChatContainer/ChatContainer.tsx";
1539
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/components/ChatContainer/ChatContainer.tsx";
1469
1540
  var ChatContainer = ({ chat, role }) => {
1470
1541
  const processor = useChatProcessor(chat);
1471
1542
  const messageQueue = useMessageQueue(chat);
@@ -1473,12 +1544,12 @@ var ChatContainer = ({ chat, role }) => {
1473
1544
  ...messageQueue?.items ?? [],
1474
1545
  ...processor.messages.value
1475
1546
  ];
1476
- const handleSubmit = useCallback3(async (text) => {
1547
+ const handleSubmit = useCallback2(async (text) => {
1477
1548
  if (processor.streaming.value) {
1478
1549
  await processor.cancel();
1479
1550
  }
1480
- invariant7(messageQueue, void 0, {
1481
- F: __dxlog_file6,
1551
+ invariant6(messageQueue, void 0, {
1552
+ F: __dxlog_file5,
1482
1553
  L: 25,
1483
1554
  S: void 0,
1484
1555
  A: [
@@ -1494,7 +1565,7 @@ var ChatContainer = ({ chat, role }) => {
1494
1565
  processor,
1495
1566
  messageQueue
1496
1567
  ]);
1497
- const handleStop = useCallback3(() => {
1568
+ const handleStop = useCallback2(() => {
1498
1569
  if (processor.streaming.value) {
1499
1570
  void processor.cancel();
1500
1571
  }
@@ -1528,4 +1599,4 @@ export {
1528
1599
  IntentResolver,
1529
1600
  ReactSurface
1530
1601
  };
1531
- //# sourceMappingURL=chunk-DL7XA62G.mjs.map
1602
+ //# sourceMappingURL=chunk-N4SSCQ7P.mjs.map