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