@supyagent/sdk 0.1.21 → 0.1.23
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/react.cjs +270 -81
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +12 -2
- package/dist/react.d.ts +12 -2
- package/dist/react.js +270 -82
- package/dist/react.js.map +1 -1
- package/package.json +10 -10
package/dist/react.cjs
CHANGED
|
@@ -32,6 +32,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
var react_exports = {};
|
|
33
33
|
__export(react_exports, {
|
|
34
34
|
BrevoFormatter: () => BrevoFormatter,
|
|
35
|
+
BrowserFormatter: () => BrowserFormatter,
|
|
35
36
|
CalendarEventFormatter: () => CalendarEventFormatter,
|
|
36
37
|
CalendlyFormatter: () => CalendlyFormatter,
|
|
37
38
|
CollapsibleResult: () => CollapsibleResult,
|
|
@@ -65,6 +66,7 @@ __export(react_exports, {
|
|
|
65
66
|
ToolInput: () => ToolInput,
|
|
66
67
|
TwilioFormatter: () => TwilioFormatter,
|
|
67
68
|
TwitterFormatter: () => TwitterFormatter,
|
|
69
|
+
WhatsAppFormatter: () => WhatsAppFormatter,
|
|
68
70
|
extractArgs: () => extractArgs,
|
|
69
71
|
extractResult: () => extractResult,
|
|
70
72
|
extractState: () => extractState,
|
|
@@ -128,7 +130,14 @@ var PROVIDER_LABELS = {
|
|
|
128
130
|
twilio: "Twilio",
|
|
129
131
|
image: "Image",
|
|
130
132
|
audio: "Audio",
|
|
131
|
-
video: "Video"
|
|
133
|
+
video: "Video",
|
|
134
|
+
shopify: "Shopify",
|
|
135
|
+
sap: "SAP",
|
|
136
|
+
jobs: "Jobs",
|
|
137
|
+
browser: "Browser",
|
|
138
|
+
files: "Files",
|
|
139
|
+
db: "Database",
|
|
140
|
+
radar: "Radar"
|
|
132
141
|
};
|
|
133
142
|
function getProviderLabel(provider) {
|
|
134
143
|
return PROVIDER_LABELS[provider] || provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
@@ -200,6 +209,16 @@ function getFormatterType(toolName) {
|
|
|
200
209
|
return "twilio";
|
|
201
210
|
case "linkedin":
|
|
202
211
|
return "linkedin";
|
|
212
|
+
case "whatsapp":
|
|
213
|
+
return "whatsapp";
|
|
214
|
+
case "browser":
|
|
215
|
+
return "browser";
|
|
216
|
+
case "db":
|
|
217
|
+
return "compute";
|
|
218
|
+
case "files":
|
|
219
|
+
return "drive";
|
|
220
|
+
case "radar":
|
|
221
|
+
return "search";
|
|
203
222
|
case "image":
|
|
204
223
|
return "image";
|
|
205
224
|
case "tts":
|
|
@@ -262,7 +281,9 @@ var ICON_MAP = {
|
|
|
262
281
|
microsoft: import_lucide_react.Monitor,
|
|
263
282
|
outlook: import_lucide_react.Mail,
|
|
264
283
|
onedrive: import_lucide_react.HardDrive,
|
|
265
|
-
telegram: import_lucide_react.Send
|
|
284
|
+
telegram: import_lucide_react.Send,
|
|
285
|
+
whatsapp: import_lucide_react.MessageCircle,
|
|
286
|
+
browser: import_lucide_react.Globe
|
|
266
287
|
};
|
|
267
288
|
function ProviderIcon({ toolName, className = "h-4 w-4" }) {
|
|
268
289
|
const provider = getProviderFromToolName(toolName);
|
|
@@ -680,6 +701,40 @@ function getVideoSummary(data, toolName) {
|
|
|
680
701
|
}
|
|
681
702
|
return { text: isUnderstand ? "Video analysis" : "Video generation" };
|
|
682
703
|
}
|
|
704
|
+
function getWhatsappSummary(data, toolName) {
|
|
705
|
+
const action = actionFromToolName(toolName);
|
|
706
|
+
if (action === "send") {
|
|
707
|
+
const to = typeof data === "object" && data !== null && "to" in data ? String(data.to) : void 0;
|
|
708
|
+
return { text: to ? `Sent message to ${to}` : "Sent message", badge: { text: "Sent", variant: "success" } };
|
|
709
|
+
}
|
|
710
|
+
const n = countItems(data, "messages");
|
|
711
|
+
if (n > 0) return { text: `${n} messages`, badge: countBadge(n) };
|
|
712
|
+
if (typeof data === "object" && data !== null && "body" in data) {
|
|
713
|
+
const body = String(data.body);
|
|
714
|
+
return { text: body.length > 60 ? body.slice(0, 60) + "..." : body };
|
|
715
|
+
}
|
|
716
|
+
return { text: "WhatsApp result" };
|
|
717
|
+
}
|
|
718
|
+
function getBrowserSummary(data, toolName) {
|
|
719
|
+
if (typeof data === "object" && data !== null) {
|
|
720
|
+
const d = data;
|
|
721
|
+
if (d.url && typeof d.url === "string") {
|
|
722
|
+
try {
|
|
723
|
+
const hostname = new URL(d.url).hostname.replace("www.", "");
|
|
724
|
+
return { text: `Visited ${hostname}` };
|
|
725
|
+
} catch {
|
|
726
|
+
return { text: `Visited ${d.url}` };
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
if (d.screenshot_url || d.screenshot) {
|
|
730
|
+
return { text: "Page screenshot captured" };
|
|
731
|
+
}
|
|
732
|
+
if (d.content || d.text || d.markdown) {
|
|
733
|
+
return { text: "Page content extracted" };
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
return { text: humanizeToolName(toolName) };
|
|
737
|
+
}
|
|
683
738
|
function getBashSummary(data) {
|
|
684
739
|
if (typeof data !== "object" || data === null) return { text: "Command executed" };
|
|
685
740
|
const d = data;
|
|
@@ -722,6 +777,8 @@ var SUMMARY_MAP = {
|
|
|
722
777
|
image: getImageSummary,
|
|
723
778
|
audio: getAudioSummary,
|
|
724
779
|
video: getVideoSummary,
|
|
780
|
+
whatsapp: getWhatsappSummary,
|
|
781
|
+
browser: getBrowserSummary,
|
|
725
782
|
bash: getBashSummary,
|
|
726
783
|
generic: getGenericSummary
|
|
727
784
|
};
|
|
@@ -3065,17 +3122,143 @@ function LinkedInFormatter({ data }) {
|
|
|
3065
3122
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("pre", { className: "rounded-lg border border-border bg-background p-3 text-xs text-foreground overflow-x-auto max-h-96 overflow-y-auto", children: JSON.stringify(data, null, 2) });
|
|
3066
3123
|
}
|
|
3067
3124
|
|
|
3068
|
-
// src/ui/formatters/
|
|
3125
|
+
// src/ui/formatters/whatsapp.tsx
|
|
3126
|
+
var import_lucide_react29 = require("lucide-react");
|
|
3069
3127
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3128
|
+
function isWhatsAppMessage(data) {
|
|
3129
|
+
return typeof data === "object" && data !== null && ("body" in data || "text" in data || "from" in data);
|
|
3130
|
+
}
|
|
3131
|
+
function formatTimestamp3(ts) {
|
|
3132
|
+
try {
|
|
3133
|
+
const date = typeof ts === "number" ? new Date(ts > 1e12 ? ts : ts * 1e3) : new Date(ts);
|
|
3134
|
+
const now = /* @__PURE__ */ new Date();
|
|
3135
|
+
const diffMs = now.getTime() - date.getTime();
|
|
3136
|
+
const diffMins = Math.floor(diffMs / 6e4);
|
|
3137
|
+
const diffHours = Math.floor(diffMs / 36e5);
|
|
3138
|
+
const diffDays = Math.floor(diffMs / 864e5);
|
|
3139
|
+
if (diffMins < 1) return "Just now";
|
|
3140
|
+
if (diffMins < 60) return `${diffMins}m ago`;
|
|
3141
|
+
if (diffHours < 24) return `${diffHours}h ago`;
|
|
3142
|
+
if (diffDays < 7) return `${diffDays}d ago`;
|
|
3143
|
+
return date.toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
3144
|
+
} catch {
|
|
3145
|
+
return String(ts);
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
function MessageCard4({ message }) {
|
|
3149
|
+
const sender = message.profile_name || message.contact_name || message.from;
|
|
3150
|
+
const body = message.body || message.text;
|
|
3151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "rounded-lg border border-border bg-card p-3 space-y-1.5", children: [
|
|
3152
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3153
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react29.MessageCircle, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
|
|
3154
|
+
sender && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex items-center gap-1 text-xs font-medium text-foreground", children: [
|
|
3155
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react29.User, { className: "h-3 w-3" }),
|
|
3156
|
+
sender
|
|
3157
|
+
] }),
|
|
3158
|
+
message.type && message.type !== "text" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "inline-flex rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground", children: message.type }),
|
|
3159
|
+
message.status && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: `inline-flex rounded-full px-2 py-0.5 text-xs ${message.status === "delivered" || message.status === "read" ? "text-green-500 bg-green-500/10" : "text-muted-foreground bg-muted"}`, children: message.status }),
|
|
3160
|
+
message.timestamp && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex items-center gap-1 text-xs text-muted-foreground ml-auto", children: [
|
|
3161
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react29.Clock, { className: "h-3 w-3" }),
|
|
3162
|
+
formatTimestamp3(message.timestamp)
|
|
3163
|
+
] })
|
|
3164
|
+
] }),
|
|
3165
|
+
body && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-sm text-foreground line-clamp-3", children: body })
|
|
3166
|
+
] });
|
|
3167
|
+
}
|
|
3168
|
+
function WhatsAppFormatter({ data }) {
|
|
3169
|
+
if (typeof data === "object" && data !== null && "messages" in data) {
|
|
3170
|
+
const msgs = data.messages;
|
|
3171
|
+
if (Array.isArray(msgs)) {
|
|
3172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "space-y-2", children: msgs.filter(isWhatsAppMessage).map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(MessageCard4, { message: m }, m.id || i)) });
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3175
|
+
if (isWhatsAppMessage(data)) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(MessageCard4, { message: data });
|
|
3176
|
+
if (Array.isArray(data)) {
|
|
3177
|
+
const msgs = data.filter(isWhatsAppMessage);
|
|
3178
|
+
if (msgs.length > 0) {
|
|
3179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "space-y-2", children: msgs.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(MessageCard4, { message: m }, m.id || i)) });
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("pre", { className: "rounded-lg border border-border bg-background p-3 text-xs text-foreground overflow-x-auto max-h-96 overflow-y-auto", children: JSON.stringify(data, null, 2) });
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
// src/ui/formatters/browser.tsx
|
|
3186
|
+
var import_lucide_react30 = require("lucide-react");
|
|
3187
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3188
|
+
function isBrowserData(data) {
|
|
3189
|
+
if (typeof data !== "object" || data === null) return false;
|
|
3190
|
+
return "url" in data || "content" in data || "text" in data || "markdown" in data || "screenshot_url" in data || "screenshot" in data;
|
|
3191
|
+
}
|
|
3192
|
+
function getDomain2(url) {
|
|
3193
|
+
try {
|
|
3194
|
+
return new URL(url).hostname.replace("www.", "");
|
|
3195
|
+
} catch {
|
|
3196
|
+
return url;
|
|
3197
|
+
}
|
|
3198
|
+
}
|
|
3199
|
+
function BrowserFormatter({ data }) {
|
|
3200
|
+
if (!isBrowserData(data)) {
|
|
3201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("pre", { className: "rounded-lg border border-border bg-background p-3 text-xs text-foreground overflow-x-auto max-h-96 overflow-y-auto", children: JSON.stringify(data, null, 2) });
|
|
3202
|
+
}
|
|
3203
|
+
const content = data.content || data.text || data.markdown || "";
|
|
3204
|
+
const screenshotUrl = data.screenshot_url || data.screenshot;
|
|
3205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "space-y-2", children: [
|
|
3206
|
+
data.url && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "rounded-lg border border-border bg-card overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2 px-3 py-2", children: [
|
|
3207
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react30.Globe, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
|
|
3208
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
3209
|
+
data.title && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-sm font-medium text-foreground truncate", children: data.title }),
|
|
3210
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-xs text-muted-foreground truncate", children: getDomain2(data.url) })
|
|
3211
|
+
] }),
|
|
3212
|
+
data.status && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: `inline-flex rounded-full px-2 py-0.5 text-xs ${Number(data.status) >= 200 && Number(data.status) < 300 ? "text-green-500 bg-green-500/10" : Number(data.status) >= 400 ? "text-destructive bg-destructive/10" : "text-muted-foreground bg-muted"}`, children: data.status }),
|
|
3213
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { href: data.url, target: "_blank", rel: "noopener noreferrer", className: "shrink-0 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react30.ExternalLink, { className: "h-3.5 w-3.5" }) })
|
|
3214
|
+
] }) }),
|
|
3215
|
+
screenshotUrl && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "rounded-lg border border-border bg-background overflow-hidden", children: [
|
|
3216
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1.5 px-3 py-1.5 bg-muted border-b border-border", children: [
|
|
3217
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react30.Image, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
3218
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-xs text-muted-foreground", children: "Screenshot" })
|
|
3219
|
+
] }),
|
|
3220
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3221
|
+
"img",
|
|
3222
|
+
{
|
|
3223
|
+
src: screenshotUrl,
|
|
3224
|
+
alt: data.title || "Page screenshot",
|
|
3225
|
+
className: "w-full rounded border border-border"
|
|
3226
|
+
}
|
|
3227
|
+
) })
|
|
3228
|
+
] }),
|
|
3229
|
+
content && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "rounded-lg border border-border bg-background overflow-hidden", children: [
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1.5 px-3 py-1.5 bg-muted border-b border-border", children: [
|
|
3231
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react30.FileText, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
3232
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-xs text-muted-foreground", children: "Extracted content" })
|
|
3233
|
+
] }),
|
|
3234
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("pre", { className: "p-3 text-xs text-foreground overflow-x-auto max-h-80 overflow-y-auto font-mono whitespace-pre-wrap", children: content })
|
|
3235
|
+
] }),
|
|
3236
|
+
data.links && data.links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "rounded-lg border border-border bg-card p-3 space-y-1", children: [
|
|
3237
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { className: "text-xs font-medium text-muted-foreground mb-1.5", children: [
|
|
3238
|
+
"Links (",
|
|
3239
|
+
data.links.length,
|
|
3240
|
+
")"
|
|
3241
|
+
] }),
|
|
3242
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "space-y-1 max-h-40 overflow-y-auto", children: data.links.slice(0, 20).map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
3243
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react30.ExternalLink, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
3244
|
+
link.href ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { href: link.href, target: "_blank", rel: "noopener noreferrer", className: "text-xs text-primary hover:underline truncate", children: link.text || link.href }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-xs text-foreground truncate", children: link.text })
|
|
3245
|
+
] }, i)) })
|
|
3246
|
+
] }),
|
|
3247
|
+
!data.url && !content && !screenshotUrl && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("pre", { className: "rounded-lg border border-border bg-background p-3 text-xs text-foreground overflow-x-auto max-h-96 overflow-y-auto", children: JSON.stringify(data, null, 2) })
|
|
3248
|
+
] });
|
|
3249
|
+
}
|
|
3250
|
+
|
|
3251
|
+
// src/ui/formatters/generic.tsx
|
|
3252
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3070
3253
|
function GenericFormatter({ data }) {
|
|
3071
3254
|
if (data === null || data === void 0) {
|
|
3072
|
-
return /* @__PURE__ */ (0,
|
|
3255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-sm text-muted-foreground italic", children: "No data returned" });
|
|
3073
3256
|
}
|
|
3074
|
-
return /* @__PURE__ */ (0,
|
|
3257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("pre", { className: "rounded-lg border border-border bg-background p-3 text-xs text-foreground overflow-x-auto max-h-96 overflow-y-auto", children: JSON.stringify(data, null, 2) });
|
|
3075
3258
|
}
|
|
3076
3259
|
|
|
3077
3260
|
// src/ui/tool-result.tsx
|
|
3078
|
-
var
|
|
3261
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3079
3262
|
function extractToolName(part) {
|
|
3080
3263
|
if (part.type.startsWith("tool-") && part.type !== "tool-invocation") {
|
|
3081
3264
|
return part.type.slice(5);
|
|
@@ -3128,59 +3311,63 @@ function maybeNormalize(toolName, formatterType, data) {
|
|
|
3128
3311
|
function renderFormatter(formatterType, data) {
|
|
3129
3312
|
switch (formatterType) {
|
|
3130
3313
|
case "email":
|
|
3131
|
-
return /* @__PURE__ */ (0,
|
|
3314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EmailFormatter, { data });
|
|
3132
3315
|
case "calendar":
|
|
3133
|
-
return /* @__PURE__ */ (0,
|
|
3316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CalendarEventFormatter, { data });
|
|
3134
3317
|
case "slack":
|
|
3135
|
-
return /* @__PURE__ */ (0,
|
|
3318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SlackMessageFormatter, { data });
|
|
3136
3319
|
case "github":
|
|
3137
|
-
return /* @__PURE__ */ (0,
|
|
3320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(GithubFormatter, { data });
|
|
3138
3321
|
case "drive":
|
|
3139
|
-
return /* @__PURE__ */ (0,
|
|
3322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DriveFileFormatter, { data });
|
|
3140
3323
|
case "search":
|
|
3141
|
-
return /* @__PURE__ */ (0,
|
|
3324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SearchFormatter, { data });
|
|
3142
3325
|
case "docs":
|
|
3143
|
-
return /* @__PURE__ */ (0,
|
|
3326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DocsFormatter, { data });
|
|
3144
3327
|
case "sheets":
|
|
3145
|
-
return /* @__PURE__ */ (0,
|
|
3328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SheetsFormatter, { data });
|
|
3146
3329
|
case "slides":
|
|
3147
|
-
return /* @__PURE__ */ (0,
|
|
3330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SlidesFormatter, { data });
|
|
3148
3331
|
case "hubspot":
|
|
3149
|
-
return /* @__PURE__ */ (0,
|
|
3332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(HubspotFormatter, { data });
|
|
3150
3333
|
case "linear":
|
|
3151
|
-
return /* @__PURE__ */ (0,
|
|
3334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LinearFormatter, { data });
|
|
3152
3335
|
case "pipedrive":
|
|
3153
|
-
return /* @__PURE__ */ (0,
|
|
3336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PipedriveFormatter, { data });
|
|
3154
3337
|
case "compute":
|
|
3155
|
-
return /* @__PURE__ */ (0,
|
|
3338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ComputeFormatter, { data });
|
|
3156
3339
|
case "resend":
|
|
3157
|
-
return /* @__PURE__ */ (0,
|
|
3340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ResendFormatter, { data });
|
|
3158
3341
|
case "inbox":
|
|
3159
|
-
return /* @__PURE__ */ (0,
|
|
3342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(InboxFormatter, { data });
|
|
3160
3343
|
case "discord":
|
|
3161
|
-
return /* @__PURE__ */ (0,
|
|
3344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DiscordFormatter, { data });
|
|
3162
3345
|
case "notion":
|
|
3163
|
-
return /* @__PURE__ */ (0,
|
|
3346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(NotionFormatter, { data });
|
|
3164
3347
|
case "twitter":
|
|
3165
|
-
return /* @__PURE__ */ (0,
|
|
3348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TwitterFormatter, { data });
|
|
3166
3349
|
case "telegram":
|
|
3167
|
-
return /* @__PURE__ */ (0,
|
|
3350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TelegramFormatter, { data });
|
|
3168
3351
|
case "stripe":
|
|
3169
|
-
return /* @__PURE__ */ (0,
|
|
3352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(StripeFormatter, { data });
|
|
3170
3353
|
case "jira":
|
|
3171
|
-
return /* @__PURE__ */ (0,
|
|
3354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(JiraFormatter, { data });
|
|
3172
3355
|
case "salesforce":
|
|
3173
|
-
return /* @__PURE__ */ (0,
|
|
3356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SalesforceFormatter, { data });
|
|
3174
3357
|
case "brevo":
|
|
3175
|
-
return /* @__PURE__ */ (0,
|
|
3358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BrevoFormatter, { data });
|
|
3176
3359
|
case "calendly":
|
|
3177
|
-
return /* @__PURE__ */ (0,
|
|
3360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CalendlyFormatter, { data });
|
|
3178
3361
|
case "twilio":
|
|
3179
|
-
return /* @__PURE__ */ (0,
|
|
3362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TwilioFormatter, { data });
|
|
3180
3363
|
case "linkedin":
|
|
3181
|
-
return /* @__PURE__ */ (0,
|
|
3364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LinkedInFormatter, { data });
|
|
3365
|
+
case "whatsapp":
|
|
3366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(WhatsAppFormatter, { data });
|
|
3367
|
+
case "browser":
|
|
3368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BrowserFormatter, { data });
|
|
3182
3369
|
default:
|
|
3183
|
-
return /* @__PURE__ */ (0,
|
|
3370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(GenericFormatter, { data });
|
|
3184
3371
|
}
|
|
3185
3372
|
}
|
|
3186
3373
|
function SupyagentToolResult({ part }) {
|
|
@@ -3195,7 +3382,7 @@ function SupyagentToolResult({ part }) {
|
|
|
3195
3382
|
const formatterType = getFormatterType(toolName);
|
|
3196
3383
|
const data = maybeNormalize(toolName, formatterType, result);
|
|
3197
3384
|
const summary = getSummary(formatterType, data, toolName);
|
|
3198
|
-
return /* @__PURE__ */ (0,
|
|
3385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3199
3386
|
CollapsibleResult,
|
|
3200
3387
|
{
|
|
3201
3388
|
toolName,
|
|
@@ -3208,7 +3395,7 @@ function SupyagentToolResult({ part }) {
|
|
|
3208
3395
|
|
|
3209
3396
|
// src/ui/tool-input.tsx
|
|
3210
3397
|
var import_react2 = __toESM(require("react"), 1);
|
|
3211
|
-
var
|
|
3398
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3212
3399
|
function formatValue(value) {
|
|
3213
3400
|
if (value === null || value === void 0) {
|
|
3214
3401
|
return { text: "null", muted: true };
|
|
@@ -3242,19 +3429,19 @@ function formatValue(value) {
|
|
|
3242
3429
|
}
|
|
3243
3430
|
function ToolInput({ args }) {
|
|
3244
3431
|
if (!args || Object.keys(args).length === 0) return null;
|
|
3245
|
-
return /* @__PURE__ */ (0,
|
|
3432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm", children: Object.entries(args).map(([key, value]) => {
|
|
3246
3433
|
const formatted = formatValue(value);
|
|
3247
|
-
return /* @__PURE__ */ (0,
|
|
3248
|
-
/* @__PURE__ */ (0,
|
|
3249
|
-
/* @__PURE__ */ (0,
|
|
3434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react2.default.Fragment, { children: [
|
|
3435
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-muted-foreground select-none", children: key }),
|
|
3436
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: formatted.muted ? "text-muted-foreground" : "text-foreground", children: formatted.text })
|
|
3250
3437
|
] }, key);
|
|
3251
3438
|
}) });
|
|
3252
3439
|
}
|
|
3253
3440
|
|
|
3254
3441
|
// src/ui/tool-action.tsx
|
|
3255
3442
|
var import_react3 = require("react");
|
|
3256
|
-
var
|
|
3257
|
-
var
|
|
3443
|
+
var import_lucide_react31 = require("lucide-react");
|
|
3444
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3258
3445
|
var BADGE_STYLES2 = {
|
|
3259
3446
|
default: "bg-muted text-muted-foreground",
|
|
3260
3447
|
success: "bg-green-500/10 text-green-500",
|
|
@@ -3287,59 +3474,59 @@ function SupyagentToolAction({ part, defaultExpanded = false }) {
|
|
|
3287
3474
|
const hasArgs = args && Object.keys(args).length > 0;
|
|
3288
3475
|
const hasExpandableContent = hasArgs || formatterOutput;
|
|
3289
3476
|
const canExpand = !isStreaming && hasExpandableContent;
|
|
3290
|
-
return /* @__PURE__ */ (0,
|
|
3477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
3291
3478
|
"div",
|
|
3292
3479
|
{
|
|
3293
3480
|
className: "rounded-lg border border-border bg-card overflow-hidden",
|
|
3294
3481
|
"data-state": isDone ? "done" : isError ? "error" : isStreaming ? "streaming" : "pending",
|
|
3295
3482
|
children: [
|
|
3296
|
-
/* @__PURE__ */ (0,
|
|
3483
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
3297
3484
|
"button",
|
|
3298
3485
|
{
|
|
3299
3486
|
type: "button",
|
|
3300
3487
|
onClick: () => canExpand && setExpanded(!expanded),
|
|
3301
3488
|
className: `flex items-center gap-2 w-full px-3 py-2 text-left transition-colors ${canExpand ? "hover:bg-muted cursor-pointer" : "cursor-default"}`,
|
|
3302
3489
|
children: [
|
|
3303
|
-
/* @__PURE__ */ (0,
|
|
3304
|
-
/* @__PURE__ */ (0,
|
|
3305
|
-
isStreaming && /* @__PURE__ */ (0,
|
|
3490
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "relative shrink-0", children: [
|
|
3491
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ProviderIcon, { toolName, className: "h-4 w-4 text-muted-foreground" }),
|
|
3492
|
+
isStreaming && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react31.Loader2, { className: "absolute -top-1 -right-1 h-3 w-3 text-primary animate-spin" })
|
|
3306
3493
|
] }),
|
|
3307
|
-
/* @__PURE__ */ (0,
|
|
3308
|
-
/* @__PURE__ */ (0,
|
|
3309
|
-
summary && /* @__PURE__ */ (0,
|
|
3310
|
-
/* @__PURE__ */ (0,
|
|
3311
|
-
/* @__PURE__ */ (0,
|
|
3494
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-xs text-muted-foreground", children: providerLabel }),
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-sm text-foreground", children: actionLabel }),
|
|
3496
|
+
summary && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-muted-foreground text-xs", children: "\xB7" }),
|
|
3498
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-sm text-muted-foreground flex-1 truncate", children: summary.text })
|
|
3312
3499
|
] }),
|
|
3313
|
-
!summary && /* @__PURE__ */ (0,
|
|
3314
|
-
summary?.badge && /* @__PURE__ */ (0,
|
|
3500
|
+
!summary && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "flex-1" }),
|
|
3501
|
+
summary?.badge && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3315
3502
|
"span",
|
|
3316
3503
|
{
|
|
3317
3504
|
className: `inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium shrink-0 ${BADGE_STYLES2[summary.badge.variant || "default"]}`,
|
|
3318
3505
|
children: summary.badge.text
|
|
3319
3506
|
}
|
|
3320
3507
|
),
|
|
3321
|
-
isDone && /* @__PURE__ */ (0,
|
|
3322
|
-
isError && /* @__PURE__ */ (0,
|
|
3323
|
-
/* @__PURE__ */ (0,
|
|
3508
|
+
isDone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react31.Check, { className: "h-3.5 w-3.5 text-green-500 shrink-0" }),
|
|
3509
|
+
isError && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-xs text-destructive shrink-0", children: [
|
|
3510
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react31.AlertCircle, { className: "h-3 w-3" }),
|
|
3324
3511
|
"Error"
|
|
3325
3512
|
] }),
|
|
3326
|
-
isStreaming && /* @__PURE__ */ (0,
|
|
3327
|
-
canExpand && (expanded ? /* @__PURE__ */ (0,
|
|
3513
|
+
isStreaming && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "inline-flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-xs text-primary animate-pulse shrink-0", children: "Calling..." }),
|
|
3514
|
+
canExpand && (expanded ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react31.ChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react31.ChevronRight, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }))
|
|
3328
3515
|
]
|
|
3329
3516
|
}
|
|
3330
3517
|
),
|
|
3331
|
-
/* @__PURE__ */ (0,
|
|
3518
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3332
3519
|
"div",
|
|
3333
3520
|
{
|
|
3334
3521
|
className: "grid transition-[grid-template-rows] duration-200 ease-out",
|
|
3335
3522
|
style: { gridTemplateRows: expanded ? "1fr" : "0fr" },
|
|
3336
|
-
children: /* @__PURE__ */ (0,
|
|
3337
|
-
args && Object.keys(args).length > 0 && /* @__PURE__ */ (0,
|
|
3338
|
-
/* @__PURE__ */ (0,
|
|
3339
|
-
/* @__PURE__ */ (0,
|
|
3523
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "border-t border-border px-3 py-2 space-y-3", children: [
|
|
3524
|
+
args && Object.keys(args).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5", children: "Input" }),
|
|
3526
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ToolInput, { args })
|
|
3340
3527
|
] }),
|
|
3341
|
-
formatterOutput && /* @__PURE__ */ (0,
|
|
3342
|
-
/* @__PURE__ */ (0,
|
|
3528
|
+
formatterOutput && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
3529
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5", children: "Output" }),
|
|
3343
3530
|
formatterOutput
|
|
3344
3531
|
] })
|
|
3345
3532
|
] }) })
|
|
@@ -3352,8 +3539,8 @@ function SupyagentToolAction({ part, defaultExpanded = false }) {
|
|
|
3352
3539
|
|
|
3353
3540
|
// src/ui/tool-call.tsx
|
|
3354
3541
|
var import_react4 = require("react");
|
|
3355
|
-
var
|
|
3356
|
-
var
|
|
3542
|
+
var import_lucide_react32 = require("lucide-react");
|
|
3543
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3357
3544
|
function extractToolName2(part) {
|
|
3358
3545
|
if (part.type.startsWith("tool-") && part.type !== "tool-invocation") {
|
|
3359
3546
|
return part.type.slice(5);
|
|
@@ -3382,39 +3569,39 @@ function SupyagentToolCall({ part }) {
|
|
|
3382
3569
|
const isStreaming = state === "input-streaming";
|
|
3383
3570
|
const isError = state === "output-error";
|
|
3384
3571
|
const isDone = state === "output-available";
|
|
3385
|
-
return /* @__PURE__ */ (0,
|
|
3572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
3386
3573
|
"div",
|
|
3387
3574
|
{
|
|
3388
3575
|
className: "rounded-lg border border-border bg-card overflow-hidden",
|
|
3389
3576
|
"data-state": isDone ? "done" : isError ? "error" : isStreaming ? "streaming" : "pending",
|
|
3390
3577
|
children: [
|
|
3391
|
-
/* @__PURE__ */ (0,
|
|
3578
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
3392
3579
|
"button",
|
|
3393
3580
|
{
|
|
3394
3581
|
type: "button",
|
|
3395
3582
|
onClick: () => args && setExpanded(!expanded),
|
|
3396
3583
|
className: "flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-muted transition-colors",
|
|
3397
3584
|
children: [
|
|
3398
|
-
/* @__PURE__ */ (0,
|
|
3399
|
-
/* @__PURE__ */ (0,
|
|
3400
|
-
isStreaming && /* @__PURE__ */ (0,
|
|
3585
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "relative", children: [
|
|
3586
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ProviderIcon, { toolName, className: "h-4 w-4 text-muted-foreground" }),
|
|
3587
|
+
isStreaming && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react32.Loader2, { className: "absolute -top-1 -right-1 h-3 w-3 text-primary animate-spin" })
|
|
3401
3588
|
] }),
|
|
3402
|
-
/* @__PURE__ */ (0,
|
|
3403
|
-
/* @__PURE__ */ (0,
|
|
3404
|
-
isDone && /* @__PURE__ */ (0,
|
|
3405
|
-
/* @__PURE__ */ (0,
|
|
3589
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-xs text-muted-foreground", children: providerLabel }),
|
|
3590
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-sm text-foreground flex-1", children: actionLabel }),
|
|
3591
|
+
isDone && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "inline-flex items-center gap-1 rounded-full bg-green-500/10 px-2 py-0.5 text-xs text-green-500", children: [
|
|
3592
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react32.Check, { className: "h-3 w-3" }),
|
|
3406
3593
|
"Completed"
|
|
3407
3594
|
] }),
|
|
3408
|
-
isError && /* @__PURE__ */ (0,
|
|
3409
|
-
/* @__PURE__ */ (0,
|
|
3595
|
+
isError && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-xs text-destructive", children: [
|
|
3596
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react32.AlertCircle, { className: "h-3 w-3" }),
|
|
3410
3597
|
"Error"
|
|
3411
3598
|
] }),
|
|
3412
|
-
isStreaming && /* @__PURE__ */ (0,
|
|
3413
|
-
args && (expanded ? /* @__PURE__ */ (0,
|
|
3599
|
+
isStreaming && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "inline-flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-xs text-primary animate-pulse", children: "Calling..." }),
|
|
3600
|
+
args && (expanded ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react32.ChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react32.ChevronRight, { className: "h-3.5 w-3.5 text-muted-foreground" }))
|
|
3414
3601
|
]
|
|
3415
3602
|
}
|
|
3416
3603
|
),
|
|
3417
|
-
expanded && args && /* @__PURE__ */ (0,
|
|
3604
|
+
expanded && args && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "border-t border-border px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("pre", { className: "text-xs text-muted-foreground overflow-x-auto", children: JSON.stringify(args, null, 2) }) })
|
|
3418
3605
|
]
|
|
3419
3606
|
}
|
|
3420
3607
|
);
|
|
@@ -3422,6 +3609,7 @@ function SupyagentToolCall({ part }) {
|
|
|
3422
3609
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3423
3610
|
0 && (module.exports = {
|
|
3424
3611
|
BrevoFormatter,
|
|
3612
|
+
BrowserFormatter,
|
|
3425
3613
|
CalendarEventFormatter,
|
|
3426
3614
|
CalendlyFormatter,
|
|
3427
3615
|
CollapsibleResult,
|
|
@@ -3455,6 +3643,7 @@ function SupyagentToolCall({ part }) {
|
|
|
3455
3643
|
ToolInput,
|
|
3456
3644
|
TwilioFormatter,
|
|
3457
3645
|
TwitterFormatter,
|
|
3646
|
+
WhatsAppFormatter,
|
|
3458
3647
|
extractArgs,
|
|
3459
3648
|
extractResult,
|
|
3460
3649
|
extractState,
|