@supyagent/sdk 0.1.23 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +25 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +139 -82
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +7 -2
- package/dist/react.d.ts +7 -2
- package/dist/react.js +142 -85
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -66,6 +66,7 @@ __export(react_exports, {
|
|
|
66
66
|
ToolInput: () => ToolInput,
|
|
67
67
|
TwilioFormatter: () => TwilioFormatter,
|
|
68
68
|
TwitterFormatter: () => TwitterFormatter,
|
|
69
|
+
ViewImageFormatter: () => ViewImageFormatter,
|
|
69
70
|
WhatsAppFormatter: () => WhatsAppFormatter,
|
|
70
71
|
extractArgs: () => extractArgs,
|
|
71
72
|
extractResult: () => extractResult,
|
|
@@ -213,6 +214,8 @@ function getFormatterType(toolName) {
|
|
|
213
214
|
return "whatsapp";
|
|
214
215
|
case "browser":
|
|
215
216
|
return "browser";
|
|
217
|
+
case "viewImage":
|
|
218
|
+
return "viewImage";
|
|
216
219
|
case "db":
|
|
217
220
|
return "compute";
|
|
218
221
|
case "files":
|
|
@@ -283,7 +286,8 @@ var ICON_MAP = {
|
|
|
283
286
|
onedrive: import_lucide_react.HardDrive,
|
|
284
287
|
telegram: import_lucide_react.Send,
|
|
285
288
|
whatsapp: import_lucide_react.MessageCircle,
|
|
286
|
-
browser: import_lucide_react.Globe
|
|
289
|
+
browser: import_lucide_react.Globe,
|
|
290
|
+
viewImage: import_lucide_react.Image
|
|
287
291
|
};
|
|
288
292
|
function ProviderIcon({ toolName, className = "h-4 w-4" }) {
|
|
289
293
|
const provider = getProviderFromToolName(toolName);
|
|
@@ -735,6 +739,20 @@ function getBrowserSummary(data, toolName) {
|
|
|
735
739
|
}
|
|
736
740
|
return { text: humanizeToolName(toolName) };
|
|
737
741
|
}
|
|
742
|
+
function getViewImageSummary(data) {
|
|
743
|
+
if (typeof data === "object" && data !== null) {
|
|
744
|
+
const d = data;
|
|
745
|
+
if (d.url && typeof d.url === "string") {
|
|
746
|
+
try {
|
|
747
|
+
const hostname = new URL(d.url).hostname.replace("www.", "");
|
|
748
|
+
return { text: `Image from ${hostname}` };
|
|
749
|
+
} catch {
|
|
750
|
+
return { text: "Image displayed" };
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return { text: "Image displayed" };
|
|
755
|
+
}
|
|
738
756
|
function getBashSummary(data) {
|
|
739
757
|
if (typeof data !== "object" || data === null) return { text: "Command executed" };
|
|
740
758
|
const d = data;
|
|
@@ -779,6 +797,7 @@ var SUMMARY_MAP = {
|
|
|
779
797
|
video: getVideoSummary,
|
|
780
798
|
whatsapp: getWhatsappSummary,
|
|
781
799
|
browser: getBrowserSummary,
|
|
800
|
+
viewImage: getViewImageSummary,
|
|
782
801
|
bash: getBashSummary,
|
|
783
802
|
generic: getGenericSummary
|
|
784
803
|
};
|
|
@@ -3248,17 +3267,52 @@ function BrowserFormatter({ data }) {
|
|
|
3248
3267
|
] });
|
|
3249
3268
|
}
|
|
3250
3269
|
|
|
3251
|
-
// src/ui/formatters/
|
|
3270
|
+
// src/ui/formatters/view-image.tsx
|
|
3271
|
+
var import_lucide_react31 = require("lucide-react");
|
|
3252
3272
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3273
|
+
function isViewImageData(data) {
|
|
3274
|
+
return typeof data === "object" && data !== null && "url" in data;
|
|
3275
|
+
}
|
|
3276
|
+
function getDomain3(url) {
|
|
3277
|
+
try {
|
|
3278
|
+
return new URL(url).hostname.replace("www.", "");
|
|
3279
|
+
} catch {
|
|
3280
|
+
return url;
|
|
3281
|
+
}
|
|
3282
|
+
}
|
|
3283
|
+
function ViewImageFormatter({ data }) {
|
|
3284
|
+
if (!isViewImageData(data) || !data.url) {
|
|
3285
|
+
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) });
|
|
3286
|
+
}
|
|
3287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "space-y-2", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "rounded-lg border border-border bg-background overflow-hidden", children: [
|
|
3288
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2 px-3 py-1.5 bg-muted border-b border-border", children: [
|
|
3289
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react31.Image, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
3290
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-xs text-muted-foreground flex-1 truncate", children: getDomain3(data.url) }),
|
|
3291
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("a", { href: data.url, target: "_blank", rel: "noopener noreferrer", className: "shrink-0 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react31.ExternalLink, { className: "h-3.5 w-3.5" }) })
|
|
3292
|
+
] }),
|
|
3293
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3294
|
+
"img",
|
|
3295
|
+
{
|
|
3296
|
+
src: data.url,
|
|
3297
|
+
alt: "Viewed image",
|
|
3298
|
+
className: "w-full rounded border border-border",
|
|
3299
|
+
loading: "lazy"
|
|
3300
|
+
}
|
|
3301
|
+
) })
|
|
3302
|
+
] }) });
|
|
3303
|
+
}
|
|
3304
|
+
|
|
3305
|
+
// src/ui/formatters/generic.tsx
|
|
3306
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3253
3307
|
function GenericFormatter({ data }) {
|
|
3254
3308
|
if (data === null || data === void 0) {
|
|
3255
|
-
return /* @__PURE__ */ (0,
|
|
3309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-sm text-muted-foreground italic", children: "No data returned" });
|
|
3256
3310
|
}
|
|
3257
|
-
return /* @__PURE__ */ (0,
|
|
3311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.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) });
|
|
3258
3312
|
}
|
|
3259
3313
|
|
|
3260
3314
|
// src/ui/tool-result.tsx
|
|
3261
|
-
var
|
|
3315
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3262
3316
|
function extractToolName(part) {
|
|
3263
3317
|
if (part.type.startsWith("tool-") && part.type !== "tool-invocation") {
|
|
3264
3318
|
return part.type.slice(5);
|
|
@@ -3311,63 +3365,65 @@ function maybeNormalize(toolName, formatterType, data) {
|
|
|
3311
3365
|
function renderFormatter(formatterType, data) {
|
|
3312
3366
|
switch (formatterType) {
|
|
3313
3367
|
case "email":
|
|
3314
|
-
return /* @__PURE__ */ (0,
|
|
3368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EmailFormatter, { data });
|
|
3315
3369
|
case "calendar":
|
|
3316
|
-
return /* @__PURE__ */ (0,
|
|
3370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CalendarEventFormatter, { data });
|
|
3317
3371
|
case "slack":
|
|
3318
|
-
return /* @__PURE__ */ (0,
|
|
3372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SlackMessageFormatter, { data });
|
|
3319
3373
|
case "github":
|
|
3320
|
-
return /* @__PURE__ */ (0,
|
|
3374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(GithubFormatter, { data });
|
|
3321
3375
|
case "drive":
|
|
3322
|
-
return /* @__PURE__ */ (0,
|
|
3376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DriveFileFormatter, { data });
|
|
3323
3377
|
case "search":
|
|
3324
|
-
return /* @__PURE__ */ (0,
|
|
3378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SearchFormatter, { data });
|
|
3325
3379
|
case "docs":
|
|
3326
|
-
return /* @__PURE__ */ (0,
|
|
3380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DocsFormatter, { data });
|
|
3327
3381
|
case "sheets":
|
|
3328
|
-
return /* @__PURE__ */ (0,
|
|
3382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SheetsFormatter, { data });
|
|
3329
3383
|
case "slides":
|
|
3330
|
-
return /* @__PURE__ */ (0,
|
|
3384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SlidesFormatter, { data });
|
|
3331
3385
|
case "hubspot":
|
|
3332
|
-
return /* @__PURE__ */ (0,
|
|
3386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(HubspotFormatter, { data });
|
|
3333
3387
|
case "linear":
|
|
3334
|
-
return /* @__PURE__ */ (0,
|
|
3388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LinearFormatter, { data });
|
|
3335
3389
|
case "pipedrive":
|
|
3336
|
-
return /* @__PURE__ */ (0,
|
|
3390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PipedriveFormatter, { data });
|
|
3337
3391
|
case "compute":
|
|
3338
|
-
return /* @__PURE__ */ (0,
|
|
3392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ComputeFormatter, { data });
|
|
3339
3393
|
case "resend":
|
|
3340
|
-
return /* @__PURE__ */ (0,
|
|
3394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ResendFormatter, { data });
|
|
3341
3395
|
case "inbox":
|
|
3342
|
-
return /* @__PURE__ */ (0,
|
|
3396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(InboxFormatter, { data });
|
|
3343
3397
|
case "discord":
|
|
3344
|
-
return /* @__PURE__ */ (0,
|
|
3398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DiscordFormatter, { data });
|
|
3345
3399
|
case "notion":
|
|
3346
|
-
return /* @__PURE__ */ (0,
|
|
3400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(NotionFormatter, { data });
|
|
3347
3401
|
case "twitter":
|
|
3348
|
-
return /* @__PURE__ */ (0,
|
|
3402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TwitterFormatter, { data });
|
|
3349
3403
|
case "telegram":
|
|
3350
|
-
return /* @__PURE__ */ (0,
|
|
3404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TelegramFormatter, { data });
|
|
3351
3405
|
case "stripe":
|
|
3352
|
-
return /* @__PURE__ */ (0,
|
|
3406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(StripeFormatter, { data });
|
|
3353
3407
|
case "jira":
|
|
3354
|
-
return /* @__PURE__ */ (0,
|
|
3408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(JiraFormatter, { data });
|
|
3355
3409
|
case "salesforce":
|
|
3356
|
-
return /* @__PURE__ */ (0,
|
|
3410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SalesforceFormatter, { data });
|
|
3357
3411
|
case "brevo":
|
|
3358
|
-
return /* @__PURE__ */ (0,
|
|
3412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(BrevoFormatter, { data });
|
|
3359
3413
|
case "calendly":
|
|
3360
|
-
return /* @__PURE__ */ (0,
|
|
3414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CalendlyFormatter, { data });
|
|
3361
3415
|
case "twilio":
|
|
3362
|
-
return /* @__PURE__ */ (0,
|
|
3416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TwilioFormatter, { data });
|
|
3363
3417
|
case "linkedin":
|
|
3364
|
-
return /* @__PURE__ */ (0,
|
|
3418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LinkedInFormatter, { data });
|
|
3365
3419
|
case "whatsapp":
|
|
3366
|
-
return /* @__PURE__ */ (0,
|
|
3420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(WhatsAppFormatter, { data });
|
|
3367
3421
|
case "browser":
|
|
3368
|
-
return /* @__PURE__ */ (0,
|
|
3422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(BrowserFormatter, { data });
|
|
3423
|
+
case "viewImage":
|
|
3424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ViewImageFormatter, { data });
|
|
3369
3425
|
default:
|
|
3370
|
-
return /* @__PURE__ */ (0,
|
|
3426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(GenericFormatter, { data });
|
|
3371
3427
|
}
|
|
3372
3428
|
}
|
|
3373
3429
|
function SupyagentToolResult({ part }) {
|
|
@@ -3382,7 +3438,7 @@ function SupyagentToolResult({ part }) {
|
|
|
3382
3438
|
const formatterType = getFormatterType(toolName);
|
|
3383
3439
|
const data = maybeNormalize(toolName, formatterType, result);
|
|
3384
3440
|
const summary = getSummary(formatterType, data, toolName);
|
|
3385
|
-
return /* @__PURE__ */ (0,
|
|
3441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3386
3442
|
CollapsibleResult,
|
|
3387
3443
|
{
|
|
3388
3444
|
toolName,
|
|
@@ -3395,7 +3451,7 @@ function SupyagentToolResult({ part }) {
|
|
|
3395
3451
|
|
|
3396
3452
|
// src/ui/tool-input.tsx
|
|
3397
3453
|
var import_react2 = __toESM(require("react"), 1);
|
|
3398
|
-
var
|
|
3454
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3399
3455
|
function formatValue(value) {
|
|
3400
3456
|
if (value === null || value === void 0) {
|
|
3401
3457
|
return { text: "null", muted: true };
|
|
@@ -3429,19 +3485,19 @@ function formatValue(value) {
|
|
|
3429
3485
|
}
|
|
3430
3486
|
function ToolInput({ args }) {
|
|
3431
3487
|
if (!args || Object.keys(args).length === 0) return null;
|
|
3432
|
-
return /* @__PURE__ */ (0,
|
|
3488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm", children: Object.entries(args).map(([key, value]) => {
|
|
3433
3489
|
const formatted = formatValue(value);
|
|
3434
|
-
return /* @__PURE__ */ (0,
|
|
3435
|
-
/* @__PURE__ */ (0,
|
|
3436
|
-
/* @__PURE__ */ (0,
|
|
3490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react2.default.Fragment, { children: [
|
|
3491
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-muted-foreground select-none", children: key }),
|
|
3492
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: formatted.muted ? "text-muted-foreground" : "text-foreground", children: formatted.text })
|
|
3437
3493
|
] }, key);
|
|
3438
3494
|
}) });
|
|
3439
3495
|
}
|
|
3440
3496
|
|
|
3441
3497
|
// src/ui/tool-action.tsx
|
|
3442
3498
|
var import_react3 = require("react");
|
|
3443
|
-
var
|
|
3444
|
-
var
|
|
3499
|
+
var import_lucide_react32 = require("lucide-react");
|
|
3500
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3445
3501
|
var BADGE_STYLES2 = {
|
|
3446
3502
|
default: "bg-muted text-muted-foreground",
|
|
3447
3503
|
success: "bg-green-500/10 text-green-500",
|
|
@@ -3474,59 +3530,59 @@ function SupyagentToolAction({ part, defaultExpanded = false }) {
|
|
|
3474
3530
|
const hasArgs = args && Object.keys(args).length > 0;
|
|
3475
3531
|
const hasExpandableContent = hasArgs || formatterOutput;
|
|
3476
3532
|
const canExpand = !isStreaming && hasExpandableContent;
|
|
3477
|
-
return /* @__PURE__ */ (0,
|
|
3533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
3478
3534
|
"div",
|
|
3479
3535
|
{
|
|
3480
3536
|
className: "rounded-lg border border-border bg-card overflow-hidden",
|
|
3481
3537
|
"data-state": isDone ? "done" : isError ? "error" : isStreaming ? "streaming" : "pending",
|
|
3482
3538
|
children: [
|
|
3483
|
-
/* @__PURE__ */ (0,
|
|
3539
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
3484
3540
|
"button",
|
|
3485
3541
|
{
|
|
3486
3542
|
type: "button",
|
|
3487
3543
|
onClick: () => canExpand && setExpanded(!expanded),
|
|
3488
3544
|
className: `flex items-center gap-2 w-full px-3 py-2 text-left transition-colors ${canExpand ? "hover:bg-muted cursor-pointer" : "cursor-default"}`,
|
|
3489
3545
|
children: [
|
|
3490
|
-
/* @__PURE__ */ (0,
|
|
3491
|
-
/* @__PURE__ */ (0,
|
|
3492
|
-
isStreaming && /* @__PURE__ */ (0,
|
|
3546
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "relative shrink-0", children: [
|
|
3547
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ProviderIcon, { toolName, className: "h-4 w-4 text-muted-foreground" }),
|
|
3548
|
+
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" })
|
|
3493
3549
|
] }),
|
|
3494
|
-
/* @__PURE__ */ (0,
|
|
3495
|
-
/* @__PURE__ */ (0,
|
|
3496
|
-
summary && /* @__PURE__ */ (0,
|
|
3497
|
-
/* @__PURE__ */ (0,
|
|
3498
|
-
/* @__PURE__ */ (0,
|
|
3550
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-xs text-muted-foreground", children: providerLabel }),
|
|
3551
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-sm text-foreground", children: actionLabel }),
|
|
3552
|
+
summary && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
3553
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-muted-foreground text-xs", children: "\xB7" }),
|
|
3554
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-sm text-muted-foreground flex-1 truncate", children: summary.text })
|
|
3499
3555
|
] }),
|
|
3500
|
-
!summary && /* @__PURE__ */ (0,
|
|
3501
|
-
summary?.badge && /* @__PURE__ */ (0,
|
|
3556
|
+
!summary && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "flex-1" }),
|
|
3557
|
+
summary?.badge && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3502
3558
|
"span",
|
|
3503
3559
|
{
|
|
3504
3560
|
className: `inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium shrink-0 ${BADGE_STYLES2[summary.badge.variant || "default"]}`,
|
|
3505
3561
|
children: summary.badge.text
|
|
3506
3562
|
}
|
|
3507
3563
|
),
|
|
3508
|
-
isDone && /* @__PURE__ */ (0,
|
|
3509
|
-
isError && /* @__PURE__ */ (0,
|
|
3510
|
-
/* @__PURE__ */ (0,
|
|
3564
|
+
isDone && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react32.Check, { className: "h-3.5 w-3.5 text-green-500 shrink-0" }),
|
|
3565
|
+
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 shrink-0", children: [
|
|
3566
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react32.AlertCircle, { className: "h-3 w-3" }),
|
|
3511
3567
|
"Error"
|
|
3512
3568
|
] }),
|
|
3513
|
-
isStreaming && /* @__PURE__ */ (0,
|
|
3514
|
-
canExpand && (expanded ? /* @__PURE__ */ (0,
|
|
3569
|
+
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 shrink-0", children: "Calling..." }),
|
|
3570
|
+
canExpand && (expanded ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react32.ChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react32.ChevronRight, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }))
|
|
3515
3571
|
]
|
|
3516
3572
|
}
|
|
3517
3573
|
),
|
|
3518
|
-
/* @__PURE__ */ (0,
|
|
3574
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3519
3575
|
"div",
|
|
3520
3576
|
{
|
|
3521
3577
|
className: "grid transition-[grid-template-rows] duration-200 ease-out",
|
|
3522
3578
|
style: { gridTemplateRows: expanded ? "1fr" : "0fr" },
|
|
3523
|
-
children: /* @__PURE__ */ (0,
|
|
3524
|
-
args && Object.keys(args).length > 0 && /* @__PURE__ */ (0,
|
|
3525
|
-
/* @__PURE__ */ (0,
|
|
3526
|
-
/* @__PURE__ */ (0,
|
|
3579
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "border-t border-border px-3 py-2 space-y-3", children: [
|
|
3580
|
+
args && Object.keys(args).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
|
|
3581
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5", children: "Input" }),
|
|
3582
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ToolInput, { args })
|
|
3527
3583
|
] }),
|
|
3528
|
-
formatterOutput && /* @__PURE__ */ (0,
|
|
3529
|
-
/* @__PURE__ */ (0,
|
|
3584
|
+
formatterOutput && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
|
|
3585
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5", children: "Output" }),
|
|
3530
3586
|
formatterOutput
|
|
3531
3587
|
] })
|
|
3532
3588
|
] }) })
|
|
@@ -3539,8 +3595,8 @@ function SupyagentToolAction({ part, defaultExpanded = false }) {
|
|
|
3539
3595
|
|
|
3540
3596
|
// src/ui/tool-call.tsx
|
|
3541
3597
|
var import_react4 = require("react");
|
|
3542
|
-
var
|
|
3543
|
-
var
|
|
3598
|
+
var import_lucide_react33 = require("lucide-react");
|
|
3599
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3544
3600
|
function extractToolName2(part) {
|
|
3545
3601
|
if (part.type.startsWith("tool-") && part.type !== "tool-invocation") {
|
|
3546
3602
|
return part.type.slice(5);
|
|
@@ -3569,39 +3625,39 @@ function SupyagentToolCall({ part }) {
|
|
|
3569
3625
|
const isStreaming = state === "input-streaming";
|
|
3570
3626
|
const isError = state === "output-error";
|
|
3571
3627
|
const isDone = state === "output-available";
|
|
3572
|
-
return /* @__PURE__ */ (0,
|
|
3628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
3573
3629
|
"div",
|
|
3574
3630
|
{
|
|
3575
3631
|
className: "rounded-lg border border-border bg-card overflow-hidden",
|
|
3576
3632
|
"data-state": isDone ? "done" : isError ? "error" : isStreaming ? "streaming" : "pending",
|
|
3577
3633
|
children: [
|
|
3578
|
-
/* @__PURE__ */ (0,
|
|
3634
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
3579
3635
|
"button",
|
|
3580
3636
|
{
|
|
3581
3637
|
type: "button",
|
|
3582
3638
|
onClick: () => args && setExpanded(!expanded),
|
|
3583
3639
|
className: "flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-muted transition-colors",
|
|
3584
3640
|
children: [
|
|
3585
|
-
/* @__PURE__ */ (0,
|
|
3586
|
-
/* @__PURE__ */ (0,
|
|
3587
|
-
isStreaming && /* @__PURE__ */ (0,
|
|
3641
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "relative", children: [
|
|
3642
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ProviderIcon, { toolName, className: "h-4 w-4 text-muted-foreground" }),
|
|
3643
|
+
isStreaming && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react33.Loader2, { className: "absolute -top-1 -right-1 h-3 w-3 text-primary animate-spin" })
|
|
3588
3644
|
] }),
|
|
3589
|
-
/* @__PURE__ */ (0,
|
|
3590
|
-
/* @__PURE__ */ (0,
|
|
3591
|
-
isDone && /* @__PURE__ */ (0,
|
|
3592
|
-
/* @__PURE__ */ (0,
|
|
3645
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-xs text-muted-foreground", children: providerLabel }),
|
|
3646
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-sm text-foreground flex-1", children: actionLabel }),
|
|
3647
|
+
isDone && /* @__PURE__ */ (0, import_jsx_runtime36.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: [
|
|
3648
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react33.Check, { className: "h-3 w-3" }),
|
|
3593
3649
|
"Completed"
|
|
3594
3650
|
] }),
|
|
3595
|
-
isError && /* @__PURE__ */ (0,
|
|
3596
|
-
/* @__PURE__ */ (0,
|
|
3651
|
+
isError && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-xs text-destructive", children: [
|
|
3652
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react33.AlertCircle, { className: "h-3 w-3" }),
|
|
3597
3653
|
"Error"
|
|
3598
3654
|
] }),
|
|
3599
|
-
isStreaming && /* @__PURE__ */ (0,
|
|
3600
|
-
args && (expanded ? /* @__PURE__ */ (0,
|
|
3655
|
+
isStreaming && /* @__PURE__ */ (0, import_jsx_runtime36.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..." }),
|
|
3656
|
+
args && (expanded ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react33.ChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react33.ChevronRight, { className: "h-3.5 w-3.5 text-muted-foreground" }))
|
|
3601
3657
|
]
|
|
3602
3658
|
}
|
|
3603
3659
|
),
|
|
3604
|
-
expanded && args && /* @__PURE__ */ (0,
|
|
3660
|
+
expanded && args && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "border-t border-border px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { className: "text-xs text-muted-foreground overflow-x-auto", children: JSON.stringify(args, null, 2) }) })
|
|
3605
3661
|
]
|
|
3606
3662
|
}
|
|
3607
3663
|
);
|
|
@@ -3643,6 +3699,7 @@ function SupyagentToolCall({ part }) {
|
|
|
3643
3699
|
ToolInput,
|
|
3644
3700
|
TwilioFormatter,
|
|
3645
3701
|
TwitterFormatter,
|
|
3702
|
+
ViewImageFormatter,
|
|
3646
3703
|
WhatsAppFormatter,
|
|
3647
3704
|
extractArgs,
|
|
3648
3705
|
extractResult,
|