@mastra/playground-ui 5.1.1-alpha.0 → 5.1.1-alpha.2
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.
- package/dist/index.cjs.js +441 -74
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +439 -76
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/assistant-ui/thread.d.ts +2 -1
- package/dist/src/components/assistant-ui/use-has-attachments.d.ts +1 -0
- package/dist/src/domains/agents/agent/agent-chat.d.ts +1 -1
- package/dist/src/ds/icons/AgentNetworkCoinIcon.d.ts +1 -0
- package/dist/src/ds/icons/McpCoinIcon.d.ts +3 -0
- package/dist/src/ds/icons/ToolCoinIcon.d.ts +3 -0
- package/dist/src/ds/icons/index.d.ts +3 -0
- package/dist/src/hooks/use-speech-recognition.d.ts +15 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/lib/file.d.ts +1 -0
- package/dist/src/types.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -18,6 +18,8 @@ const langJson = require('@codemirror/lang-json');
|
|
|
18
18
|
const highlight$1 = require('@lezer/highlight');
|
|
19
19
|
const codemirrorThemeDracula = require('@uiw/codemirror-theme-dracula');
|
|
20
20
|
const CodeMirror = require('@uiw/react-codemirror');
|
|
21
|
+
const DialogPrimitive = require('@radix-ui/react-dialog');
|
|
22
|
+
const shallow = require('zustand/shallow');
|
|
21
23
|
const di = require('@mastra/core/di');
|
|
22
24
|
const clientJs = require('@mastra/client-js');
|
|
23
25
|
const zustand = require('zustand');
|
|
@@ -35,7 +37,6 @@ require('@xyflow/react/dist/style.css');
|
|
|
35
37
|
const Dagre = require('@dagrejs/dagre');
|
|
36
38
|
const prismReactRenderer = require('prism-react-renderer');
|
|
37
39
|
const CollapsiblePrimitive = require('@radix-ui/react-collapsible');
|
|
38
|
-
const DialogPrimitive = require('@radix-ui/react-dialog');
|
|
39
40
|
const ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
40
41
|
const jsonSchemaToZod = require('json-schema-to-zod');
|
|
41
42
|
const superjson = require('superjson');
|
|
@@ -71,9 +72,9 @@ function _interopNamespaceDefault(e) {
|
|
|
71
72
|
const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
72
73
|
const TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(TooltipPrimitive);
|
|
73
74
|
const AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(AvatarPrimitive);
|
|
75
|
+
const DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPrimitive);
|
|
74
76
|
const TabsPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(TabsPrimitive);
|
|
75
77
|
const CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(CollapsiblePrimitive);
|
|
76
|
-
const DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPrimitive);
|
|
77
78
|
const ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(ScrollAreaPrimitive);
|
|
78
79
|
const CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(CheckboxPrimitive);
|
|
79
80
|
const PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(PopoverPrimitive);
|
|
@@ -3886,6 +3887,122 @@ const FolderIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16
|
|
|
3886
3887
|
}
|
|
3887
3888
|
) });
|
|
3888
3889
|
|
|
3890
|
+
const McpCoinIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "126", height: "85", viewBox: "0 0 126 85", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3891
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3892
|
+
"path",
|
|
3893
|
+
{
|
|
3894
|
+
d: "M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641V49.8368C6.67773 65.0327 31.894 77.3514 62.9998 77.3514C94.1055 77.3514 119.322 65.0327 119.322 49.8368V35.1641Z",
|
|
3895
|
+
fill: "#2E2E2E",
|
|
3896
|
+
fillOpacity: "0.9"
|
|
3897
|
+
}
|
|
3898
|
+
),
|
|
3899
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3900
|
+
"path",
|
|
3901
|
+
{
|
|
3902
|
+
d: "M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641M119.322 35.1641C119.322 19.9681 94.1055 7.64941 62.9998 7.64941C31.894 7.64941 6.67773 19.9681 6.67773 35.1641M119.322 35.1641V49.8368C119.322 65.0327 94.1055 77.3514 62.9998 77.3514C31.894 77.3514 6.67773 65.0327 6.67773 49.8368V35.1641",
|
|
3903
|
+
stroke: "#424242"
|
|
3904
|
+
}
|
|
3905
|
+
),
|
|
3906
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3907
|
+
"path",
|
|
3908
|
+
{
|
|
3909
|
+
d: "M63.0002 0.96875C28.5152 0.96875 0.55957 15.6489 0.55957 33.7578V51.2433C0.55957 69.3522 28.5152 84.0323 63.0002 84.0323C97.4853 84.0323 125.441 69.3522 125.441 51.2433V33.7578C125.441 15.6489 97.4853 0.96875 63.0002 0.96875Z",
|
|
3910
|
+
stroke: "#707070"
|
|
3911
|
+
}
|
|
3912
|
+
),
|
|
3913
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3914
|
+
"path",
|
|
3915
|
+
{
|
|
3916
|
+
d: "M51.5215 39.9726C50.5464 40.4477 48.9738 40.4435 48.009 39.9634C47.0442 39.4833 47.0526 38.709 48.0277 38.2339L69.7191 27.6672C72.7243 26.2032 72.7347 23.8181 69.7605 22.3476L69.6898 22.313C66.6927 20.8686 61.8895 20.8864 58.9368 22.3528L30.3946 36.5278C29.4288 37.0074 27.8561 37.0107 26.882 36.5352C25.9078 36.0597 25.901 35.2853 26.8668 34.8057L55.4092 20.6308C60.2847 18.2094 68.2157 18.1801 73.1645 20.5651L73.2814 20.6222C76.1808 22.0558 77.3624 24.0157 76.8227 25.8782C80.6339 25.5828 84.6694 26.1476 87.6364 27.5775C92.6525 29.9949 92.7059 33.962 87.7554 36.4119L61.5441 49.3836C61.282 49.5133 61.281 49.7227 61.5417 49.853L67.0252 52.5932C67.988 53.0743 67.9763 53.8486 66.9992 54.3226C66.0221 54.7966 64.4495 54.7909 63.4867 54.3098L58.0033 51.5695C55.8306 50.4838 55.8392 48.7391 58.0226 47.6585L84.2339 34.6868C87.2382 33.2 87.2058 30.7925 84.1617 29.3254C81.1488 27.8734 76.1811 27.9317 73.2127 29.4058L51.5215 39.9726Z",
|
|
3917
|
+
fill: "#A9A9A9"
|
|
3918
|
+
}
|
|
3919
|
+
),
|
|
3920
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3921
|
+
"path",
|
|
3922
|
+
{
|
|
3923
|
+
d: "M63.0028 23.8809C64.0019 23.4098 65.5873 23.4146 66.5747 23.8972C67.562 24.3798 67.5831 25.1603 66.6338 25.6556L66.5879 25.679L45.1511 36.3113C42.2204 37.7649 42.2292 40.1117 45.1707 41.56C48.1228 43.0135 52.91 43.0118 55.8578 41.5563L76.8564 31.1875L76.9037 31.1648C77.9049 30.6949 79.4903 30.7013 80.4755 31.185C81.4763 31.6764 81.4785 32.4741 80.4806 32.9669L59.4821 43.3356C54.5363 45.7777 46.5044 45.7806 41.5516 43.342C36.6166 40.9121 36.602 36.9747 41.519 34.5359L62.9558 23.9037L63.0028 23.8809Z",
|
|
3924
|
+
fill: "#A9A9A9"
|
|
3925
|
+
}
|
|
3926
|
+
)
|
|
3927
|
+
] });
|
|
3928
|
+
|
|
3929
|
+
const ToolCoinIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "126", height: "85", viewBox: "0 0 126 85", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3930
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3931
|
+
"path",
|
|
3932
|
+
{
|
|
3933
|
+
d: "M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641V49.8368C6.67773 65.0327 31.894 77.3514 62.9998 77.3514C94.1055 77.3514 119.322 65.0327 119.322 49.8368V35.1641Z",
|
|
3934
|
+
fill: "#2E2E2E",
|
|
3935
|
+
fillOpacity: "0.9"
|
|
3936
|
+
}
|
|
3937
|
+
),
|
|
3938
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3939
|
+
"path",
|
|
3940
|
+
{
|
|
3941
|
+
d: "M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641M119.322 35.1641C119.322 19.9681 94.1055 7.64941 62.9998 7.64941C31.894 7.64941 6.67773 19.9681 6.67773 35.1641M119.322 35.1641V49.8368C119.322 65.0327 94.1055 77.3514 62.9998 77.3514C31.894 77.3514 6.67773 65.0327 6.67773 49.8368V35.1641",
|
|
3942
|
+
stroke: "#424242"
|
|
3943
|
+
}
|
|
3944
|
+
),
|
|
3945
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3946
|
+
"path",
|
|
3947
|
+
{
|
|
3948
|
+
d: "M63.0002 0.96875C28.5152 0.96875 0.55957 15.6489 0.55957 33.7578V51.2433C0.55957 69.3522 28.5152 84.0323 63.0002 84.0323C97.4853 84.0323 125.441 69.3522 125.441 51.2433V33.7578C125.441 15.6489 97.4853 0.96875 63.0002 0.96875Z",
|
|
3949
|
+
stroke: "#707070"
|
|
3950
|
+
}
|
|
3951
|
+
),
|
|
3952
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3953
|
+
"path",
|
|
3954
|
+
{
|
|
3955
|
+
fillRule: "evenodd",
|
|
3956
|
+
clipRule: "evenodd",
|
|
3957
|
+
d: "M95.8997 32.6647C98.4806 33.9355 98.4744 36.0012 95.8997 37.2689L89.6657 40.3384C87.0848 41.6091 82.8892 41.6061 80.3146 40.3384L74.0805 37.2689C71.4996 35.9981 71.5059 33.9324 74.0805 32.6647L80.3146 29.5952C82.8955 28.3244 87.091 28.3275 89.6657 29.5952L95.8997 32.6647ZM74.0805 21.9215C76.6614 23.1923 76.6552 25.258 74.0805 26.5257L67.8465 29.5952C65.2656 30.866 61.0701 30.8629 58.4954 29.5952L52.2613 26.5257C49.6804 25.255 49.6867 23.1892 52.2613 21.9215L58.4954 18.852C61.0763 17.5813 65.2718 17.5843 67.8465 18.852L74.0805 21.9215ZM74.0805 43.4079C76.6614 44.6786 76.6552 46.7444 74.0805 48.0121L67.8465 51.0816C65.2656 52.3523 61.0701 52.3493 58.4954 51.0816L52.2613 48.0121C49.6804 46.7413 49.6867 44.6756 52.2613 43.4079L58.4954 40.3384C61.0763 39.0676 65.2718 39.0707 67.8465 40.3384L74.0805 43.4079ZM52.2613 32.6647C54.8422 33.9355 54.836 36.0012 52.2613 37.2689L46.0273 40.3384C43.4464 41.6091 39.2509 41.6061 36.6762 40.3384L30.4422 37.2689C27.8613 35.9981 27.8675 33.9324 30.4422 32.6647L36.6762 29.5952C39.2571 28.3244 43.4526 28.3275 46.0273 29.5952L52.2613 32.6647Z",
|
|
3958
|
+
fill: "#A9A9A9"
|
|
3959
|
+
}
|
|
3960
|
+
)
|
|
3961
|
+
] });
|
|
3962
|
+
|
|
3963
|
+
const AgentNetworkCoinIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "126", height: "85", viewBox: "0 0 126 85", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3964
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3965
|
+
"path",
|
|
3966
|
+
{
|
|
3967
|
+
d: "M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641V49.8368C6.67773 65.0327 31.894 77.3514 62.9998 77.3514C94.1055 77.3514 119.322 65.0327 119.322 49.8368V35.1641Z",
|
|
3968
|
+
fill: "#2E2E2E",
|
|
3969
|
+
fillOpacity: "0.9"
|
|
3970
|
+
}
|
|
3971
|
+
),
|
|
3972
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3973
|
+
"path",
|
|
3974
|
+
{
|
|
3975
|
+
d: "M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641M119.322 35.1641C119.322 19.9681 94.1055 7.64941 62.9998 7.64941C31.894 7.64941 6.67773 19.9681 6.67773 35.1641M119.322 35.1641V49.8368C119.322 65.0327 94.1055 77.3514 62.9998 77.3514C31.894 77.3514 6.67773 65.0327 6.67773 49.8368V35.1641",
|
|
3976
|
+
stroke: "#424242"
|
|
3977
|
+
}
|
|
3978
|
+
),
|
|
3979
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3980
|
+
"path",
|
|
3981
|
+
{
|
|
3982
|
+
d: "M63.0002 0.96875C28.5152 0.96875 0.55957 15.6489 0.55957 33.7578V51.2433C0.55957 69.3522 28.5152 84.0323 63.0002 84.0323C97.4853 84.0323 125.441 69.3522 125.441 51.2433V33.7578C125.441 15.6489 97.4853 0.96875 63.0002 0.96875Z",
|
|
3983
|
+
stroke: "#707070"
|
|
3984
|
+
}
|
|
3985
|
+
),
|
|
3986
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip0_23333_14744)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3987
|
+
"path",
|
|
3988
|
+
{
|
|
3989
|
+
fillRule: "evenodd",
|
|
3990
|
+
clipRule: "evenodd",
|
|
3991
|
+
d: "M79.2946 17.9539C83.0143 19.7854 83.016 22.7559 79.2979 24.5879C77.0214 25.7087 73.8794 26.1385 70.9301 25.8878L67.5296 30.2202C68.0944 30.3987 68.6321 30.6075 69.1262 30.8507C71.0847 31.815 72.0009 33.0948 71.8979 34.3581L77.2504 35.1977C77.6452 34.8727 78.1174 34.5635 78.6856 34.2835C82.4066 32.4514 88.4403 32.4485 92.1623 34.2803C95.8842 36.1128 95.8805 39.0851 92.159 40.9175C88.4373 42.7488 82.4002 42.7513 78.679 40.9191C76.7415 39.9647 75.8248 38.7009 75.9073 37.4506L70.5219 36.6045C70.1354 36.9168 69.6777 37.2145 69.1295 37.4846C68.345 37.8708 67.4527 38.1705 66.5059 38.3939L67.9312 41.984C70.1507 42.0573 72.3276 42.5087 74.0244 43.3438C77.7444 45.1754 77.7467 48.1458 74.0277 49.9778C70.3071 51.8092 64.2712 51.8095 60.551 49.9778C56.8323 48.1459 56.8351 45.1755 60.5543 43.3438C61.3581 42.9482 62.2741 42.6414 63.247 42.4167L61.8282 38.8428C59.5803 38.7777 57.3696 38.3299 55.6527 37.4846C54.1264 36.7327 53.2395 35.7882 52.9666 34.8103L43.924 34.0469C43.4596 34.6259 42.7547 35.1702 41.8041 35.6385C38.0834 37.4696 32.0473 37.4701 28.3273 35.6385C24.6089 33.8068 24.6123 30.8363 28.3306 29.0046C32.0508 27.1737 38.0806 27.1737 41.8008 29.0046C43.3459 29.7653 44.2412 30.7224 44.5033 31.7129L53.5098 32.4747C53.9742 31.8832 54.6868 31.3279 55.656 30.8507C57.6687 29.8601 60.357 29.4079 62.9902 29.4892L66.5783 24.9218C66.3174 24.8179 66.0637 24.7073 65.8212 24.5879C62.1022 22.7559 62.1045 19.7856 65.8245 17.9539C69.5447 16.1235 75.5747 16.1232 79.2946 17.9539ZM38.4299 30.6643C36.5715 29.75 33.5599 29.75 31.7015 30.6643C29.8447 31.5793 29.8414 33.0638 31.6982 33.9788C33.5565 34.8938 36.5742 34.8933 38.4332 33.9788C40.2906 33.0635 40.2883 31.5793 38.4299 30.6643ZM70.6536 45.0035C68.7951 44.0893 65.7836 44.0893 63.9251 45.0035C62.0676 45.9185 62.0647 47.4029 63.9218 48.318C65.7804 49.2332 68.7979 49.2329 70.6569 48.3181C72.5142 47.4027 72.5119 45.9185 70.6536 45.0035ZM65.7553 32.5104C63.8969 31.5961 60.8853 31.5961 59.0269 32.5104C57.1685 33.4254 57.1662 34.9096 59.0236 35.8249C60.8824 36.7402 63.8998 36.7402 65.7586 35.8249C67.616 34.9096 67.6137 33.4254 65.7553 32.5104ZM88.7915 35.94C86.9338 35.0261 83.9184 35.0264 82.0564 35.9432C80.1965 36.8601 80.1945 38.3451 82.0498 39.2594C83.9067 40.1736 86.9255 40.1738 88.7882 39.2578C90.6507 38.3407 90.649 36.8546 88.7915 35.94ZM75.9238 19.6136C74.0656 18.6995 71.0538 18.6998 69.1953 19.6136C67.3369 20.5286 67.3347 22.0129 69.192 22.9282C71.0509 23.8434 74.0682 23.8434 75.9271 22.9282C77.7836 22.0128 77.7818 20.5285 75.9238 19.6136Z",
|
|
3992
|
+
fill: "#A9A9A9"
|
|
3993
|
+
}
|
|
3994
|
+
) }),
|
|
3995
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_23333_14744", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3996
|
+
"rect",
|
|
3997
|
+
{
|
|
3998
|
+
width: "59.3185",
|
|
3999
|
+
height: "59.3185",
|
|
4000
|
+
fill: "white",
|
|
4001
|
+
transform: "matrix(0.897148 0.441731 -0.897148 0.441731 65.3042 6.51953)"
|
|
4002
|
+
}
|
|
4003
|
+
) }) })
|
|
4004
|
+
] });
|
|
4005
|
+
|
|
3889
4006
|
const useCodemirrorTheme$1 = () => {
|
|
3890
4007
|
return React.useMemo(
|
|
3891
4008
|
() => codemirrorThemeDracula.draculaInit({
|
|
@@ -3982,8 +4099,156 @@ const AssistantActionBar = () => {
|
|
|
3982
4099
|
);
|
|
3983
4100
|
};
|
|
3984
4101
|
|
|
4102
|
+
const Dialog = DialogPrimitive__namespace.Root;
|
|
4103
|
+
const DialogTrigger = DialogPrimitive__namespace.Trigger;
|
|
4104
|
+
const DialogPortal = DialogPrimitive__namespace.Portal;
|
|
4105
|
+
const DialogOverlay = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4106
|
+
DialogPrimitive__namespace.Overlay,
|
|
4107
|
+
{
|
|
4108
|
+
ref,
|
|
4109
|
+
className: cn(
|
|
4110
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
4111
|
+
className
|
|
4112
|
+
),
|
|
4113
|
+
...props
|
|
4114
|
+
}
|
|
4115
|
+
));
|
|
4116
|
+
DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
|
|
4117
|
+
const DialogContent = React__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
|
|
4118
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
|
|
4119
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4120
|
+
DialogPrimitive__namespace.Content,
|
|
4121
|
+
{
|
|
4122
|
+
ref,
|
|
4123
|
+
className: cn(
|
|
4124
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
4125
|
+
className
|
|
4126
|
+
),
|
|
4127
|
+
...props,
|
|
4128
|
+
children: [
|
|
4129
|
+
children,
|
|
4130
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
4131
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }),
|
|
4132
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
|
|
4133
|
+
] })
|
|
4134
|
+
]
|
|
4135
|
+
}
|
|
4136
|
+
)
|
|
4137
|
+
] }));
|
|
4138
|
+
DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
|
|
4139
|
+
const DialogTitle = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4140
|
+
DialogPrimitive__namespace.Title,
|
|
4141
|
+
{
|
|
4142
|
+
ref,
|
|
4143
|
+
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
4144
|
+
...props
|
|
4145
|
+
}
|
|
4146
|
+
));
|
|
4147
|
+
DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
|
|
4148
|
+
const DialogDescription = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
4149
|
+
DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
|
|
4150
|
+
|
|
4151
|
+
const useHasAttachments = () => {
|
|
4152
|
+
const composer = react.useComposerRuntime();
|
|
4153
|
+
const [hasAttachments, setHasAttachments] = React.useState(false);
|
|
4154
|
+
React.useEffect(() => {
|
|
4155
|
+
composer.subscribe(() => {
|
|
4156
|
+
const attachments = composer.getState().attachments;
|
|
4157
|
+
setHasAttachments(attachments.length > 0);
|
|
4158
|
+
});
|
|
4159
|
+
}, [composer]);
|
|
4160
|
+
return hasAttachments;
|
|
4161
|
+
};
|
|
4162
|
+
|
|
4163
|
+
const useFileSrc = (file) => {
|
|
4164
|
+
const [src, setSrc] = React.useState(void 0);
|
|
4165
|
+
React.useEffect(() => {
|
|
4166
|
+
if (!file) {
|
|
4167
|
+
setSrc(void 0);
|
|
4168
|
+
return;
|
|
4169
|
+
}
|
|
4170
|
+
const objectUrl = URL.createObjectURL(file);
|
|
4171
|
+
setSrc(objectUrl);
|
|
4172
|
+
return () => {
|
|
4173
|
+
URL.revokeObjectURL(objectUrl);
|
|
4174
|
+
};
|
|
4175
|
+
}, [file]);
|
|
4176
|
+
return src;
|
|
4177
|
+
};
|
|
4178
|
+
const useAttachmentSrc = () => {
|
|
4179
|
+
const { file, src } = react.useAttachment(
|
|
4180
|
+
shallow.useShallow((a) => {
|
|
4181
|
+
if (a.type !== "image") return {};
|
|
4182
|
+
if (a.file) return { file: a.file };
|
|
4183
|
+
const src2 = a.content?.filter((c) => c.type === "image")[0]?.image;
|
|
4184
|
+
if (!src2) return {};
|
|
4185
|
+
return { src: src2 };
|
|
4186
|
+
})
|
|
4187
|
+
);
|
|
4188
|
+
return useFileSrc(file) ?? src;
|
|
4189
|
+
};
|
|
4190
|
+
const AttachmentPreview = ({ src }) => {
|
|
4191
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden w-full", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src, className: "object-contain aspect-ratio h-full w-full", alt: "Preview" }) });
|
|
4192
|
+
};
|
|
4193
|
+
const AttachmentPreviewDialog = ({ children }) => {
|
|
4194
|
+
const src = useAttachmentSrc();
|
|
4195
|
+
if (!src) return children;
|
|
4196
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { children: [
|
|
4197
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogTrigger, { className: "hover:bg-accent/50 cursor-pointer transition-colors", asChild: true, children }),
|
|
4198
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
|
|
4199
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
|
|
4200
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "max-w-5xl w-full max-h-[80%]", children: [
|
|
4201
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "aui-sr-only", children: "Image Attachment Preview" }),
|
|
4202
|
+
/* @__PURE__ */ jsxRuntime.jsx(AttachmentPreview, { src })
|
|
4203
|
+
] })
|
|
4204
|
+
] })
|
|
4205
|
+
] });
|
|
4206
|
+
};
|
|
4207
|
+
const AttachmentThumbnail = () => {
|
|
4208
|
+
const isImage = react.useAttachment((a) => a.type === "image");
|
|
4209
|
+
const src = useAttachmentSrc();
|
|
4210
|
+
const canRemove = react.useAttachment((a) => a.source !== "message");
|
|
4211
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
4212
|
+
/* @__PURE__ */ jsxRuntime.jsxs(react.AttachmentPrimitive.Root, { className: "relative", children: [
|
|
4213
|
+
/* @__PURE__ */ jsxRuntime.jsx(AttachmentPreviewDialog, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full aspect-ratio overflow-hidden rounded-lg", children: isImage ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border-sm border-border1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src, className: "object-cover aspect-ratio size-16", alt: "Preview", height: 64, width: 64 }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border-sm border-border1 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileIcon, { className: "text-icon3" }) }) }) }) }),
|
|
4214
|
+
canRemove && /* @__PURE__ */ jsxRuntime.jsx(AttachmentRemove, {})
|
|
4215
|
+
] }),
|
|
4216
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side: "top", children: /* @__PURE__ */ jsxRuntime.jsx(react.AttachmentPrimitive.Name, {}) })
|
|
4217
|
+
] }) });
|
|
4218
|
+
};
|
|
4219
|
+
const AttachmentRemove = () => {
|
|
4220
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.AttachmentPrimitive.Remove, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4221
|
+
TooltipIconButton,
|
|
4222
|
+
{
|
|
4223
|
+
tooltip: "Remove file",
|
|
4224
|
+
className: "absolute -right-3 -top-3 hover:bg-transparent rounded-full bg-surface1 rounded-full p-1",
|
|
4225
|
+
side: "top",
|
|
4226
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleXIcon, {}) })
|
|
4227
|
+
}
|
|
4228
|
+
) });
|
|
4229
|
+
};
|
|
4230
|
+
const UserMessageAttachments = () => {
|
|
4231
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.MessagePrimitive.Attachments, { components: { Attachment: InMessageAttachment } });
|
|
4232
|
+
};
|
|
4233
|
+
const InMessageAttachment = () => {
|
|
4234
|
+
const isImage = react.useAttachment((a) => a.type === "image");
|
|
4235
|
+
const src = useAttachmentSrc();
|
|
4236
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
4237
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.AttachmentPrimitive.Root, { className: "relative pt-4", children: /* @__PURE__ */ jsxRuntime.jsx(AttachmentPreviewDialog, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full aspect-ratio overflow-hidden rounded-lg", children: isImage ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border-sm border-border1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src, className: "object-cover aspect-ratio max-h-[140px] max-w-[320px]", alt: "Preview" }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border-sm border-border1 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileIcon, { className: "text-icon3" }) }) }) }) }) }),
|
|
4238
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side: "top", children: /* @__PURE__ */ jsxRuntime.jsx(react.AttachmentPrimitive.Name, {}) })
|
|
4239
|
+
] }) });
|
|
4240
|
+
};
|
|
4241
|
+
const ComposerAttachments = () => {
|
|
4242
|
+
const hasAttachments = useHasAttachments();
|
|
4243
|
+
if (!hasAttachments) return null;
|
|
4244
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full flex-row items-center gap-4 h-24", children: /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Attachments, { components: { Attachment: AttachmentThumbnail } }) });
|
|
4245
|
+
};
|
|
4246
|
+
|
|
3985
4247
|
const UserMessage = () => {
|
|
3986
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
4248
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.MessagePrimitive.Root, { className: "w-full flex items-end pb-4 flex-col", children: [
|
|
4249
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-[366px] px-5 py-3 text-icon6 text-ui-lg leading-ui-lg rounded-lg bg-surface3", children: /* @__PURE__ */ jsxRuntime.jsx(react.MessagePrimitive.Content, {}) }),
|
|
4250
|
+
/* @__PURE__ */ jsxRuntime.jsx(UserMessageAttachments, {})
|
|
4251
|
+
] });
|
|
3987
4252
|
};
|
|
3988
4253
|
|
|
3989
4254
|
const useAutoscroll = (ref, { enabled = true }) => {
|
|
@@ -4038,13 +4303,63 @@ const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) =
|
|
|
4038
4303
|
return /* @__PURE__ */ jsxRuntime.jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
|
|
4039
4304
|
};
|
|
4040
4305
|
|
|
4041
|
-
const
|
|
4306
|
+
const useSpeechRecognition = ({ language = "en-US" } = {}) => {
|
|
4307
|
+
const speechRecognitionRef = React.useRef(null);
|
|
4308
|
+
const [state, setState] = React.useState({
|
|
4309
|
+
isListening: false,
|
|
4310
|
+
transcript: "",
|
|
4311
|
+
error: null
|
|
4312
|
+
});
|
|
4313
|
+
const start = () => {
|
|
4314
|
+
if (!speechRecognitionRef.current) return;
|
|
4315
|
+
speechRecognitionRef.current.start();
|
|
4316
|
+
};
|
|
4317
|
+
const stop = () => {
|
|
4318
|
+
if (!speechRecognitionRef.current) return;
|
|
4319
|
+
speechRecognitionRef.current.stop();
|
|
4320
|
+
};
|
|
4321
|
+
React.useEffect(() => {
|
|
4322
|
+
if (!("webkitSpeechRecognition" in window) && !("SpeechRecognition" in window)) {
|
|
4323
|
+
setState((prev) => ({ ...prev, error: "Speech Recognition not supported in this browser" }));
|
|
4324
|
+
return;
|
|
4325
|
+
}
|
|
4326
|
+
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
4327
|
+
const recognition = new SpeechRecognition();
|
|
4328
|
+
speechRecognitionRef.current = recognition;
|
|
4329
|
+
recognition.continuous = true;
|
|
4330
|
+
recognition.lang = language;
|
|
4331
|
+
recognition.onstart = () => {
|
|
4332
|
+
setState((prev) => ({ ...prev, isListening: true }));
|
|
4333
|
+
};
|
|
4334
|
+
recognition.onresult = (event) => {
|
|
4335
|
+
let finalTranscript = "";
|
|
4336
|
+
for (let i = event.resultIndex; i < event.results.length; i++) {
|
|
4337
|
+
const transcript = event.results[i][0].transcript;
|
|
4338
|
+
if (event.results[i].isFinal) {
|
|
4339
|
+
finalTranscript += transcript + " ";
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
setState((prev) => ({ ...prev, transcript: finalTranscript }));
|
|
4343
|
+
};
|
|
4344
|
+
recognition.onerror = (event) => {
|
|
4345
|
+
setState((prev) => ({ ...prev, error: `Error: ${event.error}` }));
|
|
4346
|
+
};
|
|
4347
|
+
recognition.onend = () => setState((prev) => ({ ...prev, isListening: false }));
|
|
4348
|
+
}, [language]);
|
|
4349
|
+
return {
|
|
4350
|
+
...state,
|
|
4351
|
+
start,
|
|
4352
|
+
stop
|
|
4353
|
+
};
|
|
4354
|
+
};
|
|
4355
|
+
|
|
4356
|
+
const Thread = ({ ToolFallback, agentName, hasMemory, showFileSupport }) => {
|
|
4042
4357
|
const areaRef = React.useRef(null);
|
|
4043
4358
|
useAutoscroll(areaRef, { enabled: true });
|
|
4044
4359
|
const WrappedAssistantMessage = (props) => {
|
|
4045
4360
|
return /* @__PURE__ */ jsxRuntime.jsx(AssistantMessage, { ...props, ToolFallback });
|
|
4046
4361
|
};
|
|
4047
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4362
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ThreadWrapper, { children: [
|
|
4048
4363
|
/* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
|
|
4049
4364
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4050
4365
|
/* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome, { agentName }),
|
|
@@ -4061,9 +4376,22 @@ const Thread = ({ ToolFallback, agentName, hasMemory }) => {
|
|
|
4061
4376
|
] }),
|
|
4062
4377
|
/* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) })
|
|
4063
4378
|
] }),
|
|
4064
|
-
/* @__PURE__ */ jsxRuntime.jsx(Composer, { hasMemory })
|
|
4379
|
+
/* @__PURE__ */ jsxRuntime.jsx(Composer, { hasMemory, showFileSupport })
|
|
4065
4380
|
] });
|
|
4066
4381
|
};
|
|
4382
|
+
const ThreadWrapper = ({ children }) => {
|
|
4383
|
+
const hasAttachments = useHasAttachments();
|
|
4384
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4385
|
+
react.ThreadPrimitive.Root,
|
|
4386
|
+
{
|
|
4387
|
+
className: clsx(
|
|
4388
|
+
"max-w-[568px] w-full mx-auto px-4",
|
|
4389
|
+
hasAttachments ? "h-[calc(100%-208px)]" : "h-[calc(100%-112px)]"
|
|
4390
|
+
),
|
|
4391
|
+
children
|
|
4392
|
+
}
|
|
4393
|
+
);
|
|
4394
|
+
};
|
|
4067
4395
|
const ThreadWelcome = ({ agentName }) => {
|
|
4068
4396
|
const safeAgentName = agentName ?? "";
|
|
4069
4397
|
const words = safeAgentName.split(" ") ?? [];
|
|
@@ -4080,20 +4408,26 @@ const ThreadWelcome = ({ agentName }) => {
|
|
|
4080
4408
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
|
|
4081
4409
|
] }) });
|
|
4082
4410
|
};
|
|
4083
|
-
const Composer = ({ hasMemory }) => {
|
|
4411
|
+
const Composer = ({ hasMemory, showFileSupport }) => {
|
|
4084
4412
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4085
|
-
/* @__PURE__ */ jsxRuntime.jsxs(react.ComposerPrimitive.Root, {
|
|
4086
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4087
|
-
|
|
4088
|
-
{
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4413
|
+
/* @__PURE__ */ jsxRuntime.jsxs(react.ComposerPrimitive.Root, { children: [
|
|
4414
|
+
/* @__PURE__ */ jsxRuntime.jsx(ComposerAttachments, {}),
|
|
4415
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
|
|
4416
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4417
|
+
"textarea",
|
|
4418
|
+
{
|
|
4419
|
+
className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none",
|
|
4420
|
+
autoFocus: true,
|
|
4421
|
+
placeholder: "Enter your message...",
|
|
4422
|
+
name: "",
|
|
4423
|
+
id: ""
|
|
4424
|
+
}
|
|
4425
|
+
) }),
|
|
4426
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
4427
|
+
/* @__PURE__ */ jsxRuntime.jsx(SpeechInput, {}),
|
|
4428
|
+
/* @__PURE__ */ jsxRuntime.jsx(ComposerAction, { showFileSupport })
|
|
4429
|
+
] })
|
|
4430
|
+
] })
|
|
4097
4431
|
] }),
|
|
4098
4432
|
!hasMemory && /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-sm", className: "text-icon3 flex items-center gap-2 pt-0.5", children: [
|
|
4099
4433
|
/* @__PURE__ */ jsxRuntime.jsx(Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, {}) }),
|
|
@@ -4101,8 +4435,28 @@ const Composer = ({ hasMemory }) => {
|
|
|
4101
4435
|
] })
|
|
4102
4436
|
] });
|
|
4103
4437
|
};
|
|
4104
|
-
const
|
|
4438
|
+
const SpeechInput = () => {
|
|
4439
|
+
const composerRuntime = react.useComposerRuntime();
|
|
4440
|
+
const { start, stop, isListening, transcript } = useSpeechRecognition();
|
|
4441
|
+
React.useEffect(() => {
|
|
4442
|
+
if (!transcript) return;
|
|
4443
|
+
composerRuntime.setText(transcript);
|
|
4444
|
+
}, [composerRuntime, transcript]);
|
|
4445
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4446
|
+
TooltipIconButton,
|
|
4447
|
+
{
|
|
4448
|
+
type: "button",
|
|
4449
|
+
tooltip: isListening ? "Stop dictation" : "Start dictation",
|
|
4450
|
+
variant: "ghost",
|
|
4451
|
+
className: "rounded-full",
|
|
4452
|
+
onClick: () => isListening ? stop() : start(),
|
|
4453
|
+
children: isListening ? /* @__PURE__ */ jsxRuntime.jsx(CircleStopIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mic, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
4454
|
+
}
|
|
4455
|
+
);
|
|
4456
|
+
};
|
|
4457
|
+
const ComposerAction = ({ showFileSupport }) => {
|
|
4105
4458
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4459
|
+
showFileSupport && /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.AddAttachment, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipIconButton, { tooltip: "Add attachment", variant: "ghost", className: "rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" }) }) }),
|
|
4106
4460
|
/* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.If, { running: false, children: /* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4107
4461
|
TooltipIconButton,
|
|
4108
4462
|
{
|
|
@@ -4136,9 +4490,40 @@ const createMastraClient = (baseUrl) => {
|
|
|
4136
4490
|
});
|
|
4137
4491
|
};
|
|
4138
4492
|
|
|
4493
|
+
const fileToBase64 = async (file) => {
|
|
4494
|
+
return new Promise((resolve, reject) => {
|
|
4495
|
+
const reader = new FileReader();
|
|
4496
|
+
reader.onload = () => {
|
|
4497
|
+
const result = reader.result;
|
|
4498
|
+
if (typeof result === "string") {
|
|
4499
|
+
resolve(result);
|
|
4500
|
+
} else {
|
|
4501
|
+
reject(new Error("Failed to convert file to base64."));
|
|
4502
|
+
}
|
|
4503
|
+
};
|
|
4504
|
+
reader.onerror = (error) => {
|
|
4505
|
+
reject(error);
|
|
4506
|
+
};
|
|
4507
|
+
reader.readAsDataURL(file);
|
|
4508
|
+
});
|
|
4509
|
+
};
|
|
4510
|
+
|
|
4139
4511
|
const convertMessage$1 = (message) => {
|
|
4140
4512
|
return message;
|
|
4141
4513
|
};
|
|
4514
|
+
const convertToAIAttachments = async (attachments) => {
|
|
4515
|
+
const promises = attachments.filter((attachment) => attachment.file).map(async (attachment) => ({
|
|
4516
|
+
role: "user",
|
|
4517
|
+
content: [
|
|
4518
|
+
{
|
|
4519
|
+
type: "image",
|
|
4520
|
+
image: await fileToBase64(attachment.file),
|
|
4521
|
+
mimeType: attachment.file.type
|
|
4522
|
+
}
|
|
4523
|
+
]
|
|
4524
|
+
}));
|
|
4525
|
+
return Promise.all(promises);
|
|
4526
|
+
};
|
|
4142
4527
|
function MastraRuntimeProvider({
|
|
4143
4528
|
children,
|
|
4144
4529
|
agentId,
|
|
@@ -4191,8 +4576,12 @@ function MastraRuntimeProvider({
|
|
|
4191
4576
|
const agent = mastra.getAgent(agentId);
|
|
4192
4577
|
const onNew = async (message) => {
|
|
4193
4578
|
if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
|
|
4579
|
+
const attachments = await convertToAIAttachments(message.attachments);
|
|
4194
4580
|
const input = message.content[0].text;
|
|
4195
|
-
setMessages((currentConversation) => [
|
|
4581
|
+
setMessages((currentConversation) => [
|
|
4582
|
+
...currentConversation,
|
|
4583
|
+
{ role: "user", content: input, attachments: message.attachments }
|
|
4584
|
+
]);
|
|
4196
4585
|
setIsRunning(true);
|
|
4197
4586
|
try {
|
|
4198
4587
|
if (chatWithGenerate) {
|
|
@@ -4201,7 +4590,8 @@ function MastraRuntimeProvider({
|
|
|
4201
4590
|
{
|
|
4202
4591
|
role: "user",
|
|
4203
4592
|
content: input
|
|
4204
|
-
}
|
|
4593
|
+
},
|
|
4594
|
+
...attachments
|
|
4205
4595
|
],
|
|
4206
4596
|
runId: agentId,
|
|
4207
4597
|
frequencyPenalty,
|
|
@@ -4310,7 +4700,8 @@ function MastraRuntimeProvider({
|
|
|
4310
4700
|
{
|
|
4311
4701
|
role: "user",
|
|
4312
4702
|
content: input
|
|
4313
|
-
}
|
|
4703
|
+
},
|
|
4704
|
+
...attachments
|
|
4314
4705
|
],
|
|
4315
4706
|
runId: agentId,
|
|
4316
4707
|
frequencyPenalty,
|
|
@@ -4431,7 +4822,10 @@ function MastraRuntimeProvider({
|
|
|
4431
4822
|
isRunning,
|
|
4432
4823
|
messages,
|
|
4433
4824
|
convertMessage: convertMessage$1,
|
|
4434
|
-
onNew
|
|
4825
|
+
onNew,
|
|
4826
|
+
adapters: {
|
|
4827
|
+
attachments: new react.CompositeAttachmentAdapter([new react.SimpleImageAttachmentAdapter()])
|
|
4828
|
+
}
|
|
4435
4829
|
});
|
|
4436
4830
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.AssistantRuntimeProvider, { runtime, children: [
|
|
4437
4831
|
" ",
|
|
@@ -4513,7 +4907,8 @@ const AgentChat = ({
|
|
|
4513
4907
|
initialMessages,
|
|
4514
4908
|
memory,
|
|
4515
4909
|
baseUrl,
|
|
4516
|
-
refreshThreadList
|
|
4910
|
+
refreshThreadList,
|
|
4911
|
+
showFileSupport
|
|
4517
4912
|
}) => {
|
|
4518
4913
|
const { modelSettings, chatWithGenerate } = React.useContext(AgentContext);
|
|
4519
4914
|
const { runtimeContext } = usePlaygroundStore();
|
|
@@ -4530,7 +4925,7 @@ const AgentChat = ({
|
|
|
4530
4925
|
modelSettings,
|
|
4531
4926
|
chatWithGenerate,
|
|
4532
4927
|
runtimeContext,
|
|
4533
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { agentName: agentName ?? "", hasMemory: memory }) })
|
|
4928
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { agentName: agentName ?? "", hasMemory: memory, showFileSupport }) })
|
|
4534
4929
|
}
|
|
4535
4930
|
);
|
|
4536
4931
|
};
|
|
@@ -7192,54 +7587,6 @@ const Collapsible = CollapsiblePrimitive__namespace.Root;
|
|
|
7192
7587
|
const CollapsibleTrigger = CollapsiblePrimitive__namespace.CollapsibleTrigger;
|
|
7193
7588
|
const CollapsibleContent = CollapsiblePrimitive__namespace.CollapsibleContent;
|
|
7194
7589
|
|
|
7195
|
-
const Dialog = DialogPrimitive__namespace.Root;
|
|
7196
|
-
const DialogPortal = DialogPrimitive__namespace.Portal;
|
|
7197
|
-
const DialogOverlay = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7198
|
-
DialogPrimitive__namespace.Overlay,
|
|
7199
|
-
{
|
|
7200
|
-
ref,
|
|
7201
|
-
className: cn(
|
|
7202
|
-
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
7203
|
-
className
|
|
7204
|
-
),
|
|
7205
|
-
...props
|
|
7206
|
-
}
|
|
7207
|
-
));
|
|
7208
|
-
DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
|
|
7209
|
-
const DialogContent = React__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
|
|
7210
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
|
|
7211
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7212
|
-
DialogPrimitive__namespace.Content,
|
|
7213
|
-
{
|
|
7214
|
-
ref,
|
|
7215
|
-
className: cn(
|
|
7216
|
-
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
7217
|
-
className
|
|
7218
|
-
),
|
|
7219
|
-
...props,
|
|
7220
|
-
children: [
|
|
7221
|
-
children,
|
|
7222
|
-
/* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
7223
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }),
|
|
7224
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
|
|
7225
|
-
] })
|
|
7226
|
-
]
|
|
7227
|
-
}
|
|
7228
|
-
)
|
|
7229
|
-
] }));
|
|
7230
|
-
DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
|
|
7231
|
-
const DialogTitle = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7232
|
-
DialogPrimitive__namespace.Title,
|
|
7233
|
-
{
|
|
7234
|
-
ref,
|
|
7235
|
-
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
7236
|
-
...props
|
|
7237
|
-
}
|
|
7238
|
-
));
|
|
7239
|
-
DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
|
|
7240
|
-
const DialogDescription = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
7241
|
-
DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
|
|
7242
|
-
|
|
7243
7590
|
const ScrollArea = React__namespace.forwardRef(
|
|
7244
7591
|
({ className, children, viewPortClassName, maxHeight, autoScroll = false, ...props }, ref) => {
|
|
7245
7592
|
const areaRef = React__namespace.useRef(null);
|
|
@@ -9215,6 +9562,21 @@ const EntityContent = ({ children, className }) => {
|
|
|
9215
9562
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
|
|
9216
9563
|
};
|
|
9217
9564
|
|
|
9565
|
+
const EmptyState = ({
|
|
9566
|
+
iconSlot,
|
|
9567
|
+
titleSlot,
|
|
9568
|
+
descriptionSlot,
|
|
9569
|
+
actionSlot,
|
|
9570
|
+
as: Component = "div"
|
|
9571
|
+
}) => {
|
|
9572
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-[340px] flex-col items-center justify-center text-center", children: [
|
|
9573
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-auto [&>svg]:w-[126px]", children: iconSlot }),
|
|
9574
|
+
/* @__PURE__ */ jsxRuntime.jsx(Component, { className: "text-icon6 pt-[34px] font-serif text-[1.75rem] font-semibold", children: titleSlot }),
|
|
9575
|
+
/* @__PURE__ */ jsxRuntime.jsx(Txt, { variant: "ui-lg", className: "text-icon3 pb-[34px]", children: descriptionSlot }),
|
|
9576
|
+
actionSlot
|
|
9577
|
+
] });
|
|
9578
|
+
};
|
|
9579
|
+
|
|
9218
9580
|
function usePolling({
|
|
9219
9581
|
fetchFn,
|
|
9220
9582
|
interval = 3e3,
|
|
@@ -9374,6 +9736,7 @@ exports.AgentCoinIcon = AgentCoinIcon;
|
|
|
9374
9736
|
exports.AgentContext = AgentContext;
|
|
9375
9737
|
exports.AgentEvals = AgentEvals;
|
|
9376
9738
|
exports.AgentIcon = AgentIcon;
|
|
9739
|
+
exports.AgentNetworkCoinIcon = AgentNetworkCoinIcon;
|
|
9377
9740
|
exports.AgentProvider = AgentProvider;
|
|
9378
9741
|
exports.AgentTraces = AgentTraces;
|
|
9379
9742
|
exports.AiIcon = AiIcon;
|
|
@@ -9397,6 +9760,7 @@ exports.DeploymentIcon = DeploymentIcon;
|
|
|
9397
9760
|
exports.DividerIcon = DividerIcon;
|
|
9398
9761
|
exports.DocsIcon = DocsIcon;
|
|
9399
9762
|
exports.DynamicForm = DynamicForm;
|
|
9763
|
+
exports.EmptyState = EmptyState;
|
|
9400
9764
|
exports.Entity = Entity;
|
|
9401
9765
|
exports.EntityContent = EntityContent;
|
|
9402
9766
|
exports.EntityDescription = EntityDescription;
|
|
@@ -9423,6 +9787,7 @@ exports.LegacyWorkflowGraph = LegacyWorkflowGraph;
|
|
|
9423
9787
|
exports.LegacyWorkflowTrigger = LegacyWorkflowTrigger;
|
|
9424
9788
|
exports.LogsIcon = LogsIcon;
|
|
9425
9789
|
exports.MastraResizablePanel = MastraResizablePanel;
|
|
9790
|
+
exports.McpCoinIcon = McpCoinIcon;
|
|
9426
9791
|
exports.McpServerIcon = McpServerIcon;
|
|
9427
9792
|
exports.MemoryIcon = MemoryIcon;
|
|
9428
9793
|
exports.NetworkChat = NetworkChat;
|
|
@@ -9444,6 +9809,7 @@ exports.ThreadItem = ThreadItem;
|
|
|
9444
9809
|
exports.ThreadLink = ThreadLink;
|
|
9445
9810
|
exports.ThreadList = ThreadList;
|
|
9446
9811
|
exports.Threads = Threads;
|
|
9812
|
+
exports.ToolCoinIcon = ToolCoinIcon;
|
|
9447
9813
|
exports.ToolsIcon = ToolsIcon;
|
|
9448
9814
|
exports.TraceContext = TraceContext;
|
|
9449
9815
|
exports.TraceIcon = TraceIcon;
|
|
@@ -9463,5 +9829,6 @@ exports.WorkflowTrigger = WorkflowTrigger;
|
|
|
9463
9829
|
exports.refineTraces = refineTraces;
|
|
9464
9830
|
exports.usePlaygroundStore = usePlaygroundStore;
|
|
9465
9831
|
exports.usePolling = usePolling;
|
|
9832
|
+
exports.useSpeechRecognition = useSpeechRecognition;
|
|
9466
9833
|
exports.useTraces = useTraces;
|
|
9467
9834
|
//# sourceMappingURL=index.cjs.js.map
|