@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.es.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useMessage, MessagePrimitive, ActionBarPrimitive,
|
|
3
|
-
import { CheckIcon as CheckIcon$1, CopyIcon, ChevronUpIcon, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc,
|
|
2
|
+
import { useMessage, MessagePrimitive, ActionBarPrimitive, useComposerRuntime, ComposerPrimitive, useAttachment, AttachmentPrimitive, ThreadPrimitive, useExternalStoreRuntime, CompositeAttachmentAdapter, SimpleImageAttachmentAdapter, AssistantRuntimeProvider } from '@assistant-ui/react';
|
|
3
|
+
import { CheckIcon as CheckIcon$1, CopyIcon, ChevronUpIcon, X, FileIcon, CircleXIcon, Mic, PlusIcon, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, Check, ChevronUp, ChevronDown, LoaderCircle, ChevronDownIcon, ExternalLinkIcon, Footprints, CircleCheck, CircleX, Workflow, AlertCircleIcon, AlertCircle, CalendarIcon, Braces, Brackets, TrashIcon, Plus, Loader2, CirclePause } from 'lucide-react';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import React__default, { forwardRef, useState, useEffect, memo, useMemo, useRef, createContext, useContext, useCallback, Suspense, Fragment as Fragment$1 } from 'react';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
8
|
+
import { TooltipProvider as TooltipProvider$1 } from '@radix-ui/react-tooltip';
|
|
8
9
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
9
10
|
import { unstable_memoizeMarkdownComponents, useIsMarkdownCodeBlock, MarkdownTextPrimitive } from '@assistant-ui/react-markdown';
|
|
10
11
|
import '@assistant-ui/react-markdown/styles/dot.css';
|
|
@@ -15,6 +16,8 @@ import { jsonLanguage } from '@codemirror/lang-json';
|
|
|
15
16
|
import { tags } from '@lezer/highlight';
|
|
16
17
|
import { draculaInit } from '@uiw/codemirror-theme-dracula';
|
|
17
18
|
import CodeMirror from '@uiw/react-codemirror';
|
|
19
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
20
|
+
import { useShallow } from 'zustand/shallow';
|
|
18
21
|
import { RuntimeContext } from '@mastra/core/di';
|
|
19
22
|
import { MastraClient } from '@mastra/client-js';
|
|
20
23
|
import { create } from 'zustand';
|
|
@@ -32,7 +35,6 @@ import '@xyflow/react/dist/style.css';
|
|
|
32
35
|
import Dagre from '@dagrejs/dagre';
|
|
33
36
|
import { Highlight, themes } from 'prism-react-renderer';
|
|
34
37
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
35
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
36
38
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
37
39
|
import jsonSchemaToZod from 'json-schema-to-zod';
|
|
38
40
|
import { parse } from 'superjson';
|
|
@@ -3854,6 +3856,122 @@ const FolderIcon = (props) => /* @__PURE__ */ jsx("svg", { width: "16", height:
|
|
|
3854
3856
|
}
|
|
3855
3857
|
) });
|
|
3856
3858
|
|
|
3859
|
+
const McpCoinIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "126", height: "85", viewBox: "0 0 126 85", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3860
|
+
/* @__PURE__ */ jsx(
|
|
3861
|
+
"path",
|
|
3862
|
+
{
|
|
3863
|
+
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",
|
|
3864
|
+
fill: "#2E2E2E",
|
|
3865
|
+
fillOpacity: "0.9"
|
|
3866
|
+
}
|
|
3867
|
+
),
|
|
3868
|
+
/* @__PURE__ */ jsx(
|
|
3869
|
+
"path",
|
|
3870
|
+
{
|
|
3871
|
+
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",
|
|
3872
|
+
stroke: "#424242"
|
|
3873
|
+
}
|
|
3874
|
+
),
|
|
3875
|
+
/* @__PURE__ */ jsx(
|
|
3876
|
+
"path",
|
|
3877
|
+
{
|
|
3878
|
+
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",
|
|
3879
|
+
stroke: "#707070"
|
|
3880
|
+
}
|
|
3881
|
+
),
|
|
3882
|
+
/* @__PURE__ */ jsx(
|
|
3883
|
+
"path",
|
|
3884
|
+
{
|
|
3885
|
+
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",
|
|
3886
|
+
fill: "#A9A9A9"
|
|
3887
|
+
}
|
|
3888
|
+
),
|
|
3889
|
+
/* @__PURE__ */ jsx(
|
|
3890
|
+
"path",
|
|
3891
|
+
{
|
|
3892
|
+
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",
|
|
3893
|
+
fill: "#A9A9A9"
|
|
3894
|
+
}
|
|
3895
|
+
)
|
|
3896
|
+
] });
|
|
3897
|
+
|
|
3898
|
+
const ToolCoinIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "126", height: "85", viewBox: "0 0 126 85", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3899
|
+
/* @__PURE__ */ 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.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",
|
|
3903
|
+
fill: "#2E2E2E",
|
|
3904
|
+
fillOpacity: "0.9"
|
|
3905
|
+
}
|
|
3906
|
+
),
|
|
3907
|
+
/* @__PURE__ */ jsx(
|
|
3908
|
+
"path",
|
|
3909
|
+
{
|
|
3910
|
+
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",
|
|
3911
|
+
stroke: "#424242"
|
|
3912
|
+
}
|
|
3913
|
+
),
|
|
3914
|
+
/* @__PURE__ */ jsx(
|
|
3915
|
+
"path",
|
|
3916
|
+
{
|
|
3917
|
+
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",
|
|
3918
|
+
stroke: "#707070"
|
|
3919
|
+
}
|
|
3920
|
+
),
|
|
3921
|
+
/* @__PURE__ */ jsx(
|
|
3922
|
+
"path",
|
|
3923
|
+
{
|
|
3924
|
+
fillRule: "evenodd",
|
|
3925
|
+
clipRule: "evenodd",
|
|
3926
|
+
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",
|
|
3927
|
+
fill: "#A9A9A9"
|
|
3928
|
+
}
|
|
3929
|
+
)
|
|
3930
|
+
] });
|
|
3931
|
+
|
|
3932
|
+
const AgentNetworkCoinIcon = (props) => /* @__PURE__ */ jsxs("svg", { width: "126", height: "85", viewBox: "0 0 126 85", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
3933
|
+
/* @__PURE__ */ jsx(
|
|
3934
|
+
"path",
|
|
3935
|
+
{
|
|
3936
|
+
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",
|
|
3937
|
+
fill: "#2E2E2E",
|
|
3938
|
+
fillOpacity: "0.9"
|
|
3939
|
+
}
|
|
3940
|
+
),
|
|
3941
|
+
/* @__PURE__ */ jsx(
|
|
3942
|
+
"path",
|
|
3943
|
+
{
|
|
3944
|
+
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",
|
|
3945
|
+
stroke: "#424242"
|
|
3946
|
+
}
|
|
3947
|
+
),
|
|
3948
|
+
/* @__PURE__ */ jsx(
|
|
3949
|
+
"path",
|
|
3950
|
+
{
|
|
3951
|
+
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",
|
|
3952
|
+
stroke: "#707070"
|
|
3953
|
+
}
|
|
3954
|
+
),
|
|
3955
|
+
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip0_23333_14744)", children: /* @__PURE__ */ jsx(
|
|
3956
|
+
"path",
|
|
3957
|
+
{
|
|
3958
|
+
fillRule: "evenodd",
|
|
3959
|
+
clipRule: "evenodd",
|
|
3960
|
+
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",
|
|
3961
|
+
fill: "#A9A9A9"
|
|
3962
|
+
}
|
|
3963
|
+
) }),
|
|
3964
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_23333_14744", children: /* @__PURE__ */ jsx(
|
|
3965
|
+
"rect",
|
|
3966
|
+
{
|
|
3967
|
+
width: "59.3185",
|
|
3968
|
+
height: "59.3185",
|
|
3969
|
+
fill: "white",
|
|
3970
|
+
transform: "matrix(0.897148 0.441731 -0.897148 0.441731 65.3042 6.51953)"
|
|
3971
|
+
}
|
|
3972
|
+
) }) })
|
|
3973
|
+
] });
|
|
3974
|
+
|
|
3857
3975
|
const useCodemirrorTheme$1 = () => {
|
|
3858
3976
|
return useMemo(
|
|
3859
3977
|
() => draculaInit({
|
|
@@ -3950,8 +4068,156 @@ const AssistantActionBar = () => {
|
|
|
3950
4068
|
);
|
|
3951
4069
|
};
|
|
3952
4070
|
|
|
4071
|
+
const Dialog = DialogPrimitive.Root;
|
|
4072
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
4073
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
4074
|
+
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4075
|
+
DialogPrimitive.Overlay,
|
|
4076
|
+
{
|
|
4077
|
+
ref,
|
|
4078
|
+
className: cn(
|
|
4079
|
+
"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",
|
|
4080
|
+
className
|
|
4081
|
+
),
|
|
4082
|
+
...props
|
|
4083
|
+
}
|
|
4084
|
+
));
|
|
4085
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
4086
|
+
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
4087
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
4088
|
+
/* @__PURE__ */ jsxs(
|
|
4089
|
+
DialogPrimitive.Content,
|
|
4090
|
+
{
|
|
4091
|
+
ref,
|
|
4092
|
+
className: cn(
|
|
4093
|
+
"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",
|
|
4094
|
+
className
|
|
4095
|
+
),
|
|
4096
|
+
...props,
|
|
4097
|
+
children: [
|
|
4098
|
+
children,
|
|
4099
|
+
/* @__PURE__ */ jsxs(DialogPrimitive.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: [
|
|
4100
|
+
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
4101
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
4102
|
+
] })
|
|
4103
|
+
]
|
|
4104
|
+
}
|
|
4105
|
+
)
|
|
4106
|
+
] }));
|
|
4107
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
4108
|
+
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4109
|
+
DialogPrimitive.Title,
|
|
4110
|
+
{
|
|
4111
|
+
ref,
|
|
4112
|
+
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
4113
|
+
...props
|
|
4114
|
+
}
|
|
4115
|
+
));
|
|
4116
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
4117
|
+
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
4118
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
4119
|
+
|
|
4120
|
+
const useHasAttachments = () => {
|
|
4121
|
+
const composer = useComposerRuntime();
|
|
4122
|
+
const [hasAttachments, setHasAttachments] = useState(false);
|
|
4123
|
+
useEffect(() => {
|
|
4124
|
+
composer.subscribe(() => {
|
|
4125
|
+
const attachments = composer.getState().attachments;
|
|
4126
|
+
setHasAttachments(attachments.length > 0);
|
|
4127
|
+
});
|
|
4128
|
+
}, [composer]);
|
|
4129
|
+
return hasAttachments;
|
|
4130
|
+
};
|
|
4131
|
+
|
|
4132
|
+
const useFileSrc = (file) => {
|
|
4133
|
+
const [src, setSrc] = useState(void 0);
|
|
4134
|
+
useEffect(() => {
|
|
4135
|
+
if (!file) {
|
|
4136
|
+
setSrc(void 0);
|
|
4137
|
+
return;
|
|
4138
|
+
}
|
|
4139
|
+
const objectUrl = URL.createObjectURL(file);
|
|
4140
|
+
setSrc(objectUrl);
|
|
4141
|
+
return () => {
|
|
4142
|
+
URL.revokeObjectURL(objectUrl);
|
|
4143
|
+
};
|
|
4144
|
+
}, [file]);
|
|
4145
|
+
return src;
|
|
4146
|
+
};
|
|
4147
|
+
const useAttachmentSrc = () => {
|
|
4148
|
+
const { file, src } = useAttachment(
|
|
4149
|
+
useShallow((a) => {
|
|
4150
|
+
if (a.type !== "image") return {};
|
|
4151
|
+
if (a.file) return { file: a.file };
|
|
4152
|
+
const src2 = a.content?.filter((c) => c.type === "image")[0]?.image;
|
|
4153
|
+
if (!src2) return {};
|
|
4154
|
+
return { src: src2 };
|
|
4155
|
+
})
|
|
4156
|
+
);
|
|
4157
|
+
return useFileSrc(file) ?? src;
|
|
4158
|
+
};
|
|
4159
|
+
const AttachmentPreview = ({ src }) => {
|
|
4160
|
+
return /* @__PURE__ */ jsx("div", { className: "overflow-hidden w-full", children: /* @__PURE__ */ jsx("img", { src, className: "object-contain aspect-ratio h-full w-full", alt: "Preview" }) });
|
|
4161
|
+
};
|
|
4162
|
+
const AttachmentPreviewDialog = ({ children }) => {
|
|
4163
|
+
const src = useAttachmentSrc();
|
|
4164
|
+
if (!src) return children;
|
|
4165
|
+
return /* @__PURE__ */ jsxs(Dialog, { children: [
|
|
4166
|
+
/* @__PURE__ */ jsx(DialogTrigger, { className: "hover:bg-accent/50 cursor-pointer transition-colors", asChild: true, children }),
|
|
4167
|
+
/* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
4168
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
4169
|
+
/* @__PURE__ */ jsxs(DialogContent, { className: "max-w-5xl w-full max-h-[80%]", children: [
|
|
4170
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "aui-sr-only", children: "Image Attachment Preview" }),
|
|
4171
|
+
/* @__PURE__ */ jsx(AttachmentPreview, { src })
|
|
4172
|
+
] })
|
|
4173
|
+
] })
|
|
4174
|
+
] });
|
|
4175
|
+
};
|
|
4176
|
+
const AttachmentThumbnail = () => {
|
|
4177
|
+
const isImage = useAttachment((a) => a.type === "image");
|
|
4178
|
+
const src = useAttachmentSrc();
|
|
4179
|
+
const canRemove = useAttachment((a) => a.source !== "message");
|
|
4180
|
+
return /* @__PURE__ */ jsx(TooltipProvider$1, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4181
|
+
/* @__PURE__ */ jsxs(AttachmentPrimitive.Root, { className: "relative", children: [
|
|
4182
|
+
/* @__PURE__ */ jsx(AttachmentPreviewDialog, { children: /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: "h-full w-full aspect-ratio overflow-hidden rounded-lg", children: isImage ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border-sm border-border1 overflow-hidden", children: /* @__PURE__ */ jsx("img", { src, className: "object-cover aspect-ratio size-16", alt: "Preview", height: 64, width: 64 }) }) : /* @__PURE__ */ jsx("div", { className: "rounded-lg border-sm border-border1 flex items-center justify-center", children: /* @__PURE__ */ jsx(FileIcon, { className: "text-icon3" }) }) }) }) }),
|
|
4183
|
+
canRemove && /* @__PURE__ */ jsx(AttachmentRemove, {})
|
|
4184
|
+
] }),
|
|
4185
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "top", children: /* @__PURE__ */ jsx(AttachmentPrimitive.Name, {}) })
|
|
4186
|
+
] }) });
|
|
4187
|
+
};
|
|
4188
|
+
const AttachmentRemove = () => {
|
|
4189
|
+
return /* @__PURE__ */ jsx(AttachmentPrimitive.Remove, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
4190
|
+
TooltipIconButton,
|
|
4191
|
+
{
|
|
4192
|
+
tooltip: "Remove file",
|
|
4193
|
+
className: "absolute -right-3 -top-3 hover:bg-transparent rounded-full bg-surface1 rounded-full p-1",
|
|
4194
|
+
side: "top",
|
|
4195
|
+
children: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(CircleXIcon, {}) })
|
|
4196
|
+
}
|
|
4197
|
+
) });
|
|
4198
|
+
};
|
|
4199
|
+
const UserMessageAttachments = () => {
|
|
4200
|
+
return /* @__PURE__ */ jsx(MessagePrimitive.Attachments, { components: { Attachment: InMessageAttachment } });
|
|
4201
|
+
};
|
|
4202
|
+
const InMessageAttachment = () => {
|
|
4203
|
+
const isImage = useAttachment((a) => a.type === "image");
|
|
4204
|
+
const src = useAttachmentSrc();
|
|
4205
|
+
return /* @__PURE__ */ jsx(TooltipProvider$1, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4206
|
+
/* @__PURE__ */ jsx(AttachmentPrimitive.Root, { className: "relative pt-4", children: /* @__PURE__ */ jsx(AttachmentPreviewDialog, { children: /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: "h-full w-full aspect-ratio overflow-hidden rounded-lg", children: isImage ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border-sm border-border1 overflow-hidden", children: /* @__PURE__ */ jsx("img", { src, className: "object-cover aspect-ratio max-h-[140px] max-w-[320px]", alt: "Preview" }) }) : /* @__PURE__ */ jsx("div", { className: "rounded-lg border-sm border-border1 flex items-center justify-center", children: /* @__PURE__ */ jsx(FileIcon, { className: "text-icon3" }) }) }) }) }) }),
|
|
4207
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "top", children: /* @__PURE__ */ jsx(AttachmentPrimitive.Name, {}) })
|
|
4208
|
+
] }) });
|
|
4209
|
+
};
|
|
4210
|
+
const ComposerAttachments = () => {
|
|
4211
|
+
const hasAttachments = useHasAttachments();
|
|
4212
|
+
if (!hasAttachments) return null;
|
|
4213
|
+
return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-row items-center gap-4 h-24", children: /* @__PURE__ */ jsx(ComposerPrimitive.Attachments, { components: { Attachment: AttachmentThumbnail } }) });
|
|
4214
|
+
};
|
|
4215
|
+
|
|
3953
4216
|
const UserMessage = () => {
|
|
3954
|
-
return /* @__PURE__ */
|
|
4217
|
+
return /* @__PURE__ */ jsxs(MessagePrimitive.Root, { className: "w-full flex items-end pb-4 flex-col", children: [
|
|
4218
|
+
/* @__PURE__ */ jsx("div", { className: "max-w-[366px] px-5 py-3 text-icon6 text-ui-lg leading-ui-lg rounded-lg bg-surface3", children: /* @__PURE__ */ jsx(MessagePrimitive.Content, {}) }),
|
|
4219
|
+
/* @__PURE__ */ jsx(UserMessageAttachments, {})
|
|
4220
|
+
] });
|
|
3955
4221
|
};
|
|
3956
4222
|
|
|
3957
4223
|
const useAutoscroll = (ref, { enabled = true }) => {
|
|
@@ -4006,13 +4272,63 @@ const Txt = ({ as: Root = "p", className, variant = "ui-md", font, ...props }) =
|
|
|
4006
4272
|
return /* @__PURE__ */ jsx(Root, { className: clsx(variants[variant], font && fonts[font], className), ...props });
|
|
4007
4273
|
};
|
|
4008
4274
|
|
|
4009
|
-
const
|
|
4275
|
+
const useSpeechRecognition = ({ language = "en-US" } = {}) => {
|
|
4276
|
+
const speechRecognitionRef = useRef(null);
|
|
4277
|
+
const [state, setState] = useState({
|
|
4278
|
+
isListening: false,
|
|
4279
|
+
transcript: "",
|
|
4280
|
+
error: null
|
|
4281
|
+
});
|
|
4282
|
+
const start = () => {
|
|
4283
|
+
if (!speechRecognitionRef.current) return;
|
|
4284
|
+
speechRecognitionRef.current.start();
|
|
4285
|
+
};
|
|
4286
|
+
const stop = () => {
|
|
4287
|
+
if (!speechRecognitionRef.current) return;
|
|
4288
|
+
speechRecognitionRef.current.stop();
|
|
4289
|
+
};
|
|
4290
|
+
useEffect(() => {
|
|
4291
|
+
if (!("webkitSpeechRecognition" in window) && !("SpeechRecognition" in window)) {
|
|
4292
|
+
setState((prev) => ({ ...prev, error: "Speech Recognition not supported in this browser" }));
|
|
4293
|
+
return;
|
|
4294
|
+
}
|
|
4295
|
+
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
4296
|
+
const recognition = new SpeechRecognition();
|
|
4297
|
+
speechRecognitionRef.current = recognition;
|
|
4298
|
+
recognition.continuous = true;
|
|
4299
|
+
recognition.lang = language;
|
|
4300
|
+
recognition.onstart = () => {
|
|
4301
|
+
setState((prev) => ({ ...prev, isListening: true }));
|
|
4302
|
+
};
|
|
4303
|
+
recognition.onresult = (event) => {
|
|
4304
|
+
let finalTranscript = "";
|
|
4305
|
+
for (let i = event.resultIndex; i < event.results.length; i++) {
|
|
4306
|
+
const transcript = event.results[i][0].transcript;
|
|
4307
|
+
if (event.results[i].isFinal) {
|
|
4308
|
+
finalTranscript += transcript + " ";
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
setState((prev) => ({ ...prev, transcript: finalTranscript }));
|
|
4312
|
+
};
|
|
4313
|
+
recognition.onerror = (event) => {
|
|
4314
|
+
setState((prev) => ({ ...prev, error: `Error: ${event.error}` }));
|
|
4315
|
+
};
|
|
4316
|
+
recognition.onend = () => setState((prev) => ({ ...prev, isListening: false }));
|
|
4317
|
+
}, [language]);
|
|
4318
|
+
return {
|
|
4319
|
+
...state,
|
|
4320
|
+
start,
|
|
4321
|
+
stop
|
|
4322
|
+
};
|
|
4323
|
+
};
|
|
4324
|
+
|
|
4325
|
+
const Thread = ({ ToolFallback, agentName, hasMemory, showFileSupport }) => {
|
|
4010
4326
|
const areaRef = useRef(null);
|
|
4011
4327
|
useAutoscroll(areaRef, { enabled: true });
|
|
4012
4328
|
const WrappedAssistantMessage = (props) => {
|
|
4013
4329
|
return /* @__PURE__ */ jsx(AssistantMessage, { ...props, ToolFallback });
|
|
4014
4330
|
};
|
|
4015
|
-
return /* @__PURE__ */ jsxs(
|
|
4331
|
+
return /* @__PURE__ */ jsxs(ThreadWrapper, { children: [
|
|
4016
4332
|
/* @__PURE__ */ jsxs(ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
|
|
4017
4333
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
4018
4334
|
/* @__PURE__ */ jsx(ThreadWelcome, { agentName }),
|
|
@@ -4029,9 +4345,22 @@ const Thread = ({ ToolFallback, agentName, hasMemory }) => {
|
|
|
4029
4345
|
] }),
|
|
4030
4346
|
/* @__PURE__ */ jsx(ThreadPrimitive.If, { empty: false, children: /* @__PURE__ */ jsx("div", {}) })
|
|
4031
4347
|
] }),
|
|
4032
|
-
/* @__PURE__ */ jsx(Composer, { hasMemory })
|
|
4348
|
+
/* @__PURE__ */ jsx(Composer, { hasMemory, showFileSupport })
|
|
4033
4349
|
] });
|
|
4034
4350
|
};
|
|
4351
|
+
const ThreadWrapper = ({ children }) => {
|
|
4352
|
+
const hasAttachments = useHasAttachments();
|
|
4353
|
+
return /* @__PURE__ */ jsx(
|
|
4354
|
+
ThreadPrimitive.Root,
|
|
4355
|
+
{
|
|
4356
|
+
className: clsx(
|
|
4357
|
+
"max-w-[568px] w-full mx-auto px-4",
|
|
4358
|
+
hasAttachments ? "h-[calc(100%-208px)]" : "h-[calc(100%-112px)]"
|
|
4359
|
+
),
|
|
4360
|
+
children
|
|
4361
|
+
}
|
|
4362
|
+
);
|
|
4363
|
+
};
|
|
4035
4364
|
const ThreadWelcome = ({ agentName }) => {
|
|
4036
4365
|
const safeAgentName = agentName ?? "";
|
|
4037
4366
|
const words = safeAgentName.split(" ") ?? [];
|
|
@@ -4048,20 +4377,26 @@ const ThreadWelcome = ({ agentName }) => {
|
|
|
4048
4377
|
/* @__PURE__ */ jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
|
|
4049
4378
|
] }) });
|
|
4050
4379
|
};
|
|
4051
|
-
const Composer = ({ hasMemory }) => {
|
|
4380
|
+
const Composer = ({ hasMemory, showFileSupport }) => {
|
|
4052
4381
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4053
|
-
/* @__PURE__ */ jsxs(ComposerPrimitive.Root, {
|
|
4054
|
-
/* @__PURE__ */ jsx(
|
|
4055
|
-
|
|
4056
|
-
{
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4382
|
+
/* @__PURE__ */ jsxs(ComposerPrimitive.Root, { children: [
|
|
4383
|
+
/* @__PURE__ */ jsx(ComposerAttachments, {}),
|
|
4384
|
+
/* @__PURE__ */ jsxs("div", { className: "w-full bg-surface3 rounded-lg border-sm border-border1 px-3 py-4 mt-auto h-[100px]", children: [
|
|
4385
|
+
/* @__PURE__ */ jsx(ComposerPrimitive.Input, { asChild: true, className: "w-full", children: /* @__PURE__ */ jsx(
|
|
4386
|
+
"textarea",
|
|
4387
|
+
{
|
|
4388
|
+
className: "text-ui-lg leading-ui-lg placeholder:text-icon3 text-icon6 bg-transparent focus:outline-none resize-none",
|
|
4389
|
+
autoFocus: true,
|
|
4390
|
+
placeholder: "Enter your message...",
|
|
4391
|
+
name: "",
|
|
4392
|
+
id: ""
|
|
4393
|
+
}
|
|
4394
|
+
) }),
|
|
4395
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
4396
|
+
/* @__PURE__ */ jsx(SpeechInput, {}),
|
|
4397
|
+
/* @__PURE__ */ jsx(ComposerAction, { showFileSupport })
|
|
4398
|
+
] })
|
|
4399
|
+
] })
|
|
4065
4400
|
] }),
|
|
4066
4401
|
!hasMemory && /* @__PURE__ */ jsxs(Txt, { variant: "ui-sm", className: "text-icon3 flex items-center gap-2 pt-0.5", children: [
|
|
4067
4402
|
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(InfoIcon, {}) }),
|
|
@@ -4069,8 +4404,28 @@ const Composer = ({ hasMemory }) => {
|
|
|
4069
4404
|
] })
|
|
4070
4405
|
] });
|
|
4071
4406
|
};
|
|
4072
|
-
const
|
|
4407
|
+
const SpeechInput = () => {
|
|
4408
|
+
const composerRuntime = useComposerRuntime();
|
|
4409
|
+
const { start, stop, isListening, transcript } = useSpeechRecognition();
|
|
4410
|
+
useEffect(() => {
|
|
4411
|
+
if (!transcript) return;
|
|
4412
|
+
composerRuntime.setText(transcript);
|
|
4413
|
+
}, [composerRuntime, transcript]);
|
|
4414
|
+
return /* @__PURE__ */ jsx(
|
|
4415
|
+
TooltipIconButton,
|
|
4416
|
+
{
|
|
4417
|
+
type: "button",
|
|
4418
|
+
tooltip: isListening ? "Stop dictation" : "Start dictation",
|
|
4419
|
+
variant: "ghost",
|
|
4420
|
+
className: "rounded-full",
|
|
4421
|
+
onClick: () => isListening ? stop() : start(),
|
|
4422
|
+
children: isListening ? /* @__PURE__ */ jsx(CircleStopIcon, {}) : /* @__PURE__ */ jsx(Mic, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" })
|
|
4423
|
+
}
|
|
4424
|
+
);
|
|
4425
|
+
};
|
|
4426
|
+
const ComposerAction = ({ showFileSupport }) => {
|
|
4073
4427
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4428
|
+
showFileSupport && /* @__PURE__ */ jsx(ComposerPrimitive.AddAttachment, { asChild: true, children: /* @__PURE__ */ jsx(TooltipIconButton, { tooltip: "Add attachment", variant: "ghost", className: "rounded-full", children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-6 w-6 text-[#898989] hover:text-[#fff]" }) }) }),
|
|
4074
4429
|
/* @__PURE__ */ jsx(ThreadPrimitive.If, { running: false, children: /* @__PURE__ */ jsx(ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
4075
4430
|
TooltipIconButton,
|
|
4076
4431
|
{
|
|
@@ -4104,9 +4459,40 @@ const createMastraClient = (baseUrl) => {
|
|
|
4104
4459
|
});
|
|
4105
4460
|
};
|
|
4106
4461
|
|
|
4462
|
+
const fileToBase64 = async (file) => {
|
|
4463
|
+
return new Promise((resolve, reject) => {
|
|
4464
|
+
const reader = new FileReader();
|
|
4465
|
+
reader.onload = () => {
|
|
4466
|
+
const result = reader.result;
|
|
4467
|
+
if (typeof result === "string") {
|
|
4468
|
+
resolve(result);
|
|
4469
|
+
} else {
|
|
4470
|
+
reject(new Error("Failed to convert file to base64."));
|
|
4471
|
+
}
|
|
4472
|
+
};
|
|
4473
|
+
reader.onerror = (error) => {
|
|
4474
|
+
reject(error);
|
|
4475
|
+
};
|
|
4476
|
+
reader.readAsDataURL(file);
|
|
4477
|
+
});
|
|
4478
|
+
};
|
|
4479
|
+
|
|
4107
4480
|
const convertMessage$1 = (message) => {
|
|
4108
4481
|
return message;
|
|
4109
4482
|
};
|
|
4483
|
+
const convertToAIAttachments = async (attachments) => {
|
|
4484
|
+
const promises = attachments.filter((attachment) => attachment.file).map(async (attachment) => ({
|
|
4485
|
+
role: "user",
|
|
4486
|
+
content: [
|
|
4487
|
+
{
|
|
4488
|
+
type: "image",
|
|
4489
|
+
image: await fileToBase64(attachment.file),
|
|
4490
|
+
mimeType: attachment.file.type
|
|
4491
|
+
}
|
|
4492
|
+
]
|
|
4493
|
+
}));
|
|
4494
|
+
return Promise.all(promises);
|
|
4495
|
+
};
|
|
4110
4496
|
function MastraRuntimeProvider({
|
|
4111
4497
|
children,
|
|
4112
4498
|
agentId,
|
|
@@ -4159,8 +4545,12 @@ function MastraRuntimeProvider({
|
|
|
4159
4545
|
const agent = mastra.getAgent(agentId);
|
|
4160
4546
|
const onNew = async (message) => {
|
|
4161
4547
|
if (message.content[0]?.type !== "text") throw new Error("Only text messages are supported");
|
|
4548
|
+
const attachments = await convertToAIAttachments(message.attachments);
|
|
4162
4549
|
const input = message.content[0].text;
|
|
4163
|
-
setMessages((currentConversation) => [
|
|
4550
|
+
setMessages((currentConversation) => [
|
|
4551
|
+
...currentConversation,
|
|
4552
|
+
{ role: "user", content: input, attachments: message.attachments }
|
|
4553
|
+
]);
|
|
4164
4554
|
setIsRunning(true);
|
|
4165
4555
|
try {
|
|
4166
4556
|
if (chatWithGenerate) {
|
|
@@ -4169,7 +4559,8 @@ function MastraRuntimeProvider({
|
|
|
4169
4559
|
{
|
|
4170
4560
|
role: "user",
|
|
4171
4561
|
content: input
|
|
4172
|
-
}
|
|
4562
|
+
},
|
|
4563
|
+
...attachments
|
|
4173
4564
|
],
|
|
4174
4565
|
runId: agentId,
|
|
4175
4566
|
frequencyPenalty,
|
|
@@ -4278,7 +4669,8 @@ function MastraRuntimeProvider({
|
|
|
4278
4669
|
{
|
|
4279
4670
|
role: "user",
|
|
4280
4671
|
content: input
|
|
4281
|
-
}
|
|
4672
|
+
},
|
|
4673
|
+
...attachments
|
|
4282
4674
|
],
|
|
4283
4675
|
runId: agentId,
|
|
4284
4676
|
frequencyPenalty,
|
|
@@ -4399,7 +4791,10 @@ function MastraRuntimeProvider({
|
|
|
4399
4791
|
isRunning,
|
|
4400
4792
|
messages,
|
|
4401
4793
|
convertMessage: convertMessage$1,
|
|
4402
|
-
onNew
|
|
4794
|
+
onNew,
|
|
4795
|
+
adapters: {
|
|
4796
|
+
attachments: new CompositeAttachmentAdapter([new SimpleImageAttachmentAdapter()])
|
|
4797
|
+
}
|
|
4403
4798
|
});
|
|
4404
4799
|
return /* @__PURE__ */ jsxs(AssistantRuntimeProvider, { runtime, children: [
|
|
4405
4800
|
" ",
|
|
@@ -4481,7 +4876,8 @@ const AgentChat = ({
|
|
|
4481
4876
|
initialMessages,
|
|
4482
4877
|
memory,
|
|
4483
4878
|
baseUrl,
|
|
4484
|
-
refreshThreadList
|
|
4879
|
+
refreshThreadList,
|
|
4880
|
+
showFileSupport
|
|
4485
4881
|
}) => {
|
|
4486
4882
|
const { modelSettings, chatWithGenerate } = useContext(AgentContext);
|
|
4487
4883
|
const { runtimeContext } = usePlaygroundStore();
|
|
@@ -4498,7 +4894,7 @@ const AgentChat = ({
|
|
|
4498
4894
|
modelSettings,
|
|
4499
4895
|
chatWithGenerate,
|
|
4500
4896
|
runtimeContext,
|
|
4501
|
-
children: /* @__PURE__ */ jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsx(Thread, { agentName: agentName ?? "", hasMemory: memory }) })
|
|
4897
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-full pb-4 bg-surface1", children: /* @__PURE__ */ jsx(Thread, { agentName: agentName ?? "", hasMemory: memory, showFileSupport }) })
|
|
4502
4898
|
}
|
|
4503
4899
|
);
|
|
4504
4900
|
};
|
|
@@ -7160,54 +7556,6 @@ const Collapsible = CollapsiblePrimitive.Root;
|
|
|
7160
7556
|
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
7161
7557
|
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
7162
7558
|
|
|
7163
|
-
const Dialog = DialogPrimitive.Root;
|
|
7164
|
-
const DialogPortal = DialogPrimitive.Portal;
|
|
7165
|
-
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7166
|
-
DialogPrimitive.Overlay,
|
|
7167
|
-
{
|
|
7168
|
-
ref,
|
|
7169
|
-
className: cn(
|
|
7170
|
-
"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",
|
|
7171
|
-
className
|
|
7172
|
-
),
|
|
7173
|
-
...props
|
|
7174
|
-
}
|
|
7175
|
-
));
|
|
7176
|
-
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
7177
|
-
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
7178
|
-
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
7179
|
-
/* @__PURE__ */ jsxs(
|
|
7180
|
-
DialogPrimitive.Content,
|
|
7181
|
-
{
|
|
7182
|
-
ref,
|
|
7183
|
-
className: cn(
|
|
7184
|
-
"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",
|
|
7185
|
-
className
|
|
7186
|
-
),
|
|
7187
|
-
...props,
|
|
7188
|
-
children: [
|
|
7189
|
-
children,
|
|
7190
|
-
/* @__PURE__ */ jsxs(DialogPrimitive.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: [
|
|
7191
|
-
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
7192
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
7193
|
-
] })
|
|
7194
|
-
]
|
|
7195
|
-
}
|
|
7196
|
-
)
|
|
7197
|
-
] }));
|
|
7198
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
7199
|
-
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7200
|
-
DialogPrimitive.Title,
|
|
7201
|
-
{
|
|
7202
|
-
ref,
|
|
7203
|
-
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
7204
|
-
...props
|
|
7205
|
-
}
|
|
7206
|
-
));
|
|
7207
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
7208
|
-
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
7209
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
7210
|
-
|
|
7211
7559
|
const ScrollArea = React.forwardRef(
|
|
7212
7560
|
({ className, children, viewPortClassName, maxHeight, autoScroll = false, ...props }, ref) => {
|
|
7213
7561
|
const areaRef = React.useRef(null);
|
|
@@ -9183,6 +9531,21 @@ const EntityContent = ({ children, className }) => {
|
|
|
9183
9531
|
return /* @__PURE__ */ jsx("div", { className, children });
|
|
9184
9532
|
};
|
|
9185
9533
|
|
|
9534
|
+
const EmptyState = ({
|
|
9535
|
+
iconSlot,
|
|
9536
|
+
titleSlot,
|
|
9537
|
+
descriptionSlot,
|
|
9538
|
+
actionSlot,
|
|
9539
|
+
as: Component = "div"
|
|
9540
|
+
}) => {
|
|
9541
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex w-[340px] flex-col items-center justify-center text-center", children: [
|
|
9542
|
+
/* @__PURE__ */ jsx("div", { className: "h-auto [&>svg]:w-[126px]", children: iconSlot }),
|
|
9543
|
+
/* @__PURE__ */ jsx(Component, { className: "text-icon6 pt-[34px] font-serif text-[1.75rem] font-semibold", children: titleSlot }),
|
|
9544
|
+
/* @__PURE__ */ jsx(Txt, { variant: "ui-lg", className: "text-icon3 pb-[34px]", children: descriptionSlot }),
|
|
9545
|
+
actionSlot
|
|
9546
|
+
] });
|
|
9547
|
+
};
|
|
9548
|
+
|
|
9186
9549
|
function usePolling({
|
|
9187
9550
|
fetchFn,
|
|
9188
9551
|
interval = 3e3,
|
|
@@ -9337,5 +9700,5 @@ const useTraces = (componentName, baseUrl, isWorkflow = false) => {
|
|
|
9337
9700
|
return { traces, firstCallLoading, error };
|
|
9338
9701
|
};
|
|
9339
9702
|
|
|
9340
|
-
export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LogsIcon, MastraResizablePanel, McpServerIcon, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolsIcon, TraceContext, TraceIcon, TraceProvider, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger, refineTraces, usePlaygroundStore, usePolling, useTraces };
|
|
9703
|
+
export { AgentChat, AgentCoinIcon, AgentContext, AgentEvals, AgentIcon, AgentNetworkCoinIcon, AgentProvider, AgentTraces, AiIcon, ApiIcon, Badge$1 as Badge, BranchIcon, Breadcrumb, Button, Cell, CheckIcon, ChevronIcon, CommitIcon, CrossIcon, Crumb, DarkLogo, DataTable, DateTimeCell, DbIcon, DebugIcon, DeploymentIcon, DividerIcon, DocsIcon, DynamicForm, EmptyState, Entity, EntityContent, EntityDescription, EntityIcon, EntityName, EntryCell, EnvIcon, EvaluatorCoinIcon, FiltersIcon, FolderIcon, GithubCoinIcon, GithubIcon, GoogleIcon, Header, HeaderAction, HeaderGroup, HeaderTitle, HomeIcon, Icon, InfoIcon, JudgeIcon, LatencyIcon, LegacyWorkflowGraph, LegacyWorkflowTrigger, LogsIcon, MastraResizablePanel, McpCoinIcon, McpServerIcon, MemoryIcon, NetworkChat, NetworkContext, NetworkProvider, OpenAIIcon, PromptIcon, RepoIcon, Row, ScoreIcon, SettingsIcon, SlashIcon, Table, Tbody, Th, Thead, ThreadDeleteButton, ThreadItem, ThreadLink, ThreadList, Threads, ToolCoinIcon, ToolsIcon, TraceContext, TraceIcon, TraceProvider, TsIcon, Txt, TxtCell, UnitCell, VariablesIcon, WorkflowCoinIcon, WorkflowGraph, WorkflowIcon, WorkflowRunContext, WorkflowRunProvider, WorkflowTraces, WorkflowTrigger, refineTraces, usePlaygroundStore, usePolling, useSpeechRecognition, useTraces };
|
|
9341
9704
|
//# sourceMappingURL=index.es.js.map
|