@supyagent/sdk 0.1.25 → 0.1.26

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
@@ -222,6 +222,8 @@ function getFormatterType(toolName) {
222
222
  return "drive";
223
223
  case "radar":
224
224
  return "search";
225
+ case "jobs":
226
+ return "jobs";
225
227
  case "image":
226
228
  return "image";
227
229
  case "tts":
@@ -245,7 +247,11 @@ function resolveToolName(rawToolName, args) {
245
247
  const path = typeof args.path === "string" ? args.path : "";
246
248
  const stripped = path.replace(/^\/api\/v1\//, "");
247
249
  if (!stripped || stripped === path) return rawToolName;
248
- return stripped.split("/").filter(Boolean).join("_");
250
+ const segments = stripped.split("/").filter(Boolean);
251
+ if (segments[0] === "jobs" && segments.length === 2) {
252
+ return "jobs_status";
253
+ }
254
+ return segments.join("_");
249
255
  }
250
256
 
251
257
  // src/ui/collapsible-result.tsx
@@ -762,6 +768,35 @@ function getBashSummary(data) {
762
768
  if (exitCode === 0) return { text: "Command succeeded", badge: { text: "exit 0", variant: "success" } };
763
769
  return { text: `Command failed`, badge: { text: `exit ${exitCode}`, variant: "error" } };
764
770
  }
771
+ function getJobsSummary(data) {
772
+ if (typeof data !== "object" || data === null) return { text: "Job status" };
773
+ const d = data;
774
+ const service = typeof d.service === "string" ? d.service : "";
775
+ const action = typeof d.action === "string" ? d.action : "";
776
+ const label = service ? `${service.charAt(0).toUpperCase() + service.slice(1)}${action ? ` ${action}` : ""}` : "Job";
777
+ if (d.status === "processing") {
778
+ return { text: `Checking ${label.toLowerCase()}...`, badge: { text: "processing", variant: "warning" } };
779
+ }
780
+ if (d.status === "completed") {
781
+ const elapsed = formatElapsed(d.created_at, d.completed_at);
782
+ return { text: elapsed ? `${label} completed in ${elapsed}` : `${label} completed`, badge: { text: "done", variant: "success" } };
783
+ }
784
+ if (d.status === "failed" || d.error) {
785
+ return { text: `${label} failed`, badge: { text: "failed", variant: "error" } };
786
+ }
787
+ return { text: `${label} status` };
788
+ }
789
+ function formatElapsed(start, end) {
790
+ if (typeof start !== "string") return void 0;
791
+ const s = new Date(start).getTime();
792
+ const e = typeof end === "string" ? new Date(end).getTime() : Date.now();
793
+ if (isNaN(s) || isNaN(e)) return void 0;
794
+ const sec = Math.round((e - s) / 1e3);
795
+ if (sec < 60) return `${sec}s`;
796
+ const min = Math.floor(sec / 60);
797
+ const rem = sec % 60;
798
+ return rem > 0 ? `${min}m ${rem}s` : `${min}m`;
799
+ }
765
800
  function getGenericSummary(_data, toolName) {
766
801
  return { text: humanizeToolName(toolName) };
767
802
  }
@@ -799,6 +834,7 @@ var SUMMARY_MAP = {
799
834
  browser: getBrowserSummary,
800
835
  viewImage: getViewImageSummary,
801
836
  bash: getBashSummary,
837
+ jobs: getJobsSummary,
802
838
  generic: getGenericSummary
803
839
  };
804
840
  function getSummary(formatterType, data, toolName) {