@workflow/web 5.3.1 → 5.3.2
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/README.md +11 -34
- package/build/client/assets/app-BHCSMHev.css +1 -0
- package/build/client/assets/{arrow-up-right-CNHh1bh2.js → arrow-up-right-DyaB_ak4.js} +1 -1
- package/build/client/assets/{entry.client-DDsh88VE.js → entry.client-xzxVCL3o.js} +1 -1
- package/build/client/assets/{highlighted-body-JLMTFACH-CWHg5f-6.js → highlighted-body-JLMTFACH-1yzOVKg0.js} +2 -2
- package/build/client/assets/{home-DZqYMSiD.js → home--wf0CrF6.js} +5 -3
- package/build/client/assets/{index-BS6T0Zjc.js → index-wl5l5E8H.js} +30 -25
- package/build/client/assets/manifest-7b81d8d4.js +1 -0
- package/build/client/assets/{mermaid-WFAXDIZX-BLO7Z8RE.js → mermaid-WFAXDIZX-CB__BxYb.js} +272 -2736
- package/build/client/assets/meta-9cjJ0pVb.js +6 -0
- package/build/client/assets/{root-wdKzRZGT.js → root-C1XwTNUK.js} +14 -8
- package/build/client/assets/root-C3ED6Dwc.css +1 -0
- package/build/client/assets/rpc-client-SbyXJdFV.js +2482 -0
- package/build/client/assets/{run-detail-DyXpnv9C.js → run-detail-2CnpdXm1.js} +426 -618
- package/build/client/assets/run-usage-C3aywyqa.js +33 -0
- package/build/client/assets/run-usage-DRV6lopZ.js +1261 -0
- package/build/client/assets/skeleton-DMLgjvZZ.js +94 -0
- package/build/client/assets/{url-state-DhOv2zv0.js → url-state-JAVaNZ_m.js} +79 -159
- package/build/client/assets/{zstd-browser-decoder-BNeg7hxG.js → zstd-browser-decoder-Z5736ep5.js} +2 -2
- package/build/server/assets/{app-CNGxG3wL.js → app-C4Vf0mu1.js} +2256 -470
- package/build/server/assets/{highlighted-body-JLMTFACH-Bj8JsfUl.js → highlighted-body-JLMTFACH-CF_5tt3-.js} +1 -1
- package/build/server/assets/{index-DGn_6xEN.js → index-BrYeW--s.js} +4 -4
- package/build/server/assets/{mermaid-WFAXDIZX-C_v93dNU.js → mermaid-WFAXDIZX-BHZz_uL6.js} +1 -1
- package/build/server/assets/{token-b1ZjKN2Q.js → token-B94O3LuJ.js} +1 -1
- package/build/server/assets/{token-5fcfNNDG.js → token-k0na1G9v.js} +2 -2
- package/build/server/assets/{token-util-BJhEZw83.js → token-util-DFlzY9Hw.js} +2 -2
- package/build/server/assets/{token-util-spPPOelu.js → token-util-DgTmPzWb.js} +1 -1
- package/build/server/assets/{wrapper-Cc-ChiPM.js → wrapper-BEqyNEir.js} +2 -2
- package/build/server/assets/{zstd-browser-decoder-y4X_FyMk.js → zstd-browser-decoder-LnaKiDUZ.js} +1 -1
- package/build/server/index.js +1 -1
- package/handler.d.ts +9 -0
- package/handler.js +16 -2
- package/host-guard.js +179 -0
- package/package.json +8 -7
- package/server.d.ts +15 -1
- package/server.js +14 -1
- package/build/client/assets/app-BE8uqS_d.css +0 -1
- package/build/client/assets/manifest-f2e93220.js +0 -1
- package/build/client/assets/root-BBptRWmF.css +0 -1
|
@@ -1841,24 +1841,24 @@ function flattenAndRankRoutes(routes2) {
|
|
|
1841
1841
|
}
|
|
1842
1842
|
function flattenRoutes(routes2, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
|
1843
1843
|
let flattenRoute = (route, index2, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
|
1844
|
-
let
|
|
1844
|
+
let meta2 = {
|
|
1845
1845
|
relativePath: relativePath === void 0 ? route.path || "" : relativePath,
|
|
1846
1846
|
caseSensitive: route.caseSensitive === true,
|
|
1847
1847
|
childrenIndex: index2,
|
|
1848
1848
|
route
|
|
1849
1849
|
};
|
|
1850
|
-
if (
|
|
1851
|
-
if (!
|
|
1850
|
+
if (meta2.relativePath.startsWith("/")) {
|
|
1851
|
+
if (!meta2.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
|
|
1852
1852
|
return;
|
|
1853
1853
|
}
|
|
1854
1854
|
invariant$1(
|
|
1855
|
-
|
|
1856
|
-
`Absolute route path "${
|
|
1855
|
+
meta2.relativePath.startsWith(parentPath),
|
|
1856
|
+
`Absolute route path "${meta2.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
|
|
1857
1857
|
);
|
|
1858
|
-
|
|
1858
|
+
meta2.relativePath = meta2.relativePath.slice(parentPath.length);
|
|
1859
1859
|
}
|
|
1860
|
-
let path2 = joinPaths([parentPath,
|
|
1861
|
-
let routesMeta = parentsMeta.concat(
|
|
1860
|
+
let path2 = joinPaths([parentPath, meta2.relativePath]);
|
|
1861
|
+
let routesMeta = parentsMeta.concat(meta2);
|
|
1862
1862
|
if (route.children && route.children.length > 0) {
|
|
1863
1863
|
invariant$1(
|
|
1864
1864
|
// Our types know better, but runtime JS may not!
|
|
@@ -1880,14 +1880,14 @@ function flattenRoutes(routes2, branches = [], parentsMeta = [], parentPath = ""
|
|
|
1880
1880
|
branches.push({
|
|
1881
1881
|
path: path2,
|
|
1882
1882
|
score: computeScore(path2, route.index),
|
|
1883
|
-
routesMeta: routesMeta.map((
|
|
1883
|
+
routesMeta: routesMeta.map((meta22, i) => {
|
|
1884
1884
|
let [matcher2, params] = compilePath(
|
|
1885
|
-
|
|
1886
|
-
|
|
1885
|
+
meta22.relativePath,
|
|
1886
|
+
meta22.caseSensitive,
|
|
1887
1887
|
i === routesMeta.length - 1
|
|
1888
1888
|
);
|
|
1889
1889
|
return {
|
|
1890
|
-
...
|
|
1890
|
+
...meta22,
|
|
1891
1891
|
matcher: matcher2,
|
|
1892
1892
|
compiledParams: params
|
|
1893
1893
|
};
|
|
@@ -1932,8 +1932,8 @@ function explodeOptionalSegments(path2) {
|
|
|
1932
1932
|
function rankRouteBranches(branches) {
|
|
1933
1933
|
branches.sort(
|
|
1934
1934
|
(a2, b2) => a2.score !== b2.score ? b2.score - a2.score : compareIndexes(
|
|
1935
|
-
a2.routesMeta.map((
|
|
1936
|
-
b2.routesMeta.map((
|
|
1935
|
+
a2.routesMeta.map((meta2) => meta2.childrenIndex),
|
|
1936
|
+
b2.routesMeta.map((meta2) => meta2.childrenIndex)
|
|
1937
1937
|
)
|
|
1938
1938
|
);
|
|
1939
1939
|
}
|
|
@@ -1978,29 +1978,29 @@ function matchRouteBranch(branch, pathname, allowPartial = false) {
|
|
|
1978
1978
|
let matchedPathname = "/";
|
|
1979
1979
|
let matches = [];
|
|
1980
1980
|
for (let i = 0; i < routesMeta.length; ++i) {
|
|
1981
|
-
let
|
|
1981
|
+
let meta2 = routesMeta[i];
|
|
1982
1982
|
let end = i === routesMeta.length - 1;
|
|
1983
1983
|
let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
|
|
1984
1984
|
let pattern2 = {
|
|
1985
|
-
path:
|
|
1986
|
-
caseSensitive:
|
|
1985
|
+
path: meta2.relativePath,
|
|
1986
|
+
caseSensitive: meta2.caseSensitive,
|
|
1987
1987
|
end
|
|
1988
1988
|
};
|
|
1989
1989
|
let match2 = (
|
|
1990
1990
|
// Use precomputed matcher if it exists
|
|
1991
|
-
|
|
1991
|
+
meta2.matcher && meta2.compiledParams ? matchPathImpl(
|
|
1992
1992
|
pattern2,
|
|
1993
1993
|
remainingPathname,
|
|
1994
|
-
|
|
1995
|
-
|
|
1994
|
+
meta2.matcher,
|
|
1995
|
+
meta2.compiledParams
|
|
1996
1996
|
) : matchPath(pattern2, remainingPathname)
|
|
1997
1997
|
);
|
|
1998
|
-
let route =
|
|
1998
|
+
let route = meta2.route;
|
|
1999
1999
|
if (!match2 && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
|
|
2000
2000
|
match2 = matchPath(
|
|
2001
2001
|
{
|
|
2002
|
-
path:
|
|
2003
|
-
caseSensitive:
|
|
2002
|
+
path: meta2.relativePath,
|
|
2003
|
+
caseSensitive: meta2.caseSensitive,
|
|
2004
2004
|
end: false
|
|
2005
2005
|
},
|
|
2006
2006
|
remainingPathname
|
|
@@ -4308,6 +4308,9 @@ function useNavigateUnstable() {
|
|
|
4308
4308
|
return navigate;
|
|
4309
4309
|
}
|
|
4310
4310
|
var OutletContext = reactExports.createContext(null);
|
|
4311
|
+
function useOutletContext() {
|
|
4312
|
+
return reactExports.useContext(OutletContext);
|
|
4313
|
+
}
|
|
4311
4314
|
function useOutlet(context) {
|
|
4312
4315
|
let outlet = reactExports.useContext(RouteContext).outlet;
|
|
4313
4316
|
return reactExports.useMemo(
|
|
@@ -6589,7 +6592,7 @@ function Meta() {
|
|
|
6589
6592
|
if (errors2) {
|
|
6590
6593
|
error2 = errors2[_matches[_matches.length - 1].route.id];
|
|
6591
6594
|
}
|
|
6592
|
-
let
|
|
6595
|
+
let meta2 = [];
|
|
6593
6596
|
let leafMeta = null;
|
|
6594
6597
|
let matches = [];
|
|
6595
6598
|
for (let i = 0; i < _matches.length; i++) {
|
|
@@ -6630,10 +6633,10 @@ function Meta() {
|
|
|
6630
6633
|
}
|
|
6631
6634
|
match2.meta = routeMeta;
|
|
6632
6635
|
matches[i] = match2;
|
|
6633
|
-
|
|
6634
|
-
leafMeta =
|
|
6636
|
+
meta2 = [...routeMeta];
|
|
6637
|
+
leafMeta = meta2;
|
|
6635
6638
|
}
|
|
6636
|
-
return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null,
|
|
6639
|
+
return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, meta2.flat().map((metaProps) => {
|
|
6637
6640
|
if (!metaProps) {
|
|
6638
6641
|
return null;
|
|
6639
6642
|
}
|
|
@@ -41716,7 +41719,7 @@ const createLucideIcon = (iconName, iconNode) => {
|
|
|
41716
41719
|
* This source code is licensed under the ISC license.
|
|
41717
41720
|
* See the LICENSE file in the root directory of this source tree.
|
|
41718
41721
|
*/
|
|
41719
|
-
const __iconNode$
|
|
41722
|
+
const __iconNode$L = [
|
|
41720
41723
|
[
|
|
41721
41724
|
"path",
|
|
41722
41725
|
{
|
|
@@ -41725,14 +41728,14 @@ const __iconNode$K = [
|
|
|
41725
41728
|
}
|
|
41726
41729
|
]
|
|
41727
41730
|
];
|
|
41728
|
-
const Activity = createLucideIcon("activity", __iconNode$
|
|
41731
|
+
const Activity = createLucideIcon("activity", __iconNode$L);
|
|
41729
41732
|
/**
|
|
41730
41733
|
* @license lucide-react v0.575.0 - ISC
|
|
41731
41734
|
*
|
|
41732
41735
|
* This source code is licensed under the ISC license.
|
|
41733
41736
|
* See the LICENSE file in the root directory of this source tree.
|
|
41734
41737
|
*/
|
|
41735
|
-
const __iconNode$
|
|
41738
|
+
const __iconNode$K = [
|
|
41736
41739
|
["path", { d: "M6.87 6.87a8 8 0 1 0 11.26 11.26", key: "3on8tj" }],
|
|
41737
41740
|
["path", { d: "M19.9 14.25a8 8 0 0 0-9.15-9.15", key: "15ghsc" }],
|
|
41738
41741
|
["path", { d: "m22 6-3-3", key: "1opdir" }],
|
|
@@ -41740,75 +41743,75 @@ const __iconNode$J = [
|
|
|
41740
41743
|
["path", { d: "m2 2 20 20", key: "1ooewy" }],
|
|
41741
41744
|
["path", { d: "M4 4 2 6", key: "1ycko6" }]
|
|
41742
41745
|
];
|
|
41743
|
-
const AlarmClockOff = createLucideIcon("alarm-clock-off", __iconNode$
|
|
41746
|
+
const AlarmClockOff = createLucideIcon("alarm-clock-off", __iconNode$K);
|
|
41744
41747
|
/**
|
|
41745
41748
|
* @license lucide-react v0.575.0 - ISC
|
|
41746
41749
|
*
|
|
41747
41750
|
* This source code is licensed under the ISC license.
|
|
41748
41751
|
* See the LICENSE file in the root directory of this source tree.
|
|
41749
41752
|
*/
|
|
41750
|
-
const __iconNode$
|
|
41753
|
+
const __iconNode$J = [
|
|
41751
41754
|
["path", { d: "m3 16 4 4 4-4", key: "1co6wj" }],
|
|
41752
41755
|
["path", { d: "M7 20V4", key: "1yoxec" }],
|
|
41753
41756
|
["path", { d: "M20 8h-5", key: "1vsyxs" }],
|
|
41754
41757
|
["path", { d: "M15 10V6.5a2.5 2.5 0 0 1 5 0V10", key: "ag13bf" }],
|
|
41755
41758
|
["path", { d: "M15 14h5l-5 6h5", key: "ur5jdg" }]
|
|
41756
41759
|
];
|
|
41757
|
-
const ArrowDownAZ = createLucideIcon("arrow-down-a-z", __iconNode$
|
|
41760
|
+
const ArrowDownAZ = createLucideIcon("arrow-down-a-z", __iconNode$J);
|
|
41758
41761
|
/**
|
|
41759
41762
|
* @license lucide-react v0.575.0 - ISC
|
|
41760
41763
|
*
|
|
41761
41764
|
* This source code is licensed under the ISC license.
|
|
41762
41765
|
* See the LICENSE file in the root directory of this source tree.
|
|
41763
41766
|
*/
|
|
41764
|
-
const __iconNode$
|
|
41767
|
+
const __iconNode$I = [
|
|
41765
41768
|
["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
|
|
41766
41769
|
["path", { d: "M19 12H5", key: "x3x0zl" }]
|
|
41767
41770
|
];
|
|
41768
|
-
const ArrowLeft = createLucideIcon("arrow-left", __iconNode$
|
|
41771
|
+
const ArrowLeft = createLucideIcon("arrow-left", __iconNode$I);
|
|
41769
41772
|
/**
|
|
41770
41773
|
* @license lucide-react v0.575.0 - ISC
|
|
41771
41774
|
*
|
|
41772
41775
|
* This source code is licensed under the ISC license.
|
|
41773
41776
|
* See the LICENSE file in the root directory of this source tree.
|
|
41774
41777
|
*/
|
|
41775
|
-
const __iconNode$
|
|
41778
|
+
const __iconNode$H = [
|
|
41776
41779
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
41777
41780
|
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
41778
41781
|
];
|
|
41779
|
-
const ArrowRight = createLucideIcon("arrow-right", __iconNode$
|
|
41782
|
+
const ArrowRight = createLucideIcon("arrow-right", __iconNode$H);
|
|
41780
41783
|
/**
|
|
41781
41784
|
* @license lucide-react v0.575.0 - ISC
|
|
41782
41785
|
*
|
|
41783
41786
|
* This source code is licensed under the ISC license.
|
|
41784
41787
|
* See the LICENSE file in the root directory of this source tree.
|
|
41785
41788
|
*/
|
|
41786
|
-
const __iconNode$
|
|
41789
|
+
const __iconNode$G = [
|
|
41787
41790
|
["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
|
|
41788
41791
|
["path", { d: "M7 4v16", key: "1glfcx" }],
|
|
41789
41792
|
["path", { d: "M20 8h-5", key: "1vsyxs" }],
|
|
41790
41793
|
["path", { d: "M15 10V6.5a2.5 2.5 0 0 1 5 0V10", key: "ag13bf" }],
|
|
41791
41794
|
["path", { d: "M15 14h5l-5 6h5", key: "ur5jdg" }]
|
|
41792
41795
|
];
|
|
41793
|
-
const ArrowUpAZ = createLucideIcon("arrow-up-a-z", __iconNode$
|
|
41796
|
+
const ArrowUpAZ = createLucideIcon("arrow-up-a-z", __iconNode$G);
|
|
41794
41797
|
/**
|
|
41795
41798
|
* @license lucide-react v0.575.0 - ISC
|
|
41796
41799
|
*
|
|
41797
41800
|
* This source code is licensed under the ISC license.
|
|
41798
41801
|
* See the LICENSE file in the root directory of this source tree.
|
|
41799
41802
|
*/
|
|
41800
|
-
const __iconNode$
|
|
41803
|
+
const __iconNode$F = [
|
|
41801
41804
|
["path", { d: "M7 7h10v10", key: "1tivn9" }],
|
|
41802
41805
|
["path", { d: "M7 17 17 7", key: "1vkiza" }]
|
|
41803
41806
|
];
|
|
41804
|
-
const ArrowUpRight = createLucideIcon("arrow-up-right", __iconNode$
|
|
41807
|
+
const ArrowUpRight = createLucideIcon("arrow-up-right", __iconNode$F);
|
|
41805
41808
|
/**
|
|
41806
41809
|
* @license lucide-react v0.575.0 - ISC
|
|
41807
41810
|
*
|
|
41808
41811
|
* This source code is licensed under the ISC license.
|
|
41809
41812
|
* See the LICENSE file in the root directory of this source tree.
|
|
41810
41813
|
*/
|
|
41811
|
-
const __iconNode$
|
|
41814
|
+
const __iconNode$E = [
|
|
41812
41815
|
["path", { d: "M12 8V4H8", key: "hb8ula" }],
|
|
41813
41816
|
["rect", { width: "16", height: "12", x: "4", y: "8", rx: "2", key: "enze0r" }],
|
|
41814
41817
|
["path", { d: "M2 14h2", key: "vft8re" }],
|
|
@@ -41816,7 +41819,20 @@ const __iconNode$D = [
|
|
|
41816
41819
|
["path", { d: "M15 13v2", key: "1xurst" }],
|
|
41817
41820
|
["path", { d: "M9 13v2", key: "rq6x2g" }]
|
|
41818
41821
|
];
|
|
41819
|
-
const Bot = createLucideIcon("bot", __iconNode$
|
|
41822
|
+
const Bot = createLucideIcon("bot", __iconNode$E);
|
|
41823
|
+
/**
|
|
41824
|
+
* @license lucide-react v0.575.0 - ISC
|
|
41825
|
+
*
|
|
41826
|
+
* This source code is licensed under the ISC license.
|
|
41827
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41828
|
+
*/
|
|
41829
|
+
const __iconNode$D = [
|
|
41830
|
+
["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
|
|
41831
|
+
["path", { d: "M18 17V9", key: "2bz60n" }],
|
|
41832
|
+
["path", { d: "M13 17V5", key: "1frdt8" }],
|
|
41833
|
+
["path", { d: "M8 17v-3", key: "17ska0" }]
|
|
41834
|
+
];
|
|
41835
|
+
const ChartColumn = createLucideIcon("chart-column", __iconNode$D);
|
|
41820
41836
|
/**
|
|
41821
41837
|
* @license lucide-react v0.575.0 - ISC
|
|
41822
41838
|
*
|
|
@@ -52707,10 +52723,10 @@ class $ZodRegistry {
|
|
|
52707
52723
|
this._idmap = /* @__PURE__ */ new Map();
|
|
52708
52724
|
}
|
|
52709
52725
|
add(schema, ..._meta) {
|
|
52710
|
-
const
|
|
52711
|
-
this._map.set(schema,
|
|
52712
|
-
if (
|
|
52713
|
-
this._idmap.set(
|
|
52726
|
+
const meta2 = _meta[0];
|
|
52727
|
+
this._map.set(schema, meta2);
|
|
52728
|
+
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
52729
|
+
this._idmap.set(meta2.id, schema);
|
|
52714
52730
|
}
|
|
52715
52731
|
return this;
|
|
52716
52732
|
}
|
|
@@ -52720,9 +52736,9 @@ class $ZodRegistry {
|
|
|
52720
52736
|
return this;
|
|
52721
52737
|
}
|
|
52722
52738
|
remove(schema) {
|
|
52723
|
-
const
|
|
52724
|
-
if (
|
|
52725
|
-
this._idmap.delete(
|
|
52739
|
+
const meta2 = this._map.get(schema);
|
|
52740
|
+
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
52741
|
+
this._idmap.delete(meta2.id);
|
|
52726
52742
|
}
|
|
52727
52743
|
this._map.delete(schema);
|
|
52728
52744
|
return this;
|
|
@@ -55003,9 +55019,9 @@ function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
55003
55019
|
ctx.seen.get(parent).isParent = true;
|
|
55004
55020
|
}
|
|
55005
55021
|
}
|
|
55006
|
-
const
|
|
55007
|
-
if (
|
|
55008
|
-
assignProps(result.schema,
|
|
55022
|
+
const meta2 = ctx.metadataRegistry.get(schema);
|
|
55023
|
+
if (meta2)
|
|
55024
|
+
assignProps(result.schema, meta2);
|
|
55009
55025
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
55010
55026
|
delete result.schema.examples;
|
|
55011
55027
|
delete result.schema.default;
|
|
@@ -56097,8 +56113,8 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
56097
56113
|
brand() {
|
|
56098
56114
|
return this;
|
|
56099
56115
|
},
|
|
56100
|
-
register(reg,
|
|
56101
|
-
reg.add(this,
|
|
56116
|
+
register(reg, meta2) {
|
|
56117
|
+
reg.add(this, meta2);
|
|
56102
56118
|
return this;
|
|
56103
56119
|
},
|
|
56104
56120
|
refine(check, params) {
|
|
@@ -59383,6 +59399,398 @@ function validateUlidTimestamp(prefixedUlid, prefix, pastThresholdMs = DEFAULT_T
|
|
|
59383
59399
|
const thresholdSeconds = Math.round(thresholdMs / 1e3);
|
|
59384
59400
|
return `Invalid runId timestamp: embedded timestamp is ${driftSeconds}s in the ${direction} (threshold: ${thresholdSeconds}s)`;
|
|
59385
59401
|
}
|
|
59402
|
+
const USAGE_DOCS_URL = "https://workflow-sdk.dev/docs/observability/usage";
|
|
59403
|
+
const USAGE_SPANS_SHOWN = 5;
|
|
59404
|
+
const RUN_USAGE_ENTITIES = [
|
|
59405
|
+
"run",
|
|
59406
|
+
"step",
|
|
59407
|
+
"hook",
|
|
59408
|
+
"stream"
|
|
59409
|
+
];
|
|
59410
|
+
const RUN_USAGE_RUN_EVENT_TYPES = [
|
|
59411
|
+
"created",
|
|
59412
|
+
"started",
|
|
59413
|
+
"completed",
|
|
59414
|
+
"failed",
|
|
59415
|
+
"cancelled"
|
|
59416
|
+
];
|
|
59417
|
+
const RUN_USAGE_STEP_EVENT_TYPES = [
|
|
59418
|
+
"created",
|
|
59419
|
+
"started",
|
|
59420
|
+
"completed",
|
|
59421
|
+
"failed",
|
|
59422
|
+
"retrying"
|
|
59423
|
+
];
|
|
59424
|
+
const UNKNOWN_STEP_NAME = "(unknown step)";
|
|
59425
|
+
function spanOf(eventType, workflowName) {
|
|
59426
|
+
if (eventType.startsWith("hook_"))
|
|
59427
|
+
return { kind: "hook", name: "hook" };
|
|
59428
|
+
if (eventType.startsWith("wait_"))
|
|
59429
|
+
return { kind: "wait", name: "sleep" };
|
|
59430
|
+
if (eventType.startsWith("run_"))
|
|
59431
|
+
return { kind: "run", name: workflowName };
|
|
59432
|
+
if (eventType === "attr_set") {
|
|
59433
|
+
return { kind: "attributes", name: "attributes" };
|
|
59434
|
+
}
|
|
59435
|
+
return { kind: "other", name: "other" };
|
|
59436
|
+
}
|
|
59437
|
+
function compareCodeUnits(a2, b2) {
|
|
59438
|
+
return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
|
|
59439
|
+
}
|
|
59440
|
+
function toCount(value) {
|
|
59441
|
+
const n = Number(value);
|
|
59442
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
59443
|
+
}
|
|
59444
|
+
function usageEntityOfEventType(eventType) {
|
|
59445
|
+
if (isSealedNoopEvent$1({ eventType }))
|
|
59446
|
+
return null;
|
|
59447
|
+
if (eventType.startsWith("step_"))
|
|
59448
|
+
return "step";
|
|
59449
|
+
if (eventType.startsWith("hook_"))
|
|
59450
|
+
return "hook";
|
|
59451
|
+
return "run";
|
|
59452
|
+
}
|
|
59453
|
+
function buildRunUsage(input) {
|
|
59454
|
+
var _a3;
|
|
59455
|
+
const spans = /* @__PURE__ */ new Map();
|
|
59456
|
+
const byEntity = {
|
|
59457
|
+
run: 0,
|
|
59458
|
+
step: 0,
|
|
59459
|
+
hook: 0,
|
|
59460
|
+
stream: toCount(input.streamBytes)
|
|
59461
|
+
};
|
|
59462
|
+
let events2 = 0;
|
|
59463
|
+
let retries = 0;
|
|
59464
|
+
const add = (kind, name2, entity, count2, retryCount, bytes) => {
|
|
59465
|
+
if (count2 <= 0)
|
|
59466
|
+
return;
|
|
59467
|
+
const key = `${kind}\0${name2}`;
|
|
59468
|
+
let span = spans.get(key);
|
|
59469
|
+
if (!span) {
|
|
59470
|
+
span = { kind, name: name2, events: 0, share: 0, retries: 0, calls: 0 };
|
|
59471
|
+
spans.set(key, span);
|
|
59472
|
+
}
|
|
59473
|
+
span.events += count2;
|
|
59474
|
+
span.retries += retryCount;
|
|
59475
|
+
events2 += count2;
|
|
59476
|
+
retries += retryCount;
|
|
59477
|
+
byEntity[entity] += bytes;
|
|
59478
|
+
};
|
|
59479
|
+
const created = { hook: 0, wait: 0 };
|
|
59480
|
+
const hookGroups = input.hookGroups;
|
|
59481
|
+
let hookEvents = 0;
|
|
59482
|
+
const runEvents = {
|
|
59483
|
+
events: 0,
|
|
59484
|
+
byType: { created: 0, started: 0, completed: 0, failed: 0, cancelled: 0 }
|
|
59485
|
+
};
|
|
59486
|
+
for (const group of input.eventGroups) {
|
|
59487
|
+
const entity = usageEntityOfEventType(group.eventType);
|
|
59488
|
+
if (!entity)
|
|
59489
|
+
continue;
|
|
59490
|
+
const runType = group.eventType.slice("run_".length);
|
|
59491
|
+
if (group.eventType.startsWith("run_") && RUN_USAGE_RUN_EVENT_TYPES.includes(runType)) {
|
|
59492
|
+
runEvents.byType[runType] += toCount(group.events);
|
|
59493
|
+
}
|
|
59494
|
+
if (group.eventType.startsWith("run_")) {
|
|
59495
|
+
runEvents.events += toCount(group.events);
|
|
59496
|
+
}
|
|
59497
|
+
if (group.eventType === "hook_created")
|
|
59498
|
+
created.hook += toCount(group.events);
|
|
59499
|
+
if (group.eventType === "wait_created")
|
|
59500
|
+
created.wait += toCount(group.events);
|
|
59501
|
+
const { kind, name: name2 } = spanOf(group.eventType, input.workflowName);
|
|
59502
|
+
if (kind === "hook" && hookGroups) {
|
|
59503
|
+
hookEvents += toCount(group.events);
|
|
59504
|
+
events2 += toCount(group.events);
|
|
59505
|
+
byEntity[entity] += toCount(group.bytes);
|
|
59506
|
+
continue;
|
|
59507
|
+
}
|
|
59508
|
+
add(kind, name2, entity, toCount(group.events), 0, toCount(group.bytes));
|
|
59509
|
+
}
|
|
59510
|
+
if (hookGroups) {
|
|
59511
|
+
let grouped = 0;
|
|
59512
|
+
for (const group of hookGroups) {
|
|
59513
|
+
const count2 = toCount(group.events);
|
|
59514
|
+
if (count2 <= 0 || !group.hookId)
|
|
59515
|
+
continue;
|
|
59516
|
+
grouped += count2;
|
|
59517
|
+
spans.set(`hook\0${group.hookId}`, {
|
|
59518
|
+
kind: "hook",
|
|
59519
|
+
name: group.token || group.hookId,
|
|
59520
|
+
id: group.hookId,
|
|
59521
|
+
events: count2,
|
|
59522
|
+
share: 0,
|
|
59523
|
+
retries: 0,
|
|
59524
|
+
calls: 1
|
|
59525
|
+
});
|
|
59526
|
+
}
|
|
59527
|
+
if (hookEvents > grouped) {
|
|
59528
|
+
spans.set("hook\0", {
|
|
59529
|
+
kind: "hook",
|
|
59530
|
+
name: "hook",
|
|
59531
|
+
events: hookEvents - grouped,
|
|
59532
|
+
share: 0,
|
|
59533
|
+
retries: 0,
|
|
59534
|
+
calls: 0
|
|
59535
|
+
});
|
|
59536
|
+
}
|
|
59537
|
+
}
|
|
59538
|
+
const calls = {
|
|
59539
|
+
hook: toCount(created.hook),
|
|
59540
|
+
wait: toCount(((_a3 = input.calls) == null ? void 0 : _a3.wait) ?? created.wait)
|
|
59541
|
+
};
|
|
59542
|
+
const stepEvents = {
|
|
59543
|
+
steps: 0,
|
|
59544
|
+
events: 0,
|
|
59545
|
+
byType: {
|
|
59546
|
+
created: 0,
|
|
59547
|
+
started: 0,
|
|
59548
|
+
completed: 0,
|
|
59549
|
+
failed: 0,
|
|
59550
|
+
retrying: 0,
|
|
59551
|
+
other: 0
|
|
59552
|
+
}
|
|
59553
|
+
};
|
|
59554
|
+
let restarts = 0;
|
|
59555
|
+
for (const group of input.stepGroups) {
|
|
59556
|
+
restarts += toCount(group.restarts);
|
|
59557
|
+
const counts = {
|
|
59558
|
+
created: toCount(group.created),
|
|
59559
|
+
started: toCount(group.started),
|
|
59560
|
+
completed: toCount(group.completed),
|
|
59561
|
+
failed: toCount(group.failed),
|
|
59562
|
+
retrying: toCount(group.retries)
|
|
59563
|
+
};
|
|
59564
|
+
const total = toCount(group.events);
|
|
59565
|
+
if (total <= 0)
|
|
59566
|
+
continue;
|
|
59567
|
+
stepEvents.steps += toCount(group.steps);
|
|
59568
|
+
stepEvents.events += total;
|
|
59569
|
+
let known = 0;
|
|
59570
|
+
for (const type of RUN_USAGE_STEP_EVENT_TYPES) {
|
|
59571
|
+
stepEvents.byType[type] += counts[type];
|
|
59572
|
+
known += counts[type];
|
|
59573
|
+
}
|
|
59574
|
+
stepEvents.byType.other += Math.max(0, total - known);
|
|
59575
|
+
const name2 = group.stepName || UNKNOWN_STEP_NAME;
|
|
59576
|
+
add("step", name2, "step", toCount(group.events), toCount(group.retries), toCount(group.bytes));
|
|
59577
|
+
const span = spans.get(`step\0${name2}`);
|
|
59578
|
+
if (span)
|
|
59579
|
+
span.calls += toCount(group.steps);
|
|
59580
|
+
}
|
|
59581
|
+
for (const span of spans.values()) {
|
|
59582
|
+
if (span.kind === "run")
|
|
59583
|
+
span.calls = 1;
|
|
59584
|
+
if (span.kind === "hook" && !hookGroups)
|
|
59585
|
+
span.calls = calls.hook;
|
|
59586
|
+
if (span.kind === "wait")
|
|
59587
|
+
span.calls = calls.wait;
|
|
59588
|
+
if (span.kind === "attributes" || span.kind === "other") {
|
|
59589
|
+
span.calls = span.events;
|
|
59590
|
+
}
|
|
59591
|
+
}
|
|
59592
|
+
const eventsBySpan = [...spans.values()].map((span) => ({ ...span, share: events2 > 0 ? span.events / events2 : 0 })).sort((a2, b2) => b2.events - a2.events || compareCodeUnits(a2.name, b2.name) || compareCodeUnits(a2.kind, b2.kind) || compareCodeUnits(a2.id ?? "", b2.id ?? ""));
|
|
59593
|
+
return {
|
|
59594
|
+
runId: input.runId,
|
|
59595
|
+
status: input.status,
|
|
59596
|
+
workflowName: input.workflowName,
|
|
59597
|
+
billed: input.billed === true,
|
|
59598
|
+
inProgress: !isTerminalWorkflowRunStatus(input.status),
|
|
59599
|
+
events: events2,
|
|
59600
|
+
billableEvents: events2,
|
|
59601
|
+
retries: { count: retries, events: retries + restarts },
|
|
59602
|
+
runEvents,
|
|
59603
|
+
stepEvents,
|
|
59604
|
+
eventsBySpan,
|
|
59605
|
+
dataWritten: dataWrittenOf(input, byEntity),
|
|
59606
|
+
dataPurged: input.dataPurged === true,
|
|
59607
|
+
dataRetained: input.dataRetained ?? null
|
|
59608
|
+
};
|
|
59609
|
+
}
|
|
59610
|
+
function dataWrittenOf(input, measured) {
|
|
59611
|
+
const saved = input.dataPurged ? input.savedDataWritten : void 0;
|
|
59612
|
+
const byEntity = saved ? {
|
|
59613
|
+
run: toCount(saved.run),
|
|
59614
|
+
step: toCount(saved.step),
|
|
59615
|
+
hook: toCount(saved.hook),
|
|
59616
|
+
stream: toCount(saved.stream)
|
|
59617
|
+
} : measured;
|
|
59618
|
+
return {
|
|
59619
|
+
bytes: byEntity.run + byEntity.step + byEntity.hook + byEntity.stream,
|
|
59620
|
+
byEntity,
|
|
59621
|
+
source: !input.dataPurged ? "log" : saved ? "saved-at-purge" : "left-after-purge"
|
|
59622
|
+
};
|
|
59623
|
+
}
|
|
59624
|
+
function plural(count2, one2, many) {
|
|
59625
|
+
return `${count2.toLocaleString("en-US")} ${count2 === 1 ? one2 : many}`;
|
|
59626
|
+
}
|
|
59627
|
+
function usageSpanLabel(span) {
|
|
59628
|
+
var _a3, _b2;
|
|
59629
|
+
if (span.kind === "step") {
|
|
59630
|
+
return ((_a3 = parseStepName(span.name)) == null ? void 0 : _a3.shortName) || span.name;
|
|
59631
|
+
}
|
|
59632
|
+
if (span.kind === "run") {
|
|
59633
|
+
return ((_b2 = parseWorkflowName(span.name)) == null ? void 0 : _b2.shortName) || span.name;
|
|
59634
|
+
}
|
|
59635
|
+
return span.name;
|
|
59636
|
+
}
|
|
59637
|
+
function formatUsageEvents(count2) {
|
|
59638
|
+
return plural(count2, "event", "events");
|
|
59639
|
+
}
|
|
59640
|
+
function formatUsageBytes(bytes) {
|
|
59641
|
+
const units = ["B", "KB", "MB", "GB", "TB"];
|
|
59642
|
+
let value = Math.max(0, bytes);
|
|
59643
|
+
let unit = 0;
|
|
59644
|
+
while (value >= 1e3 && unit < units.length - 1) {
|
|
59645
|
+
value /= 1e3;
|
|
59646
|
+
unit++;
|
|
59647
|
+
}
|
|
59648
|
+
if (unit === 0)
|
|
59649
|
+
return `${Math.round(value)} B`;
|
|
59650
|
+
const digits = value >= 100 ? 0 : value >= 10 ? 1 : 2;
|
|
59651
|
+
return `${Number(value.toFixed(digits))} ${units[unit]}`;
|
|
59652
|
+
}
|
|
59653
|
+
function formatUsageShare(share) {
|
|
59654
|
+
if (share > 0 && share < 0.01)
|
|
59655
|
+
return "<1%";
|
|
59656
|
+
return `${Math.round(share * 100)}%`;
|
|
59657
|
+
}
|
|
59658
|
+
function formatCount(count2, one2, many) {
|
|
59659
|
+
return plural(count2, one2, many);
|
|
59660
|
+
}
|
|
59661
|
+
function formatOtherSteps(steps) {
|
|
59662
|
+
return `+ ${steps.toLocaleString("en-US")} other ${steps === 1 ? "step" : "steps"}`;
|
|
59663
|
+
}
|
|
59664
|
+
function formatDataWrittenHeading(usage) {
|
|
59665
|
+
return usage.billed ? "Storage" : "Storage (local)";
|
|
59666
|
+
}
|
|
59667
|
+
function formatLocalDataWrittenNote(usage) {
|
|
59668
|
+
if (usage.billed)
|
|
59669
|
+
return null;
|
|
59670
|
+
return "The bytes of the run's payloads as the SDK sent them, plus the bytes it wrote to streams, counted the way Vercel counts Data Written. It doesn't include QuickJS VM snapshots or a dynamic workflow's code.";
|
|
59671
|
+
}
|
|
59672
|
+
function formatUsageFooter(usage) {
|
|
59673
|
+
return usage.billed ? "Not your final bill." : "Local runs aren't billed. Counted from this run's log in your local data directory.";
|
|
59674
|
+
}
|
|
59675
|
+
const RUN_EVENT_LABELS = {
|
|
59676
|
+
created: "created",
|
|
59677
|
+
started: "started",
|
|
59678
|
+
completed: "completed",
|
|
59679
|
+
failed: "failed",
|
|
59680
|
+
cancelled: "cancelled"
|
|
59681
|
+
};
|
|
59682
|
+
function formatRunEventsLine(usage) {
|
|
59683
|
+
const { events: events2, byType } = usage.runEvents;
|
|
59684
|
+
if (events2 <= 0)
|
|
59685
|
+
return null;
|
|
59686
|
+
const parts = RUN_USAGE_RUN_EVENT_TYPES.flatMap((type) => byType[type] > 0 ? [`${byType[type].toLocaleString("en-US")} ${RUN_EVENT_LABELS[type]}`] : []);
|
|
59687
|
+
const known = RUN_USAGE_RUN_EVENT_TYPES.reduce((n, t) => n + byType[t], 0);
|
|
59688
|
+
if (events2 > known) {
|
|
59689
|
+
parts.push(`${(events2 - known).toLocaleString("en-US")} other`);
|
|
59690
|
+
}
|
|
59691
|
+
const sofar = usage.inProgress ? " so far" : "";
|
|
59692
|
+
return `The run wrote ${formatUsageEvents(events2)}${sofar}: ${parts.join(", ")}.`;
|
|
59693
|
+
}
|
|
59694
|
+
function formatDataPurgedNote(usage) {
|
|
59695
|
+
if (!usage.dataPurged)
|
|
59696
|
+
return null;
|
|
59697
|
+
return usage.dataWritten.source === "saved-at-purge" ? "This run's data was deleted; sizes show what it wrote." : "This run's data was deleted before its sizes were kept; sizes show what is left.";
|
|
59698
|
+
}
|
|
59699
|
+
const USAGE_ROW_TYPES = [
|
|
59700
|
+
"steps",
|
|
59701
|
+
"hooks",
|
|
59702
|
+
"attributes",
|
|
59703
|
+
"sleeps",
|
|
59704
|
+
"run",
|
|
59705
|
+
"other"
|
|
59706
|
+
];
|
|
59707
|
+
const USAGE_ROW_TYPE_LABELS = {
|
|
59708
|
+
steps: "Steps",
|
|
59709
|
+
hooks: "Hooks",
|
|
59710
|
+
attributes: "Attributes",
|
|
59711
|
+
sleeps: "Sleeps",
|
|
59712
|
+
run: "Run",
|
|
59713
|
+
other: "Other events"
|
|
59714
|
+
};
|
|
59715
|
+
const SPAN_KIND_OF_ROW_TYPE = {
|
|
59716
|
+
steps: "step",
|
|
59717
|
+
hooks: "hook",
|
|
59718
|
+
attributes: "attributes",
|
|
59719
|
+
sleeps: "wait",
|
|
59720
|
+
run: "run",
|
|
59721
|
+
other: "other"
|
|
59722
|
+
};
|
|
59723
|
+
function usageRows(usage, limit = USAGE_SPANS_SHOWN) {
|
|
59724
|
+
const runNote = formatRunEventsLine(usage) ?? void 0;
|
|
59725
|
+
return USAGE_ROW_TYPES.flatMap((type) => {
|
|
59726
|
+
const spans = usage.eventsBySpan.filter((span) => span.kind === SPAN_KIND_OF_ROW_TYPE[type]);
|
|
59727
|
+
if (spans.length === 0)
|
|
59728
|
+
return [];
|
|
59729
|
+
const total = sumRows(spans);
|
|
59730
|
+
const group = {
|
|
59731
|
+
type,
|
|
59732
|
+
key: type,
|
|
59733
|
+
events: total.events,
|
|
59734
|
+
share: total.share,
|
|
59735
|
+
retries: total.retries,
|
|
59736
|
+
calls: type === "hooks" ? spans.length : total.calls,
|
|
59737
|
+
children: [],
|
|
59738
|
+
otherChildren: null,
|
|
59739
|
+
...type === "run" && runNote ? { note: runNote } : {}
|
|
59740
|
+
};
|
|
59741
|
+
if (type !== "steps" && type !== "hooks")
|
|
59742
|
+
return [group];
|
|
59743
|
+
const { shown, other } = collapseUsageSpans(spans, limit);
|
|
59744
|
+
group.children = childRowsOf(shown);
|
|
59745
|
+
group.otherChildren = other && {
|
|
59746
|
+
key: `${type}:other`,
|
|
59747
|
+
count: other.spans,
|
|
59748
|
+
label: type === "steps" ? formatOtherSteps(other.spans) : `+ ${other.spans.toLocaleString("en-US")} other ${other.spans === 1 ? "hook" : "hooks"}`,
|
|
59749
|
+
events: other.events,
|
|
59750
|
+
share: other.share,
|
|
59751
|
+
retries: other.retries,
|
|
59752
|
+
calls: other.calls
|
|
59753
|
+
};
|
|
59754
|
+
return [group];
|
|
59755
|
+
});
|
|
59756
|
+
}
|
|
59757
|
+
function sumRows(spans) {
|
|
59758
|
+
return spans.reduce((sum, span) => ({
|
|
59759
|
+
events: sum.events + span.events,
|
|
59760
|
+
share: sum.share + span.share,
|
|
59761
|
+
retries: sum.retries + span.retries,
|
|
59762
|
+
calls: sum.calls + span.calls
|
|
59763
|
+
}), { events: 0, share: 0, retries: 0, calls: 0 });
|
|
59764
|
+
}
|
|
59765
|
+
function childRowsOf(spans) {
|
|
59766
|
+
const labels = spans.map((span) => usageSpanLabel(span));
|
|
59767
|
+
const seen = /* @__PURE__ */ new Map();
|
|
59768
|
+
for (const label of labels)
|
|
59769
|
+
seen.set(label, (seen.get(label) ?? 0) + 1);
|
|
59770
|
+
return spans.map((span, i) => ({
|
|
59771
|
+
key: span.kind === "hook" ? span.id ?? span.name : span.name,
|
|
59772
|
+
label: (seen.get(labels[i]) ?? 0) > 1 ? span.kind === "step" ? formatStepName(span.name) : `${labels[i]} (${span.id ?? span.name})` : labels[i],
|
|
59773
|
+
events: span.events,
|
|
59774
|
+
share: span.share,
|
|
59775
|
+
retries: span.retries,
|
|
59776
|
+
calls: span.calls
|
|
59777
|
+
}));
|
|
59778
|
+
}
|
|
59779
|
+
function collapseUsageSpans(spans, limit = USAGE_SPANS_SHOWN) {
|
|
59780
|
+
if (spans.length <= limit + 1)
|
|
59781
|
+
return { shown: spans, other: null };
|
|
59782
|
+
const rest = spans.slice(limit);
|
|
59783
|
+
return {
|
|
59784
|
+
shown: spans.slice(0, limit),
|
|
59785
|
+
other: {
|
|
59786
|
+
spans: rest.length,
|
|
59787
|
+
events: rest.reduce((sum, span) => sum + span.events, 0),
|
|
59788
|
+
share: rest.reduce((sum, span) => sum + span.share, 0),
|
|
59789
|
+
retries: rest.reduce((sum, span) => sum + span.retries, 0),
|
|
59790
|
+
calls: rest.reduce((sum, span) => sum + span.calls, 0)
|
|
59791
|
+
}
|
|
59792
|
+
};
|
|
59793
|
+
}
|
|
59386
59794
|
const SINGLETON_EVENT_CLASSES = /* @__PURE__ */ new Set([
|
|
59387
59795
|
"run_started"
|
|
59388
59796
|
]);
|
|
@@ -59468,8 +59876,8 @@ function globalSingleton(name2, shapeVersion, create2) {
|
|
|
59468
59876
|
store[key] = created;
|
|
59469
59877
|
return created;
|
|
59470
59878
|
}
|
|
59471
|
-
function pluralize(singular,
|
|
59472
|
-
return count2 === 1 ? singular :
|
|
59879
|
+
function pluralize(singular, plural2, count2) {
|
|
59880
|
+
return count2 === 1 ? singular : plural2;
|
|
59473
59881
|
}
|
|
59474
59882
|
function withResolvers$1() {
|
|
59475
59883
|
let resolve2;
|
|
@@ -59636,20 +60044,20 @@ function requireMs() {
|
|
|
59636
60044
|
function fmtLong(ms2) {
|
|
59637
60045
|
var msAbs = Math.abs(ms2);
|
|
59638
60046
|
if (msAbs >= d2) {
|
|
59639
|
-
return
|
|
60047
|
+
return plural2(ms2, msAbs, d2, "day");
|
|
59640
60048
|
}
|
|
59641
60049
|
if (msAbs >= h2) {
|
|
59642
|
-
return
|
|
60050
|
+
return plural2(ms2, msAbs, h2, "hour");
|
|
59643
60051
|
}
|
|
59644
60052
|
if (msAbs >= m2) {
|
|
59645
|
-
return
|
|
60053
|
+
return plural2(ms2, msAbs, m2, "minute");
|
|
59646
60054
|
}
|
|
59647
60055
|
if (msAbs >= s2) {
|
|
59648
|
-
return
|
|
60056
|
+
return plural2(ms2, msAbs, s2, "second");
|
|
59649
60057
|
}
|
|
59650
60058
|
return ms2 + " ms";
|
|
59651
60059
|
}
|
|
59652
|
-
function
|
|
60060
|
+
function plural2(ms2, msAbs, n, name2) {
|
|
59653
60061
|
var isPlural = msAbs >= n * 1.5;
|
|
59654
60062
|
return Math.round(ms2 / n) + " " + name2 + (isPlural ? "s" : "");
|
|
59655
60063
|
}
|
|
@@ -63384,7 +63792,7 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
|
|
|
63384
63792
|
}
|
|
63385
63793
|
async function hydrateResourceIOAsync(resource, key, extraRevivers) {
|
|
63386
63794
|
const { hydrateDataWithKey: hydrateDataWithKey2, deriveRunPayloadKeys: deriveRunPayloadKeys2 } = await Promise.resolve().then(() => serializationFormat);
|
|
63387
|
-
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-
|
|
63795
|
+
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-LnaKiDUZ.js");
|
|
63388
63796
|
ensureZstdDecoderRegistered();
|
|
63389
63797
|
const cryptoKey = key ? await deriveRunPayloadKeys2(key) : void 0;
|
|
63390
63798
|
const revivers = extraRevivers ? { ...getRevivers(), ...extraRevivers } : getRevivers();
|
|
@@ -68537,13 +68945,36 @@ function formatTimeDifference(diff) {
|
|
|
68537
68945
|
}
|
|
68538
68946
|
return result.join(", ");
|
|
68539
68947
|
}
|
|
68948
|
+
function formatTimeAgo(date2, now2) {
|
|
68949
|
+
const diff = now2 - date2;
|
|
68950
|
+
const formattedDiff = formatTimeDifference(diff);
|
|
68951
|
+
if (!formattedDiff)
|
|
68952
|
+
return "Just now";
|
|
68953
|
+
return diff < 0 ? `in ${formattedDiff}` : `${formattedDiff} ago`;
|
|
68954
|
+
}
|
|
68955
|
+
function formatShortTimeAgo(date2, now2) {
|
|
68956
|
+
const diff = now2 - date2;
|
|
68957
|
+
const abs = Math.abs(diff);
|
|
68958
|
+
const days = Math.floor(abs / (1e3 * 60 * 60 * 24));
|
|
68959
|
+
const hours = Math.floor(abs / (1e3 * 60 * 60));
|
|
68960
|
+
const minutes = Math.floor(abs / (1e3 * 60));
|
|
68961
|
+
let value;
|
|
68962
|
+
if (days > 0) {
|
|
68963
|
+
value = `${days} day${days > 1 ? "s" : ""}`;
|
|
68964
|
+
} else if (hours > 0) {
|
|
68965
|
+
value = `${hours} hour${hours > 1 ? "s" : ""}`;
|
|
68966
|
+
} else if (minutes > 0) {
|
|
68967
|
+
value = `${minutes} minute${minutes > 1 ? "s" : ""}`;
|
|
68968
|
+
} else {
|
|
68969
|
+
return diff < 0 ? "In less than a minute" : "Just now";
|
|
68970
|
+
}
|
|
68971
|
+
return diff < 0 ? `In ${value}` : `${value} ago`;
|
|
68972
|
+
}
|
|
68540
68973
|
function useTimeAgo(date2) {
|
|
68541
68974
|
const [timeAgo, setTimeAgo] = reactExports.useState("");
|
|
68542
68975
|
reactExports.useEffect(() => {
|
|
68543
68976
|
const updateTimeAgo = () => {
|
|
68544
|
-
|
|
68545
|
-
const formattedDiff = formatTimeDifference(diff);
|
|
68546
|
-
setTimeAgo(formattedDiff ? `${formattedDiff} ago` : "Just now");
|
|
68977
|
+
setTimeAgo(formatTimeAgo(date2, Date.now()));
|
|
68547
68978
|
};
|
|
68548
68979
|
updateTimeAgo();
|
|
68549
68980
|
const timer2 = setInterval(updateTimeAgo, 1e3);
|
|
@@ -68559,19 +68990,7 @@ function useShortTimeAgo(date2) {
|
|
|
68559
68990
|
return;
|
|
68560
68991
|
}
|
|
68561
68992
|
const updateShortTimeAgo = () => {
|
|
68562
|
-
|
|
68563
|
-
const days = Math.floor(diff / (1e3 * 60 * 60 * 24));
|
|
68564
|
-
const hours = Math.floor(diff / (1e3 * 60 * 60));
|
|
68565
|
-
const minutes = Math.floor(diff / (1e3 * 60));
|
|
68566
|
-
if (days > 0) {
|
|
68567
|
-
setShortTimeAgo(`${days} day${days > 1 ? "s" : ""} ago`);
|
|
68568
|
-
} else if (hours > 0) {
|
|
68569
|
-
setShortTimeAgo(`${hours} hour${hours > 1 ? "s" : ""} ago`);
|
|
68570
|
-
} else if (minutes > 0) {
|
|
68571
|
-
setShortTimeAgo(`${minutes} minute${minutes > 1 ? "s" : ""} ago`);
|
|
68572
|
-
} else {
|
|
68573
|
-
setShortTimeAgo("Just now");
|
|
68574
|
-
}
|
|
68993
|
+
setShortTimeAgo(formatShortTimeAgo(date2, Date.now()));
|
|
68575
68994
|
};
|
|
68576
68995
|
updateShortTimeAgo();
|
|
68577
68996
|
const timer2 = setInterval(updateShortTimeAgo, 6e4);
|
|
@@ -68631,7 +69050,7 @@ const COL = {
|
|
|
68631
69050
|
name: "w-[280px]",
|
|
68632
69051
|
duration: "w-[96px] justify-end"
|
|
68633
69052
|
};
|
|
68634
|
-
const CELL = "flex h-full shrink-0 items-center overflow-hidden px-1.5";
|
|
69053
|
+
const CELL$1 = "flex h-full shrink-0 items-center overflow-hidden px-1.5";
|
|
68635
69054
|
const LEVEL_ROW_CLASS = {
|
|
68636
69055
|
default: "text-gray-1000 hover:bg-gray-100",
|
|
68637
69056
|
muted: "text-gray-700 hover:bg-gray-100",
|
|
@@ -68652,7 +69071,7 @@ const LEVEL_SELECTED_CLASS = {
|
|
|
68652
69071
|
};
|
|
68653
69072
|
function TimestampCell({ date: date2, secondaryClass }) {
|
|
68654
69073
|
const parts = formatTimestampParts(date2);
|
|
68655
|
-
return jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.time, "tabular-nums"), children: jsxRuntimeExports.jsx(TimestampTooltip, { date: date2, children: jsxRuntimeExports.jsxs("span", { className: "whitespace-pre", children: [jsxRuntimeExports.jsx("span", { className: secondaryClass, children: `${parts.day} ` }), parts.clock, jsxRuntimeExports.jsx("span", { className: secondaryClass, children: parts.ms })] }) }) });
|
|
69074
|
+
return jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.time, "tabular-nums"), children: jsxRuntimeExports.jsx(TimestampTooltip, { date: date2, children: jsxRuntimeExports.jsxs("span", { className: "whitespace-pre", children: [jsxRuntimeExports.jsx("span", { className: secondaryClass, children: `${parts.day} ` }), parts.clock, jsxRuntimeExports.jsx("span", { className: secondaryClass, children: parts.ms })] }) }) });
|
|
68656
69075
|
}
|
|
68657
69076
|
function LevelIcon({ level }) {
|
|
68658
69077
|
if (level === "warning") {
|
|
@@ -68667,8 +69086,8 @@ function SortIndicator({ order: order2 }) {
|
|
|
68667
69086
|
return jsxRuntimeExports.jsxs("span", { "aria-hidden": true, className: "flex flex-col gap-px", children: [jsxRuntimeExports.jsx("span", { className: cn$2("-my-0.5 flex size-3 items-center justify-center rounded-full transition-all duration-[280ms] ease-in-out", order2 === "asc" ? "translate-y-1 bg-gray-300 text-gray-900" : "-translate-y-1 opacity-0"), children: jsxRuntimeExports.jsx(ChevronUp, { className: "size-2", strokeWidth: 3 }) }), jsxRuntimeExports.jsx("span", { className: cn$2("-my-0.5 flex size-3 items-center justify-center rounded-full transition-all duration-[280ms] ease-in-out", order2 === "desc" ? "-translate-y-1 bg-gray-300 text-gray-900" : "opacity-0"), children: jsxRuntimeExports.jsx(ChevronDown, { className: "size-2 translate-y-[0.5px]", strokeWidth: 3 }) })] });
|
|
68668
69087
|
}
|
|
68669
69088
|
function EventListHeader({ showOccurred, sortOrder, onSortOrderChange }) {
|
|
68670
|
-
const sortButton = (label) => jsxRuntimeExports.jsxs("button", { type: "button", "aria-label": `${label}, ${sortOrder === "asc" ? "oldest" : "newest"} first`, onClick: () => onSortOrderChange(sortOrder === "asc" ? "desc" : "asc"), className: cn$2(CELL, COL.time, "cursor-pointer gap-1.5 border-0 bg-transparent text-left font-sans text-label-14 text-gray-900 hover:text-gray-1000"), children: [label, jsxRuntimeExports.jsx(SortIndicator, { order: sortOrder })] });
|
|
68671
|
-
return jsxRuntimeExports.jsxs("div", { role: "row", className: "flex h-10 shrink-0 items-center border-b border-gray-alpha-400 px-1 font-sans text-label-14 text-gray-900", children: [jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.level) }), showOccurred ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [sortButton("Occurred"), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.time), children: "Created" })] }) : sortButton("Time"), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.since) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.name), children: "Name" }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.event), children: "Event" }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, "min-w-0 flex-1 h-3.5 border-l border-gray-400"), children: "Message" }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.duration), children: "Duration" })] });
|
|
69089
|
+
const sortButton = (label) => jsxRuntimeExports.jsxs("button", { type: "button", "aria-label": `${label}, ${sortOrder === "asc" ? "oldest" : "newest"} first`, onClick: () => onSortOrderChange(sortOrder === "asc" ? "desc" : "asc"), className: cn$2(CELL$1, COL.time, "cursor-pointer gap-1.5 border-0 bg-transparent text-left font-sans text-label-14 text-gray-900 hover:text-gray-1000"), children: [label, jsxRuntimeExports.jsx(SortIndicator, { order: sortOrder })] });
|
|
69090
|
+
return jsxRuntimeExports.jsxs("div", { role: "row", className: "flex h-10 shrink-0 items-center border-b border-gray-alpha-400 px-1 font-sans text-label-14 text-gray-900", children: [jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.level) }), showOccurred ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [sortButton("Occurred"), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.time), children: "Created" })] }) : sortButton("Time"), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.since) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.name), children: "Name" }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.event), children: "Event" }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, "min-w-0 flex-1 h-3.5 border-l border-gray-400"), children: "Message" }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.duration), children: "Duration" })] });
|
|
68672
69091
|
}
|
|
68673
69092
|
function IdleGapRow({ ms: ms2, reason }) {
|
|
68674
69093
|
return jsxRuntimeExports.jsxs("div", { className: "mx-1 mt-px flex h-6 items-center gap-2.5 pl-[30px] pr-2 font-mono text-label-12-mono text-gray-700", children: [jsxRuntimeExports.jsx("span", { className: "h-px w-3 shrink-0 bg-gray-400" }), jsxRuntimeExports.jsxs("span", { className: "shrink-0", children: [formatDurationPrecise(ms2), " idle", reason ? ` · ${reason}` : ""] }), jsxRuntimeExports.jsx("span", { className: "h-px flex-1 bg-gray-400" })] });
|
|
@@ -68686,13 +69105,13 @@ function EventRow({ row, index: index2, isSelected, isTabStop, relation, onSelec
|
|
|
68686
69105
|
e.preventDefault();
|
|
68687
69106
|
onSelect(event);
|
|
68688
69107
|
}
|
|
68689
|
-
}, className: cn$2("mx-1 mt-px flex h-6 cursor-pointer items-center rounded-md font-mono text-[13px] leading-5 outline-none focus-visible:relative focus-visible:z-10 focus-visible:shadow-[0_0_0_2px_var(--ds-focus-color)]", LEVEL_ROW_CLASS[level], !isTinted && !relation && index2 % 2 === 1 && "bg-background-200", isRelated && !isTinted && "bg-blue-300/50 hover:bg-blue-300/75", isMuted && "text-gray-700 [&_svg]:text-gray-700", isSelected && LEVEL_SELECTED_CLASS[level]), children: [jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.level), children: jsxRuntimeExports.jsx(LevelIcon, { level }) }), showSeparateEventOccurrenceTimestamps && (occurredAt ? jsxRuntimeExports.jsx(TimestampCell, { date: occurredAt, secondaryClass }) : jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.time, secondaryClass), children: "—" })), jsxRuntimeExports.jsx(TimestampCell, { date: displayedAt, secondaryClass }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.since, "tabular-nums", secondaryClass), children: row.sinceStartMs !== void 0 ? formatSinceStart(row.sinceStartMs) : "" }), jsxRuntimeExports.jsxs("div", { className: cn$2(CELL, COL.name, "gap-2"), title: name2 || void 0, children: [jsxRuntimeExports.jsx(ResourceIcon, { resource: row.resource, isErrored: level === "error", isCancelled: event.eventType === "run_cancelled" }), name2 ? jsxRuntimeExports.jsx("span", { className: cn$2("-mx-1 truncate rounded px-1", isRelated && "text-blue-900", isRelated && isTinted && "bg-blue-100"), children: name2 }) : null] }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.event), children: jsxRuntimeExports.jsx(EventNoticeTooltip, { notice, children: jsxRuntimeExports.jsx("span", { className: cn$2("truncate", notice && "line-through"), title: event.eventType, children: event.eventType }) }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, "min-w-0 flex-1 h-3.5 border-l", LEVEL_SEPARATOR_CLASS[level]), title: message2 || void 0, children: jsxRuntimeExports.jsx("span", { className: "truncate", children: message2 }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.duration, "tabular-nums"), children: row.durationMs !== void 0 ? formatDurationPrecise(row.durationMs) : "" })] });
|
|
69108
|
+
}, className: cn$2("mx-1 mt-px flex h-6 cursor-pointer items-center rounded-md font-mono text-[13px] leading-5 outline-none focus-visible:relative focus-visible:z-10 focus-visible:shadow-[0_0_0_2px_var(--ds-focus-color)]", LEVEL_ROW_CLASS[level], !isTinted && !relation && index2 % 2 === 1 && "bg-background-200", isRelated && !isTinted && "bg-blue-300/50 hover:bg-blue-300/75", isMuted && "text-gray-700 [&_svg]:text-gray-700", isSelected && LEVEL_SELECTED_CLASS[level]), children: [jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.level), children: jsxRuntimeExports.jsx(LevelIcon, { level }) }), showSeparateEventOccurrenceTimestamps && (occurredAt ? jsxRuntimeExports.jsx(TimestampCell, { date: occurredAt, secondaryClass }) : jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.time, secondaryClass), children: "—" })), jsxRuntimeExports.jsx(TimestampCell, { date: displayedAt, secondaryClass }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.since, "tabular-nums", secondaryClass), children: row.sinceStartMs !== void 0 ? formatSinceStart(row.sinceStartMs) : "" }), jsxRuntimeExports.jsxs("div", { className: cn$2(CELL$1, COL.name, "gap-2"), title: name2 || void 0, children: [jsxRuntimeExports.jsx(ResourceIcon, { resource: row.resource, isErrored: level === "error", isCancelled: event.eventType === "run_cancelled" }), name2 ? jsxRuntimeExports.jsx("span", { className: cn$2("-mx-1 truncate rounded px-1", isRelated && "text-blue-900", isRelated && isTinted && "bg-blue-100"), children: name2 }) : null] }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.event), children: jsxRuntimeExports.jsx(EventNoticeTooltip, { notice, children: jsxRuntimeExports.jsx("span", { className: cn$2("truncate", notice && "line-through"), title: event.eventType, children: event.eventType }) }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, "min-w-0 flex-1 h-3.5 border-l", LEVEL_SEPARATOR_CLASS[level]), title: message2 || void 0, children: jsxRuntimeExports.jsx("span", { className: "truncate", children: message2 }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.duration, "tabular-nums"), children: row.durationMs !== void 0 ? formatDurationPrecise(row.durationMs) : "" })] });
|
|
68690
69109
|
}
|
|
68691
69110
|
const SKELETON_MESSAGE_WIDTHS = ["40%", "0%", "25%", "55%", "0%", "30%"];
|
|
68692
69111
|
function EventRowsSkeleton() {
|
|
68693
|
-
return jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-hidden pt-px", children: Array.from({ length: 18 }, (_2, i) => jsxRuntimeExports.jsxs("div", { className: cn$2("mx-1 mt-px flex h-6 items-center rounded-md", i % 2 === 1 && "bg-background-200"), children: [jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.level) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.time), children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3 w-[136px]" }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.since), children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3 w-12" }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.name), children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3 w-24" }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.event), children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3 w-[104px]" }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, "min-w-0 flex-1"), children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3", style: {
|
|
69112
|
+
return jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-hidden pt-px", children: Array.from({ length: 18 }, (_2, i) => jsxRuntimeExports.jsxs("div", { className: cn$2("mx-1 mt-px flex h-6 items-center rounded-md", i % 2 === 1 && "bg-background-200"), children: [jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.level) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.time), children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3 w-[136px]" }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.since), children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3 w-12" }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.name), children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3 w-24" }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.event), children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3 w-[104px]" }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, "min-w-0 flex-1"), children: jsxRuntimeExports.jsx(Skeleton$1, { className: "h-3", style: {
|
|
68694
69113
|
width: SKELETON_MESSAGE_WIDTHS[i % SKELETON_MESSAGE_WIDTHS.length]
|
|
68695
|
-
} }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL, COL.duration) })] }, i)) });
|
|
69114
|
+
} }) }), jsxRuntimeExports.jsx("div", { className: cn$2(CELL$1, COL.duration) })] }, i)) });
|
|
68696
69115
|
}
|
|
68697
69116
|
const WORKFLOW_ULID_BODY = "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}";
|
|
68698
69117
|
const STEP_ID_PATTERN$1 = new RegExp(`^step_(${WORKFLOW_ULID_BODY})$`, "i");
|
|
@@ -87909,9 +88328,9 @@ function tokenizeCodeFenced(effects, ok2, nok) {
|
|
|
87909
88328
|
effects.enter("chunkString", {
|
|
87910
88329
|
contentType: "string"
|
|
87911
88330
|
});
|
|
87912
|
-
return
|
|
88331
|
+
return meta2(code2);
|
|
87913
88332
|
}
|
|
87914
|
-
function
|
|
88333
|
+
function meta2(code2) {
|
|
87915
88334
|
if (code2 === null || markdownLineEnding(code2)) {
|
|
87916
88335
|
effects.exit("chunkString");
|
|
87917
88336
|
effects.exit("codeFencedFenceMeta");
|
|
@@ -87921,7 +88340,7 @@ function tokenizeCodeFenced(effects, ok2, nok) {
|
|
|
87921
88340
|
return nok(code2);
|
|
87922
88341
|
}
|
|
87923
88342
|
effects.consume(code2);
|
|
87924
|
-
return
|
|
88343
|
+
return meta2;
|
|
87925
88344
|
}
|
|
87926
88345
|
function atNonLazyBreak(code2) {
|
|
87927
88346
|
return effects.attempt(closeStart, after, contentBefore)(code2);
|
|
@@ -101132,7 +101551,7 @@ var Ts = (e) => {
|
|
|
101132
101551
|
for (; t > 0 && e[t - 1] === `
|
|
101133
101552
|
`; ) t--;
|
|
101134
101553
|
return e.slice(0, t);
|
|
101135
|
-
}, Ps = reactExports.lazy(() => import("./highlighted-body-JLMTFACH-
|
|
101554
|
+
}, Ps = reactExports.lazy(() => import("./highlighted-body-JLMTFACH-CF_5tt3-.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), At = ({ code: e, language: t, className: n, children: o, isIncomplete: r2 = false, startLine: s2, lineNumbers: a2, ...i }) => {
|
|
101136
101555
|
let l = w(), { codeBlockMaxHeight: c2 } = reactExports.useContext(R), d2 = reactExports.useMemo(() => Ts(e), [e]), p2 = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: d2.split(`
|
|
101137
101556
|
`).map((b2) => [{ content: b2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [d2]);
|
|
101138
101557
|
return jsxRuntimeExports.jsx(Lt.Provider, { value: { code: e }, children: jsxRuntimeExports.jsxs(It, { dir: "ltr", isIncomplete: r2, language: t, children: [jsxRuntimeExports.jsx(Dt, { language: t }), o ? jsxRuntimeExports.jsx("div", { className: l("pointer-events-none absolute top-2 right-2 z-10 flex items-center"), children: jsxRuntimeExports.jsx("div", { className: l("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"), "data-streamdown": "code-block-actions", children: o }) }) : null, jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: jsxRuntimeExports.jsx(In, { className: n, language: t, lineNumbers: a2, maxHeight: c2, result: p2, startLine: s2, ...i }), children: jsxRuntimeExports.jsx(Ps, { className: n, code: d2, isIncomplete: r2, language: t, lineNumbers: a2, maxHeight: c2, raw: p2, startLine: s2, ...i }) })] }) });
|
|
@@ -101567,7 +101986,7 @@ var Co = ({ children: e, className: t, maxHeight: n, showControls: o, showCopy:
|
|
|
101567
101986
|
let l = w(), { isAnimating: c2 } = reactExports.useContext(R), d2 = rt(n), p2 = st(c2, !!d2, e), b2 = o && r2, f2 = o && s2, u = o && a2, g2 = b2 || f2 || u;
|
|
101568
101987
|
return jsxRuntimeExports.jsxs("div", { className: l("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"), "data-streamdown": "table-wrapper", children: [g2 ? jsxRuntimeExports.jsxs("div", { className: l("flex items-center justify-end gap-1"), children: [b2 ? jsxRuntimeExports.jsx(Ze, {}) : null, f2 ? jsxRuntimeExports.jsx(Ge, {}) : null, u ? jsxRuntimeExports.jsx(ho, { showCopy: b2, showDownload: f2, children: e }) : null] }) : null, jsxRuntimeExports.jsx("div", { className: l("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"), ref: p2, style: d2 ? { maxHeight: d2 } : void 0, children: jsxRuntimeExports.jsx("table", { className: l("w-full divide-y divide-border", t), "data-streamdown": "table", ...i, children: e }) })] });
|
|
101569
101988
|
};
|
|
101570
|
-
var Na = /startLine=(\d+)/, Ra = /\bnoLineNumbers\b/, Ia = reactExports.lazy(() => import("./mermaid-WFAXDIZX-
|
|
101989
|
+
var Na = /startLine=(\d+)/, Ra = /\bnoLineNumbers\b/, Ia = reactExports.lazy(() => import("./mermaid-WFAXDIZX-BHZz_uL6.js").then((e) => ({ default: e.Mermaid }))), La = /language-([^\s]+)/, Da = "node";
|
|
101571
101990
|
function H(e, t) {
|
|
101572
101991
|
let n = Object.keys(e);
|
|
101573
101992
|
if (n.length !== Object.keys(t).length) return false;
|
|
@@ -103329,7 +103748,7 @@ function EntityDetailPanel({ run: run2, onStreamClick, onRunClick, fetchSpanDeta
|
|
|
103329
103748
|
run2.status,
|
|
103330
103749
|
resolvedHookIds
|
|
103331
103750
|
]);
|
|
103332
|
-
const
|
|
103751
|
+
const hookToken2 = reactExports.useMemo(() => {
|
|
103333
103752
|
if (resource !== "hook" || !resourceId)
|
|
103334
103753
|
return void 0;
|
|
103335
103754
|
if (isHook(matchedSpanDetailData) && matchedSpanDetailData.token) {
|
|
@@ -103386,7 +103805,7 @@ function EntityDetailPanel({ run: run2, onStreamClick, onRunClick, fetchSpanDeta
|
|
|
103386
103805
|
});
|
|
103387
103806
|
return;
|
|
103388
103807
|
}
|
|
103389
|
-
if (!
|
|
103808
|
+
if (!hookToken2) {
|
|
103390
103809
|
toast2.error("Unable to resolve hook", {
|
|
103391
103810
|
description: "Missing hook token. Try refreshing the run data and retry."
|
|
103392
103811
|
});
|
|
@@ -103396,7 +103815,7 @@ function EntityDetailPanel({ run: run2, onStreamClick, onRunClick, fetchSpanDeta
|
|
|
103396
103815
|
setResolvingHook(true);
|
|
103397
103816
|
const candidate = matchedSpanDetailData ?? data2;
|
|
103398
103817
|
const hook = isHook(candidate) ? candidate : void 0;
|
|
103399
|
-
await onResolveHook(
|
|
103818
|
+
await onResolveHook(hookToken2, payload, hook);
|
|
103400
103819
|
toast2.success("Hook resolved", {
|
|
103401
103820
|
description: "The payload has been sent and the hook resolved."
|
|
103402
103821
|
});
|
|
@@ -103412,7 +103831,7 @@ function EntityDetailPanel({ run: run2, onStreamClick, onRunClick, fetchSpanDeta
|
|
|
103412
103831
|
} finally {
|
|
103413
103832
|
setResolvingHook(false);
|
|
103414
103833
|
}
|
|
103415
|
-
}, [onResolveHook,
|
|
103834
|
+
}, [onResolveHook, hookToken2, resolvingHook, matchedSpanDetailData, data2]);
|
|
103416
103835
|
const moduleSpecifier = reactExports.useMemo(() => {
|
|
103417
103836
|
const displayRecord = displayData;
|
|
103418
103837
|
const displayStepName = displayRecord.stepName;
|
|
@@ -107259,6 +107678,9 @@ async function fetchRuns$1(worldEnv, params) {
|
|
|
107259
107678
|
async function fetchRun$1(worldEnv, runId, resolveData = "all") {
|
|
107260
107679
|
return rpc("fetchRun", { worldEnv, runId, resolveData });
|
|
107261
107680
|
}
|
|
107681
|
+
async function fetchRunUsage$1(worldEnv, runId) {
|
|
107682
|
+
return rpc("fetchRunUsage", { worldEnv, runId });
|
|
107683
|
+
}
|
|
107262
107684
|
async function fetchStep$1(worldEnv, runId, stepId, resolveData = "all") {
|
|
107263
107685
|
return rpc("fetchStep", { worldEnv, runId, stepId, resolveData });
|
|
107264
107686
|
}
|
|
@@ -107539,6 +107961,8 @@ function Logo({ className } = {}) {
|
|
|
107539
107961
|
}
|
|
107540
107962
|
);
|
|
107541
107963
|
}
|
|
107964
|
+
const DEFAULT_TITLE = "Workflow Observability UI";
|
|
107965
|
+
const DEFAULT_META_DESCRIPTION = "Web interface for inspecting flow runs, steps, streams, and events";
|
|
107542
107966
|
const RETRYABLE_WORLD_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
107543
107967
|
"TRANSPORT",
|
|
107544
107968
|
"TIMEOUT",
|
|
@@ -112483,7 +112907,7 @@ var EventConsumerResult;
|
|
|
112483
112907
|
})(EventConsumerResult || (EventConsumerResult = {}));
|
|
112484
112908
|
_g = ABORT_STREAM_NAME, _f = ABORT_HOOK_TOKEN;
|
|
112485
112909
|
class WorkflowAbortSignal {
|
|
112486
|
-
constructor(streamName,
|
|
112910
|
+
constructor(streamName, hookToken2) {
|
|
112487
112911
|
__publicField(this, "aborted", false);
|
|
112488
112912
|
__publicField(this, "reason");
|
|
112489
112913
|
__publicField(this, _g);
|
|
@@ -112491,7 +112915,7 @@ class WorkflowAbortSignal {
|
|
|
112491
112915
|
__privateAdd(this, _listeners, []);
|
|
112492
112916
|
__privateAdd(this, _onabort, null);
|
|
112493
112917
|
this[ABORT_STREAM_NAME] = streamName;
|
|
112494
|
-
this[ABORT_HOOK_TOKEN] =
|
|
112918
|
+
this[ABORT_HOOK_TOKEN] = hookToken2;
|
|
112495
112919
|
}
|
|
112496
112920
|
get onabort() {
|
|
112497
112921
|
return __privateGet(this, _onabort);
|
|
@@ -113469,22 +113893,22 @@ function getAllBaseReducers(global2 = globalThis) {
|
|
|
113469
113893
|
}
|
|
113470
113894
|
function reduceAbortWithListener(signal, holder, global2, ops, runId, cryptoKey, framedAbortStreams) {
|
|
113471
113895
|
let streamName = holder[ABORT_STREAM_NAME];
|
|
113472
|
-
let
|
|
113896
|
+
let hookToken2 = holder[ABORT_HOOK_TOKEN];
|
|
113473
113897
|
if (!streamName) {
|
|
113474
113898
|
const id2 = (global2[STABLE_ULID] || defaultUlid)();
|
|
113475
113899
|
streamName = getAbortStreamId(id2);
|
|
113476
|
-
|
|
113900
|
+
hookToken2 = `abrt_${id2}`;
|
|
113477
113901
|
holder[ABORT_STREAM_NAME] = streamName;
|
|
113478
|
-
holder[ABORT_HOOK_TOKEN] =
|
|
113902
|
+
holder[ABORT_HOOK_TOKEN] = hookToken2;
|
|
113479
113903
|
if (holder.signal) {
|
|
113480
113904
|
holder.signal[ABORT_STREAM_NAME] = streamName;
|
|
113481
|
-
holder.signal[ABORT_HOOK_TOKEN] =
|
|
113905
|
+
holder.signal[ABORT_HOOK_TOKEN] = hookToken2;
|
|
113482
113906
|
}
|
|
113483
113907
|
}
|
|
113484
113908
|
attachAbortListenerOnce(signal, streamName, runId, cryptoKey, ops, framedAbortStreams);
|
|
113485
113909
|
return {
|
|
113486
113910
|
streamName,
|
|
113487
|
-
hookToken,
|
|
113911
|
+
hookToken: hookToken2,
|
|
113488
113912
|
aborted: signal.aborted,
|
|
113489
113913
|
reason: signal.aborted ? signal.reason : void 0
|
|
113490
113914
|
};
|
|
@@ -113492,13 +113916,13 @@ function reduceAbortWithListener(signal, holder, global2, ops, runId, cryptoKey,
|
|
|
113492
113916
|
function reduceAbortBySymbol(signal, holder) {
|
|
113493
113917
|
var _a3, _b2;
|
|
113494
113918
|
const streamName = holder[ABORT_STREAM_NAME] ?? ((_a3 = holder.signal) == null ? void 0 : _a3[ABORT_STREAM_NAME]);
|
|
113495
|
-
const
|
|
113919
|
+
const hookToken2 = holder[ABORT_HOOK_TOKEN] ?? ((_b2 = holder.signal) == null ? void 0 : _b2[ABORT_HOOK_TOKEN]);
|
|
113496
113920
|
if (!streamName) {
|
|
113497
113921
|
throw new Error("AbortController/AbortSignal stream name is not set");
|
|
113498
113922
|
}
|
|
113499
113923
|
return {
|
|
113500
113924
|
streamName,
|
|
113501
|
-
hookToken,
|
|
113925
|
+
hookToken: hookToken2,
|
|
113502
113926
|
aborted: signal.aborted,
|
|
113503
113927
|
reason: signal.aborted ? signal.reason : void 0
|
|
113504
113928
|
};
|
|
@@ -114789,7 +115213,7 @@ function getCompressionMode(capabilities) {
|
|
|
114789
115213
|
}
|
|
114790
115214
|
return capabilities.supportedFormats.has(SerializationFormat$1.ZSTD) ? true : "gzip";
|
|
114791
115215
|
}
|
|
114792
|
-
const version$2 = "5.7.
|
|
115216
|
+
const version$2 = "5.7.2";
|
|
114793
115217
|
globalSingleton("@workflow/core//envWarnings", 1, () => ({
|
|
114794
115218
|
replayTimeoutValues: /* @__PURE__ */ new Set(),
|
|
114795
115219
|
maxInlineStepsValues: /* @__PURE__ */ new Set(),
|
|
@@ -121303,8 +121727,8 @@ function requireWebidl() {
|
|
|
121303
121727
|
return new TypeError(`${message2.header}: ${message2.message}`);
|
|
121304
121728
|
};
|
|
121305
121729
|
webidl.errors.conversionFailed = function(opts) {
|
|
121306
|
-
const
|
|
121307
|
-
const message2 = `${opts.argument} could not be converted to${
|
|
121730
|
+
const plural2 = opts.types.length === 1 ? "" : " one of";
|
|
121731
|
+
const message2 = `${opts.argument} could not be converted to${plural2}: ${opts.types.join(", ")}.`;
|
|
121308
121732
|
return webidl.errors.exception({
|
|
121309
121733
|
header: opts.prefix,
|
|
121310
121734
|
message: message2
|
|
@@ -132290,8 +132714,8 @@ function requireDns() {
|
|
|
132290
132714
|
deleteRecords(origin) {
|
|
132291
132715
|
this.storage.delete(origin.hostname);
|
|
132292
132716
|
}
|
|
132293
|
-
getHandler(
|
|
132294
|
-
return new DNSDispatchHandler(this,
|
|
132717
|
+
getHandler(meta2, opts) {
|
|
132718
|
+
return new DNSDispatchHandler(this, meta2, opts);
|
|
132295
132719
|
}
|
|
132296
132720
|
}
|
|
132297
132721
|
_maxTTL = new WeakMap();
|
|
@@ -144632,6 +145056,105 @@ function backstopWakeDelaySeconds(resumeAt, now2) {
|
|
|
144632
145056
|
return void 0;
|
|
144633
145057
|
return Math.ceil(delayMs / 1e3);
|
|
144634
145058
|
}
|
|
145059
|
+
const PAYLOAD_PATHS = {
|
|
145060
|
+
// A dynamic run's code is kept on the run, not on its events, so it is
|
|
145061
|
+
// not here.
|
|
145062
|
+
run_created: ["$.eventData.input", "$.eventData.startHook.metadata"],
|
|
145063
|
+
run_started: ["$.eventData.input", "$.eventData.startHook.metadata"],
|
|
145064
|
+
run_completed: ["$.eventData.output"],
|
|
145065
|
+
run_failed: ["$.eventData.error"],
|
|
145066
|
+
step_created: ["$.eventData.input"],
|
|
145067
|
+
step_started: ["$.eventData.input"],
|
|
145068
|
+
step_completed: ["$.eventData.result"],
|
|
145069
|
+
step_failed: ["$.eventData.error"],
|
|
145070
|
+
step_retrying: ["$.eventData.error"],
|
|
145071
|
+
hook_created: ["$.eventData.metadata"],
|
|
145072
|
+
hook_received: ["$.eventData.payload"]
|
|
145073
|
+
};
|
|
145074
|
+
function valueBytesSql(path2) {
|
|
145075
|
+
const data2 = `CAST(json_extract(doc, '${path2}.data') AS BLOB)`;
|
|
145076
|
+
return `CASE WHEN json_extract(doc, '${path2}.__type') = 'Uint8Array'
|
|
145077
|
+
THEN length(${data2}) / 4 * 3 - (CASE WHEN substr(${data2}, -2) = X'3D3D' THEN 2 WHEN substr(${data2}, -1) = X'3D' THEN 1 ELSE 0 END)
|
|
145078
|
+
ELSE coalesce(length(CAST(doc -> '${path2}' AS BLOB)), 0) END`;
|
|
145079
|
+
}
|
|
145080
|
+
const PAYLOAD_BYTES_SQL = `(CASE event_type ${Object.entries(PAYLOAD_PATHS).map(([eventType, paths]) => `WHEN '${eventType}' THEN ${paths.map((path2) => `(${valueBytesSql(path2)})`).join(" + ")}`).join(" ")} ELSE 0 END)`;
|
|
145081
|
+
const STREAM_BYTES_SQL = `
|
|
145082
|
+
SELECT COALESCE(SUM(length(data)), 0) AS bytes
|
|
145083
|
+
FROM stream_chunks
|
|
145084
|
+
WHERE run_id = ?
|
|
145085
|
+
`;
|
|
145086
|
+
function measureStreamBytes(db, runId) {
|
|
145087
|
+
var _a3;
|
|
145088
|
+
return Number(((_a3 = db.get(STREAM_BYTES_SQL, runId)) == null ? void 0 : _a3.bytes) ?? 0);
|
|
145089
|
+
}
|
|
145090
|
+
const TABLE = "run_usage_purged";
|
|
145091
|
+
const CREATE_TABLE_SQL = `
|
|
145092
|
+
CREATE TABLE IF NOT EXISTS ${TABLE} (
|
|
145093
|
+
run_id TEXT PRIMARY KEY,
|
|
145094
|
+
-- The last log position the sizes below cover.
|
|
145095
|
+
seq INTEGER NOT NULL,
|
|
145096
|
+
run_bytes INTEGER NOT NULL,
|
|
145097
|
+
step_bytes INTEGER NOT NULL,
|
|
145098
|
+
hook_bytes INTEGER NOT NULL,
|
|
145099
|
+
stream_bytes INTEGER NOT NULL
|
|
145100
|
+
)
|
|
145101
|
+
`;
|
|
145102
|
+
class EntityBytes {
|
|
145103
|
+
constructor() {
|
|
145104
|
+
__publicField(this, "byEntity", {
|
|
145105
|
+
run: 0,
|
|
145106
|
+
step: 0,
|
|
145107
|
+
hook: 0,
|
|
145108
|
+
stream: 0
|
|
145109
|
+
});
|
|
145110
|
+
}
|
|
145111
|
+
add(eventType, bytes) {
|
|
145112
|
+
const entity = usageEntityOfEventType(eventType);
|
|
145113
|
+
if (entity)
|
|
145114
|
+
this.byEntity[entity] += Number(bytes) || 0;
|
|
145115
|
+
}
|
|
145116
|
+
}
|
|
145117
|
+
function tableExists(db) {
|
|
145118
|
+
return db.get("SELECT 1 AS one FROM sqlite_master WHERE type = 'table' AND name = ?", TABLE) !== void 0;
|
|
145119
|
+
}
|
|
145120
|
+
function savePurgedUsage(db, runId, usage) {
|
|
145121
|
+
db.run(CREATE_TABLE_SQL);
|
|
145122
|
+
db.run(`INSERT INTO ${TABLE}
|
|
145123
|
+
(run_id, seq, run_bytes, step_bytes, hook_bytes, stream_bytes)
|
|
145124
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
145125
|
+
ON CONFLICT (run_id) DO UPDATE SET
|
|
145126
|
+
seq = excluded.seq,
|
|
145127
|
+
run_bytes = excluded.run_bytes,
|
|
145128
|
+
step_bytes = excluded.step_bytes,
|
|
145129
|
+
hook_bytes = excluded.hook_bytes,
|
|
145130
|
+
stream_bytes = excluded.stream_bytes`, runId, usage.seq, usage.byEntity.run, usage.byEntity.step, usage.byEntity.hook, usage.byEntity.stream);
|
|
145131
|
+
}
|
|
145132
|
+
function readPurgedUsage(db, runId) {
|
|
145133
|
+
if (!tableExists(db))
|
|
145134
|
+
return null;
|
|
145135
|
+
const row = db.get(`SELECT seq, run_bytes, step_bytes, hook_bytes, stream_bytes
|
|
145136
|
+
FROM ${TABLE} WHERE run_id = ?`, runId);
|
|
145137
|
+
if (!row)
|
|
145138
|
+
return null;
|
|
145139
|
+
return {
|
|
145140
|
+
seq: Number(row.seq),
|
|
145141
|
+
byEntity: {
|
|
145142
|
+
run: Number(row.run_bytes),
|
|
145143
|
+
step: Number(row.step_bytes),
|
|
145144
|
+
hook: Number(row.hook_bytes),
|
|
145145
|
+
stream: Number(row.stream_bytes)
|
|
145146
|
+
}
|
|
145147
|
+
};
|
|
145148
|
+
}
|
|
145149
|
+
function deletePurgedUsage(db, where) {
|
|
145150
|
+
if (!tableExists(db))
|
|
145151
|
+
return;
|
|
145152
|
+
if (!where) {
|
|
145153
|
+
db.run(`DELETE FROM ${TABLE}`);
|
|
145154
|
+
return;
|
|
145155
|
+
}
|
|
145156
|
+
db.run(`DELETE FROM ${TABLE} WHERE run_id IN (${where.runIdsSql})`, ...where.params);
|
|
145157
|
+
}
|
|
144635
145158
|
function truncateForError(value) {
|
|
144636
145159
|
const s2 = typeof value === "string" ? value : String(value);
|
|
144637
145160
|
const MAX = 48;
|
|
@@ -144666,11 +145189,31 @@ function ranPurge(run2) {
|
|
|
144666
145189
|
return true;
|
|
144667
145190
|
return run2.expiredAt !== void 0 && new Date(run2.expiredAt).getTime() <= Date.now();
|
|
144668
145191
|
}
|
|
144669
|
-
function purgeRunData(db, runId) {
|
|
145192
|
+
function purgeRunData(db, runId, { purgedBefore = false } = {}) {
|
|
144670
145193
|
for (const row of db.all("SELECT step_id, doc FROM steps WHERE run_id = ?", runId)) {
|
|
144671
145194
|
writeScrubbedStep(db, runId, row.step_id, row.doc);
|
|
144672
145195
|
}
|
|
144673
|
-
|
|
145196
|
+
const saved = readPurgedUsage(db, runId);
|
|
145197
|
+
const written = new EntityBytes();
|
|
145198
|
+
let lastSeq = 0;
|
|
145199
|
+
const events2 = db.all(`SELECT seq, event_type, doc, ${PAYLOAD_BYTES_SQL} AS bytes
|
|
145200
|
+
FROM events WHERE run_id = ?`, runId);
|
|
145201
|
+
for (const row of events2) {
|
|
145202
|
+
lastSeq = Math.max(lastSeq, Number(row.seq));
|
|
145203
|
+
if (saved && Number(row.seq) <= saved.seq)
|
|
145204
|
+
continue;
|
|
145205
|
+
written.add(row.event_type, row.bytes);
|
|
145206
|
+
}
|
|
145207
|
+
written.byEntity.stream = measureStreamBytes(db, runId);
|
|
145208
|
+
if (saved) {
|
|
145209
|
+
savePurgedUsage(db, runId, {
|
|
145210
|
+
seq: lastSeq,
|
|
145211
|
+
byEntity: addBytes(saved.byEntity, written.byEntity)
|
|
145212
|
+
});
|
|
145213
|
+
} else if (!purgedBefore) {
|
|
145214
|
+
savePurgedUsage(db, runId, { seq: lastSeq, byEntity: written.byEntity });
|
|
145215
|
+
}
|
|
145216
|
+
for (const row of events2) {
|
|
144674
145217
|
writeScrubbedEvent(db, runId, row.seq, row.doc);
|
|
144675
145218
|
}
|
|
144676
145219
|
for (const row of db.all("SELECT hook_id, doc FROM hooks WHERE run_id = ?", runId)) {
|
|
@@ -144690,8 +145233,29 @@ function purgeLateStepWrite(db, runId, stepId, seq) {
|
|
|
144690
145233
|
db.run("UPDATE steps SET doc = ? WHERE run_id = ? AND step_id = ?", encode$1(step), runId, stepId);
|
|
144691
145234
|
}
|
|
144692
145235
|
const event = db.get("SELECT doc FROM events WHERE run_id = ? AND seq = ?", runId, seq);
|
|
144693
|
-
if (event)
|
|
144694
|
-
|
|
145236
|
+
if (!event)
|
|
145237
|
+
return;
|
|
145238
|
+
const saved = readPurgedUsage(db, runId);
|
|
145239
|
+
if (saved && seq > saved.seq) {
|
|
145240
|
+
const written = new EntityBytes();
|
|
145241
|
+
for (const row of db.all(`SELECT event_type, ${PAYLOAD_BYTES_SQL} AS bytes
|
|
145242
|
+
FROM events WHERE run_id = ? AND seq > ? AND seq <= ?`, runId, saved.seq, seq)) {
|
|
145243
|
+
written.add(row.event_type, row.bytes);
|
|
145244
|
+
}
|
|
145245
|
+
savePurgedUsage(db, runId, {
|
|
145246
|
+
seq,
|
|
145247
|
+
byEntity: addBytes(saved.byEntity, written.byEntity)
|
|
145248
|
+
});
|
|
145249
|
+
}
|
|
145250
|
+
writeScrubbedEvent(db, runId, seq, event.doc);
|
|
145251
|
+
}
|
|
145252
|
+
function addBytes(a2, b2) {
|
|
145253
|
+
return {
|
|
145254
|
+
run: a2.run + b2.run,
|
|
145255
|
+
step: a2.step + b2.step,
|
|
145256
|
+
hook: a2.hook + b2.hook,
|
|
145257
|
+
stream: a2.stream + b2.stream
|
|
145258
|
+
};
|
|
144695
145259
|
}
|
|
144696
145260
|
function writeScrubbedStep(db, runId, stepId, doc) {
|
|
144697
145261
|
const step = decode$1(doc);
|
|
@@ -144929,6 +145493,7 @@ class Store {
|
|
|
144929
145493
|
eventsBetween(runId, afterSeq, beforeSeq) {
|
|
144930
145494
|
return this.db.all("SELECT doc FROM events WHERE run_id = ? AND seq > ? AND seq < ? ORDER BY seq", runId, afterSeq, beforeSeq).map((row) => decode$1(row.doc));
|
|
144931
145495
|
}
|
|
145496
|
+
// A caller that rewrites a live run's events makes the usage cache stale (see usage-storage.ts).
|
|
144932
145497
|
rewriteEvent(event) {
|
|
144933
145498
|
const seq = eventIdToSlot(event.eventId);
|
|
144934
145499
|
if (seq === null)
|
|
@@ -146096,7 +146661,7 @@ function createRunsStorage(db, tag) {
|
|
|
146096
146661
|
const alreadyDeleted = run2.expiredAt !== void 0 && run2.expiredAt.getTime() <= now2.getTime();
|
|
146097
146662
|
if (!alreadyDeleted)
|
|
146098
146663
|
store.updateRun(withRunPayloadsPurged(run2, now2));
|
|
146099
|
-
purgeRunData(db, runId);
|
|
146664
|
+
purgeRunData(db, runId, { purgedBefore: alreadyDeleted });
|
|
146100
146665
|
return { runId, outcome: alreadyDeleted ? "already_deleted" : "deleted" };
|
|
146101
146666
|
}
|
|
146102
146667
|
return {
|
|
@@ -146289,6 +146854,320 @@ function createStepsStorage(db, tag) {
|
|
|
146289
146854
|
})
|
|
146290
146855
|
};
|
|
146291
146856
|
}
|
|
146857
|
+
const IS_STEP_EVENT = `event_type LIKE 'step\\_%' ESCAPE '\\'`;
|
|
146858
|
+
const EVENT_GROUPS_SQL = `
|
|
146859
|
+
SELECT event_type,
|
|
146860
|
+
COUNT(*) AS events,
|
|
146861
|
+
SUM(${PAYLOAD_BYTES_SQL}) AS bytes
|
|
146862
|
+
FROM events
|
|
146863
|
+
WHERE run_id = ?1 AND seq > ?2 AND seq <= ?3 AND NOT (${IS_STEP_EVENT})
|
|
146864
|
+
GROUP BY event_type
|
|
146865
|
+
`;
|
|
146866
|
+
const STEP_GROUPS_SQL = `
|
|
146867
|
+
SELECT correlation_id,
|
|
146868
|
+
COUNT(*) AS events,
|
|
146869
|
+
SUM(event_type = 'step_created') AS created,
|
|
146870
|
+
SUM(event_type = 'step_started') AS started,
|
|
146871
|
+
SUM(event_type = 'step_completed') AS completed,
|
|
146872
|
+
SUM(event_type = 'step_failed') AS failed,
|
|
146873
|
+
SUM(event_type = 'step_retrying') AS retries,
|
|
146874
|
+
SUM(${PAYLOAD_BYTES_SQL}) AS bytes
|
|
146875
|
+
FROM events
|
|
146876
|
+
WHERE run_id = ?1 AND seq > ?2 AND seq <= ?3 AND ${IS_STEP_EVENT}
|
|
146877
|
+
GROUP BY correlation_id
|
|
146878
|
+
`;
|
|
146879
|
+
const WAIT_IDS_SQL = `
|
|
146880
|
+
SELECT DISTINCT correlation_id
|
|
146881
|
+
FROM events
|
|
146882
|
+
WHERE run_id = ?1 AND seq > ?2 AND seq <= ?3
|
|
146883
|
+
AND correlation_id IS NOT NULL AND substr(event_type, 1, 5) = 'wait_'
|
|
146884
|
+
`;
|
|
146885
|
+
const HOOK_GROUPS_SQL = `
|
|
146886
|
+
SELECT correlation_id, COUNT(*) AS events
|
|
146887
|
+
FROM events
|
|
146888
|
+
WHERE run_id = ?1 AND seq > ?2 AND seq <= ?3
|
|
146889
|
+
AND correlation_id IS NOT NULL AND substr(event_type, 1, 5) = 'hook_'
|
|
146890
|
+
GROUP BY correlation_id
|
|
146891
|
+
`;
|
|
146892
|
+
const HOOK_TOKEN_SQL = `
|
|
146893
|
+
SELECT json_extract(doc, '$.eventData.token') AS token
|
|
146894
|
+
FROM ${EVENTS_BY_CORRELATION}
|
|
146895
|
+
WHERE run_id = ? AND correlation_id = ?
|
|
146896
|
+
AND event_type IN ('hook_created', 'hook_conflict')
|
|
146897
|
+
ORDER BY seq LIMIT 1
|
|
146898
|
+
`;
|
|
146899
|
+
const HOOK_ROW_TOKEN_SQL = "SELECT token FROM hooks WHERE hook_id = ?";
|
|
146900
|
+
const START_HOOK_TOKEN_SQL = `
|
|
146901
|
+
SELECT json_extract(doc, '$.eventData.startHook.token') AS token
|
|
146902
|
+
FROM events
|
|
146903
|
+
WHERE run_id = ? AND event_type = 'run_created'
|
|
146904
|
+
LIMIT 1
|
|
146905
|
+
`;
|
|
146906
|
+
const STEP_NAME_SQL = `
|
|
146907
|
+
SELECT json_extract(doc, '$.stepName') AS step_name
|
|
146908
|
+
FROM steps WHERE run_id = ? AND step_id = ?
|
|
146909
|
+
`;
|
|
146910
|
+
const BATCH_END_SQL = `
|
|
146911
|
+
SELECT MAX(seq) AS seq FROM (
|
|
146912
|
+
SELECT seq FROM events WHERE run_id = ? AND seq > ? ORDER BY seq LIMIT ?
|
|
146913
|
+
)
|
|
146914
|
+
`;
|
|
146915
|
+
const EVENTS_AFTER_SQL = `
|
|
146916
|
+
SELECT event_type, SUM(${PAYLOAD_BYTES_SQL}) AS bytes
|
|
146917
|
+
FROM events
|
|
146918
|
+
WHERE run_id = ? AND seq > ?
|
|
146919
|
+
GROUP BY event_type
|
|
146920
|
+
`;
|
|
146921
|
+
const PURGED_RUN_SQL = `
|
|
146922
|
+
SELECT json_extract(doc, '$.expiredAt') IS NOT NULL AS purged
|
|
146923
|
+
FROM runs WHERE run_id = ?
|
|
146924
|
+
`;
|
|
146925
|
+
const newCounts = () => ({
|
|
146926
|
+
countedSeq: 0,
|
|
146927
|
+
finished: false,
|
|
146928
|
+
eventTypes: /* @__PURE__ */ new Map(),
|
|
146929
|
+
steps: /* @__PURE__ */ new Map(),
|
|
146930
|
+
hooks: /* @__PURE__ */ new Map(),
|
|
146931
|
+
waitIds: /* @__PURE__ */ new Set()
|
|
146932
|
+
});
|
|
146933
|
+
function countRange(db, runId, counts, from, to2) {
|
|
146934
|
+
var _a3;
|
|
146935
|
+
if (to2 <= from)
|
|
146936
|
+
return;
|
|
146937
|
+
for (const row of db.all(EVENT_GROUPS_SQL, runId, from, to2)) {
|
|
146938
|
+
const entry2 = counts.eventTypes.get(row.event_type) ?? {
|
|
146939
|
+
events: 0,
|
|
146940
|
+
bytes: 0
|
|
146941
|
+
};
|
|
146942
|
+
entry2.events += Number(row.events);
|
|
146943
|
+
entry2.bytes += Number(row.bytes ?? 0);
|
|
146944
|
+
counts.eventTypes.set(row.event_type, entry2);
|
|
146945
|
+
}
|
|
146946
|
+
for (const row of db.all(STEP_GROUPS_SQL, runId, from, to2)) {
|
|
146947
|
+
const stepId = row.correlation_id ?? "";
|
|
146948
|
+
let step = counts.steps.get(stepId);
|
|
146949
|
+
if (!step) {
|
|
146950
|
+
const name2 = row.correlation_id === null ? null : ((_a3 = db.get(STEP_NAME_SQL, runId, row.correlation_id)) == null ? void 0 : _a3.step_name) ?? null;
|
|
146951
|
+
step = {
|
|
146952
|
+
name: name2,
|
|
146953
|
+
events: 0,
|
|
146954
|
+
created: 0,
|
|
146955
|
+
started: 0,
|
|
146956
|
+
completed: 0,
|
|
146957
|
+
failed: 0,
|
|
146958
|
+
retries: 0,
|
|
146959
|
+
bytes: 0
|
|
146960
|
+
};
|
|
146961
|
+
counts.steps.set(stepId, step);
|
|
146962
|
+
}
|
|
146963
|
+
step.events += Number(row.events);
|
|
146964
|
+
step.created += Number(row.created);
|
|
146965
|
+
step.started += Number(row.started);
|
|
146966
|
+
step.completed += Number(row.completed);
|
|
146967
|
+
step.failed += Number(row.failed);
|
|
146968
|
+
step.retries += Number(row.retries);
|
|
146969
|
+
step.bytes += Number(row.bytes ?? 0);
|
|
146970
|
+
}
|
|
146971
|
+
for (const row of db.all(HOOK_GROUPS_SQL, runId, from, to2)) {
|
|
146972
|
+
let hook = counts.hooks.get(row.correlation_id);
|
|
146973
|
+
if (!hook) {
|
|
146974
|
+
hook = { token: hookToken(db, runId, row.correlation_id), events: 0 };
|
|
146975
|
+
counts.hooks.set(row.correlation_id, hook);
|
|
146976
|
+
}
|
|
146977
|
+
hook.events += Number(row.events);
|
|
146978
|
+
}
|
|
146979
|
+
for (const row of db.all(WAIT_IDS_SQL, runId, from, to2)) {
|
|
146980
|
+
counts.waitIds.add(row.correlation_id);
|
|
146981
|
+
}
|
|
146982
|
+
counts.countedSeq = to2;
|
|
146983
|
+
}
|
|
146984
|
+
function hookToken(db, runId, hookId) {
|
|
146985
|
+
const created = db.get(HOOK_TOKEN_SQL, runId, hookId);
|
|
146986
|
+
if (typeof (created == null ? void 0 : created.token) === "string" && created.token)
|
|
146987
|
+
return created.token;
|
|
146988
|
+
const row = db.get(HOOK_ROW_TOKEN_SQL, hookId);
|
|
146989
|
+
if (typeof (row == null ? void 0 : row.token) === "string" && row.token)
|
|
146990
|
+
return row.token;
|
|
146991
|
+
let startHook;
|
|
146992
|
+
try {
|
|
146993
|
+
startHook = startHookId(runId);
|
|
146994
|
+
} catch {
|
|
146995
|
+
return null;
|
|
146996
|
+
}
|
|
146997
|
+
if (hookId !== startHook)
|
|
146998
|
+
return null;
|
|
146999
|
+
const start2 = db.get(START_HOOK_TOKEN_SQL, runId);
|
|
147000
|
+
return typeof (start2 == null ? void 0 : start2.token) === "string" && start2.token ? start2.token : null;
|
|
147001
|
+
}
|
|
147002
|
+
function hookGroupsOf(counts) {
|
|
147003
|
+
return [...counts.hooks].map(([hookId, hook]) => ({
|
|
147004
|
+
hookId,
|
|
147005
|
+
token: hook.token,
|
|
147006
|
+
events: hook.events
|
|
147007
|
+
}));
|
|
147008
|
+
}
|
|
147009
|
+
function eventGroupsOf(counts) {
|
|
147010
|
+
return [...counts.eventTypes].map(([eventType, entry2]) => ({
|
|
147011
|
+
eventType,
|
|
147012
|
+
events: entry2.events,
|
|
147013
|
+
bytes: entry2.bytes
|
|
147014
|
+
}));
|
|
147015
|
+
}
|
|
147016
|
+
function stepGroupsOf(counts) {
|
|
147017
|
+
const byName = /* @__PURE__ */ new Map();
|
|
147018
|
+
for (const step of counts.steps.values()) {
|
|
147019
|
+
let group = byName.get(step.name);
|
|
147020
|
+
if (!group) {
|
|
147021
|
+
group = {
|
|
147022
|
+
stepName: step.name,
|
|
147023
|
+
steps: 0,
|
|
147024
|
+
events: 0,
|
|
147025
|
+
created: 0,
|
|
147026
|
+
started: 0,
|
|
147027
|
+
completed: 0,
|
|
147028
|
+
failed: 0,
|
|
147029
|
+
retries: 0,
|
|
147030
|
+
restarts: 0,
|
|
147031
|
+
bytes: 0
|
|
147032
|
+
};
|
|
147033
|
+
byName.set(step.name, group);
|
|
147034
|
+
}
|
|
147035
|
+
group.steps += 1;
|
|
147036
|
+
group.events += step.events;
|
|
147037
|
+
group.created += step.created;
|
|
147038
|
+
group.started += step.started;
|
|
147039
|
+
group.completed += step.completed;
|
|
147040
|
+
group.failed += step.failed;
|
|
147041
|
+
group.retries += step.retries;
|
|
147042
|
+
group.restarts += Math.min(step.retries, Math.max(0, step.started - 1));
|
|
147043
|
+
group.bytes += step.bytes;
|
|
147044
|
+
}
|
|
147045
|
+
return [...byName.values()];
|
|
147046
|
+
}
|
|
147047
|
+
function purgedDataWritten(db, runId, streamBytes) {
|
|
147048
|
+
const saved = readPurgedUsage(db, runId);
|
|
147049
|
+
if (!saved)
|
|
147050
|
+
return null;
|
|
147051
|
+
const late = new EntityBytes();
|
|
147052
|
+
for (const row of db.all(EVENTS_AFTER_SQL, runId, saved.seq)) {
|
|
147053
|
+
late.add(row.event_type, Number(row.bytes ?? 0));
|
|
147054
|
+
}
|
|
147055
|
+
return {
|
|
147056
|
+
run: saved.byEntity.run + late.byEntity.run,
|
|
147057
|
+
step: saved.byEntity.step + late.byEntity.step,
|
|
147058
|
+
hook: saved.byEntity.hook + late.byEntity.hook,
|
|
147059
|
+
stream: saved.byEntity.stream + streamBytes
|
|
147060
|
+
};
|
|
147061
|
+
}
|
|
147062
|
+
const yieldToEventLoop = () => new Promise((resolve2) => setImmediate(resolve2));
|
|
147063
|
+
function createUsageStorage(db, tag, options = {}) {
|
|
147064
|
+
const maxRuns = options.maxRuns ?? 64;
|
|
147065
|
+
const batchTargetMs = options.batchTargetMs ?? 10;
|
|
147066
|
+
const maxBatchRows = options.maxBatchRows ?? 4096;
|
|
147067
|
+
const initialBatchRows = options.initialBatchRows ?? 4;
|
|
147068
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
147069
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
147070
|
+
const remember = (runId, counts) => {
|
|
147071
|
+
cache2.delete(runId);
|
|
147072
|
+
cache2.set(runId, counts);
|
|
147073
|
+
while (cache2.size > maxRuns) {
|
|
147074
|
+
cache2.delete(cache2.keys().next().value);
|
|
147075
|
+
}
|
|
147076
|
+
};
|
|
147077
|
+
const runRow = (runId) => db.get(`SELECT status, workflow_name, seq FROM runs WHERE run_id = ? AND ${tagClause("tag", tag)}`, runId, ...tagParams(tag));
|
|
147078
|
+
async function countInBatches(runId, counts, target2) {
|
|
147079
|
+
var _a3, _b2;
|
|
147080
|
+
let batchRows = initialBatchRows;
|
|
147081
|
+
while (counts.countedSeq < target2) {
|
|
147082
|
+
const end = Number(((_a3 = db.get(BATCH_END_SQL, runId, counts.countedSeq, batchRows)) == null ? void 0 : _a3.seq) ?? target2);
|
|
147083
|
+
const started = performance.now();
|
|
147084
|
+
countRange(db, runId, counts, counts.countedSeq, Math.min(end, target2));
|
|
147085
|
+
const took = performance.now() - started;
|
|
147086
|
+
batchRows = Math.max(1, Math.min(maxBatchRows, batchRows * 2, Math.round(batchRows * batchTargetMs / Math.max(took, 0.1))));
|
|
147087
|
+
if (counts.countedSeq < target2) {
|
|
147088
|
+
await ((_b2 = options.onBatch) == null ? void 0 : _b2.call(options, runId, counts.countedSeq));
|
|
147089
|
+
await yieldToEventLoop();
|
|
147090
|
+
}
|
|
147091
|
+
}
|
|
147092
|
+
}
|
|
147093
|
+
async function read2(runId) {
|
|
147094
|
+
const first = runRow(runId);
|
|
147095
|
+
if (!first) {
|
|
147096
|
+
cache2.delete(runId);
|
|
147097
|
+
throw new WorkflowRunNotFoundError(runId);
|
|
147098
|
+
}
|
|
147099
|
+
let counts = cache2.get(runId) ?? newCounts();
|
|
147100
|
+
if (Number(first.seq) < counts.countedSeq)
|
|
147101
|
+
counts = newCounts();
|
|
147102
|
+
let readBeforeFinish = !isTerminalWorkflowRunStatus(first.status) || counts.countedSeq > 0 && !counts.finished;
|
|
147103
|
+
await countInBatches(runId, counts, Number(first.seq));
|
|
147104
|
+
const snapshot = db.snapshot(() => {
|
|
147105
|
+
var _a3, _b2;
|
|
147106
|
+
const run2 = runRow(runId);
|
|
147107
|
+
if (!run2)
|
|
147108
|
+
return null;
|
|
147109
|
+
const seq = Number(run2.seq);
|
|
147110
|
+
const finished = isTerminalWorkflowRunStatus(run2.status);
|
|
147111
|
+
if (seq < counts.countedSeq) {
|
|
147112
|
+
counts = newCounts();
|
|
147113
|
+
readBeforeFinish = !finished;
|
|
147114
|
+
}
|
|
147115
|
+
countRange(db, runId, counts, counts.countedSeq, seq);
|
|
147116
|
+
const streamBytes = measureStreamBytes(db, runId);
|
|
147117
|
+
const savedDataWritten = purgedDataWritten(db, runId, streamBytes) ?? void 0;
|
|
147118
|
+
const dataPurged = savedDataWritten !== void 0 || finished && Number((_a3 = db.get(PURGED_RUN_SQL, runId)) == null ? void 0 : _a3.purged) === 1;
|
|
147119
|
+
if (dataPurged && readBeforeFinish && counts.countedSeq > 0) {
|
|
147120
|
+
(_b2 = options.onRecount) == null ? void 0 : _b2.call(options, runId);
|
|
147121
|
+
counts = newCounts();
|
|
147122
|
+
countRange(db, runId, counts, 0, seq);
|
|
147123
|
+
}
|
|
147124
|
+
counts.finished = finished;
|
|
147125
|
+
return {
|
|
147126
|
+
run: run2,
|
|
147127
|
+
streamBytes,
|
|
147128
|
+
dataPurged,
|
|
147129
|
+
savedDataWritten
|
|
147130
|
+
};
|
|
147131
|
+
});
|
|
147132
|
+
if (!snapshot) {
|
|
147133
|
+
cache2.delete(runId);
|
|
147134
|
+
throw new WorkflowRunNotFoundError(runId);
|
|
147135
|
+
}
|
|
147136
|
+
remember(runId, counts);
|
|
147137
|
+
return buildRunUsage({
|
|
147138
|
+
runId,
|
|
147139
|
+
status: snapshot.run.status,
|
|
147140
|
+
workflowName: snapshot.run.workflow_name,
|
|
147141
|
+
eventGroups: eventGroupsOf(counts),
|
|
147142
|
+
stepGroups: stepGroupsOf(counts),
|
|
147143
|
+
streamBytes: snapshot.streamBytes,
|
|
147144
|
+
dataPurged: snapshot.dataPurged,
|
|
147145
|
+
savedDataWritten: snapshot.savedDataWritten,
|
|
147146
|
+
hookGroups: hookGroupsOf(counts),
|
|
147147
|
+
calls: { wait: counts.waitIds.size },
|
|
147148
|
+
// Local runs are not billed.
|
|
147149
|
+
billed: false,
|
|
147150
|
+
// world-local has no plan retention, so there is no Data Retained to
|
|
147151
|
+
// report: the UI and CLI hide it.
|
|
147152
|
+
dataRetained: null
|
|
147153
|
+
});
|
|
147154
|
+
}
|
|
147155
|
+
return {
|
|
147156
|
+
async getRun(runId) {
|
|
147157
|
+
assertSafeEntityId("runId", runId);
|
|
147158
|
+
const previous2 = inFlight.get(runId) ?? Promise.resolve();
|
|
147159
|
+
const current2 = previous2.catch(() => {
|
|
147160
|
+
}).then(() => read2(runId));
|
|
147161
|
+
inFlight.set(runId, current2);
|
|
147162
|
+
try {
|
|
147163
|
+
return await current2;
|
|
147164
|
+
} finally {
|
|
147165
|
+
if (inFlight.get(runId) === current2)
|
|
147166
|
+
inFlight.delete(runId);
|
|
147167
|
+
}
|
|
147168
|
+
}
|
|
147169
|
+
};
|
|
147170
|
+
}
|
|
146292
147171
|
function createStorage$1(basedir, tag) {
|
|
146293
147172
|
const db = databaseFor(basedir);
|
|
146294
147173
|
const runs = createRunsStorage(db, tag);
|
|
@@ -146296,12 +147175,14 @@ function createStorage$1(basedir, tag) {
|
|
|
146296
147175
|
const events2 = createEventsStorage(db, tag);
|
|
146297
147176
|
const hooks = createHooksStorage(db, tag);
|
|
146298
147177
|
const snapshots = createSnapshotsStorage$1(db);
|
|
147178
|
+
const usage = createUsageStorage(db, tag);
|
|
146299
147179
|
return {
|
|
146300
147180
|
runs: instrumentObject$1("world.runs", runs),
|
|
146301
147181
|
steps: instrumentObject$1("world.steps", steps),
|
|
146302
147182
|
events: instrumentObject$1("world.events", events2),
|
|
146303
147183
|
hooks: instrumentObject$1("world.hooks", hooks),
|
|
146304
147184
|
experimental_snapshots: instrumentObject$1("world.experimental_snapshots", snapshots),
|
|
147185
|
+
experimental_usage: instrumentObject$1("world.experimental_usage", usage),
|
|
146305
147186
|
clearCache: () => {
|
|
146306
147187
|
}
|
|
146307
147188
|
};
|
|
@@ -146677,9 +147558,11 @@ function createWorld$2(args) {
|
|
|
146677
147558
|
]) {
|
|
146678
147559
|
db.run(`DELETE FROM ${table2}`);
|
|
146679
147560
|
}
|
|
147561
|
+
deletePurgedUsage(db);
|
|
146680
147562
|
return;
|
|
146681
147563
|
}
|
|
146682
147564
|
const runs = "SELECT run_id FROM runs WHERE tag = ?";
|
|
147565
|
+
deletePurgedUsage(db, { runIdsSql: runs, params: [tag] });
|
|
146683
147566
|
for (const table2 of [
|
|
146684
147567
|
"events",
|
|
146685
147568
|
"steps",
|
|
@@ -146822,8 +147705,8 @@ function requireGetVercelOidcToken() {
|
|
|
146822
147705
|
}
|
|
146823
147706
|
try {
|
|
146824
147707
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
146825
|
-
await import("./token-util-
|
|
146826
|
-
await import("./token-
|
|
147708
|
+
await import("./token-util-DgTmPzWb.js").then((n) => n.t),
|
|
147709
|
+
await import("./token-B94O3LuJ.js").then((n) => n.t)
|
|
146827
147710
|
]);
|
|
146828
147711
|
if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
|
|
146829
147712
|
await refreshToken(options);
|
|
@@ -147387,7 +148270,7 @@ function requireDist() {
|
|
|
147387
148270
|
}
|
|
147388
148271
|
var distExports = requireDist();
|
|
147389
148272
|
const QUEUE_REQUEST_DEADLINE_CODE = "WORKFLOW_QUEUE_REQUEST_DEADLINE";
|
|
147390
|
-
const version$1 = "5.7.
|
|
148273
|
+
const version$1 = "5.7.2";
|
|
147391
148274
|
const pools = globalSingleton("@workflow/world-vercel//httpPools", 1, () => ({
|
|
147392
148275
|
dispatcher: void 0,
|
|
147393
148276
|
queueDispatcher: void 0,
|
|
@@ -147755,7 +148638,7 @@ function getDefaultStreamCloseDispatcher() {
|
|
|
147755
148638
|
return pools.streamCloseDispatcher;
|
|
147756
148639
|
}
|
|
147757
148640
|
async function getDeadline() {
|
|
147758
|
-
const { getDeadline: getDeadline2 } = await import("./index-
|
|
148641
|
+
const { getDeadline: getDeadline2 } = await import("./index-BrYeW--s.js").then((n) => n.i);
|
|
147759
148642
|
return getDeadline2();
|
|
147760
148643
|
}
|
|
147761
148644
|
class ReplayEventObserverError extends Error {
|
|
@@ -156107,8 +156990,8 @@ const V4_FRAME_CONTENT_TYPE = "application/vnd.workflow.v4-frames";
|
|
|
156107
156990
|
class IncompleteFrameError extends Error {
|
|
156108
156991
|
}
|
|
156109
156992
|
const CborObjectSchema = record(string$2(), unknown$1());
|
|
156110
|
-
function encodeFrame(
|
|
156111
|
-
const metaBytes = new Uint8Array(encode$2(
|
|
156993
|
+
function encodeFrame(meta2, body2) {
|
|
156994
|
+
const metaBytes = new Uint8Array(encode$2(meta2));
|
|
156112
156995
|
const out = new Uint8Array(4 + metaBytes.byteLength + 4 + body2.byteLength);
|
|
156113
156996
|
const view = new DataView(out.buffer);
|
|
156114
156997
|
view.setUint32(0, metaBytes.byteLength, false);
|
|
@@ -156126,8 +157009,8 @@ function decodeFrame(raw2) {
|
|
|
156126
157009
|
if (raw2.byteLength < metaEnd + 4) {
|
|
156127
157010
|
throw new Error("ws frame too short for meta + body length prefix");
|
|
156128
157011
|
}
|
|
156129
|
-
const
|
|
156130
|
-
if (
|
|
157012
|
+
const meta2 = decode$2(raw2.subarray(4, metaEnd));
|
|
157013
|
+
if (meta2 === null || typeof meta2 !== "object" || Array.isArray(meta2)) {
|
|
156131
157014
|
throw new Error("ws frame meta must be a CBOR map");
|
|
156132
157015
|
}
|
|
156133
157016
|
const bodyStart = metaEnd + 4;
|
|
@@ -156136,7 +157019,7 @@ function decodeFrame(raw2) {
|
|
|
156136
157019
|
throw new Error(raw2.byteLength < bodyEnd ? "ws frame shorter than its declared body length" : `ws frame has ${raw2.byteLength - bodyEnd} trailing bytes`);
|
|
156137
157020
|
}
|
|
156138
157021
|
return {
|
|
156139
|
-
meta,
|
|
157022
|
+
meta: meta2,
|
|
156140
157023
|
body: raw2.subarray(bodyStart, bodyEnd)
|
|
156141
157024
|
};
|
|
156142
157025
|
}
|
|
@@ -156186,7 +157069,7 @@ async function* decodeFrames(source) {
|
|
|
156186
157069
|
if (!await refill(metaLen)) {
|
|
156187
157070
|
throw new IncompleteFrameError("decodeFrames: truncated meta block");
|
|
156188
157071
|
}
|
|
156189
|
-
const
|
|
157072
|
+
const meta2 = CborObjectSchema.parse(decode$2(take(metaLen)));
|
|
156190
157073
|
if (!await refill(4)) {
|
|
156191
157074
|
throw new IncompleteFrameError("decodeFrames: truncated body length");
|
|
156192
157075
|
}
|
|
@@ -156195,9 +157078,9 @@ async function* decodeFrames(source) {
|
|
|
156195
157078
|
if (bodyLen > 0 && !await refill(bodyLen)) {
|
|
156196
157079
|
throw new IncompleteFrameError("decodeFrames: truncated body bytes");
|
|
156197
157080
|
}
|
|
156198
|
-
yield { meta, body: buffer2.slice(0, bodyLen) };
|
|
157081
|
+
yield { meta: meta2, body: buffer2.slice(0, bodyLen) };
|
|
156199
157082
|
take(bodyLen);
|
|
156200
|
-
if (
|
|
157083
|
+
if (meta2._end === 1)
|
|
156201
157084
|
return;
|
|
156202
157085
|
}
|
|
156203
157086
|
} finally {
|
|
@@ -156614,146 +157497,146 @@ function decodeLegacyStructuredError(payload) {
|
|
|
156614
157497
|
return payload;
|
|
156615
157498
|
}
|
|
156616
157499
|
}
|
|
156617
|
-
function decodeEventFrame({ meta, body: body2 }) {
|
|
156618
|
-
const eventType = EventTypeSchema.parse(
|
|
157500
|
+
function decodeEventFrame({ meta: meta2, body: body2 }) {
|
|
157501
|
+
const eventType = EventTypeSchema.parse(meta2.eventType);
|
|
156619
157502
|
if (body2.byteLength === 0)
|
|
156620
|
-
return VercelEventWireSchema.parse(
|
|
157503
|
+
return VercelEventWireSchema.parse(meta2);
|
|
156621
157504
|
const payloadField = getEventDataPayloadField(eventType);
|
|
156622
157505
|
assert$1(payloadField, `Event type ${eventType} cannot carry a payload body`);
|
|
156623
|
-
assert$1(
|
|
157506
|
+
assert$1(meta2.eventData && typeof meta2.eventData === "object");
|
|
156624
157507
|
return VercelEventWireSchema.parse({
|
|
156625
|
-
...
|
|
157508
|
+
...meta2,
|
|
156626
157509
|
eventData: {
|
|
156627
|
-
...
|
|
157510
|
+
...meta2.eventData,
|
|
156628
157511
|
[payloadField]: legacyStructuredErrorEventTypes.has(eventType) ? decodeLegacyStructuredError(body2) : body2
|
|
156629
157512
|
}
|
|
156630
157513
|
});
|
|
156631
157514
|
}
|
|
156632
157515
|
function buildPostFrameMeta(input) {
|
|
156633
|
-
const
|
|
157516
|
+
const meta2 = {
|
|
156634
157517
|
eventType: input.eventType,
|
|
156635
157518
|
specVersion: input.specVersion
|
|
156636
157519
|
};
|
|
156637
157520
|
if (input.executorSpecVersion !== void 0) {
|
|
156638
|
-
|
|
157521
|
+
meta2.executorSpecVersion = input.executorSpecVersion;
|
|
156639
157522
|
}
|
|
156640
157523
|
if (input.correlationId !== void 0)
|
|
156641
|
-
|
|
157524
|
+
meta2.correlationId = input.correlationId;
|
|
156642
157525
|
if (input.vercelId !== void 0)
|
|
156643
|
-
|
|
157526
|
+
meta2.vercelId = input.vercelId;
|
|
156644
157527
|
if (input.computeInstanceId !== void 0)
|
|
156645
|
-
|
|
157528
|
+
meta2.computeInstanceId = input.computeInstanceId;
|
|
156646
157529
|
if (input.stepCreatedAt !== void 0) {
|
|
156647
|
-
|
|
157530
|
+
meta2.stepCreatedAt = input.stepCreatedAt;
|
|
156648
157531
|
}
|
|
156649
157532
|
if (input.occurredAt !== void 0)
|
|
156650
|
-
|
|
157533
|
+
meta2.occurredAt = input.occurredAt;
|
|
156651
157534
|
if (input.remoteRefBehavior !== void 0) {
|
|
156652
|
-
|
|
157535
|
+
meta2.remoteRefBehavior = input.remoteRefBehavior;
|
|
156653
157536
|
}
|
|
156654
157537
|
if (input.eventsRemoteRefBehavior !== void 0) {
|
|
156655
|
-
|
|
157538
|
+
meta2.eventsRemoteRefBehavior = input.eventsRemoteRefBehavior;
|
|
156656
157539
|
}
|
|
156657
157540
|
if (input.deploymentId !== void 0)
|
|
156658
|
-
|
|
157541
|
+
meta2.deploymentId = input.deploymentId;
|
|
156659
157542
|
if (input.workflowName !== void 0)
|
|
156660
|
-
|
|
157543
|
+
meta2.workflowName = input.workflowName;
|
|
156661
157544
|
if (input.stepName !== void 0)
|
|
156662
|
-
|
|
157545
|
+
meta2.stepName = input.stepName;
|
|
156663
157546
|
if (input.attempt !== void 0)
|
|
156664
|
-
|
|
157547
|
+
meta2.attempt = input.attempt;
|
|
156665
157548
|
if (input.resumeAt !== void 0)
|
|
156666
|
-
|
|
157549
|
+
meta2.resumeAt = input.resumeAt;
|
|
156667
157550
|
if (input.retryAfter !== void 0)
|
|
156668
|
-
|
|
157551
|
+
meta2.retryAfter = input.retryAfter;
|
|
156669
157552
|
if (input.hookToken !== void 0)
|
|
156670
|
-
|
|
157553
|
+
meta2.hookToken = input.hookToken;
|
|
156671
157554
|
if (input.hookTokenRetentionUntil !== void 0) {
|
|
156672
|
-
|
|
157555
|
+
meta2.hookTokenRetentionUntil = input.hookTokenRetentionUntil;
|
|
156673
157556
|
}
|
|
156674
157557
|
if (input.hookIsWebhook !== void 0)
|
|
156675
|
-
|
|
157558
|
+
meta2.hookIsWebhook = input.hookIsWebhook;
|
|
156676
157559
|
if (input.hookIsSystem !== void 0)
|
|
156677
|
-
|
|
157560
|
+
meta2.hookIsSystem = input.hookIsSystem;
|
|
156678
157561
|
if (input.hookForce !== void 0)
|
|
156679
|
-
|
|
157562
|
+
meta2.hookForce = input.hookForce;
|
|
156680
157563
|
if (input.resumeId !== void 0)
|
|
156681
|
-
|
|
157564
|
+
meta2.resumeId = input.resumeId;
|
|
156682
157565
|
if (input.errorCode !== void 0)
|
|
156683
|
-
|
|
157566
|
+
meta2.errorCode = input.errorCode;
|
|
156684
157567
|
if (input.cancelReason !== void 0)
|
|
156685
|
-
|
|
157568
|
+
meta2.cancelReason = input.cancelReason;
|
|
156686
157569
|
if (input.ownerMessageId !== void 0) {
|
|
156687
|
-
|
|
157570
|
+
meta2.ownerMessageId = input.ownerMessageId;
|
|
156688
157571
|
}
|
|
156689
157572
|
if (input.executionContext !== void 0) {
|
|
156690
|
-
|
|
157573
|
+
meta2.executionContext = input.executionContext;
|
|
156691
157574
|
}
|
|
156692
157575
|
if (input.attributes !== void 0)
|
|
156693
|
-
|
|
157576
|
+
meta2.attributes = input.attributes;
|
|
156694
157577
|
if (input.startHook !== void 0)
|
|
156695
|
-
|
|
157578
|
+
meta2.startHook = input.startHook;
|
|
156696
157579
|
if (input.changes !== void 0)
|
|
156697
|
-
|
|
157580
|
+
meta2.changes = input.changes;
|
|
156698
157581
|
if (input.writer !== void 0)
|
|
156699
|
-
|
|
157582
|
+
meta2.writer = input.writer;
|
|
156700
157583
|
if (input.allowReservedAttributes !== void 0) {
|
|
156701
|
-
|
|
157584
|
+
meta2.allowReservedAttributes = input.allowReservedAttributes;
|
|
156702
157585
|
}
|
|
156703
157586
|
if (input.encryptionPublicKey !== void 0) {
|
|
156704
|
-
|
|
157587
|
+
meta2.encryptionPublicKey = input.encryptionPublicKey;
|
|
156705
157588
|
}
|
|
156706
157589
|
if (input.dynamicWorkflowCode !== void 0) {
|
|
156707
|
-
|
|
157590
|
+
meta2.dynamicWorkflowCode = input.dynamicWorkflowCode;
|
|
156708
157591
|
}
|
|
156709
157592
|
if (input.dynamicWorkflowCodeRef !== void 0) {
|
|
156710
|
-
|
|
157593
|
+
meta2.dynamicWorkflowCodeRef = input.dynamicWorkflowCodeRef;
|
|
156711
157594
|
}
|
|
156712
157595
|
if (input.ttfs !== void 0)
|
|
156713
|
-
|
|
157596
|
+
meta2.ttfs = input.ttfs;
|
|
156714
157597
|
if (input.stso !== void 0)
|
|
156715
|
-
|
|
157598
|
+
meta2.stso = input.stso;
|
|
156716
157599
|
if (input.stepCount !== void 0)
|
|
156717
|
-
|
|
157600
|
+
meta2.stepCount = input.stepCount;
|
|
156718
157601
|
if (input.eventCount !== void 0)
|
|
156719
|
-
|
|
157602
|
+
meta2.eventCount = input.eventCount;
|
|
156720
157603
|
if (input.rsfs !== void 0)
|
|
156721
|
-
|
|
157604
|
+
meta2.rsfs = input.rsfs;
|
|
156722
157605
|
if (input.finalSchedulingReplay !== void 0) {
|
|
156723
|
-
|
|
157606
|
+
meta2.finalSchedulingReplay = input.finalSchedulingReplay;
|
|
156724
157607
|
}
|
|
156725
157608
|
if (input.optimizations !== void 0) {
|
|
156726
|
-
|
|
157609
|
+
meta2.optimizations = input.optimizations;
|
|
156727
157610
|
}
|
|
156728
157611
|
if (input.sinceCursor !== void 0)
|
|
156729
|
-
|
|
157612
|
+
meta2.sinceCursor = input.sinceCursor;
|
|
156730
157613
|
if (input.skipPreload)
|
|
156731
|
-
|
|
157614
|
+
meta2.skipPreload = true;
|
|
156732
157615
|
if (input.maxSlot !== void 0)
|
|
156733
|
-
|
|
157616
|
+
meta2.maxSlot = input.maxSlot;
|
|
156734
157617
|
if (input.replayDivergenceCount !== void 0) {
|
|
156735
|
-
|
|
157618
|
+
meta2.replayDivergenceCount = input.replayDivergenceCount;
|
|
156736
157619
|
}
|
|
156737
157620
|
if (input.replayDivergenceEventIds !== void 0) {
|
|
156738
|
-
|
|
157621
|
+
meta2.replayDivergenceEventIds = input.replayDivergenceEventIds;
|
|
156739
157622
|
}
|
|
156740
157623
|
if (input.resumePayloadDigest !== void 0) {
|
|
156741
|
-
|
|
157624
|
+
meta2.resumePayloadDigest = input.resumePayloadDigest;
|
|
156742
157625
|
}
|
|
156743
157626
|
if (input.viaStepDispatch !== void 0) {
|
|
156744
|
-
|
|
157627
|
+
meta2.viaStepDispatch = input.viaStepDispatch;
|
|
156745
157628
|
}
|
|
156746
157629
|
if (input.inBand !== void 0)
|
|
156747
|
-
|
|
157630
|
+
meta2.inBand = input.inBand;
|
|
156748
157631
|
if (input.expectedSeqInBand !== void 0) {
|
|
156749
|
-
|
|
157632
|
+
meta2.expectedSeqInBand = input.expectedSeqInBand;
|
|
156750
157633
|
}
|
|
156751
157634
|
if (input.inline !== void 0)
|
|
156752
|
-
|
|
157635
|
+
meta2.inline = input.inline;
|
|
156753
157636
|
if (input.creatorMessageId !== void 0) {
|
|
156754
|
-
|
|
157637
|
+
meta2.creatorMessageId = input.creatorMessageId;
|
|
156755
157638
|
}
|
|
156756
|
-
return
|
|
157639
|
+
return meta2;
|
|
156757
157640
|
}
|
|
156758
157641
|
function inBandFenceAttributes(input) {
|
|
156759
157642
|
return {
|
|
@@ -157083,14 +157966,14 @@ async function createWorkflowRunEventsBatchV4(input, config2) {
|
|
|
157083
157966
|
...allocated !== void 0 ? { allocated } : {}
|
|
157084
157967
|
};
|
|
157085
157968
|
}
|
|
157086
|
-
function replyMetaToHeaderRecord(
|
|
157969
|
+
function replyMetaToHeaderRecord(meta2) {
|
|
157087
157970
|
const out = {};
|
|
157088
|
-
if (typeof
|
|
157089
|
-
out[EVENT_ID_HEADER] =
|
|
157090
|
-
if (typeof
|
|
157091
|
-
out["retry-after"] =
|
|
157092
|
-
if (typeof
|
|
157093
|
-
out["x-vercel-mitigated"] =
|
|
157971
|
+
if (typeof meta2.eventId === "string")
|
|
157972
|
+
out[EVENT_ID_HEADER] = meta2.eventId;
|
|
157973
|
+
if (typeof meta2.retryAfter === "string")
|
|
157974
|
+
out["retry-after"] = meta2.retryAfter;
|
|
157975
|
+
if (typeof meta2.mitigated === "string")
|
|
157976
|
+
out["x-vercel-mitigated"] = meta2.mitigated;
|
|
157094
157977
|
return out;
|
|
157095
157978
|
}
|
|
157096
157979
|
function recordWsReplyParts(span, reply) {
|
|
@@ -157304,8 +158187,8 @@ async function getEventV4(runId, eventId, remoteRefBehavior, config2, specVersio
|
|
|
157304
158187
|
}
|
|
157305
158188
|
throw new Error(`v4 getEvent: empty frame stream for ${eventId}`);
|
|
157306
158189
|
}
|
|
157307
|
-
function streamErrorFrameToError(
|
|
157308
|
-
const parsed = EventStreamErrorSchema.safeParse(
|
|
158190
|
+
function streamErrorFrameToError(meta2, opName) {
|
|
158191
|
+
const parsed = EventStreamErrorSchema.safeParse(meta2);
|
|
157309
158192
|
if (!parsed.success) {
|
|
157310
158193
|
return new WorkflowWorldError(`v4 ${opName}: malformed terminal error frame`, { code: "SCHEMA_VALIDATION", cause: parsed.error });
|
|
157311
158194
|
}
|
|
@@ -157862,84 +158745,84 @@ function splitEventDataForV4(data2) {
|
|
|
157862
158745
|
}
|
|
157863
158746
|
const eventData = data2.eventData ?? {};
|
|
157864
158747
|
const payloadField = getEventDataPayloadField(data2.eventType);
|
|
157865
|
-
const
|
|
158748
|
+
const meta2 = {};
|
|
157866
158749
|
if (typeof eventData.deploymentId === "string") {
|
|
157867
|
-
|
|
158750
|
+
meta2.deploymentId = eventData.deploymentId;
|
|
157868
158751
|
}
|
|
157869
158752
|
if (typeof eventData.workflowName === "string") {
|
|
157870
|
-
|
|
158753
|
+
meta2.workflowName = eventData.workflowName;
|
|
157871
158754
|
}
|
|
157872
158755
|
if (typeof eventData.stepName === "string") {
|
|
157873
|
-
|
|
158756
|
+
meta2.stepName = eventData.stepName;
|
|
157874
158757
|
}
|
|
157875
158758
|
if (typeof eventData.attempt === "number") {
|
|
157876
|
-
|
|
158759
|
+
meta2.attempt = eventData.attempt;
|
|
157877
158760
|
}
|
|
157878
158761
|
if (eventData.resumeAt instanceof Date) {
|
|
157879
|
-
|
|
158762
|
+
meta2.resumeAt = eventData.resumeAt;
|
|
157880
158763
|
} else if (typeof eventData.resumeAt === "string") {
|
|
157881
158764
|
const parsed = new Date(eventData.resumeAt);
|
|
157882
158765
|
if (!Number.isNaN(parsed.getTime()))
|
|
157883
|
-
|
|
158766
|
+
meta2.resumeAt = parsed;
|
|
157884
158767
|
}
|
|
157885
158768
|
if (eventData.retryAfter instanceof Date) {
|
|
157886
|
-
|
|
158769
|
+
meta2.retryAfter = eventData.retryAfter;
|
|
157887
158770
|
} else if (typeof eventData.retryAfter === "string") {
|
|
157888
158771
|
const parsed = new Date(eventData.retryAfter);
|
|
157889
158772
|
if (!Number.isNaN(parsed.getTime()))
|
|
157890
|
-
|
|
158773
|
+
meta2.retryAfter = parsed;
|
|
157891
158774
|
}
|
|
157892
158775
|
if (typeof eventData.token === "string") {
|
|
157893
|
-
|
|
158776
|
+
meta2.hookToken = eventData.token;
|
|
157894
158777
|
}
|
|
157895
158778
|
if (eventData.tokenRetentionUntil instanceof Date) {
|
|
157896
|
-
|
|
158779
|
+
meta2.hookTokenRetentionUntil = eventData.tokenRetentionUntil;
|
|
157897
158780
|
}
|
|
157898
158781
|
if (typeof eventData.isWebhook === "boolean") {
|
|
157899
|
-
|
|
158782
|
+
meta2.hookIsWebhook = eventData.isWebhook;
|
|
157900
158783
|
}
|
|
157901
158784
|
if (typeof eventData.isSystem === "boolean") {
|
|
157902
|
-
|
|
158785
|
+
meta2.hookIsSystem = eventData.isSystem;
|
|
157903
158786
|
}
|
|
157904
158787
|
if (eventData.force === true) {
|
|
157905
|
-
|
|
158788
|
+
meta2.hookForce = true;
|
|
157906
158789
|
}
|
|
157907
158790
|
if (typeof eventData.errorCode === "string") {
|
|
157908
|
-
|
|
158791
|
+
meta2.errorCode = eventData.errorCode;
|
|
157909
158792
|
}
|
|
157910
158793
|
if (typeof eventData.cancelReason === "string") {
|
|
157911
|
-
|
|
158794
|
+
meta2.cancelReason = eventData.cancelReason;
|
|
157912
158795
|
}
|
|
157913
158796
|
if (typeof eventData.ownerMessageId === "string") {
|
|
157914
|
-
|
|
158797
|
+
meta2.ownerMessageId = eventData.ownerMessageId;
|
|
157915
158798
|
}
|
|
157916
158799
|
if (eventData.executionContext !== void 0 && eventData.executionContext !== null && typeof eventData.executionContext === "object") {
|
|
157917
|
-
|
|
158800
|
+
meta2.executionContext = eventData.executionContext;
|
|
157918
158801
|
}
|
|
157919
158802
|
if (eventData.attributes !== void 0 && eventData.attributes !== null && typeof eventData.attributes === "object") {
|
|
157920
|
-
|
|
158803
|
+
meta2.attributes = eventData.attributes;
|
|
157921
158804
|
}
|
|
157922
158805
|
if (Array.isArray(eventData.changes)) {
|
|
157923
|
-
|
|
158806
|
+
meta2.changes = eventData.changes;
|
|
157924
158807
|
}
|
|
157925
158808
|
if (eventData.writer !== void 0 && eventData.writer !== null && typeof eventData.writer === "object") {
|
|
157926
|
-
|
|
158809
|
+
meta2.writer = eventData.writer;
|
|
157927
158810
|
}
|
|
157928
158811
|
if (typeof eventData.allowReservedAttributes === "boolean") {
|
|
157929
|
-
|
|
158812
|
+
meta2.allowReservedAttributes = eventData.allowReservedAttributes;
|
|
157930
158813
|
}
|
|
157931
158814
|
if (typeof eventData.encryptionPublicKey === "string") {
|
|
157932
|
-
|
|
158815
|
+
meta2.encryptionPublicKey = eventData.encryptionPublicKey;
|
|
157933
158816
|
}
|
|
157934
158817
|
if (eventData.dynamicWorkflowCode instanceof Uint8Array) {
|
|
157935
|
-
|
|
158818
|
+
meta2.dynamicWorkflowCode = eventData.dynamicWorkflowCode;
|
|
157936
158819
|
}
|
|
157937
158820
|
if (typeof eventData.dynamicWorkflowCodeRef === "string") {
|
|
157938
|
-
|
|
158821
|
+
meta2.dynamicWorkflowCodeRef = eventData.dynamicWorkflowCodeRef;
|
|
157939
158822
|
}
|
|
157940
158823
|
if (eventData.startHook !== void 0 && eventData.startHook !== null && typeof eventData.startHook === "object") {
|
|
157941
158824
|
const startHook = eventData.startHook;
|
|
157942
|
-
|
|
158825
|
+
meta2.startHook = {
|
|
157943
158826
|
token: startHook.token,
|
|
157944
158827
|
...startHook.tokenRetentionUntil instanceof Date ? { tokenRetentionUntil: startHook.tokenRetentionUntil } : {},
|
|
157945
158828
|
// The serialized metadata bytes, exactly what `hook_created` would
|
|
@@ -157948,31 +158831,31 @@ function splitEventDataForV4(data2) {
|
|
|
157948
158831
|
};
|
|
157949
158832
|
}
|
|
157950
158833
|
if (typeof eventData.ttfs === "number") {
|
|
157951
|
-
|
|
158834
|
+
meta2.ttfs = eventData.ttfs;
|
|
157952
158835
|
}
|
|
157953
158836
|
if (typeof eventData.stso === "number") {
|
|
157954
|
-
|
|
158837
|
+
meta2.stso = eventData.stso;
|
|
157955
158838
|
}
|
|
157956
158839
|
if (typeof eventData.stepCount === "number" && Number.isSafeInteger(eventData.stepCount) && eventData.stepCount > 0) {
|
|
157957
|
-
|
|
158840
|
+
meta2.stepCount = eventData.stepCount;
|
|
157958
158841
|
}
|
|
157959
158842
|
if (typeof eventData.eventCount === "number" && Number.isSafeInteger(eventData.eventCount) && eventData.eventCount > 0) {
|
|
157960
|
-
|
|
158843
|
+
meta2.eventCount = eventData.eventCount;
|
|
157961
158844
|
}
|
|
157962
158845
|
if (typeof eventData.rsfs === "number") {
|
|
157963
|
-
|
|
158846
|
+
meta2.rsfs = eventData.rsfs;
|
|
157964
158847
|
}
|
|
157965
158848
|
if (typeof eventData.finalSchedulingReplay === "number") {
|
|
157966
|
-
|
|
158849
|
+
meta2.finalSchedulingReplay = eventData.finalSchedulingReplay;
|
|
157967
158850
|
}
|
|
157968
158851
|
if (Array.isArray(eventData.optimizations) && eventData.optimizations.every((o) => typeof o === "string")) {
|
|
157969
|
-
|
|
158852
|
+
meta2.optimizations = eventData.optimizations;
|
|
157970
158853
|
}
|
|
157971
158854
|
if (typeof eventData.inline === "boolean") {
|
|
157972
|
-
|
|
158855
|
+
meta2.inline = eventData.inline;
|
|
157973
158856
|
}
|
|
157974
158857
|
if (typeof eventData.creatorMessageId === "string") {
|
|
157975
|
-
|
|
158858
|
+
meta2.creatorMessageId = eventData.creatorMessageId;
|
|
157976
158859
|
}
|
|
157977
158860
|
let payload;
|
|
157978
158861
|
if (payloadField && payloadField in eventData) {
|
|
@@ -157984,7 +158867,7 @@ function splitEventDataForV4(data2) {
|
|
|
157984
158867
|
payload = value;
|
|
157985
158868
|
}
|
|
157986
158869
|
}
|
|
157987
|
-
return { payload, meta };
|
|
158870
|
+
return { payload, meta: meta2 };
|
|
157988
158871
|
}
|
|
157989
158872
|
async function getEvent(runId, eventId, params, config2) {
|
|
157990
158873
|
return getEventV4(runId, eventId, (params == null ? void 0 : params.resolveData) === "none" ? "lazy" : "resolve", config2, params == null ? void 0 : params.specVersion);
|
|
@@ -158034,7 +158917,7 @@ async function createWorkflowRunEventBatch(runId, events2, params, config2) {
|
|
|
158034
158917
|
throw new WorkflowWorldError("world-vercel: hook_received cannot be batched (it has no entity condition, so a batch retry would append the delivery twice); send it through the single-event path", { status: 400 });
|
|
158035
158918
|
}
|
|
158036
158919
|
const inputs = events2.map(({ event, occurredAt, computeInstanceId, stepCreatedAt }) => {
|
|
158037
|
-
const { payload, meta } = splitEventDataForV4(event);
|
|
158920
|
+
const { payload, meta: meta2 } = splitEventDataForV4(event);
|
|
158038
158921
|
return {
|
|
158039
158922
|
runId,
|
|
158040
158923
|
eventType: event.eventType,
|
|
@@ -158059,7 +158942,7 @@ async function createWorkflowRunEventBatch(runId, events2, params, config2) {
|
|
|
158059
158942
|
...(fence == null ? void 0 : fence.expectedSeqInBand) !== void 0 ? { expectedSeqInBand: fence.expectedSeqInBand } : {},
|
|
158060
158943
|
...(fence == null ? void 0 : fence.eventCount) !== void 0 ? { maxSlot: fence.eventCount } : {},
|
|
158061
158944
|
payload,
|
|
158062
|
-
...
|
|
158945
|
+
...meta2,
|
|
158063
158946
|
// The batch is one fenced allocation: the backend requires every frame
|
|
158064
158947
|
// to carry the same fence. Spread after `meta` so nothing derived from
|
|
158065
158948
|
// the event data can override it.
|
|
@@ -158181,7 +159064,7 @@ async function createWorkflowRunEventInner(id2, data2, params, config2) {
|
|
|
158181
159064
|
// Honor its explicit request for replay-ready metadata; other mutation
|
|
158182
159065
|
// responses keep their existing lightweight entity-only behavior.
|
|
158183
159066
|
data2.eventType === "hook_created" && (params == null ? void 0 : params.resolveData) === "all" ? "resolve" : "lazy";
|
|
158184
|
-
const { payload, meta } = splitEventDataForV4(data2);
|
|
159067
|
+
const { payload, meta: meta2 } = splitEventDataForV4(data2);
|
|
158185
159068
|
const input = {
|
|
158186
159069
|
runId: id2,
|
|
158187
159070
|
specVersion: data2.specVersion ?? 2,
|
|
@@ -158229,7 +159112,7 @@ async function createWorkflowRunEventInner(id2, data2, params, config2) {
|
|
|
158229
159112
|
...(params == null ? void 0 : params.resolveData) === "skip-step-inputs" ? { eventsRemoteRefBehavior: "skip-step-inputs" } : {},
|
|
158230
159113
|
remoteRefBehavior,
|
|
158231
159114
|
payload,
|
|
158232
|
-
...
|
|
159115
|
+
...meta2
|
|
158233
159116
|
};
|
|
158234
159117
|
if (data2.eventType === "run_started" && !(params == null ? void 0 : params.skipPreload) && (params == null ? void 0 : params.inBand) === void 0) {
|
|
158235
159118
|
const result2 = await createWorkflowRunStartedEventV4(input, config2, params == null ? void 0 : params.replayEventObserver);
|
|
@@ -158318,8 +159201,8 @@ const GAP_FILL_PAGE_SIZE = 100;
|
|
|
158318
159201
|
function cursorAfterSlot(slot) {
|
|
158319
159202
|
return `eid:${slotToEventId(slot)}`;
|
|
158320
159203
|
}
|
|
158321
|
-
function ackedHeartbeatMs(
|
|
158322
|
-
const value =
|
|
159204
|
+
function ackedHeartbeatMs(meta2) {
|
|
159205
|
+
const value = meta2.heartbeatMs;
|
|
158323
159206
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
158324
159207
|
}
|
|
158325
159208
|
class LiveFeedError extends Error {
|
|
@@ -158854,8 +159737,8 @@ function getStreamWsProtocolV1Url(baseUrl, runId, streamId, writerId) {
|
|
|
158854
159737
|
url.search = new URLSearchParams({ writerId: parsedWriterId }).toString();
|
|
158855
159738
|
return url;
|
|
158856
159739
|
}
|
|
158857
|
-
function encodeStreamWsWriteRequest(
|
|
158858
|
-
const parsed = StreamWsWriteRequestMetaSchema.parse(
|
|
159740
|
+
function encodeStreamWsWriteRequest(meta2, chunks) {
|
|
159741
|
+
const parsed = StreamWsWriteRequestMetaSchema.parse(meta2);
|
|
158859
159742
|
if (parsed.numChunks !== chunks.length) {
|
|
158860
159743
|
throw new Error(`stream WebSocket write declares ${parsed.numChunks} chunks but received ${chunks.length}`);
|
|
158861
159744
|
}
|
|
@@ -158880,14 +159763,14 @@ function streamWsWriteBatchEnd(chunks, start2, maxMessageBytes) {
|
|
|
158880
159763
|
}
|
|
158881
159764
|
return end;
|
|
158882
159765
|
}
|
|
158883
|
-
function encodeStreamWsCloseRequest(
|
|
158884
|
-
return encodeFrame(StreamWsCloseRequestMetaSchema.parse(
|
|
159766
|
+
function encodeStreamWsCloseRequest(meta2) {
|
|
159767
|
+
return encodeFrame(StreamWsCloseRequestMetaSchema.parse(meta2), new Uint8Array());
|
|
158885
159768
|
}
|
|
158886
|
-
function parseStreamWsReply(
|
|
159769
|
+
function parseStreamWsReply(meta2, body2) {
|
|
158887
159770
|
if (body2.byteLength !== 0) {
|
|
158888
159771
|
throw new Error("stream WebSocket reply body must be empty");
|
|
158889
159772
|
}
|
|
158890
|
-
return StreamWsReplyMetaSchema.parse(
|
|
159773
|
+
return StreamWsReplyMetaSchema.parse(meta2);
|
|
158891
159774
|
}
|
|
158892
159775
|
const WS_FLAGS_HEADER = "x-workflow-ws-flags";
|
|
158893
159776
|
const WS_FLAG_FRAME_PARTS = "frame-parts";
|
|
@@ -158907,19 +159790,19 @@ function wsMaxMessageBytes() {
|
|
|
158907
159790
|
integer: true
|
|
158908
159791
|
});
|
|
158909
159792
|
}
|
|
158910
|
-
function encodeWsFrameMessages(
|
|
158911
|
-
const whole = encodeFrame(
|
|
159793
|
+
function encodeWsFrameMessages(meta2, body2, maxMessageBytes) {
|
|
159794
|
+
const whole = encodeFrame(meta2, body2);
|
|
158912
159795
|
if (whole.byteLength <= maxMessageBytes)
|
|
158913
159796
|
return [whole];
|
|
158914
159797
|
if (body2.byteLength > WS_MAX_FRAME_BYTES) {
|
|
158915
159798
|
throw new WsFrameTooLargeError(`ws frame body of ${body2.byteLength} bytes is over the ${WS_MAX_FRAME_BYTES}-byte limit for a split frame`);
|
|
158916
159799
|
}
|
|
158917
|
-
const reqId =
|
|
159800
|
+
const reqId = meta2.reqId;
|
|
158918
159801
|
if (!isClientReqId(reqId)) {
|
|
158919
159802
|
throw new Error(`ws frame of ${whole.byteLength} bytes exceeds the ${maxMessageBytes}-byte message limit and has no reqId to split it under`);
|
|
158920
159803
|
}
|
|
158921
159804
|
const bound = body2.byteLength + 1;
|
|
158922
|
-
const firstHeaderBytes = encodeFrame({ ...
|
|
159805
|
+
const firstHeaderBytes = encodeFrame({ ...meta2, partIndex: 0, partCount: bound }, EMPTY).byteLength;
|
|
158923
159806
|
const continuationHeaderBytes = encodeFrame(continuationMeta(reqId, bound, bound), EMPTY).byteLength;
|
|
158924
159807
|
const firstSlice = maxMessageBytes - firstHeaderBytes;
|
|
158925
159808
|
const continuationSlice = maxMessageBytes - continuationHeaderBytes;
|
|
@@ -158932,7 +159815,7 @@ function encodeWsFrameMessages(meta, body2, maxMessageBytes) {
|
|
|
158932
159815
|
throw new Error(`ws frame of ${whole.byteLength} bytes needs ${partCount} parts at a ${maxMessageBytes}-byte message limit; at most ${WS_MAX_PART_COUNT} are allowed`);
|
|
158933
159816
|
}
|
|
158934
159817
|
const messages = [
|
|
158935
|
-
encodeFrame({ ...
|
|
159818
|
+
encodeFrame({ ...meta2, partIndex: 0, partCount }, body2.subarray(0, firstSlice))
|
|
158936
159819
|
];
|
|
158937
159820
|
for (let index2 = 1; index2 < partCount; index2++) {
|
|
158938
159821
|
const start2 = firstSlice + (index2 - 1) * continuationSlice;
|
|
@@ -158944,8 +159827,8 @@ const EMPTY = new Uint8Array(0);
|
|
|
158944
159827
|
function splitEncodedFrame(frame2, maxMessageBytes) {
|
|
158945
159828
|
if (frame2.byteLength <= maxMessageBytes)
|
|
158946
159829
|
return [frame2];
|
|
158947
|
-
const { meta, body: body2 } = decodeFrame(frame2);
|
|
158948
|
-
return encodeWsFrameMessages(
|
|
159830
|
+
const { meta: meta2, body: body2 } = decodeFrame(frame2);
|
|
159831
|
+
return encodeWsFrameMessages(meta2, body2, maxMessageBytes);
|
|
158949
159832
|
}
|
|
158950
159833
|
function continuationMeta(reqId, partIndex, partCount) {
|
|
158951
159834
|
return { type: WS_PART_TYPE, reqId, partIndex, partCount };
|
|
@@ -158986,11 +159869,11 @@ class WsPartAssembler {
|
|
|
158986
159869
|
});
|
|
158987
159870
|
}
|
|
158988
159871
|
accept(frame2) {
|
|
158989
|
-
const { meta, body: body2 } = frame2;
|
|
158990
|
-
if (
|
|
158991
|
-
return this.continue(
|
|
158992
|
-
const { reqId, partIndex, partCount } =
|
|
158993
|
-
if (!("partIndex" in
|
|
159872
|
+
const { meta: meta2, body: body2 } = frame2;
|
|
159873
|
+
if (meta2.type === WS_PART_TYPE)
|
|
159874
|
+
return this.continue(meta2, body2);
|
|
159875
|
+
const { reqId, partIndex, partCount } = meta2;
|
|
159876
|
+
if (!("partIndex" in meta2) && !("partCount" in meta2)) {
|
|
158994
159877
|
if (isClientReqId(reqId) && this.open.has(reqId)) {
|
|
158995
159878
|
throw new WsPartProtocolError(`whole frame for reqId ${reqId} while its split frame is open`);
|
|
158996
159879
|
}
|
|
@@ -159011,7 +159894,7 @@ class WsPartAssembler {
|
|
|
159011
159894
|
if (this.open.size >= this.maxOpenFrames) {
|
|
159012
159895
|
throw new WsPartProtocolError(`more than ${this.maxOpenFrames} split frames open at once`);
|
|
159013
159896
|
}
|
|
159014
|
-
const { partIndex: _index, partCount: _count, ...frameMeta } =
|
|
159897
|
+
const { partIndex: _index, partCount: _count, ...frameMeta } = meta2;
|
|
159015
159898
|
const entry2 = {
|
|
159016
159899
|
meta: frameMeta,
|
|
159017
159900
|
partCount,
|
|
@@ -159029,12 +159912,12 @@ class WsPartAssembler {
|
|
|
159029
159912
|
get openFrames() {
|
|
159030
159913
|
return this.open.size;
|
|
159031
159914
|
}
|
|
159032
|
-
continue(
|
|
159033
|
-
const keys2 = Object.keys(
|
|
159034
|
-
if (keys2.length !== 4 || !("reqId" in
|
|
159915
|
+
continue(meta2, body2) {
|
|
159916
|
+
const keys2 = Object.keys(meta2);
|
|
159917
|
+
if (keys2.length !== 4 || !("reqId" in meta2) || !("partIndex" in meta2) || !("partCount" in meta2)) {
|
|
159035
159918
|
throw new WsPartProtocolError(`continuation part must have exactly type, reqId, partIndex and partCount, got ${keys2.join(", ")}`);
|
|
159036
159919
|
}
|
|
159037
|
-
const { reqId, partIndex, partCount } =
|
|
159920
|
+
const { reqId, partIndex, partCount } = meta2;
|
|
159038
159921
|
if (!isClientReqId(reqId)) {
|
|
159039
159922
|
throw new WsPartProtocolError("continuation part has no valid reqId");
|
|
159040
159923
|
}
|
|
@@ -159124,7 +160007,7 @@ function beginNormalWsClose(ws, reason) {
|
|
|
159124
160007
|
await observed;
|
|
159125
160008
|
span == null ? void 0 : span.setAttribute("workflow.stream.ws.close_cleanup_timeout", timedOut);
|
|
159126
160009
|
});
|
|
159127
|
-
void import("./index-
|
|
160010
|
+
void import("./index-BrYeW--s.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => waitUntil2(cleanup)).catch(() => {
|
|
159128
160011
|
});
|
|
159129
160012
|
void cleanup.catch(() => {
|
|
159130
160013
|
});
|
|
@@ -159509,7 +160392,7 @@ class VercelStreamWriteSession {
|
|
|
159509
160392
|
return http3;
|
|
159510
160393
|
});
|
|
159511
160394
|
const [{ WebSocket: WebSocketImpl }, http2] = await Promise.all([
|
|
159512
|
-
import("./wrapper-
|
|
160395
|
+
import("./wrapper-BEqyNEir.js"),
|
|
159513
160396
|
httpPromise
|
|
159514
160397
|
]);
|
|
159515
160398
|
if (this.mode !== "connecting")
|
|
@@ -164947,7 +165830,7 @@ const VERCEL_REQUEST_CONTEXT = Symbol.for("@vercel/request-context");
|
|
|
164947
165830
|
function waitUntil(promise2) {
|
|
164948
165831
|
if (!(VERCEL_REQUEST_CONTEXT in globalThis))
|
|
164949
165832
|
return;
|
|
164950
|
-
void import("./index-
|
|
165833
|
+
void import("./index-BrYeW--s.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
|
|
164951
165834
|
waitUntil2(promise2);
|
|
164952
165835
|
});
|
|
164953
165836
|
}
|
|
@@ -168275,9 +169158,9 @@ pp$5.parseExprImport = function(forNew) {
|
|
|
168275
169158
|
if (this.type === types$1.parenL && !forNew) {
|
|
168276
169159
|
return this.parseDynamicImport(node2);
|
|
168277
169160
|
} else if (this.type === types$1.dot) {
|
|
168278
|
-
var
|
|
168279
|
-
|
|
168280
|
-
node2.meta = this.finishNode(
|
|
169161
|
+
var meta2 = this.startNodeAt(node2.start, node2.loc && node2.loc.start);
|
|
169162
|
+
meta2.name = "import";
|
|
169163
|
+
node2.meta = this.finishNode(meta2, "Identifier");
|
|
168281
169164
|
return this.parseImportMeta(node2);
|
|
168282
169165
|
} else {
|
|
168283
169166
|
this.unexpected();
|
|
@@ -168427,9 +169310,9 @@ pp$5.parseNew = function() {
|
|
|
168427
169310
|
var node2 = this.startNode();
|
|
168428
169311
|
this.next();
|
|
168429
169312
|
if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {
|
|
168430
|
-
var
|
|
168431
|
-
|
|
168432
|
-
node2.meta = this.finishNode(
|
|
169313
|
+
var meta2 = this.startNodeAt(node2.start, node2.loc && node2.loc.start);
|
|
169314
|
+
meta2.name = "new";
|
|
169315
|
+
node2.meta = this.finishNode(meta2, "Identifier");
|
|
168433
169316
|
this.next();
|
|
168434
169317
|
var containsEsc = this.containsEsc;
|
|
168435
169318
|
node2.property = this.parseIdent(true);
|
|
@@ -174214,6 +175097,19 @@ async function fetchRun(worldEnv, runId, resolveData = "all") {
|
|
|
174214
175097
|
});
|
|
174215
175098
|
}
|
|
174216
175099
|
}
|
|
175100
|
+
async function fetchRunUsage(worldEnv, runId) {
|
|
175101
|
+
try {
|
|
175102
|
+
const world = await getWorldFromEnv(worldEnv);
|
|
175103
|
+
if (!world.experimental_usage) return createResponse(null);
|
|
175104
|
+
return createResponse(await world.experimental_usage.getRun(runId));
|
|
175105
|
+
} catch (error2) {
|
|
175106
|
+
return createServerActionError(
|
|
175107
|
+
error2,
|
|
175108
|
+
"world.experimental_usage.getRun",
|
|
175109
|
+
{ runId }
|
|
175110
|
+
);
|
|
175111
|
+
}
|
|
175112
|
+
}
|
|
174217
175113
|
async function fetchStep(worldEnv, runId, stepId, resolveData = "all") {
|
|
174218
175114
|
try {
|
|
174219
175115
|
const world = await getWorldFromEnv(worldEnv);
|
|
@@ -174611,6 +175507,14 @@ async function action$1({
|
|
|
174611
175507
|
Body: ${body2.slice(0, 500) || "(empty)"}`);
|
|
174612
175508
|
return null;
|
|
174613
175509
|
}
|
|
175510
|
+
function meta$1() {
|
|
175511
|
+
return [{
|
|
175512
|
+
title: DEFAULT_TITLE
|
|
175513
|
+
}, {
|
|
175514
|
+
name: "description",
|
|
175515
|
+
content: DEFAULT_META_DESCRIPTION
|
|
175516
|
+
}];
|
|
175517
|
+
}
|
|
174614
175518
|
function Layout({
|
|
174615
175519
|
children: children2
|
|
174616
175520
|
}) {
|
|
@@ -174626,11 +175530,6 @@ function Layout({
|
|
|
174626
175530
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx("link", {
|
|
174627
175531
|
rel: "icon",
|
|
174628
175532
|
href: "/favicon.ico"
|
|
174629
|
-
}), /* @__PURE__ */ jsxRuntimeExports.jsx("title", {
|
|
174630
|
-
children: "Workflow Observability UI"
|
|
174631
|
-
}), /* @__PURE__ */ jsxRuntimeExports.jsx("meta", {
|
|
174632
|
-
name: "description",
|
|
174633
|
-
content: "Web interface for inspecting flow runs, steps, streams, and events"
|
|
174634
175533
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx(Meta, {}), /* @__PURE__ */ jsxRuntimeExports.jsx(Links, {})]
|
|
174635
175534
|
}), /* @__PURE__ */ jsxRuntimeExports.jsxs("body", {
|
|
174636
175535
|
className: "antialiased",
|
|
@@ -174811,6 +175710,7 @@ const route0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
174811
175710
|
action: action$1,
|
|
174812
175711
|
default: root$1,
|
|
174813
175712
|
loader: loader$2,
|
|
175713
|
+
meta: meta$1,
|
|
174814
175714
|
shouldRevalidate
|
|
174815
175715
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
174816
175716
|
const alertVariants = cva(
|
|
@@ -183666,6 +184566,8 @@ function makeContentId(baseId, value) {
|
|
|
183666
184566
|
return `${baseId}-content-${value}`;
|
|
183667
184567
|
}
|
|
183668
184568
|
__name$2(makeContentId, "makeContentId");
|
|
184569
|
+
const tabsListClassName = "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg border border-input p-[3px]";
|
|
184570
|
+
const tabsTriggerClassName = "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow aria-[current=page]:bg-background aria-[current=page]:text-foreground aria-[current=page]:shadow";
|
|
183669
184571
|
function Tabs({
|
|
183670
184572
|
className,
|
|
183671
184573
|
...props
|
|
@@ -183687,10 +184589,7 @@ function TabsList({
|
|
|
183687
184589
|
TabsList$1,
|
|
183688
184590
|
{
|
|
183689
184591
|
"data-slot": "tabs-list",
|
|
183690
|
-
className: cn$2(
|
|
183691
|
-
"bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg border border-input p-[3px]",
|
|
183692
|
-
className
|
|
183693
|
-
),
|
|
184592
|
+
className: cn$2(tabsListClassName, className),
|
|
183694
184593
|
...props
|
|
183695
184594
|
}
|
|
183696
184595
|
);
|
|
@@ -183703,10 +184602,7 @@ function TabsTrigger({
|
|
|
183703
184602
|
TabsTrigger$1,
|
|
183704
184603
|
{
|
|
183705
184604
|
"data-slot": "tabs-trigger",
|
|
183706
|
-
className: cn$2(
|
|
183707
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
|
|
183708
|
-
className
|
|
183709
|
-
),
|
|
184605
|
+
className: cn$2(tabsTriggerClassName, className),
|
|
183710
184606
|
...props
|
|
183711
184607
|
}
|
|
183712
184608
|
);
|
|
@@ -194826,6 +195722,88 @@ function useCancellationReason(env2, runId, status, events2) {
|
|
|
194826
195722
|
}, [env2, runId, status, loadedReason]);
|
|
194827
195723
|
return loadedReason ?? terminalReason;
|
|
194828
195724
|
}
|
|
195725
|
+
const RUN_USAGE_REFRESH_INTERVAL_MS = 5e3;
|
|
195726
|
+
const SLOW_READ_BACKOFF = 10;
|
|
195727
|
+
function useRunUsage(env2, runId, {
|
|
195728
|
+
enabled = true,
|
|
195729
|
+
live = false,
|
|
195730
|
+
refreshInterval = RUN_USAGE_REFRESH_INTERVAL_MS
|
|
195731
|
+
} = {}) {
|
|
195732
|
+
const [usage, setUsage] = reactExports.useState(void 0);
|
|
195733
|
+
const [loading, setLoading] = reactExports.useState(false);
|
|
195734
|
+
const [error2, setError] = reactExports.useState(null);
|
|
195735
|
+
const latestRef = reactExports.useRef(0);
|
|
195736
|
+
const lastReadMsRef = reactExports.useRef(0);
|
|
195737
|
+
const inFlightRef = reactExports.useRef(0);
|
|
195738
|
+
const mountedRef = reactExports.useRef(true);
|
|
195739
|
+
reactExports.useEffect(() => {
|
|
195740
|
+
mountedRef.current = true;
|
|
195741
|
+
return () => {
|
|
195742
|
+
mountedRef.current = false;
|
|
195743
|
+
};
|
|
195744
|
+
}, []);
|
|
195745
|
+
const read2 = reactExports.useCallback(async () => {
|
|
195746
|
+
const seq = ++latestRef.current;
|
|
195747
|
+
const startedAt = Date.now();
|
|
195748
|
+
const isCurrent = () => mountedRef.current && seq === latestRef.current;
|
|
195749
|
+
inFlightRef.current++;
|
|
195750
|
+
setLoading(true);
|
|
195751
|
+
try {
|
|
195752
|
+
const result = await unwrapOrThrow(fetchRunUsage$1(env2, runId));
|
|
195753
|
+
if (isCurrent()) {
|
|
195754
|
+
setUsage(result);
|
|
195755
|
+
setError(null);
|
|
195756
|
+
}
|
|
195757
|
+
} catch (err) {
|
|
195758
|
+
if (isCurrent()) {
|
|
195759
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
195760
|
+
}
|
|
195761
|
+
} finally {
|
|
195762
|
+
lastReadMsRef.current = Date.now() - startedAt;
|
|
195763
|
+
inFlightRef.current--;
|
|
195764
|
+
if (isCurrent()) setLoading(false);
|
|
195765
|
+
}
|
|
195766
|
+
}, [env2, runId]);
|
|
195767
|
+
reactExports.useEffect(() => {
|
|
195768
|
+
setUsage(void 0);
|
|
195769
|
+
setError(null);
|
|
195770
|
+
}, [runId]);
|
|
195771
|
+
reactExports.useEffect(() => {
|
|
195772
|
+
if (!enabled) return;
|
|
195773
|
+
void read2();
|
|
195774
|
+
}, [enabled, read2]);
|
|
195775
|
+
const wasLiveRef = reactExports.useRef(live);
|
|
195776
|
+
reactExports.useEffect(() => {
|
|
195777
|
+
const wasLive = wasLiveRef.current;
|
|
195778
|
+
wasLiveRef.current = live;
|
|
195779
|
+
if (enabled && wasLive && !live) void read2();
|
|
195780
|
+
}, [enabled, live, read2]);
|
|
195781
|
+
const unsupported = usage === null;
|
|
195782
|
+
const polling = live || (usage == null ? void 0 : usage.inProgress) === true;
|
|
195783
|
+
reactExports.useEffect(() => {
|
|
195784
|
+
if (!enabled || !polling || unsupported) return;
|
|
195785
|
+
if (!refreshInterval || refreshInterval <= 0) return;
|
|
195786
|
+
let cancelled = false;
|
|
195787
|
+
let timer2;
|
|
195788
|
+
const schedule2 = () => {
|
|
195789
|
+
const delay = Math.max(
|
|
195790
|
+
refreshInterval,
|
|
195791
|
+
SLOW_READ_BACKOFF * lastReadMsRef.current
|
|
195792
|
+
);
|
|
195793
|
+
timer2 = setTimeout(async () => {
|
|
195794
|
+
if (cancelled) return;
|
|
195795
|
+
if (inFlightRef.current === 0) await read2();
|
|
195796
|
+
if (!cancelled) schedule2();
|
|
195797
|
+
}, delay);
|
|
195798
|
+
};
|
|
195799
|
+
schedule2();
|
|
195800
|
+
return () => {
|
|
195801
|
+
cancelled = true;
|
|
195802
|
+
clearTimeout(timer2);
|
|
195803
|
+
};
|
|
195804
|
+
}, [enabled, polling, unsupported, refreshInterval, read2]);
|
|
195805
|
+
return { usage, loading, error: error2, refresh: read2 };
|
|
195806
|
+
}
|
|
194829
195807
|
const FRAME_HEADER_SIZE = 4;
|
|
194830
195808
|
const ENCRYPTED_PLACEHOLDER = "[Encrypted]";
|
|
194831
195809
|
const POLL_INTERVAL_MS = 3e3;
|
|
@@ -195196,6 +196174,696 @@ function LiveStatus({ hasError, errorMessage }) {
|
|
|
195196
196174
|
({
|
|
195197
196175
|
...LAYOUT$1
|
|
195198
196176
|
});
|
|
196177
|
+
const STORAGE_DOCS_URL = `${USAGE_DOCS_URL}#storage`;
|
|
196178
|
+
function NewTabLink({
|
|
196179
|
+
href,
|
|
196180
|
+
className,
|
|
196181
|
+
children: children2,
|
|
196182
|
+
label,
|
|
196183
|
+
testId,
|
|
196184
|
+
...rest
|
|
196185
|
+
}) {
|
|
196186
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
196187
|
+
"a",
|
|
196188
|
+
{
|
|
196189
|
+
...rest,
|
|
196190
|
+
href,
|
|
196191
|
+
target: "_blank",
|
|
196192
|
+
rel: "noopener noreferrer",
|
|
196193
|
+
className,
|
|
196194
|
+
"aria-label": label ? `${label} (opens in a new tab)` : void 0,
|
|
196195
|
+
"data-testid": testId,
|
|
196196
|
+
children: [
|
|
196197
|
+
children2,
|
|
196198
|
+
!label && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
196199
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196200
|
+
ArrowUpRight,
|
|
196201
|
+
{
|
|
196202
|
+
className: "ml-0.5 inline h-3.5 w-3.5 align-[-2px]",
|
|
196203
|
+
"aria-hidden": "true"
|
|
196204
|
+
}
|
|
196205
|
+
),
|
|
196206
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: " (opens in a new tab)" })
|
|
196207
|
+
] })
|
|
196208
|
+
]
|
|
196209
|
+
}
|
|
196210
|
+
);
|
|
196211
|
+
}
|
|
196212
|
+
function runUsagePath(runId) {
|
|
196213
|
+
return `/run/${encodeURIComponent(runId)}/usage`;
|
|
196214
|
+
}
|
|
196215
|
+
function runPath(runId) {
|
|
196216
|
+
return `/run/${encodeURIComponent(runId)}`;
|
|
196217
|
+
}
|
|
196218
|
+
const ENTITY_LABELS = {
|
|
196219
|
+
run: "Run",
|
|
196220
|
+
step: "Steps",
|
|
196221
|
+
hook: "Hooks",
|
|
196222
|
+
stream: "Streams"
|
|
196223
|
+
};
|
|
196224
|
+
const ROW_RESOURCE = {
|
|
196225
|
+
steps: "step",
|
|
196226
|
+
hooks: "hook",
|
|
196227
|
+
attributes: "run",
|
|
196228
|
+
sleeps: "sleep",
|
|
196229
|
+
run: "run",
|
|
196230
|
+
other: "event"
|
|
196231
|
+
};
|
|
196232
|
+
function RowIcon({ type }) {
|
|
196233
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex h-[18px] shrink-0 items-center", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceIcon, { resource: ROW_RESOURCE[type] }) });
|
|
196234
|
+
}
|
|
196235
|
+
function RetryBadge({
|
|
196236
|
+
retries,
|
|
196237
|
+
testId = "run-usage-retries"
|
|
196238
|
+
}) {
|
|
196239
|
+
if (retries <= 0) return null;
|
|
196240
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196241
|
+
"span",
|
|
196242
|
+
{
|
|
196243
|
+
className: "inline-flex items-center whitespace-nowrap rounded-full border border-amber-400 bg-amber-100 px-2 text-label-12 leading-4 text-amber-900",
|
|
196244
|
+
"data-testid": testId,
|
|
196245
|
+
children: formatCount(retries, "retry", "retries")
|
|
196246
|
+
}
|
|
196247
|
+
);
|
|
196248
|
+
}
|
|
196249
|
+
function RowDetail({
|
|
196250
|
+
children: children2,
|
|
196251
|
+
testId
|
|
196252
|
+
}) {
|
|
196253
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196254
|
+
"span",
|
|
196255
|
+
{
|
|
196256
|
+
className: "whitespace-nowrap font-sans text-label-12 text-gray-700",
|
|
196257
|
+
"data-testid": testId,
|
|
196258
|
+
children: children2
|
|
196259
|
+
}
|
|
196260
|
+
);
|
|
196261
|
+
}
|
|
196262
|
+
function InlineRetryBadge({
|
|
196263
|
+
retries,
|
|
196264
|
+
className
|
|
196265
|
+
}) {
|
|
196266
|
+
if (retries <= 0) return null;
|
|
196267
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: cn$2("mt-1 block @min-[520px]:hidden", className), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RetryBadge, { retries, testId: "run-usage-retries-inline" }) });
|
|
196268
|
+
}
|
|
196269
|
+
function ShareBar({
|
|
196270
|
+
share,
|
|
196271
|
+
muted = false
|
|
196272
|
+
}) {
|
|
196273
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196274
|
+
"div",
|
|
196275
|
+
{
|
|
196276
|
+
className: "h-1.5 w-full min-w-16 rounded-full bg-gray-alpha-200",
|
|
196277
|
+
"aria-hidden": "true",
|
|
196278
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196279
|
+
"div",
|
|
196280
|
+
{
|
|
196281
|
+
className: cn$2(
|
|
196282
|
+
"h-1.5 rounded-full",
|
|
196283
|
+
muted ? "bg-gray-500" : "bg-blue-700"
|
|
196284
|
+
),
|
|
196285
|
+
style: { width: `${Math.max(0, Math.min(1, share)) * 100}%` }
|
|
196286
|
+
}
|
|
196287
|
+
)
|
|
196288
|
+
}
|
|
196289
|
+
);
|
|
196290
|
+
}
|
|
196291
|
+
function usageVisible(usage, isLocalBackend) {
|
|
196292
|
+
return usage != null || usage === void 0 && isLocalBackend;
|
|
196293
|
+
}
|
|
196294
|
+
const UNAVAILABLE = "—";
|
|
196295
|
+
function dataWrittenLabel(usage, isLocalBackend) {
|
|
196296
|
+
if (usage) return formatDataWrittenHeading(usage);
|
|
196297
|
+
return isLocalBackend ? "Storage (local)" : "Storage";
|
|
196298
|
+
}
|
|
196299
|
+
const failedMessage = (error2) => `Failed to read this run’s usage: ${error2.message}`;
|
|
196300
|
+
function HeaderFigure({
|
|
196301
|
+
to: to2,
|
|
196302
|
+
onUsagePage,
|
|
196303
|
+
label,
|
|
196304
|
+
title,
|
|
196305
|
+
testId,
|
|
196306
|
+
children: children2
|
|
196307
|
+
}) {
|
|
196308
|
+
if (onUsagePage) {
|
|
196309
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", "data-testid": testId, title, children: children2 });
|
|
196310
|
+
}
|
|
196311
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196312
|
+
Link,
|
|
196313
|
+
{
|
|
196314
|
+
to: to2,
|
|
196315
|
+
className: "-my-1 inline-block min-w-6 rounded-sm py-1 text-left text-xs underline decoration-dotted underline-offset-2 text-gray-1000 hover:text-blue-900 focus-visible:outline-none focus-visible:shadow-[var(--ds-focus-ring)]",
|
|
196316
|
+
"aria-label": label,
|
|
196317
|
+
title,
|
|
196318
|
+
"data-testid": testId,
|
|
196319
|
+
children: children2
|
|
196320
|
+
}
|
|
196321
|
+
);
|
|
196322
|
+
}
|
|
196323
|
+
function RunUsageHeaderStats({
|
|
196324
|
+
runId,
|
|
196325
|
+
usage,
|
|
196326
|
+
error: error2,
|
|
196327
|
+
isLocalBackend,
|
|
196328
|
+
onUsagePage = false
|
|
196329
|
+
}) {
|
|
196330
|
+
const failed = !usage && error2 !== null;
|
|
196331
|
+
const failedTitle = failed ? failedMessage(error2) : void 0;
|
|
196332
|
+
const localNote = usage ? formatLocalDataWrittenNote(usage) : null;
|
|
196333
|
+
const to2 = runUsagePath(runId);
|
|
196334
|
+
const label = dataWrittenLabel(usage, isLocalBackend);
|
|
196335
|
+
const events2 = usage ? usage.events.toLocaleString("en-US") : UNAVAILABLE;
|
|
196336
|
+
const bytes = usage ? formatUsageBytes(usage.dataWritten.bytes) : UNAVAILABLE;
|
|
196337
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
196338
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
196339
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Events" }),
|
|
196340
|
+
usage || failed ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196341
|
+
HeaderFigure,
|
|
196342
|
+
{
|
|
196343
|
+
to: to2,
|
|
196344
|
+
onUsagePage,
|
|
196345
|
+
label: usage ? `${formatCount(usage.events, "event", "events")}, open usage` : "Events unavailable, open usage",
|
|
196346
|
+
title: failedTitle,
|
|
196347
|
+
testId: "run-usage-events",
|
|
196348
|
+
children: events2
|
|
196349
|
+
}
|
|
196350
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[40px] h-[20px]" })
|
|
196351
|
+
] }),
|
|
196352
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
196353
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
196354
|
+
"div",
|
|
196355
|
+
{
|
|
196356
|
+
className: "text-xs text-muted-foreground flex items-center gap-1",
|
|
196357
|
+
"data-testid": "run-usage-data-label",
|
|
196358
|
+
children: [
|
|
196359
|
+
label,
|
|
196360
|
+
localNote && /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
196361
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196362
|
+
NewTabLink,
|
|
196363
|
+
{
|
|
196364
|
+
href: STORAGE_DOCS_URL,
|
|
196365
|
+
className: "-m-1.5 inline-flex rounded-sm p-1.5 text-muted-foreground hover:text-gray-1000 focus-visible:outline-none focus-visible:shadow-[var(--ds-focus-ring)]",
|
|
196366
|
+
label: `How ${label} is counted`,
|
|
196367
|
+
testId: "run-usage-data-help",
|
|
196368
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(CircleQuestionMark, { className: "w-3 h-3", "aria-hidden": "true" })
|
|
196369
|
+
}
|
|
196370
|
+
) }),
|
|
196371
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "max-w-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: localNote }) })
|
|
196372
|
+
] })
|
|
196373
|
+
]
|
|
196374
|
+
}
|
|
196375
|
+
),
|
|
196376
|
+
usage || failed ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196377
|
+
HeaderFigure,
|
|
196378
|
+
{
|
|
196379
|
+
to: to2,
|
|
196380
|
+
onUsagePage,
|
|
196381
|
+
label: usage ? `${bytes} ${label.toLowerCase()}, open usage` : `${label} unavailable, open usage`,
|
|
196382
|
+
title: failedTitle,
|
|
196383
|
+
testId: "run-usage-data-written",
|
|
196384
|
+
children: bytes
|
|
196385
|
+
}
|
|
196386
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[50px] h-[20px]" })
|
|
196387
|
+
] })
|
|
196388
|
+
] });
|
|
196389
|
+
}
|
|
196390
|
+
function formatRunEventTypes(usage) {
|
|
196391
|
+
const { events: events2, byType } = usage.runEvents;
|
|
196392
|
+
if (events2 <= 0) return null;
|
|
196393
|
+
const parts = RUN_USAGE_RUN_EVENT_TYPES.flatMap(
|
|
196394
|
+
(type) => byType[type] > 0 ? [`${byType[type].toLocaleString("en-US")} ${type}`] : []
|
|
196395
|
+
);
|
|
196396
|
+
const known = RUN_USAGE_RUN_EVENT_TYPES.reduce((n, t) => n + byType[t], 0);
|
|
196397
|
+
if (events2 > known) {
|
|
196398
|
+
parts.push(`${(events2 - known).toLocaleString("en-US")} other`);
|
|
196399
|
+
}
|
|
196400
|
+
return parts.join(", ");
|
|
196401
|
+
}
|
|
196402
|
+
const CELL = "py-2 pr-2 sm:pr-4";
|
|
196403
|
+
const SHARE_CELL = "py-2 pr-0 @min-[520px]:pr-4";
|
|
196404
|
+
const TABLE_HEAD_ROW = "text-label-12 text-gray-900 border-b border-gray-alpha-400";
|
|
196405
|
+
function groupDetail(group) {
|
|
196406
|
+
switch (group.type) {
|
|
196407
|
+
case "steps":
|
|
196408
|
+
return formatCount(group.calls, "call", "calls");
|
|
196409
|
+
case "hooks":
|
|
196410
|
+
return formatCount(group.calls, "hook", "hooks");
|
|
196411
|
+
case "attributes":
|
|
196412
|
+
return formatCount(group.calls, "write", "writes");
|
|
196413
|
+
case "sleeps":
|
|
196414
|
+
return formatCount(group.calls, "sleep", "sleeps");
|
|
196415
|
+
default:
|
|
196416
|
+
return null;
|
|
196417
|
+
}
|
|
196418
|
+
}
|
|
196419
|
+
function BreakableLabel({ label }) {
|
|
196420
|
+
const parts = label.split(new RegExp("(?<=[:/._-])"));
|
|
196421
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: parts.map((part, i) => (
|
|
196422
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: parts of one fixed label
|
|
196423
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(reactExports.Fragment, { children: [
|
|
196424
|
+
i > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("wbr", {}),
|
|
196425
|
+
part
|
|
196426
|
+
] }, i)
|
|
196427
|
+
)) });
|
|
196428
|
+
}
|
|
196429
|
+
function CountCells({
|
|
196430
|
+
row,
|
|
196431
|
+
emphasis: emphasis2 = false
|
|
196432
|
+
}) {
|
|
196433
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
196434
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196435
|
+
"td",
|
|
196436
|
+
{
|
|
196437
|
+
className: cn$2(
|
|
196438
|
+
CELL,
|
|
196439
|
+
"text-right tabular-nums",
|
|
196440
|
+
emphasis2 && "font-medium"
|
|
196441
|
+
),
|
|
196442
|
+
children: row.events.toLocaleString("en-US")
|
|
196443
|
+
}
|
|
196444
|
+
),
|
|
196445
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: cn$2(CELL, "hidden @min-[520px]:table-cell"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ShareBar, { share: row.share }) }),
|
|
196446
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: cn$2(SHARE_CELL, "text-right tabular-nums text-gray-900"), children: formatUsageShare(row.share) }),
|
|
196447
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "hidden py-2 @min-[520px]:table-cell", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RetryBadge, { retries: row.retries }) })
|
|
196448
|
+
] });
|
|
196449
|
+
}
|
|
196450
|
+
const TOGGLE = "-my-[3px] -ml-1 flex min-w-0 items-start gap-2 rounded-sm py-[3px] pl-1 pr-1 text-left focus-visible:outline-none focus-visible:shadow-[var(--ds-focus-ring)]";
|
|
196451
|
+
function UsageGroup({
|
|
196452
|
+
group,
|
|
196453
|
+
usage,
|
|
196454
|
+
idPrefix
|
|
196455
|
+
}) {
|
|
196456
|
+
const expandable = group.type === "steps" || group.type === "hooks";
|
|
196457
|
+
const [expanded, setExpanded] = reactExports.useState(true);
|
|
196458
|
+
const [showAll, setShowAll] = reactExports.useState(false);
|
|
196459
|
+
const label = USAGE_ROW_TYPE_LABELS[group.type];
|
|
196460
|
+
const detail = groupDetail(group);
|
|
196461
|
+
const runEventTypes = group.type === "run" ? formatRunEventTypes(usage) : null;
|
|
196462
|
+
const childrenId = `${idPrefix}-${group.type}`;
|
|
196463
|
+
const shown = expandable && showAll ? usageRows(usage, Number.POSITIVE_INFINITY).find(
|
|
196464
|
+
(g2) => g2.type === group.type
|
|
196465
|
+
) ?? group : group;
|
|
196466
|
+
const name2 = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
196467
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(RowIcon, { type: group.type }),
|
|
196468
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex min-w-0 flex-wrap items-baseline gap-x-2", children: [
|
|
196469
|
+
runEventTypes ? (
|
|
196470
|
+
// Just "Run"; its event types are its tooltip, on hover or focus.
|
|
196471
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
196472
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196473
|
+
"span",
|
|
196474
|
+
{
|
|
196475
|
+
tabIndex: 0,
|
|
196476
|
+
className: "rounded-sm font-medium text-gray-1000 underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:shadow-[var(--ds-focus-ring)]",
|
|
196477
|
+
"data-testid": "run-usage-type-label",
|
|
196478
|
+
children: label
|
|
196479
|
+
}
|
|
196480
|
+
) }),
|
|
196481
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { "data-testid": "run-usage-run-events", children: runEventTypes })
|
|
196482
|
+
] })
|
|
196483
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196484
|
+
"span",
|
|
196485
|
+
{
|
|
196486
|
+
className: "font-medium text-gray-1000",
|
|
196487
|
+
"data-testid": "run-usage-type-label",
|
|
196488
|
+
children: label
|
|
196489
|
+
}
|
|
196490
|
+
),
|
|
196491
|
+
detail && /* @__PURE__ */ jsxRuntimeExports.jsx(RowDetail, { testId: "run-usage-group-detail", children: detail })
|
|
196492
|
+
] })
|
|
196493
|
+
] });
|
|
196494
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
196495
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
196496
|
+
"tr",
|
|
196497
|
+
{
|
|
196498
|
+
className: "border-b border-gray-alpha-200",
|
|
196499
|
+
"data-testid": "run-usage-group",
|
|
196500
|
+
"data-type": group.type,
|
|
196501
|
+
children: [
|
|
196502
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("td", { className: CELL, children: [
|
|
196503
|
+
expandable ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
196504
|
+
"button",
|
|
196505
|
+
{
|
|
196506
|
+
type: "button",
|
|
196507
|
+
className: TOGGLE,
|
|
196508
|
+
"aria-expanded": expanded,
|
|
196509
|
+
"aria-controls": childrenId,
|
|
196510
|
+
onClick: () => setExpanded((value) => !value),
|
|
196511
|
+
"data-testid": "run-usage-toggle",
|
|
196512
|
+
children: [
|
|
196513
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex h-[18px] shrink-0 items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196514
|
+
ChevronRight,
|
|
196515
|
+
{
|
|
196516
|
+
className: cn$2(
|
|
196517
|
+
"h-4 w-4 text-gray-900 motion-safe:transition-transform",
|
|
196518
|
+
expanded && "rotate-90"
|
|
196519
|
+
),
|
|
196520
|
+
"aria-hidden": "true"
|
|
196521
|
+
}
|
|
196522
|
+
) }),
|
|
196523
|
+
name2
|
|
196524
|
+
]
|
|
196525
|
+
}
|
|
196526
|
+
) : (
|
|
196527
|
+
// Lines up with the toggles' labels: a chevron's width in.
|
|
196528
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-w-0 items-start gap-2 pl-6", children: name2 })
|
|
196529
|
+
),
|
|
196530
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(InlineRetryBadge, { retries: group.retries, className: "pl-12" })
|
|
196531
|
+
] }),
|
|
196532
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CountCells, { row: group, emphasis: true })
|
|
196533
|
+
]
|
|
196534
|
+
}
|
|
196535
|
+
) }),
|
|
196536
|
+
expandable && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
196537
|
+
"tbody",
|
|
196538
|
+
{
|
|
196539
|
+
id: childrenId,
|
|
196540
|
+
hidden: !expanded,
|
|
196541
|
+
"data-testid": "run-usage-children",
|
|
196542
|
+
"data-type": group.type,
|
|
196543
|
+
children: [
|
|
196544
|
+
shown.children.map((child) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
196545
|
+
"tr",
|
|
196546
|
+
{
|
|
196547
|
+
className: "border-b border-gray-alpha-200",
|
|
196548
|
+
"data-testid": "run-usage-child",
|
|
196549
|
+
"data-key": child.key,
|
|
196550
|
+
children: [
|
|
196551
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("td", { className: cn$2(CELL, "pl-12"), children: [
|
|
196552
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex min-w-0 flex-wrap items-baseline gap-x-2", children: [
|
|
196553
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196554
|
+
"span",
|
|
196555
|
+
{
|
|
196556
|
+
className: "min-w-0 font-mono text-gray-1000",
|
|
196557
|
+
title: child.label,
|
|
196558
|
+
"data-testid": "run-usage-child-label",
|
|
196559
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(BreakableLabel, { label: child.label })
|
|
196560
|
+
}
|
|
196561
|
+
),
|
|
196562
|
+
group.type === "steps" && /* @__PURE__ */ jsxRuntimeExports.jsx(RowDetail, { testId: "run-usage-calls", children: formatCount(child.calls, "call", "calls") })
|
|
196563
|
+
] }),
|
|
196564
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(InlineRetryBadge, { retries: child.retries })
|
|
196565
|
+
] }),
|
|
196566
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CountCells, { row: child })
|
|
196567
|
+
]
|
|
196568
|
+
},
|
|
196569
|
+
child.key
|
|
196570
|
+
)),
|
|
196571
|
+
shown.otherChildren && /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { className: "border-b border-gray-alpha-200", children: [
|
|
196572
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("td", { className: cn$2(CELL, "pl-12"), children: [
|
|
196573
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196574
|
+
"button",
|
|
196575
|
+
{
|
|
196576
|
+
type: "button",
|
|
196577
|
+
className: "-my-[3px] rounded-sm py-[3px] text-gray-900 hover:text-gray-1000 underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:shadow-[var(--ds-focus-ring)]",
|
|
196578
|
+
onClick: () => setShowAll(true),
|
|
196579
|
+
children: shown.otherChildren.label
|
|
196580
|
+
}
|
|
196581
|
+
),
|
|
196582
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(InlineRetryBadge, { retries: shown.otherChildren.retries })
|
|
196583
|
+
] }),
|
|
196584
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CountCells, { row: shown.otherChildren })
|
|
196585
|
+
] })
|
|
196586
|
+
]
|
|
196587
|
+
}
|
|
196588
|
+
)
|
|
196589
|
+
] });
|
|
196590
|
+
}
|
|
196591
|
+
function UsageTable({ usage }) {
|
|
196592
|
+
const idPrefix = reactExports.useId();
|
|
196593
|
+
return (
|
|
196594
|
+
// A size container: its width, not the viewport's, decides whether the
|
|
196595
|
+
// bars and the retries column fit (side by side with the storage table
|
|
196596
|
+
// from lg, the table is narrower than the screen).
|
|
196597
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "@container overflow-x-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("table", { className: "w-full text-copy-13", "data-testid": "run-usage-types", children: [
|
|
196598
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("thead", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { className: TABLE_HEAD_ROW, children: [
|
|
196599
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: cn$2(CELL, "text-left font-medium"), children: "Type" }),
|
|
196600
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: cn$2(CELL, "text-right font-medium"), children: "Events" }),
|
|
196601
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: cn$2(CELL, "hidden w-1/4 @min-[520px]:table-cell"), children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Share of Events" }) }),
|
|
196602
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: cn$2(SHARE_CELL, "text-right font-medium"), children: "Share" }),
|
|
196603
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: "hidden py-2 text-left font-medium @min-[520px]:table-cell", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Retries" }) })
|
|
196604
|
+
] }) }),
|
|
196605
|
+
usageRows(usage).map((group) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196606
|
+
UsageGroup,
|
|
196607
|
+
{
|
|
196608
|
+
group,
|
|
196609
|
+
usage,
|
|
196610
|
+
idPrefix
|
|
196611
|
+
},
|
|
196612
|
+
group.key
|
|
196613
|
+
))
|
|
196614
|
+
] }) })
|
|
196615
|
+
);
|
|
196616
|
+
}
|
|
196617
|
+
function DataWrittenTable({ usage }) {
|
|
196618
|
+
const purgedNote = formatDataPurgedNote(usage);
|
|
196619
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
|
|
196620
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("table", { className: "w-full text-copy-13", "data-testid": "run-usage-data", children: [
|
|
196621
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("thead", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { className: TABLE_HEAD_ROW, children: [
|
|
196622
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196623
|
+
"th",
|
|
196624
|
+
{
|
|
196625
|
+
className: cn$2(CELL, "text-left font-medium"),
|
|
196626
|
+
"data-testid": "run-usage-data-heading",
|
|
196627
|
+
children: formatDataWrittenHeading(usage)
|
|
196628
|
+
}
|
|
196629
|
+
),
|
|
196630
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: "py-2 text-right font-medium", children: "Size" })
|
|
196631
|
+
] }) }),
|
|
196632
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("tbody", { children: [
|
|
196633
|
+
RUN_USAGE_ENTITIES.filter(
|
|
196634
|
+
// Like the CLI: only the entities that wrote something.
|
|
196635
|
+
(entity) => usage.dataWritten.byEntity[entity] > 0
|
|
196636
|
+
).map((entity) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
196637
|
+
"tr",
|
|
196638
|
+
{
|
|
196639
|
+
className: "border-b border-gray-alpha-200",
|
|
196640
|
+
"data-testid": "run-usage-entity",
|
|
196641
|
+
children: [
|
|
196642
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: cn$2(CELL, "text-gray-1000"), children: ENTITY_LABELS[entity] }),
|
|
196643
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "py-2 text-right tabular-nums", children: formatUsageBytes(usage.dataWritten.byEntity[entity]) })
|
|
196644
|
+
]
|
|
196645
|
+
},
|
|
196646
|
+
entity
|
|
196647
|
+
)),
|
|
196648
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { className: "font-medium", children: [
|
|
196649
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: cn$2(CELL, "text-gray-1000"), children: "Total" }),
|
|
196650
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196651
|
+
"td",
|
|
196652
|
+
{
|
|
196653
|
+
className: "py-2 text-right tabular-nums",
|
|
196654
|
+
"data-testid": "run-usage-total",
|
|
196655
|
+
children: formatUsageBytes(usage.dataWritten.bytes)
|
|
196656
|
+
}
|
|
196657
|
+
)
|
|
196658
|
+
] })
|
|
196659
|
+
] })
|
|
196660
|
+
] }),
|
|
196661
|
+
purgedNote && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196662
|
+
"p",
|
|
196663
|
+
{
|
|
196664
|
+
className: "text-copy-13 text-gray-900",
|
|
196665
|
+
"data-testid": "run-usage-purged-note",
|
|
196666
|
+
children: purgedNote
|
|
196667
|
+
}
|
|
196668
|
+
),
|
|
196669
|
+
usage.dataRetained && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { "data-testid": "run-usage-retained", children: [
|
|
196670
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-label-12 text-gray-900", children: "Data retained" }),
|
|
196671
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-copy-14 text-gray-1000", children: [
|
|
196672
|
+
formatUsageBytes(usage.dataRetained.byteMonths),
|
|
196673
|
+
"-months"
|
|
196674
|
+
] }),
|
|
196675
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-copy-13 text-gray-900", children: [
|
|
196676
|
+
"Storage × ",
|
|
196677
|
+
usage.dataRetained.retentionMonths,
|
|
196678
|
+
" month retention"
|
|
196679
|
+
] })
|
|
196680
|
+
] })
|
|
196681
|
+
] });
|
|
196682
|
+
}
|
|
196683
|
+
const USAGE_TABLES_LAYOUT = "grid grid-cols-1 gap-8 lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] lg:gap-10";
|
|
196684
|
+
function UsageTables({ spans, data: data2 }) {
|
|
196685
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: USAGE_TABLES_LAYOUT, "data-testid": "run-usage-tables", children: [
|
|
196686
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("section", { "aria-labelledby": "run-usage-spans-heading", className: "min-w-0", children: [
|
|
196687
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { id: "run-usage-spans-heading", className: "sr-only", children: "Events by type" }),
|
|
196688
|
+
spans
|
|
196689
|
+
] }),
|
|
196690
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("section", { "aria-labelledby": "run-usage-data-section", className: "min-w-0", children: [
|
|
196691
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { id: "run-usage-data-section", className: "sr-only", children: "Storage" }),
|
|
196692
|
+
data2
|
|
196693
|
+
] })
|
|
196694
|
+
] });
|
|
196695
|
+
}
|
|
196696
|
+
const skeletonRow = (key, widths) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
196697
|
+
"div",
|
|
196698
|
+
{
|
|
196699
|
+
className: "flex h-[37px] items-center justify-between border-b border-gray-alpha-200",
|
|
196700
|
+
children: [
|
|
196701
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: cn$2("h-4", widths[0]) }),
|
|
196702
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: cn$2("h-4", widths[1]) })
|
|
196703
|
+
]
|
|
196704
|
+
},
|
|
196705
|
+
key
|
|
196706
|
+
);
|
|
196707
|
+
function RunUsagePageSkeleton() {
|
|
196708
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-6 pb-6 pt-2", "data-testid": "run-usage-skeleton", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196709
|
+
UsageTables,
|
|
196710
|
+
{
|
|
196711
|
+
spans: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
196712
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-[33px] items-center border-b border-gray-alpha-400", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-3 w-12" }) }),
|
|
196713
|
+
skeletonRow(0, ["w-28 ml-6", "w-10"]),
|
|
196714
|
+
[1, 2, 3].map((i) => skeletonRow(i, ["w-40 ml-12", "w-10"])),
|
|
196715
|
+
skeletonRow(4, ["w-28 ml-6", "w-10"]),
|
|
196716
|
+
skeletonRow(5, ["w-40 ml-12", "w-10"]),
|
|
196717
|
+
[6, 7, 8].map((i) => skeletonRow(i, ["w-24 ml-6", "w-10"]))
|
|
196718
|
+
] }),
|
|
196719
|
+
data: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
196720
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-[33px] items-center border-b border-gray-alpha-400", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-3 w-32" }) }),
|
|
196721
|
+
[0, 1, 2, 3, 4].map((i) => skeletonRow(i, ["w-16", "w-12"]))
|
|
196722
|
+
] })
|
|
196723
|
+
}
|
|
196724
|
+
) });
|
|
196725
|
+
}
|
|
196726
|
+
const FOOTER_LINK = "whitespace-nowrap rounded-sm py-1 text-blue-900 hover:underline focus-visible:outline-none focus-visible:shadow-[var(--ds-focus-ring)]";
|
|
196727
|
+
function UsageFooter({ usage }) {
|
|
196728
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("footer", { className: "text-copy-13 text-gray-900", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { "data-testid": "run-usage-footer-line", children: [
|
|
196729
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { "data-testid": "run-usage-footer", children: usage.billed ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-gray-1000", children: formatUsageFooter(usage) }) : formatUsageFooter(usage) }),
|
|
196730
|
+
" ",
|
|
196731
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(NewTabLink, { href: USAGE_DOCS_URL, className: FOOTER_LINK, children: "How usage is counted" })
|
|
196732
|
+
] }) });
|
|
196733
|
+
}
|
|
196734
|
+
function RunUsagePage({
|
|
196735
|
+
runId,
|
|
196736
|
+
usage,
|
|
196737
|
+
error: error2,
|
|
196738
|
+
onRetry,
|
|
196739
|
+
retrying = false
|
|
196740
|
+
}) {
|
|
196741
|
+
if (usage === null) {
|
|
196742
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
196743
|
+
"div",
|
|
196744
|
+
{
|
|
196745
|
+
className: "flex flex-col items-start gap-3 pb-6 pt-2",
|
|
196746
|
+
"data-testid": "run-usage-unsupported",
|
|
196747
|
+
children: [
|
|
196748
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-copy-14 text-gray-1000", children: "This page isn’t available for this backend." }),
|
|
196749
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196750
|
+
Link,
|
|
196751
|
+
{
|
|
196752
|
+
to: runPath(runId),
|
|
196753
|
+
className: "-my-[3px] inline-block rounded-sm py-[3px] text-copy-13 text-blue-900 hover:underline focus-visible:outline-none focus-visible:shadow-[var(--ds-focus-ring)]",
|
|
196754
|
+
children: "Back to run"
|
|
196755
|
+
}
|
|
196756
|
+
)
|
|
196757
|
+
]
|
|
196758
|
+
}
|
|
196759
|
+
);
|
|
196760
|
+
}
|
|
196761
|
+
if (!usage) {
|
|
196762
|
+
if (!error2) return /* @__PURE__ */ jsxRuntimeExports.jsx(RunUsagePageSkeleton, {});
|
|
196763
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
196764
|
+
"div",
|
|
196765
|
+
{
|
|
196766
|
+
className: "flex flex-col items-start gap-3 pb-6 pt-2",
|
|
196767
|
+
"data-testid": "run-usage-error",
|
|
196768
|
+
children: [
|
|
196769
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-copy-13 text-red-800", children: [
|
|
196770
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CircleAlert, { className: "h-4 w-4 shrink-0" }),
|
|
196771
|
+
failedMessage(error2)
|
|
196772
|
+
] }),
|
|
196773
|
+
onRetry && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196774
|
+
Button,
|
|
196775
|
+
{
|
|
196776
|
+
variant: "secondary",
|
|
196777
|
+
size: "small",
|
|
196778
|
+
onClick: onRetry,
|
|
196779
|
+
loading: retrying,
|
|
196780
|
+
prefix: /* @__PURE__ */ jsxRuntimeExports.jsx(RotateCw, {}),
|
|
196781
|
+
children: "Try again"
|
|
196782
|
+
}
|
|
196783
|
+
)
|
|
196784
|
+
]
|
|
196785
|
+
}
|
|
196786
|
+
);
|
|
196787
|
+
}
|
|
196788
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-8 pb-6 pt-2", "data-testid": "run-usage-page", children: [
|
|
196789
|
+
error2 && /* @__PURE__ */ jsxRuntimeExports.jsxs("output", { className: "block text-copy-13 text-amber-800", children: [
|
|
196790
|
+
"Showing the last numbers read. Failed to refresh: ",
|
|
196791
|
+
error2.message
|
|
196792
|
+
] }),
|
|
196793
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
196794
|
+
UsageTables,
|
|
196795
|
+
{
|
|
196796
|
+
spans: usage.eventsBySpan.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(UsageTable, { usage }) : /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-copy-13 text-gray-900", children: "This run has no events yet." }),
|
|
196797
|
+
data: /* @__PURE__ */ jsxRuntimeExports.jsx(DataWrittenTable, { usage })
|
|
196798
|
+
}
|
|
196799
|
+
),
|
|
196800
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(UsageFooter, { usage })
|
|
196801
|
+
] });
|
|
196802
|
+
}
|
|
196803
|
+
const RUN_TABS = [
|
|
196804
|
+
{ value: "trace", label: "Trace" },
|
|
196805
|
+
{ value: "events", label: "Events" },
|
|
196806
|
+
{ value: "streams", label: "Streams" }
|
|
196807
|
+
];
|
|
196808
|
+
function focusRunViewItem(root2, item) {
|
|
196809
|
+
const target2 = root2 == null ? void 0 : root2.querySelector(
|
|
196810
|
+
`[data-run-view-item="${item}"]:is([aria-current="page"], [data-state="active"])`
|
|
196811
|
+
);
|
|
196812
|
+
if (!(target2 instanceof HTMLElement)) return false;
|
|
196813
|
+
target2.focus();
|
|
196814
|
+
return true;
|
|
196815
|
+
}
|
|
196816
|
+
function runTabPath(runId, tab2) {
|
|
196817
|
+
return `${runPath(runId)}?tab=${tab2}`;
|
|
196818
|
+
}
|
|
196819
|
+
function UsageNavLink({
|
|
196820
|
+
runId,
|
|
196821
|
+
current: current2 = false,
|
|
196822
|
+
onNavigate
|
|
196823
|
+
}) {
|
|
196824
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
196825
|
+
Link,
|
|
196826
|
+
{
|
|
196827
|
+
to: runUsagePath(runId),
|
|
196828
|
+
className: cn$2(tabsTriggerClassName, "gap-2"),
|
|
196829
|
+
"aria-current": current2 ? "page" : void 0,
|
|
196830
|
+
"data-testid": "run-usage-nav-link",
|
|
196831
|
+
"data-run-view-item": "usage",
|
|
196832
|
+
onClick: () => onNavigate == null ? void 0 : onNavigate("usage"),
|
|
196833
|
+
children: [
|
|
196834
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ChartColumn, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
196835
|
+
"Usage"
|
|
196836
|
+
]
|
|
196837
|
+
}
|
|
196838
|
+
);
|
|
196839
|
+
}
|
|
196840
|
+
const RUN_VIEW_ROW_CLASS = cn$2(
|
|
196841
|
+
tabsListClassName,
|
|
196842
|
+
"mb-4 max-w-full flex-none max-sm:[&_svg]:hidden"
|
|
196843
|
+
);
|
|
196844
|
+
function RunViewNav({
|
|
196845
|
+
runId,
|
|
196846
|
+
showUsage,
|
|
196847
|
+
onNavigate
|
|
196848
|
+
}) {
|
|
196849
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("nav", { "aria-label": "Run views", className: RUN_VIEW_ROW_CLASS, children: [
|
|
196850
|
+
RUN_TABS.map((tab2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
196851
|
+
Link,
|
|
196852
|
+
{
|
|
196853
|
+
to: runTabPath(runId, tab2.value),
|
|
196854
|
+
className: cn$2(tabsTriggerClassName, "gap-2"),
|
|
196855
|
+
"data-run-view-item": tab2.value,
|
|
196856
|
+
onClick: () => onNavigate == null ? void 0 : onNavigate(tab2.value),
|
|
196857
|
+
children: [
|
|
196858
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
196859
|
+
tab2.label
|
|
196860
|
+
]
|
|
196861
|
+
},
|
|
196862
|
+
tab2.value
|
|
196863
|
+
)),
|
|
196864
|
+
showUsage && /* @__PURE__ */ jsxRuntimeExports.jsx(UsageNavLink, { runId, current: true, onNavigate })
|
|
196865
|
+
] });
|
|
196866
|
+
}
|
|
195199
196867
|
function RunDetailView({
|
|
195200
196868
|
runId,
|
|
195201
196869
|
selectedId: _selectedId
|
|
@@ -195209,8 +196877,8 @@ function RunDetailView({
|
|
|
195209
196877
|
const [showCancelDialog, setShowCancelDialog] = reactExports.useState(false);
|
|
195210
196878
|
const [showRerunDialog, setShowRerunDialog] = reactExports.useState(false);
|
|
195211
196879
|
const env2 = reactExports.useMemo(() => ({}), []);
|
|
195212
|
-
const rawTab = searchParams.get("tab")
|
|
195213
|
-
const activeTab = rawTab === "
|
|
196880
|
+
const rawTab = searchParams.get("tab");
|
|
196881
|
+
const activeTab = rawTab === "events" || rawTab === "streams" ? rawTab : "trace";
|
|
195214
196882
|
const selectedStreamId = searchParams.get("streamId");
|
|
195215
196883
|
const initialSelectedSpanId = searchParams.get("spanId") ?? void 0;
|
|
195216
196884
|
const setActiveTab = reactExports.useCallback(
|
|
@@ -195249,8 +196917,8 @@ function RunDetailView({
|
|
|
195249
196917
|
);
|
|
195250
196918
|
const encryptionKeyRef = reactExports.useRef(null);
|
|
195251
196919
|
const handleResolveHook = reactExports.useCallback(
|
|
195252
|
-
async (
|
|
195253
|
-
await resumeHook(env2,
|
|
196920
|
+
async (hookToken2, payload) => {
|
|
196921
|
+
await resumeHook(env2, hookToken2, payload);
|
|
195254
196922
|
},
|
|
195255
196923
|
[env2]
|
|
195256
196924
|
);
|
|
@@ -195277,7 +196945,7 @@ function RunDetailView({
|
|
|
195277
196945
|
},
|
|
195278
196946
|
[env2, stateHydrator]
|
|
195279
196947
|
);
|
|
195280
|
-
serverConfig.backendId === "local" || serverConfig.backendId === "@workflow/world-local";
|
|
196948
|
+
const isLocalBackend = serverConfig.backendId === "local" || serverConfig.backendId === "@workflow/world-local";
|
|
195281
196949
|
const {
|
|
195282
196950
|
run: runData,
|
|
195283
196951
|
events: allEvents,
|
|
@@ -195352,6 +197020,23 @@ function RunDetailView({
|
|
|
195352
197020
|
hasEncryptedData
|
|
195353
197021
|
]
|
|
195354
197022
|
);
|
|
197023
|
+
const runIsLive = Boolean(run2.status) && !isTerminalWorkflowRunStatus(run2.status);
|
|
197024
|
+
const runUsageState = useRunUsage(env2, runId, { live: runIsLive });
|
|
197025
|
+
const { usage: runUsage2, error: runUsageError } = runUsageState;
|
|
197026
|
+
const showUsage = usageVisible(runUsage2, isLocalBackend);
|
|
197027
|
+
const usageContext = { runId, usage: runUsageState };
|
|
197028
|
+
const usagePage = useOutlet(usageContext);
|
|
197029
|
+
const viewRootRef = reactExports.useRef(null);
|
|
197030
|
+
const pendingRowFocus = reactExports.useRef(null);
|
|
197031
|
+
const focusRowItemAfterNavigation = reactExports.useCallback((item) => {
|
|
197032
|
+
pendingRowFocus.current = item;
|
|
197033
|
+
}, []);
|
|
197034
|
+
reactExports.useEffect(() => {
|
|
197035
|
+
const item = pendingRowFocus.current;
|
|
197036
|
+
if (item && focusRunViewItem(viewRootRef.current, item)) {
|
|
197037
|
+
pendingRowFocus.current = null;
|
|
197038
|
+
}
|
|
197039
|
+
});
|
|
195355
197040
|
const {
|
|
195356
197041
|
streams,
|
|
195357
197042
|
loading: streamsLoading,
|
|
@@ -195446,196 +197131,260 @@ function RunDetailView({
|
|
|
195446
197131
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogAction, { onClick: handleConfirmRerun, children: "Replay Run" })
|
|
195447
197132
|
] })
|
|
195448
197133
|
] }) }),
|
|
195449
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
195450
|
-
|
|
195451
|
-
|
|
195452
|
-
|
|
195453
|
-
|
|
195454
|
-
|
|
195455
|
-
|
|
195456
|
-
|
|
195457
|
-
|
|
195458
|
-
|
|
195459
|
-
|
|
195460
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
195461
|
-
|
|
195462
|
-
|
|
195463
|
-
|
|
195464
|
-
|
|
195465
|
-
|
|
195466
|
-
|
|
195467
|
-
|
|
195468
|
-
|
|
195469
|
-
|
|
195470
|
-
|
|
195471
|
-
|
|
195472
|
-
|
|
195473
|
-
|
|
195474
|
-
|
|
195475
|
-
|
|
195476
|
-
|
|
195477
|
-
|
|
195478
|
-
|
|
195479
|
-
|
|
195480
|
-
|
|
195481
|
-
|
|
195482
|
-
|
|
195483
|
-
|
|
195484
|
-
|
|
195485
|
-
|
|
195486
|
-
}
|
|
195487
|
-
) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[55px] h-[24px]" })
|
|
195488
|
-
] }),
|
|
195489
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
195490
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Duration" }),
|
|
195491
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: run2.runId ? run2.startedAt ? (() => {
|
|
195492
|
-
const ms2 = (run2.completedAt ? new Date(run2.completedAt).getTime() : Date.now()) - new Date(run2.startedAt).getTime();
|
|
195493
|
-
const seconds = Math.floor(ms2 / 1e3);
|
|
195494
|
-
if (seconds < 60) return `${seconds}s`;
|
|
195495
|
-
const minutes = Math.floor(seconds / 60);
|
|
195496
|
-
const remainingSeconds = seconds % 60;
|
|
195497
|
-
if (minutes < 60) {
|
|
195498
|
-
return remainingSeconds > 0 ? `${minutes}m ${remainingSeconds}s` : `${minutes}m`;
|
|
195499
|
-
}
|
|
195500
|
-
const hours = Math.floor(minutes / 60);
|
|
195501
|
-
const remainingMinutes = minutes % 60;
|
|
195502
|
-
return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
|
|
195503
|
-
})() : "-" : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[60px] h-[20px]" }) })
|
|
195504
|
-
] }),
|
|
195505
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
195506
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Run ID" }),
|
|
195507
|
-
run2.runId ? /* @__PURE__ */ jsxRuntimeExports.jsx(CopyableText, { text: run2.runId, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs mt-0.5 font-mono", children: run2.runId }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[280px] h-[20px]" })
|
|
195508
|
-
] }),
|
|
195509
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
195510
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Queued" }),
|
|
195511
|
-
run2.createdAt ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run2.createdAt }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[110px] h-[20px]" })
|
|
195512
|
-
] }),
|
|
195513
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
195514
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Started" }),
|
|
195515
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: run2.runId ? run2.startedAt ? /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run2.startedAt }) : "-" : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[110px] h-[20px]" }) })
|
|
195516
|
-
] }),
|
|
195517
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
195518
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Completed" }),
|
|
195519
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: run2.runId ? run2.completedAt ? /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run2.completedAt }) : "-" : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[110px] h-[20px]" }) })
|
|
195520
|
-
] }),
|
|
195521
|
-
run2.expiredAt != null && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
195522
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
195523
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-muted-foreground cursor-help flex items-center gap-1", children: [
|
|
195524
|
-
"Expired",
|
|
195525
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CircleQuestionMark, { className: "w-3 h-3" })
|
|
195526
|
-
] }) }),
|
|
195527
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "The storage data for this run has expired and is no longer available." }) })
|
|
195528
|
-
] }),
|
|
195529
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run2.expiredAt }) })
|
|
195530
|
-
] })
|
|
195531
|
-
] })
|
|
195532
|
-
] }),
|
|
195533
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(RunLimitGuidanceAlert, { run: runData })
|
|
195534
|
-
] }),
|
|
195535
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
195536
|
-
Tabs,
|
|
195537
|
-
{
|
|
195538
|
-
value: activeTab,
|
|
195539
|
-
onValueChange: (v2) => setActiveTab(v2),
|
|
195540
|
-
className: "flex-1 flex flex-col min-h-0",
|
|
195541
|
-
children: [
|
|
195542
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "mb-4 flex-none", children: [
|
|
195543
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "trace", className: "gap-2", children: [
|
|
195544
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4" }),
|
|
195545
|
-
"Trace"
|
|
195546
|
-
] }),
|
|
195547
|
-
false,
|
|
195548
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "events", className: "gap-2", children: [
|
|
195549
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4" }),
|
|
195550
|
-
"Events"
|
|
197134
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
197135
|
+
"div",
|
|
197136
|
+
{
|
|
197137
|
+
ref: viewRootRef,
|
|
197138
|
+
className: usagePage ? "flex flex-col" : "flex flex-col h-[calc(100vh-97px)]",
|
|
197139
|
+
children: [
|
|
197140
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-none space-y-4", children: [
|
|
197141
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Breadcrumb, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(BreadcrumbList, { children: [
|
|
197142
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: "/", children: "Runs" }) }) }),
|
|
197143
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbSeparator, {}),
|
|
197144
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbItem, { children: usagePage ? /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbLink, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: runPath(runId), className: "font-mono text-xs", children: runId }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbPage, { className: "font-mono text-xs", children: runId }) }),
|
|
197145
|
+
usagePage && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
197146
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbSeparator, {}),
|
|
197147
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BreadcrumbPage, { children: "Usage" }) })
|
|
197148
|
+
] })
|
|
197149
|
+
] }) }),
|
|
197150
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 p-6 border rounded-lg", children: [
|
|
197151
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-start justify-between gap-x-4 gap-y-2", children: [
|
|
197152
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-xl font-semibold", children: workflowName ? workflowName : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[260px] h-[28px]" }) }) }),
|
|
197153
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
197154
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(LiveStatus, { hasError, errorMessage }),
|
|
197155
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197156
|
+
RunActionsButtons,
|
|
197157
|
+
{
|
|
197158
|
+
env: env2,
|
|
197159
|
+
runId,
|
|
197160
|
+
runStatus: run2.status,
|
|
197161
|
+
events: allEvents,
|
|
197162
|
+
eventsLoading: loading,
|
|
197163
|
+
loading,
|
|
197164
|
+
replayDisabledReason: isDynamicRun ? "Dynamic runs cannot be replayed as a new run." : void 0,
|
|
197165
|
+
onRerunClick: handleRerunClick,
|
|
197166
|
+
onCancelClick: handleCancelClick,
|
|
197167
|
+
callbacks: { onSuccess: update }
|
|
197168
|
+
}
|
|
197169
|
+
)
|
|
197170
|
+
] })
|
|
195551
197171
|
] }),
|
|
195552
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
195553
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
195554
|
-
|
|
197172
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-start gap-x-8 gap-y-4", children: [
|
|
197173
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
197174
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Status" }),
|
|
197175
|
+
run2.status ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197176
|
+
StatusBadge,
|
|
197177
|
+
{
|
|
197178
|
+
status: run2.status,
|
|
197179
|
+
context: { error: run2.error, cancelReason }
|
|
197180
|
+
}
|
|
197181
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[55px] h-[24px]" })
|
|
197182
|
+
] }),
|
|
197183
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
197184
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Duration" }),
|
|
197185
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: run2.runId ? run2.startedAt ? (() => {
|
|
197186
|
+
const ms2 = (run2.completedAt ? new Date(run2.completedAt).getTime() : Date.now()) - new Date(run2.startedAt).getTime();
|
|
197187
|
+
const seconds = Math.floor(ms2 / 1e3);
|
|
197188
|
+
if (seconds < 60) return `${seconds}s`;
|
|
197189
|
+
const minutes = Math.floor(seconds / 60);
|
|
197190
|
+
const remainingSeconds = seconds % 60;
|
|
197191
|
+
if (minutes < 60) {
|
|
197192
|
+
return remainingSeconds > 0 ? `${minutes}m ${remainingSeconds}s` : `${minutes}m`;
|
|
197193
|
+
}
|
|
197194
|
+
const hours = Math.floor(minutes / 60);
|
|
197195
|
+
const remainingMinutes = minutes % 60;
|
|
197196
|
+
return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
|
|
197197
|
+
})() : "-" : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[60px] h-[20px]" }) })
|
|
197198
|
+
] }),
|
|
197199
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
197200
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Run ID" }),
|
|
197201
|
+
run2.runId ? /* @__PURE__ */ jsxRuntimeExports.jsx(CopyableText, { text: run2.runId, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs mt-0.5 font-mono", children: run2.runId }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[280px] h-[20px]" })
|
|
197202
|
+
] }),
|
|
197203
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
197204
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Queued" }),
|
|
197205
|
+
run2.createdAt ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run2.createdAt }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[110px] h-[20px]" })
|
|
197206
|
+
] }),
|
|
197207
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
197208
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Started" }),
|
|
197209
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: run2.runId ? run2.startedAt ? /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run2.startedAt }) : "-" : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[110px] h-[20px]" }) })
|
|
197210
|
+
] }),
|
|
197211
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
197212
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Completed" }),
|
|
197213
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: run2.runId ? run2.completedAt ? /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run2.completedAt }) : "-" : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[110px] h-[20px]" }) })
|
|
197214
|
+
] }),
|
|
197215
|
+
showUsage && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197216
|
+
RunUsageHeaderStats,
|
|
197217
|
+
{
|
|
197218
|
+
runId,
|
|
197219
|
+
usage: runUsage2 ?? void 0,
|
|
197220
|
+
error: runUsageError,
|
|
197221
|
+
isLocalBackend,
|
|
197222
|
+
onUsagePage: usagePage != null
|
|
197223
|
+
}
|
|
197224
|
+
),
|
|
197225
|
+
run2.expiredAt != null && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
197226
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
197227
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-muted-foreground cursor-help flex items-center gap-1", children: [
|
|
197228
|
+
"Expired",
|
|
197229
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CircleQuestionMark, { className: "w-3 h-3" })
|
|
197230
|
+
] }) }),
|
|
197231
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "The storage data for this run has expired and is no longer available." }) })
|
|
197232
|
+
] }),
|
|
197233
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run2.expiredAt }) })
|
|
197234
|
+
] })
|
|
195555
197235
|
] })
|
|
195556
197236
|
] }),
|
|
195557
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
195558
|
-
|
|
195559
|
-
|
|
195560
|
-
|
|
195561
|
-
|
|
195562
|
-
loading,
|
|
195563
|
-
sidebarData,
|
|
195564
|
-
onLoadMore: loadMoreTraceData,
|
|
195565
|
-
hasMore: hasMoreTraceData,
|
|
195566
|
-
isLoadingMore: isLoadingMoreTraceData,
|
|
195567
|
-
initialSelectedSpanId
|
|
195568
|
-
}
|
|
195569
|
-
) }) }) }),
|
|
195570
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "events", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$1, { title: "Failed to load events list", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative h-full -mx-6 bg-background-100 border-t border-gray-alpha-400 overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
195571
|
-
RunEventsTab,
|
|
197237
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(RunLimitGuidanceAlert, { run: runData })
|
|
197238
|
+
] }),
|
|
197239
|
+
usagePage ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4", children: [
|
|
197240
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197241
|
+
RunViewNav,
|
|
195572
197242
|
{
|
|
195573
|
-
env: env2,
|
|
195574
197243
|
runId,
|
|
195575
|
-
|
|
195576
|
-
|
|
195577
|
-
encryptionKey: encryptionKey ?? void 0,
|
|
195578
|
-
sortOrder: eventsSortOrder,
|
|
195579
|
-
onSortOrderChange: setEventsSortOrder,
|
|
195580
|
-
onDecrypt: handleDecrypt,
|
|
195581
|
-
isDecrypting,
|
|
195582
|
-
onViewInTrace: (spanId) => updateSearchParams({ tab: "trace", spanId })
|
|
197244
|
+
showUsage,
|
|
197245
|
+
onNavigate: focusRowItemAfterNavigation
|
|
195583
197246
|
}
|
|
195584
|
-
)
|
|
195585
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
195586
|
-
|
|
195587
|
-
|
|
195588
|
-
|
|
197247
|
+
),
|
|
197248
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$1, { title: "Failed to load run usage", children: usagePage })
|
|
197249
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
197250
|
+
Tabs,
|
|
197251
|
+
{
|
|
197252
|
+
value: activeTab,
|
|
197253
|
+
onValueChange: (v2) => setActiveTab(v2),
|
|
197254
|
+
className: "flex-1 flex flex-col min-h-0",
|
|
197255
|
+
children: [
|
|
197256
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: RUN_VIEW_ROW_CLASS, children: [
|
|
197257
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "h-auto border-0 bg-transparent p-0", children: [
|
|
197258
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
197259
|
+
TabsTrigger,
|
|
197260
|
+
{
|
|
197261
|
+
value: "trace",
|
|
197262
|
+
className: "gap-2",
|
|
197263
|
+
"data-run-view-item": "trace",
|
|
197264
|
+
children: [
|
|
197265
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4" }),
|
|
197266
|
+
"Trace"
|
|
197267
|
+
]
|
|
197268
|
+
}
|
|
197269
|
+
),
|
|
197270
|
+
false,
|
|
197271
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
197272
|
+
TabsTrigger,
|
|
197273
|
+
{
|
|
197274
|
+
value: "events",
|
|
197275
|
+
className: "gap-2",
|
|
197276
|
+
"data-run-view-item": "events",
|
|
197277
|
+
children: [
|
|
197278
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4" }),
|
|
197279
|
+
"Events"
|
|
197280
|
+
]
|
|
197281
|
+
}
|
|
197282
|
+
),
|
|
197283
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
197284
|
+
TabsTrigger,
|
|
197285
|
+
{
|
|
197286
|
+
value: "streams",
|
|
197287
|
+
className: "gap-2",
|
|
197288
|
+
"data-run-view-item": "streams",
|
|
197289
|
+
children: [
|
|
197290
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-4 w-4" }),
|
|
197291
|
+
"Streams"
|
|
197292
|
+
]
|
|
197293
|
+
}
|
|
197294
|
+
)
|
|
197295
|
+
] }),
|
|
197296
|
+
showUsage && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197297
|
+
UsageNavLink,
|
|
197298
|
+
{
|
|
197299
|
+
runId,
|
|
197300
|
+
onNavigate: focusRowItemAfterNavigation
|
|
197301
|
+
}
|
|
197302
|
+
)
|
|
197303
|
+
] }),
|
|
197304
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "trace", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$1, { title: "Failed to load trace viewer", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative h-full -mx-6 bg-background-100 border-t border-gray-alpha-400 overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197305
|
+
TraceViewer,
|
|
195589
197306
|
{
|
|
195590
|
-
|
|
195591
|
-
|
|
197307
|
+
run: run2,
|
|
197308
|
+
events: allEvents ?? [],
|
|
197309
|
+
loading,
|
|
197310
|
+
sidebarData,
|
|
197311
|
+
onLoadMore: loadMoreTraceData,
|
|
197312
|
+
hasMore: hasMoreTraceData,
|
|
197313
|
+
isLoadingMore: isLoadingMoreTraceData,
|
|
197314
|
+
initialSelectedSpanId
|
|
195592
197315
|
}
|
|
195593
|
-
),
|
|
195594
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("
|
|
195595
|
-
|
|
195596
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center pl-4 pr-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-3.5 w-32" }) }),
|
|
195597
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center pl-4 pr-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-3.5 w-20" }) })
|
|
195598
|
-
] }) : streamsError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4 py-2 text-label-12 text-red-900", children: streamsError.message }) : streams.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center px-4 text-label-12 text-gray-900", children: "No streams found for this run" }) : streams.map((streamId) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
195599
|
-
"button",
|
|
195600
|
-
{
|
|
195601
|
-
type: "button",
|
|
195602
|
-
onClick: () => setSelectedStreamId(streamId),
|
|
195603
|
-
className: `flex h-10 min-h-10 w-full min-w-0 items-center truncate pl-4 pr-2 text-left text-label-14 transition-colors ${selectedStreamId === streamId ? "bg-gray-100 text-gray-1000 hover:bg-gray-200 active:bg-gray-200" : "bg-transparent text-gray-900 hover:bg-gray-100 hover:text-gray-1000 focus-visible:bg-gray-100 focus-visible:text-gray-1000"}`,
|
|
195604
|
-
title: streamId,
|
|
195605
|
-
children: streamId
|
|
195606
|
-
},
|
|
195607
|
-
streamId
|
|
195608
|
-
)) })
|
|
195609
|
-
] }),
|
|
195610
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-w-0 flex-1 flex-col overflow-hidden bg-background-100", children: streamsLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(StreamViewerSkeleton, {}) }) : selectedStreamId ? (streamError == null ? void 0 : streamError.includes("encrypted")) && !encryptionKey ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
195611
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Lock, { className: "h-8 w-8 text-gray-700" }),
|
|
195612
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
|
|
195613
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-label-14 font-medium text-gray-1000", children: "Encrypted Stream" }),
|
|
195614
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-label-12 text-gray-900", children: "Decrypt this stream to view its chunks." })
|
|
195615
|
-
] }),
|
|
195616
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
195617
|
-
DecryptButton,
|
|
197316
|
+
) }) }) }),
|
|
197317
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "events", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$1, { title: "Failed to load events list", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative h-full -mx-6 bg-background-100 border-t border-gray-alpha-400 overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197318
|
+
RunEventsTab,
|
|
195618
197319
|
{
|
|
195619
|
-
|
|
195620
|
-
|
|
197320
|
+
env: env2,
|
|
197321
|
+
runId,
|
|
197322
|
+
run: run2,
|
|
197323
|
+
onLoadEventData: handleLoadEventData,
|
|
197324
|
+
encryptionKey: encryptionKey ?? void 0,
|
|
197325
|
+
sortOrder: eventsSortOrder,
|
|
197326
|
+
onSortOrderChange: setEventsSortOrder,
|
|
197327
|
+
onDecrypt: handleDecrypt,
|
|
197328
|
+
isDecrypting,
|
|
197329
|
+
onViewInTrace: (spanId) => updateSearchParams({ tab: "trace", spanId })
|
|
195621
197330
|
}
|
|
195622
|
-
)
|
|
195623
|
-
|
|
195624
|
-
|
|
195625
|
-
|
|
195626
|
-
|
|
195627
|
-
|
|
195628
|
-
|
|
195629
|
-
|
|
195630
|
-
|
|
195631
|
-
|
|
195632
|
-
|
|
195633
|
-
|
|
195634
|
-
|
|
195635
|
-
|
|
195636
|
-
|
|
195637
|
-
|
|
195638
|
-
|
|
197331
|
+
) }) }) }),
|
|
197332
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "streams", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$1, { title: "Failed to load stream data", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative -mx-6 flex h-full min-h-0 overflow-hidden border-t border-gray-alpha-400 bg-background-100", children: [
|
|
197333
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-[340px] shrink-0 flex-col border-r border-gray-alpha-400 bg-background-100", children: [
|
|
197334
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197335
|
+
"div",
|
|
197336
|
+
{
|
|
197337
|
+
"aria-hidden": "true",
|
|
197338
|
+
className: "h-10 min-h-10 border-b border-gray-alpha-400"
|
|
197339
|
+
}
|
|
197340
|
+
),
|
|
197341
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-h-0 flex-1 divide-y divide-gray-400 overflow-y-auto", children: streamsLoading ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col divide-y divide-gray-400", children: [
|
|
197342
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center pl-4 pr-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-3.5 w-24" }) }),
|
|
197343
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center pl-4 pr-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-3.5 w-32" }) }),
|
|
197344
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center pl-4 pr-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-3.5 w-20" }) })
|
|
197345
|
+
] }) : streamsError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4 py-2 text-label-12 text-red-900", children: streamsError.message }) : streams.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-10 min-h-10 items-center px-4 text-label-12 text-gray-900", children: "No streams found for this run" }) : streams.map((streamId) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197346
|
+
"button",
|
|
197347
|
+
{
|
|
197348
|
+
type: "button",
|
|
197349
|
+
onClick: () => setSelectedStreamId(streamId),
|
|
197350
|
+
className: `flex h-10 min-h-10 w-full min-w-0 items-center truncate pl-4 pr-2 text-left text-label-14 transition-colors ${selectedStreamId === streamId ? "bg-gray-100 text-gray-1000 hover:bg-gray-200 active:bg-gray-200" : "bg-transparent text-gray-900 hover:bg-gray-100 hover:text-gray-1000 focus-visible:bg-gray-100 focus-visible:text-gray-1000"}`,
|
|
197351
|
+
title: streamId,
|
|
197352
|
+
children: streamId
|
|
197353
|
+
},
|
|
197354
|
+
streamId
|
|
197355
|
+
)) })
|
|
197356
|
+
] }),
|
|
197357
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-w-0 flex-1 flex-col overflow-hidden bg-background-100", children: streamsLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(StreamViewerSkeleton, {}) }) : selectedStreamId ? (streamError == null ? void 0 : streamError.includes("encrypted")) && !encryptionKey ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
197358
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Lock, { className: "h-8 w-8 text-gray-700" }),
|
|
197359
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
|
|
197360
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-label-14 font-medium text-gray-1000", children: "Encrypted Stream" }),
|
|
197361
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-label-12 text-gray-900", children: "Decrypt this stream to view its chunks." })
|
|
197362
|
+
] }),
|
|
197363
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197364
|
+
DecryptButton,
|
|
197365
|
+
{
|
|
197366
|
+
onClick: handleDecrypt,
|
|
197367
|
+
loading: isDecrypting
|
|
197368
|
+
}
|
|
197369
|
+
)
|
|
197370
|
+
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197371
|
+
StreamViewer,
|
|
197372
|
+
{
|
|
197373
|
+
streamId: selectedStreamId,
|
|
197374
|
+
chunks: streamChunks,
|
|
197375
|
+
isLive: streamIsLive,
|
|
197376
|
+
isLoading: streamIsInitialLoading,
|
|
197377
|
+
error: (streamError == null ? void 0 : streamError.includes("encrypted")) ? null : streamError
|
|
197378
|
+
}
|
|
197379
|
+
) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-label-14 text-gray-600", children: streams.length > 0 ? "Select a stream to view its data" : "No streams available" }) }) })
|
|
197380
|
+
] }) }) }),
|
|
197381
|
+
false
|
|
197382
|
+
]
|
|
197383
|
+
}
|
|
197384
|
+
) })
|
|
197385
|
+
]
|
|
197386
|
+
}
|
|
197387
|
+
)
|
|
195639
197388
|
] });
|
|
195640
197389
|
}
|
|
195641
197390
|
const runDetail = withComponentProps(function RunDetailPage() {
|
|
@@ -195658,9 +197407,38 @@ const route2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
195658
197407
|
__proto__: null,
|
|
195659
197408
|
default: runDetail
|
|
195660
197409
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
197410
|
+
function meta({
|
|
197411
|
+
params
|
|
197412
|
+
}) {
|
|
197413
|
+
return [{
|
|
197414
|
+
title: `Usage · ${params.runId ?? "Run"} · ${DEFAULT_TITLE}`
|
|
197415
|
+
}, {
|
|
197416
|
+
name: "description",
|
|
197417
|
+
content: DEFAULT_META_DESCRIPTION
|
|
197418
|
+
}];
|
|
197419
|
+
}
|
|
197420
|
+
const runUsage = withComponentProps(function RunUsageRoute() {
|
|
197421
|
+
const {
|
|
197422
|
+
runId,
|
|
197423
|
+
usage
|
|
197424
|
+
} = useOutletContext();
|
|
197425
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(RunUsagePage, {
|
|
197426
|
+
runId,
|
|
197427
|
+
usage: usage.usage,
|
|
197428
|
+
error: usage.error,
|
|
197429
|
+
onRetry: usage.refresh,
|
|
197430
|
+
retrying: usage.loading
|
|
197431
|
+
});
|
|
197432
|
+
});
|
|
197433
|
+
const route3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
197434
|
+
__proto__: null,
|
|
197435
|
+
default: runUsage,
|
|
197436
|
+
meta
|
|
197437
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
195661
197438
|
const handlers = {
|
|
195662
197439
|
fetchRuns: (p2) => fetchRuns(p2.worldEnv ?? {}, p2.params ?? {}),
|
|
195663
197440
|
fetchRun: (p2) => fetchRun(p2.worldEnv ?? {}, p2.runId, p2.resolveData),
|
|
197441
|
+
fetchRunUsage: (p2) => fetchRunUsage(p2.worldEnv ?? {}, p2.runId),
|
|
195664
197442
|
fetchStep: (p2) => fetchStep(p2.worldEnv ?? {}, p2.runId, p2.stepId, p2.resolveData),
|
|
195665
197443
|
fetchEvents: (p2) => fetchEvents(p2.worldEnv ?? {}, p2.runId, p2.params ?? {}),
|
|
195666
197444
|
fetchEvent: (p2) => fetchEvent(p2.worldEnv ?? {}, p2.runId, p2.eventId, p2.resolveData),
|
|
@@ -195752,7 +197530,7 @@ async function loader$1({
|
|
|
195752
197530
|
status: 405
|
|
195753
197531
|
});
|
|
195754
197532
|
}
|
|
195755
|
-
const
|
|
197533
|
+
const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
195756
197534
|
__proto__: null,
|
|
195757
197535
|
action,
|
|
195758
197536
|
loader: loader$1
|
|
@@ -195810,11 +197588,11 @@ async function loader({
|
|
|
195810
197588
|
});
|
|
195811
197589
|
}
|
|
195812
197590
|
}
|
|
195813
|
-
const
|
|
197591
|
+
const route5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
195814
197592
|
__proto__: null,
|
|
195815
197593
|
loader
|
|
195816
197594
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
195817
|
-
const serverManifest = { "entry": { "module": "/assets/entry.client-
|
|
197595
|
+
const serverManifest = { "entry": { "module": "/assets/entry.client-xzxVCL3o.js", "imports": ["/assets/index-wl5l5E8H.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-C1XwTNUK.js", "imports": ["/assets/index-wl5l5E8H.js", "/assets/mermaid-WFAXDIZX-CB__BxYb.js", "/assets/rpc-client-SbyXJdFV.js", "/assets/arrow-up-right-DyaB_ak4.js", "/assets/meta-9cjJ0pVb.js"], "css": ["/assets/root-C3ED6Dwc.css", "/assets/mermaid-WFAXDIZX-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home--wf0CrF6.js", "imports": ["/assets/index-wl5l5E8H.js", "/assets/url-state-JAVaNZ_m.js", "/assets/mermaid-WFAXDIZX-CB__BxYb.js", "/assets/rpc-client-SbyXJdFV.js", "/assets/skeleton-DMLgjvZZ.js"], "css": ["/assets/url-state-C9ccOmbh.css", "/assets/mermaid-WFAXDIZX-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-2CnpdXm1.js", "imports": ["/assets/index-wl5l5E8H.js", "/assets/url-state-JAVaNZ_m.js", "/assets/mermaid-WFAXDIZX-CB__BxYb.js", "/assets/skeleton-DMLgjvZZ.js", "/assets/run-usage-DRV6lopZ.js", "/assets/arrow-up-right-DyaB_ak4.js", "/assets/rpc-client-SbyXJdFV.js"], "css": ["/assets/run-detail-CWoGxu_0.css", "/assets/url-state-C9ccOmbh.css", "/assets/mermaid-WFAXDIZX-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-usage": { "id": "routes/run-usage", "parentId": "routes/run-detail", "path": "usage", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-usage-C3aywyqa.js", "imports": ["/assets/index-wl5l5E8H.js", "/assets/run-usage-DRV6lopZ.js", "/assets/meta-9cjJ0pVb.js", "/assets/mermaid-WFAXDIZX-CB__BxYb.js", "/assets/skeleton-DMLgjvZZ.js", "/assets/arrow-up-right-DyaB_ak4.js"], "css": ["/assets/mermaid-WFAXDIZX-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-7b81d8d4.js", "version": "7b81d8d4", "sri": void 0 };
|
|
195818
197596
|
const assetsBuildDirectory = "build/client";
|
|
195819
197597
|
const basename = "/";
|
|
195820
197598
|
const future = { "unstable_optimizeDeps": false, "v8_passThroughRequests": false, "v8_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
|
|
@@ -195849,13 +197627,21 @@ const routes = {
|
|
|
195849
197627
|
caseSensitive: void 0,
|
|
195850
197628
|
module: route2
|
|
195851
197629
|
},
|
|
197630
|
+
"routes/run-usage": {
|
|
197631
|
+
id: "routes/run-usage",
|
|
197632
|
+
parentId: "routes/run-detail",
|
|
197633
|
+
path: "usage",
|
|
197634
|
+
index: void 0,
|
|
197635
|
+
caseSensitive: void 0,
|
|
197636
|
+
module: route3
|
|
197637
|
+
},
|
|
195852
197638
|
"routes/api.rpc": {
|
|
195853
197639
|
id: "routes/api.rpc",
|
|
195854
197640
|
parentId: "root",
|
|
195855
197641
|
path: "api/rpc",
|
|
195856
197642
|
index: void 0,
|
|
195857
197643
|
caseSensitive: void 0,
|
|
195858
|
-
module:
|
|
197644
|
+
module: route4
|
|
195859
197645
|
},
|
|
195860
197646
|
"routes/api.stream.$streamId": {
|
|
195861
197647
|
id: "routes/api.stream.$streamId",
|
|
@@ -195863,7 +197649,7 @@ const routes = {
|
|
|
195863
197649
|
path: "api/stream/:streamId",
|
|
195864
197650
|
index: void 0,
|
|
195865
197651
|
caseSensitive: void 0,
|
|
195866
|
-
module:
|
|
197652
|
+
module: route5
|
|
195867
197653
|
}
|
|
195868
197654
|
};
|
|
195869
197655
|
const allowedActionOrigins = false;
|