@invergent/agent-chat-react 2.14.2 → 2.15.0

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
@@ -66,6 +66,13 @@ interface AgentChatMessage {
66
66
  errorInfo?: AgentChatErrorInfo;
67
67
  images?: AgentChatImageAttachment[];
68
68
  attachments?: AgentChatDisplayAttachment[];
69
+ /**
70
+ * The per-turn metadata the user message was sent with, as stored on
71
+ * its event. The whiteboard resolves relational anchors ("latest",
72
+ * "selection") from the `whiteboard` block at fold time, so it must
73
+ * survive replay from the event log, not just the live send.
74
+ */
75
+ metadata?: Record<string, unknown>;
69
76
  llmResponseEventId?: number;
70
77
  userFeedback?: {
71
78
  rating: "up" | "down";
@@ -458,7 +465,15 @@ interface AgentChatState {
458
465
  * results. Deduped by sourceId on insertion. */
459
466
  researchSources: AgentChatResearchSource[];
460
467
  }
461
- type AgentChatViewMode = "simple" | "expert";
468
+ /**
469
+ * How the conversation is shown.
470
+ *
471
+ * `whiteboard` is a *view* of the same session, not a different kind of
472
+ * session: the agent gets the draw tool on any turn sent from the
473
+ * canvas, so switching here never leaves you on a board the agent
474
+ * cannot draw on.
475
+ */
476
+ type AgentChatViewMode = "simple" | "expert" | "whiteboard";
462
477
  type AgentChatArtifactKind = "markdown" | "table" | "chart" | "html" | "svg" | "image" | "video";
463
478
  interface AgentChatArtifactMeta {
464
479
  artifact_id: string;
@@ -901,7 +916,9 @@ interface AgentChatRuntimeApi {
901
916
  tokenUsage: AgentChatTokenUsage;
902
917
  retryIndicator: AgentChatRetryIndicator | null;
903
918
  workspaceRefreshKey: number;
904
- send(content: string, images?: AgentChatImageAttachment[], attachments?: AgentChatPendingAttachment[]): Promise<void>;
919
+ send(content: string, images?: AgentChatImageAttachment[], attachments?: AgentChatPendingAttachment[],
920
+ /** Free-form per-turn metadata, forwarded verbatim to the adapter. */
921
+ metadata?: Record<string, unknown>): Promise<void>;
905
922
  stop(): Promise<void>;
906
923
  retry(): Promise<void>;
907
924
  markSending(content: string): void;
@@ -998,6 +1015,14 @@ interface AgentChatProps {
998
1015
  * Like `deepResearchEnabled`, the host owns the capability gate.
999
1016
  */
1000
1017
  codeAgentsEnabled?: boolean;
1018
+ /**
1019
+ * Whether this agent may draw on a canvas.
1020
+ *
1021
+ * One half of the gate on the composer's Whiteboard segment; the other
1022
+ * is the session having been created as a board. Like
1023
+ * `deepResearchEnabled`, the host owns this half.
1024
+ */
1025
+ whiteboardEnabled?: boolean;
1001
1026
  /**
1002
1027
  * Slash-command capability group (per-agent). These gate the always-on
1003
1028
  * lightweight builtins and default to shown when omitted, so a host that
@@ -1022,7 +1047,151 @@ interface AgentChatProps {
1022
1047
  */
1023
1048
  onOpenBilling?: () => void;
1024
1049
  }
1025
- declare function AgentChat({ adapter, agentId, sessionId, onSessionChange, onFileSelect, onMessagesChange, disabled, onComposerError, browserProfileId, onSelectBrowserProfile, browserProfilesEnabled, deepResearchEnabled, researchEnabled, codeAgentsEnabled, loopsEnabled, missionsEnabled, goalsEnabled, compressEnabled, onOpenIntegrations, onOpenBilling, }: AgentChatProps): react_jsx_runtime.JSX.Element;
1050
+ declare function AgentChat({ adapter, agentId, sessionId, onSessionChange, onFileSelect, onMessagesChange, disabled, onComposerError, browserProfileId, onSelectBrowserProfile, browserProfilesEnabled, deepResearchEnabled, researchEnabled, codeAgentsEnabled, whiteboardEnabled, loopsEnabled, missionsEnabled, goalsEnabled, compressEnabled, onOpenIntegrations, onOpenBilling, }: AgentChatProps): react_jsx_runtime.JSX.Element;
1051
+
1052
+ type WbTool = "pen" | "eraser" | "text" | "slot" | "select" | "pan";
1053
+
1054
+ interface AgentWhiteboardProps {
1055
+ adapter: AgentChatAdapter;
1056
+ agentId?: string;
1057
+ sessionId: string | null;
1058
+ onSessionChange?: (sessionId: string) => void;
1059
+ /**
1060
+ * Navigate to a session-less board. Without it "New board" cannot
1061
+ * clear the session id, which only the host's router owns.
1062
+ */
1063
+ onNewBoard?: () => void;
1064
+ disabled?: boolean;
1065
+ /**
1066
+ * View-mode switch, when the board is hosted inside `AgentChat`. The
1067
+ * control lives in the chat composer, so without it here the board is
1068
+ * a room with no door back.
1069
+ */
1070
+ viewMode?: AgentChatViewMode;
1071
+ onViewModeChange?: (mode: AgentChatViewMode) => void;
1072
+ }
1073
+ /**
1074
+ * The board over an existing runtime.
1075
+ *
1076
+ * Split from the standalone export so `AgentChat` can host it on the
1077
+ * runtime it already has: two `useAgentChatRuntime` calls for one
1078
+ * session would open two event streams and double every applied event.
1079
+ */
1080
+ interface WhiteboardSurfaceProps extends Omit<AgentWhiteboardProps, "adapter" | "agentId"> {
1081
+ adapter: AgentChatAdapter;
1082
+ agentId?: string;
1083
+ runtime: AgentChatRuntimeApi;
1084
+ }
1085
+ /** The board, standalone: owns its runtime. */
1086
+ declare function AgentWhiteboard(props: AgentWhiteboardProps): react_jsx_runtime.JSX.Element;
1087
+ declare function WhiteboardSurface({ adapter, agentId, sessionId, onSessionChange, onNewBoard, disabled, viewMode, onViewModeChange, runtime, }: WhiteboardSurfaceProps): react_jsx_runtime.JSX.Element;
1088
+
1089
+ interface WbBase {
1090
+ id: string;
1091
+ /**
1092
+ * Source tool-call id, or "local" for the user's own edits. Folding is
1093
+ * keyed on this so a re-delivered event cannot duplicate objects: the
1094
+ * SSE stream and the reconciliation poll both replay the same calls.
1095
+ */
1096
+ origin: string;
1097
+ selected: boolean;
1098
+ }
1099
+ type WbObject = WbBase & ({
1100
+ kind: "ink";
1101
+ pts: number[];
1102
+ width: number;
1103
+ color: string;
1104
+ } | {
1105
+ kind: "draw";
1106
+ origin_: [number, number];
1107
+ types: string[];
1108
+ items: number[][];
1109
+ width?: number;
1110
+ tension?: number;
1111
+ closed?: number[];
1112
+ fill?: number[];
1113
+ arrows?: number[];
1114
+ } | {
1115
+ kind: "text";
1116
+ x: number;
1117
+ y: number;
1118
+ text: string;
1119
+ fontSize: number;
1120
+ maxWidth: number;
1121
+ lineHeight: number;
1122
+ } | {
1123
+ kind: "formula";
1124
+ x: number;
1125
+ y: number;
1126
+ latex: string;
1127
+ fontSize: number;
1128
+ } | {
1129
+ kind: "artifact";
1130
+ x: number;
1131
+ y: number;
1132
+ w: number;
1133
+ h: number;
1134
+ artifactId: string;
1135
+ version?: number;
1136
+ } | {
1137
+ /**
1138
+ * Empty space the user reserved for the answer. The universal
1139
+ * "where": maths (`∫…dx = [slot]`), text (`H [slot] USE`), a
1140
+ * drawing ("the cat goes here"). Filling it removes it.
1141
+ */
1142
+ kind: "slot";
1143
+ x: number;
1144
+ y: number;
1145
+ w: number;
1146
+ h: number;
1147
+ /** What the user typed about what belongs here, if anything. */
1148
+ hint?: string;
1149
+ } | {
1150
+ kind: "erase";
1151
+ mode: "rect" | "path";
1152
+ x?: number;
1153
+ y?: number;
1154
+ w?: number;
1155
+ h?: number;
1156
+ points?: number[][];
1157
+ size?: number;
1158
+ });
1159
+ /**
1160
+ * What a cluster of the user's ink says, read once and kept.
1161
+ *
1162
+ * Keyed by the exact strokes it covers (see `readingKey`), so adding a
1163
+ * stroke to an expression changes its key and it reads as new -- which
1164
+ * it is: the meaning changed. A reading the user corrected outranks any
1165
+ * the agent produces later.
1166
+ */
1167
+ interface WbReading {
1168
+ text: string;
1169
+ source: "agent" | "user";
1170
+ strokeIds: string[];
1171
+ }
1172
+ interface WbDoc {
1173
+ version: 1;
1174
+ objects: WbObject[];
1175
+ /**
1176
+ * Transcriptions of the user's ink by cluster key. Optional so boards
1177
+ * saved before readings existed still load; absent means "none".
1178
+ */
1179
+ readings?: Record<string, WbReading>;
1180
+ /**
1181
+ * Highest event id folded in. The persistence layer replays only tool
1182
+ * calls newer than this after loading the saved document.
1183
+ */
1184
+ lastEventId: number;
1185
+ /**
1186
+ * Ids of the `whiteboard_draw` calls already applied.
1187
+ *
1188
+ * Kept explicitly rather than derived from the surviving objects'
1189
+ * origins: deleting an object would otherwise erase the only record
1190
+ * that its call had been consumed, and the next load would draw it
1191
+ * again. A deletion has to outlive the thing deleted.
1192
+ */
1193
+ folded: string[];
1194
+ }
1026
1195
 
1027
1196
  interface AgentChatAdapterContextValue {
1028
1197
  adapter: AgentChatAdapter;
@@ -1035,6 +1204,20 @@ interface AgentChatAdapterContextValue {
1035
1204
  declare const AgentChatAdapterProvider: react.Provider<AgentChatAdapterContextValue | null>;
1036
1205
  declare function useAgentChatAdapterContext(): AgentChatAdapterContextValue;
1037
1206
 
1207
+ /**
1208
+ * Record the Simple/Advanced preference the chat surface reads on mount.
1209
+ *
1210
+ * Exported for hosts that leave the chat surface entirely — the
1211
+ * standalone whiteboard route has no runtime to call `setViewMode` on,
1212
+ * so without this its Simple and Advanced buttons would both land on
1213
+ * whichever mode the chat page happened to be in last, and read as two
1214
+ * buttons doing the same thing.
1215
+ *
1216
+ * Takes only the two transcript modes on purpose: "whiteboard" is a
1217
+ * per-surface choice, not a stored preference, which is why
1218
+ * `readPersistedViewMode` ignores it too.
1219
+ */
1220
+ declare function persistChatViewMode(mode: "simple" | "expert"): void;
1038
1221
  declare function useChatViewMode(): "simple" | "expert";
1039
1222
  interface UseAgentChatRuntimeInput {
1040
1223
  adapter: AgentChatAdapter;
@@ -1451,4 +1634,4 @@ interface SessionTreePanelProps {
1451
1634
  }
1452
1635
  declare function SessionTreePanel({ adapter, sessionId, activeSessionId, agentId, title, sessionListLimit, hideRoot, hideHeader, loadList, onSessionSelect, onSessionDelete, }: SessionTreePanelProps): react_jsx_runtime.JSX.Element | null;
1453
1636
 
1454
- export { ACTIVE_MISSION_STATUSES, AgentChat, type AgentChatAdapter, type AgentChatAdapterContextValue, AgentChatAdapterProvider, type AgentChatArtifactKind, type AgentChatArtifactMeta, type AgentChatArtifactPayload, type AgentChatAskUserQuestionAnswer, type AgentChatAskUserQuestionArgs, type AgentChatAskUserQuestionChoice, type AgentChatAskUserQuestionQuestion, type AgentChatAttachment, type AgentChatBrowserProfile, type AgentChatChartArtifactSpec, type AgentChatDisplayAttachment, type AgentChatErrorCategory, type AgentChatErrorInfo, type AgentChatEventStream, type AgentChatEventType, type AgentChatEventsPage, type AgentChatExpertFeedbackRating, type AgentChatHtmlArtifactSpec, type AgentChatIdeaNode, type AgentChatImageAttachment, type AgentChatInboxEventStream, type AgentChatInboxItem, type AgentChatInboxKind, type AgentChatInboxList, type AgentChatInboxListInput, type AgentChatInboxStatus, type AgentChatInboxStreamEvent, type AgentChatMarkdownArtifactSpec, type AgentChatMessage, type AgentChatMessageStatus, type AgentChatMissionEvent, type AgentChatMissionEventSession, type AgentChatMissionEventsPage, type AgentChatMissionList, type AgentChatMissionResearch, type AgentChatMissionStatus, type AgentChatMissionSummary, type AgentChatMissionTask, type AgentChatMissionWorker, type AgentChatPendingAttachment, type AgentChatPolledEvent, type AgentChatProps, type AgentChatResearchRun, type AgentChatResearchSource, type AgentChatRole, type AgentChatRuntimeApi, type AgentChatRuntimeEvent, type AgentChatScheduledWorkItem, type AgentChatScheduledWorkKind, type AgentChatScheduledWorkList, type AgentChatSession, type AgentChatSessionList, type AgentChatSessionTree, type AgentChatSessionTreeNode, type AgentChatSlashCommand, type AgentChatSseMessageEvent, type AgentChatState, type AgentChatSvgArtifactSpec, type AgentChatSystemKind, type AgentChatTableArtifactSpec, type AgentChatTokenUsage, type AgentChatToolCallInfo, type AgentChatWorkspaceEntry, type AgentChatWorkspaceFile, type AgentChatWorkspaceTree, type AgentChatWorkspaceUpload, type ArtifactKind, type ArtifactPayload, type AskUserQuestionAnswer, type AskUserQuestionArgs, type AskUserQuestionChoice, type AskUserQuestionQuestion, type BorderBeamSize, BrandBeam, type BrandBeamProps, BrowserLiveView, type ChartArtifactSpec, type ChatComposerError, type ChatMessage, type CitationSegment, CitationText, type CodingAgentConnection, CodingAgentsPanel, type CodingAgentsPanelProps, ComposioConnectCard, type ComposioConnectCardProps, type ErrorInfo, FetchSseEventStream, type FetchSseEventStreamOptions, type HtmlArtifactSpec, type InboxItem, type InboxList, InboxPanel, type InboxPanelProps, type InboxUnreadCountState, IntegrationsBand, type IntegrationsBandProps, IntegrationsPage, type IntegrationsPageProps, MISSION_EVENT_CATEGORIES, type MarkdownArtifactSpec, MessageResponse, type MessageResponseProps, MissionDashboard, type MissionDashboardProps, type MissionEventCategory, type MissionEventsFeed, type MissionTaskBucket, type MissionTaskRailGroup, type MissionTaskRailGroupKey, MissionsPanel, type MissionsPanelProps, ORB_STATE_LABELS, type OrbActivity, type OrbDerivationOptions, OrbShimmerLabel, type OrbShimmerLabelProps, ResearchSourcesPanel, type RetryIndicator, SIMPLE_MODE_HIDDEN_TOOLS, SIMPLE_MODE_ORB_OPTIONS, type ScheduledWorkItem, type ScheduledWorkList, ScheduledWorkPanel, type ScheduledWorkPanelProps, type SessionTree, type SessionTreeNode, SessionTreePanel, type SessionTreePanelProps, type SvgArtifactSpec, type TableArtifactSpec, type TokenUsage, type ToolCallInfo, type WorkspaceEntry, type WorkspaceFile, type WorkspaceTree, type WorkspaceUpload, defaultSelectedMissionTaskId, deriveMissionWorkerActivityLabel, deriveOrbActivity, formatMissionTimestamp, groupMissionTasksByBucket, isHiddenSimpleTool, isTerminalMissionStatus, mergeMissionEvents, messageOrbState, missionEventActorLabel, missionEventCategory, missionEventSummary, missionEventTaskId, missionTaskBlocks, missionTaskBucket, missionTaskRailGroups, missionTaskStatusDotClass, missionTaskTitle, missionWorkerTaskCounts, splitCitations, stripMissionControlMarkup, toolOrbState, useAgentChatAdapterContext, useAgentChatRuntime, useChatViewMode, useInboxUnreadCount, useMissionEvents };
1637
+ export { ACTIVE_MISSION_STATUSES, AgentChat, type AgentChatAdapter, type AgentChatAdapterContextValue, AgentChatAdapterProvider, type AgentChatArtifactKind, type AgentChatArtifactMeta, type AgentChatArtifactPayload, type AgentChatAskUserQuestionAnswer, type AgentChatAskUserQuestionArgs, type AgentChatAskUserQuestionChoice, type AgentChatAskUserQuestionQuestion, type AgentChatAttachment, type AgentChatBrowserProfile, type AgentChatChartArtifactSpec, type AgentChatDisplayAttachment, type AgentChatErrorCategory, type AgentChatErrorInfo, type AgentChatEventStream, type AgentChatEventType, type AgentChatEventsPage, type AgentChatExpertFeedbackRating, type AgentChatHtmlArtifactSpec, type AgentChatIdeaNode, type AgentChatImageAttachment, type AgentChatInboxEventStream, type AgentChatInboxItem, type AgentChatInboxKind, type AgentChatInboxList, type AgentChatInboxListInput, type AgentChatInboxStatus, type AgentChatInboxStreamEvent, type AgentChatMarkdownArtifactSpec, type AgentChatMessage, type AgentChatMessageStatus, type AgentChatMissionEvent, type AgentChatMissionEventSession, type AgentChatMissionEventsPage, type AgentChatMissionList, type AgentChatMissionResearch, type AgentChatMissionStatus, type AgentChatMissionSummary, type AgentChatMissionTask, type AgentChatMissionWorker, type AgentChatPendingAttachment, type AgentChatPolledEvent, type AgentChatProps, type AgentChatResearchRun, type AgentChatResearchSource, type AgentChatRole, type AgentChatRuntimeApi, type AgentChatRuntimeEvent, type AgentChatScheduledWorkItem, type AgentChatScheduledWorkKind, type AgentChatScheduledWorkList, type AgentChatSession, type AgentChatSessionList, type AgentChatSessionTree, type AgentChatSessionTreeNode, type AgentChatSlashCommand, type AgentChatSseMessageEvent, type AgentChatState, type AgentChatSvgArtifactSpec, type AgentChatSystemKind, type AgentChatTableArtifactSpec, type AgentChatTokenUsage, type AgentChatToolCallInfo, type AgentChatWorkspaceEntry, type AgentChatWorkspaceFile, type AgentChatWorkspaceTree, type AgentChatWorkspaceUpload, AgentWhiteboard, type AgentWhiteboardProps, type ArtifactKind, type ArtifactPayload, type AskUserQuestionAnswer, type AskUserQuestionArgs, type AskUserQuestionChoice, type AskUserQuestionQuestion, type BorderBeamSize, BrandBeam, type BrandBeamProps, BrowserLiveView, type ChartArtifactSpec, type ChatComposerError, type ChatMessage, type CitationSegment, CitationText, type CodingAgentConnection, CodingAgentsPanel, type CodingAgentsPanelProps, ComposioConnectCard, type ComposioConnectCardProps, type ErrorInfo, FetchSseEventStream, type FetchSseEventStreamOptions, type HtmlArtifactSpec, type InboxItem, type InboxList, InboxPanel, type InboxPanelProps, type InboxUnreadCountState, IntegrationsBand, type IntegrationsBandProps, IntegrationsPage, type IntegrationsPageProps, MISSION_EVENT_CATEGORIES, type MarkdownArtifactSpec, MessageResponse, type MessageResponseProps, MissionDashboard, type MissionDashboardProps, type MissionEventCategory, type MissionEventsFeed, type MissionTaskBucket, type MissionTaskRailGroup, type MissionTaskRailGroupKey, MissionsPanel, type MissionsPanelProps, ORB_STATE_LABELS, type OrbActivity, type OrbDerivationOptions, OrbShimmerLabel, type OrbShimmerLabelProps, ResearchSourcesPanel, type RetryIndicator, SIMPLE_MODE_HIDDEN_TOOLS, SIMPLE_MODE_ORB_OPTIONS, type ScheduledWorkItem, type ScheduledWorkList, ScheduledWorkPanel, type ScheduledWorkPanelProps, type SessionTree, type SessionTreeNode, SessionTreePanel, type SessionTreePanelProps, type SvgArtifactSpec, type TableArtifactSpec, type TokenUsage, type ToolCallInfo, type WbDoc, type WbObject, type WbTool, WhiteboardSurface, type WhiteboardSurfaceProps, type WorkspaceEntry, type WorkspaceFile, type WorkspaceTree, type WorkspaceUpload, defaultSelectedMissionTaskId, deriveMissionWorkerActivityLabel, deriveOrbActivity, formatMissionTimestamp, groupMissionTasksByBucket, isHiddenSimpleTool, isTerminalMissionStatus, mergeMissionEvents, messageOrbState, missionEventActorLabel, missionEventCategory, missionEventSummary, missionEventTaskId, missionTaskBlocks, missionTaskBucket, missionTaskRailGroups, missionTaskStatusDotClass, missionTaskTitle, missionWorkerTaskCounts, persistChatViewMode, splitCitations, stripMissionControlMarkup, toolOrbState, useAgentChatAdapterContext, useAgentChatRuntime, useChatViewMode, useInboxUnreadCount, useMissionEvents };
package/dist/index.d.ts CHANGED
@@ -66,6 +66,13 @@ interface AgentChatMessage {
66
66
  errorInfo?: AgentChatErrorInfo;
67
67
  images?: AgentChatImageAttachment[];
68
68
  attachments?: AgentChatDisplayAttachment[];
69
+ /**
70
+ * The per-turn metadata the user message was sent with, as stored on
71
+ * its event. The whiteboard resolves relational anchors ("latest",
72
+ * "selection") from the `whiteboard` block at fold time, so it must
73
+ * survive replay from the event log, not just the live send.
74
+ */
75
+ metadata?: Record<string, unknown>;
69
76
  llmResponseEventId?: number;
70
77
  userFeedback?: {
71
78
  rating: "up" | "down";
@@ -458,7 +465,15 @@ interface AgentChatState {
458
465
  * results. Deduped by sourceId on insertion. */
459
466
  researchSources: AgentChatResearchSource[];
460
467
  }
461
- type AgentChatViewMode = "simple" | "expert";
468
+ /**
469
+ * How the conversation is shown.
470
+ *
471
+ * `whiteboard` is a *view* of the same session, not a different kind of
472
+ * session: the agent gets the draw tool on any turn sent from the
473
+ * canvas, so switching here never leaves you on a board the agent
474
+ * cannot draw on.
475
+ */
476
+ type AgentChatViewMode = "simple" | "expert" | "whiteboard";
462
477
  type AgentChatArtifactKind = "markdown" | "table" | "chart" | "html" | "svg" | "image" | "video";
463
478
  interface AgentChatArtifactMeta {
464
479
  artifact_id: string;
@@ -901,7 +916,9 @@ interface AgentChatRuntimeApi {
901
916
  tokenUsage: AgentChatTokenUsage;
902
917
  retryIndicator: AgentChatRetryIndicator | null;
903
918
  workspaceRefreshKey: number;
904
- send(content: string, images?: AgentChatImageAttachment[], attachments?: AgentChatPendingAttachment[]): Promise<void>;
919
+ send(content: string, images?: AgentChatImageAttachment[], attachments?: AgentChatPendingAttachment[],
920
+ /** Free-form per-turn metadata, forwarded verbatim to the adapter. */
921
+ metadata?: Record<string, unknown>): Promise<void>;
905
922
  stop(): Promise<void>;
906
923
  retry(): Promise<void>;
907
924
  markSending(content: string): void;
@@ -998,6 +1015,14 @@ interface AgentChatProps {
998
1015
  * Like `deepResearchEnabled`, the host owns the capability gate.
999
1016
  */
1000
1017
  codeAgentsEnabled?: boolean;
1018
+ /**
1019
+ * Whether this agent may draw on a canvas.
1020
+ *
1021
+ * One half of the gate on the composer's Whiteboard segment; the other
1022
+ * is the session having been created as a board. Like
1023
+ * `deepResearchEnabled`, the host owns this half.
1024
+ */
1025
+ whiteboardEnabled?: boolean;
1001
1026
  /**
1002
1027
  * Slash-command capability group (per-agent). These gate the always-on
1003
1028
  * lightweight builtins and default to shown when omitted, so a host that
@@ -1022,7 +1047,151 @@ interface AgentChatProps {
1022
1047
  */
1023
1048
  onOpenBilling?: () => void;
1024
1049
  }
1025
- declare function AgentChat({ adapter, agentId, sessionId, onSessionChange, onFileSelect, onMessagesChange, disabled, onComposerError, browserProfileId, onSelectBrowserProfile, browserProfilesEnabled, deepResearchEnabled, researchEnabled, codeAgentsEnabled, loopsEnabled, missionsEnabled, goalsEnabled, compressEnabled, onOpenIntegrations, onOpenBilling, }: AgentChatProps): react_jsx_runtime.JSX.Element;
1050
+ declare function AgentChat({ adapter, agentId, sessionId, onSessionChange, onFileSelect, onMessagesChange, disabled, onComposerError, browserProfileId, onSelectBrowserProfile, browserProfilesEnabled, deepResearchEnabled, researchEnabled, codeAgentsEnabled, whiteboardEnabled, loopsEnabled, missionsEnabled, goalsEnabled, compressEnabled, onOpenIntegrations, onOpenBilling, }: AgentChatProps): react_jsx_runtime.JSX.Element;
1051
+
1052
+ type WbTool = "pen" | "eraser" | "text" | "slot" | "select" | "pan";
1053
+
1054
+ interface AgentWhiteboardProps {
1055
+ adapter: AgentChatAdapter;
1056
+ agentId?: string;
1057
+ sessionId: string | null;
1058
+ onSessionChange?: (sessionId: string) => void;
1059
+ /**
1060
+ * Navigate to a session-less board. Without it "New board" cannot
1061
+ * clear the session id, which only the host's router owns.
1062
+ */
1063
+ onNewBoard?: () => void;
1064
+ disabled?: boolean;
1065
+ /**
1066
+ * View-mode switch, when the board is hosted inside `AgentChat`. The
1067
+ * control lives in the chat composer, so without it here the board is
1068
+ * a room with no door back.
1069
+ */
1070
+ viewMode?: AgentChatViewMode;
1071
+ onViewModeChange?: (mode: AgentChatViewMode) => void;
1072
+ }
1073
+ /**
1074
+ * The board over an existing runtime.
1075
+ *
1076
+ * Split from the standalone export so `AgentChat` can host it on the
1077
+ * runtime it already has: two `useAgentChatRuntime` calls for one
1078
+ * session would open two event streams and double every applied event.
1079
+ */
1080
+ interface WhiteboardSurfaceProps extends Omit<AgentWhiteboardProps, "adapter" | "agentId"> {
1081
+ adapter: AgentChatAdapter;
1082
+ agentId?: string;
1083
+ runtime: AgentChatRuntimeApi;
1084
+ }
1085
+ /** The board, standalone: owns its runtime. */
1086
+ declare function AgentWhiteboard(props: AgentWhiteboardProps): react_jsx_runtime.JSX.Element;
1087
+ declare function WhiteboardSurface({ adapter, agentId, sessionId, onSessionChange, onNewBoard, disabled, viewMode, onViewModeChange, runtime, }: WhiteboardSurfaceProps): react_jsx_runtime.JSX.Element;
1088
+
1089
+ interface WbBase {
1090
+ id: string;
1091
+ /**
1092
+ * Source tool-call id, or "local" for the user's own edits. Folding is
1093
+ * keyed on this so a re-delivered event cannot duplicate objects: the
1094
+ * SSE stream and the reconciliation poll both replay the same calls.
1095
+ */
1096
+ origin: string;
1097
+ selected: boolean;
1098
+ }
1099
+ type WbObject = WbBase & ({
1100
+ kind: "ink";
1101
+ pts: number[];
1102
+ width: number;
1103
+ color: string;
1104
+ } | {
1105
+ kind: "draw";
1106
+ origin_: [number, number];
1107
+ types: string[];
1108
+ items: number[][];
1109
+ width?: number;
1110
+ tension?: number;
1111
+ closed?: number[];
1112
+ fill?: number[];
1113
+ arrows?: number[];
1114
+ } | {
1115
+ kind: "text";
1116
+ x: number;
1117
+ y: number;
1118
+ text: string;
1119
+ fontSize: number;
1120
+ maxWidth: number;
1121
+ lineHeight: number;
1122
+ } | {
1123
+ kind: "formula";
1124
+ x: number;
1125
+ y: number;
1126
+ latex: string;
1127
+ fontSize: number;
1128
+ } | {
1129
+ kind: "artifact";
1130
+ x: number;
1131
+ y: number;
1132
+ w: number;
1133
+ h: number;
1134
+ artifactId: string;
1135
+ version?: number;
1136
+ } | {
1137
+ /**
1138
+ * Empty space the user reserved for the answer. The universal
1139
+ * "where": maths (`∫…dx = [slot]`), text (`H [slot] USE`), a
1140
+ * drawing ("the cat goes here"). Filling it removes it.
1141
+ */
1142
+ kind: "slot";
1143
+ x: number;
1144
+ y: number;
1145
+ w: number;
1146
+ h: number;
1147
+ /** What the user typed about what belongs here, if anything. */
1148
+ hint?: string;
1149
+ } | {
1150
+ kind: "erase";
1151
+ mode: "rect" | "path";
1152
+ x?: number;
1153
+ y?: number;
1154
+ w?: number;
1155
+ h?: number;
1156
+ points?: number[][];
1157
+ size?: number;
1158
+ });
1159
+ /**
1160
+ * What a cluster of the user's ink says, read once and kept.
1161
+ *
1162
+ * Keyed by the exact strokes it covers (see `readingKey`), so adding a
1163
+ * stroke to an expression changes its key and it reads as new -- which
1164
+ * it is: the meaning changed. A reading the user corrected outranks any
1165
+ * the agent produces later.
1166
+ */
1167
+ interface WbReading {
1168
+ text: string;
1169
+ source: "agent" | "user";
1170
+ strokeIds: string[];
1171
+ }
1172
+ interface WbDoc {
1173
+ version: 1;
1174
+ objects: WbObject[];
1175
+ /**
1176
+ * Transcriptions of the user's ink by cluster key. Optional so boards
1177
+ * saved before readings existed still load; absent means "none".
1178
+ */
1179
+ readings?: Record<string, WbReading>;
1180
+ /**
1181
+ * Highest event id folded in. The persistence layer replays only tool
1182
+ * calls newer than this after loading the saved document.
1183
+ */
1184
+ lastEventId: number;
1185
+ /**
1186
+ * Ids of the `whiteboard_draw` calls already applied.
1187
+ *
1188
+ * Kept explicitly rather than derived from the surviving objects'
1189
+ * origins: deleting an object would otherwise erase the only record
1190
+ * that its call had been consumed, and the next load would draw it
1191
+ * again. A deletion has to outlive the thing deleted.
1192
+ */
1193
+ folded: string[];
1194
+ }
1026
1195
 
1027
1196
  interface AgentChatAdapterContextValue {
1028
1197
  adapter: AgentChatAdapter;
@@ -1035,6 +1204,20 @@ interface AgentChatAdapterContextValue {
1035
1204
  declare const AgentChatAdapterProvider: react.Provider<AgentChatAdapterContextValue | null>;
1036
1205
  declare function useAgentChatAdapterContext(): AgentChatAdapterContextValue;
1037
1206
 
1207
+ /**
1208
+ * Record the Simple/Advanced preference the chat surface reads on mount.
1209
+ *
1210
+ * Exported for hosts that leave the chat surface entirely — the
1211
+ * standalone whiteboard route has no runtime to call `setViewMode` on,
1212
+ * so without this its Simple and Advanced buttons would both land on
1213
+ * whichever mode the chat page happened to be in last, and read as two
1214
+ * buttons doing the same thing.
1215
+ *
1216
+ * Takes only the two transcript modes on purpose: "whiteboard" is a
1217
+ * per-surface choice, not a stored preference, which is why
1218
+ * `readPersistedViewMode` ignores it too.
1219
+ */
1220
+ declare function persistChatViewMode(mode: "simple" | "expert"): void;
1038
1221
  declare function useChatViewMode(): "simple" | "expert";
1039
1222
  interface UseAgentChatRuntimeInput {
1040
1223
  adapter: AgentChatAdapter;
@@ -1451,4 +1634,4 @@ interface SessionTreePanelProps {
1451
1634
  }
1452
1635
  declare function SessionTreePanel({ adapter, sessionId, activeSessionId, agentId, title, sessionListLimit, hideRoot, hideHeader, loadList, onSessionSelect, onSessionDelete, }: SessionTreePanelProps): react_jsx_runtime.JSX.Element | null;
1453
1636
 
1454
- export { ACTIVE_MISSION_STATUSES, AgentChat, type AgentChatAdapter, type AgentChatAdapterContextValue, AgentChatAdapterProvider, type AgentChatArtifactKind, type AgentChatArtifactMeta, type AgentChatArtifactPayload, type AgentChatAskUserQuestionAnswer, type AgentChatAskUserQuestionArgs, type AgentChatAskUserQuestionChoice, type AgentChatAskUserQuestionQuestion, type AgentChatAttachment, type AgentChatBrowserProfile, type AgentChatChartArtifactSpec, type AgentChatDisplayAttachment, type AgentChatErrorCategory, type AgentChatErrorInfo, type AgentChatEventStream, type AgentChatEventType, type AgentChatEventsPage, type AgentChatExpertFeedbackRating, type AgentChatHtmlArtifactSpec, type AgentChatIdeaNode, type AgentChatImageAttachment, type AgentChatInboxEventStream, type AgentChatInboxItem, type AgentChatInboxKind, type AgentChatInboxList, type AgentChatInboxListInput, type AgentChatInboxStatus, type AgentChatInboxStreamEvent, type AgentChatMarkdownArtifactSpec, type AgentChatMessage, type AgentChatMessageStatus, type AgentChatMissionEvent, type AgentChatMissionEventSession, type AgentChatMissionEventsPage, type AgentChatMissionList, type AgentChatMissionResearch, type AgentChatMissionStatus, type AgentChatMissionSummary, type AgentChatMissionTask, type AgentChatMissionWorker, type AgentChatPendingAttachment, type AgentChatPolledEvent, type AgentChatProps, type AgentChatResearchRun, type AgentChatResearchSource, type AgentChatRole, type AgentChatRuntimeApi, type AgentChatRuntimeEvent, type AgentChatScheduledWorkItem, type AgentChatScheduledWorkKind, type AgentChatScheduledWorkList, type AgentChatSession, type AgentChatSessionList, type AgentChatSessionTree, type AgentChatSessionTreeNode, type AgentChatSlashCommand, type AgentChatSseMessageEvent, type AgentChatState, type AgentChatSvgArtifactSpec, type AgentChatSystemKind, type AgentChatTableArtifactSpec, type AgentChatTokenUsage, type AgentChatToolCallInfo, type AgentChatWorkspaceEntry, type AgentChatWorkspaceFile, type AgentChatWorkspaceTree, type AgentChatWorkspaceUpload, type ArtifactKind, type ArtifactPayload, type AskUserQuestionAnswer, type AskUserQuestionArgs, type AskUserQuestionChoice, type AskUserQuestionQuestion, type BorderBeamSize, BrandBeam, type BrandBeamProps, BrowserLiveView, type ChartArtifactSpec, type ChatComposerError, type ChatMessage, type CitationSegment, CitationText, type CodingAgentConnection, CodingAgentsPanel, type CodingAgentsPanelProps, ComposioConnectCard, type ComposioConnectCardProps, type ErrorInfo, FetchSseEventStream, type FetchSseEventStreamOptions, type HtmlArtifactSpec, type InboxItem, type InboxList, InboxPanel, type InboxPanelProps, type InboxUnreadCountState, IntegrationsBand, type IntegrationsBandProps, IntegrationsPage, type IntegrationsPageProps, MISSION_EVENT_CATEGORIES, type MarkdownArtifactSpec, MessageResponse, type MessageResponseProps, MissionDashboard, type MissionDashboardProps, type MissionEventCategory, type MissionEventsFeed, type MissionTaskBucket, type MissionTaskRailGroup, type MissionTaskRailGroupKey, MissionsPanel, type MissionsPanelProps, ORB_STATE_LABELS, type OrbActivity, type OrbDerivationOptions, OrbShimmerLabel, type OrbShimmerLabelProps, ResearchSourcesPanel, type RetryIndicator, SIMPLE_MODE_HIDDEN_TOOLS, SIMPLE_MODE_ORB_OPTIONS, type ScheduledWorkItem, type ScheduledWorkList, ScheduledWorkPanel, type ScheduledWorkPanelProps, type SessionTree, type SessionTreeNode, SessionTreePanel, type SessionTreePanelProps, type SvgArtifactSpec, type TableArtifactSpec, type TokenUsage, type ToolCallInfo, type WorkspaceEntry, type WorkspaceFile, type WorkspaceTree, type WorkspaceUpload, defaultSelectedMissionTaskId, deriveMissionWorkerActivityLabel, deriveOrbActivity, formatMissionTimestamp, groupMissionTasksByBucket, isHiddenSimpleTool, isTerminalMissionStatus, mergeMissionEvents, messageOrbState, missionEventActorLabel, missionEventCategory, missionEventSummary, missionEventTaskId, missionTaskBlocks, missionTaskBucket, missionTaskRailGroups, missionTaskStatusDotClass, missionTaskTitle, missionWorkerTaskCounts, splitCitations, stripMissionControlMarkup, toolOrbState, useAgentChatAdapterContext, useAgentChatRuntime, useChatViewMode, useInboxUnreadCount, useMissionEvents };
1637
+ export { ACTIVE_MISSION_STATUSES, AgentChat, type AgentChatAdapter, type AgentChatAdapterContextValue, AgentChatAdapterProvider, type AgentChatArtifactKind, type AgentChatArtifactMeta, type AgentChatArtifactPayload, type AgentChatAskUserQuestionAnswer, type AgentChatAskUserQuestionArgs, type AgentChatAskUserQuestionChoice, type AgentChatAskUserQuestionQuestion, type AgentChatAttachment, type AgentChatBrowserProfile, type AgentChatChartArtifactSpec, type AgentChatDisplayAttachment, type AgentChatErrorCategory, type AgentChatErrorInfo, type AgentChatEventStream, type AgentChatEventType, type AgentChatEventsPage, type AgentChatExpertFeedbackRating, type AgentChatHtmlArtifactSpec, type AgentChatIdeaNode, type AgentChatImageAttachment, type AgentChatInboxEventStream, type AgentChatInboxItem, type AgentChatInboxKind, type AgentChatInboxList, type AgentChatInboxListInput, type AgentChatInboxStatus, type AgentChatInboxStreamEvent, type AgentChatMarkdownArtifactSpec, type AgentChatMessage, type AgentChatMessageStatus, type AgentChatMissionEvent, type AgentChatMissionEventSession, type AgentChatMissionEventsPage, type AgentChatMissionList, type AgentChatMissionResearch, type AgentChatMissionStatus, type AgentChatMissionSummary, type AgentChatMissionTask, type AgentChatMissionWorker, type AgentChatPendingAttachment, type AgentChatPolledEvent, type AgentChatProps, type AgentChatResearchRun, type AgentChatResearchSource, type AgentChatRole, type AgentChatRuntimeApi, type AgentChatRuntimeEvent, type AgentChatScheduledWorkItem, type AgentChatScheduledWorkKind, type AgentChatScheduledWorkList, type AgentChatSession, type AgentChatSessionList, type AgentChatSessionTree, type AgentChatSessionTreeNode, type AgentChatSlashCommand, type AgentChatSseMessageEvent, type AgentChatState, type AgentChatSvgArtifactSpec, type AgentChatSystemKind, type AgentChatTableArtifactSpec, type AgentChatTokenUsage, type AgentChatToolCallInfo, type AgentChatWorkspaceEntry, type AgentChatWorkspaceFile, type AgentChatWorkspaceTree, type AgentChatWorkspaceUpload, AgentWhiteboard, type AgentWhiteboardProps, type ArtifactKind, type ArtifactPayload, type AskUserQuestionAnswer, type AskUserQuestionArgs, type AskUserQuestionChoice, type AskUserQuestionQuestion, type BorderBeamSize, BrandBeam, type BrandBeamProps, BrowserLiveView, type ChartArtifactSpec, type ChatComposerError, type ChatMessage, type CitationSegment, CitationText, type CodingAgentConnection, CodingAgentsPanel, type CodingAgentsPanelProps, ComposioConnectCard, type ComposioConnectCardProps, type ErrorInfo, FetchSseEventStream, type FetchSseEventStreamOptions, type HtmlArtifactSpec, type InboxItem, type InboxList, InboxPanel, type InboxPanelProps, type InboxUnreadCountState, IntegrationsBand, type IntegrationsBandProps, IntegrationsPage, type IntegrationsPageProps, MISSION_EVENT_CATEGORIES, type MarkdownArtifactSpec, MessageResponse, type MessageResponseProps, MissionDashboard, type MissionDashboardProps, type MissionEventCategory, type MissionEventsFeed, type MissionTaskBucket, type MissionTaskRailGroup, type MissionTaskRailGroupKey, MissionsPanel, type MissionsPanelProps, ORB_STATE_LABELS, type OrbActivity, type OrbDerivationOptions, OrbShimmerLabel, type OrbShimmerLabelProps, ResearchSourcesPanel, type RetryIndicator, SIMPLE_MODE_HIDDEN_TOOLS, SIMPLE_MODE_ORB_OPTIONS, type ScheduledWorkItem, type ScheduledWorkList, ScheduledWorkPanel, type ScheduledWorkPanelProps, type SessionTree, type SessionTreeNode, SessionTreePanel, type SessionTreePanelProps, type SvgArtifactSpec, type TableArtifactSpec, type TokenUsage, type ToolCallInfo, type WbDoc, type WbObject, type WbTool, WhiteboardSurface, type WhiteboardSurfaceProps, type WorkspaceEntry, type WorkspaceFile, type WorkspaceTree, type WorkspaceUpload, defaultSelectedMissionTaskId, deriveMissionWorkerActivityLabel, deriveOrbActivity, formatMissionTimestamp, groupMissionTasksByBucket, isHiddenSimpleTool, isTerminalMissionStatus, mergeMissionEvents, messageOrbState, missionEventActorLabel, missionEventCategory, missionEventSummary, missionEventTaskId, missionTaskBlocks, missionTaskBucket, missionTaskRailGroups, missionTaskStatusDotClass, missionTaskTitle, missionWorkerTaskCounts, persistChatViewMode, splitCitations, stripMissionControlMarkup, toolOrbState, useAgentChatAdapterContext, useAgentChatRuntime, useChatViewMode, useInboxUnreadCount, useMissionEvents };