@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.js CHANGED
@@ -13878,6 +13878,16 @@ var ThoughtTimelineCard = React24.memo(function ThoughtTimelineCard2({ thought,
13878
13878
  const withoutJsonImages = removeJsonImageUrls(withoutTags);
13879
13879
  const cleaned = sanitizeMarkdownContent(parseThinkingContent(withoutJsonImages));
13880
13880
  if (!cleaned || !cleaned.trim()) return null;
13881
+ const lineCount = React24.useMemo(() => cleaned.split("\n").length, [cleaned]);
13882
+ React24__namespace.default.useEffect(() => {
13883
+ if (isLoading) {
13884
+ setExpanded(true);
13885
+ } else {
13886
+ if (lineCount > 3) {
13887
+ setExpanded(false);
13888
+ }
13889
+ }
13890
+ }, [isLoading, lineCount]);
13881
13891
  const htmlCodeBlockMatch = cleaned.match(/```(?:html|htm)\n([\s\S]*?)(?:\n```|$)/);
13882
13892
  const isBareHtml = !htmlCodeBlockMatch && (cleaned.trimStart().startsWith("<!DOCTYPE") || cleaned.trimStart().startsWith("<html"));
13883
13893
  const isHtmlContent = !!htmlCodeBlockMatch || isBareHtml;
@@ -13946,11 +13956,45 @@ var ThoughtTimelineCard = React24.memo(function ThoughtTimelineCard2({ thought,
13946
13956
  }) })
13947
13957
  ] });
13948
13958
  }
13949
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2", children: [
13950
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm leading-relaxed max-w-none [&_*]:break-words", children: [
13951
- /* @__PURE__ */ jsxRuntime.jsx(MarkdownContent, { content: preventSetextHeadings(cleaned), skipImages, config, variant: "thought" }),
13952
- isLoading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-2 h-4 ml-0.5 bg-[#d8ff00] animate-pulse rounded-sm" })
13953
- ] }) }),
13959
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-1", children: [
13960
+ !isLoading && /* @__PURE__ */ jsxRuntime.jsxs(
13961
+ "button",
13962
+ {
13963
+ onClick: () => setExpanded(!expanded),
13964
+ 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",
13965
+ children: [
13966
+ /* @__PURE__ */ jsxRuntime.jsx(
13967
+ "svg",
13968
+ {
13969
+ width: "12",
13970
+ height: "12",
13971
+ viewBox: "0 0 12 12",
13972
+ fill: "none",
13973
+ className: `flex-shrink-0 text-zinc-500 transition-transform duration-200 ${expanded ? "rotate-90" : "rotate-0"}`,
13974
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.5 3L7.5 6L4.5 9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
13975
+ }
13976
+ ),
13977
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: expanded ? "\u9690\u85CF\u63A8\u7406\u8FC7\u7A0B" : "\u663E\u793A\u63A8\u7406\u8FC7\u7A0B" }),
13978
+ !expanded && cleaned.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-zinc-600 truncate flex-1 text-left pl-2", children: [
13979
+ cleaned.slice(0, 30).replace(/\n/g, " "),
13980
+ cleaned.length > 30 ? "..." : ""
13981
+ ] })
13982
+ ]
13983
+ }
13984
+ ),
13985
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `overflow-hidden transition-all duration-250 ease-out ${expanded ? "mt-1" : ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs(
13986
+ "div",
13987
+ {
13988
+ className: `${expanded ? "block" : "hidden"} relative`,
13989
+ children: [
13990
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-[17px] top-0 bottom-0 w-px bg-zinc-800" }),
13991
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-6 pl-3 py-2 border-l border-transparent", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm leading-relaxed max-w-none [&_*]:break-words text-zinc-300", children: [
13992
+ /* @__PURE__ */ jsxRuntime.jsx(MarkdownContent, { content: preventSetextHeadings(cleaned), skipImages, config, variant: "thought" }),
13993
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-2 h-4 ml-0.5 bg-[#d8ff00] animate-pulse rounded-sm" })
13994
+ ] }) })
13995
+ ]
13996
+ }
13997
+ ) }),
13954
13998
  thought?.raw?.length > 0 && showItemTime && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-zinc-500 mt-2", children: new Date(
13955
13999
  thought.raw[thought.raw.length - 1]?.gmt_create || thought.raw[thought.raw.length - 1]?.gmtCreate || thought.raw[thought.raw.length - 1]?.timestamp || ""
13956
14000
  ).toLocaleTimeString("zh-CN", {
@@ -13961,7 +14005,7 @@ var ThoughtTimelineCard = React24.memo(function ThoughtTimelineCard2({ thought,
13961
14005
  minute: "2-digit",
13962
14006
  second: "2-digit"
13963
14007
  }) })
13964
- ] }) });
14008
+ ] });
13965
14009
  });
13966
14010
  function formatDuration(ms) {
13967
14011
  if (ms < 1e3) return `${ms}ms`;