@supyagent/sdk 0.1.11 → 0.1.13

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.d.cts CHANGED
@@ -1,26 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
 
4
- interface ToolCallPart {
5
- type: string;
6
- toolName?: string;
7
- toolCallId?: string;
8
- state?: string;
9
- input?: Record<string, unknown>;
10
- output?: unknown;
11
- toolInvocation?: {
12
- toolName: string;
13
- state: string;
14
- args?: Record<string, unknown>;
15
- result?: unknown;
16
- };
17
- args?: Record<string, unknown>;
18
- }
19
- interface SupyagentToolCallProps {
20
- part: ToolCallPart;
21
- }
22
- declare function SupyagentToolCall({ part }: SupyagentToolCallProps): react_jsx_runtime.JSX.Element;
23
-
24
4
  /**
25
5
  * Extract provider/service prefix from a tool name.
26
6
  * Tool names follow `{service}_{action}` convention.
@@ -30,10 +10,19 @@ declare function getProviderFromToolName(toolName: string): string;
30
10
  * Convert a tool name like "gmail_list_messages" to "List messages".
31
11
  */
32
12
  declare function humanizeToolName(toolName: string): string;
13
+ /**
14
+ * Provider display names.
15
+ */
16
+ declare const PROVIDER_LABELS: Record<string, string>;
33
17
  /**
34
18
  * Get a display label for a provider.
35
19
  */
36
20
  declare function getProviderLabel(provider: string): string;
21
+ /**
22
+ * Determine which formatter to use based on tool name prefix.
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" | "generic";
25
+ declare function getFormatterType(toolName: string): FormatterType;
37
26
 
38
27
  interface ToolResultPart {
39
28
  type: string;
@@ -53,18 +42,76 @@ interface ToolResultPart {
53
42
  interface SupyagentToolResultProps {
54
43
  part: ToolResultPart;
55
44
  }
45
+ /**
46
+ * Extract the tool name from a part.
47
+ */
48
+ declare function extractToolName(part: ToolResultPart): string;
49
+ declare function extractState(part: ToolResultPart): string | undefined;
50
+ /**
51
+ * Unwrap supyagent's `{ok, data}` envelope so formatters see the inner payload.
52
+ */
53
+ declare function unwrapSupyagentResult(result: unknown): unknown;
54
+ declare function extractArgs(part: ToolResultPart): Record<string, unknown> | undefined;
55
+ declare function extractResult(part: ToolResultPart): unknown;
56
+ /**
57
+ * Apply Microsoft data normalization when the formatter type came from a Microsoft tool prefix.
58
+ */
59
+ declare function maybeNormalize(toolName: string, formatterType: FormatterType, data: unknown): unknown;
56
60
  declare function SupyagentToolResult({ part }: SupyagentToolResultProps): react_jsx_runtime.JSX.Element | null;
57
61
 
62
+ interface SummaryResult {
63
+ text: string;
64
+ badge?: {
65
+ text: string;
66
+ variant?: "default" | "success" | "error" | "warning";
67
+ };
68
+ }
69
+ declare function getSummary(formatterType: string, data: unknown, toolName: string): SummaryResult;
70
+
71
+ interface ProviderIconProps {
72
+ toolName: string;
73
+ className?: string;
74
+ }
75
+ declare function ProviderIcon({ toolName, className }: ProviderIconProps): react_jsx_runtime.JSX.Element;
76
+
77
+ interface ToolInputProps {
78
+ args: Record<string, unknown> | undefined;
79
+ }
80
+ declare function ToolInput({ args }: ToolInputProps): react_jsx_runtime.JSX.Element | null;
81
+
82
+ /**
83
+ * Normalize Microsoft API responses to match the Google formatter data shapes.
84
+ * This lets us reuse EmailFormatter, CalendarEventFormatter, and DriveFileFormatter.
85
+ */
86
+ declare function normalizeMicrosoftMail(data: unknown): unknown;
87
+ declare function normalizeMicrosoftCalendar(data: unknown): unknown;
88
+ declare function normalizeMicrosoftDrive(data: unknown): unknown;
89
+
58
90
  interface SupyagentToolActionProps {
59
91
  part: ToolResultPart;
60
92
  defaultExpanded?: boolean;
61
93
  }
62
94
  declare function SupyagentToolAction({ part, defaultExpanded }: SupyagentToolActionProps): react_jsx_runtime.JSX.Element;
63
95
 
64
- interface ToolInputProps {
65
- args: Record<string, unknown> | undefined;
96
+ interface ToolCallPart {
97
+ type: string;
98
+ toolName?: string;
99
+ toolCallId?: string;
100
+ state?: string;
101
+ input?: Record<string, unknown>;
102
+ output?: unknown;
103
+ toolInvocation?: {
104
+ toolName: string;
105
+ state: string;
106
+ args?: Record<string, unknown>;
107
+ result?: unknown;
108
+ };
109
+ args?: Record<string, unknown>;
66
110
  }
67
- declare function ToolInput({ args }: ToolInputProps): react_jsx_runtime.JSX.Element | null;
111
+ interface SupyagentToolCallProps {
112
+ part: ToolCallPart;
113
+ }
114
+ declare function SupyagentToolCall({ part }: SupyagentToolCallProps): react_jsx_runtime.JSX.Element;
68
115
 
69
116
  interface BadgeProps {
70
117
  text: string;
@@ -79,21 +126,6 @@ interface CollapsibleResultProps {
79
126
  }
80
127
  declare function CollapsibleResult({ toolName, summary, badge, defaultExpanded, children, }: CollapsibleResultProps): react_jsx_runtime.JSX.Element;
81
128
 
82
- interface ProviderIconProps {
83
- toolName: string;
84
- className?: string;
85
- }
86
- declare function ProviderIcon({ toolName, className }: ProviderIconProps): react_jsx_runtime.JSX.Element;
87
-
88
- interface SummaryResult {
89
- text: string;
90
- badge?: {
91
- text: string;
92
- variant?: "default" | "success" | "error" | "warning";
93
- };
94
- }
95
- declare function getSummary(formatterType: string, data: unknown, toolName: string): SummaryResult;
96
-
97
129
  interface EmailFormatterProps {
98
130
  data: unknown;
99
131
  }
@@ -229,4 +261,4 @@ interface LinkedInFormatterProps {
229
261
  }
230
262
  declare function LinkedInFormatter({ data }: LinkedInFormatterProps): react_jsx_runtime.JSX.Element;
231
263
 
232
- export { BrevoFormatter, CalendarEventFormatter, CalendlyFormatter, CollapsibleResult, type CollapsibleResultProps, ComputeFormatter, DiscordFormatter, DocsFormatter, DriveFileFormatter, EmailFormatter, GenericFormatter, GithubFormatter, HubspotFormatter, InboxFormatter, JiraFormatter, LinearFormatter, LinkedInFormatter, NotionFormatter, PipedriveFormatter, ProviderIcon, ResendFormatter, SalesforceFormatter, SearchFormatter, SheetsFormatter, SlackMessageFormatter, SlidesFormatter, StripeFormatter, type SummaryResult, SupyagentToolAction, SupyagentToolCall, SupyagentToolResult, TelegramFormatter, ToolInput, TwilioFormatter, TwitterFormatter, getProviderFromToolName, getProviderLabel, getSummary, humanizeToolName };
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 };
package/dist/react.d.ts CHANGED
@@ -1,26 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
 
4
- interface ToolCallPart {
5
- type: string;
6
- toolName?: string;
7
- toolCallId?: string;
8
- state?: string;
9
- input?: Record<string, unknown>;
10
- output?: unknown;
11
- toolInvocation?: {
12
- toolName: string;
13
- state: string;
14
- args?: Record<string, unknown>;
15
- result?: unknown;
16
- };
17
- args?: Record<string, unknown>;
18
- }
19
- interface SupyagentToolCallProps {
20
- part: ToolCallPart;
21
- }
22
- declare function SupyagentToolCall({ part }: SupyagentToolCallProps): react_jsx_runtime.JSX.Element;
23
-
24
4
  /**
25
5
  * Extract provider/service prefix from a tool name.
26
6
  * Tool names follow `{service}_{action}` convention.
@@ -30,10 +10,19 @@ declare function getProviderFromToolName(toolName: string): string;
30
10
  * Convert a tool name like "gmail_list_messages" to "List messages".
31
11
  */
32
12
  declare function humanizeToolName(toolName: string): string;
13
+ /**
14
+ * Provider display names.
15
+ */
16
+ declare const PROVIDER_LABELS: Record<string, string>;
33
17
  /**
34
18
  * Get a display label for a provider.
35
19
  */
36
20
  declare function getProviderLabel(provider: string): string;
21
+ /**
22
+ * Determine which formatter to use based on tool name prefix.
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" | "generic";
25
+ declare function getFormatterType(toolName: string): FormatterType;
37
26
 
38
27
  interface ToolResultPart {
39
28
  type: string;
@@ -53,18 +42,76 @@ interface ToolResultPart {
53
42
  interface SupyagentToolResultProps {
54
43
  part: ToolResultPart;
55
44
  }
45
+ /**
46
+ * Extract the tool name from a part.
47
+ */
48
+ declare function extractToolName(part: ToolResultPart): string;
49
+ declare function extractState(part: ToolResultPart): string | undefined;
50
+ /**
51
+ * Unwrap supyagent's `{ok, data}` envelope so formatters see the inner payload.
52
+ */
53
+ declare function unwrapSupyagentResult(result: unknown): unknown;
54
+ declare function extractArgs(part: ToolResultPart): Record<string, unknown> | undefined;
55
+ declare function extractResult(part: ToolResultPart): unknown;
56
+ /**
57
+ * Apply Microsoft data normalization when the formatter type came from a Microsoft tool prefix.
58
+ */
59
+ declare function maybeNormalize(toolName: string, formatterType: FormatterType, data: unknown): unknown;
56
60
  declare function SupyagentToolResult({ part }: SupyagentToolResultProps): react_jsx_runtime.JSX.Element | null;
57
61
 
62
+ interface SummaryResult {
63
+ text: string;
64
+ badge?: {
65
+ text: string;
66
+ variant?: "default" | "success" | "error" | "warning";
67
+ };
68
+ }
69
+ declare function getSummary(formatterType: string, data: unknown, toolName: string): SummaryResult;
70
+
71
+ interface ProviderIconProps {
72
+ toolName: string;
73
+ className?: string;
74
+ }
75
+ declare function ProviderIcon({ toolName, className }: ProviderIconProps): react_jsx_runtime.JSX.Element;
76
+
77
+ interface ToolInputProps {
78
+ args: Record<string, unknown> | undefined;
79
+ }
80
+ declare function ToolInput({ args }: ToolInputProps): react_jsx_runtime.JSX.Element | null;
81
+
82
+ /**
83
+ * Normalize Microsoft API responses to match the Google formatter data shapes.
84
+ * This lets us reuse EmailFormatter, CalendarEventFormatter, and DriveFileFormatter.
85
+ */
86
+ declare function normalizeMicrosoftMail(data: unknown): unknown;
87
+ declare function normalizeMicrosoftCalendar(data: unknown): unknown;
88
+ declare function normalizeMicrosoftDrive(data: unknown): unknown;
89
+
58
90
  interface SupyagentToolActionProps {
59
91
  part: ToolResultPart;
60
92
  defaultExpanded?: boolean;
61
93
  }
62
94
  declare function SupyagentToolAction({ part, defaultExpanded }: SupyagentToolActionProps): react_jsx_runtime.JSX.Element;
63
95
 
64
- interface ToolInputProps {
65
- args: Record<string, unknown> | undefined;
96
+ interface ToolCallPart {
97
+ type: string;
98
+ toolName?: string;
99
+ toolCallId?: string;
100
+ state?: string;
101
+ input?: Record<string, unknown>;
102
+ output?: unknown;
103
+ toolInvocation?: {
104
+ toolName: string;
105
+ state: string;
106
+ args?: Record<string, unknown>;
107
+ result?: unknown;
108
+ };
109
+ args?: Record<string, unknown>;
66
110
  }
67
- declare function ToolInput({ args }: ToolInputProps): react_jsx_runtime.JSX.Element | null;
111
+ interface SupyagentToolCallProps {
112
+ part: ToolCallPart;
113
+ }
114
+ declare function SupyagentToolCall({ part }: SupyagentToolCallProps): react_jsx_runtime.JSX.Element;
68
115
 
69
116
  interface BadgeProps {
70
117
  text: string;
@@ -79,21 +126,6 @@ interface CollapsibleResultProps {
79
126
  }
80
127
  declare function CollapsibleResult({ toolName, summary, badge, defaultExpanded, children, }: CollapsibleResultProps): react_jsx_runtime.JSX.Element;
81
128
 
82
- interface ProviderIconProps {
83
- toolName: string;
84
- className?: string;
85
- }
86
- declare function ProviderIcon({ toolName, className }: ProviderIconProps): react_jsx_runtime.JSX.Element;
87
-
88
- interface SummaryResult {
89
- text: string;
90
- badge?: {
91
- text: string;
92
- variant?: "default" | "success" | "error" | "warning";
93
- };
94
- }
95
- declare function getSummary(formatterType: string, data: unknown, toolName: string): SummaryResult;
96
-
97
129
  interface EmailFormatterProps {
98
130
  data: unknown;
99
131
  }
@@ -229,4 +261,4 @@ interface LinkedInFormatterProps {
229
261
  }
230
262
  declare function LinkedInFormatter({ data }: LinkedInFormatterProps): react_jsx_runtime.JSX.Element;
231
263
 
232
- export { BrevoFormatter, CalendarEventFormatter, CalendlyFormatter, CollapsibleResult, type CollapsibleResultProps, ComputeFormatter, DiscordFormatter, DocsFormatter, DriveFileFormatter, EmailFormatter, GenericFormatter, GithubFormatter, HubspotFormatter, InboxFormatter, JiraFormatter, LinearFormatter, LinkedInFormatter, NotionFormatter, PipedriveFormatter, ProviderIcon, ResendFormatter, SalesforceFormatter, SearchFormatter, SheetsFormatter, SlackMessageFormatter, SlidesFormatter, StripeFormatter, type SummaryResult, SupyagentToolAction, SupyagentToolCall, SupyagentToolResult, TelegramFormatter, ToolInput, TwilioFormatter, TwitterFormatter, getProviderFromToolName, getProviderLabel, getSummary, humanizeToolName };
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 };