@tangle-network/sandbox-ui 6.0.1 → 7.0.1

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.
Files changed (31) hide show
  1. package/README.md +8 -0
  2. package/dist/{AgentTree-D4d06rfH.js → AgentTree-Dzy6lrfP.js} +1 -1
  3. package/dist/{ResearchReport-D1TFmldm.js → ResearchReport-DKWDmzdK.js} +2 -2
  4. package/dist/{chat-BrlLa4rg.js → chat-B_5Lwevm.js} +2 -2
  5. package/dist/chat.d.ts +1 -1
  6. package/dist/chat.js +1 -1
  7. package/dist/globals.css +1562 -6987
  8. package/dist/{index-5zOVKgDT.d.ts → index-1Q4Jtlic.d.ts} +2 -2
  9. package/dist/{index-D6fZ1Hgz.d.ts → index-PolYo7h9.d.ts} +11 -6
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.js +6 -6
  12. package/dist/record/ResearchReport.js +1 -1
  13. package/dist/{record-C-EUpK-n.js → record-Cc_WNtG8.js} +2 -2
  14. package/dist/record.js +1 -1
  15. package/dist/report-viewer.js +90 -90
  16. package/dist/run/live.js +1 -1
  17. package/dist/run/record.js +3 -3
  18. package/dist/run-DBHKEnV_.js +5 -0
  19. package/dist/run.d.ts +1 -1
  20. package/dist/run.js +5 -5
  21. package/dist/runtime-viewer/AgentGraphCanvas-xHVW-YRV-Ch1fnK9k.js +957 -0
  22. package/dist/runtime-viewer/latest-events-CMbdBLcT-uhVN4JLh.js +17401 -0
  23. package/dist/styles.css +1562 -6990
  24. package/dist/tailwind.css +824 -7407
  25. package/dist/{trace-workspace-Cfil2Ma9.js → trace-workspace-B7Ht17Nh.js} +406 -133
  26. package/dist/{use-follow-tail-DZFn7QDO.js → use-follow-tail-Df965WQi.js} +46 -11
  27. package/dist/workspace-viewer.js +10386 -10180
  28. package/package.json +3 -3
  29. package/dist/runtime-viewer/AgentGraphCanvas-DGq7_u8--C6yDfIUT.js +0 -8555
  30. package/dist/runtime-viewer/latest-events-CRq9sGkK-CfoBl1dP.js +0 -9592
  31. package/dist/runtime-viewer/sandbox-ui-BEziPi7D.css +0 -2
@@ -3,7 +3,8 @@ import { HoverCard, HoverCardContent, HoverCardTrigger } from "@tangle-network/u
3
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
4
  import { Brain, Settings, Timer } from "lucide-react";
5
5
  import { getToolCategory, getToolDisplayMetadata } from "@tangle-network/ui/utils";
6
- import { formatCompact, formatCompact as fmt, formatCost, formatSpanDuration, formatSpanDuration as interval, formatUtcTime as utcTime, reportedCount, sumReportedCounts } from "@tangle-network/charts";
6
+ import { toolLabel } from "@tangle-network/charts/react/agent-graph";
7
+ import { formatCompact, formatCompact as fmt, formatCost as formatCost$1, formatSpanDuration as formatSpanDuration$1, formatSpanDuration as interval, formatUtcTime as utcTime, reportedCount, sumReportedCounts } from "@tangle-network/charts";
7
8
  import { AgentTimelineStep, agentTimelineStepKind } from "@tangle-network/ui/chat/agent-timeline";
8
9
  import { SpeakerHeader } from "@tangle-network/ui/chat/speaker";
9
10
  import { ExpandedToolDetail } from "@tangle-network/ui/run/expanded-tool-detail";
@@ -747,12 +748,12 @@ function ToolStep({ item, previous }) {
747
748
  /* @__PURE__ */ jsx("dt", { children: "Duration" }),
748
749
  /* @__PURE__ */ jsx("dd", {
749
750
  className: "m-0 text-right",
750
- children: time?.end != null && time.start != null ? formatSpanDuration(time.end - time.start) : "Not recorded"
751
+ children: time?.end != null && time.start != null ? formatSpanDuration$1(time.end - time.start) : "Not recorded"
751
752
  }),
752
753
  /* @__PURE__ */ jsx("dt", { children: "Cost" }),
753
754
  /* @__PURE__ */ jsx("dd", {
754
755
  className: "m-0 text-right",
755
- children: typeof cost === "number" ? formatCost(cost) : "Not recorded"
756
+ children: typeof cost === "number" ? formatCost$1(cost) : "Not recorded"
756
757
  })
757
758
  ]
758
759
  }),
@@ -853,7 +854,7 @@ function toolItem(id, call, output, state, durationMs, live, cost) {
853
854
  }
854
855
  };
855
856
  const known = KIT_TOOLS.has(name.toLowerCase()), meta = getToolDisplayMetadata(part);
856
- const detail = argsLabel(call.input) ?? (meta.description || (known ? void 0 : preview(call)));
857
+ const detail = argsLabel(call.input) ?? (known && meta.description || void 0);
857
858
  return {
858
859
  id,
859
860
  kind: "tool",
@@ -861,7 +862,7 @@ function toolItem(id, call, output, state, durationMs, live, cost) {
861
862
  call: {
862
863
  id,
863
864
  type: TYPES[name.toLowerCase()] ?? "unknown",
864
- label: known ? meta.title : name.replaceAll("_", " "),
865
+ label: known ? meta.title : toolLabel(name),
865
866
  status: status === "error" ? "error" : status === "running" ? "running" : "success",
866
867
  ...detail ? { detail } : {},
867
868
  ...duration !== void 0 ? { duration } : {}
@@ -907,7 +908,7 @@ function timelineItems(entries, streaming, opened) {
907
908
  key: events[0].id,
908
909
  events
909
910
  }));
910
- return rows.map((row, index) => {
911
+ return foldTools(rows.map((row, index) => {
911
912
  const entry = row.kind === "event" ? row.event : row.events[0];
912
913
  if (row.kind === "idle") return idleItem(entry.id, row.events.map((event) => ({
913
914
  id: event.id,
@@ -923,7 +924,10 @@ function timelineItems(entries, streaming, opened) {
923
924
  role: entry.role,
924
925
  content: short ? `${body.slice(0, 280).trimEnd()}…` : body,
925
926
  isStreaming: streaming && index === rows.length - 1,
926
- ...entry.role === "user" && Number.isFinite(entry.at) ? { timestamp: new Date(entry.at) } : {}
927
+ ...entry.role === "user" ? {
928
+ ...opened ? {} : { collapsedLines: 6 },
929
+ ...Number.isFinite(entry.at) ? { timestamp: new Date(entry.at) } : {}
930
+ } : {}
927
931
  };
928
932
  }
929
933
  if (entry.kind === "tool") return toolItem(entry.id, {
@@ -947,7 +951,7 @@ function timelineItems(entries, streaming, opened) {
947
951
  })
948
952
  };
949
953
  return {
950
- id: entry.id,
954
+ id: `reasoning:${entry.id}`,
951
955
  kind: "custom",
952
956
  content: /* @__PURE__ */ jsx(InlineThinkingItem, {
953
957
  part: {
@@ -958,11 +962,42 @@ function timelineItems(entries, streaming, opened) {
958
962
  openWhileActive: false
959
963
  })
960
964
  };
961
- });
965
+ }), streaming);
966
+ }
967
+ /** Back-to-back tool calls (and the reasoning between them) fold into one row that names them, "Ran 6 tools · Read ×3,
968
+ * knowledge record"; their arguments and results open with it, so the agent's own words stay the conversation. A live
969
+ * agent's newest call stays its own row so the reader sees what is running now. */
970
+ function foldTools(items, streaming) {
971
+ const out = [];
972
+ let run = [];
973
+ const flush = (last) => {
974
+ const open = last && streaming ? run.splice(-1) : [];
975
+ const tools = run.filter((item) => item.kind === "tool");
976
+ if (tools.length > 1) {
977
+ const counts = /* @__PURE__ */ new Map();
978
+ for (const tool of tools) counts.set(tool.call.label, (counts.get(tool.call.label) ?? 0) + 1);
979
+ const names = [...counts].map(([name, n]) => n > 1 ? `${name} ×${n}` : name), more = names.length - 3;
980
+ out.push({
981
+ id: `fold:${run[0].id}`,
982
+ kind: "fold",
983
+ items: run,
984
+ summary: `Ran ${tools.length} tools · ${names.slice(0, 3).join(", ")}${more > 0 ? ` +${more} more` : ""}`
985
+ });
986
+ } else out.push(...run);
987
+ out.push(...open);
988
+ run = [];
989
+ };
990
+ for (const item of items) if (item.kind === "tool" || item.kind === "custom" && item.id.startsWith("reasoning:")) run.push(item);
991
+ else {
992
+ flush(false);
993
+ out.push(item);
994
+ }
995
+ flush(true);
996
+ return out;
962
997
  }
963
998
  const toolNote = (part) => {
964
999
  const note = part.state.metadata?.note, time = part.state.time;
965
- const duration = time?.end != null && time.start != null ? formatSpanDuration(time.end - time.start) : "Not recorded";
1000
+ const duration = time?.end != null && time.start != null ? formatSpanDuration$1(time.end - time.start) : "Not recorded";
966
1001
  const result = typeof note === "string" ? note : part.state.status === "error" ? "Failed" : part.state.status === "running" ? "Running" : "Returned";
967
1002
  return /* @__PURE__ */ jsxs("span", {
968
1003
  "data-record-tool-summary": "",
@@ -1116,7 +1151,7 @@ function rowItems(row, context) {
1116
1151
  if (withheld.length) {
1117
1152
  const output = outputTokens(event.detail);
1118
1153
  const span = thinkingSpan.get(event.id);
1119
- const label = output !== null ? `${span !== void 0 && span >= 1e3 ? `for ${formatSpanDuration(span)} · ` : ""}${formatCompact(output)} output tokens · ${withheld.join(" · ")}` : withheld.join(" · ");
1154
+ const label = output !== null ? `${span !== void 0 && span >= 1e3 ? `for ${formatSpanDuration$1(span)} · ` : ""}${formatCompact(output)} output tokens · ${withheld.join(" · ")}` : withheld.join(" · ");
1120
1155
  items.push({
1121
1156
  id: `${event.id}:thinking`,
1122
1157
  kind: "custom",