@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.d.cts
CHANGED
|
@@ -21,7 +21,7 @@ declare function getProviderLabel(provider: string): string;
|
|
|
21
21
|
/**
|
|
22
22
|
* Determine which formatter to use based on tool name prefix.
|
|
23
23
|
*/
|
|
24
|
-
type FormatterType = "email" | "calendar" | "slack" | "github" | "drive" | "search" | "docs" | "sheets" | "slides" | "hubspot" | "linear" | "pipedrive" | "compute" | "resend" | "inbox" | "discord" | "notion" | "twitter" | "telegram" | "stripe" | "jira" | "salesforce" | "brevo" | "calendly" | "twilio" | "linkedin" | "bash" | "image" | "audio" | "video" | "whatsapp" | "browser" | "generic";
|
|
24
|
+
type FormatterType = "email" | "calendar" | "slack" | "github" | "drive" | "search" | "docs" | "sheets" | "slides" | "hubspot" | "linear" | "pipedrive" | "compute" | "resend" | "inbox" | "discord" | "notion" | "twitter" | "telegram" | "stripe" | "jira" | "salesforce" | "brevo" | "calendly" | "twilio" | "linkedin" | "bash" | "image" | "audio" | "video" | "whatsapp" | "browser" | "viewImage" | "generic";
|
|
25
25
|
declare function getFormatterType(toolName: string): FormatterType;
|
|
26
26
|
/**
|
|
27
27
|
* Resolve a virtual tool name for rendering purposes.
|
|
@@ -277,4 +277,9 @@ interface BrowserFormatterProps {
|
|
|
277
277
|
}
|
|
278
278
|
declare function BrowserFormatter({ data }: BrowserFormatterProps): react_jsx_runtime.JSX.Element;
|
|
279
279
|
|
|
280
|
-
|
|
280
|
+
interface ViewImageFormatterProps {
|
|
281
|
+
data: unknown;
|
|
282
|
+
}
|
|
283
|
+
declare function ViewImageFormatter({ data }: ViewImageFormatterProps): react_jsx_runtime.JSX.Element;
|
|
284
|
+
|
|
285
|
+
export { BrevoFormatter, BrowserFormatter, CalendarEventFormatter, CalendlyFormatter, CollapsibleResult, type CollapsibleResultProps, ComputeFormatter, DiscordFormatter, DocsFormatter, DriveFileFormatter, EmailFormatter, type FormatterType, GenericFormatter, GithubFormatter, HubspotFormatter, InboxFormatter, JiraFormatter, LinearFormatter, LinkedInFormatter, NotionFormatter, PROVIDER_LABELS, PipedriveFormatter, ProviderIcon, ResendFormatter, SalesforceFormatter, SearchFormatter, SheetsFormatter, SlackMessageFormatter, SlidesFormatter, StripeFormatter, type SummaryResult, SupyagentToolAction, SupyagentToolCall, SupyagentToolResult, TelegramFormatter, ToolInput, type ToolResultPart, TwilioFormatter, TwitterFormatter, ViewImageFormatter, WhatsAppFormatter, extractArgs, extractResult, extractState, extractToolName, getFormatterType, getProviderFromToolName, getProviderLabel, getSummary, humanizeToolName, maybeNormalize, normalizeMicrosoftCalendar, normalizeMicrosoftDrive, normalizeMicrosoftMail, resolveToolName, unwrapSupyagentResult };
|
package/dist/react.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ declare function getProviderLabel(provider: string): string;
|
|
|
21
21
|
/**
|
|
22
22
|
* Determine which formatter to use based on tool name prefix.
|
|
23
23
|
*/
|
|
24
|
-
type FormatterType = "email" | "calendar" | "slack" | "github" | "drive" | "search" | "docs" | "sheets" | "slides" | "hubspot" | "linear" | "pipedrive" | "compute" | "resend" | "inbox" | "discord" | "notion" | "twitter" | "telegram" | "stripe" | "jira" | "salesforce" | "brevo" | "calendly" | "twilio" | "linkedin" | "bash" | "image" | "audio" | "video" | "whatsapp" | "browser" | "generic";
|
|
24
|
+
type FormatterType = "email" | "calendar" | "slack" | "github" | "drive" | "search" | "docs" | "sheets" | "slides" | "hubspot" | "linear" | "pipedrive" | "compute" | "resend" | "inbox" | "discord" | "notion" | "twitter" | "telegram" | "stripe" | "jira" | "salesforce" | "brevo" | "calendly" | "twilio" | "linkedin" | "bash" | "image" | "audio" | "video" | "whatsapp" | "browser" | "viewImage" | "generic";
|
|
25
25
|
declare function getFormatterType(toolName: string): FormatterType;
|
|
26
26
|
/**
|
|
27
27
|
* Resolve a virtual tool name for rendering purposes.
|
|
@@ -277,4 +277,9 @@ interface BrowserFormatterProps {
|
|
|
277
277
|
}
|
|
278
278
|
declare function BrowserFormatter({ data }: BrowserFormatterProps): react_jsx_runtime.JSX.Element;
|
|
279
279
|
|
|
280
|
-
|
|
280
|
+
interface ViewImageFormatterProps {
|
|
281
|
+
data: unknown;
|
|
282
|
+
}
|
|
283
|
+
declare function ViewImageFormatter({ data }: ViewImageFormatterProps): react_jsx_runtime.JSX.Element;
|
|
284
|
+
|
|
285
|
+
export { BrevoFormatter, BrowserFormatter, CalendarEventFormatter, CalendlyFormatter, CollapsibleResult, type CollapsibleResultProps, ComputeFormatter, DiscordFormatter, DocsFormatter, DriveFileFormatter, EmailFormatter, type FormatterType, GenericFormatter, GithubFormatter, HubspotFormatter, InboxFormatter, JiraFormatter, LinearFormatter, LinkedInFormatter, NotionFormatter, PROVIDER_LABELS, PipedriveFormatter, ProviderIcon, ResendFormatter, SalesforceFormatter, SearchFormatter, SheetsFormatter, SlackMessageFormatter, SlidesFormatter, StripeFormatter, type SummaryResult, SupyagentToolAction, SupyagentToolCall, SupyagentToolResult, TelegramFormatter, ToolInput, type ToolResultPart, TwilioFormatter, TwitterFormatter, ViewImageFormatter, WhatsAppFormatter, extractArgs, extractResult, extractState, extractToolName, getFormatterType, getProviderFromToolName, getProviderLabel, getSummary, humanizeToolName, maybeNormalize, normalizeMicrosoftCalendar, normalizeMicrosoftDrive, normalizeMicrosoftMail, resolveToolName, unwrapSupyagentResult };
|
package/dist/react.js
CHANGED
|
@@ -128,6 +128,8 @@ function getFormatterType(toolName) {
|
|
|
128
128
|
return "whatsapp";
|
|
129
129
|
case "browser":
|
|
130
130
|
return "browser";
|
|
131
|
+
case "viewImage":
|
|
132
|
+
return "viewImage";
|
|
131
133
|
case "db":
|
|
132
134
|
return "compute";
|
|
133
135
|
case "files":
|
|
@@ -190,7 +192,8 @@ import {
|
|
|
190
192
|
MessageCircle,
|
|
191
193
|
UserCircle,
|
|
192
194
|
Monitor,
|
|
193
|
-
Globe
|
|
195
|
+
Globe,
|
|
196
|
+
Image
|
|
194
197
|
} from "lucide-react";
|
|
195
198
|
import { jsx } from "react/jsx-runtime";
|
|
196
199
|
var ICON_MAP = {
|
|
@@ -224,7 +227,8 @@ var ICON_MAP = {
|
|
|
224
227
|
onedrive: HardDrive,
|
|
225
228
|
telegram: Send,
|
|
226
229
|
whatsapp: MessageCircle,
|
|
227
|
-
browser: Globe
|
|
230
|
+
browser: Globe,
|
|
231
|
+
viewImage: Image
|
|
228
232
|
};
|
|
229
233
|
function ProviderIcon({ toolName, className = "h-4 w-4" }) {
|
|
230
234
|
const provider = getProviderFromToolName(toolName);
|
|
@@ -676,6 +680,20 @@ function getBrowserSummary(data, toolName) {
|
|
|
676
680
|
}
|
|
677
681
|
return { text: humanizeToolName(toolName) };
|
|
678
682
|
}
|
|
683
|
+
function getViewImageSummary(data) {
|
|
684
|
+
if (typeof data === "object" && data !== null) {
|
|
685
|
+
const d = data;
|
|
686
|
+
if (d.url && typeof d.url === "string") {
|
|
687
|
+
try {
|
|
688
|
+
const hostname = new URL(d.url).hostname.replace("www.", "");
|
|
689
|
+
return { text: `Image from ${hostname}` };
|
|
690
|
+
} catch {
|
|
691
|
+
return { text: "Image displayed" };
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
return { text: "Image displayed" };
|
|
696
|
+
}
|
|
679
697
|
function getBashSummary(data) {
|
|
680
698
|
if (typeof data !== "object" || data === null) return { text: "Command executed" };
|
|
681
699
|
const d = data;
|
|
@@ -720,6 +738,7 @@ var SUMMARY_MAP = {
|
|
|
720
738
|
video: getVideoSummary,
|
|
721
739
|
whatsapp: getWhatsappSummary,
|
|
722
740
|
browser: getBrowserSummary,
|
|
741
|
+
viewImage: getViewImageSummary,
|
|
723
742
|
bash: getBashSummary,
|
|
724
743
|
generic: getGenericSummary
|
|
725
744
|
};
|
|
@@ -1170,7 +1189,7 @@ function GithubFormatter({ data }) {
|
|
|
1170
1189
|
}
|
|
1171
1190
|
|
|
1172
1191
|
// src/ui/formatters/drive-file.tsx
|
|
1173
|
-
import { FileText as FileText2, Folder, Image, Film, FileSpreadsheet, ExternalLink, Users as UsersIcon } from "lucide-react";
|
|
1192
|
+
import { FileText as FileText2, Folder, Image as Image2, Film, FileSpreadsheet, ExternalLink, Users as UsersIcon } from "lucide-react";
|
|
1174
1193
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1175
1194
|
function isDriveFile(data) {
|
|
1176
1195
|
return typeof data === "object" && data !== null && ("name" in data || "mimeType" in data);
|
|
@@ -1178,7 +1197,7 @@ function isDriveFile(data) {
|
|
|
1178
1197
|
function getFileIcon(mimeType) {
|
|
1179
1198
|
if (!mimeType) return FileText2;
|
|
1180
1199
|
if (mimeType.includes("folder")) return Folder;
|
|
1181
|
-
if (mimeType.includes("image")) return
|
|
1200
|
+
if (mimeType.includes("image")) return Image2;
|
|
1182
1201
|
if (mimeType.includes("video")) return Film;
|
|
1183
1202
|
if (mimeType.includes("spreadsheet") || mimeType.includes("excel")) return FileSpreadsheet;
|
|
1184
1203
|
return FileText2;
|
|
@@ -3133,7 +3152,7 @@ function WhatsAppFormatter({ data }) {
|
|
|
3133
3152
|
}
|
|
3134
3153
|
|
|
3135
3154
|
// src/ui/formatters/browser.tsx
|
|
3136
|
-
import { Globe as Globe3, ExternalLink as ExternalLink8, FileText as FileText7, Image as
|
|
3155
|
+
import { Globe as Globe3, ExternalLink as ExternalLink8, FileText as FileText7, Image as Image3 } from "lucide-react";
|
|
3137
3156
|
import { jsx as jsx30, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3138
3157
|
function isBrowserData(data) {
|
|
3139
3158
|
if (typeof data !== "object" || data === null) return false;
|
|
@@ -3164,7 +3183,7 @@ function BrowserFormatter({ data }) {
|
|
|
3164
3183
|
] }) }),
|
|
3165
3184
|
screenshotUrl && /* @__PURE__ */ jsxs29("div", { className: "rounded-lg border border-border bg-background overflow-hidden", children: [
|
|
3166
3185
|
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-1.5 px-3 py-1.5 bg-muted border-b border-border", children: [
|
|
3167
|
-
/* @__PURE__ */ jsx30(
|
|
3186
|
+
/* @__PURE__ */ jsx30(Image3, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
3168
3187
|
/* @__PURE__ */ jsx30("span", { className: "text-xs text-muted-foreground", children: "Screenshot" })
|
|
3169
3188
|
] }),
|
|
3170
3189
|
/* @__PURE__ */ jsx30("div", { className: "p-2", children: /* @__PURE__ */ jsx30(
|
|
@@ -3198,17 +3217,52 @@ function BrowserFormatter({ data }) {
|
|
|
3198
3217
|
] });
|
|
3199
3218
|
}
|
|
3200
3219
|
|
|
3220
|
+
// src/ui/formatters/view-image.tsx
|
|
3221
|
+
import { Image as Image4, ExternalLink as ExternalLink9 } from "lucide-react";
|
|
3222
|
+
import { jsx as jsx31, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3223
|
+
function isViewImageData(data) {
|
|
3224
|
+
return typeof data === "object" && data !== null && "url" in data;
|
|
3225
|
+
}
|
|
3226
|
+
function getDomain3(url) {
|
|
3227
|
+
try {
|
|
3228
|
+
return new URL(url).hostname.replace("www.", "");
|
|
3229
|
+
} catch {
|
|
3230
|
+
return url;
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
function ViewImageFormatter({ data }) {
|
|
3234
|
+
if (!isViewImageData(data) || !data.url) {
|
|
3235
|
+
return /* @__PURE__ */ jsx31("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) });
|
|
3236
|
+
}
|
|
3237
|
+
return /* @__PURE__ */ jsx31("div", { className: "space-y-2", children: /* @__PURE__ */ jsxs30("div", { className: "rounded-lg border border-border bg-background overflow-hidden", children: [
|
|
3238
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2 px-3 py-1.5 bg-muted border-b border-border", children: [
|
|
3239
|
+
/* @__PURE__ */ jsx31(Image4, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
3240
|
+
/* @__PURE__ */ jsx31("span", { className: "text-xs text-muted-foreground flex-1 truncate", children: getDomain3(data.url) }),
|
|
3241
|
+
/* @__PURE__ */ jsx31("a", { href: data.url, target: "_blank", rel: "noopener noreferrer", className: "shrink-0 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx31(ExternalLink9, { className: "h-3.5 w-3.5" }) })
|
|
3242
|
+
] }),
|
|
3243
|
+
/* @__PURE__ */ jsx31("div", { className: "p-2", children: /* @__PURE__ */ jsx31(
|
|
3244
|
+
"img",
|
|
3245
|
+
{
|
|
3246
|
+
src: data.url,
|
|
3247
|
+
alt: "Viewed image",
|
|
3248
|
+
className: "w-full rounded border border-border",
|
|
3249
|
+
loading: "lazy"
|
|
3250
|
+
}
|
|
3251
|
+
) })
|
|
3252
|
+
] }) });
|
|
3253
|
+
}
|
|
3254
|
+
|
|
3201
3255
|
// src/ui/formatters/generic.tsx
|
|
3202
|
-
import { jsx as
|
|
3256
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
3203
3257
|
function GenericFormatter({ data }) {
|
|
3204
3258
|
if (data === null || data === void 0) {
|
|
3205
|
-
return /* @__PURE__ */
|
|
3259
|
+
return /* @__PURE__ */ jsx32("p", { className: "text-sm text-muted-foreground italic", children: "No data returned" });
|
|
3206
3260
|
}
|
|
3207
|
-
return /* @__PURE__ */
|
|
3261
|
+
return /* @__PURE__ */ jsx32("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) });
|
|
3208
3262
|
}
|
|
3209
3263
|
|
|
3210
3264
|
// src/ui/tool-result.tsx
|
|
3211
|
-
import { jsx as
|
|
3265
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
3212
3266
|
function extractToolName(part) {
|
|
3213
3267
|
if (part.type.startsWith("tool-") && part.type !== "tool-invocation") {
|
|
3214
3268
|
return part.type.slice(5);
|
|
@@ -3261,63 +3315,65 @@ function maybeNormalize(toolName, formatterType, data) {
|
|
|
3261
3315
|
function renderFormatter(formatterType, data) {
|
|
3262
3316
|
switch (formatterType) {
|
|
3263
3317
|
case "email":
|
|
3264
|
-
return /* @__PURE__ */
|
|
3318
|
+
return /* @__PURE__ */ jsx33(EmailFormatter, { data });
|
|
3265
3319
|
case "calendar":
|
|
3266
|
-
return /* @__PURE__ */
|
|
3320
|
+
return /* @__PURE__ */ jsx33(CalendarEventFormatter, { data });
|
|
3267
3321
|
case "slack":
|
|
3268
|
-
return /* @__PURE__ */
|
|
3322
|
+
return /* @__PURE__ */ jsx33(SlackMessageFormatter, { data });
|
|
3269
3323
|
case "github":
|
|
3270
|
-
return /* @__PURE__ */
|
|
3324
|
+
return /* @__PURE__ */ jsx33(GithubFormatter, { data });
|
|
3271
3325
|
case "drive":
|
|
3272
|
-
return /* @__PURE__ */
|
|
3326
|
+
return /* @__PURE__ */ jsx33(DriveFileFormatter, { data });
|
|
3273
3327
|
case "search":
|
|
3274
|
-
return /* @__PURE__ */
|
|
3328
|
+
return /* @__PURE__ */ jsx33(SearchFormatter, { data });
|
|
3275
3329
|
case "docs":
|
|
3276
|
-
return /* @__PURE__ */
|
|
3330
|
+
return /* @__PURE__ */ jsx33(DocsFormatter, { data });
|
|
3277
3331
|
case "sheets":
|
|
3278
|
-
return /* @__PURE__ */
|
|
3332
|
+
return /* @__PURE__ */ jsx33(SheetsFormatter, { data });
|
|
3279
3333
|
case "slides":
|
|
3280
|
-
return /* @__PURE__ */
|
|
3334
|
+
return /* @__PURE__ */ jsx33(SlidesFormatter, { data });
|
|
3281
3335
|
case "hubspot":
|
|
3282
|
-
return /* @__PURE__ */
|
|
3336
|
+
return /* @__PURE__ */ jsx33(HubspotFormatter, { data });
|
|
3283
3337
|
case "linear":
|
|
3284
|
-
return /* @__PURE__ */
|
|
3338
|
+
return /* @__PURE__ */ jsx33(LinearFormatter, { data });
|
|
3285
3339
|
case "pipedrive":
|
|
3286
|
-
return /* @__PURE__ */
|
|
3340
|
+
return /* @__PURE__ */ jsx33(PipedriveFormatter, { data });
|
|
3287
3341
|
case "compute":
|
|
3288
|
-
return /* @__PURE__ */
|
|
3342
|
+
return /* @__PURE__ */ jsx33(ComputeFormatter, { data });
|
|
3289
3343
|
case "resend":
|
|
3290
|
-
return /* @__PURE__ */
|
|
3344
|
+
return /* @__PURE__ */ jsx33(ResendFormatter, { data });
|
|
3291
3345
|
case "inbox":
|
|
3292
|
-
return /* @__PURE__ */
|
|
3346
|
+
return /* @__PURE__ */ jsx33(InboxFormatter, { data });
|
|
3293
3347
|
case "discord":
|
|
3294
|
-
return /* @__PURE__ */
|
|
3348
|
+
return /* @__PURE__ */ jsx33(DiscordFormatter, { data });
|
|
3295
3349
|
case "notion":
|
|
3296
|
-
return /* @__PURE__ */
|
|
3350
|
+
return /* @__PURE__ */ jsx33(NotionFormatter, { data });
|
|
3297
3351
|
case "twitter":
|
|
3298
|
-
return /* @__PURE__ */
|
|
3352
|
+
return /* @__PURE__ */ jsx33(TwitterFormatter, { data });
|
|
3299
3353
|
case "telegram":
|
|
3300
|
-
return /* @__PURE__ */
|
|
3354
|
+
return /* @__PURE__ */ jsx33(TelegramFormatter, { data });
|
|
3301
3355
|
case "stripe":
|
|
3302
|
-
return /* @__PURE__ */
|
|
3356
|
+
return /* @__PURE__ */ jsx33(StripeFormatter, { data });
|
|
3303
3357
|
case "jira":
|
|
3304
|
-
return /* @__PURE__ */
|
|
3358
|
+
return /* @__PURE__ */ jsx33(JiraFormatter, { data });
|
|
3305
3359
|
case "salesforce":
|
|
3306
|
-
return /* @__PURE__ */
|
|
3360
|
+
return /* @__PURE__ */ jsx33(SalesforceFormatter, { data });
|
|
3307
3361
|
case "brevo":
|
|
3308
|
-
return /* @__PURE__ */
|
|
3362
|
+
return /* @__PURE__ */ jsx33(BrevoFormatter, { data });
|
|
3309
3363
|
case "calendly":
|
|
3310
|
-
return /* @__PURE__ */
|
|
3364
|
+
return /* @__PURE__ */ jsx33(CalendlyFormatter, { data });
|
|
3311
3365
|
case "twilio":
|
|
3312
|
-
return /* @__PURE__ */
|
|
3366
|
+
return /* @__PURE__ */ jsx33(TwilioFormatter, { data });
|
|
3313
3367
|
case "linkedin":
|
|
3314
|
-
return /* @__PURE__ */
|
|
3368
|
+
return /* @__PURE__ */ jsx33(LinkedInFormatter, { data });
|
|
3315
3369
|
case "whatsapp":
|
|
3316
|
-
return /* @__PURE__ */
|
|
3370
|
+
return /* @__PURE__ */ jsx33(WhatsAppFormatter, { data });
|
|
3317
3371
|
case "browser":
|
|
3318
|
-
return /* @__PURE__ */
|
|
3372
|
+
return /* @__PURE__ */ jsx33(BrowserFormatter, { data });
|
|
3373
|
+
case "viewImage":
|
|
3374
|
+
return /* @__PURE__ */ jsx33(ViewImageFormatter, { data });
|
|
3319
3375
|
default:
|
|
3320
|
-
return /* @__PURE__ */
|
|
3376
|
+
return /* @__PURE__ */ jsx33(GenericFormatter, { data });
|
|
3321
3377
|
}
|
|
3322
3378
|
}
|
|
3323
3379
|
function SupyagentToolResult({ part }) {
|
|
@@ -3332,7 +3388,7 @@ function SupyagentToolResult({ part }) {
|
|
|
3332
3388
|
const formatterType = getFormatterType(toolName);
|
|
3333
3389
|
const data = maybeNormalize(toolName, formatterType, result);
|
|
3334
3390
|
const summary = getSummary(formatterType, data, toolName);
|
|
3335
|
-
return /* @__PURE__ */
|
|
3391
|
+
return /* @__PURE__ */ jsx33(
|
|
3336
3392
|
CollapsibleResult,
|
|
3337
3393
|
{
|
|
3338
3394
|
toolName,
|
|
@@ -3345,7 +3401,7 @@ function SupyagentToolResult({ part }) {
|
|
|
3345
3401
|
|
|
3346
3402
|
// src/ui/tool-input.tsx
|
|
3347
3403
|
import React2 from "react";
|
|
3348
|
-
import { jsx as
|
|
3404
|
+
import { jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3349
3405
|
function formatValue(value) {
|
|
3350
3406
|
if (value === null || value === void 0) {
|
|
3351
3407
|
return { text: "null", muted: true };
|
|
@@ -3379,11 +3435,11 @@ function formatValue(value) {
|
|
|
3379
3435
|
}
|
|
3380
3436
|
function ToolInput({ args }) {
|
|
3381
3437
|
if (!args || Object.keys(args).length === 0) return null;
|
|
3382
|
-
return /* @__PURE__ */
|
|
3438
|
+
return /* @__PURE__ */ jsx34("div", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm", children: Object.entries(args).map(([key, value]) => {
|
|
3383
3439
|
const formatted = formatValue(value);
|
|
3384
|
-
return /* @__PURE__ */
|
|
3385
|
-
/* @__PURE__ */
|
|
3386
|
-
/* @__PURE__ */
|
|
3440
|
+
return /* @__PURE__ */ jsxs31(React2.Fragment, { children: [
|
|
3441
|
+
/* @__PURE__ */ jsx34("span", { className: "text-muted-foreground select-none", children: key }),
|
|
3442
|
+
/* @__PURE__ */ jsx34("span", { className: formatted.muted ? "text-muted-foreground" : "text-foreground", children: formatted.text })
|
|
3387
3443
|
] }, key);
|
|
3388
3444
|
}) });
|
|
3389
3445
|
}
|
|
@@ -3391,7 +3447,7 @@ function ToolInput({ args }) {
|
|
|
3391
3447
|
// src/ui/tool-action.tsx
|
|
3392
3448
|
import { useState as useState2 } from "react";
|
|
3393
3449
|
import { ChevronDown as ChevronDown2, ChevronRight as ChevronRight2, Check as Check3, AlertCircle, Loader2 } from "lucide-react";
|
|
3394
|
-
import { Fragment, jsx as
|
|
3450
|
+
import { Fragment, jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3395
3451
|
var BADGE_STYLES2 = {
|
|
3396
3452
|
default: "bg-muted text-muted-foreground",
|
|
3397
3453
|
success: "bg-green-500/10 text-green-500",
|
|
@@ -3424,59 +3480,59 @@ function SupyagentToolAction({ part, defaultExpanded = false }) {
|
|
|
3424
3480
|
const hasArgs = args && Object.keys(args).length > 0;
|
|
3425
3481
|
const hasExpandableContent = hasArgs || formatterOutput;
|
|
3426
3482
|
const canExpand = !isStreaming && hasExpandableContent;
|
|
3427
|
-
return /* @__PURE__ */
|
|
3483
|
+
return /* @__PURE__ */ jsxs32(
|
|
3428
3484
|
"div",
|
|
3429
3485
|
{
|
|
3430
3486
|
className: "rounded-lg border border-border bg-card overflow-hidden",
|
|
3431
3487
|
"data-state": isDone ? "done" : isError ? "error" : isStreaming ? "streaming" : "pending",
|
|
3432
3488
|
children: [
|
|
3433
|
-
/* @__PURE__ */
|
|
3489
|
+
/* @__PURE__ */ jsxs32(
|
|
3434
3490
|
"button",
|
|
3435
3491
|
{
|
|
3436
3492
|
type: "button",
|
|
3437
3493
|
onClick: () => canExpand && setExpanded(!expanded),
|
|
3438
3494
|
className: `flex items-center gap-2 w-full px-3 py-2 text-left transition-colors ${canExpand ? "hover:bg-muted cursor-pointer" : "cursor-default"}`,
|
|
3439
3495
|
children: [
|
|
3440
|
-
/* @__PURE__ */
|
|
3441
|
-
/* @__PURE__ */
|
|
3442
|
-
isStreaming && /* @__PURE__ */
|
|
3496
|
+
/* @__PURE__ */ jsxs32("div", { className: "relative shrink-0", children: [
|
|
3497
|
+
/* @__PURE__ */ jsx35(ProviderIcon, { toolName, className: "h-4 w-4 text-muted-foreground" }),
|
|
3498
|
+
isStreaming && /* @__PURE__ */ jsx35(Loader2, { className: "absolute -top-1 -right-1 h-3 w-3 text-primary animate-spin" })
|
|
3443
3499
|
] }),
|
|
3444
|
-
/* @__PURE__ */
|
|
3445
|
-
/* @__PURE__ */
|
|
3446
|
-
summary && /* @__PURE__ */
|
|
3447
|
-
/* @__PURE__ */
|
|
3448
|
-
/* @__PURE__ */
|
|
3500
|
+
/* @__PURE__ */ jsx35("span", { className: "text-xs text-muted-foreground", children: providerLabel }),
|
|
3501
|
+
/* @__PURE__ */ jsx35("span", { className: "text-sm text-foreground", children: actionLabel }),
|
|
3502
|
+
summary && /* @__PURE__ */ jsxs32(Fragment, { children: [
|
|
3503
|
+
/* @__PURE__ */ jsx35("span", { className: "text-muted-foreground text-xs", children: "\xB7" }),
|
|
3504
|
+
/* @__PURE__ */ jsx35("span", { className: "text-sm text-muted-foreground flex-1 truncate", children: summary.text })
|
|
3449
3505
|
] }),
|
|
3450
|
-
!summary && /* @__PURE__ */
|
|
3451
|
-
summary?.badge && /* @__PURE__ */
|
|
3506
|
+
!summary && /* @__PURE__ */ jsx35("span", { className: "flex-1" }),
|
|
3507
|
+
summary?.badge && /* @__PURE__ */ jsx35(
|
|
3452
3508
|
"span",
|
|
3453
3509
|
{
|
|
3454
3510
|
className: `inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium shrink-0 ${BADGE_STYLES2[summary.badge.variant || "default"]}`,
|
|
3455
3511
|
children: summary.badge.text
|
|
3456
3512
|
}
|
|
3457
3513
|
),
|
|
3458
|
-
isDone && /* @__PURE__ */
|
|
3459
|
-
isError && /* @__PURE__ */
|
|
3460
|
-
/* @__PURE__ */
|
|
3514
|
+
isDone && /* @__PURE__ */ jsx35(Check3, { className: "h-3.5 w-3.5 text-green-500 shrink-0" }),
|
|
3515
|
+
isError && /* @__PURE__ */ jsxs32("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: [
|
|
3516
|
+
/* @__PURE__ */ jsx35(AlertCircle, { className: "h-3 w-3" }),
|
|
3461
3517
|
"Error"
|
|
3462
3518
|
] }),
|
|
3463
|
-
isStreaming && /* @__PURE__ */
|
|
3464
|
-
canExpand && (expanded ? /* @__PURE__ */
|
|
3519
|
+
isStreaming && /* @__PURE__ */ jsx35("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..." }),
|
|
3520
|
+
canExpand && (expanded ? /* @__PURE__ */ jsx35(ChevronDown2, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }) : /* @__PURE__ */ jsx35(ChevronRight2, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }))
|
|
3465
3521
|
]
|
|
3466
3522
|
}
|
|
3467
3523
|
),
|
|
3468
|
-
/* @__PURE__ */
|
|
3524
|
+
/* @__PURE__ */ jsx35(
|
|
3469
3525
|
"div",
|
|
3470
3526
|
{
|
|
3471
3527
|
className: "grid transition-[grid-template-rows] duration-200 ease-out",
|
|
3472
3528
|
style: { gridTemplateRows: expanded ? "1fr" : "0fr" },
|
|
3473
|
-
children: /* @__PURE__ */
|
|
3474
|
-
args && Object.keys(args).length > 0 && /* @__PURE__ */
|
|
3475
|
-
/* @__PURE__ */
|
|
3476
|
-
/* @__PURE__ */
|
|
3529
|
+
children: /* @__PURE__ */ jsx35("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsxs32("div", { className: "border-t border-border px-3 py-2 space-y-3", children: [
|
|
3530
|
+
args && Object.keys(args).length > 0 && /* @__PURE__ */ jsxs32("div", { children: [
|
|
3531
|
+
/* @__PURE__ */ jsx35("p", { className: "text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5", children: "Input" }),
|
|
3532
|
+
/* @__PURE__ */ jsx35(ToolInput, { args })
|
|
3477
3533
|
] }),
|
|
3478
|
-
formatterOutput && /* @__PURE__ */
|
|
3479
|
-
/* @__PURE__ */
|
|
3534
|
+
formatterOutput && /* @__PURE__ */ jsxs32("div", { children: [
|
|
3535
|
+
/* @__PURE__ */ jsx35("p", { className: "text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5", children: "Output" }),
|
|
3480
3536
|
formatterOutput
|
|
3481
3537
|
] })
|
|
3482
3538
|
] }) })
|
|
@@ -3490,7 +3546,7 @@ function SupyagentToolAction({ part, defaultExpanded = false }) {
|
|
|
3490
3546
|
// src/ui/tool-call.tsx
|
|
3491
3547
|
import { useState as useState3 } from "react";
|
|
3492
3548
|
import { ChevronDown as ChevronDown3, ChevronRight as ChevronRight3, Check as Check4, AlertCircle as AlertCircle2, Loader2 as Loader22 } from "lucide-react";
|
|
3493
|
-
import { jsx as
|
|
3549
|
+
import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3494
3550
|
function extractToolName2(part) {
|
|
3495
3551
|
if (part.type.startsWith("tool-") && part.type !== "tool-invocation") {
|
|
3496
3552
|
return part.type.slice(5);
|
|
@@ -3519,39 +3575,39 @@ function SupyagentToolCall({ part }) {
|
|
|
3519
3575
|
const isStreaming = state === "input-streaming";
|
|
3520
3576
|
const isError = state === "output-error";
|
|
3521
3577
|
const isDone = state === "output-available";
|
|
3522
|
-
return /* @__PURE__ */
|
|
3578
|
+
return /* @__PURE__ */ jsxs33(
|
|
3523
3579
|
"div",
|
|
3524
3580
|
{
|
|
3525
3581
|
className: "rounded-lg border border-border bg-card overflow-hidden",
|
|
3526
3582
|
"data-state": isDone ? "done" : isError ? "error" : isStreaming ? "streaming" : "pending",
|
|
3527
3583
|
children: [
|
|
3528
|
-
/* @__PURE__ */
|
|
3584
|
+
/* @__PURE__ */ jsxs33(
|
|
3529
3585
|
"button",
|
|
3530
3586
|
{
|
|
3531
3587
|
type: "button",
|
|
3532
3588
|
onClick: () => args && setExpanded(!expanded),
|
|
3533
3589
|
className: "flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-muted transition-colors",
|
|
3534
3590
|
children: [
|
|
3535
|
-
/* @__PURE__ */
|
|
3536
|
-
/* @__PURE__ */
|
|
3537
|
-
isStreaming && /* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ jsxs33("div", { className: "relative", children: [
|
|
3592
|
+
/* @__PURE__ */ jsx36(ProviderIcon, { toolName, className: "h-4 w-4 text-muted-foreground" }),
|
|
3593
|
+
isStreaming && /* @__PURE__ */ jsx36(Loader22, { className: "absolute -top-1 -right-1 h-3 w-3 text-primary animate-spin" })
|
|
3538
3594
|
] }),
|
|
3539
|
-
/* @__PURE__ */
|
|
3540
|
-
/* @__PURE__ */
|
|
3541
|
-
isDone && /* @__PURE__ */
|
|
3542
|
-
/* @__PURE__ */
|
|
3595
|
+
/* @__PURE__ */ jsx36("span", { className: "text-xs text-muted-foreground", children: providerLabel }),
|
|
3596
|
+
/* @__PURE__ */ jsx36("span", { className: "text-sm text-foreground flex-1", children: actionLabel }),
|
|
3597
|
+
isDone && /* @__PURE__ */ jsxs33("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: [
|
|
3598
|
+
/* @__PURE__ */ jsx36(Check4, { className: "h-3 w-3" }),
|
|
3543
3599
|
"Completed"
|
|
3544
3600
|
] }),
|
|
3545
|
-
isError && /* @__PURE__ */
|
|
3546
|
-
/* @__PURE__ */
|
|
3601
|
+
isError && /* @__PURE__ */ jsxs33("span", { className: "inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-xs text-destructive", children: [
|
|
3602
|
+
/* @__PURE__ */ jsx36(AlertCircle2, { className: "h-3 w-3" }),
|
|
3547
3603
|
"Error"
|
|
3548
3604
|
] }),
|
|
3549
|
-
isStreaming && /* @__PURE__ */
|
|
3550
|
-
args && (expanded ? /* @__PURE__ */
|
|
3605
|
+
isStreaming && /* @__PURE__ */ jsx36("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..." }),
|
|
3606
|
+
args && (expanded ? /* @__PURE__ */ jsx36(ChevronDown3, { className: "h-3.5 w-3.5 text-muted-foreground" }) : /* @__PURE__ */ jsx36(ChevronRight3, { className: "h-3.5 w-3.5 text-muted-foreground" }))
|
|
3551
3607
|
]
|
|
3552
3608
|
}
|
|
3553
3609
|
),
|
|
3554
|
-
expanded && args && /* @__PURE__ */
|
|
3610
|
+
expanded && args && /* @__PURE__ */ jsx36("div", { className: "border-t border-border px-3 py-2", children: /* @__PURE__ */ jsx36("pre", { className: "text-xs text-muted-foreground overflow-x-auto", children: JSON.stringify(args, null, 2) }) })
|
|
3555
3611
|
]
|
|
3556
3612
|
}
|
|
3557
3613
|
);
|
|
@@ -3592,6 +3648,7 @@ export {
|
|
|
3592
3648
|
ToolInput,
|
|
3593
3649
|
TwilioFormatter,
|
|
3594
3650
|
TwitterFormatter,
|
|
3651
|
+
ViewImageFormatter,
|
|
3595
3652
|
WhatsAppFormatter,
|
|
3596
3653
|
extractArgs,
|
|
3597
3654
|
extractResult,
|