@streamoid/agent 0.10.3 → 0.10.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.
- package/dist/index.js +77 -38
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -63625,6 +63625,12 @@ function ActivityBlock({
|
|
|
63625
63625
|
}
|
|
63626
63626
|
);
|
|
63627
63627
|
}
|
|
63628
|
+
function waitingActivity(e, t) {
|
|
63629
|
+
const n = (t ?? 0) >= 30;
|
|
63630
|
+
if (e === 0) return n ? "Still working out how to answer" : "Working out how to answer";
|
|
63631
|
+
const s = `${e} ${e === 1 ? "step" : "steps"} done`;
|
|
63632
|
+
return n ? `${s} · reasoning over the results` : `${s} · deciding what to do next`;
|
|
63633
|
+
}
|
|
63628
63634
|
function formatSubAgentLabel(e) {
|
|
63629
63635
|
const t = (e ?? "").trim().replace(/\b\w/g, (n) => n.toUpperCase()).replace(/\s+Agent$/i, "").trim();
|
|
63630
63636
|
return t ? `Using ${t}...` : "Using a sub-agent...";
|
|
@@ -63901,21 +63907,24 @@ function AgentStepsImpl({
|
|
|
63901
63907
|
settledDuration: l
|
|
63902
63908
|
}) {
|
|
63903
63909
|
const c = useMemo(() => {
|
|
63904
|
-
const
|
|
63910
|
+
const Q = parseSteps(e, s);
|
|
63905
63911
|
if (n)
|
|
63906
|
-
for (const
|
|
63907
|
-
|
|
63908
|
-
return t ||
|
|
63909
|
-
|
|
63910
|
-
}),
|
|
63911
|
-
}, [e, t, n, s]);
|
|
63912
|
+
for (const ne of Q)
|
|
63913
|
+
ne.kind === "step" && ne.status === "pending" && ne.key && n.has(ne.key) && (ne.status = "completed");
|
|
63914
|
+
return t || Q.forEach((ne) => {
|
|
63915
|
+
ne.kind === "step" && ne.status === "pending" && (ne.status = "completed");
|
|
63916
|
+
}), Q;
|
|
63917
|
+
}, [e, t, n, s]), d = useElapsedSeconds(o ?? null, t);
|
|
63912
63918
|
if (c.length === 0 && !t) return null;
|
|
63913
|
-
const
|
|
63914
|
-
|
|
63915
|
-
|
|
63916
|
-
|
|
63917
|
-
|
|
63918
|
-
|
|
63919
|
+
const h = groupIntoLanes(c), v = h[h.length - 1]?.agentLabel ?? null, N = [...c].reverse().find((Q) => Q.kind === "step" && Q.status === "pending")?.message ?? waitingActivity(
|
|
63920
|
+
c.filter((Q) => Q.kind === "step" && Q.status === "completed").length,
|
|
63921
|
+
d
|
|
63922
|
+
), T = c.filter((Q) => Q.kind === "step").length, j = c.findIndex((Q) => Q.kind === "step"), I = new Set(
|
|
63923
|
+
j === -1 ? c : c.slice(0, j)
|
|
63924
|
+
), P = (Q, ne) => {
|
|
63925
|
+
const $e = Q.items.filter(ne);
|
|
63926
|
+
return $e.length > 0 ? { ...Q, items: $e } : null;
|
|
63927
|
+
}, F = h.map((Q) => P(Q, (ne) => I.has(ne))).filter((Q) => Q !== null), Z = h.map((Q) => P(Q, (ne) => !I.has(ne))).filter((Q) => Q !== null);
|
|
63919
63928
|
return (
|
|
63920
63929
|
/* `sa-trace-block` zeroes the 4px when the trace is the row's FIRST child --
|
|
63921
63930
|
* see index.css. Written as a rule rather than `first:mt-0` because our
|
|
@@ -63928,32 +63937,32 @@ function AgentStepsImpl({
|
|
|
63928
63937
|
className: "sa-trace-block max-w-full mt-[4px] flex flex-col gap-1",
|
|
63929
63938
|
transition: stepsTransition,
|
|
63930
63939
|
children: [
|
|
63931
|
-
|
|
63940
|
+
F.map((Q, ne) => /* @__PURE__ */ jsx(
|
|
63932
63941
|
AgentLane,
|
|
63933
63942
|
{
|
|
63934
|
-
lane:
|
|
63943
|
+
lane: Q,
|
|
63935
63944
|
animateIn: t,
|
|
63936
|
-
showHeader:
|
|
63945
|
+
showHeader: Q.agentName !== null && F[ne - 1]?.agentName !== Q.agentName
|
|
63937
63946
|
},
|
|
63938
|
-
|
|
63947
|
+
Q.key
|
|
63939
63948
|
)),
|
|
63940
63949
|
/* @__PURE__ */ jsx(
|
|
63941
63950
|
ActivityBlock,
|
|
63942
63951
|
{
|
|
63943
|
-
agent:
|
|
63944
|
-
activity:
|
|
63952
|
+
agent: v,
|
|
63953
|
+
activity: N,
|
|
63945
63954
|
startedAt: o ?? null,
|
|
63946
63955
|
isLoading: t,
|
|
63947
63956
|
settledDuration: l ?? null,
|
|
63948
|
-
stepCount:
|
|
63949
|
-
children:
|
|
63957
|
+
stepCount: T,
|
|
63958
|
+
children: Z.map((Q, ne) => /* @__PURE__ */ jsx(
|
|
63950
63959
|
AgentLane,
|
|
63951
63960
|
{
|
|
63952
|
-
lane:
|
|
63961
|
+
lane: Q,
|
|
63953
63962
|
animateIn: t,
|
|
63954
|
-
showHeader:
|
|
63963
|
+
showHeader: Q.agentName !== null && Z[ne - 1]?.agentName !== Q.agentName
|
|
63955
63964
|
},
|
|
63956
|
-
|
|
63965
|
+
Q.key
|
|
63957
63966
|
))
|
|
63958
63967
|
}
|
|
63959
63968
|
)
|
|
@@ -72825,6 +72834,10 @@ function CodeBlock({ node: e, children: t, ...n }) {
|
|
|
72825
72834
|
/* @__PURE__ */ jsx("pre", { ref: g, ...n, children: t })
|
|
72826
72835
|
] });
|
|
72827
72836
|
}
|
|
72837
|
+
const FIGURE = /^[\s(+\-−~≈]*[₹$€£¥]?\s*\d[\d.,]*\s*(%|pp|x|×|k|K|M|B|L|Cr|lakh|crore)?\)?\s*$/;
|
|
72838
|
+
function isFigure(e) {
|
|
72839
|
+
return !!e && e.trim().length <= 24 && FIGURE.test(e.trim());
|
|
72840
|
+
}
|
|
72828
72841
|
const createStoreImpl = (e) => {
|
|
72829
72842
|
let t;
|
|
72830
72843
|
const n = /* @__PURE__ */ new Set(), s = (g, v) => {
|
|
@@ -73672,29 +73685,55 @@ function MarkdownLink({ node: e, href: t, children: n, ...s }) {
|
|
|
73672
73685
|
);
|
|
73673
73686
|
}
|
|
73674
73687
|
function MarkdownTableWrapper({ node: e, children: t, ...n }) {
|
|
73675
|
-
|
|
73688
|
+
const s = useRef(null), [o, l] = useState(!1), [c, d] = useState(!1);
|
|
73689
|
+
return useLayoutEffect(() => {
|
|
73690
|
+
const h = s.current;
|
|
73691
|
+
if (!h) return;
|
|
73692
|
+
const g = () => l(h.scrollWidth > h.clientWidth + 1);
|
|
73693
|
+
if (g(), typeof ResizeObserver > "u") return;
|
|
73694
|
+
const v = new ResizeObserver(g);
|
|
73695
|
+
return v.observe(h), () => v.disconnect();
|
|
73696
|
+
}, [t]), /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73697
|
+
/* @__PURE__ */ jsx("div", { ref: s, className: "md-table-wrap", children: /* @__PURE__ */ jsx("table", { ...n, children: t }) }),
|
|
73698
|
+
o && /* @__PURE__ */ jsxs(
|
|
73699
|
+
"button",
|
|
73700
|
+
{
|
|
73701
|
+
type: "button",
|
|
73702
|
+
className: "md-cell-toggle md-table-expand",
|
|
73703
|
+
onClick: () => d(!0),
|
|
73704
|
+
"aria-label": "Expand table to see every column",
|
|
73705
|
+
children: [
|
|
73706
|
+
/* @__PURE__ */ jsx(Maximize2$2, { className: "md-cell-toggle-icon", "aria-hidden": "true" }),
|
|
73707
|
+
"Expand table"
|
|
73708
|
+
]
|
|
73709
|
+
}
|
|
73710
|
+
),
|
|
73711
|
+
c && /* @__PURE__ */ jsx(CellModal, { onClose: () => d(!1), title: "Table", wide: !0, children: /* @__PURE__ */ jsx("div", { className: "md-table-wrap", children: /* @__PURE__ */ jsx("table", { ...n, children: t }) }) })
|
|
73712
|
+
] });
|
|
73676
73713
|
}
|
|
73677
73714
|
function CellModal({
|
|
73678
73715
|
children: e,
|
|
73679
|
-
onClose: t
|
|
73716
|
+
onClose: t,
|
|
73717
|
+
title: n = "Cell value",
|
|
73718
|
+
wide: s = !1
|
|
73680
73719
|
}) {
|
|
73681
73720
|
return useEffect(() => {
|
|
73682
|
-
const
|
|
73683
|
-
|
|
73721
|
+
const o = (l) => {
|
|
73722
|
+
l.key === "Escape" && t();
|
|
73684
73723
|
};
|
|
73685
|
-
return window.addEventListener("keydown",
|
|
73724
|
+
return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
|
|
73686
73725
|
}, [t]), createPortal(
|
|
73687
73726
|
/* @__PURE__ */ jsx("div", { className: "sa-surface md-cell-modal-overlay", onClick: t, children: /* @__PURE__ */ jsxs(
|
|
73688
73727
|
"div",
|
|
73689
73728
|
{
|
|
73690
|
-
className: "md-cell-modal",
|
|
73729
|
+
className: s ? "md-cell-modal md-cell-modal-wide" : "md-cell-modal",
|
|
73691
73730
|
role: "dialog",
|
|
73692
73731
|
"aria-modal": "true",
|
|
73693
|
-
"aria-label":
|
|
73694
|
-
onClick: (
|
|
73732
|
+
"aria-label": n,
|
|
73733
|
+
onClick: (o) => o.stopPropagation(),
|
|
73695
73734
|
children: [
|
|
73696
73735
|
/* @__PURE__ */ jsxs("div", { className: "md-cell-modal-header", children: [
|
|
73697
|
-
/* @__PURE__ */ jsx("span", { className: "md-cell-modal-title", children:
|
|
73736
|
+
/* @__PURE__ */ jsx("span", { className: "md-cell-modal-title", children: n }),
|
|
73698
73737
|
/* @__PURE__ */ jsx(
|
|
73699
73738
|
"button",
|
|
73700
73739
|
{
|
|
@@ -73719,16 +73758,16 @@ function ExpandableCell({
|
|
|
73719
73758
|
children: n,
|
|
73720
73759
|
...s
|
|
73721
73760
|
}) {
|
|
73722
|
-
const [o, l] = useState(!1), [c, d] = useState(!1), h = useRef(null);
|
|
73761
|
+
const [o, l] = useState(!1), [c, d] = useState(!1), [h, g] = useState(!1), v = useRef(null);
|
|
73723
73762
|
return useLayoutEffect(() => {
|
|
73724
|
-
const
|
|
73725
|
-
|
|
73763
|
+
const N = v.current;
|
|
73764
|
+
N && (d(N.scrollHeight > N.clientHeight + 1), g(isFigure(N.textContent)));
|
|
73726
73765
|
}, [n]), /* @__PURE__ */ jsxs(e, { ...s, children: [
|
|
73727
73766
|
/* @__PURE__ */ jsx(
|
|
73728
73767
|
"div",
|
|
73729
73768
|
{
|
|
73730
|
-
ref:
|
|
73731
|
-
className: "md-cell md-cell-clamped",
|
|
73769
|
+
ref: v,
|
|
73770
|
+
className: h ? "md-cell md-cell-clamped md-cell-figure" : "md-cell md-cell-clamped",
|
|
73732
73771
|
style: { WebkitLineClamp: CLAMP_LINES },
|
|
73733
73772
|
children: n
|
|
73734
73773
|
}
|