@truefoundry/agent-ui-sdk 0.0.3 → 0.0.5

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/README.md CHANGED
@@ -150,7 +150,7 @@ import {
150
150
 
151
151
  const client = new AgentSessionClient({
152
152
  apiKey: process.env.TFY_API_KEY!,
153
- environment: process.env.TFY_GATEWAY_URL!, // https://gateway.truefoundry.ai/<tenant>
153
+ baseUrl: process.env.TFY_GATEWAY_URL!, // https://gateway.truefoundry.ai/<tenant>
154
154
  });
155
155
 
156
156
  export function App() {
@@ -179,6 +179,40 @@ export function App() {
179
179
  }
180
180
  ```
181
181
 
182
+ ### Draft mode and sandbox downloads
183
+
184
+ Named-agent mode only needs `AgentSessionClient`. Draft mode and sandbox file
185
+ downloads also need a `PrivateAgentSessionClient`:
186
+
187
+ ```tsx
188
+ import { PrivateAgentSessionClient } from "truefoundry-gateway-sdk/agents/private";
189
+
190
+ const privateClient = new PrivateAgentSessionClient({
191
+ apiKey: process.env.TFY_API_KEY!,
192
+ baseUrl: process.env.TFY_GATEWAY_URL!,
193
+ });
194
+
195
+ const runtime = useTrueFoundryAgentRuntime({
196
+ client,
197
+ privateClient,
198
+ agent: {
199
+ mode: "draft",
200
+ defaultAgentSpec: { model: { name: "anthropic/claude-sonnet-4-6" } },
201
+ },
202
+ adapters: { attachments: trueFoundryAttachmentAdapter },
203
+ });
204
+ ```
205
+
206
+ ### Cross-agent History (owned sessions)
207
+
208
+ `<ThreadListContainer />` lists whatever thread-list adapter the runtime
209
+ installed — typically one named agent or the caller's drafts. For a History
210
+ sidebar of **every** session the user owns (named + draft), use
211
+ `createTrueFoundryOwnedSessionsThreadListAdapter({ privateClient })` or call
212
+ `privateClient.listOwnedSessions()` directly and render your own list. That
213
+ adapter is read-only (`initialize` throws); keep a separate named/draft
214
+ runtime for creating and sending turns.
215
+
182
216
  That's the whole integration. Three things to know:
183
217
 
184
218
  - `**<Thread />**` is the fully-assembled message list + composer. It handles
package/dist/index.d.ts CHANGED
@@ -16,9 +16,10 @@ import Dialog from 'tfy-web-components/components/molecules/Dialog';
16
16
  export { default as Dialog } from 'tfy-web-components/components/molecules/Dialog';
17
17
  export { IconProp, default as IconProvider, registerIcons, registerImgIcons } from 'tfy-web-components/components/atoms/IconProvider';
18
18
  import { UserMessageEditProps as UserMessageEditProps$1 } from 'tfy-web-components/components/molecules/agent-chat/UserMessageEdit';
19
- import { ToolCallCardProps as ToolCallCardProps$1, ToolCallContentBlockProps as ToolCallContentBlockProps$1, ToolApprovalBlockProps, ReasoningCardProps, AskUserQuestionCardProps, McpAuthCardProps } from 'tfy-web-components/components/molecules/agent-chat';
20
- export { AskUserAnswerDraft, AnsweredQuestion as AskUserAnsweredQuestion, Question as AskUserQuestion, McpServer as McpAuthServer, ReasoningCardProps } from 'tfy-web-components/components/molecules/agent-chat';
19
+ import { ToolCallCardProps as ToolCallCardProps$1, ToolCallContentBlockProps as ToolCallContentBlockProps$1, ToolApprovalBlockProps, AgentStepsCardProps, ReasoningCardProps, AskUserQuestionCardProps, McpAuthCardProps } from 'tfy-web-components/components/molecules/agent-chat';
20
+ export { AgentStepsCardProps, AskUserAnswerDraft, AnsweredQuestion as AskUserAnsweredQuestion, Question as AskUserQuestion, McpServer as McpAuthServer, ReasoningCardProps } from 'tfy-web-components/components/molecules/agent-chat';
21
21
  import { ToolCallMessagePartComponent, MessagePrimitive } from '@assistant-ui/react';
22
+ import { PartState } from '@assistant-ui/core/react';
22
23
 
23
24
  type ComposerLeftSectionProps = {
24
25
  disabled: boolean;
@@ -273,6 +274,22 @@ declare module "../theme/SlotsProvider.js" {
273
274
  }
274
275
  }
275
276
 
277
+ type HistoryLoaderProps = ComponentPropsWithRef<"div"> & {
278
+ /** True while an older-history page is being fetched. */
279
+ isLoading?: boolean;
280
+ };
281
+ /**
282
+ * Inline status row shown at the top of the message list when older history
283
+ * pages are available. Doubles as the scroll sentinel observed by
284
+ * `HistoryLoaderContainer`.
285
+ */
286
+ declare const HistoryLoader: react.ForwardRefExoticComponent<Omit<HistoryLoaderProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
287
+ declare module "../theme/SlotsProvider.js" {
288
+ interface AtomSlots {
289
+ HistoryLoader: typeof HistoryLoader;
290
+ }
291
+ }
292
+
276
293
  type ThreadRootShellProps = ComponentPropsWithRef<"div">;
277
294
  declare const ThreadRootShell: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
278
295
  type ThreadViewportShellProps = ComponentPropsWithRef<"div"> & {
@@ -382,6 +399,14 @@ declare module "../theme/SlotsProvider.js" {
382
399
  }
383
400
  }
384
401
 
402
+ /** Typed SDK slot adapter over tfy-web-components AgentStepsCard. */
403
+ declare function AgentStepsCard(props: AgentStepsCardProps): react.JSX.Element;
404
+ declare module "../../theme/SlotsProvider.js" {
405
+ interface AtomSlots {
406
+ AgentStepsCard: typeof AgentStepsCard;
407
+ }
408
+ }
409
+
385
410
  /** Typed SDK slot adapter over tfy-web-components ReasoningCard. */
386
411
  declare function ReasoningCard(props: ReasoningCardProps): react.JSX.Element;
387
412
  declare module "../../theme/SlotsProvider.js" {
@@ -545,6 +570,16 @@ type ThreadContainerProps = {
545
570
  };
546
571
  declare function ThreadContainer({ composer }: ThreadContainerProps): react.JSX.Element;
547
572
 
573
+ /**
574
+ * Renders the `HistoryLoader` slot at the top of the message list and fetches
575
+ * the next older history page when the user scrolls near it. Scroll position
576
+ * is preserved across the prepend so the list doesn't jump.
577
+ *
578
+ * Must be rendered inside `ThreadViewportShell` (it locates the scroll root
579
+ * via the `aui_thread-viewport` data-slot on its nearest scrollable ancestor).
580
+ */
581
+ declare function HistoryLoaderContainer(): react.JSX.Element | null;
582
+
548
583
  declare function AssistantMessageContainer(): react.JSX.Element;
549
584
 
550
585
  declare function UserMessageContainer(): react.JSX.Element;
@@ -579,6 +614,18 @@ declare function ToolGroupContainer({ children, group, }: PropsWithChildren<{
579
614
  group: ThreadGroupPart;
580
615
  }>): react.JSX.Element;
581
616
 
617
+ interface AgentStepsContainerProps {
618
+ toolCount: number;
619
+ thinkingCount: number;
620
+ hasFinal: boolean;
621
+ active: boolean;
622
+ }
623
+ /**
624
+ * Container for "Agent steps" section — groups reasoning, intermediate text, and tools
625
+ * in a collapsible accordion that auto-collapses once final answer is confirmed.
626
+ */
627
+ declare function AgentStepsContainer({ children, toolCount, thinkingCount, hasFinal, active, }: PropsWithChildren<AgentStepsContainerProps>): react.JSX.Element;
628
+
582
629
  declare function ReasoningContainer({ group }: {
583
630
  group: ThreadGroupPart;
584
631
  }): react.JSX.Element;
@@ -663,4 +710,12 @@ declare function useErrorToasterOptional(): ErrorToasterContextValue | null;
663
710
  /** The full assembled thread view: message list + composer. */
664
711
  declare function Thread(): react.JSX.Element;
665
712
 
666
- export { AskUserContainer, type AskUserPromptProps, type AskUserPromptProps as AskUserQuestionCardProps, AssistantMessageBubble, type AssistantMessageBubbleProps, AssistantMessageContainer, AssistantTextContainer, type AtomSlots, AttachmentCard, type AttachmentCardProps, type AttachmentCardSize, AttachmentPickerButton, type AttachmentPickerButtonProps, AttachmentPreviewDialog, type AttachmentPreviewDialogProps, Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, type ColorToken, ComposerAttachmentPickerContainer, ComposerAttachmentsContainer, ComposerBusyProvider, type ComposerBusyState, ComposerContainer, type ComposerContainerProps, ComposerLeftSection, type ComposerLeftSectionProps, type ComposerPauseView, ComposerRightSection, type ComposerRightSectionProps, ComposerSendButton, type ComposerSendButtonProps, ComposerShell, type ComposerShellProps, type DesignTokens, ErrorToasterProvider, Markdown, type MarkdownProps, type McpAuthPromptProps as McpAuthCardProps, McpAuthContainer, type McpAuthPromptProps, MessageActionBar, type MessageActionBarProps, MessageAttachmentsContainer, MessageErrorBanner, type MessageErrorBannerProps, MessageGroup, type MessageGroupProps, MessageIndicator, type MessageIndicatorProps, MessageListSkeleton, type MessageListSkeletonProps, MessageTimestamp, type MessageTimestampProps, type RadiusToken, ReasoningContainer, SandboxToolCallCard, type SandboxToolCallCardProps, ScrollToBottomButton, type ScrollToBottomButtonProps, type SlotOverrides, SlotsProvider, type SpacingToken, SubAgentCard, type SubAgentCardProps, type ThemeMode, Thread, ThreadComposerAreaShell, type ThreadComposerAreaShellProps, ThreadContainer, type ThreadContainerProps, type ThreadGroupPart, ThreadListContainer, ThreadListEmptyState, type ThreadListEmptyStateProps, ThreadListNewButton, type ThreadListNewButtonProps, ThreadListRow, type ThreadListRowProps, ThreadListRowSkeleton, type ThreadListRowSkeletonProps, ThreadListShell, type ThreadListShellProps, type ThreadPauseState, ThreadRootShell, type ThreadRootShellProps, ThreadViewportShell, type ThreadViewportShellProps, Toast, type ToastProps, ToastStack, type ToastStackProps, TokensProvider, ToolApprovalBar, type ToolApprovalBarProps, ToolApprovalContainer, type ToolApprovalOption, ToolCallCard, type ToolCallCardProps, ToolCallContainer, ToolCallContentBlock, ToolCallContentBlockContainer, type ToolCallContentBlockProps, type ToolCallStatus, ToolGroupCard, type ToolGroupCardProps, ToolGroupContainer, type TypeRoleToken, type TypeRoleValue, USER_MESSAGE_ATTACHMENT_PREVIEW_REM, UserEditComposerContainer, UserMessageActionBar, type UserMessageActionBarProps, UserMessageBubble, type UserMessageBubbleProps, UserMessageContainer, UserMessageEdit, type UserMessageEditProps, WelcomeScreen, type WelcomeScreenProps, defaultSlots, defaultTokens, threadHasPendingMcpAuth, useComposerBusyState, useComposerPauseView, useErrorToaster, useErrorToasterOptional, useSlot, useThemeMode, useTokens };
713
+ interface AgentStepsSplitResult {
714
+ cutIndex: number;
715
+ hasFinal: boolean;
716
+ toolCount: number;
717
+ thinkingCount: number;
718
+ }
719
+ declare function computeAgentStepsSplit(parts: readonly PartState[], isRunning: boolean): AgentStepsSplitResult;
720
+
721
+ export { AgentStepsCard, AgentStepsContainer, type AgentStepsContainerProps, type AgentStepsSplitResult, AskUserContainer, type AskUserPromptProps, type AskUserPromptProps as AskUserQuestionCardProps, AssistantMessageBubble, type AssistantMessageBubbleProps, AssistantMessageContainer, AssistantTextContainer, type AtomSlots, AttachmentCard, type AttachmentCardProps, type AttachmentCardSize, AttachmentPickerButton, type AttachmentPickerButtonProps, AttachmentPreviewDialog, type AttachmentPreviewDialogProps, Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, type ColorToken, ComposerAttachmentPickerContainer, ComposerAttachmentsContainer, ComposerBusyProvider, type ComposerBusyState, ComposerContainer, type ComposerContainerProps, ComposerLeftSection, type ComposerLeftSectionProps, type ComposerPauseView, ComposerRightSection, type ComposerRightSectionProps, ComposerSendButton, type ComposerSendButtonProps, ComposerShell, type ComposerShellProps, type DesignTokens, ErrorToasterProvider, HistoryLoader, HistoryLoaderContainer, type HistoryLoaderProps, Markdown, type MarkdownProps, type McpAuthPromptProps as McpAuthCardProps, McpAuthContainer, type McpAuthPromptProps, MessageActionBar, type MessageActionBarProps, MessageAttachmentsContainer, MessageErrorBanner, type MessageErrorBannerProps, MessageGroup, type MessageGroupProps, MessageIndicator, type MessageIndicatorProps, MessageListSkeleton, type MessageListSkeletonProps, MessageTimestamp, type MessageTimestampProps, type RadiusToken, ReasoningContainer, SandboxToolCallCard, type SandboxToolCallCardProps, ScrollToBottomButton, type ScrollToBottomButtonProps, type SlotOverrides, SlotsProvider, type SpacingToken, SubAgentCard, type SubAgentCardProps, type ThemeMode, Thread, ThreadComposerAreaShell, type ThreadComposerAreaShellProps, ThreadContainer, type ThreadContainerProps, type ThreadGroupPart, ThreadListContainer, ThreadListEmptyState, type ThreadListEmptyStateProps, ThreadListNewButton, type ThreadListNewButtonProps, ThreadListRow, type ThreadListRowProps, ThreadListRowSkeleton, type ThreadListRowSkeletonProps, ThreadListShell, type ThreadListShellProps, type ThreadPauseState, ThreadRootShell, type ThreadRootShellProps, ThreadViewportShell, type ThreadViewportShellProps, Toast, type ToastProps, ToastStack, type ToastStackProps, TokensProvider, ToolApprovalBar, type ToolApprovalBarProps, ToolApprovalContainer, type ToolApprovalOption, ToolCallCard, type ToolCallCardProps, ToolCallContainer, ToolCallContentBlock, ToolCallContentBlockContainer, type ToolCallContentBlockProps, type ToolCallStatus, ToolGroupCard, type ToolGroupCardProps, ToolGroupContainer, type TypeRoleToken, type TypeRoleValue, USER_MESSAGE_ATTACHMENT_PREVIEW_REM, UserEditComposerContainer, UserMessageActionBar, type UserMessageActionBarProps, UserMessageBubble, type UserMessageBubbleProps, UserMessageContainer, UserMessageEdit, type UserMessageEditProps, WelcomeScreen, type WelcomeScreenProps, computeAgentStepsSplit, defaultSlots, defaultTokens, threadHasPendingMcpAuth, useComposerBusyState, useComposerPauseView, useErrorToaster, useErrorToasterOptional, useSlot, useThemeMode, useTokens };