@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 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);
@@ -124,7 +125,10 @@ var PROVIDER_LABELS = {
124
125
  salesforce: "Salesforce",
125
126
  brevo: "Brevo",
126
127
  calendly: "Calendly",
127
- twilio: "Twilio"
128
+ twilio: "Twilio",
129
+ image: "Image",
130
+ audio: "Audio",
131
+ video: "Video"
128
132
  };
129
133
  function getProviderLabel(provider) {
130
134
  return PROVIDER_LABELS[provider] || provider.charAt(0).toUpperCase() + provider.slice(1);
@@ -196,6 +200,17 @@ function getFormatterType(toolName) {
196
200
  return "twilio";
197
201
  case "linkedin":
198
202
  return "linkedin";
203
+ case "image":
204
+ return "image";
205
+ case "tts":
206
+ case "stt":
207
+ return "audio";
208
+ case "video":
209
+ return "video";
210
+ case "code":
211
+ return "compute";
212
+ case "ocr":
213
+ return "generic";
199
214
  case "bash":
200
215
  case "shell":
201
216
  return "bash";
@@ -203,6 +218,13 @@ function getFormatterType(toolName) {
203
218
  return "generic";
204
219
  }
205
220
  }
221
+ function resolveToolName(rawToolName, args) {
222
+ if (rawToolName !== "apiCall" || !args) return rawToolName;
223
+ const path = typeof args.path === "string" ? args.path : "";
224
+ const stripped = path.replace(/^\/api\/v1\//, "");
225
+ if (!stripped || stripped === path) return rawToolName;
226
+ return stripped.split("/").filter(Boolean).join("_");
227
+ }
206
228
 
207
229
  // src/ui/collapsible-result.tsx
208
230
  var import_react = require("react");
@@ -608,6 +630,56 @@ function getLinkedinSummary(data) {
608
630
  }
609
631
  return { text: "LinkedIn result" };
610
632
  }
633
+ function getImageSummary(data, toolName) {
634
+ if (typeof data === "object" && data !== null) {
635
+ const d = data;
636
+ if (d.status === "processing" || d.poll_url) {
637
+ return { text: "Generating image...", badge: { text: "processing", variant: "warning" } };
638
+ }
639
+ if (d.image_url) {
640
+ return { text: "Image generated", badge: { text: "done", variant: "success" } };
641
+ }
642
+ }
643
+ return { text: humanizeToolName(toolName) };
644
+ }
645
+ function getAudioSummary(data, toolName) {
646
+ const isTTS = toolName.toLowerCase().startsWith("tts");
647
+ if (typeof data === "object" && data !== null) {
648
+ const d = data;
649
+ if (d.status === "processing" || d.poll_url) {
650
+ return {
651
+ text: isTTS ? "Generating audio..." : "Transcribing...",
652
+ badge: { text: "processing", variant: "warning" }
653
+ };
654
+ }
655
+ if (d.audio_url) {
656
+ return { text: "Audio generated", badge: { text: "done", variant: "success" } };
657
+ }
658
+ if (d.result && typeof d.result === "object" && "text" in d.result) {
659
+ return { text: "Transcription complete", badge: { text: "done", variant: "success" } };
660
+ }
661
+ }
662
+ return { text: isTTS ? "Text-to-speech" : "Transcription" };
663
+ }
664
+ function getVideoSummary(data, toolName) {
665
+ const isUnderstand = toolName.toLowerCase().includes("understand");
666
+ if (typeof data === "object" && data !== null) {
667
+ const d = data;
668
+ if (d.status === "processing" || d.poll_url) {
669
+ return {
670
+ text: isUnderstand ? "Analyzing video..." : "Generating video...",
671
+ badge: { text: "processing", variant: "warning" }
672
+ };
673
+ }
674
+ if (d.answer) {
675
+ return { text: "Video analysis complete", badge: { text: "done", variant: "success" } };
676
+ }
677
+ if (d.result && typeof d.result === "object") {
678
+ return { text: "Video generated", badge: { text: "done", variant: "success" } };
679
+ }
680
+ }
681
+ return { text: isUnderstand ? "Video analysis" : "Video generation" };
682
+ }
611
683
  function getBashSummary(data) {
612
684
  if (typeof data !== "object" || data === null) return { text: "Command executed" };
613
685
  const d = data;
@@ -647,6 +719,9 @@ var SUMMARY_MAP = {
647
719
  calendly: getCalendlySummary,
648
720
  twilio: getTwilioSummary,
649
721
  linkedin: getLinkedinSummary,
722
+ image: getImageSummary,
723
+ audio: getAudioSummary,
724
+ video: getVideoSummary,
650
725
  bash: getBashSummary,
651
726
  generic: getGenericSummary
652
727
  };
@@ -3111,7 +3186,9 @@ function renderFormatter(formatterType, data) {
3111
3186
  function SupyagentToolResult({ part }) {
3112
3187
  const state = extractState(part);
3113
3188
  const result = extractResult(part);
3114
- const toolName = extractToolName(part);
3189
+ const rawToolName = extractToolName(part);
3190
+ const args = extractArgs(part);
3191
+ const toolName = resolveToolName(rawToolName, args);
3115
3192
  if (state !== "output-available" || result === void 0) {
3116
3193
  return null;
3117
3194
  }
@@ -3391,6 +3468,7 @@ function SupyagentToolCall({ part }) {
3391
3468
  normalizeMicrosoftCalendar,
3392
3469
  normalizeMicrosoftDrive,
3393
3470
  normalizeMicrosoftMail,
3471
+ resolveToolName,
3394
3472
  unwrapSupyagentResult
3395
3473
  });
3396
3474
  //# sourceMappingURL=react.cjs.map