@tangle-network/agent-app 1.0.2 → 1.0.4

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.
@@ -2,7 +2,7 @@ import {
2
2
  ReasoningRow,
3
3
  chatToolCallPart,
4
4
  resolveToolPresentation
5
- } from "../chunk-IWEGCOQR.js";
5
+ } from "../chunk-DDYWECBU.js";
6
6
  import "../chunk-UHSUY6H6.js";
7
7
  import "../chunk-3HUFJ5LO.js";
8
8
  import "../chunk-7PULOECS.js";
@@ -528,9 +528,8 @@ function ReasoningRow({
528
528
  const start = startedAt ?? seenStart.current ?? void 0;
529
529
  const end = endedAt ?? seenEnd.current ?? void 0;
530
530
  useSecondTick(thinking);
531
- const [toggled, setToggled] = useState3(null);
531
+ const [open, setOpen] = useState3(thinking || defaultOpen);
532
532
  const { viewportRef, contentRef, following, jumpToLatest } = useChatScroll();
533
- const open = toggled ?? (thinking || defaultOpen || !following);
534
533
  if (!visible) return null;
535
534
  const elapsedSeconds = thinking && start !== void 0 ? Math.max(0, Math.floor((Date.now() - start) / 1e3)) : 0;
536
535
  const durationMs = !thinking && start !== void 0 && end !== void 0 && end >= start ? end - start : void 0;
@@ -551,7 +550,7 @@ function ReasoningRow({
551
550
  description: thinking ? void 0 : reasoningPreview(text),
552
551
  status: thinking ? "running" : "idle",
553
552
  open,
554
- onOpenChange: setToggled,
553
+ onOpenChange: setOpen,
555
554
  children: [
556
555
  /* @__PURE__ */ jsx2(
557
556
  "div",
@@ -7740,6 +7739,7 @@ function SegmentedBody({
7740
7739
  segments,
7741
7740
  msg,
7742
7741
  streaming,
7742
+ showCaret = true,
7743
7743
  renderBody,
7744
7744
  approval,
7745
7745
  onToolCallClick,
@@ -7792,7 +7792,7 @@ function SegmentedBody({
7792
7792
  {
7793
7793
  content: g.content,
7794
7794
  streaming: streaming && g.index === lastIndex,
7795
- showCaret: streaming && g.index === lastIndex,
7795
+ showCaret: showCaret && streaming && g.index === lastIndex,
7796
7796
  renderBody,
7797
7797
  messageClassName
7798
7798
  },
@@ -7817,7 +7817,7 @@ function SegmentedBody({
7817
7817
  g.calls.forEach((call, index) => children.push(renderToolCard(call, index)));
7818
7818
  }
7819
7819
  leftoverToolCalls.forEach((call, index) => children.push(renderToolCard(call, index)));
7820
- if (streaming && segments[lastIndex]?.kind === "tool") {
7820
+ if (showCaret && streaming && segments[lastIndex]?.kind === "tool") {
7821
7821
  children.push(/* @__PURE__ */ jsx27(StreamingCaret, {}, "streaming-caret"));
7822
7822
  }
7823
7823
  return /* @__PURE__ */ jsx27("div", { className: "flex flex-col gap-2", children });
@@ -7930,7 +7930,10 @@ function AssistantMessageImpl({
7930
7930
  const content = useSmoothText(msg.content, streaming);
7931
7931
  const body = useMemo11(() => renderBody(content), [renderBody, content]);
7932
7932
  const segments = msg.segments;
7933
- const hasAnswerText = content !== "" || (segments?.some((s) => (s.kind === "text" || s.kind === "notice") && s.content.trim() !== "") ?? false);
7933
+ const hasAnswerText = Boolean(content || segments?.some(
7934
+ (s) => (s.kind === "text" || s.kind === "notice") && s.content.trim()
7935
+ ));
7936
+ const answerScroll = useChatScroll();
7934
7937
  const quiet = chrome === "quiet";
7935
7938
  const authorClassName = quiet ? "mb-1.5" : void 0;
7936
7939
  const author = msg.speaker ? /* @__PURE__ */ jsx28(SpeakerHeader, { speaker: msg.speaker, live: streaming, className: authorClassName }) : msg.author ? /* @__PURE__ */ jsx28(MessageAuthor, { author: msg.author, className: authorClassName }) : null;
@@ -7948,73 +7951,76 @@ function AssistantMessageImpl({
7948
7951
  ]
7949
7952
  }
7950
7953
  ),
7951
- /* @__PURE__ */ jsx28(
7952
- ReasoningRow,
7953
- {
7954
- className: "mb-2",
7955
- text: msg.reasoning ?? "",
7956
- startedAt: msg.reasoningStartedAt,
7957
- endedAt: msg.reasoningEndedAt,
7958
- thinking: streaming && !hasAnswerText && msg.reasoningEndedAt === void 0
7959
- }
7960
- ),
7961
- segments && segments.length > 0 ? /* @__PURE__ */ jsx28(
7962
- SegmentedBody,
7963
- {
7964
- segments,
7965
- msg,
7966
- streaming,
7967
- renderBody,
7968
- approval,
7969
- onToolCallClick,
7970
- toolRenderers,
7971
- messageClassName
7972
- }
7973
- ) : /* @__PURE__ */ jsxs27(Fragment10, { children: [
7974
- /* @__PURE__ */ jsxs27("div", { className: messageClassName, children: [
7975
- body,
7976
- streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx28(StreamingCaret, {})
7977
- ] }),
7978
- msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx28("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc, index) => /* @__PURE__ */ jsx28(
7979
- ToolCallCard,
7954
+ /* @__PURE__ */ jsx28("div", { ref: msg.speaker ? answerScroll.viewportRef : void 0, className: msg.speaker ? "agent-speaker-answer" : void 0, tabIndex: msg.speaker ? 0 : void 0, role: msg.speaker ? "region" : void 0, "aria-label": msg.speaker ? `Answer from ${msg.speaker.name}` : void 0, children: /* @__PURE__ */ jsxs27("div", { ref: msg.speaker ? answerScroll.contentRef : void 0, children: [
7955
+ /* @__PURE__ */ jsx28(
7956
+ ReasoningRow,
7957
+ {
7958
+ className: "mb-2",
7959
+ text: msg.reasoning ?? "",
7960
+ startedAt: msg.reasoningStartedAt,
7961
+ endedAt: msg.reasoningEndedAt,
7962
+ thinking: streaming && !hasAnswerText && msg.reasoningEndedAt === void 0
7963
+ }
7964
+ ),
7965
+ segments && segments.length > 0 ? /* @__PURE__ */ jsx28(
7966
+ SegmentedBody,
7980
7967
  {
7981
- call: tc,
7982
- message: msg,
7968
+ segments,
7969
+ msg,
7970
+ streaming,
7971
+ showCaret: !msg.speaker,
7972
+ renderBody,
7983
7973
  approval,
7984
- onOpenRun: onToolCallClick,
7985
- renderers: toolRenderers,
7986
- staggerIndex: index
7974
+ onToolCallClick,
7975
+ toolRenderers,
7976
+ messageClassName
7977
+ }
7978
+ ) : /* @__PURE__ */ jsxs27(Fragment10, { children: [
7979
+ /* @__PURE__ */ jsxs27("div", { className: messageClassName, children: [
7980
+ body,
7981
+ !msg.speaker && streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx28(StreamingCaret, {})
7982
+ ] }),
7983
+ msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx28("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc, index) => /* @__PURE__ */ jsx28(
7984
+ ToolCallCard,
7985
+ {
7986
+ call: tc,
7987
+ message: msg,
7988
+ approval,
7989
+ onOpenRun: onToolCallClick,
7990
+ renderers: toolRenderers,
7991
+ staggerIndex: index
7992
+ },
7993
+ tc.id
7994
+ )) })
7995
+ ] }),
7996
+ durableCards && msg.parts && /* @__PURE__ */ jsx28(
7997
+ DurableChatCards,
7998
+ {
7999
+ ...durableCards,
8000
+ parts: msg.parts,
8001
+ renderMarkdown: renderBody,
8002
+ className: "mt-3"
8003
+ }
8004
+ ),
8005
+ workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */ jsx28(
8006
+ WorkProductCard,
8007
+ {
8008
+ part,
8009
+ onOpen: workProductCards.onOpen,
8010
+ className: "mt-3"
7987
8011
  },
7988
- tc.id
7989
- )) })
7990
- ] }),
7991
- durableCards && msg.parts && /* @__PURE__ */ jsx28(
7992
- DurableChatCards,
7993
- {
7994
- ...durableCards,
7995
- parts: msg.parts,
7996
- renderMarkdown: renderBody,
7997
- className: "mt-3"
7998
- }
7999
- ),
8000
- workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */ jsx28(
8001
- WorkProductCard,
8002
- {
8003
- part,
8004
- onOpen: workProductCards.onOpen,
8005
- className: "mt-3"
8006
- },
8007
- `${part.ref.id}:${part.ref.version}`
8008
- )),
8009
- renderExtras?.(msg),
8010
- resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx28("div", { className: "mt-2", children: /* @__PURE__ */ jsx28(
8011
- MessageAttachments,
8012
- {
8013
- parts: attachmentPartsFromMessageParts(msg.parts),
8014
- resolveFileUrl: resolveAttachmentUrl,
8015
- justify: "start"
8016
- }
8017
- ) }),
8012
+ `${part.ref.id}:${part.ref.version}`
8013
+ )),
8014
+ renderExtras?.(msg),
8015
+ resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx28("div", { className: "mt-2", children: /* @__PURE__ */ jsx28(
8016
+ MessageAttachments,
8017
+ {
8018
+ parts: attachmentPartsFromMessageParts(msg.parts),
8019
+ resolveFileUrl: resolveAttachmentUrl,
8020
+ justify: "start"
8021
+ }
8022
+ ) })
8023
+ ] }) }),
8018
8024
  quiet && /* @__PURE__ */ jsxs27("div", { "data-testid": "message-meta-lane", className: QUIET_META_LANE_CLASS, children: [
8019
8025
  /* @__PURE__ */ jsx28(CopyMessageButton, { text: copyTextOf(msg) }),
8020
8026
  msg.modelUsed && /* @__PURE__ */ jsx28("span", { className: "font-mono", children: msg.modelUsed }),
@@ -8081,6 +8087,7 @@ function OtherPersonMessage({
8081
8087
  quiet && /* @__PURE__ */ jsx28("div", { "data-testid": "message-meta-lane", className: `${QUIET_META_LANE_CLASS} justify-start`, children: /* @__PURE__ */ jsx28(CopyMessageButton, { text: msg.content }) })
8082
8088
  ] });
8083
8089
  }
8090
+ var renderPlainBody = (content) => /* @__PURE__ */ jsx28("p", { className: "whitespace-pre-wrap", children: content });
8084
8091
  function ChatMessages({
8085
8092
  messages: storedMessages,
8086
8093
  messageSize = "default",
@@ -8107,10 +8114,7 @@ function ChatMessages({
8107
8114
  }) {
8108
8115
  const messageClassName = messageSize === "large" ? `agent-app-message-copy ${TRANSCRIPT_TEXT} [--transcript-font-size:1.0625rem]` : `agent-app-message-copy ${TRANSCRIPT_TEXT}`;
8109
8116
  const assistantMessageClassName = `${messageClassName} bg-transparent text-[hsl(var(--foreground))]`;
8110
- const renderBody = useMemo11(
8111
- () => renderMarkdown ?? ((content) => /* @__PURE__ */ jsx28("p", { className: "whitespace-pre-wrap", children: content })),
8112
- [renderMarkdown]
8113
- );
8117
+ const renderBody = renderMarkdown ?? renderPlainBody;
8114
8118
  const messages = useMemo11(() => splitBySpeaker(storedMessages), [storedMessages]);
8115
8119
  const liveId = loading ? storedMessages[storedMessages.length - 1]?.id : void 0;
8116
8120
  const lastIsUser = messages[messages.length - 1]?.role === "user";
@@ -8706,4 +8710,4 @@ export {
8706
8710
  AgentProfileChoices,
8707
8711
  ComposerProfilePill
8708
8712
  };
8709
- //# sourceMappingURL=chunk-IWEGCOQR.js.map
8713
+ //# sourceMappingURL=chunk-DDYWECBU.js.map