@mieweb/ui 0.11.0-dev.49 → 0.11.0-dev.50
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/{chunk-HIYQ3M5V.cjs → chunk-2Y2O2PRZ.cjs} +3 -3
- package/dist/chunk-2Y2O2PRZ.cjs.map +1 -0
- package/dist/{chunk-O2EAHOXM.cjs → chunk-G56OUIGH.cjs} +482 -29
- package/dist/chunk-G56OUIGH.cjs.map +1 -0
- package/dist/chunk-GEXYN6AS.cjs +56 -0
- package/dist/chunk-GEXYN6AS.cjs.map +1 -0
- package/dist/{chunk-OGNADPM4.cjs → chunk-GQONYSGI.cjs} +10 -2
- package/dist/chunk-GQONYSGI.cjs.map +1 -0
- package/dist/{chunk-IZY4CMOO.js → chunk-H7L45BLY.js} +13 -24
- package/dist/chunk-H7L45BLY.js.map +1 -0
- package/dist/{chunk-MZA2LDS4.js → chunk-I65QJMFB.js} +4 -4
- package/dist/{chunk-MZA2LDS4.js.map → chunk-I65QJMFB.js.map} +1 -1
- package/dist/{chunk-NB2C6FSI.js → chunk-L3JA7EDU.js} +20 -3
- package/dist/{chunk-NB2C6FSI.js.map → chunk-L3JA7EDU.js.map} +1 -1
- package/dist/{chunk-UIFN2LYT.js → chunk-O3MN3TYS.js} +483 -32
- package/dist/chunk-O3MN3TYS.js.map +1 -0
- package/dist/{chunk-74ENCTIK.js → chunk-R25E7SYN.js} +9 -3
- package/dist/chunk-R25E7SYN.js.map +1 -0
- package/dist/{chunk-TRZLN32I.cjs → chunk-RDERYV5M.cjs} +14 -25
- package/dist/chunk-RDERYV5M.cjs.map +1 -0
- package/dist/{chunk-BFVYM6IT.cjs → chunk-TLXQ2E57.cjs} +6 -6
- package/dist/{chunk-BFVYM6IT.cjs.map → chunk-TLXQ2E57.cjs.map} +1 -1
- package/dist/{chunk-MQOYDQTF.js → chunk-URHUNFFC.js} +3 -3
- package/dist/chunk-URHUNFFC.js.map +1 -0
- package/dist/chunk-WSLKELR2.js +51 -0
- package/dist/chunk-WSLKELR2.js.map +1 -0
- package/dist/{chunk-5UKGOBCZ.cjs → chunk-XWGPEIVB.cjs} +20 -3
- package/dist/{chunk-5UKGOBCZ.cjs.map → chunk-XWGPEIVB.cjs.map} +1 -1
- package/dist/components/DictationButton/index.cjs +5 -5
- package/dist/components/DictationButton/index.js +2 -2
- package/dist/components/RecordButton/index.cjs +4 -4
- package/dist/components/RecordButton/index.d.cts +2 -2
- package/dist/components/RecordButton/index.d.ts +2 -2
- package/dist/components/RecordButton/index.js +1 -1
- package/dist/components/SuperChat/index.cjs +9 -7
- package/dist/components/SuperChat/index.cjs.map +1 -1
- package/dist/components/SuperChat/index.d.cts +2 -2
- package/dist/components/SuperChat/index.d.ts +2 -2
- package/dist/components/SuperChat/index.js +3 -1
- package/dist/components/SuperChat/index.js.map +1 -1
- package/dist/components/SuperChat/plugins/index.d.cts +2 -2
- package/dist/components/SuperChat/plugins/index.d.ts +2 -2
- package/dist/{hey-buddy-AHUHCDBC.js → hey-buddy-6HXWNHK2.js} +12 -7
- package/dist/hey-buddy-6HXWNHK2.js.map +1 -0
- package/dist/{hey-buddy-5WOBYZRJ.cjs → hey-buddy-BAS5O4AY.cjs} +12 -7
- package/dist/hey-buddy-BAS5O4AY.cjs.map +1 -0
- package/dist/index.cjs +2037 -1255
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +207 -14
- package/dist/index.d.ts +207 -14
- package/dist/index.js +1851 -1082
- package/dist/index.js.map +1 -1
- package/dist/{speaker-verify-4NEJAK6C.cjs → speaker-verify-PWTYV4JZ.cjs} +10 -10
- package/dist/{speaker-verify-4NEJAK6C.cjs.map → speaker-verify-PWTYV4JZ.cjs.map} +1 -1
- package/dist/{speaker-verify-AWSKI6DI.js → speaker-verify-REFWMPTD.js} +3 -3
- package/dist/{speaker-verify-AWSKI6DI.js.map → speaker-verify-REFWMPTD.js.map} +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind-preset.cjs +4 -4
- package/dist/tailwind-preset.js +1 -1
- package/dist/{types-BfVolads.d.ts → types-ByK_dbT7.d.cts} +13 -2
- package/dist/{types-BfVolads.d.cts → types-ByK_dbT7.d.ts} +13 -2
- package/dist/whisperTranscribe-QV2EQRCD.js +5 -0
- package/dist/{whisperTranscribe-UBNUWXUQ.js.map → whisperTranscribe-QV2EQRCD.js.map} +1 -1
- package/dist/{whisperTranscribe-AV752TZI.cjs → whisperTranscribe-XL365FM4.cjs} +26 -21
- package/dist/{whisperTranscribe-AV752TZI.cjs.map → whisperTranscribe-XL365FM4.cjs.map} +1 -1
- package/package.json +2 -2
- package/dist/chunk-74ENCTIK.js.map +0 -1
- package/dist/chunk-HIYQ3M5V.cjs.map +0 -1
- package/dist/chunk-IZY4CMOO.js.map +0 -1
- package/dist/chunk-MQOYDQTF.js.map +0 -1
- package/dist/chunk-O2EAHOXM.cjs.map +0 -1
- package/dist/chunk-OGNADPM4.cjs.map +0 -1
- package/dist/chunk-TRZLN32I.cjs.map +0 -1
- package/dist/chunk-UIFN2LYT.js.map +0 -1
- package/dist/hey-buddy-5WOBYZRJ.cjs.map +0 -1
- package/dist/hey-buddy-AHUHCDBC.js.map +0 -1
- package/dist/whisperTranscribe-UBNUWXUQ.js +0 -4
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkVXW7D5LR_cjs = require('./chunk-VXW7D5LR.cjs');
|
|
3
4
|
var chunkZ7ZOSENN_cjs = require('./chunk-Z7ZOSENN.cjs');
|
|
5
|
+
var chunkXXVUHLQN_cjs = require('./chunk-XXVUHLQN.cjs');
|
|
6
|
+
var chunk7E46YDOT_cjs = require('./chunk-7E46YDOT.cjs');
|
|
7
|
+
var chunkYW2AKBLS_cjs = require('./chunk-YW2AKBLS.cjs');
|
|
8
|
+
var chunkFSARTLUE_cjs = require('./chunk-FSARTLUE.cjs');
|
|
9
|
+
var chunkIEY3ZJIT_cjs = require('./chunk-IEY3ZJIT.cjs');
|
|
4
10
|
var chunkS5RVSXDV_cjs = require('./chunk-S5RVSXDV.cjs');
|
|
5
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
12
|
var React2 = require('react');
|
|
@@ -295,10 +301,13 @@ var statusIconVariants = classVarianceAuthority.cva(
|
|
|
295
301
|
variants: {
|
|
296
302
|
status: {
|
|
297
303
|
pending: "bg-neutral-200 dark:bg-neutral-700",
|
|
304
|
+
"awaiting-approval": "bg-amber-100 dark:bg-amber-900/50",
|
|
298
305
|
running: "bg-primary-100 dark:bg-primary-900/50",
|
|
299
306
|
success: "bg-green-100 dark:bg-green-900/50",
|
|
300
307
|
error: "bg-red-100 dark:bg-red-900/50",
|
|
301
|
-
cancelled: "bg-neutral-200 dark:bg-neutral-700"
|
|
308
|
+
cancelled: "bg-neutral-200 dark:bg-neutral-700",
|
|
309
|
+
denied: "bg-neutral-200 dark:bg-neutral-700",
|
|
310
|
+
expired: "bg-neutral-200 dark:bg-neutral-700"
|
|
302
311
|
}
|
|
303
312
|
},
|
|
304
313
|
defaultVariants: {
|
|
@@ -323,6 +332,25 @@ function ToolStatusIcon({ status, className }) {
|
|
|
323
332
|
children: /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "10", cy: "10", r: "3" })
|
|
324
333
|
}
|
|
325
334
|
),
|
|
335
|
+
status === "awaiting-approval" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
336
|
+
"svg",
|
|
337
|
+
{
|
|
338
|
+
"aria-hidden": "true",
|
|
339
|
+
className: "h-3 w-3 text-amber-600 dark:text-amber-400",
|
|
340
|
+
fill: "none",
|
|
341
|
+
viewBox: "0 0 24 24",
|
|
342
|
+
stroke: "currentColor",
|
|
343
|
+
strokeWidth: "3",
|
|
344
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
345
|
+
"path",
|
|
346
|
+
{
|
|
347
|
+
strokeLinecap: "round",
|
|
348
|
+
strokeLinejoin: "round",
|
|
349
|
+
d: "M12 7v6m0 4h.01"
|
|
350
|
+
}
|
|
351
|
+
)
|
|
352
|
+
}
|
|
353
|
+
),
|
|
326
354
|
status === "running" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
327
355
|
"svg",
|
|
328
356
|
{
|
|
@@ -391,7 +419,7 @@ function ToolStatusIcon({ status, className }) {
|
|
|
391
419
|
)
|
|
392
420
|
}
|
|
393
421
|
),
|
|
394
|
-
status === "cancelled" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
422
|
+
(status === "cancelled" || status === "denied" || status === "expired") && /* @__PURE__ */ jsxRuntime.jsx(
|
|
395
423
|
"svg",
|
|
396
424
|
{
|
|
397
425
|
"aria-hidden": "true",
|
|
@@ -772,6 +800,14 @@ function ToolResultDisplay({
|
|
|
772
800
|
}
|
|
773
801
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkS5RVSXDV_cjs.cn("space-y-2", className), children: [
|
|
774
802
|
result.summary && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-700 dark:text-neutral-300", children: result.summary }),
|
|
803
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolResultLinks, { result, onLinkClick })
|
|
804
|
+
] });
|
|
805
|
+
}
|
|
806
|
+
function hasToolResultLinks(result) {
|
|
807
|
+
return Boolean(result?.link || result?.resources?.length);
|
|
808
|
+
}
|
|
809
|
+
function ToolResultLinks({ result, onLinkClick }) {
|
|
810
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
775
811
|
result.link && /* @__PURE__ */ jsxRuntime.jsx(ResourceLink, { link: result.link, onClick: onLinkClick }),
|
|
776
812
|
result.resources && result.resources.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: result.resources.map((resource) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
777
813
|
ResourceLink,
|
|
@@ -853,10 +889,13 @@ function getParameterSummary(toolName, params) {
|
|
|
853
889
|
}
|
|
854
890
|
var statusPillClasses = {
|
|
855
891
|
pending: "bg-neutral-100 border-neutral-200 text-neutral-600 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-400",
|
|
892
|
+
"awaiting-approval": "bg-amber-50 border-amber-200 text-amber-800 dark:bg-amber-900/20 dark:border-amber-800 dark:text-amber-300",
|
|
856
893
|
running: "bg-primary-50 border-primary-200 text-primary-800 dark:bg-primary-900/20 dark:border-primary-800 dark:text-primary-300",
|
|
857
894
|
success: "bg-green-50 border-green-200 text-green-700 dark:bg-green-900/20 dark:border-green-800 dark:text-green-300",
|
|
858
895
|
error: "bg-red-50 border-red-200 text-red-700 dark:bg-red-900/20 dark:border-red-800 dark:text-red-300",
|
|
859
|
-
cancelled: "bg-neutral-100 border-neutral-200 text-neutral-400 opacity-60 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-400"
|
|
896
|
+
cancelled: "bg-neutral-100 border-neutral-200 text-neutral-400 opacity-60 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-400",
|
|
897
|
+
denied: "bg-neutral-100 border-neutral-200 text-neutral-400 opacity-60 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-400",
|
|
898
|
+
expired: "bg-neutral-100 border-neutral-200 text-neutral-400 opacity-60 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-400"
|
|
860
899
|
};
|
|
861
900
|
function MCPToolCallDisplay({
|
|
862
901
|
toolCall,
|
|
@@ -959,6 +998,381 @@ function MCPToolCallDisplay({
|
|
|
959
998
|
] })
|
|
960
999
|
) });
|
|
961
1000
|
}
|
|
1001
|
+
var plural = (count, one, other) => count === 1 ? one : other;
|
|
1002
|
+
var defaultMCPToolCallGroupLabels = {
|
|
1003
|
+
used: (count) => `Used ${count} ${plural(count, "tool", "tools")}`,
|
|
1004
|
+
running: (count) => `Running ${count} ${plural(count, "tool", "tools")}`,
|
|
1005
|
+
needsApproval: (count) => `${count} ${plural(count, "needs", "need")} approval`,
|
|
1006
|
+
failed: (count) => `${count} failed`,
|
|
1007
|
+
announceApproval: (count) => `${count} tool ${plural(count, "call needs", "calls need")} your approval`,
|
|
1008
|
+
announceFailed: (count) => `${count} tool ${plural(count, "call", "calls")} failed`,
|
|
1009
|
+
status: {
|
|
1010
|
+
pending: "Pending",
|
|
1011
|
+
"awaiting-approval": "Needs approval",
|
|
1012
|
+
running: "Running",
|
|
1013
|
+
success: "Done",
|
|
1014
|
+
error: "Failed",
|
|
1015
|
+
cancelled: "Cancelled",
|
|
1016
|
+
denied: "Denied",
|
|
1017
|
+
expired: "Expired"
|
|
1018
|
+
},
|
|
1019
|
+
callLabel: (toolCall) => toolCall.serverName ? `Tool call: ${toolCall.toolName} from ${toolCall.serverName}` : `Tool call: ${toolCall.toolName}`,
|
|
1020
|
+
showResult: "Show result",
|
|
1021
|
+
showError: "Show error",
|
|
1022
|
+
allowOnce: "Allow once",
|
|
1023
|
+
allowAlways: "Always allow",
|
|
1024
|
+
deny: "Deny"
|
|
1025
|
+
};
|
|
1026
|
+
function resolveLabels(overrides) {
|
|
1027
|
+
if (!overrides) return defaultMCPToolCallGroupLabels;
|
|
1028
|
+
return {
|
|
1029
|
+
...defaultMCPToolCallGroupLabels,
|
|
1030
|
+
...overrides,
|
|
1031
|
+
status: { ...defaultMCPToolCallGroupLabels.status, ...overrides.status }
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
function needsAttention(toolCall) {
|
|
1035
|
+
return toolCall.status === "awaiting-approval" || toolCall.status === "error";
|
|
1036
|
+
}
|
|
1037
|
+
function summarize(toolCalls) {
|
|
1038
|
+
let failed = 0;
|
|
1039
|
+
let inFlight = 0;
|
|
1040
|
+
const awaitingIds = [];
|
|
1041
|
+
for (const toolCall of toolCalls) {
|
|
1042
|
+
if (toolCall.status === "awaiting-approval") awaitingIds.push(toolCall.id);
|
|
1043
|
+
else if (toolCall.status === "error") failed += 1;
|
|
1044
|
+
else if (toolCall.status === "running" || toolCall.status === "pending")
|
|
1045
|
+
inFlight += 1;
|
|
1046
|
+
}
|
|
1047
|
+
return {
|
|
1048
|
+
total: toolCalls.length,
|
|
1049
|
+
awaitingApproval: awaitingIds.length,
|
|
1050
|
+
failed,
|
|
1051
|
+
isActive: awaitingIds.length + inFlight > 0,
|
|
1052
|
+
signature: toolCalls.map((call) => `${call.id}:${call.status}`).join("|"),
|
|
1053
|
+
approvalKey: awaitingIds.join("|")
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
function useAutoCollapse(isActive, signature, focus) {
|
|
1057
|
+
const [state, setState] = React2__namespace.useState(() => ({
|
|
1058
|
+
signature,
|
|
1059
|
+
expanded: isActive,
|
|
1060
|
+
deferred: false
|
|
1061
|
+
}));
|
|
1062
|
+
let next = state;
|
|
1063
|
+
if (state.signature !== signature) {
|
|
1064
|
+
const expanded = isActive || focus === "rows";
|
|
1065
|
+
next = { signature, expanded, deferred: expanded !== isActive };
|
|
1066
|
+
} else if (state.deferred && focus === null) {
|
|
1067
|
+
next = { signature, expanded: isActive, deferred: false };
|
|
1068
|
+
}
|
|
1069
|
+
if (next !== state) setState(next);
|
|
1070
|
+
const setExpanded = React2__namespace.useCallback(
|
|
1071
|
+
(expanded) => setState((current) => ({ ...current, expanded, deferred: false })),
|
|
1072
|
+
[]
|
|
1073
|
+
);
|
|
1074
|
+
return [next.expanded, setExpanded];
|
|
1075
|
+
}
|
|
1076
|
+
function progressAnnouncement(summary, labels) {
|
|
1077
|
+
if (summary.awaitingApproval > 0) {
|
|
1078
|
+
return labels.announceApproval(summary.awaitingApproval);
|
|
1079
|
+
}
|
|
1080
|
+
if (summary.isActive) return labels.running(summary.total);
|
|
1081
|
+
return labels.used(summary.total);
|
|
1082
|
+
}
|
|
1083
|
+
var STATUS_BADGE_VARIANT = {
|
|
1084
|
+
pending: "secondary",
|
|
1085
|
+
"awaiting-approval": "warning",
|
|
1086
|
+
running: "default",
|
|
1087
|
+
success: "success",
|
|
1088
|
+
error: "danger",
|
|
1089
|
+
cancelled: "secondary",
|
|
1090
|
+
denied: "secondary",
|
|
1091
|
+
expired: "secondary"
|
|
1092
|
+
};
|
|
1093
|
+
function formatParameters(toolCall) {
|
|
1094
|
+
return JSON.stringify(
|
|
1095
|
+
Object.fromEntries(toolCall.parameters.map((p) => [p.name, p.value])),
|
|
1096
|
+
null,
|
|
1097
|
+
2
|
|
1098
|
+
);
|
|
1099
|
+
}
|
|
1100
|
+
function formatData(data) {
|
|
1101
|
+
return typeof data === "string" ? data : JSON.stringify(data, null, 2);
|
|
1102
|
+
}
|
|
1103
|
+
function formatResult(toolCall) {
|
|
1104
|
+
const { result } = toolCall;
|
|
1105
|
+
if (!result) return null;
|
|
1106
|
+
return result.summary || formatData(result.data);
|
|
1107
|
+
}
|
|
1108
|
+
function formatError(toolCall) {
|
|
1109
|
+
if (toolCall.error) return toolCall.error;
|
|
1110
|
+
const { result } = toolCall;
|
|
1111
|
+
if (result?.type !== "error") return null;
|
|
1112
|
+
if (result.data != null && result.data !== "") return formatData(result.data);
|
|
1113
|
+
return result.summary || null;
|
|
1114
|
+
}
|
|
1115
|
+
function OutputDisclosure({ label, text }) {
|
|
1116
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(chunkVXW7D5LR_cjs.Collapsible, { children: [
|
|
1117
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkVXW7D5LR_cjs.CollapsibleTrigger, { className: "flex items-center gap-1 text-xs font-medium text-neutral-600 hover:text-neutral-800 dark:text-neutral-400 dark:hover:text-neutral-200", children: [
|
|
1118
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1119
|
+
lucideReact.ChevronDown,
|
|
1120
|
+
{
|
|
1121
|
+
"aria-hidden": "true",
|
|
1122
|
+
className: "h-3 w-3 transition-transform motion-reduce:transition-none [[data-state=open]>&]:rotate-180"
|
|
1123
|
+
}
|
|
1124
|
+
),
|
|
1125
|
+
label
|
|
1126
|
+
] }),
|
|
1127
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVXW7D5LR_cjs.CollapsibleContent, { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1128
|
+
"pre",
|
|
1129
|
+
{
|
|
1130
|
+
dir: "auto",
|
|
1131
|
+
className: "max-h-60 overflow-auto rounded bg-neutral-100 p-2 text-xs whitespace-pre-wrap dark:bg-neutral-900",
|
|
1132
|
+
children: text
|
|
1133
|
+
}
|
|
1134
|
+
) })
|
|
1135
|
+
] });
|
|
1136
|
+
}
|
|
1137
|
+
function ToolCallRow({
|
|
1138
|
+
toolCall,
|
|
1139
|
+
labels,
|
|
1140
|
+
onApprove,
|
|
1141
|
+
onDeny,
|
|
1142
|
+
onLinkClick
|
|
1143
|
+
}) {
|
|
1144
|
+
const prefersReducedMotion = chunkYW2AKBLS_cjs.usePrefersReducedMotion();
|
|
1145
|
+
const [acting, setActing] = React2__namespace.useState(false);
|
|
1146
|
+
const triggerRef = React2__namespace.useRef(null);
|
|
1147
|
+
const focusInActionsRef = React2__namespace.useRef(false);
|
|
1148
|
+
const isAwaitingApproval = toolCall.status === "awaiting-approval";
|
|
1149
|
+
const result = toolCall.result?.type === "error" ? null : formatResult(toolCall);
|
|
1150
|
+
const errorText = formatError(toolCall);
|
|
1151
|
+
const hasLinks = hasToolResultLinks(toolCall.result);
|
|
1152
|
+
const hasDetails = toolCall.parameters.length > 0 || Boolean(result) || hasLinks;
|
|
1153
|
+
const act = async (action) => {
|
|
1154
|
+
setActing(true);
|
|
1155
|
+
try {
|
|
1156
|
+
await action();
|
|
1157
|
+
} catch {
|
|
1158
|
+
} finally {
|
|
1159
|
+
setActing(false);
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
React2__namespace.useLayoutEffect(() => {
|
|
1163
|
+
if (isAwaitingApproval || !focusInActionsRef.current) return;
|
|
1164
|
+
focusInActionsRef.current = false;
|
|
1165
|
+
if (!document.activeElement || document.activeElement === document.body) {
|
|
1166
|
+
triggerRef.current?.focus();
|
|
1167
|
+
}
|
|
1168
|
+
}, [isAwaitingApproval]);
|
|
1169
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1170
|
+
chunkIEY3ZJIT_cjs.Animated,
|
|
1171
|
+
{
|
|
1172
|
+
preset: "collapse",
|
|
1173
|
+
mode: "presence",
|
|
1174
|
+
enabled: !prefersReducedMotion,
|
|
1175
|
+
role: "listitem",
|
|
1176
|
+
"data-slot": "ai-tool-call-row",
|
|
1177
|
+
className: "overflow-hidden text-sm",
|
|
1178
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "group", "aria-label": labels.callLabel(toolCall), children: [
|
|
1179
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkVXW7D5LR_cjs.Collapsible, { defaultOpen: isAwaitingApproval && hasDetails, children: [
|
|
1180
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1181
|
+
chunkVXW7D5LR_cjs.CollapsibleTrigger,
|
|
1182
|
+
{
|
|
1183
|
+
ref: triggerRef,
|
|
1184
|
+
className: "focus-visible:ring-primary-500 flex w-full min-w-0 items-center gap-2 rounded px-1.5 py-1 text-start hover:bg-neutral-100 focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset dark:hover:bg-neutral-800",
|
|
1185
|
+
children: [
|
|
1186
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1187
|
+
"span",
|
|
1188
|
+
{
|
|
1189
|
+
"aria-hidden": "true",
|
|
1190
|
+
className: "flex h-3.5 w-3.5 shrink-0 items-center justify-center text-neutral-500 [&_svg]:h-3.5 [&_svg]:w-3.5",
|
|
1191
|
+
children: toolCall.icon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wrench, {})
|
|
1192
|
+
}
|
|
1193
|
+
),
|
|
1194
|
+
toolCall.serverName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-neutral-500 dark:text-neutral-400", children: toolCall.serverName }),
|
|
1195
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { className: "min-w-0 truncate font-mono text-xs", children: toolCall.toolName }),
|
|
1196
|
+
toolCall.status === "running" && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(chunkXXVUHLQN_cjs.Spinner, { size: "xs" }) }),
|
|
1197
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1198
|
+
chunk7E46YDOT_cjs.Badge,
|
|
1199
|
+
{
|
|
1200
|
+
variant: STATUS_BADGE_VARIANT[toolCall.status],
|
|
1201
|
+
size: "sm",
|
|
1202
|
+
className: "ms-auto shrink-0",
|
|
1203
|
+
children: labels.status[toolCall.status]
|
|
1204
|
+
}
|
|
1205
|
+
),
|
|
1206
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1207
|
+
lucideReact.ChevronDown,
|
|
1208
|
+
{
|
|
1209
|
+
"aria-hidden": "true",
|
|
1210
|
+
className: "h-3.5 w-3.5 shrink-0 text-neutral-400 transition-transform motion-reduce:transition-none [[data-state=open]>&]:rotate-180"
|
|
1211
|
+
}
|
|
1212
|
+
)
|
|
1213
|
+
]
|
|
1214
|
+
}
|
|
1215
|
+
),
|
|
1216
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkVXW7D5LR_cjs.CollapsibleContent, { className: "ms-6 mt-1 space-y-2 pb-1", children: [
|
|
1217
|
+
toolCall.result && hasLinks && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1218
|
+
ToolResultLinks,
|
|
1219
|
+
{
|
|
1220
|
+
result: toolCall.result,
|
|
1221
|
+
onLinkClick
|
|
1222
|
+
}
|
|
1223
|
+
),
|
|
1224
|
+
toolCall.parameters.length > 0 && // JSON keeps its left-to-right order in RTL documents.
|
|
1225
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1226
|
+
"pre",
|
|
1227
|
+
{
|
|
1228
|
+
dir: "ltr",
|
|
1229
|
+
className: "max-h-40 overflow-auto rounded bg-neutral-100 p-2 text-xs dark:bg-neutral-900",
|
|
1230
|
+
children: formatParameters(toolCall)
|
|
1231
|
+
}
|
|
1232
|
+
),
|
|
1233
|
+
result && /* @__PURE__ */ jsxRuntime.jsx(OutputDisclosure, { label: labels.showResult, text: result }),
|
|
1234
|
+
errorText && /* @__PURE__ */ jsxRuntime.jsx(OutputDisclosure, { label: labels.showError, text: errorText })
|
|
1235
|
+
] })
|
|
1236
|
+
] }),
|
|
1237
|
+
toolCall.status === "error" && errorText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ms-6 line-clamp-2 text-xs text-red-600 dark:text-red-400", children: errorText }),
|
|
1238
|
+
isAwaitingApproval && (onApprove || onDeny) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1239
|
+
"div",
|
|
1240
|
+
{
|
|
1241
|
+
className: "ms-6 mt-1 flex flex-wrap gap-2 pb-1",
|
|
1242
|
+
onFocus: () => {
|
|
1243
|
+
focusInActionsRef.current = true;
|
|
1244
|
+
},
|
|
1245
|
+
onBlur: (event) => {
|
|
1246
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
1247
|
+
focusInActionsRef.current = false;
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
children: [
|
|
1251
|
+
onApprove && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1252
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1253
|
+
chunkFSARTLUE_cjs.Button,
|
|
1254
|
+
{
|
|
1255
|
+
size: "sm",
|
|
1256
|
+
onClick: () => void act(() => onApprove(toolCall, { always: false })),
|
|
1257
|
+
disabled: acting,
|
|
1258
|
+
isLoading: acting,
|
|
1259
|
+
children: labels.allowOnce
|
|
1260
|
+
}
|
|
1261
|
+
),
|
|
1262
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1263
|
+
chunkFSARTLUE_cjs.Button,
|
|
1264
|
+
{
|
|
1265
|
+
size: "sm",
|
|
1266
|
+
variant: "outline",
|
|
1267
|
+
onClick: () => void act(() => onApprove(toolCall, { always: true })),
|
|
1268
|
+
disabled: acting,
|
|
1269
|
+
children: labels.allowAlways
|
|
1270
|
+
}
|
|
1271
|
+
)
|
|
1272
|
+
] }),
|
|
1273
|
+
onDeny && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1274
|
+
chunkFSARTLUE_cjs.Button,
|
|
1275
|
+
{
|
|
1276
|
+
size: "sm",
|
|
1277
|
+
variant: "danger",
|
|
1278
|
+
onClick: () => void act(() => onDeny(toolCall)),
|
|
1279
|
+
disabled: acting,
|
|
1280
|
+
children: labels.deny
|
|
1281
|
+
}
|
|
1282
|
+
)
|
|
1283
|
+
]
|
|
1284
|
+
}
|
|
1285
|
+
)
|
|
1286
|
+
] })
|
|
1287
|
+
}
|
|
1288
|
+
);
|
|
1289
|
+
}
|
|
1290
|
+
function MCPToolCallGroup({
|
|
1291
|
+
toolCalls,
|
|
1292
|
+
onApprove,
|
|
1293
|
+
onDeny,
|
|
1294
|
+
onLinkClick,
|
|
1295
|
+
labels: labelOverrides,
|
|
1296
|
+
className
|
|
1297
|
+
}) {
|
|
1298
|
+
const labels = React2__namespace.useMemo(
|
|
1299
|
+
() => resolveLabels(labelOverrides),
|
|
1300
|
+
[labelOverrides]
|
|
1301
|
+
);
|
|
1302
|
+
const listId = React2__namespace.useId();
|
|
1303
|
+
const summary = summarize(toolCalls);
|
|
1304
|
+
const [focus, setFocus] = React2__namespace.useState(null);
|
|
1305
|
+
const [expanded, setExpanded] = useAutoCollapse(
|
|
1306
|
+
summary.isActive,
|
|
1307
|
+
summary.signature,
|
|
1308
|
+
focus
|
|
1309
|
+
);
|
|
1310
|
+
const hasHeader = toolCalls.length > 1;
|
|
1311
|
+
const visibleCalls = !hasHeader || expanded ? toolCalls : toolCalls.filter(needsAttention);
|
|
1312
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1313
|
+
"div",
|
|
1314
|
+
{
|
|
1315
|
+
"data-slot": "ai-tool-call-group",
|
|
1316
|
+
className,
|
|
1317
|
+
onBlur: (event) => {
|
|
1318
|
+
if (!event.currentTarget.contains(event.relatedTarget)) setFocus(null);
|
|
1319
|
+
},
|
|
1320
|
+
children: [
|
|
1321
|
+
hasHeader && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1322
|
+
"button",
|
|
1323
|
+
{
|
|
1324
|
+
type: "button",
|
|
1325
|
+
"aria-expanded": expanded,
|
|
1326
|
+
"aria-controls": listId,
|
|
1327
|
+
onClick: () => setExpanded(!expanded),
|
|
1328
|
+
onFocus: () => setFocus("header"),
|
|
1329
|
+
className: "focus-visible:ring-primary-500 flex max-w-full items-center gap-2 rounded px-1.5 py-1 text-start text-sm text-neutral-600 hover:bg-neutral-100 focus-visible:ring-2 focus-visible:outline-none dark:text-neutral-400 dark:hover:bg-neutral-800",
|
|
1330
|
+
children: [
|
|
1331
|
+
summary.isActive ? /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(chunkXXVUHLQN_cjs.Spinner, { size: "xs" }) }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wrench, { "aria-hidden": "true", className: "h-3.5 w-3.5 shrink-0" }),
|
|
1332
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: summary.isActive ? labels.running(summary.total) : labels.used(summary.total) }),
|
|
1333
|
+
summary.awaitingApproval > 0 && /* @__PURE__ */ jsxRuntime.jsx(chunk7E46YDOT_cjs.Badge, { variant: "warning", size: "sm", className: "shrink-0", children: labels.needsApproval(summary.awaitingApproval) }),
|
|
1334
|
+
summary.failed > 0 && /* @__PURE__ */ jsxRuntime.jsx(chunk7E46YDOT_cjs.Badge, { variant: "danger", size: "sm", className: "shrink-0", children: labels.failed(summary.failed) }),
|
|
1335
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1336
|
+
lucideReact.ChevronDown,
|
|
1337
|
+
{
|
|
1338
|
+
"aria-hidden": "true",
|
|
1339
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
1340
|
+
"h-3.5 w-3.5 shrink-0 transition-transform motion-reduce:transition-none",
|
|
1341
|
+
expanded && "rotate-180"
|
|
1342
|
+
)
|
|
1343
|
+
}
|
|
1344
|
+
)
|
|
1345
|
+
]
|
|
1346
|
+
}
|
|
1347
|
+
),
|
|
1348
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1349
|
+
"div",
|
|
1350
|
+
{
|
|
1351
|
+
role: "list",
|
|
1352
|
+
id: listId,
|
|
1353
|
+
onFocus: () => setFocus("rows"),
|
|
1354
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
1355
|
+
hasHeader && "ms-3 border-s border-neutral-200 ps-2 dark:border-neutral-700"
|
|
1356
|
+
),
|
|
1357
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(chunkIEY3ZJIT_cjs.AnimatedPresence, { initial: false, children: visibleCalls.map((toolCall) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1358
|
+
ToolCallRow,
|
|
1359
|
+
{
|
|
1360
|
+
toolCall,
|
|
1361
|
+
labels,
|
|
1362
|
+
onApprove,
|
|
1363
|
+
onDeny,
|
|
1364
|
+
onLinkClick
|
|
1365
|
+
},
|
|
1366
|
+
toolCall.id
|
|
1367
|
+
)) })
|
|
1368
|
+
}
|
|
1369
|
+
),
|
|
1370
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { role: "status", className: "sr-only", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: progressAnnouncement(summary, labels) }, summary.approvalKey) }),
|
|
1371
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { role: "status", className: "sr-only", children: summary.failed > 0 ? labels.announceFailed(summary.failed) : "" })
|
|
1372
|
+
]
|
|
1373
|
+
}
|
|
1374
|
+
);
|
|
1375
|
+
}
|
|
962
1376
|
var avatarVariants = classVarianceAuthority.cva(
|
|
963
1377
|
"flex shrink-0 items-center justify-center rounded-full",
|
|
964
1378
|
{
|
|
@@ -1329,6 +1743,54 @@ var ChatBubble = React2__namespace.forwardRef(
|
|
|
1329
1743
|
}
|
|
1330
1744
|
);
|
|
1331
1745
|
ChatBubble.displayName = "ChatBubble";
|
|
1746
|
+
function MessageContentBlocks({
|
|
1747
|
+
message,
|
|
1748
|
+
streaming,
|
|
1749
|
+
onLinkClick,
|
|
1750
|
+
renderTextContent,
|
|
1751
|
+
toolCallGroup
|
|
1752
|
+
}) {
|
|
1753
|
+
const nodes = [];
|
|
1754
|
+
let run = [];
|
|
1755
|
+
const flushRun = () => {
|
|
1756
|
+
if (run.length === 0) return;
|
|
1757
|
+
nodes.push(
|
|
1758
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1759
|
+
MCPToolCallGroup,
|
|
1760
|
+
{
|
|
1761
|
+
toolCalls: run,
|
|
1762
|
+
onLinkClick,
|
|
1763
|
+
...toolCallGroup
|
|
1764
|
+
},
|
|
1765
|
+
`tool-call-group-${run[0].id}`
|
|
1766
|
+
)
|
|
1767
|
+
);
|
|
1768
|
+
run = [];
|
|
1769
|
+
};
|
|
1770
|
+
message.content.forEach((content, index) => {
|
|
1771
|
+
if (toolCallGroup && content.type === "tool_use" && content.toolCall) {
|
|
1772
|
+
run.push(content.toolCall);
|
|
1773
|
+
return;
|
|
1774
|
+
}
|
|
1775
|
+
flushRun();
|
|
1776
|
+
nodes.push(
|
|
1777
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1778
|
+
ContentBlock,
|
|
1779
|
+
{
|
|
1780
|
+
content,
|
|
1781
|
+
onLinkClick,
|
|
1782
|
+
messageId: message.id,
|
|
1783
|
+
streaming,
|
|
1784
|
+
role: message.role,
|
|
1785
|
+
renderTextContent
|
|
1786
|
+
},
|
|
1787
|
+
index
|
|
1788
|
+
)
|
|
1789
|
+
);
|
|
1790
|
+
});
|
|
1791
|
+
flushRun();
|
|
1792
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: nodes });
|
|
1793
|
+
}
|
|
1332
1794
|
function AIMessageDisplay({
|
|
1333
1795
|
message,
|
|
1334
1796
|
userName,
|
|
@@ -1337,11 +1799,22 @@ function AIMessageDisplay({
|
|
|
1337
1799
|
onLinkClick,
|
|
1338
1800
|
renderTextContent,
|
|
1339
1801
|
renderMessageFooter,
|
|
1802
|
+
toolCallGroup,
|
|
1340
1803
|
className
|
|
1341
1804
|
}) {
|
|
1342
1805
|
const isStreaming = message.status === "streaming";
|
|
1343
1806
|
const hasContent = message.content.length > 0;
|
|
1344
1807
|
const messageFooter = renderMessageFooter?.(message);
|
|
1808
|
+
const contentBlocks = /* @__PURE__ */ jsxRuntime.jsx(
|
|
1809
|
+
MessageContentBlocks,
|
|
1810
|
+
{
|
|
1811
|
+
message,
|
|
1812
|
+
streaming: isStreaming,
|
|
1813
|
+
onLinkClick,
|
|
1814
|
+
renderTextContent,
|
|
1815
|
+
toolCallGroup
|
|
1816
|
+
}
|
|
1817
|
+
);
|
|
1345
1818
|
const formatTime = (timestamp) => {
|
|
1346
1819
|
const date = new Date(timestamp);
|
|
1347
1820
|
return date.toLocaleTimeString(void 0, {
|
|
@@ -1355,18 +1828,7 @@ function AIMessageDisplay({
|
|
|
1355
1828
|
{
|
|
1356
1829
|
"data-slot": "ai-message",
|
|
1357
1830
|
className: chunkS5RVSXDV_cjs.cn(messageVariants({ role: message.role }), className),
|
|
1358
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1 space-y-2", children:
|
|
1359
|
-
ContentBlock,
|
|
1360
|
-
{
|
|
1361
|
-
content,
|
|
1362
|
-
onLinkClick,
|
|
1363
|
-
messageId: message.id,
|
|
1364
|
-
streaming: isStreaming,
|
|
1365
|
-
role: message.role,
|
|
1366
|
-
renderTextContent
|
|
1367
|
-
},
|
|
1368
|
-
index
|
|
1369
|
-
)) })
|
|
1831
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1 space-y-2", children: contentBlocks })
|
|
1370
1832
|
}
|
|
1371
1833
|
);
|
|
1372
1834
|
}
|
|
@@ -1391,18 +1853,7 @@ function AIMessageDisplay({
|
|
|
1391
1853
|
"data-slot": "ai-message-bubble",
|
|
1392
1854
|
variant: message.role,
|
|
1393
1855
|
hasError: message.status === "error",
|
|
1394
|
-
children: hasContent ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children:
|
|
1395
|
-
ContentBlock,
|
|
1396
|
-
{
|
|
1397
|
-
content,
|
|
1398
|
-
onLinkClick,
|
|
1399
|
-
messageId: message.id,
|
|
1400
|
-
streaming: isStreaming,
|
|
1401
|
-
role: message.role,
|
|
1402
|
-
renderTextContent
|
|
1403
|
-
},
|
|
1404
|
-
index
|
|
1405
|
-
)) }) : isStreaming ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(AITypingIndicator, {}) }) : null
|
|
1856
|
+
children: hasContent ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: contentBlocks }) : isStreaming ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(AITypingIndicator, {}) }) : null
|
|
1406
1857
|
}
|
|
1407
1858
|
),
|
|
1408
1859
|
messageFooter != null && messageFooter !== false && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "ai-message-footer", className: "w-fit max-w-[85%]", children: messageFooter }),
|
|
@@ -1459,6 +1910,7 @@ exports.CloseIcon = CloseIcon;
|
|
|
1459
1910
|
exports.CollapsiblePill = CollapsiblePill;
|
|
1460
1911
|
exports.JumpToBottomButton = JumpToBottomButton;
|
|
1461
1912
|
exports.MCPToolCallDisplay = MCPToolCallDisplay;
|
|
1913
|
+
exports.MCPToolCallGroup = MCPToolCallGroup;
|
|
1462
1914
|
exports.MessageAvatar = MessageAvatar;
|
|
1463
1915
|
exports.RefreshIcon = RefreshIcon;
|
|
1464
1916
|
exports.ResourceLink = ResourceLink;
|
|
@@ -1466,6 +1918,7 @@ exports.SendIcon = SendIcon;
|
|
|
1466
1918
|
exports.SparklesIcon = SparklesIcon;
|
|
1467
1919
|
exports.SpinnerIcon = SpinnerIcon;
|
|
1468
1920
|
exports.ToolStatusIcon = ToolStatusIcon;
|
|
1921
|
+
exports.defaultMCPToolCallGroupLabels = defaultMCPToolCallGroupLabels;
|
|
1469
1922
|
exports.getToolIcon = getToolIcon;
|
|
1470
|
-
//# sourceMappingURL=chunk-
|
|
1471
|
-
//# sourceMappingURL=chunk-
|
|
1923
|
+
//# sourceMappingURL=chunk-G56OUIGH.cjs.map
|
|
1924
|
+
//# sourceMappingURL=chunk-G56OUIGH.cjs.map
|