@supyagent/sdk 0.1.19 → 0.1.21
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 +80 -2
- 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 +79 -2
- package/dist/react.js.map +1 -1
- package/package.json +10 -10
package/dist/react.d.cts
CHANGED
|
@@ -21,8 +21,14 @@ 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" | "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" | "generic";
|
|
25
25
|
declare function getFormatterType(toolName: string): FormatterType;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve a virtual tool name for rendering purposes.
|
|
28
|
+
* For `apiCall`, derives the tool name from the API path in args.
|
|
29
|
+
* For all other tools, returns the raw name unchanged.
|
|
30
|
+
*/
|
|
31
|
+
declare function resolveToolName(rawToolName: string, args?: Record<string, unknown>): string;
|
|
26
32
|
|
|
27
33
|
interface ToolResultPart {
|
|
28
34
|
type: string;
|
|
@@ -261,4 +267,4 @@ interface LinkedInFormatterProps {
|
|
|
261
267
|
}
|
|
262
268
|
declare function LinkedInFormatter({ data }: LinkedInFormatterProps): react_jsx_runtime.JSX.Element;
|
|
263
269
|
|
|
264
|
-
export { BrevoFormatter, 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, extractArgs, extractResult, extractState, extractToolName, getFormatterType, getProviderFromToolName, getProviderLabel, getSummary, humanizeToolName, maybeNormalize, normalizeMicrosoftCalendar, normalizeMicrosoftDrive, normalizeMicrosoftMail, unwrapSupyagentResult };
|
|
270
|
+
export { BrevoFormatter, 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, extractArgs, extractResult, extractState, extractToolName, getFormatterType, getProviderFromToolName, getProviderLabel, getSummary, humanizeToolName, maybeNormalize, normalizeMicrosoftCalendar, normalizeMicrosoftDrive, normalizeMicrosoftMail, resolveToolName, unwrapSupyagentResult };
|
package/dist/react.d.ts
CHANGED
|
@@ -21,8 +21,14 @@ 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" | "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" | "generic";
|
|
25
25
|
declare function getFormatterType(toolName: string): FormatterType;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve a virtual tool name for rendering purposes.
|
|
28
|
+
* For `apiCall`, derives the tool name from the API path in args.
|
|
29
|
+
* For all other tools, returns the raw name unchanged.
|
|
30
|
+
*/
|
|
31
|
+
declare function resolveToolName(rawToolName: string, args?: Record<string, unknown>): string;
|
|
26
32
|
|
|
27
33
|
interface ToolResultPart {
|
|
28
34
|
type: string;
|
|
@@ -261,4 +267,4 @@ interface LinkedInFormatterProps {
|
|
|
261
267
|
}
|
|
262
268
|
declare function LinkedInFormatter({ data }: LinkedInFormatterProps): react_jsx_runtime.JSX.Element;
|
|
263
269
|
|
|
264
|
-
export { BrevoFormatter, 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, extractArgs, extractResult, extractState, extractToolName, getFormatterType, getProviderFromToolName, getProviderLabel, getSummary, humanizeToolName, maybeNormalize, normalizeMicrosoftCalendar, normalizeMicrosoftDrive, normalizeMicrosoftMail, unwrapSupyagentResult };
|
|
270
|
+
export { BrevoFormatter, 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, extractArgs, extractResult, extractState, extractToolName, getFormatterType, getProviderFromToolName, getProviderLabel, getSummary, humanizeToolName, maybeNormalize, normalizeMicrosoftCalendar, normalizeMicrosoftDrive, normalizeMicrosoftMail, resolveToolName, unwrapSupyagentResult };
|
package/dist/react.js
CHANGED
|
@@ -42,7 +42,10 @@ var PROVIDER_LABELS = {
|
|
|
42
42
|
salesforce: "Salesforce",
|
|
43
43
|
brevo: "Brevo",
|
|
44
44
|
calendly: "Calendly",
|
|
45
|
-
twilio: "Twilio"
|
|
45
|
+
twilio: "Twilio",
|
|
46
|
+
image: "Image",
|
|
47
|
+
audio: "Audio",
|
|
48
|
+
video: "Video"
|
|
46
49
|
};
|
|
47
50
|
function getProviderLabel(provider) {
|
|
48
51
|
return PROVIDER_LABELS[provider] || provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
@@ -114,6 +117,17 @@ function getFormatterType(toolName) {
|
|
|
114
117
|
return "twilio";
|
|
115
118
|
case "linkedin":
|
|
116
119
|
return "linkedin";
|
|
120
|
+
case "image":
|
|
121
|
+
return "image";
|
|
122
|
+
case "tts":
|
|
123
|
+
case "stt":
|
|
124
|
+
return "audio";
|
|
125
|
+
case "video":
|
|
126
|
+
return "video";
|
|
127
|
+
case "code":
|
|
128
|
+
return "compute";
|
|
129
|
+
case "ocr":
|
|
130
|
+
return "generic";
|
|
117
131
|
case "bash":
|
|
118
132
|
case "shell":
|
|
119
133
|
return "bash";
|
|
@@ -121,6 +135,13 @@ function getFormatterType(toolName) {
|
|
|
121
135
|
return "generic";
|
|
122
136
|
}
|
|
123
137
|
}
|
|
138
|
+
function resolveToolName(rawToolName, args) {
|
|
139
|
+
if (rawToolName !== "apiCall" || !args) return rawToolName;
|
|
140
|
+
const path = typeof args.path === "string" ? args.path : "";
|
|
141
|
+
const stripped = path.replace(/^\/api\/v1\//, "");
|
|
142
|
+
if (!stripped || stripped === path) return rawToolName;
|
|
143
|
+
return stripped.split("/").filter(Boolean).join("_");
|
|
144
|
+
}
|
|
124
145
|
|
|
125
146
|
// src/ui/collapsible-result.tsx
|
|
126
147
|
import { useState } from "react";
|
|
@@ -551,6 +572,56 @@ function getLinkedinSummary(data) {
|
|
|
551
572
|
}
|
|
552
573
|
return { text: "LinkedIn result" };
|
|
553
574
|
}
|
|
575
|
+
function getImageSummary(data, toolName) {
|
|
576
|
+
if (typeof data === "object" && data !== null) {
|
|
577
|
+
const d = data;
|
|
578
|
+
if (d.status === "processing" || d.poll_url) {
|
|
579
|
+
return { text: "Generating image...", badge: { text: "processing", variant: "warning" } };
|
|
580
|
+
}
|
|
581
|
+
if (d.image_url) {
|
|
582
|
+
return { text: "Image generated", badge: { text: "done", variant: "success" } };
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return { text: humanizeToolName(toolName) };
|
|
586
|
+
}
|
|
587
|
+
function getAudioSummary(data, toolName) {
|
|
588
|
+
const isTTS = toolName.toLowerCase().startsWith("tts");
|
|
589
|
+
if (typeof data === "object" && data !== null) {
|
|
590
|
+
const d = data;
|
|
591
|
+
if (d.status === "processing" || d.poll_url) {
|
|
592
|
+
return {
|
|
593
|
+
text: isTTS ? "Generating audio..." : "Transcribing...",
|
|
594
|
+
badge: { text: "processing", variant: "warning" }
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
if (d.audio_url) {
|
|
598
|
+
return { text: "Audio generated", badge: { text: "done", variant: "success" } };
|
|
599
|
+
}
|
|
600
|
+
if (d.result && typeof d.result === "object" && "text" in d.result) {
|
|
601
|
+
return { text: "Transcription complete", badge: { text: "done", variant: "success" } };
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
return { text: isTTS ? "Text-to-speech" : "Transcription" };
|
|
605
|
+
}
|
|
606
|
+
function getVideoSummary(data, toolName) {
|
|
607
|
+
const isUnderstand = toolName.toLowerCase().includes("understand");
|
|
608
|
+
if (typeof data === "object" && data !== null) {
|
|
609
|
+
const d = data;
|
|
610
|
+
if (d.status === "processing" || d.poll_url) {
|
|
611
|
+
return {
|
|
612
|
+
text: isUnderstand ? "Analyzing video..." : "Generating video...",
|
|
613
|
+
badge: { text: "processing", variant: "warning" }
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
if (d.answer) {
|
|
617
|
+
return { text: "Video analysis complete", badge: { text: "done", variant: "success" } };
|
|
618
|
+
}
|
|
619
|
+
if (d.result && typeof d.result === "object") {
|
|
620
|
+
return { text: "Video generated", badge: { text: "done", variant: "success" } };
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return { text: isUnderstand ? "Video analysis" : "Video generation" };
|
|
624
|
+
}
|
|
554
625
|
function getBashSummary(data) {
|
|
555
626
|
if (typeof data !== "object" || data === null) return { text: "Command executed" };
|
|
556
627
|
const d = data;
|
|
@@ -590,6 +661,9 @@ var SUMMARY_MAP = {
|
|
|
590
661
|
calendly: getCalendlySummary,
|
|
591
662
|
twilio: getTwilioSummary,
|
|
592
663
|
linkedin: getLinkedinSummary,
|
|
664
|
+
image: getImageSummary,
|
|
665
|
+
audio: getAudioSummary,
|
|
666
|
+
video: getVideoSummary,
|
|
593
667
|
bash: getBashSummary,
|
|
594
668
|
generic: getGenericSummary
|
|
595
669
|
};
|
|
@@ -3063,7 +3137,9 @@ function renderFormatter(formatterType, data) {
|
|
|
3063
3137
|
function SupyagentToolResult({ part }) {
|
|
3064
3138
|
const state = extractState(part);
|
|
3065
3139
|
const result = extractResult(part);
|
|
3066
|
-
const
|
|
3140
|
+
const rawToolName = extractToolName(part);
|
|
3141
|
+
const args = extractArgs(part);
|
|
3142
|
+
const toolName = resolveToolName(rawToolName, args);
|
|
3067
3143
|
if (state !== "output-available" || result === void 0) {
|
|
3068
3144
|
return null;
|
|
3069
3145
|
}
|
|
@@ -3342,6 +3418,7 @@ export {
|
|
|
3342
3418
|
normalizeMicrosoftCalendar,
|
|
3343
3419
|
normalizeMicrosoftDrive,
|
|
3344
3420
|
normalizeMicrosoftMail,
|
|
3421
|
+
resolveToolName,
|
|
3345
3422
|
unwrapSupyagentResult
|
|
3346
3423
|
};
|
|
3347
3424
|
//# sourceMappingURL=react.js.map
|