@malette/agent-sdk 0.1.3-beta.4 → 0.1.3-beta.5

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.mjs CHANGED
@@ -13850,6 +13850,16 @@ var ThoughtTimelineCard = memo(function ThoughtTimelineCard2({ thought, config,
13850
13850
  const withoutJsonImages = removeJsonImageUrls(withoutTags);
13851
13851
  const cleaned = sanitizeMarkdownContent(parseThinkingContent(withoutJsonImages));
13852
13852
  if (!cleaned || !cleaned.trim()) return null;
13853
+ const lineCount = useMemo(() => cleaned.split("\n").length, [cleaned]);
13854
+ React24__default.useEffect(() => {
13855
+ if (isLoading) {
13856
+ setExpanded(true);
13857
+ } else {
13858
+ if (lineCount > 3) {
13859
+ setExpanded(false);
13860
+ }
13861
+ }
13862
+ }, [isLoading, lineCount]);
13853
13863
  const htmlCodeBlockMatch = cleaned.match(/```(?:html|htm)\n([\s\S]*?)(?:\n```|$)/);
13854
13864
  const isBareHtml = !htmlCodeBlockMatch && (cleaned.trimStart().startsWith("<!DOCTYPE") || cleaned.trimStart().startsWith("<html"));
13855
13865
  const isHtmlContent = !!htmlCodeBlockMatch || isBareHtml;
@@ -13918,11 +13928,45 @@ var ThoughtTimelineCard = memo(function ThoughtTimelineCard2({ thought, config,
13918
13928
  }) })
13919
13929
  ] });
13920
13930
  }
13921
- return /* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsxs("div", { className: "px-3 py-2", children: [
13922
- /* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsxs("div", { className: "text-sm leading-relaxed max-w-none [&_*]:break-words", children: [
13923
- /* @__PURE__ */ jsx(MarkdownContent, { content: preventSetextHeadings(cleaned), skipImages, config, variant: "thought" }),
13924
- isLoading && /* @__PURE__ */ jsx("span", { className: "inline-block w-2 h-4 ml-0.5 bg-[#d8ff00] animate-pulse rounded-sm" })
13925
- ] }) }),
13931
+ return /* @__PURE__ */ jsxs("div", { className: "py-1", children: [
13932
+ !isLoading && /* @__PURE__ */ jsxs(
13933
+ "button",
13934
+ {
13935
+ onClick: () => setExpanded(!expanded),
13936
+ className: "w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-sm text-zinc-400 hover:text-zinc-200 hover:bg-zinc-800/40 transition-all duration-150 group",
13937
+ children: [
13938
+ /* @__PURE__ */ jsx(
13939
+ "svg",
13940
+ {
13941
+ width: "12",
13942
+ height: "12",
13943
+ viewBox: "0 0 12 12",
13944
+ fill: "none",
13945
+ className: `flex-shrink-0 text-zinc-500 transition-transform duration-200 ${expanded ? "rotate-90" : "rotate-0"}`,
13946
+ children: /* @__PURE__ */ jsx("path", { d: "M4.5 3L7.5 6L4.5 9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
13947
+ }
13948
+ ),
13949
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: expanded ? "\u9690\u85CF\u63A8\u7406\u8FC7\u7A0B" : "\u663E\u793A\u63A8\u7406\u8FC7\u7A0B" }),
13950
+ !expanded && cleaned.length > 0 && /* @__PURE__ */ jsxs("span", { className: "text-zinc-600 truncate flex-1 text-left pl-2", children: [
13951
+ cleaned.slice(0, 30).replace(/\n/g, " "),
13952
+ cleaned.length > 30 ? "..." : ""
13953
+ ] })
13954
+ ]
13955
+ }
13956
+ ),
13957
+ /* @__PURE__ */ jsx("div", { className: `overflow-hidden transition-all duration-250 ease-out ${expanded ? "mt-1" : ""}`, children: /* @__PURE__ */ jsxs(
13958
+ "div",
13959
+ {
13960
+ className: `${expanded ? "block" : "hidden"} relative`,
13961
+ children: [
13962
+ /* @__PURE__ */ jsx("div", { className: "absolute left-[17px] top-0 bottom-0 w-px bg-zinc-800" }),
13963
+ /* @__PURE__ */ jsx("div", { className: "ml-6 pl-3 py-2 border-l border-transparent", children: /* @__PURE__ */ jsxs("div", { className: "text-sm leading-relaxed max-w-none [&_*]:break-words text-zinc-300", children: [
13964
+ /* @__PURE__ */ jsx(MarkdownContent, { content: preventSetextHeadings(cleaned), skipImages, config, variant: "thought" }),
13965
+ isLoading && /* @__PURE__ */ jsx("span", { className: "inline-block w-2 h-4 ml-0.5 bg-[#d8ff00] animate-pulse rounded-sm" })
13966
+ ] }) })
13967
+ ]
13968
+ }
13969
+ ) }),
13926
13970
  thought?.raw?.length > 0 && showItemTime && /* @__PURE__ */ jsx("div", { className: "text-xs text-zinc-500 mt-2", children: new Date(
13927
13971
  thought.raw[thought.raw.length - 1]?.gmt_create || thought.raw[thought.raw.length - 1]?.gmtCreate || thought.raw[thought.raw.length - 1]?.timestamp || ""
13928
13972
  ).toLocaleTimeString("zh-CN", {
@@ -13933,7 +13977,7 @@ var ThoughtTimelineCard = memo(function ThoughtTimelineCard2({ thought, config,
13933
13977
  minute: "2-digit",
13934
13978
  second: "2-digit"
13935
13979
  }) })
13936
- ] }) });
13980
+ ] });
13937
13981
  });
13938
13982
  function formatDuration(ms) {
13939
13983
  if (ms < 1e3) return `${ms}ms`;