@athenaintel/react 0.9.10 → 0.9.11

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.cjs CHANGED
@@ -23855,6 +23855,10 @@ const nullableToOptionalString = preprocessType(
23855
23855
  stringType().optional()
23856
23856
  );
23857
23857
  const metadataRecordSchema = recordType(stringType(), unknownType());
23858
+ const nullableToOptionalMetadataRecord = preprocessType(
23859
+ (val) => val === null ? void 0 : val,
23860
+ metadataRecordSchema.optional()
23861
+ );
23858
23862
  const systemMessageSchema = objectType({
23859
23863
  id: nullableToOptionalString,
23860
23864
  type: literalType("system"),
@@ -23893,8 +23897,8 @@ const aiMessageSchema = objectType({
23893
23897
  tool_calls: arrayType(anyType()).optional(),
23894
23898
  status: anyType().optional(),
23895
23899
  additional_kwargs: metadataRecordSchema.optional(),
23896
- usage_metadata: metadataRecordSchema.optional(),
23897
- response_metadata: metadataRecordSchema.optional()
23900
+ usage_metadata: nullableToOptionalMetadataRecord,
23901
+ response_metadata: nullableToOptionalMetadataRecord
23898
23902
  });
23899
23903
  const formatValidationError = (error2, msg) => {
23900
23904
  const msgObj = msg && typeof msg === "object" ? msg : {};
@@ -64362,16 +64366,21 @@ const AthenaReasoningPart = ({
64362
64366
  }) => {
64363
64367
  const inheritedTextComponent = React.useContext(AthenaReasoningTextComponentContext);
64364
64368
  const EffectiveTextComponent = TextComponent ?? inheritedTextComponent ?? TiptapText;
64369
+ const isMessageRunning = useAuiState((state) => {
64370
+ var _a2;
64371
+ return ((_a2 = state.message.status) == null ? void 0 : _a2.type) === "running";
64372
+ });
64365
64373
  const reasoningTokens = useAuiState(
64366
64374
  (state) => getReasoningTokensFromMetadata(state.message.metadata)
64367
64375
  );
64368
- const isRunning = (status == null ? void 0 : status.type) === "running";
64376
+ const isRunning = isMessageRunning || (status == null ? void 0 : status.type) === "running";
64369
64377
  const [isCollapsed, setIsCollapsed] = React.useState(!isRunning);
64370
64378
  const userOverrodeOpenStateRef = React.useRef(false);
64379
+ const hasText = text2.trim().length > 0;
64371
64380
  const reasoningTextProps = {
64372
64381
  type: "text",
64373
64382
  text: text2,
64374
- status
64383
+ status: isRunning ? { type: "running" } : status
64375
64384
  };
64376
64385
  React.useEffect(() => {
64377
64386
  if (userOverrodeOpenStateRef.current) {
@@ -64379,7 +64388,7 @@ const AthenaReasoningPart = ({
64379
64388
  }
64380
64389
  setIsCollapsed(!isRunning);
64381
64390
  }, [isRunning]);
64382
- if (!text2 && !isRunning) {
64391
+ if (!hasText && !isRunning) {
64383
64392
  return null;
64384
64393
  }
64385
64394
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -64420,10 +64429,10 @@ const AthenaReasoningPart = ({
64420
64429
  ]
64421
64430
  }
64422
64431
  ) }),
64423
- /* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent, { className: "pt-3", children: isRunning && !text2 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shimmer text-sm text-muted-foreground", children: "Analyzing..." }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aui-assistant-reasoning-body text-sm", children: [
64424
- /* @__PURE__ */ jsxRuntime.jsx(EffectiveTextComponent, { ...reasoningTextProps }),
64425
- isRunning && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-2 inline-block shimmer text-sm text-muted-foreground", children: "Thinking..." })
64426
- ] }) })
64432
+ /* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent, { className: "pt-3", children: isRunning && !hasText ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shimmer text-sm text-muted-foreground", children: "Analyzing..." }) : isRunning ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground", children: [
64433
+ text2,
64434
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-2 inline-block shimmer text-sm text-muted-foreground", children: "Thinking..." })
64435
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-assistant-reasoning-body text-sm", children: /* @__PURE__ */ jsxRuntime.jsx(EffectiveTextComponent, { ...reasoningTextProps }) }) })
64427
64436
  ]
64428
64437
  }
64429
64438
  );