@invergent/agent-chat-react 2.2.0 → 2.2.2

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
@@ -658,6 +658,13 @@ interface AgentChatRuntimeApi {
658
658
  session: AgentChatSession | null;
659
659
  messages: AgentChatMessage[];
660
660
  isRunning: boolean;
661
+ /** True once the session has ended terminally (complete/done/fail/paused).
662
+ * Distinct from ``isRunning``, which flips false the moment the agent
663
+ * emits its final text-only response — before the harness summarizer
664
+ * has had a chance to run. Skeleton placeholders for the post-answer
665
+ * summarizer window gate on ``!terminal`` to remain visible across
666
+ * that gap. */
667
+ terminal: boolean;
661
668
  isLoadingHistory: boolean;
662
669
  tokenUsage: AgentChatTokenUsage;
663
670
  retryIndicator: AgentChatRetryIndicator | null;
package/dist/index.d.ts CHANGED
@@ -658,6 +658,13 @@ interface AgentChatRuntimeApi {
658
658
  session: AgentChatSession | null;
659
659
  messages: AgentChatMessage[];
660
660
  isRunning: boolean;
661
+ /** True once the session has ended terminally (complete/done/fail/paused).
662
+ * Distinct from ``isRunning``, which flips false the moment the agent
663
+ * emits its final text-only response — before the harness summarizer
664
+ * has had a chance to run. Skeleton placeholders for the post-answer
665
+ * summarizer window gate on ``!terminal`` to remain visible across
666
+ * that gap. */
667
+ terminal: boolean;
661
668
  isLoadingHistory: boolean;
662
669
  tokenUsage: AgentChatTokenUsage;
663
670
  retryIndicator: AgentChatRetryIndicator | null;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { cn } from './chunk-QSC4UIVT.js';
2
2
  import { createContext, memo, useRef, useEffect, useCallback, useMemo, useState, lazy, useContext, Fragment as Fragment$1, Suspense, Children } from 'react';
3
- import { ChevronDownIcon, AlertTriangle, ChevronDown, ChevronRight, RefreshCw, File as File$1, FileImage, FileAudio, FileVideo, FileText, FileCode, FileArchive, FileSpreadsheet, InboxIcon, Loader2, AlertCircle, Pause, Play, Ban, TargetIcon, ChevronRightIcon, CalendarClockIcon, UsersIcon, MessageSquareIcon, ZapIcon, Maximize2Icon, FolderOpenIcon, Loader2Icon, UploadIcon, RefreshCwIcon, AlertCircleIcon, ExternalLinkIcon, ClipboardCheckIcon, ShieldAlertIcon, TimerIcon, CircleDotIcon, XIcon, Trash2Icon, SquareIcon, ArrowDownIcon, RotateCcwIcon, MousePointer2Icon, DownloadIcon, TrashIcon, ImageIcon, FileTextIcon, CheckIcon, CopyIcon, TerminalIcon, SparklesIcon, ClockIcon, PlusIcon, CloudIcon, HardDriveIcon, PaperclipIcon, GlobeIcon, FolderIcon, FileIcon, ChevronLeftIcon, MinusIcon, SearchIcon, ThumbsUpIcon, ThumbsDownIcon, CircleCheckIcon, GitBranchIcon, ActivityIcon, EyeIcon, ListTodoIcon, ArrowUpIcon, ListIcon, PenLineIcon, ArrowRight, BookOpenIcon, FileEditIcon, WrenchIcon, FileCodeIcon, CodeIcon, FileArchiveIcon, FileVideoIcon, FileAudioIcon, FileImageIcon, FileChartLineIcon, FileSpreadsheetIcon, XCircleIcon, CheckCircle2Icon, Code, CircleXIcon, SkullIcon, CheckCircleIcon, CircleIcon } from 'lucide-react';
3
+ import { ChevronDownIcon, AlertTriangle, ChevronDown, ChevronRight, RefreshCw, File as File$1, FileImage, FileAudio, FileVideo, FileText, FileCode, FileArchive, FileSpreadsheet, InboxIcon, Loader2, AlertCircle, Pause, Play, Ban, TargetIcon, ChevronRightIcon, CalendarClockIcon, UsersIcon, MessageSquareIcon, ZapIcon, Maximize2Icon, FolderOpenIcon, Loader2Icon, UploadIcon, RefreshCwIcon, AlertCircleIcon, ExternalLinkIcon, ClipboardCheckIcon, ShieldAlertIcon, TimerIcon, CircleDotIcon, XIcon, Trash2Icon, SquareIcon, ArrowDownIcon, RotateCcwIcon, MousePointer2Icon, DownloadIcon, TrashIcon, ImageIcon, FileTextIcon, CheckIcon, CopyIcon, TerminalIcon, SparklesIcon, ClockIcon, PlusIcon, CloudIcon, HardDriveIcon, PaperclipIcon, GlobeIcon, FolderIcon, FileIcon, ChevronLeftIcon, MinusIcon, SearchIcon, CircleCheckIcon, ThumbsUpIcon, ThumbsDownIcon, GitBranchIcon, ActivityIcon, EyeIcon, ListTodoIcon, ArrowUpIcon, ListIcon, PenLineIcon, ArrowRight, BookOpenIcon, FileEditIcon, WrenchIcon, FileCodeIcon, CodeIcon, FileArchiveIcon, FileVideoIcon, FileAudioIcon, FileImageIcon, FileChartLineIcon, FileSpreadsheetIcon, XCircleIcon, CheckCircle2Icon, Code, CircleXIcon, SkullIcon, CheckCircleIcon, CircleIcon } from 'lucide-react';
4
4
  import { cva } from 'class-variance-authority';
5
5
  import { Collapsible as Collapsible$1, Slot, Tooltip as Tooltip$1, Progress as Progress$1, Tabs as Tabs$1, Dialog as Dialog$1, ScrollArea as ScrollArea$1, Popover as Popover$1 } from 'radix-ui';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -8272,6 +8272,18 @@ function TextEntry({
8272
8272
  ] })
8273
8273
  ] });
8274
8274
  }
8275
+ function SimpleFinalAnswer({
8276
+ text,
8277
+ isStreaming,
8278
+ tail
8279
+ }) {
8280
+ const content = useSmoothStream(text, isStreaming);
8281
+ const revealComplete = content.length >= text.length;
8282
+ return /* @__PURE__ */ jsxs("div", { className: "mt-3", children: [
8283
+ /* @__PURE__ */ jsx(MessageResponse, { children: content }),
8284
+ tail?.status === "complete" && revealComplete && /* @__PURE__ */ jsx(TurnFeedback, { msg: tail })
8285
+ ] });
8286
+ }
8275
8287
  function deriveIterationLabel(message) {
8276
8288
  const calls = visibleToolCalls(message);
8277
8289
  if (calls.length === 0) {
@@ -8648,6 +8660,7 @@ function SimpleAssistantGroup({
8648
8660
  lastGlobalIndex,
8649
8661
  totalMessages,
8650
8662
  isRunning,
8663
+ terminal,
8651
8664
  sessionId,
8652
8665
  artifactFallbacks,
8653
8666
  onFileSelect,
@@ -8704,10 +8717,14 @@ function SimpleAssistantGroup({
8704
8717
  }),
8705
8718
  showThinkingShim && /* @__PURE__ */ jsx(Shimmer, { duration: 3, spread: 3, className: "text-sm", children: "Working on it..." })
8706
8719
  ] }),
8707
- finalText && /* @__PURE__ */ jsxs("div", { className: "mt-3", children: [
8708
- /* @__PURE__ */ jsx(MessageResponse, { children: finalText }),
8709
- tail?.status === "complete" && /* @__PURE__ */ jsx(TurnFeedback, { msg: tail })
8710
- ] }),
8720
+ finalText && /* @__PURE__ */ jsx(
8721
+ SimpleFinalAnswer,
8722
+ {
8723
+ text: finalText,
8724
+ isStreaming: tail?.status === "streaming",
8725
+ tail
8726
+ }
8727
+ ),
8711
8728
  effectiveTurnSummary ? /* @__PURE__ */ jsx(
8712
8729
  TurnSummaryCard,
8713
8730
  {
@@ -8720,10 +8737,12 @@ function SimpleAssistantGroup({
8720
8737
  // The harness summarizer runs after the last assistant
8721
8738
  // response and before ``session.complete``. Show a pending
8722
8739
  // placeholder during that window so users aren't surprised
8723
- // when the Summary card pops in. Gated on the tail group +
8724
- // a complete final answer + still-running session so the
8725
- // placeholder doesn't show on historic turns or mid-stream.
8726
- isTailGroup && isRunning && !!finalText && tail?.status === "complete" && /* @__PURE__ */ jsx(TurnSummaryPending, {})
8740
+ // when the Summary card pops in. Gated on ``!terminal``
8741
+ // rather than ``isRunning`` because the text-only final
8742
+ // ``llm.response`` already flips ``isRunning`` to false —
8743
+ // the summarizer then runs in the gap before
8744
+ // ``session.complete`` (which is what sets ``terminal``).
8745
+ isTailGroup && !terminal && !!finalText && tail?.status === "complete" && /* @__PURE__ */ jsx(TurnSummaryPending, {})
8727
8746
  ),
8728
8747
  showErrorInfo && /* @__PURE__ */ jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsx(ErrorMessage, { errorInfo: tail.errorInfo, onRetry }) })
8729
8748
  ] }) });
@@ -8733,6 +8752,7 @@ function AssistantGroup({
8733
8752
  lastGlobalIndex,
8734
8753
  totalMessages,
8735
8754
  isRunning,
8755
+ terminal,
8736
8756
  sessionId,
8737
8757
  artifactFallbacks,
8738
8758
  onFileSelect,
@@ -8747,6 +8767,7 @@ function AssistantGroup({
8747
8767
  lastGlobalIndex,
8748
8768
  totalMessages,
8749
8769
  isRunning,
8770
+ terminal,
8750
8771
  sessionId,
8751
8772
  artifactFallbacks,
8752
8773
  onFileSelect,
@@ -8828,6 +8849,7 @@ function ChatThread({
8828
8849
  sessionId,
8829
8850
  messages,
8830
8851
  isRunning,
8852
+ terminal,
8831
8853
  isLoadingHistory = false,
8832
8854
  onSend,
8833
8855
  onStop,
@@ -8932,6 +8954,7 @@ function ChatThread({
8932
8954
  lastGlobalIndex: group.lastGlobalIndex,
8933
8955
  totalMessages: messages.length,
8934
8956
  isRunning,
8957
+ terminal,
8935
8958
  sessionId,
8936
8959
  artifactFallbacks,
8937
8960
  onFileSelect,
@@ -10991,6 +11014,7 @@ function useAgentChatRuntime({
10991
11014
  session,
10992
11015
  messages: state.messages,
10993
11016
  isRunning: state.isRunning,
11017
+ terminal: state.terminal,
10994
11018
  isLoadingHistory: state.isLoadingHistory,
10995
11019
  tokenUsage: state.tokenUsage,
10996
11020
  retryIndicator: state.retryIndicator,
@@ -11180,6 +11204,7 @@ function AgentChat({
11180
11204
  sessionId,
11181
11205
  messages: runtime.messages,
11182
11206
  isRunning: runtime.isRunning,
11207
+ terminal: runtime.terminal,
11183
11208
  isLoadingHistory: runtime.isLoadingHistory,
11184
11209
  onSend: (content, images, attachments) => runtime.send(content, images, attachments),
11185
11210
  onStop: () => runtime.stop(),