@supyagent/sdk 0.1.37 → 0.1.39
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/context.cjs +322 -0
- package/dist/context.cjs.map +1 -0
- package/dist/context.d.cts +204 -0
- package/dist/context.d.ts +204 -0
- package/dist/context.js +290 -0
- package/dist/context.js.map +1 -0
- package/dist/react.cjs +147 -44
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +36 -1
- package/dist/react.d.ts +36 -1
- package/dist/react.js +144 -44
- package/dist/react.js.map +1 -1
- package/package.json +7 -1
package/dist/react.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { UIMessage } from 'ai';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -85,6 +86,40 @@ interface ToolInputProps {
|
|
|
85
86
|
}
|
|
86
87
|
declare function ToolInput({ args }: ToolInputProps): react_jsx_runtime.JSX.Element | null;
|
|
87
88
|
|
|
89
|
+
interface ContextIndicatorProps {
|
|
90
|
+
/** The full messages array from useChat() */
|
|
91
|
+
messages: UIMessage[];
|
|
92
|
+
/** Maximum token limit for the context window. @default 128000 */
|
|
93
|
+
maxTokens?: number;
|
|
94
|
+
/** Optional className for the outer container */
|
|
95
|
+
className?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A small progress bar that shows current context window usage.
|
|
99
|
+
*
|
|
100
|
+
* Reads `message.metadata.context` from the most recent assistant message
|
|
101
|
+
* and renders a colour-coded indicator.
|
|
102
|
+
*
|
|
103
|
+
* Returns `null` until at least one assistant response has been received.
|
|
104
|
+
*/
|
|
105
|
+
declare function ContextIndicator({ messages, maxTokens, className, }: ContextIndicatorProps): react_jsx_runtime.JSX.Element | null;
|
|
106
|
+
|
|
107
|
+
interface SummaryMessageProps {
|
|
108
|
+
/** The summary UIMessage (must have metadata.type === "context-summary") */
|
|
109
|
+
message: UIMessage;
|
|
110
|
+
/** Optional className for the outer container */
|
|
111
|
+
className?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Renders a context-summary message as a collapsible card.
|
|
115
|
+
*
|
|
116
|
+
* Visually distinct from regular chat messages — dashed border,
|
|
117
|
+
* muted styling, and an expand/collapse toggle to reveal the summary text.
|
|
118
|
+
*/
|
|
119
|
+
declare function SummaryMessage({ message, className }: SummaryMessageProps): react_jsx_runtime.JSX.Element;
|
|
120
|
+
/** Check whether a UIMessage is a context-summary message. */
|
|
121
|
+
declare function isContextSummary(message: UIMessage): boolean;
|
|
122
|
+
|
|
88
123
|
/**
|
|
89
124
|
* Normalize Microsoft API responses to match the Google formatter data shapes.
|
|
90
125
|
* This lets us reuse EmailFormatter, CalendarEventFormatter, and DriveFileFormatter.
|
|
@@ -282,4 +317,4 @@ interface ViewImageFormatterProps {
|
|
|
282
317
|
}
|
|
283
318
|
declare function ViewImageFormatter({ data }: ViewImageFormatterProps): react_jsx_runtime.JSX.Element;
|
|
284
319
|
|
|
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 };
|
|
320
|
+
export { BrevoFormatter, BrowserFormatter, CalendarEventFormatter, CalendlyFormatter, CollapsibleResult, type CollapsibleResultProps, ComputeFormatter, ContextIndicator, type ContextIndicatorProps, 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, SummaryMessage, type SummaryMessageProps, type SummaryResult, SupyagentToolAction, SupyagentToolCall, SupyagentToolResult, TelegramFormatter, ToolInput, type ToolResultPart, TwilioFormatter, TwitterFormatter, ViewImageFormatter, WhatsAppFormatter, extractArgs, extractResult, extractState, extractToolName, getFormatterType, getProviderFromToolName, getProviderLabel, getSummary, humanizeToolName, isContextSummary, maybeNormalize, normalizeMicrosoftCalendar, normalizeMicrosoftDrive, normalizeMicrosoftMail, resolveToolName, unwrapSupyagentResult };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { UIMessage } from 'ai';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -85,6 +86,40 @@ interface ToolInputProps {
|
|
|
85
86
|
}
|
|
86
87
|
declare function ToolInput({ args }: ToolInputProps): react_jsx_runtime.JSX.Element | null;
|
|
87
88
|
|
|
89
|
+
interface ContextIndicatorProps {
|
|
90
|
+
/** The full messages array from useChat() */
|
|
91
|
+
messages: UIMessage[];
|
|
92
|
+
/** Maximum token limit for the context window. @default 128000 */
|
|
93
|
+
maxTokens?: number;
|
|
94
|
+
/** Optional className for the outer container */
|
|
95
|
+
className?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A small progress bar that shows current context window usage.
|
|
99
|
+
*
|
|
100
|
+
* Reads `message.metadata.context` from the most recent assistant message
|
|
101
|
+
* and renders a colour-coded indicator.
|
|
102
|
+
*
|
|
103
|
+
* Returns `null` until at least one assistant response has been received.
|
|
104
|
+
*/
|
|
105
|
+
declare function ContextIndicator({ messages, maxTokens, className, }: ContextIndicatorProps): react_jsx_runtime.JSX.Element | null;
|
|
106
|
+
|
|
107
|
+
interface SummaryMessageProps {
|
|
108
|
+
/** The summary UIMessage (must have metadata.type === "context-summary") */
|
|
109
|
+
message: UIMessage;
|
|
110
|
+
/** Optional className for the outer container */
|
|
111
|
+
className?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Renders a context-summary message as a collapsible card.
|
|
115
|
+
*
|
|
116
|
+
* Visually distinct from regular chat messages — dashed border,
|
|
117
|
+
* muted styling, and an expand/collapse toggle to reveal the summary text.
|
|
118
|
+
*/
|
|
119
|
+
declare function SummaryMessage({ message, className }: SummaryMessageProps): react_jsx_runtime.JSX.Element;
|
|
120
|
+
/** Check whether a UIMessage is a context-summary message. */
|
|
121
|
+
declare function isContextSummary(message: UIMessage): boolean;
|
|
122
|
+
|
|
88
123
|
/**
|
|
89
124
|
* Normalize Microsoft API responses to match the Google formatter data shapes.
|
|
90
125
|
* This lets us reuse EmailFormatter, CalendarEventFormatter, and DriveFileFormatter.
|
|
@@ -282,4 +317,4 @@ interface ViewImageFormatterProps {
|
|
|
282
317
|
}
|
|
283
318
|
declare function ViewImageFormatter({ data }: ViewImageFormatterProps): react_jsx_runtime.JSX.Element;
|
|
284
319
|
|
|
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 };
|
|
320
|
+
export { BrevoFormatter, BrowserFormatter, CalendarEventFormatter, CalendlyFormatter, CollapsibleResult, type CollapsibleResultProps, ComputeFormatter, ContextIndicator, type ContextIndicatorProps, 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, SummaryMessage, type SummaryMessageProps, type SummaryResult, SupyagentToolAction, SupyagentToolCall, SupyagentToolResult, TelegramFormatter, ToolInput, type ToolResultPart, TwilioFormatter, TwitterFormatter, ViewImageFormatter, WhatsAppFormatter, extractArgs, extractResult, extractState, extractToolName, getFormatterType, getProviderFromToolName, getProviderLabel, getSummary, humanizeToolName, isContextSummary, maybeNormalize, normalizeMicrosoftCalendar, normalizeMicrosoftDrive, normalizeMicrosoftMail, resolveToolName, unwrapSupyagentResult };
|
package/dist/react.js
CHANGED
|
@@ -3480,10 +3480,107 @@ function ToolInput({ args }) {
|
|
|
3480
3480
|
}) });
|
|
3481
3481
|
}
|
|
3482
3482
|
|
|
3483
|
-
// src/ui/
|
|
3483
|
+
// src/ui/context-indicator.tsx
|
|
3484
|
+
import { jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3485
|
+
function ContextIndicator({
|
|
3486
|
+
messages,
|
|
3487
|
+
maxTokens = 128e3,
|
|
3488
|
+
className
|
|
3489
|
+
}) {
|
|
3490
|
+
const lastContext = findLastContextMetadata(messages);
|
|
3491
|
+
if (!lastContext) return null;
|
|
3492
|
+
const ratio = Math.min(lastContext.usageRatio ?? 0, 1);
|
|
3493
|
+
const percent = Math.round(ratio * 100);
|
|
3494
|
+
const totalTokens = lastContext.totalTokens ?? 0;
|
|
3495
|
+
const color = ratio < 0.5 ? "bg-emerald-500" : ratio < 0.75 ? "bg-yellow-500" : ratio < 0.9 ? "bg-orange-500" : "bg-red-500";
|
|
3496
|
+
const label = formatTokens(totalTokens);
|
|
3497
|
+
const maxLabel = formatTokens(maxTokens);
|
|
3498
|
+
return /* @__PURE__ */ jsx35(
|
|
3499
|
+
"div",
|
|
3500
|
+
{
|
|
3501
|
+
className,
|
|
3502
|
+
title: `Context: ${label} / ${maxLabel} tokens (${percent}%)`,
|
|
3503
|
+
children: /* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
3504
|
+
/* @__PURE__ */ jsx35("div", { className: "h-1.5 w-16 rounded-full bg-muted overflow-hidden", children: /* @__PURE__ */ jsx35(
|
|
3505
|
+
"div",
|
|
3506
|
+
{
|
|
3507
|
+
className: `h-full rounded-full transition-all duration-500 ${color}`,
|
|
3508
|
+
style: { width: `${percent}%` }
|
|
3509
|
+
}
|
|
3510
|
+
) }),
|
|
3511
|
+
/* @__PURE__ */ jsxs32("span", { className: "tabular-nums", children: [
|
|
3512
|
+
percent,
|
|
3513
|
+
"%"
|
|
3514
|
+
] })
|
|
3515
|
+
] })
|
|
3516
|
+
}
|
|
3517
|
+
);
|
|
3518
|
+
}
|
|
3519
|
+
function findLastContextMetadata(messages) {
|
|
3520
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
3521
|
+
const meta = messages[i].metadata;
|
|
3522
|
+
if (meta?.context) return meta.context;
|
|
3523
|
+
}
|
|
3524
|
+
return null;
|
|
3525
|
+
}
|
|
3526
|
+
function formatTokens(n) {
|
|
3527
|
+
if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
|
|
3528
|
+
if (n >= 1e3) return `${(n / 1e3).toFixed(1)}k`;
|
|
3529
|
+
return `${n}`;
|
|
3530
|
+
}
|
|
3531
|
+
|
|
3532
|
+
// src/ui/summary-message.tsx
|
|
3484
3533
|
import { useState as useState2 } from "react";
|
|
3534
|
+
import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3535
|
+
function SummaryMessage({ message, className }) {
|
|
3536
|
+
const [expanded, setExpanded] = useState2(false);
|
|
3537
|
+
const meta = message.metadata;
|
|
3538
|
+
const summaryText = message.parts.find((p) => p.type === "text");
|
|
3539
|
+
const messageCount = meta?.messagesSummarized ?? 0;
|
|
3540
|
+
return /* @__PURE__ */ jsxs33(
|
|
3541
|
+
"div",
|
|
3542
|
+
{
|
|
3543
|
+
className: `rounded-lg border border-dashed border-border bg-muted/30 px-4 py-3 ${className ?? ""}`,
|
|
3544
|
+
children: [
|
|
3545
|
+
/* @__PURE__ */ jsxs33(
|
|
3546
|
+
"button",
|
|
3547
|
+
{
|
|
3548
|
+
type: "button",
|
|
3549
|
+
onClick: () => setExpanded(!expanded),
|
|
3550
|
+
className: "flex w-full items-center gap-2 text-left text-xs text-muted-foreground hover:text-foreground transition-colors",
|
|
3551
|
+
children: [
|
|
3552
|
+
/* @__PURE__ */ jsx36(
|
|
3553
|
+
"svg",
|
|
3554
|
+
{
|
|
3555
|
+
className: `h-3 w-3 shrink-0 transition-transform ${expanded ? "rotate-90" : ""}`,
|
|
3556
|
+
fill: "none",
|
|
3557
|
+
viewBox: "0 0 24 24",
|
|
3558
|
+
stroke: "currentColor",
|
|
3559
|
+
strokeWidth: 2,
|
|
3560
|
+
children: /* @__PURE__ */ jsx36("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" })
|
|
3561
|
+
}
|
|
3562
|
+
),
|
|
3563
|
+
/* @__PURE__ */ jsxs33("span", { className: "font-medium", children: [
|
|
3564
|
+
"Context summarized",
|
|
3565
|
+
messageCount > 0 && ` (${messageCount} messages)`
|
|
3566
|
+
] })
|
|
3567
|
+
]
|
|
3568
|
+
}
|
|
3569
|
+
),
|
|
3570
|
+
expanded && summaryText?.text && /* @__PURE__ */ jsx36("div", { className: "mt-2 border-t border-border pt-2 text-sm text-muted-foreground whitespace-pre-wrap", children: summaryText.text })
|
|
3571
|
+
]
|
|
3572
|
+
}
|
|
3573
|
+
);
|
|
3574
|
+
}
|
|
3575
|
+
function isContextSummary(message) {
|
|
3576
|
+
const meta = message.metadata;
|
|
3577
|
+
return meta?.type === "context-summary";
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3580
|
+
// src/ui/tool-action.tsx
|
|
3581
|
+
import { useState as useState3 } from "react";
|
|
3485
3582
|
import { ChevronDown as ChevronDown2, ChevronRight as ChevronRight2, Check as Check3, AlertCircle, Loader2 } from "lucide-react";
|
|
3486
|
-
import { Fragment, jsx as
|
|
3583
|
+
import { Fragment, jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3487
3584
|
var BADGE_STYLES2 = {
|
|
3488
3585
|
default: "bg-muted text-muted-foreground",
|
|
3489
3586
|
success: "bg-green-500/10 text-green-500",
|
|
@@ -3491,7 +3588,7 @@ var BADGE_STYLES2 = {
|
|
|
3491
3588
|
warning: "bg-yellow-500/10 text-yellow-600"
|
|
3492
3589
|
};
|
|
3493
3590
|
function SupyagentToolAction({ part, defaultExpanded = false }) {
|
|
3494
|
-
const [expanded, setExpanded] =
|
|
3591
|
+
const [expanded, setExpanded] = useState3(defaultExpanded);
|
|
3495
3592
|
const toolName = extractToolName(part);
|
|
3496
3593
|
const state = extractState(part);
|
|
3497
3594
|
const args = extractArgs(part);
|
|
@@ -3516,59 +3613,59 @@ function SupyagentToolAction({ part, defaultExpanded = false }) {
|
|
|
3516
3613
|
const hasArgs = args && Object.keys(args).length > 0;
|
|
3517
3614
|
const hasExpandableContent = hasArgs || formatterOutput;
|
|
3518
3615
|
const canExpand = !isStreaming && hasExpandableContent;
|
|
3519
|
-
return /* @__PURE__ */
|
|
3616
|
+
return /* @__PURE__ */ jsxs34(
|
|
3520
3617
|
"div",
|
|
3521
3618
|
{
|
|
3522
3619
|
className: "rounded-lg border border-border bg-card overflow-hidden",
|
|
3523
3620
|
"data-state": isDone ? "done" : isError ? "error" : isStreaming ? "streaming" : "pending",
|
|
3524
3621
|
children: [
|
|
3525
|
-
/* @__PURE__ */
|
|
3622
|
+
/* @__PURE__ */ jsxs34(
|
|
3526
3623
|
"button",
|
|
3527
3624
|
{
|
|
3528
3625
|
type: "button",
|
|
3529
3626
|
onClick: () => canExpand && setExpanded(!expanded),
|
|
3530
3627
|
className: `flex items-center gap-2 w-full px-3 py-2 text-left transition-colors ${canExpand ? "hover:bg-muted cursor-pointer" : "cursor-default"}`,
|
|
3531
3628
|
children: [
|
|
3532
|
-
/* @__PURE__ */
|
|
3533
|
-
/* @__PURE__ */
|
|
3534
|
-
isStreaming && /* @__PURE__ */
|
|
3629
|
+
/* @__PURE__ */ jsxs34("div", { className: "relative shrink-0", children: [
|
|
3630
|
+
/* @__PURE__ */ jsx37(ProviderIcon, { toolName, className: "h-4 w-4 text-muted-foreground" }),
|
|
3631
|
+
isStreaming && /* @__PURE__ */ jsx37(Loader2, { className: "absolute -top-1 -right-1 h-3 w-3 text-primary animate-spin" })
|
|
3535
3632
|
] }),
|
|
3536
|
-
/* @__PURE__ */
|
|
3537
|
-
/* @__PURE__ */
|
|
3538
|
-
summary && /* @__PURE__ */
|
|
3539
|
-
/* @__PURE__ */
|
|
3540
|
-
/* @__PURE__ */
|
|
3633
|
+
/* @__PURE__ */ jsx37("span", { className: "text-xs text-muted-foreground", children: providerLabel }),
|
|
3634
|
+
/* @__PURE__ */ jsx37("span", { className: "text-sm text-foreground", children: actionLabel }),
|
|
3635
|
+
summary && /* @__PURE__ */ jsxs34(Fragment, { children: [
|
|
3636
|
+
/* @__PURE__ */ jsx37("span", { className: "text-muted-foreground text-xs", children: "\xB7" }),
|
|
3637
|
+
/* @__PURE__ */ jsx37("span", { className: "text-sm text-muted-foreground flex-1 truncate", children: summary.text })
|
|
3541
3638
|
] }),
|
|
3542
|
-
!summary && /* @__PURE__ */
|
|
3543
|
-
summary?.badge && /* @__PURE__ */
|
|
3639
|
+
!summary && /* @__PURE__ */ jsx37("span", { className: "flex-1" }),
|
|
3640
|
+
summary?.badge && /* @__PURE__ */ jsx37(
|
|
3544
3641
|
"span",
|
|
3545
3642
|
{
|
|
3546
3643
|
className: `inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium shrink-0 ${BADGE_STYLES2[summary.badge.variant || "default"]}`,
|
|
3547
3644
|
children: summary.badge.text
|
|
3548
3645
|
}
|
|
3549
3646
|
),
|
|
3550
|
-
isDone && /* @__PURE__ */
|
|
3551
|
-
isError && /* @__PURE__ */
|
|
3552
|
-
/* @__PURE__ */
|
|
3647
|
+
isDone && /* @__PURE__ */ jsx37(Check3, { className: "h-3.5 w-3.5 text-green-500 shrink-0" }),
|
|
3648
|
+
isError && /* @__PURE__ */ jsxs34("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: [
|
|
3649
|
+
/* @__PURE__ */ jsx37(AlertCircle, { className: "h-3 w-3" }),
|
|
3553
3650
|
"Error"
|
|
3554
3651
|
] }),
|
|
3555
|
-
isStreaming && /* @__PURE__ */
|
|
3556
|
-
canExpand && (expanded ? /* @__PURE__ */
|
|
3652
|
+
isStreaming && /* @__PURE__ */ jsx37("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..." }),
|
|
3653
|
+
canExpand && (expanded ? /* @__PURE__ */ jsx37(ChevronDown2, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }) : /* @__PURE__ */ jsx37(ChevronRight2, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }))
|
|
3557
3654
|
]
|
|
3558
3655
|
}
|
|
3559
3656
|
),
|
|
3560
|
-
/* @__PURE__ */
|
|
3657
|
+
/* @__PURE__ */ jsx37(
|
|
3561
3658
|
"div",
|
|
3562
3659
|
{
|
|
3563
3660
|
className: "grid transition-[grid-template-rows] duration-200 ease-out",
|
|
3564
3661
|
style: { gridTemplateRows: expanded ? "1fr" : "0fr" },
|
|
3565
|
-
children: /* @__PURE__ */
|
|
3566
|
-
args && Object.keys(args).length > 0 && /* @__PURE__ */
|
|
3567
|
-
/* @__PURE__ */
|
|
3568
|
-
/* @__PURE__ */
|
|
3662
|
+
children: /* @__PURE__ */ jsx37("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsxs34("div", { className: "border-t border-border px-3 py-2 space-y-3", children: [
|
|
3663
|
+
args && Object.keys(args).length > 0 && /* @__PURE__ */ jsxs34("div", { children: [
|
|
3664
|
+
/* @__PURE__ */ jsx37("p", { className: "text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5", children: "Input" }),
|
|
3665
|
+
/* @__PURE__ */ jsx37(ToolInput, { args })
|
|
3569
3666
|
] }),
|
|
3570
|
-
formatterOutput && /* @__PURE__ */
|
|
3571
|
-
/* @__PURE__ */
|
|
3667
|
+
formatterOutput && /* @__PURE__ */ jsxs34("div", { children: [
|
|
3668
|
+
/* @__PURE__ */ jsx37("p", { className: "text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5", children: "Output" }),
|
|
3572
3669
|
formatterOutput
|
|
3573
3670
|
] })
|
|
3574
3671
|
] }) })
|
|
@@ -3580,9 +3677,9 @@ function SupyagentToolAction({ part, defaultExpanded = false }) {
|
|
|
3580
3677
|
}
|
|
3581
3678
|
|
|
3582
3679
|
// src/ui/tool-call.tsx
|
|
3583
|
-
import { useState as
|
|
3680
|
+
import { useState as useState4 } from "react";
|
|
3584
3681
|
import { ChevronDown as ChevronDown3, ChevronRight as ChevronRight3, Check as Check4, AlertCircle as AlertCircle2, Loader2 as Loader22 } from "lucide-react";
|
|
3585
|
-
import { jsx as
|
|
3682
|
+
import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3586
3683
|
function extractToolName2(part) {
|
|
3587
3684
|
if (part.type.startsWith("tool-") && part.type !== "tool-invocation") {
|
|
3588
3685
|
return part.type.slice(5);
|
|
@@ -3601,7 +3698,7 @@ function extractArgs2(part) {
|
|
|
3601
3698
|
return part.input || part.args || part.toolInvocation?.args;
|
|
3602
3699
|
}
|
|
3603
3700
|
function SupyagentToolCall({ part }) {
|
|
3604
|
-
const [expanded, setExpanded] =
|
|
3701
|
+
const [expanded, setExpanded] = useState4(false);
|
|
3605
3702
|
const toolName = extractToolName2(part);
|
|
3606
3703
|
const state = extractState2(part);
|
|
3607
3704
|
const args = extractArgs2(part);
|
|
@@ -3611,39 +3708,39 @@ function SupyagentToolCall({ part }) {
|
|
|
3611
3708
|
const isStreaming = state === "input-streaming";
|
|
3612
3709
|
const isError = state === "output-error";
|
|
3613
3710
|
const isDone = state === "output-available";
|
|
3614
|
-
return /* @__PURE__ */
|
|
3711
|
+
return /* @__PURE__ */ jsxs35(
|
|
3615
3712
|
"div",
|
|
3616
3713
|
{
|
|
3617
3714
|
className: "rounded-lg border border-border bg-card overflow-hidden",
|
|
3618
3715
|
"data-state": isDone ? "done" : isError ? "error" : isStreaming ? "streaming" : "pending",
|
|
3619
3716
|
children: [
|
|
3620
|
-
/* @__PURE__ */
|
|
3717
|
+
/* @__PURE__ */ jsxs35(
|
|
3621
3718
|
"button",
|
|
3622
3719
|
{
|
|
3623
3720
|
type: "button",
|
|
3624
3721
|
onClick: () => args && setExpanded(!expanded),
|
|
3625
3722
|
className: "flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-muted transition-colors",
|
|
3626
3723
|
children: [
|
|
3627
|
-
/* @__PURE__ */
|
|
3628
|
-
/* @__PURE__ */
|
|
3629
|
-
isStreaming && /* @__PURE__ */
|
|
3724
|
+
/* @__PURE__ */ jsxs35("div", { className: "relative", children: [
|
|
3725
|
+
/* @__PURE__ */ jsx38(ProviderIcon, { toolName, className: "h-4 w-4 text-muted-foreground" }),
|
|
3726
|
+
isStreaming && /* @__PURE__ */ jsx38(Loader22, { className: "absolute -top-1 -right-1 h-3 w-3 text-primary animate-spin" })
|
|
3630
3727
|
] }),
|
|
3631
|
-
/* @__PURE__ */
|
|
3632
|
-
/* @__PURE__ */
|
|
3633
|
-
isDone && /* @__PURE__ */
|
|
3634
|
-
/* @__PURE__ */
|
|
3728
|
+
/* @__PURE__ */ jsx38("span", { className: "text-xs text-muted-foreground", children: providerLabel }),
|
|
3729
|
+
/* @__PURE__ */ jsx38("span", { className: "text-sm text-foreground flex-1", children: actionLabel }),
|
|
3730
|
+
isDone && /* @__PURE__ */ jsxs35("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: [
|
|
3731
|
+
/* @__PURE__ */ jsx38(Check4, { className: "h-3 w-3" }),
|
|
3635
3732
|
"Completed"
|
|
3636
3733
|
] }),
|
|
3637
|
-
isError && /* @__PURE__ */
|
|
3638
|
-
/* @__PURE__ */
|
|
3734
|
+
isError && /* @__PURE__ */ jsxs35("span", { className: "inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-xs text-destructive", children: [
|
|
3735
|
+
/* @__PURE__ */ jsx38(AlertCircle2, { className: "h-3 w-3" }),
|
|
3639
3736
|
"Error"
|
|
3640
3737
|
] }),
|
|
3641
|
-
isStreaming && /* @__PURE__ */
|
|
3642
|
-
args && (expanded ? /* @__PURE__ */
|
|
3738
|
+
isStreaming && /* @__PURE__ */ jsx38("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..." }),
|
|
3739
|
+
args && (expanded ? /* @__PURE__ */ jsx38(ChevronDown3, { className: "h-3.5 w-3.5 text-muted-foreground" }) : /* @__PURE__ */ jsx38(ChevronRight3, { className: "h-3.5 w-3.5 text-muted-foreground" }))
|
|
3643
3740
|
]
|
|
3644
3741
|
}
|
|
3645
3742
|
),
|
|
3646
|
-
expanded && args && /* @__PURE__ */
|
|
3743
|
+
expanded && args && /* @__PURE__ */ jsx38("div", { className: "border-t border-border px-3 py-2", children: /* @__PURE__ */ jsx38("pre", { className: "text-xs text-muted-foreground overflow-x-auto", children: JSON.stringify(args, null, 2) }) })
|
|
3647
3744
|
]
|
|
3648
3745
|
}
|
|
3649
3746
|
);
|
|
@@ -3655,6 +3752,7 @@ export {
|
|
|
3655
3752
|
CalendlyFormatter,
|
|
3656
3753
|
CollapsibleResult,
|
|
3657
3754
|
ComputeFormatter,
|
|
3755
|
+
ContextIndicator,
|
|
3658
3756
|
DiscordFormatter,
|
|
3659
3757
|
DocsFormatter,
|
|
3660
3758
|
DriveFileFormatter,
|
|
@@ -3677,6 +3775,7 @@ export {
|
|
|
3677
3775
|
SlackMessageFormatter,
|
|
3678
3776
|
SlidesFormatter,
|
|
3679
3777
|
StripeFormatter,
|
|
3778
|
+
SummaryMessage,
|
|
3680
3779
|
SupyagentToolAction,
|
|
3681
3780
|
SupyagentToolCall,
|
|
3682
3781
|
SupyagentToolResult,
|
|
@@ -3695,6 +3794,7 @@ export {
|
|
|
3695
3794
|
getProviderLabel,
|
|
3696
3795
|
getSummary,
|
|
3697
3796
|
humanizeToolName,
|
|
3797
|
+
isContextSummary,
|
|
3698
3798
|
maybeNormalize,
|
|
3699
3799
|
normalizeMicrosoftCalendar,
|
|
3700
3800
|
normalizeMicrosoftDrive,
|