@workflow/web 5.0.0-beta.31 → 5.0.0-beta.32

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.
@@ -9180,7 +9180,7 @@ const app = express();
9180
9180
  app.all(
9181
9181
  "/{*splat}",
9182
9182
  createRequestHandler({
9183
- build: () => import("./server-build-CQLvkWL5.js").then((n) => n.aB)
9183
+ build: () => import("./server-build-GYVyEwoy.js").then((n) => n.aB)
9184
9184
  })
9185
9185
  );
9186
9186
  app.use(
@@ -2,8 +2,8 @@ import { createRequire as __wkfCreateRequire } from "node:module";
2
2
  if (typeof require === "undefined") {
3
3
  globalThis.require = __wkfCreateRequire(import.meta.url);
4
4
  }
5
- import { au as R, av as Ks, aw as jsxRuntimeExports, ax as Qe } from "./server-build-CQLvkWL5.js";
6
- import { r as reactExports } from "./app-BgN_e9S7.js";
5
+ import { au as R, av as Ks, aw as jsxRuntimeExports, ax as Qe } from "./server-build-GYVyEwoy.js";
6
+ import { r as reactExports } from "./app-TShfJF1A.js";
7
7
  import "node:stream";
8
8
  import "util";
9
9
  import "crypto";
@@ -2,9 +2,9 @@ import { createRequire as __wkfCreateRequire } from "node:module";
2
2
  if (typeof require === "undefined") {
3
3
  globalThis.require = __wkfCreateRequire(import.meta.url);
4
4
  }
5
- import { H as HookSchema } from "./server-build-CQLvkWL5.js";
6
- import { A, a, b, c, d, e, f, g, h, i, j, B, C, D, k, E, l, m, n, o, p, q, r, L, M, P, Q, s, R, t, S, u, v, w, x, y, z, F, G, I, T, J, K, O, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as, at } from "./server-build-CQLvkWL5.js";
7
- import "./app-BgN_e9S7.js";
5
+ import { H as HookSchema } from "./server-build-GYVyEwoy.js";
6
+ import { A, a, b, c, d, e, f, g, h, i, j, B, C, D, k, E, l, m, n, o, p, q, r, L, M, P, Q, s, R, t, S, u, v, w, x, y, z, F, G, I, T, J, K, O, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as, at } from "./server-build-GYVyEwoy.js";
7
+ import "./app-TShfJF1A.js";
8
8
  import "stream";
9
9
  import "express";
10
10
  import "node:stream";
@@ -2,8 +2,8 @@ import { createRequire as __wkfCreateRequire } from "node:module";
2
2
  if (typeof require === "undefined") {
3
3
  globalThis.require = __wkfCreateRequire(import.meta.url);
4
4
  }
5
- import { N as Nt } from "./server-build-CQLvkWL5.js";
6
- import "./app-BgN_e9S7.js";
5
+ import { N as Nt } from "./server-build-GYVyEwoy.js";
6
+ import "./app-TShfJF1A.js";
7
7
  import "stream";
8
8
  import "express";
9
9
  import "node:stream";
@@ -18,7 +18,7 @@ import { createRequire as __wkfCreateRequire } from "node:module";
18
18
  if (typeof require === "undefined") {
19
19
  globalThis.require = __wkfCreateRequire(import.meta.url);
20
20
  }
21
- import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, d as withErrorBoundaryProps, M as Meta, L as Links, e as ScrollRestoration, f as Scripts, O as Outlet, u as useNavigate, h as useSearchParams, i as Link$1, j as useRouteError, k as isRouteErrorResponse, l as useLocation, m as useParams } from "./app-BgN_e9S7.js";
21
+ import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, d as withErrorBoundaryProps, M as Meta, L as Links, e as ScrollRestoration, f as Scripts, O as Outlet, u as useNavigate, h as useSearchParams, i as Link$1, j as useRouteError, k as isRouteErrorResponse, l as useLocation, m as useParams } from "./app-TShfJF1A.js";
22
22
  import require$$0$4, { PassThrough } from "node:stream";
23
23
  import require$$0 from "util";
24
24
  import require$$1 from "crypto";
@@ -50143,7 +50143,7 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
50143
50143
  }
50144
50144
  async function hydrateResourceIOAsync(resource, key) {
50145
50145
  const { hydrateDataWithKey: hydrateDataWithKey2 } = await Promise.resolve().then(() => serializationFormat);
50146
- const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-vLGtEQW6.js");
50146
+ const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-DmzLFSRd.js");
50147
50147
  ensureZstdDecoderRegistered();
50148
50148
  const cryptoKey = key ? await Promise.resolve().then(() => encryption).then(({ importKey: importKey2 }) => importKey2(key)) : void 0;
50149
50149
  const revivers = getRevivers();
@@ -83108,7 +83108,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
83108
83108
  var et = ({ className: e, language: t, style: o, isIncomplete: n, ...s2 }) => jsxRuntimeExports.jsx("div", { className: f("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2", e), "data-incomplete": n || void 0, "data-language": t, "data-streamdown": "code-block", style: { contentVisibility: "auto", containIntrinsicSize: "auto 200px", ...o }, ...s2 });
83109
83109
  var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
83110
83110
  var ot = ({ language: e }) => jsxRuntimeExports.jsx("div", { className: "flex h-8 items-center text-muted-foreground text-xs", "data-language": e, "data-streamdown": "code-block-header", children: jsxRuntimeExports.jsx("span", { className: "ml-1 font-mono lowercase", children: e }) });
83111
- var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-CsR2wqX2.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
83111
+ var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-Cn3Ldhfl.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
83112
83112
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
83113
83113
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
83114
83114
  return jsxRuntimeExports.jsx(Se.Provider, { value: { code: e }, children: jsxRuntimeExports.jsxs(et, { isIncomplete: s2, language: t, children: [jsxRuntimeExports.jsx(ot, { language: t }), n ? jsxRuntimeExports.jsx("div", { className: "pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end", children: jsxRuntimeExports.jsx("div", { className: "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: n }) }) : null, jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: jsxRuntimeExports.jsx(Qe, { className: o, language: t, result: c, ...r2 }), children: jsxRuntimeExports.jsx(dn, { className: o, code: i, language: t, raw: c, ...r2 }) })] }) });
@@ -83430,7 +83430,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
83430
83430
  }, []), jsxRuntimeExports.jsxs("div", { className: "relative", ref: i, children: [jsxRuntimeExports.jsx("button", { className: f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", t), disabled: c, onClick: () => r2(!s2), title: "Download table", type: "button", children: e != null ? e : jsxRuntimeExports.jsx(Z, { size: 14 }) }), s2 ? jsxRuntimeExports.jsxs("div", { className: "absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg", children: [jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("csv"), title: "Download table as CSV", type: "button", children: "CSV" }), jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("markdown"), title: "Download table as Markdown", type: "button", children: "Markdown" })] }) : null] });
83431
83431
  };
83432
83432
  var Vt = ({ children: e, className: t, showControls: o, ...n }) => jsxRuntimeExports.jsxs("div", { className: "my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2", "data-streamdown": "table-wrapper", children: [o ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-1", children: [jsxRuntimeExports.jsx(Ht, {}), jsxRuntimeExports.jsx(Dt, {})] }) : null, jsxRuntimeExports.jsx("div", { className: "border-collapse overflow-x-auto overscroll-y-auto rounded-md border border-border bg-background", children: jsxRuntimeExports.jsx("table", { className: f("w-full divide-y divide-border", t), "data-streamdown": "table", ...n, children: e }) })] });
83433
- var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-B-ddv9lk.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
83433
+ var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-Conbg-cC.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
83434
83434
  function ke(e, t) {
83435
83435
  if (!(e != null && e.position || t != null && t.position)) return true;
83436
83436
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -91965,7 +91965,7 @@ const encryption = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
91965
91965
  encrypt: encrypt$1,
91966
91966
  importKey
91967
91967
  }, Symbol.toStringTag, { value: "Module" }));
91968
- const version$1 = "5.0.0-beta.31";
91968
+ const version$1 = "5.0.0-beta.32";
91969
91969
  function assertWorldSupportsRuntimeProtocol(world) {
91970
91970
  if (world.specVersion === SPEC_VERSION_CURRENT) {
91971
91971
  return;
@@ -93635,6 +93635,21 @@ const STREAM_FLUSH_INTERVAL_MS = 10;
93635
93635
  const getStreamFlushIntervalMs = () => envNumber("WORKFLOW_STREAM_FLUSH_INTERVAL_MS", STREAM_FLUSH_INTERVAL_MS, {
93636
93636
  integer: true
93637
93637
  });
93638
+ function recordStreamWriteFlush(startEpochMs, dispatchEpochMs, runId, name2, chunkCount, byteCount) {
93639
+ void (async () => {
93640
+ await recordElapsedSpan("workflow.stream.flush", startEpochMs, {
93641
+ kind: await getSpanKind$2("CLIENT"),
93642
+ attributes: {
93643
+ "workflow.run.id": runId,
93644
+ "workflow.stream.name": name2,
93645
+ "workflow.stream.operation": "flush",
93646
+ "workflow.stream.flush.buffer_dwell_ms": dispatchEpochMs - startEpochMs,
93647
+ "workflow.stream.flush.chunks": chunkCount,
93648
+ "workflow.stream.flush.bytes": byteCount
93649
+ }
93650
+ });
93651
+ })();
93652
+ }
93638
93653
  class WorkflowServerWritableStream extends WritableStream {
93639
93654
  /**
93640
93655
  * @param runReadyBarrier Turbo mode only: a promise that resolves once the
@@ -93667,6 +93682,7 @@ class WorkflowServerWritableStream extends WritableStream {
93667
93682
  let flushTimer = null;
93668
93683
  let flushPromise = null;
93669
93684
  let resolvedFlushIntervalMs;
93685
+ let batchStartAt;
93670
93686
  const flush = async () => {
93671
93687
  if (flushTimer) {
93672
93688
  clearTimeout(flushTimer);
@@ -93676,16 +93692,29 @@ class WorkflowServerWritableStream extends WritableStream {
93676
93692
  return;
93677
93693
  await ensureRunReady();
93678
93694
  const chunksToFlush = buffer2.slice();
93695
+ const batchStart = batchStartAt;
93696
+ batchStartAt = void 0;
93697
+ const dispatchAt = Date.now();
93679
93698
  const world = await worldPromise;
93680
93699
  if (resolvedFlushIntervalMs === void 0) {
93681
93700
  resolvedFlushIntervalMs = world.streamFlushIntervalMs ?? getStreamFlushIntervalMs();
93682
93701
  }
93683
- if (typeof world.streams.writeMulti === "function" && chunksToFlush.length > 1) {
93684
- await world.streams.writeMulti(runId, name2, chunksToFlush);
93685
- } else {
93686
- for (const chunk of chunksToFlush) {
93687
- await world.streams.write(runId, name2, chunk);
93702
+ try {
93703
+ if (typeof world.streams.writeMulti === "function" && chunksToFlush.length > 1) {
93704
+ await world.streams.writeMulti(runId, name2, chunksToFlush);
93705
+ } else {
93706
+ for (const chunk of chunksToFlush) {
93707
+ await world.streams.write(runId, name2, chunk);
93708
+ }
93709
+ }
93710
+ } catch (error2) {
93711
+ if (batchStart !== void 0) {
93712
+ batchStartAt = batchStartAt === void 0 ? batchStart : Math.min(batchStartAt, batchStart);
93688
93713
  }
93714
+ throw error2;
93715
+ }
93716
+ if (batchStart !== void 0) {
93717
+ recordStreamWriteFlush(batchStart, dispatchAt, runId, name2, chunksToFlush.length, chunksToFlush.reduce((sum, c) => sum + c.byteLength, 0));
93689
93718
  }
93690
93719
  buffer2 = [];
93691
93720
  };
@@ -93708,6 +93737,8 @@ class WorkflowServerWritableStream extends WritableStream {
93708
93737
  };
93709
93738
  super({
93710
93739
  async write(chunk) {
93740
+ if (batchStartAt === void 0)
93741
+ batchStartAt = Date.now();
93711
93742
  if (flushPromise) {
93712
93743
  await flushPromise;
93713
93744
  flushPromise = null;
@@ -127038,7 +127069,7 @@ function createWorld$1(args) {
127038
127069
  const basedir = mergedConfig.dataDir;
127039
127070
  const hooksDir = path$3.join(basedir, "hooks");
127040
127071
  const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
127041
- const { HookSchema: HookSchema2 } = await import("./index-BbpsBsGO.js");
127072
+ const { HookSchema: HookSchema2 } = await import("./index-BuK37-uW.js");
127042
127073
  await Promise.all(taggedHookFiles.map(async (hookFile) => {
127043
127074
  const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
127044
127075
  if (hook == null ? void 0 : hook.token) {
@@ -127221,8 +127252,8 @@ function requireGetVercelOidcToken() {
127221
127252
  }
127222
127253
  try {
127223
127254
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
127224
- await import("./token-util-C03rrkmJ.js").then((n) => n.t),
127225
- await import("./token-Batv2rdg.js").then((n) => n.t)
127255
+ await import("./token-util-B_XNC39V.js").then((n) => n.t),
127256
+ await import("./token-B0_1Gw9R.js").then((n) => n.t)
127226
127257
  ]);
127227
127258
  if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
127228
127259
  await refreshToken(options);
@@ -127849,7 +127880,12 @@ function getDefaultStreamDispatcher() {
127849
127880
  let otelApiPromise$1 = null;
127850
127881
  async function getOtelApi$1() {
127851
127882
  if (!otelApiPromise$1) {
127852
- otelApiPromise$1 = import("./index-Dq5jTBN4.js").catch(() => null);
127883
+ otelApiPromise$1 = import("./index-Dq5jTBN4.js").catch((error2) => {
127884
+ if (typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*")) {
127885
+ console.warn("[workflow] @opentelemetry/api unavailable — world-vercel spans disabled:", error2 instanceof Error ? error2.message : error2);
127886
+ }
127887
+ return null;
127888
+ });
127853
127889
  }
127854
127890
  return otelApiPromise$1;
127855
127891
  }
@@ -128070,7 +128106,7 @@ async function instrumentedFetch(opts) {
128070
128106
  return response2;
128071
128107
  });
128072
128108
  }
128073
- const version = "5.0.0-beta.27";
128109
+ const version = "5.0.0-beta.28";
128074
128110
  const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
128075
128111
  const MAX_BODY_PARSE_RETRIES = 2;
128076
128112
  const BODY_PARSE_RETRY_BASE_MS = 100;
@@ -2,8 +2,8 @@ import { createRequire as __wkfCreateRequire } from "node:module";
2
2
  if (typeof require === "undefined") {
3
3
  globalThis.require = __wkfCreateRequire(import.meta.url);
4
4
  }
5
- import { g as getDefaultExportFromCjs } from "./app-BgN_e9S7.js";
6
- import { aA as requireTokenError, az as requireTokenUtil } from "./server-build-CQLvkWL5.js";
5
+ import { g as getDefaultExportFromCjs } from "./app-TShfJF1A.js";
6
+ import { aA as requireTokenError, az as requireTokenUtil } from "./server-build-GYVyEwoy.js";
7
7
  function _mergeNamespaces(n, m) {
8
8
  for (var i = 0; i < m.length; i++) {
9
9
  const e = m[i];
@@ -2,8 +2,8 @@ import { createRequire as __wkfCreateRequire } from "node:module";
2
2
  if (typeof require === "undefined") {
3
3
  globalThis.require = __wkfCreateRequire(import.meta.url);
4
4
  }
5
- import { g as getDefaultExportFromCjs } from "./app-BgN_e9S7.js";
6
- import { az as requireTokenUtil } from "./server-build-CQLvkWL5.js";
5
+ import { g as getDefaultExportFromCjs } from "./app-TShfJF1A.js";
6
+ import { az as requireTokenUtil } from "./server-build-GYVyEwoy.js";
7
7
  function _mergeNamespaces(n, m) {
8
8
  for (var i = 0; i < m.length; i++) {
9
9
  const e = m[i];
@@ -2,8 +2,8 @@ import { createRequire as __wkfCreateRequire } from "node:module";
2
2
  if (typeof require === "undefined") {
3
3
  globalThis.require = __wkfCreateRequire(import.meta.url);
4
4
  }
5
- import { ay as registerZstdDecoder } from "./server-build-CQLvkWL5.js";
6
- import "./app-BgN_e9S7.js";
5
+ import { ay as registerZstdDecoder } from "./server-build-GYVyEwoy.js";
6
+ import "./app-TShfJF1A.js";
7
7
  import "stream";
8
8
  import "express";
9
9
  import "node:stream";
@@ -2,7 +2,7 @@ import { createRequire as __wkfCreateRequire } from "node:module";
2
2
  if (typeof require === "undefined") {
3
3
  globalThis.require = __wkfCreateRequire(import.meta.url);
4
4
  }
5
- import { n } from "./assets/app-BgN_e9S7.js";
5
+ import { n } from "./assets/app-TShfJF1A.js";
6
6
  import "express";
7
7
  import "stream";
8
8
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@workflow/web",
3
3
  "description": "Workflow Observability UI",
4
- "version": "5.0.0-beta.31",
4
+ "version": "5.0.0-beta.32",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "files": [
@@ -74,12 +74,12 @@
74
74
  "typescript": "^6.0.3",
75
75
  "vite": "^6",
76
76
  "vitest": "^3",
77
- "@workflow/core": "5.0.0-beta.31",
77
+ "@workflow/core": "5.0.0-beta.32",
78
78
  "@workflow/errors": "5.0.0-beta.10",
79
79
  "@workflow/utils": "5.0.0-beta.6",
80
- "@workflow/web-shared": "5.0.0-beta.31",
80
+ "@workflow/web-shared": "5.0.0-beta.32",
81
81
  "@workflow/world": "5.0.0-beta.19",
82
- "@workflow/world-vercel": "5.0.0-beta.27"
82
+ "@workflow/world-vercel": "5.0.0-beta.28"
83
83
  },
84
84
  "scripts": {
85
85
  "dev": "react-router dev",