@invergent/agent-chat-react 2.1.4 → 2.1.6

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
@@ -735,6 +735,7 @@ interface AgentChatAdapterContextValue {
735
735
  declare const AgentChatAdapterProvider: React.Provider<AgentChatAdapterContextValue | null>;
736
736
  declare function useAgentChatAdapterContext(): AgentChatAdapterContextValue;
737
737
 
738
+ declare function useChatViewMode(): "simple" | "expert";
738
739
  interface UseAgentChatRuntimeInput {
739
740
  adapter: AgentChatAdapter;
740
741
  agentId?: string;
@@ -846,4 +847,4 @@ interface SessionTreePanelProps {
846
847
  }
847
848
  declare function SessionTreePanel({ adapter, sessionId, activeSessionId, agentId, title, sessionListLimit, hideRoot, hideHeader, loadList, onSessionSelect, onSessionDelete, }: SessionTreePanelProps): react_jsx_runtime.JSX.Element | null;
848
849
 
849
- 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 AgentChatChartArtifactSpec, type AgentChatDisplayAttachment, type AgentChatErrorCategory, type AgentChatErrorInfo, type AgentChatEventStream, type AgentChatEventType, type AgentChatExpertFeedbackRating, type AgentChatHtmlArtifactSpec, type AgentChatImageAttachment, type AgentChatInboxEventStream, type AgentChatInboxItem, type AgentChatInboxKind, type AgentChatInboxList, type AgentChatInboxListInput, type AgentChatInboxStatus, type AgentChatInboxStreamEvent, type AgentChatMarkdownArtifactSpec, type AgentChatMessage, type AgentChatMessageStatus, type AgentChatMissionList, type AgentChatMissionStatus, type AgentChatMissionSummary, type AgentChatMissionTask, type AgentChatMissionWorker, type AgentChatPendingAttachment, type AgentChatProps, 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 ChartArtifactSpec, type ChatComposerError, type ChatMessage, type ErrorInfo, type HtmlArtifactSpec, type InboxItem, type InboxList, InboxPanel, type InboxPanelProps, type InboxUnreadCountState, type MarkdownArtifactSpec, MessageResponse, type MessageResponseProps, MissionDashboard, type MissionDashboardProps, type MissionTaskBucket, MissionsPanel, type MissionsPanelProps, type RetryIndicator, 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, deriveMissionWorkerActivityLabel, groupMissionTasksByBucket, isTerminalMissionStatus, missionTaskBucket, useAgentChatAdapterContext, useAgentChatRuntime, useInboxUnreadCount };
850
+ 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 AgentChatChartArtifactSpec, type AgentChatDisplayAttachment, type AgentChatErrorCategory, type AgentChatErrorInfo, type AgentChatEventStream, type AgentChatEventType, type AgentChatExpertFeedbackRating, type AgentChatHtmlArtifactSpec, type AgentChatImageAttachment, type AgentChatInboxEventStream, type AgentChatInboxItem, type AgentChatInboxKind, type AgentChatInboxList, type AgentChatInboxListInput, type AgentChatInboxStatus, type AgentChatInboxStreamEvent, type AgentChatMarkdownArtifactSpec, type AgentChatMessage, type AgentChatMessageStatus, type AgentChatMissionList, type AgentChatMissionStatus, type AgentChatMissionSummary, type AgentChatMissionTask, type AgentChatMissionWorker, type AgentChatPendingAttachment, type AgentChatProps, 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 ChartArtifactSpec, type ChatComposerError, type ChatMessage, type ErrorInfo, type HtmlArtifactSpec, type InboxItem, type InboxList, InboxPanel, type InboxPanelProps, type InboxUnreadCountState, type MarkdownArtifactSpec, MessageResponse, type MessageResponseProps, MissionDashboard, type MissionDashboardProps, type MissionTaskBucket, MissionsPanel, type MissionsPanelProps, type RetryIndicator, 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, deriveMissionWorkerActivityLabel, groupMissionTasksByBucket, isTerminalMissionStatus, missionTaskBucket, useAgentChatAdapterContext, useAgentChatRuntime, useChatViewMode, useInboxUnreadCount };
package/dist/index.d.ts CHANGED
@@ -735,6 +735,7 @@ interface AgentChatAdapterContextValue {
735
735
  declare const AgentChatAdapterProvider: React.Provider<AgentChatAdapterContextValue | null>;
736
736
  declare function useAgentChatAdapterContext(): AgentChatAdapterContextValue;
737
737
 
738
+ declare function useChatViewMode(): "simple" | "expert";
738
739
  interface UseAgentChatRuntimeInput {
739
740
  adapter: AgentChatAdapter;
740
741
  agentId?: string;
@@ -846,4 +847,4 @@ interface SessionTreePanelProps {
846
847
  }
847
848
  declare function SessionTreePanel({ adapter, sessionId, activeSessionId, agentId, title, sessionListLimit, hideRoot, hideHeader, loadList, onSessionSelect, onSessionDelete, }: SessionTreePanelProps): react_jsx_runtime.JSX.Element | null;
848
849
 
849
- 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 AgentChatChartArtifactSpec, type AgentChatDisplayAttachment, type AgentChatErrorCategory, type AgentChatErrorInfo, type AgentChatEventStream, type AgentChatEventType, type AgentChatExpertFeedbackRating, type AgentChatHtmlArtifactSpec, type AgentChatImageAttachment, type AgentChatInboxEventStream, type AgentChatInboxItem, type AgentChatInboxKind, type AgentChatInboxList, type AgentChatInboxListInput, type AgentChatInboxStatus, type AgentChatInboxStreamEvent, type AgentChatMarkdownArtifactSpec, type AgentChatMessage, type AgentChatMessageStatus, type AgentChatMissionList, type AgentChatMissionStatus, type AgentChatMissionSummary, type AgentChatMissionTask, type AgentChatMissionWorker, type AgentChatPendingAttachment, type AgentChatProps, 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 ChartArtifactSpec, type ChatComposerError, type ChatMessage, type ErrorInfo, type HtmlArtifactSpec, type InboxItem, type InboxList, InboxPanel, type InboxPanelProps, type InboxUnreadCountState, type MarkdownArtifactSpec, MessageResponse, type MessageResponseProps, MissionDashboard, type MissionDashboardProps, type MissionTaskBucket, MissionsPanel, type MissionsPanelProps, type RetryIndicator, 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, deriveMissionWorkerActivityLabel, groupMissionTasksByBucket, isTerminalMissionStatus, missionTaskBucket, useAgentChatAdapterContext, useAgentChatRuntime, useInboxUnreadCount };
850
+ 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 AgentChatChartArtifactSpec, type AgentChatDisplayAttachment, type AgentChatErrorCategory, type AgentChatErrorInfo, type AgentChatEventStream, type AgentChatEventType, type AgentChatExpertFeedbackRating, type AgentChatHtmlArtifactSpec, type AgentChatImageAttachment, type AgentChatInboxEventStream, type AgentChatInboxItem, type AgentChatInboxKind, type AgentChatInboxList, type AgentChatInboxListInput, type AgentChatInboxStatus, type AgentChatInboxStreamEvent, type AgentChatMarkdownArtifactSpec, type AgentChatMessage, type AgentChatMessageStatus, type AgentChatMissionList, type AgentChatMissionStatus, type AgentChatMissionSummary, type AgentChatMissionTask, type AgentChatMissionWorker, type AgentChatPendingAttachment, type AgentChatProps, 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 ChartArtifactSpec, type ChatComposerError, type ChatMessage, type ErrorInfo, type HtmlArtifactSpec, type InboxItem, type InboxList, InboxPanel, type InboxPanelProps, type InboxUnreadCountState, type MarkdownArtifactSpec, MessageResponse, type MessageResponseProps, MissionDashboard, type MissionDashboardProps, type MissionTaskBucket, MissionsPanel, type MissionsPanelProps, type RetryIndicator, 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, deriveMissionWorkerActivityLabel, groupMissionTasksByBucket, isTerminalMissionStatus, missionTaskBucket, useAgentChatAdapterContext, useAgentChatRuntime, useChatViewMode, useInboxUnreadCount };
package/dist/index.js CHANGED
@@ -686,7 +686,7 @@ var ConversationEmptyState = ({
686
686
  icon && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center size-14 rounded-2xl bg-muted/60 text-muted-foreground/60", children: icon }),
687
687
  /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
688
688
  /* @__PURE__ */ jsx("h3", { className: "font-semibold text-base text-foreground/80", children: title }),
689
- description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground/60 text-sm max-w-sm", children: description })
689
+ description && /* @__PURE__ */ jsx("p", { className: "text-foreground/60 text-sm max-w-sm", children: description })
690
690
  ] })
691
691
  ] })
692
692
  }
@@ -6111,36 +6111,6 @@ function ChatComposerInner({
6111
6111
  }
6112
6112
  )
6113
6113
  ] }),
6114
- onViewModeChange && /* @__PURE__ */ jsxs(
6115
- "div",
6116
- {
6117
- role: "group",
6118
- "aria-label": "Chat view mode",
6119
- className: "inline-flex overflow-hidden rounded-md border border-border",
6120
- children: [
6121
- /* @__PURE__ */ jsx(
6122
- "button",
6123
- {
6124
- type: "button",
6125
- "aria-pressed": viewMode === "simple",
6126
- onClick: () => onViewModeChange("simple"),
6127
- className: viewMode === "simple" ? "bg-accent px-2 py-1 text-xs text-foreground" : "px-2 py-1 text-xs text-muted-foreground hover:text-foreground",
6128
- children: "Simple"
6129
- }
6130
- ),
6131
- /* @__PURE__ */ jsx(
6132
- "button",
6133
- {
6134
- type: "button",
6135
- "aria-pressed": viewMode === "expert",
6136
- onClick: () => onViewModeChange("expert"),
6137
- className: viewMode === "expert" ? "bg-accent px-2 py-1 text-xs text-foreground" : "px-2 py-1 text-xs text-muted-foreground hover:text-foreground",
6138
- children: "Expert"
6139
- }
6140
- )
6141
- ]
6142
- }
6143
- ),
6144
6114
  canShowBrowser && onToggleBrowser && /* @__PURE__ */ jsx(
6145
6115
  PromptInputButton,
6146
6116
  {
@@ -6220,7 +6190,46 @@ function ChatComposerInner({
6220
6190
  }
6221
6191
  )
6222
6192
  ] }),
6223
- /* @__PURE__ */ jsx(PromptInputSubmit, { status, onStop })
6193
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6194
+ onViewModeChange && /* @__PURE__ */ jsxs(
6195
+ "div",
6196
+ {
6197
+ role: "group",
6198
+ "aria-label": "Chat view mode",
6199
+ className: "inline-flex overflow-hidden rounded-md border border-border",
6200
+ children: [
6201
+ /* @__PURE__ */ jsx(
6202
+ "button",
6203
+ {
6204
+ type: "button",
6205
+ "aria-pressed": viewMode === "simple",
6206
+ onClick: () => onViewModeChange("simple"),
6207
+ className: viewMode === "simple" ? "bg-accent px-2 py-1 text-xs text-foreground" : "px-2 py-1 text-xs text-muted-foreground hover:text-foreground",
6208
+ children: "Simple"
6209
+ }
6210
+ ),
6211
+ /* @__PURE__ */ jsx(
6212
+ "button",
6213
+ {
6214
+ type: "button",
6215
+ "aria-pressed": viewMode === "expert",
6216
+ onClick: () => onViewModeChange("expert"),
6217
+ className: viewMode === "expert" ? "bg-accent px-2 py-1 text-xs text-foreground" : "px-2 py-1 text-xs text-muted-foreground hover:text-foreground",
6218
+ children: "Advanced"
6219
+ }
6220
+ )
6221
+ ]
6222
+ }
6223
+ ),
6224
+ /* @__PURE__ */ jsx(
6225
+ PromptInputSubmit,
6226
+ {
6227
+ status,
6228
+ onStop,
6229
+ className: "md:size-8"
6230
+ }
6231
+ )
6232
+ ] })
6224
6233
  ] })
6225
6234
  ]
6226
6235
  }
@@ -6394,7 +6403,7 @@ function TurnFeedback({ msg }) {
6394
6403
  {
6395
6404
  type: "button",
6396
6405
  variant: "ghost",
6397
- size: "icon-xs",
6406
+ size: "icon-sm",
6398
6407
  "aria-label": "Good response",
6399
6408
  title: alreadyRated && rating === "up" ? "Good response (recorded)" : "Good response",
6400
6409
  disabled: pending !== null || alreadyRated,
@@ -6402,7 +6411,7 @@ function TurnFeedback({ msg }) {
6402
6411
  className: cn(
6403
6412
  rating === "up" ? "text-foreground" : "text-muted-foreground/60"
6404
6413
  ),
6405
- children: /* @__PURE__ */ jsx(ThumbsUpIcon, { className: "size-3.5" })
6414
+ children: /* @__PURE__ */ jsx(ThumbsUpIcon, { className: "size-4.5" })
6406
6415
  }
6407
6416
  ),
6408
6417
  /* @__PURE__ */ jsx(
@@ -6410,7 +6419,7 @@ function TurnFeedback({ msg }) {
6410
6419
  {
6411
6420
  type: "button",
6412
6421
  variant: "ghost",
6413
- size: "icon-xs",
6422
+ size: "icon-sm",
6414
6423
  "aria-label": "Poor response",
6415
6424
  title: alreadyRated && rating === "down" ? "Poor response (recorded)" : "Poor response",
6416
6425
  disabled: pending !== null || reasonDraft !== null || alreadyRated,
@@ -6418,7 +6427,7 @@ function TurnFeedback({ msg }) {
6418
6427
  className: cn(
6419
6428
  rating === "down" ? "text-foreground" : "text-muted-foreground/60"
6420
6429
  ),
6421
- children: /* @__PURE__ */ jsx(ThumbsDownIcon, { className: "size-3.5" })
6430
+ children: /* @__PURE__ */ jsx(ThumbsDownIcon, { className: "size-4.5" })
6422
6431
  }
6423
6432
  ),
6424
6433
  alreadyRated && msg.userFeedback?.reason && /* @__PURE__ */ jsxs(
@@ -7177,7 +7186,8 @@ function FileViewer({
7177
7186
  error,
7178
7187
  downloadUrl,
7179
7188
  onDelete,
7180
- onClose
7189
+ onClose,
7190
+ hideHeader = false
7181
7191
  }) {
7182
7192
  const visible = loading || file !== null || error !== null;
7183
7193
  if (!visible) return null;
@@ -7187,7 +7197,7 @@ function FileViewer({
7187
7197
  const isImage = file?.encoding === "base64" && !isPdf;
7188
7198
  const HeaderIcon = isImage ? ImageIcon : FileTextIcon;
7189
7199
  return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col border-t border-line", children: [
7190
- /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2 border-b border-line px-3 py-2", children: [
7200
+ !hideHeader && /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2 border-b border-line px-3 py-2", children: [
7191
7201
  /* @__PURE__ */ jsx(HeaderIcon, { className: "size-3.5 shrink-0 text-muted-foreground" }),
7192
7202
  /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
7193
7203
  /* @__PURE__ */ jsx("div", { className: "truncate text-xs font-medium", children: fileName2 }),
@@ -7232,7 +7242,12 @@ function FileViewer({
7232
7242
  }
7233
7243
  )
7234
7244
  ] }),
7235
- /* @__PURE__ */ jsxs(ScrollArea, { className: "min-h-0 flex-1", children: [
7245
+ file && isPdf && file.encoding === "base64" ? (
7246
+ // PDF has its own scrollable container — bypass ScrollArea so
7247
+ // it can grow with the parent's flex height (Radix Viewport's
7248
+ // internal table wrapper sizes to content and breaks h-full).
7249
+ /* @__PURE__ */ jsx(PdfPreview, { file, fileName: fileName2 })
7250
+ ) : /* @__PURE__ */ jsxs(ScrollArea, { className: "min-h-0 flex-1", children: [
7236
7251
  loading && /* @__PURE__ */ jsx("div", { className: "space-y-1.5 p-3", children: Array.from({ length: 10 }).map((_, index) => /* @__PURE__ */ jsx(
7237
7252
  Skeleton,
7238
7253
  {
@@ -7248,7 +7263,6 @@ function FileViewer({
7248
7263
  /* @__PURE__ */ jsx("span", { children: error })
7249
7264
  ] }),
7250
7265
  file && isPdf && file.encoding !== "base64" && /* @__PURE__ */ jsx(FileViewerError, { message: "PDF preview requires base64 file content." }),
7251
- file && isPdf && file.encoding === "base64" && /* @__PURE__ */ jsx(PdfPreview, { file, fileName: fileName2 }),
7252
7266
  file && isImage && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-4", children: /* @__PURE__ */ jsx(
7253
7267
  "img",
7254
7268
  {
@@ -7512,7 +7526,7 @@ function PdfPreview({
7512
7526
  /* @__PURE__ */ jsx(AlertCircleIcon, { className: "mt-0.5 size-3.5 shrink-0" }),
7513
7527
  /* @__PURE__ */ jsx("span", { children: error })
7514
7528
  ] }),
7515
- !error && /* @__PURE__ */ jsx("div", { className: "relative h-[70vh] min-h-[420px] flex-1 bg-muted/20", children: /* @__PURE__ */ jsx(
7529
+ !error && /* @__PURE__ */ jsx("div", { className: "relative min-h-105 flex-1 bg-muted/20", children: /* @__PURE__ */ jsx(
7516
7530
  "div",
7517
7531
  {
7518
7532
  ref: containerRef,
@@ -7713,8 +7727,23 @@ function WorkspaceFilePreviewDialog({
7713
7727
  cancelled = true;
7714
7728
  };
7715
7729
  }, [adapter, sessionId, path, open]);
7716
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "flex h-[80vh] w-full max-w-5xl flex-col gap-0 overflow-hidden p-0", children: [
7717
- /* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-line px-4 py-3", children: /* @__PURE__ */ jsx(DialogTitle, { className: "truncate text-sm", children: _basename(path) }) }),
7730
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "flex h-[85vh] w-[95vw] max-w-350! flex-col gap-0 overflow-hidden p-0", children: [
7731
+ /* @__PURE__ */ jsxs(DialogHeader, { className: "flex flex-row items-center gap-2 border-b border-line px-4 py-3", children: [
7732
+ /* @__PURE__ */ jsx(DialogTitle, { className: "min-w-0 flex-1 truncate text-sm", children: _basename(path) }),
7733
+ /* @__PURE__ */ jsxs(
7734
+ "a",
7735
+ {
7736
+ href: downloadUrl,
7737
+ download: _basename(path),
7738
+ className: "mr-8 inline-flex shrink-0 items-center gap-1.5 rounded-md border border-border bg-background px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-muted",
7739
+ "aria-label": `Download ${_basename(path)}`,
7740
+ children: [
7741
+ /* @__PURE__ */ jsx(DownloadIcon, { className: "size-3.5", "aria-hidden": true }),
7742
+ "Download"
7743
+ ]
7744
+ }
7745
+ )
7746
+ ] }),
7718
7747
  /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ jsx(
7719
7748
  FileViewer,
7720
7749
  {
@@ -7723,7 +7752,8 @@ function WorkspaceFilePreviewDialog({
7723
7752
  error,
7724
7753
  downloadUrl,
7725
7754
  onDelete: null,
7726
- onClose: () => onOpenChange(false)
7755
+ onClose: () => onOpenChange(false),
7756
+ hideHeader: true
7727
7757
  }
7728
7758
  ) })
7729
7759
  ] }) });
@@ -7750,7 +7780,8 @@ function TurnSummaryCard({
7750
7780
  const hasRecap = summary.recap.trim().length > 0;
7751
7781
  const hasArtifacts = summary.artifacts.length > 0;
7752
7782
  if (!hasRecap && !hasArtifacts) return null;
7753
- return /* @__PURE__ */ jsxs("div", { className: "mt-3 rounded border border-border bg-muted/20 px-3 py-2 text-sm", children: [
7783
+ return /* @__PURE__ */ jsxs("div", { className: "mt-3 rounded border border-border bg-muted/50 px-3 py-2 text-sm", children: [
7784
+ /* @__PURE__ */ jsx("div", { className: "mb-2 text-xs font-semibold uppercase tracking-wide", children: "Summary" }),
7754
7785
  hasRecap && /* @__PURE__ */ jsx("p", { className: "mb-2 whitespace-pre-wrap text-foreground", children: summary.recap }),
7755
7786
  hasArtifacts && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: summary.artifacts.map((artifact, i) => {
7756
7787
  const key = `${artifact.kind}:${artifact.ref}:${i}`;
@@ -8537,7 +8568,7 @@ function IterationGroup({
8537
8568
  type: "button",
8538
8569
  onClick: () => setOpen((prev) => !prev),
8539
8570
  "aria-expanded": open,
8540
- className: "flex w-full items-center gap-2 rounded px-1 py-0.5 text-left text-sm hover:bg-muted/40",
8571
+ className: "flex w-full items-center gap-2 rounded py-0.5 text-left text-sm hover:bg-muted/40",
8541
8572
  children: [
8542
8573
  /* @__PURE__ */ jsx("span", { className: cn("flex-1 truncate", labelTone), children: label }),
8543
8574
  /* @__PURE__ */ jsx(
@@ -8565,6 +8596,18 @@ function IterationGroup({
8565
8596
  ] });
8566
8597
  }
8567
8598
  function deriveFileArtifactsFromMessages(messages) {
8599
+ const terminalCommands = [];
8600
+ for (const msg of messages) {
8601
+ if (msg.role !== "assistant" || !msg.toolCalls) continue;
8602
+ for (const tc of msg.toolCalls) {
8603
+ if (tc.toolName !== "terminal") continue;
8604
+ const status = effectiveStatus(tc);
8605
+ if (status === "error" || status === "cancelled") continue;
8606
+ const args = parseArgs(tc.args);
8607
+ const cmd = typeof args?.command === "string" ? args.command : "";
8608
+ if (cmd) terminalCommands.push(cmd);
8609
+ }
8610
+ }
8568
8611
  const seen = /* @__PURE__ */ new Set();
8569
8612
  const out = [];
8570
8613
  for (const msg of messages) {
@@ -8577,6 +8620,8 @@ function deriveFileArtifactsFromMessages(messages) {
8577
8620
  if (tc.toolName === "write_file" || tc.toolName === "patch") {
8578
8621
  const path = typeof args.path === "string" ? args.path : typeof args.file_path === "string" ? args.file_path : "";
8579
8622
  if (!path || seen.has(`file:${path}`)) continue;
8623
+ const executed = terminalCommands.some((cmd) => cmd.includes(path));
8624
+ if (executed) continue;
8580
8625
  seen.add(`file:${path}`);
8581
8626
  out.push({
8582
8627
  kind: "file",
@@ -8617,11 +8662,13 @@ function SimpleAssistantGroup({
8617
8662
  const isTailGroup = lastGlobalIndex === totalMessages - 1;
8618
8663
  const showThinkingShim = isTailGroup && isRunning && (!tail && messages.some((m) => m.role !== "assistant") || tailIsTextOnly && tail.status === "streaming" && !tail.content);
8619
8664
  const showErrorInfo = !!tail && tail.status === "error" && !!tail.errorInfo;
8665
+ const turnComplete = !isRunning && tail?.status === "complete";
8620
8666
  const effectiveTurnSummary = (() => {
8621
8667
  const fromHarness = tail?.turnSummary;
8622
8668
  if (fromHarness && fromHarness.artifacts.length > 0) {
8623
8669
  return fromHarness;
8624
8670
  }
8671
+ if (!turnComplete) return fromHarness;
8625
8672
  const derived = deriveFileArtifactsFromMessages(messages);
8626
8673
  if (derived.length === 0) return fromHarness;
8627
8674
  return {
@@ -9115,6 +9162,27 @@ function findEntry(entries, path) {
9115
9162
  }
9116
9163
  return null;
9117
9164
  }
9165
+ var FILENAME_MAX_CHARS = 42;
9166
+ function truncateFilename(name, max) {
9167
+ if (name.length <= max) return name;
9168
+ const dot = name.lastIndexOf(".");
9169
+ if (dot > 0 && name.length - dot <= 12) {
9170
+ const ext = name.slice(dot);
9171
+ const head = name.slice(0, Math.max(1, max - ext.length - 1));
9172
+ return `${head}\u2026${ext}`;
9173
+ }
9174
+ return `${name.slice(0, max - 1)}\u2026`;
9175
+ }
9176
+ function TruncatedFileName({ name }) {
9177
+ const truncated = truncateFilename(name, FILENAME_MAX_CHARS);
9178
+ const isTruncated = truncated !== name;
9179
+ const node = /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: truncated });
9180
+ if (!isTruncated) return node;
9181
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
9182
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: node }),
9183
+ /* @__PURE__ */ jsx(TooltipContent, { side: "top", className: "max-w-md break-all", children: name })
9184
+ ] });
9185
+ }
9118
9186
  function RenderEntries({
9119
9187
  entries,
9120
9188
  onDelete,
@@ -9134,7 +9202,7 @@ function RenderEntries({
9134
9202
  const fileName2 = entry.name;
9135
9203
  return /* @__PURE__ */ jsxs(FileTreeFile, { name: entry.name, path: entry.path, children: [
9136
9204
  /* @__PURE__ */ jsx("span", { className: "size-4 shrink-0" }),
9137
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: entry.name }),
9205
+ /* @__PURE__ */ jsx(TruncatedFileName, { name: entry.name }),
9138
9206
  entry.size != null && /* @__PURE__ */ jsx("span", { className: "ml-1 shrink-0 text-xs text-muted-foreground/60", children: formatFileSize(entry.size) }),
9139
9207
  /* @__PURE__ */ jsxs("div", { className: "ml-1 flex shrink-0 items-center gap-0 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100", children: [
9140
9208
  /* @__PURE__ */ jsx(
@@ -9178,7 +9246,6 @@ function WorkspacePanel({
9178
9246
  }) {
9179
9247
  const fileInputRef = useRef(null);
9180
9248
  const [entries, setEntries] = useState([]);
9181
- const [rootName, setRootName] = useState("workspace");
9182
9249
  const [treeLoading, setTreeLoading] = useState(false);
9183
9250
  const [treeError, setTreeError] = useState(null);
9184
9251
  const [file, setFile] = useState(null);
@@ -9197,7 +9264,6 @@ function WorkspacePanel({
9197
9264
  const fetchTree = useCallback(async () => {
9198
9265
  if (!sessionId) {
9199
9266
  setEntries([]);
9200
- setRootName("workspace");
9201
9267
  setExpandedPaths(/* @__PURE__ */ new Set());
9202
9268
  setTreeLoading(false);
9203
9269
  setTreeError(null);
@@ -9212,12 +9278,10 @@ function WorkspacePanel({
9212
9278
  });
9213
9279
  if (sessionIdRef.current !== requestedSessionId) return;
9214
9280
  setEntries(tree.entries);
9215
- setRootName(tree.root || "workspace");
9216
9281
  setExpandedPaths(new Set(collectExpandedPaths(tree.entries)));
9217
9282
  } catch (error) {
9218
9283
  if (sessionIdRef.current !== requestedSessionId) return;
9219
9284
  setEntries([]);
9220
- setRootName("workspace");
9221
9285
  setTreeError(error.message);
9222
9286
  } finally {
9223
9287
  if (sessionIdRef.current === requestedSessionId) {
@@ -9407,10 +9471,7 @@ function WorkspacePanel({
9407
9471
  ),
9408
9472
  /* @__PURE__ */ jsxs("div", { className: "flex min-h-14 items-center gap-2 border-b border-line px-3 py-3", children: [
9409
9473
  /* @__PURE__ */ jsx(FolderOpenIcon, { className: "size-4 shrink-0 text-amber-500" }),
9410
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
9411
- /* @__PURE__ */ jsx("div", { className: "truncate text-sm font-medium text-foreground", children: rootName }),
9412
- /* @__PURE__ */ jsx("div", { className: "truncate text-xs text-faint", children: disabled ? "Workspace - Read-only" : "Workspace" })
9413
- ] }),
9474
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx("div", { className: "truncate text-sm font-medium text-foreground", children: disabled ? "Workspace - Read-only" : "Workspace" }) }),
9414
9475
  /* @__PURE__ */ jsxs(Tooltip, { children: [
9415
9476
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
9416
9477
  Button,
@@ -10527,6 +10588,7 @@ function readTurnMeta(data) {
10527
10588
 
10528
10589
  // src/runtime/use-agent-chat-runtime.ts
10529
10590
  var VIEW_MODE_KEY = "@invergent/agent-chat-react:viewMode";
10591
+ var VIEW_MODE_EVENT = "@invergent/agent-chat-react:viewMode:change";
10530
10592
  function readPersistedViewMode() {
10531
10593
  if (typeof window === "undefined") return null;
10532
10594
  try {
@@ -10542,6 +10604,36 @@ function writePersistedViewMode(mode) {
10542
10604
  window.localStorage.setItem(VIEW_MODE_KEY, mode);
10543
10605
  } catch {
10544
10606
  }
10607
+ try {
10608
+ window.dispatchEvent(
10609
+ new CustomEvent(VIEW_MODE_EVENT, { detail: mode })
10610
+ );
10611
+ } catch {
10612
+ }
10613
+ }
10614
+ function useChatViewMode() {
10615
+ const [mode, setMode] = useState(
10616
+ () => readPersistedViewMode() ?? "simple"
10617
+ );
10618
+ useEffect(() => {
10619
+ if (typeof window === "undefined") return;
10620
+ const onSameTab = (event) => {
10621
+ const detail = event.detail;
10622
+ if (detail === "simple" || detail === "expert") setMode(detail);
10623
+ };
10624
+ const onCrossTab = (event) => {
10625
+ if (event.key !== VIEW_MODE_KEY) return;
10626
+ const next = event.newValue;
10627
+ if (next === "simple" || next === "expert") setMode(next);
10628
+ };
10629
+ window.addEventListener(VIEW_MODE_EVENT, onSameTab);
10630
+ window.addEventListener("storage", onCrossTab);
10631
+ return () => {
10632
+ window.removeEventListener(VIEW_MODE_EVENT, onSameTab);
10633
+ window.removeEventListener("storage", onCrossTab);
10634
+ };
10635
+ }, []);
10636
+ return mode;
10545
10637
  }
10546
10638
  function useAgentChatRuntime({
10547
10639
  adapter,
@@ -13576,6 +13668,6 @@ function SessionTreePanel({
13576
13668
  ] });
13577
13669
  }
13578
13670
 
13579
- export { ACTIVE_MISSION_STATUSES, AgentChat, AgentChatAdapterProvider, InboxPanel, MessageResponse, MissionDashboard, MissionsPanel, ScheduledWorkPanel, SessionTreePanel, deriveMissionWorkerActivityLabel, groupMissionTasksByBucket, isTerminalMissionStatus, missionTaskBucket, useAgentChatAdapterContext, useAgentChatRuntime, useInboxUnreadCount };
13671
+ export { ACTIVE_MISSION_STATUSES, AgentChat, AgentChatAdapterProvider, InboxPanel, MessageResponse, MissionDashboard, MissionsPanel, ScheduledWorkPanel, SessionTreePanel, deriveMissionWorkerActivityLabel, groupMissionTasksByBucket, isTerminalMissionStatus, missionTaskBucket, useAgentChatAdapterContext, useAgentChatRuntime, useChatViewMode, useInboxUnreadCount };
13580
13672
  //# sourceMappingURL=index.js.map
13581
13673
  //# sourceMappingURL=index.js.map