@workflow/web 5.0.0-beta.36 → 5.0.0-beta.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/build/client/assets/{arrow-up-right-Dv3gGqIf.js → arrow-up-right-DDNPFYmg.js} +1 -1
  2. package/build/client/assets/{entry.client-Q4eUIqMI.js → entry.client-LwI3HNYl.js} +1 -1
  3. package/build/client/assets/{highlighted-body-B3W2YXNL-C5gyMelW.js → highlighted-body-B3W2YXNL-CRgNr0YA.js} +2 -2
  4. package/build/client/assets/{home-0OfTSXd1.js → home-BqvW8ODs.js} +6 -7
  5. package/build/client/assets/{index-Q81MFBxC.js → index-PFjW8YjQ.js} +20 -20
  6. package/build/client/assets/manifest-7f03c136.js +1 -0
  7. package/build/client/assets/{mermaid-3ZIDBTTL-C_EWPx9a.js → mermaid-3ZIDBTTL-CMP9Tato.js} +886 -170
  8. package/build/client/assets/{root-BPK1T9Ck.js → root-2ub-CsWS.js} +11 -30
  9. package/build/client/assets/{run-detail-CrqNzQ_y.js → run-detail-B1PK-m7y.js} +21 -19
  10. package/build/client/assets/{workflow-graph-viewer-DrfqsDRu.js → workflow-graph-viewer-DOLwtzSv.js} +2 -3
  11. package/build/client/assets/{zstd-browser-decoder-Ds2MNSdp.js → zstd-browser-decoder-BAY5XtBl.js} +2 -2
  12. package/build/server/assets/{app-BSsmG188.js → app-BaJoK9ck.js} +1 -1
  13. package/build/server/assets/{highlighted-body-B3W2YXNL-C7tx66m_.js → highlighted-body-B3W2YXNL-DE3KXslx.js} +2 -2
  14. package/build/server/assets/{index-Cnj8rNtV.js → index-M4Ai7vsa.js} +48 -49
  15. package/build/server/assets/{mermaid-3ZIDBTTL-DStR4R-M.js → mermaid-3ZIDBTTL-DjL45D7x.js} +2 -2
  16. package/build/server/assets/{server-build-4Pq8AwvA.js → server-build-C11Xqmwk.js} +1964 -1368
  17. package/build/server/assets/{token-CYc8-6E0.js → token-Ulh8Tdgw.js} +2 -2
  18. package/build/server/assets/{token-util-D94FNaX0.js → token-util-CiVcDWD3.js} +2 -2
  19. package/build/server/assets/{zstd-browser-decoder-DXnLXD-w.js → zstd-browser-decoder-tQARkzJ5.js} +2 -2
  20. package/build/server/index.js +1 -1
  21. package/package.json +8 -8
  22. package/build/client/assets/encryption-CLVP4klT.js +0 -51
  23. package/build/client/assets/index-STTN0-2V.js +0 -306
  24. package/build/client/assets/manifest-485c4078.js +0 -1
@@ -1,9 +1,9 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/encryption-CLVP4klT.js","assets/index-STTN0-2V.js","assets/index-Q81MFBxC.js","assets/zstd-browser-decoder-Ds2MNSdp.js","assets/highlighted-body-B3W2YXNL-C5gyMelW.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/zstd-browser-decoder-BAY5XtBl.js","assets/index-PFjW8YjQ.js","assets/highlighted-body-B3W2YXNL-CRgNr0YA.js"])))=>i.map(i=>d[i]);
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  var _a2, _b;
6
- import { r as reactExports, j as jsxRuntimeExports, p as reactDomExports, I as React, G as ReactDOM, R as ReactExports, g as getDefaultExportFromCjs } from "./index-Q81MFBxC.js";
6
+ import { r as reactExports, j as jsxRuntimeExports, o as reactDomExports, H as React, D as ReactDOM, R as ReactExports, I as getDefaultExportFromCjs } from "./index-PFjW8YjQ.js";
7
7
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
8
8
  return function handleEvent(event) {
9
9
  originalEventHandler == null ? void 0 : originalEventHandler(event);
@@ -2164,7 +2164,7 @@ function useFloating(options) {
2164
2164
  } = {},
2165
2165
  transform: transform2 = true,
2166
2166
  whileElementsMounted,
2167
- open
2167
+ open: open2
2168
2168
  } = options;
2169
2169
  const [data, setData] = reactExports.useState({
2170
2170
  x: 0,
@@ -2200,7 +2200,7 @@ function useFloating(options) {
2200
2200
  const hasWhileElementsMounted = whileElementsMounted != null;
2201
2201
  const whileElementsMountedRef = useLatestRef(whileElementsMounted);
2202
2202
  const platformRef = useLatestRef(platform2);
2203
- const openRef = useLatestRef(open);
2203
+ const openRef = useLatestRef(open2);
2204
2204
  const update = reactExports.useCallback(() => {
2205
2205
  if (!referenceRef.current || !floatingRef.current) {
2206
2206
  return;
@@ -2231,14 +2231,14 @@ function useFloating(options) {
2231
2231
  });
2232
2232
  }, [latestMiddleware, placement, strategy, platformRef, openRef]);
2233
2233
  index$1(() => {
2234
- if (open === false && dataRef.current.isPositioned) {
2234
+ if (open2 === false && dataRef.current.isPositioned) {
2235
2235
  dataRef.current.isPositioned = false;
2236
2236
  setData((data2) => ({
2237
2237
  ...data2,
2238
2238
  isPositioned: false
2239
2239
  }));
2240
2240
  }
2241
- }, [open]);
2241
+ }, [open2]);
2242
2242
  const isMountedRef = reactExports.useRef(false);
2243
2243
  index$1(() => {
2244
2244
  isMountedRef.current = true;
@@ -2979,23 +2979,23 @@ var Tooltip$2 = (props) => {
2979
2979
  const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
2980
2980
  const delayDuration = delayDurationProp ?? providerContext.delayDuration;
2981
2981
  const wasOpenDelayedRef = reactExports.useRef(false);
2982
- const [open, setOpen] = useControllableState({
2982
+ const [open2, setOpen] = useControllableState({
2983
2983
  prop: openProp,
2984
2984
  defaultProp: defaultOpen ?? false,
2985
- onChange: (open2) => {
2986
- if (open2) {
2985
+ onChange: (open22) => {
2986
+ if (open22) {
2987
2987
  providerContext.onOpen();
2988
2988
  document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
2989
2989
  } else {
2990
2990
  providerContext.onClose();
2991
2991
  }
2992
- onOpenChange == null ? void 0 : onOpenChange(open2);
2992
+ onOpenChange == null ? void 0 : onOpenChange(open22);
2993
2993
  },
2994
2994
  caller: TOOLTIP_NAME
2995
2995
  });
2996
2996
  const stateAttribute = reactExports.useMemo(() => {
2997
- return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
2998
- }, [open]);
2997
+ return open2 ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
2998
+ }, [open2]);
2999
2999
  const handleOpen = reactExports.useCallback(() => {
3000
3000
  window.clearTimeout(openTimerRef.current);
3001
3001
  openTimerRef.current = 0;
@@ -3028,7 +3028,7 @@ var Tooltip$2 = (props) => {
3028
3028
  {
3029
3029
  scope: __scopeTooltip,
3030
3030
  contentId,
3031
- open,
3031
+ open: open2,
3032
3032
  stateAttribute,
3033
3033
  trigger,
3034
3034
  onTriggerChange: setTrigger,
@@ -15172,7 +15172,14 @@ const RunCreatedEventSchema = BaseEventSchema.extend({
15172
15172
  input: SerializedDataSchema,
15173
15173
  executionContext: record(string$2(), any()).optional(),
15174
15174
  attributes: record(string$2(), string$2()).optional(),
15175
- allowReservedAttributes: literal(true).optional()
15175
+ allowReservedAttributes: literal(true).optional(),
15176
+ /**
15177
+ * The run's X25519 public key (base64), stamped by SDKs that support
15178
+ * sealed (`encp`) envelopes. Persisted onto the run entity so that
15179
+ * cross-run writers can seal payloads to this run without holding its
15180
+ * symmetric key. Not secret — see `WorkflowRunBaseSchema`.
15181
+ */
15182
+ encryptionPublicKey: string$2().optional()
15176
15183
  })
15177
15184
  });
15178
15185
  const RunStartedEventSchema = BaseEventSchema.extend({
@@ -15183,7 +15190,14 @@ const RunStartedEventSchema = BaseEventSchema.extend({
15183
15190
  workflowName: string$2().optional(),
15184
15191
  executionContext: record(string$2(), any()).optional(),
15185
15192
  attributes: record(string$2(), string$2()).optional(),
15186
- allowReservedAttributes: literal(true).optional()
15193
+ allowReservedAttributes: literal(true).optional(),
15194
+ /**
15195
+ * Mirrors `run_created.eventData.encryptionPublicKey`. Carried here for
15196
+ * the resilient-start path: when the `run_created` write failed, the
15197
+ * server creates the run from this event instead, and without the key
15198
+ * the run would silently lose its ability to receive sealed writes.
15199
+ */
15200
+ encryptionPublicKey: string$2().optional()
15187
15201
  }).optional()
15188
15202
  });
15189
15203
  const RunCompletedEventSchema = BaseEventSchema.extend({
@@ -15345,6 +15359,26 @@ const WorkflowRunBaseSchema = object({
15345
15359
  * the attributes-mvp changelog entry.
15346
15360
  */
15347
15361
  attributes: record(string$2(), string$2()).default({}),
15362
+ /**
15363
+ * The run's X25519 public key, base64-encoded (~44 chars).
15364
+ *
15365
+ * Lets any party that can read this run seal a payload *to* it without
15366
+ * being able to read the run's data — used for cross-run writes such as a
15367
+ * hook resumption from another deployment, or a child workflow writing into
15368
+ * a forwarded stream. The matching private scalar is never stored: it is
15369
+ * re-derived on demand from the deployment's own key material, so this
15370
+ * field is not secret and its presence does not weaken the run's
15371
+ * confidentiality.
15372
+ *
15373
+ * Stamped at run creation by SDKs that support sealed (`encp`) envelopes.
15374
+ * **Presence is the writer-side gate**: a run only carries a public key if
15375
+ * the runtime that created it could also open sealed payloads, and runs are
15376
+ * pinned to their creating deployment. Writers therefore seal iff this
15377
+ * field is set, and otherwise fall back to fetching the symmetric per-run
15378
+ * key. Absent on runs created by older SDKs, and on worlds that do not
15379
+ * implement `getEncryptionKeyForRun` (encryption disabled).
15380
+ */
15381
+ encryptionPublicKey: string$2().optional(),
15348
15382
  expiredAt: date().optional(),
15349
15383
  startedAt: date().optional(),
15350
15384
  completedAt: date().optional(),
@@ -15549,22 +15583,8 @@ object({
15549
15583
  firstSeenAt: date(),
15550
15584
  lastSeenAt: date()
15551
15585
  });
15552
- object({
15553
- runId: string$2(),
15554
- hookId: string$2(),
15555
- token: string$2(),
15556
- ownerId: string$2(),
15557
- projectId: string$2(),
15558
- environment: string$2(),
15559
- metadata: SerializedDataSchema.optional(),
15560
- createdAt: date(),
15561
- // Optional in database for backwards compatibility, defaults to 1 (legacy) when reading
15562
- specVersion: number$3().optional(),
15563
- isWebhook: boolean$2().optional(),
15564
- isSystem: boolean$2().optional()
15565
- });
15566
- string$2().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_(?:workflow|step)_$/, "Must match __wkf_{workflow|step}_ or __{namespace}_wkf_{workflow|step}_");
15567
- string$2().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_(?:workflow|step)_.+$/, "Must be a valid queue name with a recognized prefix");
15586
+ string$2().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_workflow_$/, "Must match __wkf_workflow_ or __{namespace}_wkf_workflow_");
15587
+ string$2().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_workflow_.+$/, "Must be a valid queue name with a recognized prefix");
15568
15588
  string$2().regex(/^[a-z][a-z0-9]*$/, "Must be lowercase alphanumeric, starting with a letter");
15569
15589
  string$2().brand().describe("A stored queue message ID");
15570
15590
  const TraceCarrierSchema = record(string$2(), string$2());
@@ -15602,23 +15622,57 @@ const WorkflowInvokePayloadSchema = object({
15602
15622
  /** Run creation data, only present on the first queue delivery from start() */
15603
15623
  runInput: RunInputSchema.optional()
15604
15624
  });
15605
- const StepInvokePayloadSchema = object({
15606
- workflowName: string$2(),
15607
- workflowRunId: string$2(),
15608
- workflowStartedAt: number$3(),
15609
- stepId: string$2(),
15610
- traceCarrier: TraceCarrierSchema.optional(),
15611
- requestedAt: date().optional()
15612
- });
15613
15625
  const HealthCheckPayloadSchema = object({
15614
15626
  __healthCheck: literal(true),
15615
- correlationId: string$2()
15627
+ correlationId: string$2(),
15628
+ /**
15629
+ * The run id the caller is about to create, when the probe is being used to
15630
+ * prepare a cross-deployment `start()`.
15631
+ *
15632
+ * The responder runs inside the target deployment, so it can derive that
15633
+ * run's public key locally from its own key material and return it in the
15634
+ * probe response. That lets the caller seal the workflow arguments without
15635
+ * a separate key lookup. Absent for probes issued for other reasons (CLI
15636
+ * health command, dashboard), in which case no key is returned.
15637
+ */
15638
+ runId: string$2().optional()
15616
15639
  });
15617
15640
  union([
15618
- WorkflowInvokePayloadSchema,
15619
- StepInvokePayloadSchema,
15620
- HealthCheckPayloadSchema
15641
+ HealthCheckPayloadSchema,
15642
+ WorkflowInvokePayloadSchema
15621
15643
  ]);
15644
+ const HookResumeContextSchema = object({
15645
+ deploymentId: string$2(),
15646
+ workflowName: string$2(),
15647
+ // Named `runSpecVersion` to distinguish it from the hook's own `specVersion`.
15648
+ runSpecVersion: number$3().optional(),
15649
+ workflowCoreVersion: string$2().optional(),
15650
+ traceCarrier: TraceCarrierSchema.optional(),
15651
+ // The run's published X25519 public key (base64), mirrored from the run
15652
+ // entity. Lets a resume seal (`encp`) its payload to the run without reading
15653
+ // the run or fetching its symmetric key. Absent on runs created before
15654
+ // sealed envelopes and on projects with encryption disabled, where the
15655
+ // resume falls back to the symmetric per-run key.
15656
+ encryptionPublicKey: string$2().optional()
15657
+ });
15658
+ object({
15659
+ runId: string$2(),
15660
+ hookId: string$2(),
15661
+ token: string$2(),
15662
+ ownerId: string$2(),
15663
+ projectId: string$2(),
15664
+ environment: string$2(),
15665
+ metadata: SerializedDataSchema.optional(),
15666
+ createdAt: date(),
15667
+ // Optional in database for backwards compatibility, defaults to 1 (legacy) when reading
15668
+ specVersion: number$3().optional(),
15669
+ isWebhook: boolean$2().optional(),
15670
+ isSystem: boolean$2().optional(),
15671
+ // Present when the server stored it (new hooks) or synthesized it from the
15672
+ // run (old hooks). Absent only against an old server, where the resume path
15673
+ // falls back to `runs.get`.
15674
+ resumeContext: HookResumeContextSchema.optional()
15675
+ });
15622
15676
  const zodJsonSchema = lazy(() => {
15623
15677
  return union([
15624
15678
  string$2(),
@@ -15866,11 +15920,659 @@ function unflatten(parsed, revivers) {
15866
15920
  }
15867
15921
  return hydrate(0);
15868
15922
  }
15923
+ var ms$1;
15924
+ var hasRequiredMs;
15925
+ function requireMs() {
15926
+ if (hasRequiredMs) return ms$1;
15927
+ hasRequiredMs = 1;
15928
+ var s2 = 1e3;
15929
+ var m2 = s2 * 60;
15930
+ var h2 = m2 * 60;
15931
+ var d2 = h2 * 24;
15932
+ var w2 = d2 * 7;
15933
+ var y2 = d2 * 365.25;
15934
+ ms$1 = function(val, options) {
15935
+ options = options || {};
15936
+ var type = typeof val;
15937
+ if (type === "string" && val.length > 0) {
15938
+ return parse2(val);
15939
+ } else if (type === "number" && isFinite(val)) {
15940
+ return options.long ? fmtLong(val) : fmtShort(val);
15941
+ }
15942
+ throw new Error(
15943
+ "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
15944
+ );
15945
+ };
15946
+ function parse2(str) {
15947
+ str = String(str);
15948
+ if (str.length > 100) {
15949
+ return;
15950
+ }
15951
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
15952
+ str
15953
+ );
15954
+ if (!match) {
15955
+ return;
15956
+ }
15957
+ var n = parseFloat(match[1]);
15958
+ var type = (match[2] || "ms").toLowerCase();
15959
+ switch (type) {
15960
+ case "years":
15961
+ case "year":
15962
+ case "yrs":
15963
+ case "yr":
15964
+ case "y":
15965
+ return n * y2;
15966
+ case "weeks":
15967
+ case "week":
15968
+ case "w":
15969
+ return n * w2;
15970
+ case "days":
15971
+ case "day":
15972
+ case "d":
15973
+ return n * d2;
15974
+ case "hours":
15975
+ case "hour":
15976
+ case "hrs":
15977
+ case "hr":
15978
+ case "h":
15979
+ return n * h2;
15980
+ case "minutes":
15981
+ case "minute":
15982
+ case "mins":
15983
+ case "min":
15984
+ case "m":
15985
+ return n * m2;
15986
+ case "seconds":
15987
+ case "second":
15988
+ case "secs":
15989
+ case "sec":
15990
+ case "s":
15991
+ return n * s2;
15992
+ case "milliseconds":
15993
+ case "millisecond":
15994
+ case "msecs":
15995
+ case "msec":
15996
+ case "ms":
15997
+ return n;
15998
+ default:
15999
+ return void 0;
16000
+ }
16001
+ }
16002
+ function fmtShort(ms2) {
16003
+ var msAbs = Math.abs(ms2);
16004
+ if (msAbs >= d2) {
16005
+ return Math.round(ms2 / d2) + "d";
16006
+ }
16007
+ if (msAbs >= h2) {
16008
+ return Math.round(ms2 / h2) + "h";
16009
+ }
16010
+ if (msAbs >= m2) {
16011
+ return Math.round(ms2 / m2) + "m";
16012
+ }
16013
+ if (msAbs >= s2) {
16014
+ return Math.round(ms2 / s2) + "s";
16015
+ }
16016
+ return ms2 + "ms";
16017
+ }
16018
+ function fmtLong(ms2) {
16019
+ var msAbs = Math.abs(ms2);
16020
+ if (msAbs >= d2) {
16021
+ return plural(ms2, msAbs, d2, "day");
16022
+ }
16023
+ if (msAbs >= h2) {
16024
+ return plural(ms2, msAbs, h2, "hour");
16025
+ }
16026
+ if (msAbs >= m2) {
16027
+ return plural(ms2, msAbs, m2, "minute");
16028
+ }
16029
+ if (msAbs >= s2) {
16030
+ return plural(ms2, msAbs, s2, "second");
16031
+ }
16032
+ return ms2 + " ms";
16033
+ }
16034
+ function plural(ms2, msAbs, n, name2) {
16035
+ var isPlural = msAbs >= n * 1.5;
16036
+ return Math.round(ms2 / n) + " " + name2 + (isPlural ? "s" : "");
16037
+ }
16038
+ return ms$1;
16039
+ }
16040
+ var msExports = requireMs();
16041
+ const ms = /* @__PURE__ */ getDefaultExportFromCjs(msExports);
16042
+ function parseDurationToDate(param) {
16043
+ if (typeof param === "string") {
16044
+ const durationMs = ms(param);
16045
+ if (typeof durationMs !== "number" || durationMs < 0) {
16046
+ throw new Error(`Invalid duration: "${param}". Expected a valid duration string like "1s", "1m", "1h", etc.`);
16047
+ }
16048
+ return new Date(Date.now() + durationMs);
16049
+ } else if (typeof param === "number") {
16050
+ if (param < 0 || !Number.isFinite(param)) {
16051
+ throw new Error(`Invalid duration: ${param}. Expected a non-negative finite number of milliseconds.`);
16052
+ }
16053
+ return new Date(Date.now() + param);
16054
+ } else if (param instanceof Date || param && typeof param === "object" && typeof param.getTime === "function") {
16055
+ return param instanceof Date ? param : new Date(param.getTime());
16056
+ } else {
16057
+ throw new Error(`Invalid duration parameter. Expected a duration string, number (milliseconds), or Date object.`);
16058
+ }
16059
+ }
16060
+ const BASE_URL = "https://workflow-sdk.dev/err";
16061
+ function isError(value) {
16062
+ return typeof value === "object" && value !== null && "name" in value && "message" in value;
16063
+ }
16064
+ function appendFramedDetails(title, details) {
16065
+ if (details.length === 0)
16066
+ return title;
16067
+ const lines = [title];
16068
+ details.forEach((detail, index2) => {
16069
+ const isLast = index2 === details.length - 1;
16070
+ const head = isLast ? "╰▶ " : "├▶ ";
16071
+ const cont = isLast ? " " : "│ ";
16072
+ const text2 = `${detail.label}: ${detail.value}`;
16073
+ text2.split("\n").forEach((line, i) => lines.push(`${i === 0 ? head : cont}${line}`));
16074
+ });
16075
+ return lines.join("\n");
16076
+ }
16077
+ function buildFramedDetails(hint, slug) {
16078
+ const out = [];
16079
+ if (slug)
16080
+ out.push({ label: "docs", value: `${BASE_URL}/${slug}` });
16081
+ return out;
16082
+ }
16083
+ const ERROR_SLUGS = {
16084
+ HOOK_CONFLICT: "hook-conflict",
16085
+ RUNTIME_DECRYPTION_FAILED: "runtime-decryption-failed"
16086
+ };
16087
+ class WorkflowError extends Error {
16088
+ constructor(message, options) {
16089
+ const msgDocs = appendFramedDetails(message, buildFramedDetails(void 0, options == null ? void 0 : options.slug));
16090
+ super(msgDocs, { cause: options == null ? void 0 : options.cause });
16091
+ __publicField(this, "cause");
16092
+ if ((options == null ? void 0 : options.cause) !== void 0) {
16093
+ this.cause = options.cause;
16094
+ }
16095
+ if ((options == null ? void 0 : options.cause) instanceof Error) {
16096
+ this.stack = `${this.stack}
16097
+ Caused by: ${options.cause.stack}`;
16098
+ }
16099
+ }
16100
+ static is(value) {
16101
+ return isError(value) && value.name === "WorkflowError";
16102
+ }
16103
+ }
16104
+ class WorkflowRuntimeError extends WorkflowError {
16105
+ constructor(message, options) {
16106
+ super(message, {
16107
+ ...options
16108
+ });
16109
+ this.name = "WorkflowRuntimeError";
16110
+ }
16111
+ static is(value) {
16112
+ return isError(value) && value.name === "WorkflowRuntimeError";
16113
+ }
16114
+ }
16115
+ class RuntimeDecryptionError extends WorkflowRuntimeError {
16116
+ constructor(message, options) {
16117
+ super(message, {
16118
+ cause: options == null ? void 0 : options.cause,
16119
+ slug: ERROR_SLUGS.RUNTIME_DECRYPTION_FAILED
16120
+ });
16121
+ this.name = "RuntimeDecryptionError";
16122
+ if ((options == null ? void 0 : options.context) !== void 0) {
16123
+ this.context = options.context;
16124
+ }
16125
+ }
16126
+ static is(value) {
16127
+ return isError(value) && value.name === "RuntimeDecryptionError";
16128
+ }
16129
+ }
16130
+ class HookConflictError extends WorkflowError {
16131
+ constructor(token, conflictingRunId) {
16132
+ super(`Hook token "${token}" is already in use by another workflow${conflictingRunId ? ` (run "${conflictingRunId}")` : ""}`, {
16133
+ slug: ERROR_SLUGS.HOOK_CONFLICT
16134
+ });
16135
+ __publicField(this, "token");
16136
+ // TODO: Make this required once all persisted hook_conflict events and World
16137
+ // implementations always include the active hook owner's run ID.
16138
+ __publicField(this, "conflictingRunId");
16139
+ this.name = "HookConflictError";
16140
+ this.token = token;
16141
+ if (conflictingRunId !== void 0) {
16142
+ this.conflictingRunId = conflictingRunId;
16143
+ }
16144
+ }
16145
+ static is(value) {
16146
+ return isError(value) && value.name === "HookConflictError";
16147
+ }
16148
+ }
16149
+ class FatalError extends Error {
16150
+ constructor(message) {
16151
+ super(message);
16152
+ __publicField(this, "fatal", true);
16153
+ this.name = "FatalError";
16154
+ }
16155
+ static is(value) {
16156
+ if (!isError(value))
16157
+ return false;
16158
+ if (value.name === "FatalError")
16159
+ return true;
16160
+ return value.fatal === true;
16161
+ }
16162
+ }
16163
+ class RetryableError extends Error {
16164
+ constructor(message, options = {}) {
16165
+ super(message);
16166
+ /**
16167
+ * The Date when the step should be retried.
16168
+ */
16169
+ __publicField(this, "retryAfter");
16170
+ this.name = "RetryableError";
16171
+ if (options.retryAfter !== void 0) {
16172
+ this.retryAfter = parseDurationToDate(options.retryAfter);
16173
+ } else {
16174
+ this.retryAfter = new Date(Date.now() + 1e3);
16175
+ }
16176
+ }
16177
+ static is(value) {
16178
+ return isError(value) && value.name === "RetryableError";
16179
+ }
16180
+ }
16181
+ const VERCEL_403_ERROR_MESSAGE = "Your current vercel account does not have access to this resource. Use `vercel login` or `vercel switch` to ensure you are linked to the right account.";
16182
+ const FATAL_ERROR_KEY = Symbol.for("@workflow/errors//FatalError");
16183
+ const RETRYABLE_ERROR_KEY = Symbol.for("@workflow/errors//RetryableError");
16184
+ const HOOK_CONFLICT_ERROR_KEY = Symbol.for("@workflow/errors//HookConflictError");
16185
+ const RUNTIME_DECRYPTION_ERROR_KEY = Symbol.for("@workflow/errors//RuntimeDecryptionError");
16186
+ if (typeof globalThis !== "undefined") {
16187
+ if (!Object.hasOwn(globalThis, FATAL_ERROR_KEY)) {
16188
+ Object.defineProperty(globalThis, FATAL_ERROR_KEY, {
16189
+ value: FatalError,
16190
+ writable: false,
16191
+ enumerable: false,
16192
+ configurable: false
16193
+ });
16194
+ }
16195
+ if (!Object.hasOwn(globalThis, RETRYABLE_ERROR_KEY)) {
16196
+ Object.defineProperty(globalThis, RETRYABLE_ERROR_KEY, {
16197
+ value: RetryableError,
16198
+ writable: false,
16199
+ enumerable: false,
16200
+ configurable: false
16201
+ });
16202
+ }
16203
+ if (!Object.hasOwn(globalThis, HOOK_CONFLICT_ERROR_KEY)) {
16204
+ Object.defineProperty(globalThis, HOOK_CONFLICT_ERROR_KEY, {
16205
+ value: HookConflictError,
16206
+ writable: false,
16207
+ enumerable: false,
16208
+ configurable: false
16209
+ });
16210
+ }
16211
+ if (!Object.hasOwn(globalThis, RUNTIME_DECRYPTION_ERROR_KEY)) {
16212
+ Object.defineProperty(globalThis, RUNTIME_DECRYPTION_ERROR_KEY, {
16213
+ value: RuntimeDecryptionError,
16214
+ writable: false,
16215
+ enumerable: false,
16216
+ configurable: false
16217
+ });
16218
+ }
16219
+ }
16220
+ const NONCE_LENGTH = 12;
16221
+ const TAG_LENGTH = 128;
16222
+ const TAG_BYTES = TAG_LENGTH / 8;
16223
+ const KEY_LENGTH = 32;
16224
+ async function importKey(raw2, usages = ["encrypt", "decrypt"]) {
16225
+ if (raw2.byteLength !== KEY_LENGTH) {
16226
+ throw new WorkflowRuntimeError(`Encryption key must be exactly ${KEY_LENGTH} bytes, got ${raw2.byteLength}`);
16227
+ }
16228
+ return globalThis.crypto.subtle.importKey(
16229
+ "raw",
16230
+ raw2,
16231
+ "AES-GCM",
16232
+ false,
16233
+ // `KeyUsage` is a DOM-lib type that's not in scope under `es2022`.
16234
+ // The `ReadonlyArray<'encrypt' | 'decrypt'>` parameter type matches
16235
+ // a strict subset of `KeyUsage[]`, so this cast is sound.
16236
+ usages
16237
+ );
16238
+ }
16239
+ async function decrypt$1(key, data, aad) {
16240
+ const minLength = NONCE_LENGTH + TAG_LENGTH / 8;
16241
+ if (data.byteLength < minLength) {
16242
+ throw new RuntimeDecryptionError(`Encrypted data too short: expected at least ${minLength} bytes, got ${data.byteLength}`, {
16243
+ context: {
16244
+ operation: "decrypt",
16245
+ byteLength: data.byteLength
16246
+ }
16247
+ });
16248
+ }
16249
+ const nonce = data.subarray(0, NONCE_LENGTH);
16250
+ const ciphertext = data.subarray(NONCE_LENGTH);
16251
+ let plaintext;
16252
+ try {
16253
+ plaintext = await globalThis.crypto.subtle.decrypt({
16254
+ name: "AES-GCM",
16255
+ iv: nonce,
16256
+ tagLength: TAG_LENGTH,
16257
+ ...aad ? { additionalData: aad } : {}
16258
+ }, key, ciphertext);
16259
+ } catch (cause) {
16260
+ const causeMsg = cause instanceof Error ? cause.message : String(cause);
16261
+ throw new RuntimeDecryptionError(`AES-256-GCM decryption failed: ${causeMsg}`, {
16262
+ cause,
16263
+ context: {
16264
+ operation: "decrypt",
16265
+ byteLength: data.byteLength
16266
+ }
16267
+ });
16268
+ }
16269
+ return new Uint8Array(plaintext);
16270
+ }
16271
+ const X25519_KEY_LENGTH = 32;
16272
+ const CONTENT_KEY_LENGTH = 32;
16273
+ const SCALAR_INFO = "workflow/encp/x25519/v1";
16274
+ const CONTENT_KEY_INFO = "workflow/encp/aes256gcm/v1";
16275
+ const PKCS8_X25519_PREFIX = new Uint8Array([
16276
+ 48,
16277
+ 46,
16278
+ 2,
16279
+ 1,
16280
+ 0,
16281
+ 48,
16282
+ 5,
16283
+ 6,
16284
+ 3,
16285
+ 43,
16286
+ 101,
16287
+ 110,
16288
+ 4,
16289
+ 34,
16290
+ 4,
16291
+ 32
16292
+ ]);
16293
+ const infoEncoder = new TextEncoder();
16294
+ function assertKeyMaterialLength(runKeyMaterial) {
16295
+ if (runKeyMaterial.byteLength !== CONTENT_KEY_LENGTH) {
16296
+ throw new WorkflowRuntimeError(`Run key material must be exactly ${CONTENT_KEY_LENGTH} bytes, got ${runKeyMaterial.byteLength}`);
16297
+ }
16298
+ }
16299
+ async function deriveRunKeyPair(runKeyMaterial) {
16300
+ assertKeyMaterialLength(runKeyMaterial);
16301
+ const hkdfKey = await globalThis.crypto.subtle.importKey("raw", runKeyMaterial, "HKDF", false, ["deriveBits"]);
16302
+ const scalarBits = await globalThis.crypto.subtle.deriveBits({
16303
+ name: "HKDF",
16304
+ hash: "SHA-256",
16305
+ salt: new Uint8Array(32),
16306
+ info: infoEncoder.encode(SCALAR_INFO)
16307
+ }, hkdfKey, X25519_KEY_LENGTH * 8);
16308
+ const scalar = new Uint8Array(scalarBits);
16309
+ const publicKey = await derivePublicKeyFromScalar(scalar);
16310
+ return { scalar, publicKey };
16311
+ }
16312
+ async function derivePublicKeyFromScalar(scalar) {
16313
+ const privateKey = await importScalar(
16314
+ scalar,
16315
+ /* extractable */
16316
+ true
16317
+ );
16318
+ const jwk = await globalThis.crypto.subtle.exportKey("jwk", privateKey);
16319
+ if (!jwk.x) {
16320
+ throw new WorkflowRuntimeError('X25519 JWK export did not include a public key component ("x")');
16321
+ }
16322
+ const publicKey = base64UrlToBytes(jwk.x);
16323
+ if (publicKey.byteLength !== X25519_KEY_LENGTH) {
16324
+ throw new WorkflowRuntimeError(`X25519 JWK export produced a ${publicKey.byteLength}-byte public key, expected ${X25519_KEY_LENGTH}`);
16325
+ }
16326
+ return publicKey;
16327
+ }
16328
+ async function importScalar(scalar, extractable) {
16329
+ const pkcs8 = new Uint8Array(PKCS8_X25519_PREFIX.length + scalar.byteLength);
16330
+ pkcs8.set(PKCS8_X25519_PREFIX, 0);
16331
+ pkcs8.set(scalar, PKCS8_X25519_PREFIX.length);
16332
+ return globalThis.crypto.subtle.importKey("pkcs8", pkcs8, { name: "X25519" }, extractable, ["deriveBits"]);
16333
+ }
16334
+ function importPublicKey(publicKey) {
16335
+ return globalThis.crypto.subtle.importKey(
16336
+ "raw",
16337
+ publicKey,
16338
+ { name: "X25519" },
16339
+ /* extractable */
16340
+ true,
16341
+ // Public keys carry no usages for X25519 — the private key does the
16342
+ // deriving; the public key is only ever an argument to it.
16343
+ []
16344
+ );
16345
+ }
16346
+ const BASE64URL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
16347
+ function base64UrlToBytes(value) {
16348
+ let accumulator = 0;
16349
+ let bitCount = 0;
16350
+ const bytes = [];
16351
+ for (let i = 0; i < value.length; i++) {
16352
+ const char = value[i];
16353
+ if (char === "=")
16354
+ break;
16355
+ const index2 = BASE64URL_CHARS.indexOf(char);
16356
+ if (index2 === -1) {
16357
+ throw new WorkflowRuntimeError(`Invalid base64url character "${char}" in X25519 JWK key component`);
16358
+ }
16359
+ accumulator = accumulator << 6 | index2;
16360
+ bitCount += 6;
16361
+ if (bitCount >= 8) {
16362
+ bitCount -= 8;
16363
+ bytes.push(accumulator >> bitCount & 255);
16364
+ }
16365
+ }
16366
+ return new Uint8Array(bytes);
16367
+ }
16368
+ async function deriveContentKey(sharedSecret, ephemeralPublicKey, recipientPublicKey, usages) {
16369
+ const label = infoEncoder.encode(CONTENT_KEY_INFO);
16370
+ const info = new Uint8Array(label.length + ephemeralPublicKey.length + recipientPublicKey.length);
16371
+ info.set(label, 0);
16372
+ info.set(ephemeralPublicKey, label.length);
16373
+ info.set(recipientPublicKey, label.length + ephemeralPublicKey.length);
16374
+ const hkdfKey = await globalThis.crypto.subtle.importKey("raw", sharedSecret, "HKDF", false, ["deriveBits"]);
16375
+ const contentKeyBits = await globalThis.crypto.subtle.deriveBits({ name: "HKDF", hash: "SHA-256", salt: new Uint8Array(32), info }, hkdfKey, CONTENT_KEY_LENGTH * 8);
16376
+ return globalThis.crypto.subtle.importKey(
16377
+ "raw",
16378
+ new Uint8Array(contentKeyBits),
16379
+ "AES-GCM",
16380
+ false,
16381
+ // `KeyUsage` is a DOM-lib type that is not in scope under `es2022`; the
16382
+ // parameter type is a strict subset of it, so this cast is sound.
16383
+ usages
16384
+ );
16385
+ }
16386
+ async function decapsulate(keyPair, ephemeralPublicKey) {
16387
+ if (ephemeralPublicKey.byteLength !== X25519_KEY_LENGTH) {
16388
+ throw new RuntimeDecryptionError(`Sealed payload has a malformed ephemeral public key: expected ${X25519_KEY_LENGTH} bytes, got ${ephemeralPublicKey.byteLength}`, {
16389
+ context: {
16390
+ operation: "decrypt",
16391
+ byteLength: ephemeralPublicKey.byteLength
16392
+ }
16393
+ });
16394
+ }
16395
+ let sharedSecretBits;
16396
+ try {
16397
+ const [privateKey, senderKey] = await Promise.all([
16398
+ importScalar(
16399
+ keyPair.scalar,
16400
+ /* extractable */
16401
+ false
16402
+ ),
16403
+ importPublicKey(ephemeralPublicKey)
16404
+ ]);
16405
+ sharedSecretBits = await globalThis.crypto.subtle.deriveBits({ name: "X25519", public: senderKey }, privateKey, X25519_KEY_LENGTH * 8);
16406
+ } catch (cause) {
16407
+ throw new RuntimeDecryptionError(`X25519 key agreement failed while opening a sealed payload: ${cause instanceof Error ? cause.message : String(cause)}`, {
16408
+ cause,
16409
+ context: {
16410
+ operation: "decrypt",
16411
+ byteLength: ephemeralPublicKey.byteLength
16412
+ }
16413
+ });
16414
+ }
16415
+ return deriveContentKey(new Uint8Array(sharedSecretBits), ephemeralPublicKey, keyPair.publicKey, ["decrypt"]);
16416
+ }
16417
+ async function open(keyPair, sealed, aad) {
16418
+ const minLength = X25519_KEY_LENGTH + NONCE_LENGTH + TAG_BYTES;
16419
+ if (sealed.byteLength < minLength) {
16420
+ throw new RuntimeDecryptionError(`Sealed payload too short: expected at least ${minLength} bytes, got ${sealed.byteLength}`, { context: { operation: "decrypt", byteLength: sealed.byteLength } });
16421
+ }
16422
+ const ephemeralPublicKey = sealed.subarray(0, X25519_KEY_LENGTH);
16423
+ const encrypted = sealed.subarray(X25519_KEY_LENGTH);
16424
+ const contentKey = await decapsulate(keyPair, ephemeralPublicKey);
16425
+ return decrypt$1(contentKey, encrypted, aad);
16426
+ }
16427
+ function isFormatPrefix(value) {
16428
+ return value.length === 4 && /^[a-z0-9]{4}$/.test(value);
16429
+ }
16430
+ const SerializationFormat$1 = {
16431
+ /** devalue stringify/parse with TextEncoder/TextDecoder */
16432
+ DEVALUE_V1: "devl",
16433
+ /** Encrypted payload (inner payload has its own format prefix) */
16434
+ ENCRYPTED: "encr",
16435
+ /**
16436
+ * Sealed payload — asymmetrically encrypted to a run's X25519 public key
16437
+ * (inner payload has its own format prefix).
16438
+ *
16439
+ * Used for *cross-run* writes (hook payloads, forwarded stream frames),
16440
+ * where the writer holds only the recipient run's public key and therefore
16441
+ * cannot decrypt. A run's own payloads continue to use {@link ENCRYPTED}.
16442
+ * See `sealed-box.ts` for the construction.
16443
+ */
16444
+ SEALED: "encp"
16445
+ };
16446
+ const FORMAT_PREFIX_LENGTH$1 = 4;
16447
+ new TextEncoder();
16448
+ const formatDecoder$1 = new TextDecoder();
16449
+ function peekFormatPrefix(data) {
16450
+ if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$1) {
16451
+ return null;
16452
+ }
16453
+ const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH$1);
16454
+ const str = formatDecoder$1.decode(prefixBytes);
16455
+ return isFormatPrefix(str) ? str : null;
16456
+ }
16457
+ function decodeFormatPrefix$1(data) {
16458
+ if (!(data instanceof Uint8Array)) {
16459
+ return {
16460
+ format: SerializationFormat$1.DEVALUE_V1,
16461
+ payload: new TextEncoder().encode(JSON.stringify(data))
16462
+ };
16463
+ }
16464
+ if (data.length < FORMAT_PREFIX_LENGTH$1) {
16465
+ throw new Error(`Data too short to contain format prefix: expected at least ${FORMAT_PREFIX_LENGTH$1} bytes, got ${data.length}`);
16466
+ }
16467
+ const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH$1);
16468
+ const str = formatDecoder$1.decode(prefixBytes);
16469
+ if (!isFormatPrefix(str)) {
16470
+ throw new Error(`Invalid format prefix: "${str}". Must be 4 characters of [a-z0-9].`);
16471
+ }
16472
+ const payload = data.subarray(FORMAT_PREFIX_LENGTH$1);
16473
+ return { format: str, payload };
16474
+ }
16475
+ const SEAL_TARGET_BRAND = Symbol.for("workflow.serialization.sealTarget");
16476
+ const RUN_KEYS_BRAND = Symbol.for("workflow.serialization.runKeys");
16477
+ function runPayloadKeys(aes, keyPair, aad) {
16478
+ return { [RUN_KEYS_BRAND]: true, aes, keyPair, aad };
16479
+ }
16480
+ async function deriveRunPayloadKeys(runKeyMaterial) {
16481
+ const [aes, keyPair] = await Promise.all([
16482
+ importKey(runKeyMaterial),
16483
+ deriveRunKeyPair(runKeyMaterial)
16484
+ ]);
16485
+ return runPayloadKeys(aes, keyPair);
16486
+ }
16487
+ function isSealTarget(value) {
16488
+ return typeof value === "object" && value !== null && value[SEAL_TARGET_BRAND] === true;
16489
+ }
16490
+ function isRunPayloadKeys(value) {
16491
+ return typeof value === "object" && value !== null && value[RUN_KEYS_BRAND] === true;
16492
+ }
16493
+ function aesKeyOf(key) {
16494
+ if (!key)
16495
+ return void 0;
16496
+ if (isRunPayloadKeys(key))
16497
+ return key.aes;
16498
+ if (isSealTarget(key))
16499
+ return void 0;
16500
+ return key;
16501
+ }
16502
+ async function openSealedEnvelope(data, key) {
16503
+ if (!isRunPayloadKeys(key)) {
16504
+ throw new RuntimeDecryptionError("Sealed data encountered but no run keypair is available. Opening a sealed payload requires the run's own encryption key material; a symmetric key or a seal-only target cannot decrypt it.", {
16505
+ context: {
16506
+ operation: "decrypt",
16507
+ byteLength: data.byteLength,
16508
+ formatPrefix: "encp"
16509
+ }
16510
+ });
16511
+ }
16512
+ const { payload } = decodeFormatPrefix$1(data);
16513
+ try {
16514
+ return await open(key.keyPair, payload, key.aad);
16515
+ } catch (error) {
16516
+ if (RuntimeDecryptionError.is(error) && error.context) {
16517
+ error.context.formatPrefix = SerializationFormat$1.SEALED;
16518
+ }
16519
+ throw error;
16520
+ }
16521
+ }
16522
+ async function decrypt(data, key) {
16523
+ if (!(data instanceof Uint8Array))
16524
+ return data;
16525
+ const format = peekFormatPrefix(data);
16526
+ if (format === SerializationFormat$1.SEALED) {
16527
+ return openSealedEnvelope(data, key);
16528
+ }
16529
+ if (format !== SerializationFormat$1.ENCRYPTED)
16530
+ return data;
16531
+ const aesKey = aesKeyOf(key);
16532
+ if (!aesKey) {
16533
+ throw new RuntimeDecryptionError("Encrypted data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.", {
16534
+ context: {
16535
+ operation: "decrypt",
16536
+ byteLength: data.byteLength,
16537
+ formatPrefix: "encr"
16538
+ }
16539
+ });
16540
+ }
16541
+ const { payload } = decodeFormatPrefix$1(data);
16542
+ try {
16543
+ return await decrypt$1(aesKey, payload);
16544
+ } catch (error) {
16545
+ if (RuntimeDecryptionError.is(error) && error.context) {
16546
+ error.context.formatPrefix = format;
16547
+ }
16548
+ throw error;
16549
+ }
16550
+ }
16551
+ const encryption = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
16552
+ __proto__: null,
16553
+ aesKeyOf,
16554
+ decrypt,
16555
+ deriveRunPayloadKeys,
16556
+ isRunPayloadKeys,
16557
+ isSealTarget,
16558
+ runPayloadKeys
16559
+ }, Symbol.toStringTag, { value: "Module" }));
15869
16560
  const SerializationFormat = {
15870
16561
  /** devalue stringify/parse with TextEncoder/TextDecoder */
15871
16562
  DEVALUE_V1: "devl",
15872
16563
  /** Encrypted payload (inner payload has its own format prefix after decryption) */
15873
16564
  ENCRYPTED: "encr",
16565
+ /**
16566
+ * Sealed payload — asymmetrically encrypted to a run's X25519 public key
16567
+ * (inner payload has its own format prefix after opening).
16568
+ *
16569
+ * Written by cross-run writers that hold only the recipient run's public
16570
+ * key. Opening it requires the run's private scalar rather than the
16571
+ * symmetric per-run key, so o11y display treats it as ciphertext via
16572
+ * {@link isEncryptedData} but {@link hydrateDataWithKey} does not attempt
16573
+ * an AES-GCM decrypt on it.
16574
+ */
16575
+ SEALED: "encp",
15874
16576
  /** Gzip-compressed payload (inner payload has its own format prefix after decompression) */
15875
16577
  GZIP: "gzip",
15876
16578
  /** Zstandard-compressed payload (inner payload has its own format prefix after decompression) */
@@ -15918,7 +16620,14 @@ function isEncryptedData(data) {
15918
16620
  return false;
15919
16621
  }
15920
16622
  const prefix = formatDecoder.decode(data.subarray(0, FORMAT_PREFIX_LENGTH));
15921
- return prefix === SerializationFormat.ENCRYPTED;
16623
+ return prefix === SerializationFormat.ENCRYPTED || prefix === SerializationFormat.SEALED;
16624
+ }
16625
+ function isSealedData(data) {
16626
+ if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH) {
16627
+ return false;
16628
+ }
16629
+ const prefix = formatDecoder.decode(data.subarray(0, FORMAT_PREFIX_LENGTH));
16630
+ return prefix === SerializationFormat.SEALED;
15922
16631
  }
15923
16632
  function isCompressedData(data) {
15924
16633
  if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH) {
@@ -16012,12 +16721,13 @@ function hydrateData(value, revivers) {
16012
16721
  async function hydrateDataWithKey(value, revivers, key) {
16013
16722
  let data = value;
16014
16723
  if (data instanceof Uint8Array && isEncryptedData(data) && key) {
16015
- const { decrypt } = await __vitePreload(async () => {
16016
- const { decrypt: decrypt2 } = await import("./encryption-CLVP4klT.js");
16017
- return { decrypt: decrypt2 };
16018
- }, true ? __vite__mapDeps([0,1,2]) : void 0);
16019
- const { payload } = decodeFormatPrefix(data);
16020
- data = await decrypt(key, payload);
16724
+ const { decrypt: decrypt2, isRunPayloadKeys: isRunPayloadKeys2 } = await __vitePreload(async () => {
16725
+ const { decrypt: decrypt3, isRunPayloadKeys: isRunPayloadKeys3 } = await Promise.resolve().then(() => encryption);
16726
+ return { decrypt: decrypt3, isRunPayloadKeys: isRunPayloadKeys3 };
16727
+ }, true ? void 0 : void 0);
16728
+ if (!isSealedData(data) || isRunPayloadKeys2(key)) {
16729
+ data = await decrypt2(data, key);
16730
+ }
16021
16731
  }
16022
16732
  if (data instanceof Uint8Array && isCompressedData(data)) {
16023
16733
  const { format, payload } = decodeFormatPrefix(data);
@@ -16244,6 +16954,8 @@ const serializationFormat = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object
16244
16954
  STREAM_REF_TYPE: STREAM_REF_TYPE$1,
16245
16955
  SerializationFormat,
16246
16956
  decodeFormatPrefix,
16957
+ decryptEnvelope: decrypt,
16958
+ deriveRunPayloadKeys,
16247
16959
  extractClassName,
16248
16960
  hydrateData,
16249
16961
  hydrateDataWithKey,
@@ -16251,9 +16963,13 @@ const serializationFormat = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object
16251
16963
  isCompressedData,
16252
16964
  isEncryptedData,
16253
16965
  isExpiredStub,
16966
+ isRunPayloadKeys,
16254
16967
  isRunRef: isRunRef$1,
16968
+ isSealTarget,
16969
+ isSealedData,
16255
16970
  observabilityRevivers,
16256
16971
  registerZstdDecoder,
16972
+ runPayloadKeys,
16257
16973
  serializedClassToString,
16258
16974
  serializedInstanceToRef,
16259
16975
  serializedRunToRunRef,
@@ -16533,19 +17249,16 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
16533
17249
  return result;
16534
17250
  }
16535
17251
  async function hydrateResourceIOAsync(resource, key) {
16536
- const { hydrateDataWithKey: hydrateDataWithKey2 } = await __vitePreload(async () => {
16537
- const { hydrateDataWithKey: hydrateDataWithKey3 } = await Promise.resolve().then(() => serializationFormat);
16538
- return { hydrateDataWithKey: hydrateDataWithKey3 };
17252
+ const { hydrateDataWithKey: hydrateDataWithKey2, deriveRunPayloadKeys: deriveRunPayloadKeys2 } = await __vitePreload(async () => {
17253
+ const { hydrateDataWithKey: hydrateDataWithKey3, deriveRunPayloadKeys: deriveRunPayloadKeys3 } = await Promise.resolve().then(() => serializationFormat);
17254
+ return { hydrateDataWithKey: hydrateDataWithKey3, deriveRunPayloadKeys: deriveRunPayloadKeys3 };
16539
17255
  }, true ? void 0 : void 0);
16540
17256
  const { ensureZstdDecoderRegistered } = await __vitePreload(async () => {
16541
- const { ensureZstdDecoderRegistered: ensureZstdDecoderRegistered2 } = await import("./zstd-browser-decoder-Ds2MNSdp.js");
17257
+ const { ensureZstdDecoderRegistered: ensureZstdDecoderRegistered2 } = await import("./zstd-browser-decoder-BAY5XtBl.js");
16542
17258
  return { ensureZstdDecoderRegistered: ensureZstdDecoderRegistered2 };
16543
- }, true ? __vite__mapDeps([3,2]) : void 0);
17259
+ }, true ? __vite__mapDeps([0,1]) : void 0);
16544
17260
  ensureZstdDecoderRegistered();
16545
- const cryptoKey = key ? await __vitePreload(async () => {
16546
- const { importKey } = await import("./encryption-CLVP4klT.js");
16547
- return { importKey };
16548
- }, true ? __vite__mapDeps([0,1,2]) : void 0).then(({ importKey }) => importKey(key)) : void 0;
17261
+ const cryptoKey = key ? await deriveRunPayloadKeys2(key) : void 0;
16549
17262
  const revivers = getRevivers();
16550
17263
  async function hydrateField(value) {
16551
17264
  if (isEncryptedMarker$1(value)) {
@@ -17689,15 +18402,15 @@ const MS_IN_SECOND$1 = 1e3;
17689
18402
  const MS_IN_MINUTE = 60 * MS_IN_SECOND$1;
17690
18403
  const MS_IN_HOUR = 60 * MS_IN_MINUTE;
17691
18404
  const MS_IN_DAY = 24 * MS_IN_HOUR;
17692
- function formatDuration(ms, compact = false) {
17693
- if (ms === 0) {
18405
+ function formatDuration(ms2, compact = false) {
18406
+ if (ms2 === 0) {
17694
18407
  return "0s";
17695
18408
  }
17696
- if (ms < MS_IN_SECOND$1) {
17697
- const roundedMs2 = Math.round(ms);
18409
+ if (ms2 < MS_IN_SECOND$1) {
18410
+ const roundedMs2 = Math.round(ms2);
17698
18411
  return roundedMs2 < MS_IN_SECOND$1 ? `${roundedMs2}ms` : "1s";
17699
18412
  }
17700
- const roundedMs = Math.round(ms / MS_IN_SECOND$1) * MS_IN_SECOND$1;
18413
+ const roundedMs = Math.round(ms2 / MS_IN_SECOND$1) * MS_IN_SECOND$1;
17701
18414
  if (roundedMs < MS_IN_MINUTE) {
17702
18415
  return `${Math.floor(roundedMs / MS_IN_SECOND$1)}s`;
17703
18416
  }
@@ -17728,18 +18441,18 @@ function formatDuration(ms, compact = false) {
17728
18441
  parts.push(`${seconds}s`);
17729
18442
  return parts.join(" ");
17730
18443
  }
17731
- function formatDurationPrecise(ms, fractionDigits = 2) {
17732
- if (ms === 0) {
18444
+ function formatDurationPrecise(ms2, fractionDigits = 2) {
18445
+ if (ms2 === 0) {
17733
18446
  return "0s";
17734
18447
  }
17735
- if (ms < MS_IN_SECOND$1) {
17736
- const roundedMs = Math.round(ms);
18448
+ if (ms2 < MS_IN_SECOND$1) {
18449
+ const roundedMs = Math.round(ms2);
17737
18450
  if (roundedMs < MS_IN_SECOND$1) {
17738
18451
  return `${roundedMs}ms`;
17739
18452
  }
17740
18453
  }
17741
18454
  const granularityMs = MS_IN_SECOND$1 / 10 ** fractionDigits;
17742
- const normalizedMs = Math.round(ms / granularityMs) * granularityMs;
18455
+ const normalizedMs = Math.round(ms2 / granularityMs) * granularityMs;
17743
18456
  if (normalizedMs < MS_IN_MINUTE) {
17744
18457
  return `${Number((normalizedMs / MS_IN_SECOND$1).toFixed(fractionDigits))}s`;
17745
18458
  }
@@ -17825,7 +18538,7 @@ function useCollapsibleContext(part) {
17825
18538
  return context;
17826
18539
  }
17827
18540
  function CollapsibleRoot({ children: children2, variant = "section", disabled = false, defaultOpen = false, onOpenChange, className }) {
17828
- const [open, setOpen] = reactExports.useState(defaultOpen);
18541
+ const [open2, setOpen] = reactExports.useState(defaultOpen);
17829
18542
  const handleToggle = (event) => {
17830
18543
  if (event.target !== event.currentTarget)
17831
18544
  return;
@@ -17833,7 +18546,7 @@ function CollapsibleRoot({ children: children2, variant = "section", disabled =
17833
18546
  setOpen(next2);
17834
18547
  onOpenChange == null ? void 0 : onOpenChange(next2);
17835
18548
  };
17836
- const details = jsxRuntimeExports.jsx("details", { "data-slot": "collapsible", "data-state": open ? "open" : "closed", open, onToggle: disabled ? void 0 : handleToggle, className: cn$4(variant === "card" ? "group/card border-gray-alpha-400 last:border-b" : "group", className), children: jsxRuntimeExports.jsx(CollapsibleContext.Provider, { value: { variant, disabled }, children: children2 }) });
18549
+ const details = jsxRuntimeExports.jsx("details", { "data-slot": "collapsible", "data-state": open2 ? "open" : "closed", open: open2, onToggle: disabled ? void 0 : handleToggle, className: cn$4(variant === "card" ? "group/card border-gray-alpha-400 last:border-b" : "group", className), children: jsxRuntimeExports.jsx(CollapsibleContext.Provider, { value: { variant, disabled }, children: children2 }) });
17837
18550
  if (variant === "card") {
17838
18551
  return details;
17839
18552
  }
@@ -18249,8 +18962,8 @@ function PrimitiveValue({ field, value, isLast }) {
18249
18962
  const { text: text2, cls } = describePrimitive(value);
18250
18963
  return jsxRuntimeExports.jsx(LeafRow, { field, isLast, children: jsxRuntimeExports.jsx("span", { className: cls, children: text2 }) });
18251
18964
  }
18252
- function EmptyContainer({ field, prefix, open, close, isLast }) {
18253
- return jsxRuntimeExports.jsxs("div", { className: CLS.child, role: "treeitem", tabIndex: -1, children: [jsxRuntimeExports.jsx(Label, { field }), prefix ? jsxRuntimeExports.jsx("span", { className: CLS.className, children: prefix }) : null, jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: open }), jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: close }), jsxRuntimeExports.jsx(Comma, { isLast })] });
18965
+ function EmptyContainer({ field, prefix, open: open2, close, isLast }) {
18966
+ return jsxRuntimeExports.jsxs("div", { className: CLS.child, role: "treeitem", tabIndex: -1, children: [jsxRuntimeExports.jsx(Label, { field }), prefix ? jsxRuntimeExports.jsx("span", { className: CLS.className, children: prefix }) : null, jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: open2 }), jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: close }), jsxRuntimeExports.jsx(Comma, { isLast })] });
18254
18967
  }
18255
18968
  function focusExpander(button, outerRef) {
18256
18969
  var _a3;
@@ -18279,13 +18992,13 @@ function moveExpanderFocus(outerRef, direction) {
18279
18992
  buttons[next2].tabIndex = 0;
18280
18993
  buttons[next2].focus();
18281
18994
  }
18282
- function ExpandableContainer({ field, entries, open, close, prefix, ctx, isLast }) {
18995
+ function ExpandableContainer({ field, entries, open: open2, close, prefix, ctx, isLast }) {
18283
18996
  const { level, shouldExpand, outerRef } = ctx;
18284
18997
  const [expanded2, setExpanded] = reactExports.useState(() => shouldExpand(level));
18285
18998
  const rowRef = reactExports.useRef(null);
18286
18999
  const contentsId = reactExports.useId();
18287
19000
  if (entries.length === 0) {
18288
- return jsxRuntimeExports.jsx(EmptyContainer, { field, prefix, open, close, isLast });
19001
+ return jsxRuntimeExports.jsx(EmptyContainer, { field, prefix, open: open2, close, isLast });
18289
19002
  }
18290
19003
  const toggle = () => {
18291
19004
  setExpanded((value) => !value);
@@ -18314,7 +19027,7 @@ function ExpandableContainer({ field, entries, open, close, prefix, ctx, isLast
18314
19027
  }
18315
19028
  };
18316
19029
  const lastIndex = entries.length - 1;
18317
- return jsxRuntimeExports.jsxs("div", { className: CLS.child, role: "treeitem", "aria-expanded": expanded2, "aria-controls": expanded2 ? contentsId : void 0, "data-json-expander": true, ref: rowRef, tabIndex: level === 0 ? 0 : -1, onClick, onKeyDown, children: [jsxRuntimeExports.jsx("span", { className: expanded2 ? CLS.collapseIcon : CLS.expandIcon, "aria-hidden": "true" }), field !== void 0 && jsxRuntimeExports.jsx("span", { className: CLS.clickableLabel, children: `${formatField(field)}:` }), prefix ? jsxRuntimeExports.jsx("span", { className: CLS.className, children: prefix }) : null, jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: open }), expanded2 ? jsxRuntimeExports.jsx("ul", { id: contentsId, className: CLS.childFields, role: "group", children: entries.map(([childField, childValue], index2) => jsxRuntimeExports.jsx(DataRender, { field: childField, value: childValue, isLast: index2 === lastIndex, ctx: { ...ctx, level: level + 1 } }, childField ?? index2)) }) : jsxRuntimeExports.jsx("span", { className: CLS.collapsedContent, "aria-hidden": "true" }), jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: close }), jsxRuntimeExports.jsx(Comma, { isLast })] });
19030
+ return jsxRuntimeExports.jsxs("div", { className: CLS.child, role: "treeitem", "aria-expanded": expanded2, "aria-controls": expanded2 ? contentsId : void 0, "data-json-expander": true, ref: rowRef, tabIndex: level === 0 ? 0 : -1, onClick, onKeyDown, children: [jsxRuntimeExports.jsx("span", { className: expanded2 ? CLS.collapseIcon : CLS.expandIcon, "aria-hidden": "true" }), field !== void 0 && jsxRuntimeExports.jsx("span", { className: CLS.clickableLabel, children: `${formatField(field)}:` }), prefix ? jsxRuntimeExports.jsx("span", { className: CLS.className, children: prefix }) : null, jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: open2 }), expanded2 ? jsxRuntimeExports.jsx("ul", { id: contentsId, className: CLS.childFields, role: "group", children: entries.map(([childField, childValue], index2) => jsxRuntimeExports.jsx(DataRender, { field: childField, value: childValue, isLast: index2 === lastIndex, ctx: { ...ctx, level: level + 1 } }, childField ?? index2)) }) : jsxRuntimeExports.jsx("span", { className: CLS.collapsedContent, "aria-hidden": "true" }), jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: close }), jsxRuntimeExports.jsx(Comma, { isLast })] });
18318
19031
  }
18319
19032
  function DataRender({ field, value, isLast, ctx }) {
18320
19033
  if (isBytesDisplay(value)) {
@@ -19241,11 +19954,11 @@ const TIME_UNITS = [
19241
19954
  function formatTimeDifference(diff) {
19242
19955
  let remaining = Math.abs(diff);
19243
19956
  const result = [];
19244
- for (const { unit, ms } of TIME_UNITS) {
19245
- const value = Math.floor(remaining / ms);
19957
+ for (const { unit, ms: ms2 } of TIME_UNITS) {
19958
+ const value = Math.floor(remaining / ms2);
19246
19959
  if (value > 0 || result.length > 0) {
19247
19960
  result.push(`${value} ${unit}${value !== 1 ? "s" : ""}`);
19248
- remaining %= ms;
19961
+ remaining %= ms2;
19249
19962
  }
19250
19963
  if (result.length === 3)
19251
19964
  break;
@@ -32551,12 +33264,12 @@ function emphasis$1(node2, _2, state, info) {
32551
33264
  })
32552
33265
  );
32553
33266
  const betweenHead = between.charCodeAt(0);
32554
- const open = encodeInfo(
33267
+ const open2 = encodeInfo(
32555
33268
  info.before.charCodeAt(info.before.length - 1),
32556
33269
  betweenHead,
32557
33270
  marker2
32558
33271
  );
32559
- if (open.inside) {
33272
+ if (open2.inside) {
32560
33273
  between = encodeCharacterReference(betweenHead) + between.slice(1);
32561
33274
  }
32562
33275
  const betweenTail = between.charCodeAt(between.length - 1);
@@ -32568,7 +33281,7 @@ function emphasis$1(node2, _2, state, info) {
32568
33281
  exit2();
32569
33282
  state.attentionEncodeSurroundingInfo = {
32570
33283
  after: close.outside,
32571
- before: open.outside
33284
+ before: open2.outside
32572
33285
  };
32573
33286
  return before + between + after;
32574
33287
  }
@@ -33101,12 +33814,12 @@ function strong$1(node2, _2, state, info) {
33101
33814
  })
33102
33815
  );
33103
33816
  const betweenHead = between.charCodeAt(0);
33104
- const open = encodeInfo(
33817
+ const open2 = encodeInfo(
33105
33818
  info.before.charCodeAt(info.before.length - 1),
33106
33819
  betweenHead,
33107
33820
  marker2
33108
33821
  );
33109
- if (open.inside) {
33822
+ if (open2.inside) {
33110
33823
  between = encodeCharacterReference(betweenHead) + between.slice(1);
33111
33824
  }
33112
33825
  const betweenTail = between.charCodeAt(between.length - 1);
@@ -33118,7 +33831,7 @@ function strong$1(node2, _2, state, info) {
33118
33831
  exit2();
33119
33832
  state.attentionEncodeSurroundingInfo = {
33120
33833
  after: close.outside,
33121
- before: open.outside
33834
+ before: open2.outside
33122
33835
  };
33123
33836
  return before + between + after;
33124
33837
  }
@@ -33915,7 +34628,7 @@ const attention = {
33915
34628
  };
33916
34629
  function resolveAllAttention(events, context) {
33917
34630
  let index2 = -1;
33918
- let open;
34631
+ let open2;
33919
34632
  let group;
33920
34633
  let text2;
33921
34634
  let openingSequence;
@@ -33925,16 +34638,16 @@ function resolveAllAttention(events, context) {
33925
34638
  let offset2;
33926
34639
  while (++index2 < events.length) {
33927
34640
  if (events[index2][0] === "enter" && events[index2][1].type === "attentionSequence" && events[index2][1]._close) {
33928
- open = index2;
33929
- while (open--) {
33930
- if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && // If the markers are the same:
33931
- context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index2][1]).charCodeAt(0)) {
33932
- if ((events[open][1]._close || events[index2][1]._open) && (events[index2][1].end.offset - events[index2][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index2][1].end.offset - events[index2][1].start.offset) % 3)) {
34641
+ open2 = index2;
34642
+ while (open2--) {
34643
+ if (events[open2][0] === "exit" && events[open2][1].type === "attentionSequence" && events[open2][1]._open && // If the markers are the same:
34644
+ context.sliceSerialize(events[open2][1]).charCodeAt(0) === context.sliceSerialize(events[index2][1]).charCodeAt(0)) {
34645
+ if ((events[open2][1]._close || events[index2][1]._open) && (events[index2][1].end.offset - events[index2][1].start.offset) % 3 && !((events[open2][1].end.offset - events[open2][1].start.offset + events[index2][1].end.offset - events[index2][1].start.offset) % 3)) {
33933
34646
  continue;
33934
34647
  }
33935
- use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index2][1].end.offset - events[index2][1].start.offset > 1 ? 2 : 1;
34648
+ use = events[open2][1].end.offset - events[open2][1].start.offset > 1 && events[index2][1].end.offset - events[index2][1].start.offset > 1 ? 2 : 1;
33936
34649
  const start = {
33937
- ...events[open][1].end
34650
+ ...events[open2][1].end
33938
34651
  };
33939
34652
  const end = {
33940
34653
  ...events[index2][1].start
@@ -33945,7 +34658,7 @@ function resolveAllAttention(events, context) {
33945
34658
  type: use > 1 ? "strongSequence" : "emphasisSequence",
33946
34659
  start,
33947
34660
  end: {
33948
- ...events[open][1].end
34661
+ ...events[open2][1].end
33949
34662
  }
33950
34663
  };
33951
34664
  closingSequence = {
@@ -33958,7 +34671,7 @@ function resolveAllAttention(events, context) {
33958
34671
  text2 = {
33959
34672
  type: use > 1 ? "strongText" : "emphasisText",
33960
34673
  start: {
33961
- ...events[open][1].end
34674
+ ...events[open2][1].end
33962
34675
  },
33963
34676
  end: {
33964
34677
  ...events[index2][1].start
@@ -33973,18 +34686,18 @@ function resolveAllAttention(events, context) {
33973
34686
  ...closingSequence.end
33974
34687
  }
33975
34688
  };
33976
- events[open][1].end = {
34689
+ events[open2][1].end = {
33977
34690
  ...openingSequence.start
33978
34691
  };
33979
34692
  events[index2][1].start = {
33980
34693
  ...closingSequence.end
33981
34694
  };
33982
34695
  nextEvents = [];
33983
- if (events[open][1].end.offset - events[open][1].start.offset) {
33984
- nextEvents = push(nextEvents, [["enter", events[open][1], context], ["exit", events[open][1], context]]);
34696
+ if (events[open2][1].end.offset - events[open2][1].start.offset) {
34697
+ nextEvents = push(nextEvents, [["enter", events[open2][1], context], ["exit", events[open2][1], context]]);
33985
34698
  }
33986
34699
  nextEvents = push(nextEvents, [["enter", group, context], ["enter", openingSequence, context], ["exit", openingSequence, context], ["enter", text2, context]]);
33987
- nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index2), context));
34700
+ nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open2 + 1, index2), context));
33988
34701
  nextEvents = push(nextEvents, [["exit", text2, context], ["enter", closingSequence, context], ["exit", closingSequence, context], ["exit", group, context]]);
33989
34702
  if (events[index2][1].end.offset - events[index2][1].start.offset) {
33990
34703
  offset2 = 2;
@@ -33992,8 +34705,8 @@ function resolveAllAttention(events, context) {
33992
34705
  } else {
33993
34706
  offset2 = 0;
33994
34707
  }
33995
- splice(events, open - 1, index2 - open + 3, nextEvents);
33996
- index2 = open + nextEvents.length - offset2 - 2;
34708
+ splice(events, open2 - 1, index2 - open2 + 3, nextEvents);
34709
+ index2 = open2 + nextEvents.length - offset2 - 2;
33997
34710
  break;
33998
34711
  }
33999
34712
  }
@@ -34025,10 +34738,10 @@ function tokenizeAttention(effects, ok2) {
34025
34738
  }
34026
34739
  const token = effects.exit("attentionSequence");
34027
34740
  const after = classifyCharacter(code2);
34028
- const open = !after || after === 2 && before || attentionMarkers2.includes(code2);
34741
+ const open2 = !after || after === 2 && before || attentionMarkers2.includes(code2);
34029
34742
  const close = !before || before === 2 && after || attentionMarkers2.includes(previous2);
34030
- token._open = Boolean(marker2 === 42 ? open : open && (before || !close));
34031
- token._close = Boolean(marker2 === 42 ? close : close && (after || !open));
34743
+ token._open = Boolean(marker2 === 42 ? open2 : open2 && (before || !close));
34744
+ token._close = Boolean(marker2 === 42 ? close : close && (after || !open2));
34032
34745
  return ok2(code2);
34033
34746
  }
34034
34747
  }
@@ -34050,9 +34763,9 @@ function tokenizeAutolink(effects, ok2, nok) {
34050
34763
  effects.consume(code2);
34051
34764
  effects.exit("autolinkMarker");
34052
34765
  effects.enter("autolinkProtocol");
34053
- return open;
34766
+ return open2;
34054
34767
  }
34055
- function open(code2) {
34768
+ function open2(code2) {
34056
34769
  if (asciiAlpha(code2)) {
34057
34770
  effects.consume(code2);
34058
34771
  return schemeOrEmailAtext;
@@ -34264,9 +34977,9 @@ function tokenizeCharacterReference(effects, ok2, nok) {
34264
34977
  effects.enter("characterReferenceMarker");
34265
34978
  effects.consume(code2);
34266
34979
  effects.exit("characterReferenceMarker");
34267
- return open;
34980
+ return open2;
34268
34981
  }
34269
- function open(code2) {
34982
+ function open2(code2) {
34270
34983
  if (code2 === 35) {
34271
34984
  effects.enter("characterReferenceMarkerNumeric");
34272
34985
  effects.consume(code2);
@@ -35604,9 +36317,9 @@ function tokenizeHtmlFlow(effects, ok2, nok) {
35604
36317
  effects.enter("htmlFlow");
35605
36318
  effects.enter("htmlFlowData");
35606
36319
  effects.consume(code2);
35607
- return open;
36320
+ return open2;
35608
36321
  }
35609
- function open(code2) {
36322
+ function open2(code2) {
35610
36323
  if (code2 === 33) {
35611
36324
  effects.consume(code2);
35612
36325
  return declarationOpen;
@@ -35952,9 +36665,9 @@ function tokenizeHtmlText(effects, ok2, nok) {
35952
36665
  effects.enter("htmlText");
35953
36666
  effects.enter("htmlTextData");
35954
36667
  effects.consume(code2);
35955
- return open;
36668
+ return open2;
35956
36669
  }
35957
- function open(code2) {
36670
+ function open2(code2) {
35958
36671
  if (code2 === 33) {
35959
36672
  effects.consume(code2);
35960
36673
  return declarationOpen;
@@ -36278,12 +36991,12 @@ function resolveToLabelEnd(events, context) {
36278
36991
  let index2 = events.length;
36279
36992
  let offset2 = 0;
36280
36993
  let token;
36281
- let open;
36994
+ let open2;
36282
36995
  let close;
36283
36996
  let media;
36284
36997
  while (index2--) {
36285
36998
  token = events[index2][1];
36286
- if (open) {
36999
+ if (open2) {
36287
37000
  if (token.type === "link" || token.type === "labelLink" && token._inactive) {
36288
37001
  break;
36289
37002
  }
@@ -36292,7 +37005,7 @@ function resolveToLabelEnd(events, context) {
36292
37005
  }
36293
37006
  } else if (close) {
36294
37007
  if (events[index2][0] === "enter" && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) {
36295
- open = index2;
37008
+ open2 = index2;
36296
37009
  if (token.type !== "labelLink") {
36297
37010
  offset2 = 2;
36298
37011
  break;
@@ -36303,9 +37016,9 @@ function resolveToLabelEnd(events, context) {
36303
37016
  }
36304
37017
  }
36305
37018
  const group = {
36306
- type: events[open][1].type === "labelLink" ? "link" : "image",
37019
+ type: events[open2][1].type === "labelLink" ? "link" : "image",
36307
37020
  start: {
36308
- ...events[open][1].start
37021
+ ...events[open2][1].start
36309
37022
  },
36310
37023
  end: {
36311
37024
  ...events[events.length - 1][1].end
@@ -36314,7 +37027,7 @@ function resolveToLabelEnd(events, context) {
36314
37027
  const label = {
36315
37028
  type: "label",
36316
37029
  start: {
36317
- ...events[open][1].start
37030
+ ...events[open2][1].start
36318
37031
  },
36319
37032
  end: {
36320
37033
  ...events[close][1].end
@@ -36323,20 +37036,20 @@ function resolveToLabelEnd(events, context) {
36323
37036
  const text2 = {
36324
37037
  type: "labelText",
36325
37038
  start: {
36326
- ...events[open + offset2 + 2][1].end
37039
+ ...events[open2 + offset2 + 2][1].end
36327
37040
  },
36328
37041
  end: {
36329
37042
  ...events[close - 2][1].start
36330
37043
  }
36331
37044
  };
36332
37045
  media = [["enter", group, context], ["enter", label, context]];
36333
- media = push(media, events.slice(open + 1, open + offset2 + 3));
37046
+ media = push(media, events.slice(open2 + 1, open2 + offset2 + 3));
36334
37047
  media = push(media, [["enter", text2, context]]);
36335
- media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset2 + 4, close - 3), context));
37048
+ media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open2 + offset2 + 4, close - 3), context));
36336
37049
  media = push(media, [["exit", text2, context], events[close - 2], events[close - 1], ["exit", label, context]]);
36337
37050
  media = push(media, events.slice(close + 1));
36338
37051
  media = push(media, [["exit", group, context]]);
36339
- splice(events, open, events.length, media);
37052
+ splice(events, open2, events.length, media);
36340
37053
  return events;
36341
37054
  }
36342
37055
  function tokenizeLabelEnd(effects, ok2, nok) {
@@ -36479,9 +37192,9 @@ function tokenizeLabelStartImage(effects, ok2, nok) {
36479
37192
  effects.enter("labelImageMarker");
36480
37193
  effects.consume(code2);
36481
37194
  effects.exit("labelImageMarker");
36482
- return open;
37195
+ return open2;
36483
37196
  }
36484
- function open(code2) {
37197
+ function open2(code2) {
36485
37198
  if (code2 === 91) {
36486
37199
  effects.enter("labelMarker");
36487
37200
  effects.consume(code2);
@@ -37081,30 +37794,30 @@ function gfmStrikethrough(options) {
37081
37794
  let index2 = -1;
37082
37795
  while (++index2 < events.length) {
37083
37796
  if (events[index2][0] === "enter" && events[index2][1].type === "strikethroughSequenceTemporary" && events[index2][1]._close) {
37084
- let open = index2;
37085
- while (open--) {
37086
- if (events[open][0] === "exit" && events[open][1].type === "strikethroughSequenceTemporary" && events[open][1]._open && // If the sizes are the same:
37087
- events[index2][1].end.offset - events[index2][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {
37797
+ let open2 = index2;
37798
+ while (open2--) {
37799
+ if (events[open2][0] === "exit" && events[open2][1].type === "strikethroughSequenceTemporary" && events[open2][1]._open && // If the sizes are the same:
37800
+ events[index2][1].end.offset - events[index2][1].start.offset === events[open2][1].end.offset - events[open2][1].start.offset) {
37088
37801
  events[index2][1].type = "strikethroughSequence";
37089
- events[open][1].type = "strikethroughSequence";
37802
+ events[open2][1].type = "strikethroughSequence";
37090
37803
  const strikethrough2 = {
37091
37804
  type: "strikethrough",
37092
- start: Object.assign({}, events[open][1].start),
37805
+ start: Object.assign({}, events[open2][1].start),
37093
37806
  end: Object.assign({}, events[index2][1].end)
37094
37807
  };
37095
37808
  const text2 = {
37096
37809
  type: "strikethroughText",
37097
- start: Object.assign({}, events[open][1].end),
37810
+ start: Object.assign({}, events[open2][1].end),
37098
37811
  end: Object.assign({}, events[index2][1].start)
37099
37812
  };
37100
- const nextEvents = [["enter", strikethrough2, context], ["enter", events[open][1], context], ["exit", events[open][1], context], ["enter", text2, context]];
37813
+ const nextEvents = [["enter", strikethrough2, context], ["enter", events[open2][1], context], ["exit", events[open2][1], context], ["enter", text2, context]];
37101
37814
  const insideSpan2 = context.parser.constructs.insideSpan.null;
37102
37815
  if (insideSpan2) {
37103
- splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan2, events.slice(open + 1, index2), context));
37816
+ splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan2, events.slice(open2 + 1, index2), context));
37104
37817
  }
37105
37818
  splice(nextEvents, nextEvents.length, 0, [["exit", text2, context], ["enter", events[index2][1], context], ["exit", events[index2][1], context], ["exit", strikethrough2, context]]);
37106
- splice(events, open - 1, index2 - open + 3, nextEvents);
37107
- index2 = open + nextEvents.length - 2;
37819
+ splice(events, open2 - 1, index2 - open2 + 3, nextEvents);
37820
+ index2 = open2 + nextEvents.length - 2;
37108
37821
  break;
37109
37822
  }
37110
37823
  }
@@ -37646,8 +38359,8 @@ function gfmTaskListItem() {
37646
38359
  }
37647
38360
  function tokenizeTasklistCheck(effects, ok2, nok) {
37648
38361
  const self2 = this;
37649
- return open;
37650
- function open(code2) {
38362
+ return open2;
38363
+ function open2(code2) {
37651
38364
  if (
37652
38365
  // Exit if there’s stuff before.
37653
38366
  self2.previous !== null || // Exit if not in the first content that is the first child of a list
@@ -40080,8 +40793,8 @@ function compiler(options) {
40080
40793
  return length;
40081
40794
  }
40082
40795
  function opener(create2, and) {
40083
- return open;
40084
- function open(token) {
40796
+ return open2;
40797
+ function open2(token) {
40085
40798
  enter.call(this, create2(token), token);
40086
40799
  if (and) and.call(this, token);
40087
40800
  }
@@ -40113,18 +40826,18 @@ function compiler(options) {
40113
40826
  }
40114
40827
  function exit2(token, onExitError) {
40115
40828
  const node2 = this.stack.pop();
40116
- const open = this.tokenStack.pop();
40117
- if (!open) {
40829
+ const open2 = this.tokenStack.pop();
40830
+ if (!open2) {
40118
40831
  throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({
40119
40832
  start: token.start,
40120
40833
  end: token.end
40121
40834
  }) + "): it’s not open");
40122
- } else if (open[0].type !== token.type) {
40835
+ } else if (open2[0].type !== token.type) {
40123
40836
  if (onExitError) {
40124
- onExitError.call(this, token, open[0]);
40837
+ onExitError.call(this, token, open2[0]);
40125
40838
  } else {
40126
- const handler = open[1] || defaultOnError;
40127
- handler.call(this, token, open[0]);
40839
+ const handler = open2[1] || defaultOnError;
40840
+ handler.call(this, token, open2[0]);
40128
40841
  }
40129
40842
  }
40130
40843
  node2.position.end = point(token.end);
@@ -44100,7 +44813,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
44100
44813
  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 });
44101
44814
  var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
44102
44815
  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 }) });
44103
- var cn$1 = /\n+$/, dn = reactExports.lazy(() => __vitePreload(() => import("./highlighted-body-B3W2YXNL-C5gyMelW.js"), true ? __vite__mapDeps([4,2]) : void 0).then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
44816
+ var cn$1 = /\n+$/, dn = reactExports.lazy(() => __vitePreload(() => import("./highlighted-body-B3W2YXNL-CRgNr0YA.js"), true ? __vite__mapDeps([2,1]) : void 0).then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
44104
44817
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
44105
44818
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
44106
44819
  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 }) })] }) });
@@ -46441,8 +47154,8 @@ function computeTimeMarkers(viewDuration, offset2) {
46441
47154
  }
46442
47155
  return markers2;
46443
47156
  }
46444
- function toViewportFrac(ms, viewStart, range) {
46445
- return Math.min(Math.max((ms - viewStart) / range, 0), 1);
47157
+ function toViewportFrac(ms2, viewStart, range) {
47158
+ return Math.min(Math.max((ms2 - viewStart) / range, 0), 1);
46446
47159
  }
46447
47160
  function computeSpanGaps(spans, viewStart, viewEnd) {
46448
47161
  const range = viewEnd - viewStart;
@@ -49747,8 +50460,8 @@ async function fetchStreams(worldEnv, runId) {
49747
50460
  async function fetchWorkflowsManifest(worldEnv) {
49748
50461
  return rpc("fetchWorkflowsManifest", { worldEnv });
49749
50462
  }
49750
- async function runHealthCheck(worldEnv, endpoint, options) {
49751
- return rpc("runHealthCheck", { worldEnv, endpoint, options });
50463
+ async function runHealthCheck(worldEnv, options) {
50464
+ return rpc("runHealthCheck", { worldEnv, options });
49752
50465
  }
49753
50466
  async function getEncryptionKeyForRun(worldEnv, runId) {
49754
50467
  return rpc("getEncryptionKeyForRun", { worldEnv, runId });
@@ -49855,26 +50568,29 @@ export {
49855
50568
  fetchEventsByCorrelationId as b0,
49856
50569
  isEncryptedData as b1,
49857
50570
  hydrateData as b2,
49858
- getWebRevivers as b3,
49859
- LIVE_UPDATE_INTERVAL_MS as b4,
49860
- getEncryptionKeyForRun as b5,
49861
- StreamViewer as b6,
49862
- composeRefs as b7,
49863
- useFloating as b8,
49864
- offset as b9,
49865
- shift as ba,
49866
- limitShift as bb,
49867
- flip as bc,
49868
- size as bd,
49869
- arrow as be,
49870
- hide as bf,
49871
- autoUpdate as bg,
49872
- cancelRun as bh,
49873
- reenqueueRun as bi,
49874
- wakeUpRun as bj,
49875
- resumeHook as bk,
49876
- fetchHookToken as bl,
49877
- recreateRun as bm,
50571
+ decrypt as b3,
50572
+ deriveRunPayloadKeys as b4,
50573
+ getWebRevivers as b5,
50574
+ LIVE_UPDATE_INTERVAL_MS as b6,
50575
+ getEncryptionKeyForRun as b7,
50576
+ StreamViewer as b8,
50577
+ composeRefs as b9,
50578
+ useFloating as ba,
50579
+ offset as bb,
50580
+ shift as bc,
50581
+ limitShift as bd,
50582
+ flip as be,
50583
+ size as bf,
50584
+ arrow as bg,
50585
+ hide as bh,
50586
+ autoUpdate as bi,
50587
+ VERCEL_403_ERROR_MESSAGE as bj,
50588
+ cancelRun as bk,
50589
+ reenqueueRun as bl,
50590
+ wakeUpRun as bm,
50591
+ resumeHook as bn,
50592
+ fetchHookToken as bo,
50593
+ recreateRun as bp,
49878
50594
  createLucideIcon as c,
49879
50595
  runHealthCheck as d,
49880
50596
  cn as e,