@dudko.dev/agent-web-react 0.0.33 → 0.0.34

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/index.d.cts CHANGED
@@ -2,8 +2,8 @@ import * as react from 'react';
2
2
  import { DependencyList, ReactNode, RefObject, ComponentType, CSSProperties } from 'react';
3
3
  import { RunFile, RunResult, Agent, ToolApprovalMode, AppToolCallRequest, AppSamplingRequest, AppSamplingView, AppSamplingResult, CompactResult, IUsage, AgentEventHandler, BrowserAgentConfig, VirtualFileInfo, VirtualFileSystem, CredentialStore, createWebLLMModel, WebLLMModelOptions, ModelTier, TierReason, EscalationReason, DecisionFallbackReason, AgentEvent, Skill, IPlan, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
4
4
  export { Agent, AgentEvent, AgentEventHandler, AgentLoggerSink, AgentTool, AgentToolSet, AppToolCallRequest, AttachmentsNotSupportedError, BrowserAgentConfig, CompactResult, CompactionConfig, CredentialStore, FileToolsOptions, IPlan, IPlanStep, IStepResult, IToolCall, IUsage, ImagesNotSupportedError, IndexedDBStore, LearningConfig, LogLevel, McpAppCsp, McpAppResource, McpAppToolResult, MemoryCredentialStore, MemorySkillStore, MemoryStore, ModelInput, ProviderModelSpec, ProviderType, RunControl, RunFile, RunOptions, RunResult, SessionBusyError, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillStore, StorageChange, StorageChangeKind, StorageChangeOp, SubagentInfo, SubagentToolOptions, SubagentWorkerConfig, ThinkingLevel, ThinkingSetting, TokenLimits, ToolApprovalConfig, ToolApprovalContext, ToolApprovalMode, ToolApprovalRequest, VaultCredentialStore, VfsSkillStore, VirtualFile, VirtualFileInfo, VirtualFileSystem, WatchSessionOptions, createAgent, createFileTools, createRunControl, createSubagentTool, createWebLLMModel, defineSkill, defineTool, isWebGPUAvailable, loadSkillFromUrl, markReadOnly, onStorageChange, parseSkillMarkdown, postStorageChange, preloadWebLLMModel, serveSubagentWorker, supportsImages, supportsPdf, unloadWebLLMModel, watchSession } from '@dudko.dev/agent-web';
5
- import { A as AgentUiState, C as ChatAttachment, a as ApprovalView, b as ChatMessage, c as AgentStatus, E as ElicitationIssueKind, d as ElicitationOutcomeReason, M as McpAppSandboxReason, R as RemoteRunView, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-B6h_-yLg.cjs';
6
- export { s as APP_DEFAULT_HEIGHT, t as APP_MAX_HEIGHT, u as APP_MIN_HEIGHT, v as AppDownload, w as AppDownloadView, x as AppFileSaverEnv, y as AppLink, z as AppReadyDownload, F as AppResourceReader, G as ElicitationControl, H as ElicitationDraft, I as ElicitationDraftValue, J as ElicitationField, K as ElicitationFormOutcome, N as ElicitationIssue, O as ElicitationLink, Q as ElicitationOption, V as FetchView, X as MCP_APP_DISPLAY_MODES, Y as MCP_APP_MAX_ARGS_CHARS, Z as MCP_APP_MAX_DOWNLOAD_BYTES, _ as MCP_APP_MAX_FILE_NAME_CHARS, $ as MCP_APP_MAX_IN_FLIGHT, a0 as MCP_APP_MAX_MESSAGE_CHARS, a1 as MCP_APP_MAX_URL_CHARS, a2 as MCP_APP_NOTIFICATIONS, a3 as MCP_APP_OPTIONAL_REQUESTS, a4 as MCP_APP_PROTOCOL_VERSION, a5 as MCP_APP_REFUSED, a6 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a7 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a8 as MCP_APP_RELAY, a9 as MCP_APP_REQUESTS, aa as MCP_APP_SANDBOX_FRAME_TOKENS, ab as MCP_APP_SANDBOX_GRACE_MS, ac as MCP_APP_SANDBOX_SERVER, ad as MCP_APP_SANDBOX_TIMEOUT_MS, ae as McpAppBridge, af as McpAppBridgeHandlers, ag as McpAppBridgeOptions, ah as McpAppDisplayMode, ai as McpAppRpcError, aj as McpAppRpcMessage, ak as McpAppSandboxInput, al as McpAppSandboxLink, am as McpAppSandboxLinkOptions, an as McpAppSandboxTarget, ao as McpElicitationFieldSchema, ap as McpElicitationRequest, aq as McpElicitationSchema, ar as QueuedMessageView, as as ReplanState, at as SkillConsentView, au as StepEscalationView, av as UseMcpAppHostOptions, aw as appDisplayModeAllowed, ax as appDownloadOf, ay as appDownloadRefusal, az as appFileExtensionOf, aA as appFileNameOf, aB as appGestureOf, aC as appLinkOf, aD as appMessageTextOf, aE as appMimeTypeOf, aF as appSamplingErrorOf, aG as buildMcpAppDocument, aH as buildMcpAppSandboxShell, aI as clampAppHeight, aJ as elicitationFields, aK as elicitationFormAnswer, aL as elicitationInitialDraft, aM as elicitationLink, aN as formatCountdown, aO as grantedAppCsp, aP as mcpAppCsp, aQ as mcpAppHostCapabilities, aR as mcpAppSandboxProxyUrl, aS as mcpAppSandboxShellCsp, aT as mcpAppSandboxTarget, aU as resolveAppDownload, aV as saveAppFile, aW as useMcpAppHost } from './elicitation-B6h_-yLg.cjs';
5
+ import { A as AgentUiState, C as ChatAttachment, a as ApprovalView, b as ChatMessage, c as AgentStatus, E as ElicitationIssueKind, d as ElicitationOutcomeReason, M as McpAppSandboxReason, R as RemoteRunView, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-BTrJ5t3c.cjs';
6
+ export { s as APP_DEFAULT_HEIGHT, t as APP_MAX_HEIGHT, u as APP_MIN_HEIGHT, v as AppDownload, w as AppDownloadView, x as AppFileSaverEnv, y as AppLink, z as AppReadyDownload, F as AppResourceReader, G as ElicitationControl, H as ElicitationDraft, I as ElicitationDraftValue, J as ElicitationField, K as ElicitationFormOutcome, N as ElicitationIssue, O as ElicitationLink, Q as ElicitationOption, V as FetchView, X as MCP_APP_DISPLAY_MODES, Y as MCP_APP_MAX_ARGS_CHARS, Z as MCP_APP_MAX_DOWNLOAD_BYTES, _ as MCP_APP_MAX_FILE_NAME_CHARS, $ as MCP_APP_MAX_IN_FLIGHT, a0 as MCP_APP_MAX_MESSAGE_CHARS, a1 as MCP_APP_MAX_URL_CHARS, a2 as MCP_APP_NOTIFICATIONS, a3 as MCP_APP_OPTIONAL_REQUESTS, a4 as MCP_APP_PROTOCOL_VERSION, a5 as MCP_APP_REFUSED, a6 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a7 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a8 as MCP_APP_RELAY, a9 as MCP_APP_REQUESTS, aa as MCP_APP_SANDBOX_FRAME_TOKENS, ab as MCP_APP_SANDBOX_GRACE_MS, ac as MCP_APP_SANDBOX_SERVER, ad as MCP_APP_SANDBOX_TIMEOUT_MS, ae as McpAppBridge, af as McpAppBridgeHandlers, ag as McpAppBridgeOptions, ah as McpAppDisplayMode, ai as McpAppRpcError, aj as McpAppRpcMessage, ak as McpAppSandboxInput, al as McpAppSandboxLink, am as McpAppSandboxLinkOptions, an as McpAppSandboxTarget, ao as McpElicitationFieldSchema, ap as McpElicitationRequest, aq as McpElicitationSchema, ar as QueuedMessageView, as as ReplanState, at as SkillConsentView, au as StepEscalationView, av as UseMcpAppHostOptions, aw as appDisplayModeAllowed, ax as appDownloadOf, ay as appDownloadRefusal, az as appFileExtensionOf, aA as appFileNameOf, aB as appGestureOf, aC as appLinkOf, aD as appMessageTextOf, aE as appMimeTypeOf, aF as appSamplingErrorOf, aG as buildMcpAppDocument, aH as buildMcpAppSandboxShell, aI as clampAppHeight, aJ as elicitationFields, aK as elicitationFormAnswer, aL as elicitationInitialDraft, aM as elicitationLink, aN as formatCountdown, aO as grantedAppCsp, aP as mcpAppCsp, aQ as mcpAppHostCapabilities, aR as mcpAppSandboxProxyUrl, aS as mcpAppSandboxShellCsp, aT as mcpAppSandboxTarget, aU as resolveAppDownload, aV as saveAppFile, aW as useMcpAppHost } from './elicitation-BTrJ5t3c.cjs';
7
7
  export { M as MCP_APP_POLICY_TOKEN_MAX_CHARS, a as MCP_APP_SANDBOX_PROXY_READY, b as MCP_APP_SANDBOX_RESOURCE_READY, i as isMcpAppSandboxMessage, m as mcpAppPolicyToken } from './mcp-app-policy-DIUmGPJP.cjs';
8
8
 
9
9
  interface UseAgentOptions {
@@ -865,6 +865,13 @@ interface AgentLabels {
865
865
  approvalLeadHelper: (role: string | undefined, depth: number) => string;
866
866
  /** Alt text of a generated image; `path` is where it is in the workspace. */
867
867
  mediaImage: (path: string) => string;
868
+ /** A picture in the transcript: the thumbnail's accessible name (it opens the viewer). */
869
+ imageOpen: (name: string) => string;
870
+ /** The image viewer: the other pictures of the message, the zoom switch, "2 of 5". */
871
+ imagePrevious: string;
872
+ imageNext: string;
873
+ imageZoom: string;
874
+ imageCount: (index: number, total: number) => string;
868
875
  /** The accessible name of a generated audio player. */
869
876
  mediaAudio: (path: string) => string;
870
877
  /** A generated file that cannot be shown here (no workspace, the file is gone, an unknown type). */
@@ -1492,6 +1499,57 @@ interface FilesPanelProps {
1492
1499
  */
1493
1500
  declare const FilesPanel: ({ files: vfs, prefix, title, allowUpload, allowDelete, uploadDir, onOpen, renderFile, labels, className, }: FilesPanelProps) => react.JSX.Element;
1494
1501
 
1502
+ /** A picture the viewer shows: where it is read from (`data:` / `blob:` / a URL) and its name. */
1503
+ interface ViewerImage {
1504
+ src: string;
1505
+ /** The file's name: the dialog's label and the name of the download. */
1506
+ name: string;
1507
+ alt?: string;
1508
+ }
1509
+ interface ImageViewerProps {
1510
+ /** The pictures of one message, in the order they are shown. */
1511
+ images: ViewerImage[];
1512
+ /** The one on the screen. */
1513
+ index: number;
1514
+ onIndex: (index: number) => void;
1515
+ onClose: () => void;
1516
+ labels?: AgentLabelsOverride;
1517
+ }
1518
+ /**
1519
+ * A picture over the chat, in the page: fitted to the screen, the others of its message one
1520
+ * arrow (or swipe) away, a click to see it at full size, Download as a file. A modal dialog -
1521
+ * Esc, the close button or the backdrop close it; focus stays inside while it is open. Nothing
1522
+ * is opened in another window, and the picture is only ever an `<img>`.
1523
+ */
1524
+ declare const ImageViewer: ({ images, index, onIndex, onClose, labels }: ImageViewerProps) => react.JSX.Element | null;
1525
+ /** Draws the viewer your way; `fallback` is the built-in `<ImageViewer>`, to wrap or ignore. */
1526
+ type RenderImageViewer = (props: ImageViewerProps, fallback: ReactNode) => ReactNode;
1527
+ /** Sets how the pictures under it open (`<AgentChat imageViewer>` / `<MessageList imageViewer>`). */
1528
+ declare const ImageViewerProvider: ({ enabled, render, children, }: {
1529
+ enabled?: boolean;
1530
+ render?: RenderImageViewer;
1531
+ children: ReactNode;
1532
+ }) => react.JSX.Element;
1533
+ /** `.png` for a `data:image/png…` URL (a picture that has no file name of its own). */
1534
+ declare const imageExtensionOf: (src: string) => string;
1535
+ interface ImageThumbProps {
1536
+ src: string;
1537
+ /** The file's name or path. */
1538
+ name: string;
1539
+ alt: string;
1540
+ /** Classes of the thumbnail's control and of its `<img>`. */
1541
+ className?: string;
1542
+ imgClassName?: string;
1543
+ title?: string;
1544
+ labels?: AgentLabelsOverride;
1545
+ }
1546
+ /**
1547
+ * A picture in the transcript: a thumbnail that opens the viewer over the chat (a button - click,
1548
+ * Enter or Space), with the other pictures of its message to go through. With the viewer
1549
+ * switched off it is what it was: a link that opens the picture in a new tab.
1550
+ */
1551
+ declare const ImageThumb: ({ src, name, alt, className, imgClassName, title, labels, }: ImageThumbProps) => react.JSX.Element;
1552
+
1495
1553
  /** How an `.html` file is previewed. */
1496
1554
  interface HtmlPreviewOptions {
1497
1555
  /**
@@ -1767,12 +1825,19 @@ interface MessageListProps {
1767
1825
  renderApp?: (app: AppView, message: ChatMessage) => ReactNode;
1768
1826
  /** Draw the apps of an answer (default true; needs `renderApp`). */
1769
1827
  showApps?: boolean;
1828
+ /**
1829
+ * How a picture (an attachment, a generated image, an image a tool returned) opens: in the
1830
+ * image viewer over the chat (default true), or - `false` - as a link in a new tab.
1831
+ */
1832
+ imageViewer?: boolean;
1833
+ /** The viewer drawn your way; `fallback` is the built-in `<ImageViewer>`. */
1834
+ renderImageViewer?: RenderImageViewer;
1770
1835
  labels?: AgentLabelsOverride;
1771
1836
  className?: string;
1772
1837
  }
1773
1838
  /** "in 12k · out 456 · think 120 · cached 9k · 4.2 s" for one answer. */
1774
1839
  declare const usageLine: (usage: IUsage | undefined, durationMs?: number) => string;
1775
- /** The built-in attachment: an image thumbnail (opens full size) or a file chip. */
1840
+ /** The built-in attachment: an image thumbnail (opens in the viewer) or a file chip. */
1776
1841
  declare const AttachmentView: ({ attachment: a }: {
1777
1842
  attachment: ChatAttachment;
1778
1843
  }) => react.JSX.Element;
@@ -1783,7 +1848,7 @@ declare const AttachmentView: ({ attachment: a }: {
1783
1848
  * subagents, consent decisions — and the tokens it spent by kind. Every part
1784
1849
  * can be hidden, relabelled or rendered by the host.
1785
1850
  */
1786
- declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, showNotes, showLearned, showTiers, showReplanFailed, showDecisions, showSearchResults, showSubagents, showMedia, showFileChips, files, htmlPreview, onShowFiles, renderFile, renderFileContent, renderMedia, renderSubagent, onStopSubagent, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, renderApp, showApps, labels, className, }: MessageListProps) => react.JSX.Element | null;
1851
+ declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, showNotes, showLearned, showTiers, showReplanFailed, showDecisions, showSearchResults, showSubagents, showMedia, showFileChips, files, htmlPreview, onShowFiles, renderFile, renderFileContent, renderMedia, renderSubagent, onStopSubagent, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, renderApp, showApps, imageViewer, renderImageViewer, labels, className, }: MessageListProps) => react.JSX.Element | null;
1787
1852
 
1788
1853
  interface ToolApprovalPromptProps {
1789
1854
  /** Pending requests (e.g. `agent.pendingApprovals`). */
@@ -1852,6 +1917,8 @@ interface AgentChatClassNames {
1852
1917
  footer?: string;
1853
1918
  sidebar?: string;
1854
1919
  files?: string;
1920
+ /** The shade beside an open side panel on a narrow chat (a tap on it closes the panel). */
1921
+ scrim?: string;
1855
1922
  }
1856
1923
  interface AgentChatProps {
1857
1924
  /**
@@ -1987,6 +2054,13 @@ interface AgentChatProps {
1987
2054
  /** A server's question (gets the built-in card as `fallback`, and `answer`). */
1988
2055
  renderElicitation?: ElicitationPromptProps['renderElicitation'];
1989
2056
  slots?: AgentChatSlots;
2057
+ /**
2058
+ * How a picture in the transcript opens: in the image viewer over the chat (default true),
2059
+ * or - `false` - as a link in a new tab, as it used to.
2060
+ */
2061
+ imageViewer?: boolean;
2062
+ /** The image viewer drawn your way; `fallback` is the built-in `<ImageViewer>`. */
2063
+ renderImageViewer?: RenderImageViewer;
1990
2064
  components?: AgentChatComponents;
1991
2065
  /** Override any text (i18n); applies to every part inside. */
1992
2066
  labels?: AgentLabelsOverride;
@@ -2280,6 +2354,71 @@ interface WebSearchView {
2280
2354
  */
2281
2355
  declare const webSearchOf: (output: unknown) => WebSearchView | undefined;
2282
2356
 
2357
+ /**
2358
+ * Keeps a scrolling transcript where it should be while content arrives (`follow-scroll.ts` has
2359
+ * the rule):
2360
+ *
2361
+ * - at the end, it stays at the end - set in a layout effect and from a ResizeObserver, both
2362
+ * before the browser paints, so no frame is drawn at the old position: for every render that
2363
+ * changed it, for a new size of its box (the keyboard), and - while content arrives (`live`) -
2364
+ * for every change of size of its parts (a picture that loads, a block that folds);
2365
+ * - while nothing arrives, a part that grows by itself (an app's frame the person clicks in, a
2366
+ * summary they opened) unfolds where it is: the view stays, as if they had moved up - it does not
2367
+ * move what is under their finger;
2368
+ * - moved up by the person, it stays on what they read: elements at the top of the view are
2369
+ * remembered (the smallest first) and the shift of the first one still drawn undone - what a
2370
+ * browser's scroll anchoring does where there is one (not in Safari), done here in every engine,
2371
+ * the browser's own turned off for the element.
2372
+ *
2373
+ * The position is set at once, never animated: there is no motion to reduce.
2374
+ *
2375
+ * `turn`: a value that changes when the person sends a message - the view goes to the end.
2376
+ * `live`: whether content is arriving (a run is under way); default true - every change of size
2377
+ * is followed.
2378
+ */
2379
+ declare const useFollowScroll: (ref: RefObject<HTMLElement | null>, turn?: unknown, live?: boolean) => void;
2380
+
2381
+ /**
2382
+ * The transcript's scroll position while content arrives - the rule, as a pure function (no DOM),
2383
+ * and the numbers it stands on. `useFollowScroll` (hooks/use-follow-scroll.ts) applies it.
2384
+ *
2385
+ * Two states. FOLLOWING: the view is at the end and stays there, whatever grows or shrinks.
2386
+ * READING: the person moved up, and the view is theirs - nothing that arrives moves what they
2387
+ * read; going back down to the end follows again.
2388
+ */
2389
+ /** A scroller's measures (CSS pixels). */
2390
+ interface ScrollMeasure {
2391
+ scrollTop: number;
2392
+ scrollHeight: number;
2393
+ clientHeight: number;
2394
+ }
2395
+ /** How far from the end still counts as "back at the end" when moving down. */
2396
+ declare const FOLLOW_REJOIN_PX = 80;
2397
+ /**
2398
+ * How far above the end a move up must leave the view to count as the person's. Under it, a
2399
+ * move up is the browser's own: the bounce at the end of a touch scroll (the position comes
2400
+ * back from beyond the end), or a sub-pixel rounding. Small on purpose: a slow drag moves a
2401
+ * few pixels between two pieces of an answer, and must not be pulled back.
2402
+ */
2403
+ declare const FOLLOW_LEAVE_PX = 2;
2404
+ /**
2405
+ * Whether the view follows after a scroll event: `before` is what the scroller measured when it
2406
+ * was last looked at, `now` what it measures in the event.
2407
+ *
2408
+ * - The content or the box changed size since: the move is the layout's (the browser keeps the
2409
+ * position inside a shorter transcript, a keyboard opens), not the person's - nothing changes.
2410
+ * - A move up that leaves the end: the person reads - stop following.
2411
+ * - A move down that ends near the end: follow again.
2412
+ */
2413
+ declare const followsAfterScroll: (following: boolean, before: ScrollMeasure, now: ScrollMeasure) => boolean;
2414
+ /**
2415
+ * Whether the view still follows when the transcript changed size: a piece of the answer often
2416
+ * lands between a move of the person's and its scroll event, and must not undo the move. With
2417
+ * the box as it was and the transcript no shorter, nothing but the person moves the view up
2418
+ * (the hook turns the browser's own scroll anchoring off: `useFollowScroll`).
2419
+ */
2420
+ declare const followsAfterResize: (following: boolean, before: ScrollMeasure, now: ScrollMeasure) => boolean;
2421
+
2283
2422
  /** The consent requests waiting for a person, by request id. */
2284
2423
  interface ApprovalQueue {
2285
2424
  /**
@@ -2461,5 +2600,5 @@ interface AppRequestPromptProps {
2461
2600
  */
2462
2601
  declare const AppRequestPrompt: ({ requests, onAnswer, renderRequest, labels, className, }: AppRequestPromptProps) => react.JSX.Element | null;
2463
2602
 
2464
- export { AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, RemoteRunView, SandboxedFrame, SourceView, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, attachmentKindOf, attachmentRefusal, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createInitialAgentState, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, formatElapsed, lessonsOf, linkedFilesOf, mediaFamilyOf, mergeChatRecord, mergeLabels, newChatId, noticesOf, parseSlash, pendingApprovalsOf, sandboxTokens, sandboxedCsp, saveChat, steerIntent, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments, withCspFirst, withPolicyFirst };
2465
- export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MessageListProps, ModelLoadBarProps, NoticeTexts, PlanViewProps, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, SlashCommand, SourceToken, SourceViewProps, SpeechRecognizerLike, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, ToolApprovalPromptProps, ToolCallRowProps, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, WebLLMModelFactory, WebSearchResultView, WebSearchView };
2603
+ export { AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, ImageThumb, ImageViewer, ImageViewerProvider, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, RemoteRunView, SandboxedFrame, SourceView, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, attachmentKindOf, attachmentRefusal, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createInitialAgentState, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, followsAfterResize, followsAfterScroll, formatElapsed, imageExtensionOf, lessonsOf, linkedFilesOf, mediaFamilyOf, mergeChatRecord, mergeLabels, newChatId, noticesOf, parseSlash, pendingApprovalsOf, sandboxTokens, sandboxedCsp, saveChat, steerIntent, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useFollowScroll, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments, withCspFirst, withPolicyFirst };
2604
+ export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, ImageThumbProps, ImageViewerProps, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MessageListProps, ModelLoadBarProps, NoticeTexts, PlanViewProps, RenderImageViewer, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, ScrollMeasure, SlashCommand, SourceToken, SourceViewProps, SpeechRecognizerLike, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, ToolApprovalPromptProps, ToolCallRowProps, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, ViewerImage, WebLLMModelFactory, WebSearchResultView, WebSearchView };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as react from 'react';
2
2
  import { DependencyList, ReactNode, RefObject, ComponentType, CSSProperties } from 'react';
3
3
  import { RunFile, RunResult, Agent, ToolApprovalMode, AppToolCallRequest, AppSamplingRequest, AppSamplingView, AppSamplingResult, CompactResult, IUsage, AgentEventHandler, BrowserAgentConfig, VirtualFileInfo, VirtualFileSystem, CredentialStore, createWebLLMModel, WebLLMModelOptions, ModelTier, TierReason, EscalationReason, DecisionFallbackReason, AgentEvent, Skill, IPlan, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
4
4
  export { Agent, AgentEvent, AgentEventHandler, AgentLoggerSink, AgentTool, AgentToolSet, AppToolCallRequest, AttachmentsNotSupportedError, BrowserAgentConfig, CompactResult, CompactionConfig, CredentialStore, FileToolsOptions, IPlan, IPlanStep, IStepResult, IToolCall, IUsage, ImagesNotSupportedError, IndexedDBStore, LearningConfig, LogLevel, McpAppCsp, McpAppResource, McpAppToolResult, MemoryCredentialStore, MemorySkillStore, MemoryStore, ModelInput, ProviderModelSpec, ProviderType, RunControl, RunFile, RunOptions, RunResult, SessionBusyError, SessionHolder, SessionLockMode, SessionRunState, SessionWatch, Skill, SkillStore, StorageChange, StorageChangeKind, StorageChangeOp, SubagentInfo, SubagentToolOptions, SubagentWorkerConfig, ThinkingLevel, ThinkingSetting, TokenLimits, ToolApprovalConfig, ToolApprovalContext, ToolApprovalMode, ToolApprovalRequest, VaultCredentialStore, VfsSkillStore, VirtualFile, VirtualFileInfo, VirtualFileSystem, WatchSessionOptions, createAgent, createFileTools, createRunControl, createSubagentTool, createWebLLMModel, defineSkill, defineTool, isWebGPUAvailable, loadSkillFromUrl, markReadOnly, onStorageChange, parseSkillMarkdown, postStorageChange, preloadWebLLMModel, serveSubagentWorker, supportsImages, supportsPdf, unloadWebLLMModel, watchSession } from '@dudko.dev/agent-web';
5
- import { A as AgentUiState, C as ChatAttachment, a as ApprovalView, b as ChatMessage, c as AgentStatus, E as ElicitationIssueKind, d as ElicitationOutcomeReason, M as McpAppSandboxReason, R as RemoteRunView, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-B6h_-yLg.js';
6
- export { s as APP_DEFAULT_HEIGHT, t as APP_MAX_HEIGHT, u as APP_MIN_HEIGHT, v as AppDownload, w as AppDownloadView, x as AppFileSaverEnv, y as AppLink, z as AppReadyDownload, F as AppResourceReader, G as ElicitationControl, H as ElicitationDraft, I as ElicitationDraftValue, J as ElicitationField, K as ElicitationFormOutcome, N as ElicitationIssue, O as ElicitationLink, Q as ElicitationOption, V as FetchView, X as MCP_APP_DISPLAY_MODES, Y as MCP_APP_MAX_ARGS_CHARS, Z as MCP_APP_MAX_DOWNLOAD_BYTES, _ as MCP_APP_MAX_FILE_NAME_CHARS, $ as MCP_APP_MAX_IN_FLIGHT, a0 as MCP_APP_MAX_MESSAGE_CHARS, a1 as MCP_APP_MAX_URL_CHARS, a2 as MCP_APP_NOTIFICATIONS, a3 as MCP_APP_OPTIONAL_REQUESTS, a4 as MCP_APP_PROTOCOL_VERSION, a5 as MCP_APP_REFUSED, a6 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a7 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a8 as MCP_APP_RELAY, a9 as MCP_APP_REQUESTS, aa as MCP_APP_SANDBOX_FRAME_TOKENS, ab as MCP_APP_SANDBOX_GRACE_MS, ac as MCP_APP_SANDBOX_SERVER, ad as MCP_APP_SANDBOX_TIMEOUT_MS, ae as McpAppBridge, af as McpAppBridgeHandlers, ag as McpAppBridgeOptions, ah as McpAppDisplayMode, ai as McpAppRpcError, aj as McpAppRpcMessage, ak as McpAppSandboxInput, al as McpAppSandboxLink, am as McpAppSandboxLinkOptions, an as McpAppSandboxTarget, ao as McpElicitationFieldSchema, ap as McpElicitationRequest, aq as McpElicitationSchema, ar as QueuedMessageView, as as ReplanState, at as SkillConsentView, au as StepEscalationView, av as UseMcpAppHostOptions, aw as appDisplayModeAllowed, ax as appDownloadOf, ay as appDownloadRefusal, az as appFileExtensionOf, aA as appFileNameOf, aB as appGestureOf, aC as appLinkOf, aD as appMessageTextOf, aE as appMimeTypeOf, aF as appSamplingErrorOf, aG as buildMcpAppDocument, aH as buildMcpAppSandboxShell, aI as clampAppHeight, aJ as elicitationFields, aK as elicitationFormAnswer, aL as elicitationInitialDraft, aM as elicitationLink, aN as formatCountdown, aO as grantedAppCsp, aP as mcpAppCsp, aQ as mcpAppHostCapabilities, aR as mcpAppSandboxProxyUrl, aS as mcpAppSandboxShellCsp, aT as mcpAppSandboxTarget, aU as resolveAppDownload, aV as saveAppFile, aW as useMcpAppHost } from './elicitation-B6h_-yLg.js';
5
+ import { A as AgentUiState, C as ChatAttachment, a as ApprovalView, b as ChatMessage, c as AgentStatus, E as ElicitationIssueKind, d as ElicitationOutcomeReason, M as McpAppSandboxReason, R as RemoteRunView, L as LessonView, S as SubagentView, e as SubagentNode, P as PendingElicitation, f as McpElicitationResult, g as ElicitationView, W as WrittenFileView, T as ToolCallView, h as StepView, U as UserNoteView, D as DecisionView, i as MediaView, j as AppView, k as McpAppsConnectionLike, l as McpAppSandboxOptions, m as AppRequestView, n as TranscriptView, B as BudgetView, o as CompactionView, p as ModelLoadState, q as McpAppHost, r as AppRequestAnswerOptions } from './elicitation-BTrJ5t3c.js';
6
+ export { s as APP_DEFAULT_HEIGHT, t as APP_MAX_HEIGHT, u as APP_MIN_HEIGHT, v as AppDownload, w as AppDownloadView, x as AppFileSaverEnv, y as AppLink, z as AppReadyDownload, F as AppResourceReader, G as ElicitationControl, H as ElicitationDraft, I as ElicitationDraftValue, J as ElicitationField, K as ElicitationFormOutcome, N as ElicitationIssue, O as ElicitationLink, Q as ElicitationOption, V as FetchView, X as MCP_APP_DISPLAY_MODES, Y as MCP_APP_MAX_ARGS_CHARS, Z as MCP_APP_MAX_DOWNLOAD_BYTES, _ as MCP_APP_MAX_FILE_NAME_CHARS, $ as MCP_APP_MAX_IN_FLIGHT, a0 as MCP_APP_MAX_MESSAGE_CHARS, a1 as MCP_APP_MAX_URL_CHARS, a2 as MCP_APP_NOTIFICATIONS, a3 as MCP_APP_OPTIONAL_REQUESTS, a4 as MCP_APP_PROTOCOL_VERSION, a5 as MCP_APP_REFUSED, a6 as MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS, a7 as MCP_APP_REFUSED_DOWNLOAD_TYPES, a8 as MCP_APP_RELAY, a9 as MCP_APP_REQUESTS, aa as MCP_APP_SANDBOX_FRAME_TOKENS, ab as MCP_APP_SANDBOX_GRACE_MS, ac as MCP_APP_SANDBOX_SERVER, ad as MCP_APP_SANDBOX_TIMEOUT_MS, ae as McpAppBridge, af as McpAppBridgeHandlers, ag as McpAppBridgeOptions, ah as McpAppDisplayMode, ai as McpAppRpcError, aj as McpAppRpcMessage, ak as McpAppSandboxInput, al as McpAppSandboxLink, am as McpAppSandboxLinkOptions, an as McpAppSandboxTarget, ao as McpElicitationFieldSchema, ap as McpElicitationRequest, aq as McpElicitationSchema, ar as QueuedMessageView, as as ReplanState, at as SkillConsentView, au as StepEscalationView, av as UseMcpAppHostOptions, aw as appDisplayModeAllowed, ax as appDownloadOf, ay as appDownloadRefusal, az as appFileExtensionOf, aA as appFileNameOf, aB as appGestureOf, aC as appLinkOf, aD as appMessageTextOf, aE as appMimeTypeOf, aF as appSamplingErrorOf, aG as buildMcpAppDocument, aH as buildMcpAppSandboxShell, aI as clampAppHeight, aJ as elicitationFields, aK as elicitationFormAnswer, aL as elicitationInitialDraft, aM as elicitationLink, aN as formatCountdown, aO as grantedAppCsp, aP as mcpAppCsp, aQ as mcpAppHostCapabilities, aR as mcpAppSandboxProxyUrl, aS as mcpAppSandboxShellCsp, aT as mcpAppSandboxTarget, aU as resolveAppDownload, aV as saveAppFile, aW as useMcpAppHost } from './elicitation-BTrJ5t3c.js';
7
7
  export { M as MCP_APP_POLICY_TOKEN_MAX_CHARS, a as MCP_APP_SANDBOX_PROXY_READY, b as MCP_APP_SANDBOX_RESOURCE_READY, i as isMcpAppSandboxMessage, m as mcpAppPolicyToken } from './mcp-app-policy-DIUmGPJP.js';
8
8
 
9
9
  interface UseAgentOptions {
@@ -865,6 +865,13 @@ interface AgentLabels {
865
865
  approvalLeadHelper: (role: string | undefined, depth: number) => string;
866
866
  /** Alt text of a generated image; `path` is where it is in the workspace. */
867
867
  mediaImage: (path: string) => string;
868
+ /** A picture in the transcript: the thumbnail's accessible name (it opens the viewer). */
869
+ imageOpen: (name: string) => string;
870
+ /** The image viewer: the other pictures of the message, the zoom switch, "2 of 5". */
871
+ imagePrevious: string;
872
+ imageNext: string;
873
+ imageZoom: string;
874
+ imageCount: (index: number, total: number) => string;
868
875
  /** The accessible name of a generated audio player. */
869
876
  mediaAudio: (path: string) => string;
870
877
  /** A generated file that cannot be shown here (no workspace, the file is gone, an unknown type). */
@@ -1492,6 +1499,57 @@ interface FilesPanelProps {
1492
1499
  */
1493
1500
  declare const FilesPanel: ({ files: vfs, prefix, title, allowUpload, allowDelete, uploadDir, onOpen, renderFile, labels, className, }: FilesPanelProps) => react.JSX.Element;
1494
1501
 
1502
+ /** A picture the viewer shows: where it is read from (`data:` / `blob:` / a URL) and its name. */
1503
+ interface ViewerImage {
1504
+ src: string;
1505
+ /** The file's name: the dialog's label and the name of the download. */
1506
+ name: string;
1507
+ alt?: string;
1508
+ }
1509
+ interface ImageViewerProps {
1510
+ /** The pictures of one message, in the order they are shown. */
1511
+ images: ViewerImage[];
1512
+ /** The one on the screen. */
1513
+ index: number;
1514
+ onIndex: (index: number) => void;
1515
+ onClose: () => void;
1516
+ labels?: AgentLabelsOverride;
1517
+ }
1518
+ /**
1519
+ * A picture over the chat, in the page: fitted to the screen, the others of its message one
1520
+ * arrow (or swipe) away, a click to see it at full size, Download as a file. A modal dialog -
1521
+ * Esc, the close button or the backdrop close it; focus stays inside while it is open. Nothing
1522
+ * is opened in another window, and the picture is only ever an `<img>`.
1523
+ */
1524
+ declare const ImageViewer: ({ images, index, onIndex, onClose, labels }: ImageViewerProps) => react.JSX.Element | null;
1525
+ /** Draws the viewer your way; `fallback` is the built-in `<ImageViewer>`, to wrap or ignore. */
1526
+ type RenderImageViewer = (props: ImageViewerProps, fallback: ReactNode) => ReactNode;
1527
+ /** Sets how the pictures under it open (`<AgentChat imageViewer>` / `<MessageList imageViewer>`). */
1528
+ declare const ImageViewerProvider: ({ enabled, render, children, }: {
1529
+ enabled?: boolean;
1530
+ render?: RenderImageViewer;
1531
+ children: ReactNode;
1532
+ }) => react.JSX.Element;
1533
+ /** `.png` for a `data:image/png…` URL (a picture that has no file name of its own). */
1534
+ declare const imageExtensionOf: (src: string) => string;
1535
+ interface ImageThumbProps {
1536
+ src: string;
1537
+ /** The file's name or path. */
1538
+ name: string;
1539
+ alt: string;
1540
+ /** Classes of the thumbnail's control and of its `<img>`. */
1541
+ className?: string;
1542
+ imgClassName?: string;
1543
+ title?: string;
1544
+ labels?: AgentLabelsOverride;
1545
+ }
1546
+ /**
1547
+ * A picture in the transcript: a thumbnail that opens the viewer over the chat (a button - click,
1548
+ * Enter or Space), with the other pictures of its message to go through. With the viewer
1549
+ * switched off it is what it was: a link that opens the picture in a new tab.
1550
+ */
1551
+ declare const ImageThumb: ({ src, name, alt, className, imgClassName, title, labels, }: ImageThumbProps) => react.JSX.Element;
1552
+
1495
1553
  /** How an `.html` file is previewed. */
1496
1554
  interface HtmlPreviewOptions {
1497
1555
  /**
@@ -1767,12 +1825,19 @@ interface MessageListProps {
1767
1825
  renderApp?: (app: AppView, message: ChatMessage) => ReactNode;
1768
1826
  /** Draw the apps of an answer (default true; needs `renderApp`). */
1769
1827
  showApps?: boolean;
1828
+ /**
1829
+ * How a picture (an attachment, a generated image, an image a tool returned) opens: in the
1830
+ * image viewer over the chat (default true), or - `false` - as a link in a new tab.
1831
+ */
1832
+ imageViewer?: boolean;
1833
+ /** The viewer drawn your way; `fallback` is the built-in `<ImageViewer>`. */
1834
+ renderImageViewer?: RenderImageViewer;
1770
1835
  labels?: AgentLabelsOverride;
1771
1836
  className?: string;
1772
1837
  }
1773
1838
  /** "in 12k · out 456 · think 120 · cached 9k · 4.2 s" for one answer. */
1774
1839
  declare const usageLine: (usage: IUsage | undefined, durationMs?: number) => string;
1775
- /** The built-in attachment: an image thumbnail (opens full size) or a file chip. */
1840
+ /** The built-in attachment: an image thumbnail (opens in the viewer) or a file chip. */
1776
1841
  declare const AttachmentView: ({ attachment: a }: {
1777
1842
  attachment: ChatAttachment;
1778
1843
  }) => react.JSX.Element;
@@ -1783,7 +1848,7 @@ declare const AttachmentView: ({ attachment: a }: {
1783
1848
  * subagents, consent decisions — and the tokens it spent by kind. Every part
1784
1849
  * can be hidden, relabelled or rendered by the host.
1785
1850
  */
1786
- declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, showNotes, showLearned, showTiers, showReplanFailed, showDecisions, showSearchResults, showSubagents, showMedia, showFileChips, files, htmlPreview, onShowFiles, renderFile, renderFileContent, renderMedia, renderSubagent, onStopSubagent, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, renderApp, showApps, labels, className, }: MessageListProps) => react.JSX.Element | null;
1851
+ declare const MessageList: ({ messages, empty, showActivity, showToolCalls, showUsage, showThoughts, showNotes, showLearned, showTiers, showReplanFailed, showDecisions, showSearchResults, showSubagents, showMedia, showFileChips, files, htmlPreview, onShowFiles, renderFile, renderFileContent, renderMedia, renderSubagent, onStopSubagent, activityOpen, liveExtra, renderContent, renderMessage, renderAttachment, renderToolCall, renderApp, showApps, imageViewer, renderImageViewer, labels, className, }: MessageListProps) => react.JSX.Element | null;
1787
1852
 
1788
1853
  interface ToolApprovalPromptProps {
1789
1854
  /** Pending requests (e.g. `agent.pendingApprovals`). */
@@ -1852,6 +1917,8 @@ interface AgentChatClassNames {
1852
1917
  footer?: string;
1853
1918
  sidebar?: string;
1854
1919
  files?: string;
1920
+ /** The shade beside an open side panel on a narrow chat (a tap on it closes the panel). */
1921
+ scrim?: string;
1855
1922
  }
1856
1923
  interface AgentChatProps {
1857
1924
  /**
@@ -1987,6 +2054,13 @@ interface AgentChatProps {
1987
2054
  /** A server's question (gets the built-in card as `fallback`, and `answer`). */
1988
2055
  renderElicitation?: ElicitationPromptProps['renderElicitation'];
1989
2056
  slots?: AgentChatSlots;
2057
+ /**
2058
+ * How a picture in the transcript opens: in the image viewer over the chat (default true),
2059
+ * or - `false` - as a link in a new tab, as it used to.
2060
+ */
2061
+ imageViewer?: boolean;
2062
+ /** The image viewer drawn your way; `fallback` is the built-in `<ImageViewer>`. */
2063
+ renderImageViewer?: RenderImageViewer;
1990
2064
  components?: AgentChatComponents;
1991
2065
  /** Override any text (i18n); applies to every part inside. */
1992
2066
  labels?: AgentLabelsOverride;
@@ -2280,6 +2354,71 @@ interface WebSearchView {
2280
2354
  */
2281
2355
  declare const webSearchOf: (output: unknown) => WebSearchView | undefined;
2282
2356
 
2357
+ /**
2358
+ * Keeps a scrolling transcript where it should be while content arrives (`follow-scroll.ts` has
2359
+ * the rule):
2360
+ *
2361
+ * - at the end, it stays at the end - set in a layout effect and from a ResizeObserver, both
2362
+ * before the browser paints, so no frame is drawn at the old position: for every render that
2363
+ * changed it, for a new size of its box (the keyboard), and - while content arrives (`live`) -
2364
+ * for every change of size of its parts (a picture that loads, a block that folds);
2365
+ * - while nothing arrives, a part that grows by itself (an app's frame the person clicks in, a
2366
+ * summary they opened) unfolds where it is: the view stays, as if they had moved up - it does not
2367
+ * move what is under their finger;
2368
+ * - moved up by the person, it stays on what they read: elements at the top of the view are
2369
+ * remembered (the smallest first) and the shift of the first one still drawn undone - what a
2370
+ * browser's scroll anchoring does where there is one (not in Safari), done here in every engine,
2371
+ * the browser's own turned off for the element.
2372
+ *
2373
+ * The position is set at once, never animated: there is no motion to reduce.
2374
+ *
2375
+ * `turn`: a value that changes when the person sends a message - the view goes to the end.
2376
+ * `live`: whether content is arriving (a run is under way); default true - every change of size
2377
+ * is followed.
2378
+ */
2379
+ declare const useFollowScroll: (ref: RefObject<HTMLElement | null>, turn?: unknown, live?: boolean) => void;
2380
+
2381
+ /**
2382
+ * The transcript's scroll position while content arrives - the rule, as a pure function (no DOM),
2383
+ * and the numbers it stands on. `useFollowScroll` (hooks/use-follow-scroll.ts) applies it.
2384
+ *
2385
+ * Two states. FOLLOWING: the view is at the end and stays there, whatever grows or shrinks.
2386
+ * READING: the person moved up, and the view is theirs - nothing that arrives moves what they
2387
+ * read; going back down to the end follows again.
2388
+ */
2389
+ /** A scroller's measures (CSS pixels). */
2390
+ interface ScrollMeasure {
2391
+ scrollTop: number;
2392
+ scrollHeight: number;
2393
+ clientHeight: number;
2394
+ }
2395
+ /** How far from the end still counts as "back at the end" when moving down. */
2396
+ declare const FOLLOW_REJOIN_PX = 80;
2397
+ /**
2398
+ * How far above the end a move up must leave the view to count as the person's. Under it, a
2399
+ * move up is the browser's own: the bounce at the end of a touch scroll (the position comes
2400
+ * back from beyond the end), or a sub-pixel rounding. Small on purpose: a slow drag moves a
2401
+ * few pixels between two pieces of an answer, and must not be pulled back.
2402
+ */
2403
+ declare const FOLLOW_LEAVE_PX = 2;
2404
+ /**
2405
+ * Whether the view follows after a scroll event: `before` is what the scroller measured when it
2406
+ * was last looked at, `now` what it measures in the event.
2407
+ *
2408
+ * - The content or the box changed size since: the move is the layout's (the browser keeps the
2409
+ * position inside a shorter transcript, a keyboard opens), not the person's - nothing changes.
2410
+ * - A move up that leaves the end: the person reads - stop following.
2411
+ * - A move down that ends near the end: follow again.
2412
+ */
2413
+ declare const followsAfterScroll: (following: boolean, before: ScrollMeasure, now: ScrollMeasure) => boolean;
2414
+ /**
2415
+ * Whether the view still follows when the transcript changed size: a piece of the answer often
2416
+ * lands between a move of the person's and its scroll event, and must not undo the move. With
2417
+ * the box as it was and the transcript no shorter, nothing but the person moves the view up
2418
+ * (the hook turns the browser's own scroll anchoring off: `useFollowScroll`).
2419
+ */
2420
+ declare const followsAfterResize: (following: boolean, before: ScrollMeasure, now: ScrollMeasure) => boolean;
2421
+
2283
2422
  /** The consent requests waiting for a person, by request id. */
2284
2423
  interface ApprovalQueue {
2285
2424
  /**
@@ -2461,5 +2600,5 @@ interface AppRequestPromptProps {
2461
2600
  */
2462
2601
  declare const AppRequestPrompt: ({ requests, onAnswer, renderRequest, labels, className, }: AppRequestPromptProps) => react.JSX.Element | null;
2463
2602
 
2464
- export { AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, RemoteRunView, SandboxedFrame, SourceView, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, attachmentKindOf, attachmentRefusal, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createInitialAgentState, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, formatElapsed, lessonsOf, linkedFilesOf, mediaFamilyOf, mergeChatRecord, mergeLabels, newChatId, noticesOf, parseSlash, pendingApprovalsOf, sandboxTokens, sandboxedCsp, saveChat, steerIntent, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments, withCspFirst, withPolicyFirst };
2465
- export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MessageListProps, ModelLoadBarProps, NoticeTexts, PlanViewProps, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, SlashCommand, SourceToken, SourceViewProps, SpeechRecognizerLike, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, ToolApprovalPromptProps, ToolCallRowProps, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, WebLLMModelFactory, WebSearchResultView, WebSearchView };
2603
+ export { AgentChat, AgentComposer, AgentLabelsProvider, AgentProvider, AgentStatus, AgentUiState, ApiKeyForm, AppRequestAnswerOptions, AppRequestPrompt, AppRequestView, AppView, ApprovalModeSwitch, ApprovalView, AttachmentView, BudgetView, ChatAttachment, ChatHistoryList, ChatHistoryStore, ChatMessage, CompactionView, Composer, ContextMeter, DecisionView, ElicitationIssueKind, ElicitationOutcomeReason, ElicitationPrompt, ElicitationView, FILE_PREVIEW_CHARS, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, FileChip, FileChips, FilesPanel, GeneratedMedia, HTML_PREVIEW_MAX_CHARS, ImageThumb, ImageViewer, ImageViewerProvider, LearnedSkills, LessonView, McpAppFrame, McpAppHost, McpAppLine, McpAppSandboxOptions, McpAppSandboxReason, McpAppsConnectionLike, McpElicitationResult, MediaView, MessageList, ModelLoadBar, ModelLoadState, PendingElicitation, PlanView, RemoteRunView, SandboxedFrame, SourceView, StepList, StepView, SubagentNode, SubagentRow, SubagentTree, SubagentView, ToolApprovalPrompt, ToolCallRow, ToolCallView, TranscriptBlock, TranscriptView, UsageBadge, UserNoteRow, UserNoteView, agentStateReducer, agentStatusOf, attachmentKindOf, attachmentRefusal, buildSandboxedDocument, chatTitle, clampFrameHeight, createApprovalQueue, createInitialAgentState, createWebLLMEngine, decisionNote, defaultLabels, downscaleImage, escapeAttribute, fileKindOf, fileNameOf, filterCommands, followsAfterResize, followsAfterScroll, formatElapsed, imageExtensionOf, lessonsOf, linkedFilesOf, mediaFamilyOf, mergeChatRecord, mergeLabels, newChatId, noticesOf, parseSlash, pendingApprovalsOf, sandboxTokens, sandboxedCsp, saveChat, steerIntent, subagentTree, tokenizeHtml, unchangedSince, usageLine, useAgent, useAgentContext, useChatHistory, useCredentials, useFollowScroll, useLabels, useLocalModel, useOptionalAgentContext, useSpeechToText, useVirtualFiles, useWebLLMModel, webSearchOf, withAttachments, withCspFirst, withPolicyFirst };
2604
+ export type { AgentAction, AgentChatClassNames, AgentChatComponents, AgentChatProps, AgentChatSlots, AgentComposerProps, AgentLabels, AgentLabelsOverride, AgentLabelsProviderProps, AgentProviderProps, ApiKeyFormProps, AppRequestPromptProps, ApprovalModeSwitchProps, ApprovalQueue, ApproveOptions, ChatBase, ChatHistoryListProps, ChatHistoryStoreOptions, ChatRecord, ChatSummary, ComposerAttachment, ComposerModelChip, ComposerNotice, ComposerProps, ComposerThinkingChip, ContextMeterProps, ConvertedFile, DownscaleOptions, ElicitationPromptProps, FileChipProps, FileChipsProps, FileKind, FilesPanelProps, GeneratedMediaProps, HtmlPreviewOptions, ImageThumbProps, ImageViewerProps, LearnedSkillsProps, LocalModelEngine, LocalModelLoadContext, LocalModelProgress, McpAppFrameProps, McpAppLineProps, MessageListProps, ModelLoadBarProps, NoticeTexts, PlanViewProps, RenderImageViewer, RenderSubagent, RenderToolCall, RunGoalOptions, SandboxedDocumentOptions, SandboxedFrameProps, ScrollMeasure, SlashCommand, SourceToken, SourceViewProps, SpeechRecognizerLike, SteerIntent, StepListProps, SubagentRowProps, SubagentTreeProps, ToolApprovalPromptProps, ToolCallRowProps, TranscriptBlockProps, UsageBadgeProps, UseAgentOptions, UseAgentReturn, UseChatHistoryOptions, UseChatHistoryReturn, UseCredentialsReturn, UseLocalModelOptions, UseLocalModelReturn, UseSpeechToTextOptions, UseSpeechToTextReturn, UseVirtualFilesReturn, UseWebLLMModelOptions, UseWebLLMModelReturn, ViewerImage, WebLLMModelFactory, WebSearchResultView, WebSearchView };