langchain_agentx_stream_ui 0.8.3 → 0.8.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.
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { b as ToolDisplayProps, T as ToolBodyComponent } from './types-CZahMfoe.js';
3
- import { T as ToolDisplayRegistry } from './sessionViewOptions-Il6SnYYB.js';
2
+ import { b as ToolDisplayProps, T as ToolBodyComponent } from './types-Db-2uTSL.js';
3
+ import { T as ToolDisplayRegistry } from './sessionViewOptions-DboYs118.js';
4
4
 
5
5
  declare function DefaultToolBody({ result, bodyMode, onBodyModeChange, }: ToolDisplayProps): react_jsx_runtime.JSX.Element;
6
6
 
@@ -26,7 +26,7 @@ declare function WebSearchToolBody({ result, bodyMode, onBodyModeChange, }: Tool
26
26
 
27
27
  declare function WebFetchToolBody({ result, bodyMode, onBodyModeChange, }: ToolDisplayProps): react_jsx_runtime.JSX.Element;
28
28
 
29
- declare function SkillToolBody({ result, bodyMode, onBodyModeChange, }: ToolDisplayProps): react_jsx_runtime.JSX.Element;
29
+ declare function SkillToolBody({ input, result, bodyMode, onBodyModeChange, status, skillProgressMessages, }: ToolDisplayProps): react_jsx_runtime.JSX.Element;
30
30
 
31
31
  declare function AskUserQuestionToolBody({ input, result, bodyMode, onBodyModeChange, }: ToolDisplayProps): react_jsx_runtime.JSX.Element;
32
32
 
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { a as ToolBodyMode } from './types-CZahMfoe.js';
2
+ import { a as ToolBodyMode } from './types-Db-2uTSL.js';
3
3
 
4
4
  declare const MAX_PREVIEW_LINES = 3;
5
5
  interface TruncatedContentProps {
@@ -884,10 +884,25 @@ function AgentProgressLines({
884
884
  // src/view/tools/presentation/subagentTranscriptRenderer.ts
885
885
  function toolCallsFromAssistant(message) {
886
886
  const raw = message.tool_calls;
887
- if (!Array.isArray(raw)) return [];
888
- return raw.filter(
889
- (item) => item != null && typeof item === "object" && !Array.isArray(item)
890
- );
887
+ if (Array.isArray(raw) && raw.length > 0) {
888
+ return raw.filter(
889
+ (item) => item != null && typeof item === "object" && !Array.isArray(item)
890
+ );
891
+ }
892
+ const content = message.content;
893
+ if (!Array.isArray(content)) return [];
894
+ const fromContent = [];
895
+ for (const block of content) {
896
+ if (block == null || typeof block !== "object" || Array.isArray(block)) continue;
897
+ const item = block;
898
+ if (item.type !== "tool_use") continue;
899
+ fromContent.push({
900
+ name: item.name,
901
+ input: item.input,
902
+ id: item.id
903
+ });
904
+ }
905
+ return fromContent;
891
906
  }
892
907
  function toolInputFromCall(call) {
893
908
  const args = call.args;
@@ -1048,10 +1063,11 @@ function renderTranscriptLaneLines(entries) {
1048
1063
  }
1049
1064
  };
1050
1065
  for (const entry of entries) {
1066
+ const entryKey = entry.id ?? "entry";
1051
1067
  if (entry.messageKind === "assistant") {
1052
1068
  const toolCalls = toolCallsFromAssistant(entry.message);
1053
1069
  if (toolCalls.length > 0) {
1054
- for (const call of toolCalls) {
1070
+ toolCalls.forEach((call, callIndex) => {
1055
1071
  const callName = String(call.name ?? entry.toolName ?? "Tool").trim();
1056
1072
  const text2 = formatAssistantToolLine(
1057
1073
  callName,
@@ -1059,15 +1075,23 @@ function renderTranscriptLaneLines(entries) {
1059
1075
  toolInputFromCall(call)
1060
1076
  );
1061
1077
  if (text2.length > 0) {
1062
- pendingCalls.push({ kind: "call", text: text2 });
1078
+ pendingCalls.push({
1079
+ kind: "call",
1080
+ text: text2,
1081
+ lineKey: `${entryKey}:a:${callIndex}`
1082
+ });
1063
1083
  }
1064
- }
1084
+ });
1065
1085
  continue;
1066
1086
  }
1067
1087
  flushPendingCalls();
1068
1088
  const text = String(entry.message.content ?? "").trim();
1069
1089
  if (text) {
1070
- lines.push({ kind: "call", text: truncatePreview2(text, 240) });
1090
+ lines.push({
1091
+ kind: "call",
1092
+ text: truncatePreview2(text, 240),
1093
+ lineKey: `${entryKey}:a:0`
1094
+ });
1071
1095
  }
1072
1096
  continue;
1073
1097
  }
@@ -1078,7 +1102,7 @@ function renderTranscriptLaneLines(entries) {
1078
1102
  if (paired && paired.text.length > 0) {
1079
1103
  lines.push(paired);
1080
1104
  }
1081
- lines.push(result);
1105
+ lines.push({ ...result, lineKey: `${entryKey}:u:0` });
1082
1106
  }
1083
1107
  }
1084
1108
  flushPendingCalls();
@@ -1642,25 +1666,122 @@ function ReadToolBody({
1642
1666
  ] });
1643
1667
  }
1644
1668
 
1669
+ // src/view/tools/skill/skillForkUI.ts
1670
+ var SKILL_PROGRESS_TAIL_LINES = 3;
1671
+ var SKILL_FORK_INITIALIZING = "Initializing\u2026";
1672
+ function isSkillForkExecution(input, display) {
1673
+ const inp = asInputRecord(input);
1674
+ const d = asDisplayRecord(display);
1675
+ const ctx = strField(inp, "context") || strField(d, "execution_context") || strField(inp, "execution_context");
1676
+ return typeof ctx === "string" && ctx.trim().toLowerCase() === "fork";
1677
+ }
1678
+ function isSkillForkDoneResult(input, display) {
1679
+ if (!isSkillForkExecution(input, display)) return false;
1680
+ const d = asDisplayRecord(display);
1681
+ if (d?.status === "forked") return true;
1682
+ if (d?.execution_context === "fork" && d?.fork_result != null) return true;
1683
+ return false;
1684
+ }
1685
+
1686
+ // src/view/tools/skill/SkillProgressLines.tsx
1687
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1688
+ function toTranscriptEntry(entry) {
1689
+ return {
1690
+ id: entry.id,
1691
+ agentId: entry.agentId,
1692
+ messageKind: entry.messageKind,
1693
+ message: entry.message,
1694
+ step: entry.step,
1695
+ toolName: entry.toolName
1696
+ };
1697
+ }
1698
+ function SkillProgressLines({
1699
+ entries,
1700
+ mode,
1701
+ maxVisible = SKILL_PROGRESS_TAIL_LINES,
1702
+ onExpand
1703
+ }) {
1704
+ if (entries.length === 0) {
1705
+ return /* @__PURE__ */ jsx11("div", { className: "lax-skill-progress", "data-testid": "lax-skill-progress-initializing", children: /* @__PURE__ */ jsxs8("div", { className: "lax-agent-progress__line", children: [
1706
+ /* @__PURE__ */ jsx11("span", { className: "lax-agent-progress__gutter", "aria-hidden": true, children: AGENT_PROGRESS_GUTTER }),
1707
+ /* @__PURE__ */ jsx11("span", { className: "lax-agent-progress__text lax-skill-progress__initializing", children: SKILL_FORK_INITIALIZING })
1708
+ ] }) });
1709
+ }
1710
+ const allLines = renderTranscriptLaneLines(entries.map(toTranscriptEntry));
1711
+ const limit = mode === "full" ? allLines.length : maxVisible;
1712
+ const visible = allLines.slice(-limit);
1713
+ const hiddenCount = allLines.length - visible.length;
1714
+ return /* @__PURE__ */ jsxs8("div", { className: "lax-skill-progress", "data-testid": "lax-skill-progress", children: [
1715
+ visible.map((line, index) => /* @__PURE__ */ jsxs8(
1716
+ "div",
1717
+ {
1718
+ className: "lax-agent-progress__line",
1719
+ children: [
1720
+ /* @__PURE__ */ jsx11("span", { className: "lax-agent-progress__gutter", "aria-hidden": true, children: AGENT_PROGRESS_GUTTER }),
1721
+ /* @__PURE__ */ jsx11("span", { className: "lax-agent-progress__text", children: line.text })
1722
+ ]
1723
+ },
1724
+ line.lineKey ?? `skill-progress-line:${index}`
1725
+ )),
1726
+ hiddenCount > 0 && mode !== "full" ? /* @__PURE__ */ jsxs8("div", { className: "lax-agent-progress__line lax-agent-progress__line--more", children: [
1727
+ /* @__PURE__ */ jsx11("span", { className: "lax-agent-progress__gutter", "aria-hidden": true, children: AGENT_PROGRESS_INDENT }),
1728
+ /* @__PURE__ */ jsxs8(
1729
+ "button",
1730
+ {
1731
+ type: "button",
1732
+ className: "lax-agent-progress__more",
1733
+ "aria-expanded": false,
1734
+ onClick: onExpand,
1735
+ children: [
1736
+ "+",
1737
+ hiddenCount,
1738
+ " more tool ",
1739
+ hiddenCount === 1 ? "use" : "uses"
1740
+ ]
1741
+ }
1742
+ )
1743
+ ] }) : null
1744
+ ] });
1745
+ }
1746
+
1645
1747
  // src/view/tools/skill/SkillToolBody.tsx
1646
- import { jsx as jsx11 } from "react/jsx-runtime";
1748
+ import { jsx as jsx12 } from "react/jsx-runtime";
1647
1749
  var MAX_BODY_LINES = 20;
1648
1750
  function SkillToolBody({
1751
+ input,
1649
1752
  result,
1650
1753
  bodyMode,
1651
- onBodyModeChange
1754
+ onBodyModeChange,
1755
+ status,
1756
+ skillProgressMessages
1652
1757
  }) {
1653
1758
  if (result?.error) {
1654
- return /* @__PURE__ */ jsx11("div", { className: "lax-tool-body lax-tool-body--skill", children: /* @__PURE__ */ jsx11("div", { className: "lax-tool-body__block", "data-variant": "error", children: /* @__PURE__ */ jsx11("pre", { className: "lax-tool-body__text", children: result.error.message }) }) });
1759
+ return /* @__PURE__ */ jsx12("div", { className: "lax-tool-body lax-tool-body--skill", children: /* @__PURE__ */ jsx12("div", { className: "lax-tool-body__block", "data-variant": "error", children: /* @__PURE__ */ jsx12("pre", { className: "lax-tool-body__text", children: result.error.message }) }) });
1760
+ }
1761
+ const display = result?.display;
1762
+ const forkExec = isSkillForkExecution(input, display);
1763
+ const forkDone = isSkillForkDoneResult(input, display);
1764
+ if (forkDone || forkExec && status === "done") {
1765
+ return /* @__PURE__ */ jsx12("div", { className: "lax-tool-body lax-tool-body--skill", "data-testid": "lax-skill-fork-done", children: /* @__PURE__ */ jsx12("div", { className: "lax-tool-body__block", "data-variant": "dim", children: /* @__PURE__ */ jsx12("pre", { className: "lax-tool-body__text", children: "Done" }) }) });
1766
+ }
1767
+ if (forkExec && status === "running") {
1768
+ return /* @__PURE__ */ jsx12("div", { className: "lax-tool-body lax-tool-body--skill lax-tool-body--skill-fork-running", children: /* @__PURE__ */ jsx12(
1769
+ SkillProgressLines,
1770
+ {
1771
+ entries: skillProgressMessages ?? [],
1772
+ mode: bodyMode,
1773
+ onExpand: () => onBodyModeChange?.("full")
1774
+ }
1775
+ ) });
1655
1776
  }
1656
1777
  const text = result?.summary?.trim() ?? "";
1657
1778
  if (!text) {
1658
- return /* @__PURE__ */ jsx11("div", { className: "lax-tool-body lax-tool-body--skill", children: /* @__PURE__ */ jsx11("div", { className: "lax-tool-body__block", "data-variant": "dim", children: /* @__PURE__ */ jsx11("pre", { className: "lax-tool-body__text", children: "(done)" }) }) });
1779
+ return /* @__PURE__ */ jsx12("div", { className: "lax-tool-body lax-tool-body--skill", children: /* @__PURE__ */ jsx12("div", { className: "lax-tool-body__block", "data-variant": "dim", children: /* @__PURE__ */ jsx12("pre", { className: "lax-tool-body__text", children: "(done)" }) }) });
1659
1780
  }
1660
1781
  const { text: truncated, truncated: was } = truncateLines(text, MAX_BODY_LINES);
1661
1782
  const bodyText = was ? `${truncated}
1662
1783
  \u2026 \u5DF2\u622A\u65AD` : truncated;
1663
- return /* @__PURE__ */ jsx11("div", { className: "lax-tool-body lax-tool-body--skill", children: /* @__PURE__ */ jsx11(
1784
+ return /* @__PURE__ */ jsx12("div", { className: "lax-tool-body lax-tool-body--skill", children: /* @__PURE__ */ jsx12(
1664
1785
  TruncatedContent,
1665
1786
  {
1666
1787
  text: bodyText,
@@ -1672,7 +1793,7 @@ function SkillToolBody({
1672
1793
  }
1673
1794
 
1674
1795
  // src/view/tools/webfetch/WebFetchToolBody.tsx
1675
- import { jsx as jsx12 } from "react/jsx-runtime";
1796
+ import { jsx as jsx13 } from "react/jsx-runtime";
1676
1797
  var RECEIVED_RE = /Received\s+.+/i;
1677
1798
  var MAX_BODY_LINES2 = 15;
1678
1799
  function buildWebFetchBody(result) {
@@ -1701,10 +1822,10 @@ function WebFetchToolBody({
1701
1822
  onBodyModeChange
1702
1823
  }) {
1703
1824
  if (result?.error) {
1704
- return /* @__PURE__ */ jsx12("div", { className: "lax-tool-body lax-tool-body--webfetch", children: /* @__PURE__ */ jsx12("div", { className: "lax-tool-body__block", "data-variant": "error", children: /* @__PURE__ */ jsx12("pre", { className: "lax-tool-body__text", children: result.error.message }) }) });
1825
+ return /* @__PURE__ */ jsx13("div", { className: "lax-tool-body lax-tool-body--webfetch", children: /* @__PURE__ */ jsx13("div", { className: "lax-tool-body__block", "data-variant": "error", children: /* @__PURE__ */ jsx13("pre", { className: "lax-tool-body__text", children: result.error.message }) }) });
1705
1826
  }
1706
1827
  const bodyText = buildWebFetchBody(result);
1707
- return /* @__PURE__ */ jsx12("div", { className: "lax-tool-body lax-tool-body--webfetch", children: /* @__PURE__ */ jsx12(
1828
+ return /* @__PURE__ */ jsx13("div", { className: "lax-tool-body lax-tool-body--webfetch", children: /* @__PURE__ */ jsx13(
1708
1829
  TruncatedContent,
1709
1830
  {
1710
1831
  text: bodyText,
@@ -1716,7 +1837,7 @@ function WebFetchToolBody({
1716
1837
  }
1717
1838
 
1718
1839
  // src/view/tools/websearch/WebSearchToolBody.tsx
1719
- import { jsx as jsx13 } from "react/jsx-runtime";
1840
+ import { jsx as jsx14 } from "react/jsx-runtime";
1720
1841
  var MAX_BODY_LINES3 = 15;
1721
1842
  function buildWebSearchBody(result) {
1722
1843
  const d = asDisplayRecord(result?.display);
@@ -1741,10 +1862,10 @@ function WebSearchToolBody({
1741
1862
  onBodyModeChange
1742
1863
  }) {
1743
1864
  if (result?.error) {
1744
- return /* @__PURE__ */ jsx13("div", { className: "lax-tool-body lax-tool-body--websearch", children: /* @__PURE__ */ jsx13("div", { className: "lax-tool-body__block", "data-variant": "error", children: /* @__PURE__ */ jsx13("pre", { className: "lax-tool-body__text", children: result.error.message }) }) });
1865
+ return /* @__PURE__ */ jsx14("div", { className: "lax-tool-body lax-tool-body--websearch", children: /* @__PURE__ */ jsx14("div", { className: "lax-tool-body__block", "data-variant": "error", children: /* @__PURE__ */ jsx14("pre", { className: "lax-tool-body__text", children: result.error.message }) }) });
1745
1866
  }
1746
1867
  const bodyText = buildWebSearchBody(result);
1747
- return /* @__PURE__ */ jsx13("div", { className: "lax-tool-body lax-tool-body--websearch", children: /* @__PURE__ */ jsx13(
1868
+ return /* @__PURE__ */ jsx14("div", { className: "lax-tool-body lax-tool-body--websearch", children: /* @__PURE__ */ jsx14(
1748
1869
  TruncatedContent,
1749
1870
  {
1750
1871
  text: bodyText,
@@ -1756,7 +1877,7 @@ function WebSearchToolBody({
1756
1877
  }
1757
1878
 
1758
1879
  // src/view/tools/write/WriteToolBody.tsx
1759
- import { jsx as jsx14 } from "react/jsx-runtime";
1880
+ import { jsx as jsx15 } from "react/jsx-runtime";
1760
1881
  function buildWriteBodyText(input, display, summary) {
1761
1882
  const d = asDisplayRecord(display);
1762
1883
  const inp = asInputRecord(input);
@@ -1798,7 +1919,7 @@ function WriteToolBody({
1798
1919
  onBodyModeChange
1799
1920
  }) {
1800
1921
  if (result?.error) {
1801
- return /* @__PURE__ */ jsx14("div", { className: "lax-tool-body lax-tool-body--write", children: /* @__PURE__ */ jsx14("div", { className: "lax-tool-body__block", "data-variant": "error", children: /* @__PURE__ */ jsx14("pre", { className: "lax-tool-body__text", children: result.error.message }) }) });
1922
+ return /* @__PURE__ */ jsx15("div", { className: "lax-tool-body lax-tool-body--write", children: /* @__PURE__ */ jsx15("div", { className: "lax-tool-body__block", "data-variant": "error", children: /* @__PURE__ */ jsx15("pre", { className: "lax-tool-body__text", children: result.error.message }) }) });
1802
1923
  }
1803
1924
  const body = buildWriteBodyText(
1804
1925
  input,
@@ -1806,7 +1927,7 @@ function WriteToolBody({
1806
1927
  result?.summary ?? ""
1807
1928
  );
1808
1929
  if (body.kind === "diff") {
1809
- return /* @__PURE__ */ jsx14("div", { className: "lax-tool-body lax-tool-body--write", children: /* @__PURE__ */ jsx14(
1930
+ return /* @__PURE__ */ jsx15("div", { className: "lax-tool-body lax-tool-body--write", children: /* @__PURE__ */ jsx15(
1810
1931
  DiffView,
1811
1932
  {
1812
1933
  diff: body.text,
@@ -1815,7 +1936,7 @@ function WriteToolBody({
1815
1936
  }
1816
1937
  ) });
1817
1938
  }
1818
- return /* @__PURE__ */ jsx14("div", { className: "lax-tool-body lax-tool-body--write", children: /* @__PURE__ */ jsx14(
1939
+ return /* @__PURE__ */ jsx15("div", { className: "lax-tool-body lax-tool-body--write", children: /* @__PURE__ */ jsx15(
1819
1940
  TruncatedContent,
1820
1941
  {
1821
1942
  text: body.text,
@@ -1893,6 +2014,7 @@ export {
1893
2014
  GlobToolBody,
1894
2015
  GrepToolBody,
1895
2016
  ReadToolBody,
2017
+ isSkillForkExecution,
1896
2018
  SkillToolBody,
1897
2019
  WebFetchToolBody,
1898
2020
  WebSearchToolBody,
@@ -1900,4 +2022,4 @@ export {
1900
2022
  ToolDisplayRegistry,
1901
2023
  createDefaultToolRegistry
1902
2024
  };
1903
- //# sourceMappingURL=chunk-Z5EWWIP3.js.map
2025
+ //# sourceMappingURL=chunk-BAMDIFNS.js.map