@supyagent/sdk 0.1.20 → 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 +280 -82
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +8 -2
- package/dist/react.d.ts +8 -2
- package/dist/react.js +281 -83
- package/dist/react.js.map +1 -1
- package/package.json +10 -10
package/dist/react.cjs
CHANGED
|
@@ -78,6 +78,7 @@ __export(react_exports, {
|
|
|
78
78
|
normalizeMicrosoftCalendar: () => normalizeMicrosoftCalendar,
|
|
79
79
|
normalizeMicrosoftDrive: () => normalizeMicrosoftDrive,
|
|
80
80
|
normalizeMicrosoftMail: () => normalizeMicrosoftMail,
|
|
81
|
+
resolveToolName: () => resolveToolName,
|
|
81
82
|
unwrapSupyagentResult: () => unwrapSupyagentResult
|
|
82
83
|
});
|
|
83
84
|
module.exports = __toCommonJS(react_exports);
|
|
@@ -127,7 +128,14 @@ var PROVIDER_LABELS = {
|
|
|
127
128
|
twilio: "Twilio",
|
|
128
129
|
image: "Image",
|
|
129
130
|
audio: "Audio",
|
|
130
|
-
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"
|
|
131
139
|
};
|
|
132
140
|
function getProviderLabel(provider) {
|
|
133
141
|
return PROVIDER_LABELS[provider] || provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
@@ -199,6 +207,16 @@ function getFormatterType(toolName) {
|
|
|
199
207
|
return "twilio";
|
|
200
208
|
case "linkedin":
|
|
201
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";
|
|
202
220
|
case "image":
|
|
203
221
|
return "image";
|
|
204
222
|
case "tts":
|
|
@@ -206,6 +224,8 @@ function getFormatterType(toolName) {
|
|
|
206
224
|
return "audio";
|
|
207
225
|
case "video":
|
|
208
226
|
return "video";
|
|
227
|
+
case "code":
|
|
228
|
+
return "compute";
|
|
209
229
|
case "ocr":
|
|
210
230
|
return "generic";
|
|
211
231
|
case "bash":
|
|
@@ -215,6 +235,13 @@ function getFormatterType(toolName) {
|
|
|
215
235
|
return "generic";
|
|
216
236
|
}
|
|
217
237
|
}
|
|
238
|
+
function resolveToolName(rawToolName, args) {
|
|
239
|
+
if (rawToolName !== "apiCall" || !args) return rawToolName;
|
|
240
|
+
const path = typeof args.path === "string" ? args.path : "";
|
|
241
|
+
const stripped = path.replace(/^\/api\/v1\//, "");
|
|
242
|
+
if (!stripped || stripped === path) return rawToolName;
|
|
243
|
+
return stripped.split("/").filter(Boolean).join("_");
|
|
244
|
+
}
|
|
218
245
|
|
|
219
246
|
// src/ui/collapsible-result.tsx
|
|
220
247
|
var import_react = require("react");
|
|
@@ -252,7 +279,9 @@ var ICON_MAP = {
|
|
|
252
279
|
microsoft: import_lucide_react.Monitor,
|
|
253
280
|
outlook: import_lucide_react.Mail,
|
|
254
281
|
onedrive: import_lucide_react.HardDrive,
|
|
255
|
-
telegram: import_lucide_react.Send
|
|
282
|
+
telegram: import_lucide_react.Send,
|
|
283
|
+
whatsapp: import_lucide_react.MessageCircle,
|
|
284
|
+
browser: import_lucide_react.Globe
|
|
256
285
|
};
|
|
257
286
|
function ProviderIcon({ toolName, className = "h-4 w-4" }) {
|
|
258
287
|
const provider = getProviderFromToolName(toolName);
|
|
@@ -670,6 +699,40 @@ function getVideoSummary(data, toolName) {
|
|
|
670
699
|
}
|
|
671
700
|
return { text: isUnderstand ? "Video analysis" : "Video generation" };
|
|
672
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
|
+
}
|
|
673
736
|
function getBashSummary(data) {
|
|
674
737
|
if (typeof data !== "object" || data === null) return { text: "Command executed" };
|
|
675
738
|
const d = data;
|
|
@@ -712,6 +775,8 @@ var SUMMARY_MAP = {
|
|
|
712
775
|
image: getImageSummary,
|
|
713
776
|
audio: getAudioSummary,
|
|
714
777
|
video: getVideoSummary,
|
|
778
|
+
whatsapp: getWhatsappSummary,
|
|
779
|
+
browser: getBrowserSummary,
|
|
715
780
|
bash: getBashSummary,
|
|
716
781
|
generic: getGenericSummary
|
|
717
782
|
};
|
|
@@ -3055,17 +3120,143 @@ function LinkedInFormatter({ data }) {
|
|
|
3055
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) });
|
|
3056
3121
|
}
|
|
3057
3122
|
|
|
3058
|
-
// src/ui/formatters/
|
|
3123
|
+
// src/ui/formatters/whatsapp.tsx
|
|
3124
|
+
var import_lucide_react29 = require("lucide-react");
|
|
3059
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");
|
|
3060
3251
|
function GenericFormatter({ data }) {
|
|
3061
3252
|
if (data === null || data === void 0) {
|
|
3062
|
-
return /* @__PURE__ */ (0,
|
|
3253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-sm text-muted-foreground italic", children: "No data returned" });
|
|
3063
3254
|
}
|
|
3064
|
-
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) });
|
|
3065
3256
|
}
|
|
3066
3257
|
|
|
3067
3258
|
// src/ui/tool-result.tsx
|
|
3068
|
-
var
|
|
3259
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3069
3260
|
function extractToolName(part) {
|
|
3070
3261
|
if (part.type.startsWith("tool-") && part.type !== "tool-invocation") {
|
|
3071
3262
|
return part.type.slice(5);
|
|
@@ -3118,72 +3309,78 @@ function maybeNormalize(toolName, formatterType, data) {
|
|
|
3118
3309
|
function renderFormatter(formatterType, data) {
|
|
3119
3310
|
switch (formatterType) {
|
|
3120
3311
|
case "email":
|
|
3121
|
-
return /* @__PURE__ */ (0,
|
|
3312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EmailFormatter, { data });
|
|
3122
3313
|
case "calendar":
|
|
3123
|
-
return /* @__PURE__ */ (0,
|
|
3314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CalendarEventFormatter, { data });
|
|
3124
3315
|
case "slack":
|
|
3125
|
-
return /* @__PURE__ */ (0,
|
|
3316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SlackMessageFormatter, { data });
|
|
3126
3317
|
case "github":
|
|
3127
|
-
return /* @__PURE__ */ (0,
|
|
3318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(GithubFormatter, { data });
|
|
3128
3319
|
case "drive":
|
|
3129
|
-
return /* @__PURE__ */ (0,
|
|
3320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DriveFileFormatter, { data });
|
|
3130
3321
|
case "search":
|
|
3131
|
-
return /* @__PURE__ */ (0,
|
|
3322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SearchFormatter, { data });
|
|
3132
3323
|
case "docs":
|
|
3133
|
-
return /* @__PURE__ */ (0,
|
|
3324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DocsFormatter, { data });
|
|
3134
3325
|
case "sheets":
|
|
3135
|
-
return /* @__PURE__ */ (0,
|
|
3326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SheetsFormatter, { data });
|
|
3136
3327
|
case "slides":
|
|
3137
|
-
return /* @__PURE__ */ (0,
|
|
3328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SlidesFormatter, { data });
|
|
3138
3329
|
case "hubspot":
|
|
3139
|
-
return /* @__PURE__ */ (0,
|
|
3330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(HubspotFormatter, { data });
|
|
3140
3331
|
case "linear":
|
|
3141
|
-
return /* @__PURE__ */ (0,
|
|
3332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LinearFormatter, { data });
|
|
3142
3333
|
case "pipedrive":
|
|
3143
|
-
return /* @__PURE__ */ (0,
|
|
3334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PipedriveFormatter, { data });
|
|
3144
3335
|
case "compute":
|
|
3145
|
-
return /* @__PURE__ */ (0,
|
|
3336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ComputeFormatter, { data });
|
|
3146
3337
|
case "resend":
|
|
3147
|
-
return /* @__PURE__ */ (0,
|
|
3338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ResendFormatter, { data });
|
|
3148
3339
|
case "inbox":
|
|
3149
|
-
return /* @__PURE__ */ (0,
|
|
3340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(InboxFormatter, { data });
|
|
3150
3341
|
case "discord":
|
|
3151
|
-
return /* @__PURE__ */ (0,
|
|
3342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DiscordFormatter, { data });
|
|
3152
3343
|
case "notion":
|
|
3153
|
-
return /* @__PURE__ */ (0,
|
|
3344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(NotionFormatter, { data });
|
|
3154
3345
|
case "twitter":
|
|
3155
|
-
return /* @__PURE__ */ (0,
|
|
3346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TwitterFormatter, { data });
|
|
3156
3347
|
case "telegram":
|
|
3157
|
-
return /* @__PURE__ */ (0,
|
|
3348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TelegramFormatter, { data });
|
|
3158
3349
|
case "stripe":
|
|
3159
|
-
return /* @__PURE__ */ (0,
|
|
3350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(StripeFormatter, { data });
|
|
3160
3351
|
case "jira":
|
|
3161
|
-
return /* @__PURE__ */ (0,
|
|
3352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(JiraFormatter, { data });
|
|
3162
3353
|
case "salesforce":
|
|
3163
|
-
return /* @__PURE__ */ (0,
|
|
3354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SalesforceFormatter, { data });
|
|
3164
3355
|
case "brevo":
|
|
3165
|
-
return /* @__PURE__ */ (0,
|
|
3356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BrevoFormatter, { data });
|
|
3166
3357
|
case "calendly":
|
|
3167
|
-
return /* @__PURE__ */ (0,
|
|
3358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CalendlyFormatter, { data });
|
|
3168
3359
|
case "twilio":
|
|
3169
|
-
return /* @__PURE__ */ (0,
|
|
3360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TwilioFormatter, { data });
|
|
3170
3361
|
case "linkedin":
|
|
3171
|
-
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 });
|
|
3172
3367
|
default:
|
|
3173
|
-
return /* @__PURE__ */ (0,
|
|
3368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(GenericFormatter, { data });
|
|
3174
3369
|
}
|
|
3175
3370
|
}
|
|
3176
3371
|
function SupyagentToolResult({ part }) {
|
|
3177
3372
|
const state = extractState(part);
|
|
3178
3373
|
const result = extractResult(part);
|
|
3179
|
-
const
|
|
3374
|
+
const rawToolName = extractToolName(part);
|
|
3375
|
+
const args = extractArgs(part);
|
|
3376
|
+
const toolName = resolveToolName(rawToolName, args);
|
|
3180
3377
|
if (state !== "output-available" || result === void 0) {
|
|
3181
3378
|
return null;
|
|
3182
3379
|
}
|
|
3183
3380
|
const formatterType = getFormatterType(toolName);
|
|
3184
3381
|
const data = maybeNormalize(toolName, formatterType, result);
|
|
3185
3382
|
const summary = getSummary(formatterType, data, toolName);
|
|
3186
|
-
return /* @__PURE__ */ (0,
|
|
3383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3187
3384
|
CollapsibleResult,
|
|
3188
3385
|
{
|
|
3189
3386
|
toolName,
|
|
@@ -3196,7 +3393,7 @@ function SupyagentToolResult({ part }) {
|
|
|
3196
3393
|
|
|
3197
3394
|
// src/ui/tool-input.tsx
|
|
3198
3395
|
var import_react2 = __toESM(require("react"), 1);
|
|
3199
|
-
var
|
|
3396
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3200
3397
|
function formatValue(value) {
|
|
3201
3398
|
if (value === null || value === void 0) {
|
|
3202
3399
|
return { text: "null", muted: true };
|
|
@@ -3230,19 +3427,19 @@ function formatValue(value) {
|
|
|
3230
3427
|
}
|
|
3231
3428
|
function ToolInput({ args }) {
|
|
3232
3429
|
if (!args || Object.keys(args).length === 0) return null;
|
|
3233
|
-
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]) => {
|
|
3234
3431
|
const formatted = formatValue(value);
|
|
3235
|
-
return /* @__PURE__ */ (0,
|
|
3236
|
-
/* @__PURE__ */ (0,
|
|
3237
|
-
/* @__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 })
|
|
3238
3435
|
] }, key);
|
|
3239
3436
|
}) });
|
|
3240
3437
|
}
|
|
3241
3438
|
|
|
3242
3439
|
// src/ui/tool-action.tsx
|
|
3243
3440
|
var import_react3 = require("react");
|
|
3244
|
-
var
|
|
3245
|
-
var
|
|
3441
|
+
var import_lucide_react31 = require("lucide-react");
|
|
3442
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3246
3443
|
var BADGE_STYLES2 = {
|
|
3247
3444
|
default: "bg-muted text-muted-foreground",
|
|
3248
3445
|
success: "bg-green-500/10 text-green-500",
|
|
@@ -3275,59 +3472,59 @@ function SupyagentToolAction({ part, defaultExpanded = false }) {
|
|
|
3275
3472
|
const hasArgs = args && Object.keys(args).length > 0;
|
|
3276
3473
|
const hasExpandableContent = hasArgs || formatterOutput;
|
|
3277
3474
|
const canExpand = !isStreaming && hasExpandableContent;
|
|
3278
|
-
return /* @__PURE__ */ (0,
|
|
3475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
3279
3476
|
"div",
|
|
3280
3477
|
{
|
|
3281
3478
|
className: "rounded-lg border border-border bg-card overflow-hidden",
|
|
3282
3479
|
"data-state": isDone ? "done" : isError ? "error" : isStreaming ? "streaming" : "pending",
|
|
3283
3480
|
children: [
|
|
3284
|
-
/* @__PURE__ */ (0,
|
|
3481
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
3285
3482
|
"button",
|
|
3286
3483
|
{
|
|
3287
3484
|
type: "button",
|
|
3288
3485
|
onClick: () => canExpand && setExpanded(!expanded),
|
|
3289
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"}`,
|
|
3290
3487
|
children: [
|
|
3291
|
-
/* @__PURE__ */ (0,
|
|
3292
|
-
/* @__PURE__ */ (0,
|
|
3293
|
-
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" })
|
|
3294
3491
|
] }),
|
|
3295
|
-
/* @__PURE__ */ (0,
|
|
3296
|
-
/* @__PURE__ */ (0,
|
|
3297
|
-
summary && /* @__PURE__ */ (0,
|
|
3298
|
-
/* @__PURE__ */ (0,
|
|
3299
|
-
/* @__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 })
|
|
3300
3497
|
] }),
|
|
3301
|
-
!summary && /* @__PURE__ */ (0,
|
|
3302
|
-
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)(
|
|
3303
3500
|
"span",
|
|
3304
3501
|
{
|
|
3305
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"]}`,
|
|
3306
3503
|
children: summary.badge.text
|
|
3307
3504
|
}
|
|
3308
3505
|
),
|
|
3309
|
-
isDone && /* @__PURE__ */ (0,
|
|
3310
|
-
isError && /* @__PURE__ */ (0,
|
|
3311
|
-
/* @__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" }),
|
|
3312
3509
|
"Error"
|
|
3313
3510
|
] }),
|
|
3314
|
-
isStreaming && /* @__PURE__ */ (0,
|
|
3315
|
-
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" }))
|
|
3316
3513
|
]
|
|
3317
3514
|
}
|
|
3318
3515
|
),
|
|
3319
|
-
/* @__PURE__ */ (0,
|
|
3516
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3320
3517
|
"div",
|
|
3321
3518
|
{
|
|
3322
3519
|
className: "grid transition-[grid-template-rows] duration-200 ease-out",
|
|
3323
3520
|
style: { gridTemplateRows: expanded ? "1fr" : "0fr" },
|
|
3324
|
-
children: /* @__PURE__ */ (0,
|
|
3325
|
-
args && Object.keys(args).length > 0 && /* @__PURE__ */ (0,
|
|
3326
|
-
/* @__PURE__ */ (0,
|
|
3327
|
-
/* @__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 })
|
|
3328
3525
|
] }),
|
|
3329
|
-
formatterOutput && /* @__PURE__ */ (0,
|
|
3330
|
-
/* @__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" }),
|
|
3331
3528
|
formatterOutput
|
|
3332
3529
|
] })
|
|
3333
3530
|
] }) })
|
|
@@ -3340,8 +3537,8 @@ function SupyagentToolAction({ part, defaultExpanded = false }) {
|
|
|
3340
3537
|
|
|
3341
3538
|
// src/ui/tool-call.tsx
|
|
3342
3539
|
var import_react4 = require("react");
|
|
3343
|
-
var
|
|
3344
|
-
var
|
|
3540
|
+
var import_lucide_react32 = require("lucide-react");
|
|
3541
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3345
3542
|
function extractToolName2(part) {
|
|
3346
3543
|
if (part.type.startsWith("tool-") && part.type !== "tool-invocation") {
|
|
3347
3544
|
return part.type.slice(5);
|
|
@@ -3370,39 +3567,39 @@ function SupyagentToolCall({ part }) {
|
|
|
3370
3567
|
const isStreaming = state === "input-streaming";
|
|
3371
3568
|
const isError = state === "output-error";
|
|
3372
3569
|
const isDone = state === "output-available";
|
|
3373
|
-
return /* @__PURE__ */ (0,
|
|
3570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
3374
3571
|
"div",
|
|
3375
3572
|
{
|
|
3376
3573
|
className: "rounded-lg border border-border bg-card overflow-hidden",
|
|
3377
3574
|
"data-state": isDone ? "done" : isError ? "error" : isStreaming ? "streaming" : "pending",
|
|
3378
3575
|
children: [
|
|
3379
|
-
/* @__PURE__ */ (0,
|
|
3576
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
3380
3577
|
"button",
|
|
3381
3578
|
{
|
|
3382
3579
|
type: "button",
|
|
3383
3580
|
onClick: () => args && setExpanded(!expanded),
|
|
3384
3581
|
className: "flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-muted transition-colors",
|
|
3385
3582
|
children: [
|
|
3386
|
-
/* @__PURE__ */ (0,
|
|
3387
|
-
/* @__PURE__ */ (0,
|
|
3388
|
-
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" })
|
|
3389
3586
|
] }),
|
|
3390
|
-
/* @__PURE__ */ (0,
|
|
3391
|
-
/* @__PURE__ */ (0,
|
|
3392
|
-
isDone && /* @__PURE__ */ (0,
|
|
3393
|
-
/* @__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" }),
|
|
3394
3591
|
"Completed"
|
|
3395
3592
|
] }),
|
|
3396
|
-
isError && /* @__PURE__ */ (0,
|
|
3397
|
-
/* @__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" }),
|
|
3398
3595
|
"Error"
|
|
3399
3596
|
] }),
|
|
3400
|
-
isStreaming && /* @__PURE__ */ (0,
|
|
3401
|
-
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" }))
|
|
3402
3599
|
]
|
|
3403
3600
|
}
|
|
3404
3601
|
),
|
|
3405
|
-
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) }) })
|
|
3406
3603
|
]
|
|
3407
3604
|
}
|
|
3408
3605
|
);
|
|
@@ -3456,6 +3653,7 @@ function SupyagentToolCall({ part }) {
|
|
|
3456
3653
|
normalizeMicrosoftCalendar,
|
|
3457
3654
|
normalizeMicrosoftDrive,
|
|
3458
3655
|
normalizeMicrosoftMail,
|
|
3656
|
+
resolveToolName,
|
|
3459
3657
|
unwrapSupyagentResult
|
|
3460
3658
|
});
|
|
3461
3659
|
//# sourceMappingURL=react.cjs.map
|