@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.
- package/build/client/assets/{arrow-up-right-Dv3gGqIf.js → arrow-up-right-DDNPFYmg.js} +1 -1
- package/build/client/assets/{entry.client-Q4eUIqMI.js → entry.client-LwI3HNYl.js} +1 -1
- package/build/client/assets/{highlighted-body-B3W2YXNL-C5gyMelW.js → highlighted-body-B3W2YXNL-CRgNr0YA.js} +2 -2
- package/build/client/assets/{home-0OfTSXd1.js → home-BqvW8ODs.js} +6 -7
- package/build/client/assets/{index-Q81MFBxC.js → index-PFjW8YjQ.js} +20 -20
- package/build/client/assets/manifest-7f03c136.js +1 -0
- package/build/client/assets/{mermaid-3ZIDBTTL-C_EWPx9a.js → mermaid-3ZIDBTTL-CMP9Tato.js} +886 -170
- package/build/client/assets/{root-BPK1T9Ck.js → root-2ub-CsWS.js} +11 -30
- package/build/client/assets/{run-detail-CrqNzQ_y.js → run-detail-B1PK-m7y.js} +21 -19
- package/build/client/assets/{workflow-graph-viewer-DrfqsDRu.js → workflow-graph-viewer-DOLwtzSv.js} +2 -3
- package/build/client/assets/{zstd-browser-decoder-Ds2MNSdp.js → zstd-browser-decoder-BAY5XtBl.js} +2 -2
- package/build/server/assets/{app-BSsmG188.js → app-BaJoK9ck.js} +1 -1
- package/build/server/assets/{highlighted-body-B3W2YXNL-C7tx66m_.js → highlighted-body-B3W2YXNL-DE3KXslx.js} +2 -2
- package/build/server/assets/{index-Cnj8rNtV.js → index-M4Ai7vsa.js} +48 -49
- package/build/server/assets/{mermaid-3ZIDBTTL-DStR4R-M.js → mermaid-3ZIDBTTL-DjL45D7x.js} +2 -2
- package/build/server/assets/{server-build-4Pq8AwvA.js → server-build-C11Xqmwk.js} +1964 -1368
- package/build/server/assets/{token-CYc8-6E0.js → token-Ulh8Tdgw.js} +2 -2
- package/build/server/assets/{token-util-D94FNaX0.js → token-util-CiVcDWD3.js} +2 -2
- package/build/server/assets/{zstd-browser-decoder-DXnLXD-w.js → zstd-browser-decoder-tQARkzJ5.js} +2 -2
- package/build/server/index.js +1 -1
- package/package.json +8 -8
- package/build/client/assets/encryption-CLVP4klT.js +0 -51
- package/build/client/assets/index-STTN0-2V.js +0 -306
- package/build/client/assets/manifest-485c4078.js +0 -1
|
@@ -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-
|
|
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-BaJoK9ck.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";
|
|
@@ -33,7 +33,7 @@ import fs$1, { access, readdir, readlink, readFile, mkdir, constants as constant
|
|
|
33
33
|
import { createRequire as createRequire$1 } from "node:module";
|
|
34
34
|
import require$$3, { types as types$3, promisify, inspect } from "node:util";
|
|
35
35
|
import require$$1$3, { AsyncLocalStorage } from "node:async_hooks";
|
|
36
|
-
import os, { homedir } from "node:os";
|
|
36
|
+
import os, { homedir, tmpdir } from "node:os";
|
|
37
37
|
import { promises } from "node:fs";
|
|
38
38
|
import { execFile } from "node:child_process";
|
|
39
39
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
@@ -25563,7 +25563,7 @@ function useFloating(options) {
|
|
|
25563
25563
|
} = {},
|
|
25564
25564
|
transform: transform2 = true,
|
|
25565
25565
|
whileElementsMounted,
|
|
25566
|
-
open
|
|
25566
|
+
open: open2
|
|
25567
25567
|
} = options;
|
|
25568
25568
|
const [data, setData] = reactExports.useState({
|
|
25569
25569
|
x: 0,
|
|
@@ -25599,7 +25599,7 @@ function useFloating(options) {
|
|
|
25599
25599
|
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
25600
25600
|
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
25601
25601
|
const platformRef = useLatestRef(platform2);
|
|
25602
|
-
const openRef = useLatestRef(
|
|
25602
|
+
const openRef = useLatestRef(open2);
|
|
25603
25603
|
const update = reactExports.useCallback(() => {
|
|
25604
25604
|
if (!referenceRef.current || !floatingRef.current) {
|
|
25605
25605
|
return;
|
|
@@ -25630,14 +25630,14 @@ function useFloating(options) {
|
|
|
25630
25630
|
});
|
|
25631
25631
|
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
|
25632
25632
|
index$4(() => {
|
|
25633
|
-
if (
|
|
25633
|
+
if (open2 === false && dataRef.current.isPositioned) {
|
|
25634
25634
|
dataRef.current.isPositioned = false;
|
|
25635
25635
|
setData((data2) => ({
|
|
25636
25636
|
...data2,
|
|
25637
25637
|
isPositioned: false
|
|
25638
25638
|
}));
|
|
25639
25639
|
}
|
|
25640
|
-
}, [
|
|
25640
|
+
}, [open2]);
|
|
25641
25641
|
const isMountedRef = reactExports.useRef(false);
|
|
25642
25642
|
index$4(() => {
|
|
25643
25643
|
isMountedRef.current = true;
|
|
@@ -26378,23 +26378,23 @@ var Tooltip$2 = (props) => {
|
|
|
26378
26378
|
const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
|
|
26379
26379
|
const delayDuration = delayDurationProp ?? providerContext.delayDuration;
|
|
26380
26380
|
const wasOpenDelayedRef = reactExports.useRef(false);
|
|
26381
|
-
const [
|
|
26381
|
+
const [open2, setOpen] = useControllableState$1({
|
|
26382
26382
|
prop: openProp,
|
|
26383
26383
|
defaultProp: defaultOpen ?? false,
|
|
26384
|
-
onChange: (
|
|
26385
|
-
if (
|
|
26384
|
+
onChange: (open22) => {
|
|
26385
|
+
if (open22) {
|
|
26386
26386
|
providerContext.onOpen();
|
|
26387
26387
|
document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
|
|
26388
26388
|
} else {
|
|
26389
26389
|
providerContext.onClose();
|
|
26390
26390
|
}
|
|
26391
|
-
onOpenChange == null ? void 0 : onOpenChange(
|
|
26391
|
+
onOpenChange == null ? void 0 : onOpenChange(open22);
|
|
26392
26392
|
},
|
|
26393
26393
|
caller: TOOLTIP_NAME
|
|
26394
26394
|
});
|
|
26395
26395
|
const stateAttribute = reactExports.useMemo(() => {
|
|
26396
|
-
return
|
|
26397
|
-
}, [
|
|
26396
|
+
return open2 ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
|
|
26397
|
+
}, [open2]);
|
|
26398
26398
|
const handleOpen = reactExports.useCallback(() => {
|
|
26399
26399
|
window.clearTimeout(openTimerRef.current);
|
|
26400
26400
|
openTimerRef.current = 0;
|
|
@@ -26427,7 +26427,7 @@ var Tooltip$2 = (props) => {
|
|
|
26427
26427
|
{
|
|
26428
26428
|
scope: __scopeTooltip,
|
|
26429
26429
|
contentId,
|
|
26430
|
-
open,
|
|
26430
|
+
open: open2,
|
|
26431
26431
|
stateAttribute,
|
|
26432
26432
|
trigger,
|
|
26433
26433
|
onTriggerChange: setTrigger,
|
|
@@ -48196,7 +48196,14 @@ const RunCreatedEventSchema = BaseEventSchema.extend({
|
|
|
48196
48196
|
input: SerializedDataSchema,
|
|
48197
48197
|
executionContext: record(string$3(), any()).optional(),
|
|
48198
48198
|
attributes: record(string$3(), string$3()).optional(),
|
|
48199
|
-
allowReservedAttributes: literal(true).optional()
|
|
48199
|
+
allowReservedAttributes: literal(true).optional(),
|
|
48200
|
+
/**
|
|
48201
|
+
* The run's X25519 public key (base64), stamped by SDKs that support
|
|
48202
|
+
* sealed (`encp`) envelopes. Persisted onto the run entity so that
|
|
48203
|
+
* cross-run writers can seal payloads to this run without holding its
|
|
48204
|
+
* symmetric key. Not secret — see `WorkflowRunBaseSchema`.
|
|
48205
|
+
*/
|
|
48206
|
+
encryptionPublicKey: string$3().optional()
|
|
48200
48207
|
})
|
|
48201
48208
|
});
|
|
48202
48209
|
const RunStartedEventSchema = BaseEventSchema.extend({
|
|
@@ -48207,7 +48214,14 @@ const RunStartedEventSchema = BaseEventSchema.extend({
|
|
|
48207
48214
|
workflowName: string$3().optional(),
|
|
48208
48215
|
executionContext: record(string$3(), any()).optional(),
|
|
48209
48216
|
attributes: record(string$3(), string$3()).optional(),
|
|
48210
|
-
allowReservedAttributes: literal(true).optional()
|
|
48217
|
+
allowReservedAttributes: literal(true).optional(),
|
|
48218
|
+
/**
|
|
48219
|
+
* Mirrors `run_created.eventData.encryptionPublicKey`. Carried here for
|
|
48220
|
+
* the resilient-start path: when the `run_created` write failed, the
|
|
48221
|
+
* server creates the run from this event instead, and without the key
|
|
48222
|
+
* the run would silently lose its ability to receive sealed writes.
|
|
48223
|
+
*/
|
|
48224
|
+
encryptionPublicKey: string$3().optional()
|
|
48211
48225
|
}).optional()
|
|
48212
48226
|
});
|
|
48213
48227
|
const RunCompletedEventSchema = BaseEventSchema.extend({
|
|
@@ -48375,6 +48389,26 @@ const WorkflowRunBaseSchema = object$1({
|
|
|
48375
48389
|
* the attributes-mvp changelog entry.
|
|
48376
48390
|
*/
|
|
48377
48391
|
attributes: record(string$3(), string$3()).default({}),
|
|
48392
|
+
/**
|
|
48393
|
+
* The run's X25519 public key, base64-encoded (~44 chars).
|
|
48394
|
+
*
|
|
48395
|
+
* Lets any party that can read this run seal a payload *to* it without
|
|
48396
|
+
* being able to read the run's data — used for cross-run writes such as a
|
|
48397
|
+
* hook resumption from another deployment, or a child workflow writing into
|
|
48398
|
+
* a forwarded stream. The matching private scalar is never stored: it is
|
|
48399
|
+
* re-derived on demand from the deployment's own key material, so this
|
|
48400
|
+
* field is not secret and its presence does not weaken the run's
|
|
48401
|
+
* confidentiality.
|
|
48402
|
+
*
|
|
48403
|
+
* Stamped at run creation by SDKs that support sealed (`encp`) envelopes.
|
|
48404
|
+
* **Presence is the writer-side gate**: a run only carries a public key if
|
|
48405
|
+
* the runtime that created it could also open sealed payloads, and runs are
|
|
48406
|
+
* pinned to their creating deployment. Writers therefore seal iff this
|
|
48407
|
+
* field is set, and otherwise fall back to fetching the symmetric per-run
|
|
48408
|
+
* key. Absent on runs created by older SDKs, and on worlds that do not
|
|
48409
|
+
* implement `getEncryptionKeyForRun` (encryption disabled).
|
|
48410
|
+
*/
|
|
48411
|
+
encryptionPublicKey: string$3().optional(),
|
|
48378
48412
|
expiredAt: date$2().optional(),
|
|
48379
48413
|
startedAt: date$2().optional(),
|
|
48380
48414
|
completedAt: date$2().optional(),
|
|
@@ -48609,22 +48643,8 @@ function envNumber(name2, fallback, options = {}) {
|
|
|
48609
48643
|
}
|
|
48610
48644
|
return parsed;
|
|
48611
48645
|
}
|
|
48612
|
-
const
|
|
48613
|
-
|
|
48614
|
-
hookId: string$3(),
|
|
48615
|
-
token: string$3(),
|
|
48616
|
-
ownerId: string$3(),
|
|
48617
|
-
projectId: string$3(),
|
|
48618
|
-
environment: string$3(),
|
|
48619
|
-
metadata: SerializedDataSchema.optional(),
|
|
48620
|
-
createdAt: date$2(),
|
|
48621
|
-
// Optional in database for backwards compatibility, defaults to 1 (legacy) when reading
|
|
48622
|
-
specVersion: number$3().optional(),
|
|
48623
|
-
isWebhook: boolean$3().optional(),
|
|
48624
|
-
isSystem: boolean$3().optional()
|
|
48625
|
-
});
|
|
48626
|
-
const QueuePrefix = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_(?:workflow|step)_$/, "Must match __wkf_{workflow|step}_ or __{namespace}_wkf_{workflow|step}_");
|
|
48627
|
-
const ValidQueueName = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_(?:workflow|step)_.+$/, "Must be a valid queue name with a recognized prefix");
|
|
48646
|
+
const QueuePrefix = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_workflow_$/, "Must match __wkf_workflow_ or __{namespace}_wkf_workflow_");
|
|
48647
|
+
const ValidQueueName = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_workflow_.+$/, "Must be a valid queue name with a recognized prefix");
|
|
48628
48648
|
const QueueNamespace = string$3().regex(/^[a-z][a-z0-9]*$/, "Must be lowercase alphanumeric, starting with a letter");
|
|
48629
48649
|
function resolveQueueNamespace(namespace2) {
|
|
48630
48650
|
return namespace2 ?? process.env.WORKFLOW_QUEUE_NAMESPACE ?? void 0;
|
|
@@ -48632,19 +48652,18 @@ function resolveQueueNamespace(namespace2) {
|
|
|
48632
48652
|
function getQueueTopicPrefix(kind, namespace2) {
|
|
48633
48653
|
if (namespace2 !== void 0) {
|
|
48634
48654
|
QueueNamespace.parse(namespace2);
|
|
48635
|
-
return `__${namespace2}
|
|
48655
|
+
return `__${namespace2}_wkf_workflow_`;
|
|
48636
48656
|
}
|
|
48637
|
-
return
|
|
48657
|
+
return "__wkf_workflow_";
|
|
48638
48658
|
}
|
|
48639
48659
|
function parseQueueName(name2) {
|
|
48640
|
-
const match2 = name2.match(/^(__(?:[a-z][a-z0-9]*_)?
|
|
48660
|
+
const match2 = name2.match(/^(__(?:[a-z][a-z0-9]*_)?wkf_workflow_)(.+)$/);
|
|
48641
48661
|
if (!match2) {
|
|
48642
48662
|
throw new Error(`Invalid queue name: ${name2}`);
|
|
48643
48663
|
}
|
|
48644
48664
|
return {
|
|
48645
48665
|
prefix: QueuePrefix.parse(match2[1]),
|
|
48646
|
-
|
|
48647
|
-
id: match2[3]
|
|
48666
|
+
id: match2[2]
|
|
48648
48667
|
};
|
|
48649
48668
|
}
|
|
48650
48669
|
const MessageId = string$3().brand().describe("A stored queue message ID");
|
|
@@ -48683,23 +48702,57 @@ const WorkflowInvokePayloadSchema = object$1({
|
|
|
48683
48702
|
/** Run creation data, only present on the first queue delivery from start() */
|
|
48684
48703
|
runInput: RunInputSchema.optional()
|
|
48685
48704
|
});
|
|
48686
|
-
const StepInvokePayloadSchema = object$1({
|
|
48687
|
-
workflowName: string$3(),
|
|
48688
|
-
workflowRunId: string$3(),
|
|
48689
|
-
workflowStartedAt: number$3(),
|
|
48690
|
-
stepId: string$3(),
|
|
48691
|
-
traceCarrier: TraceCarrierSchema.optional(),
|
|
48692
|
-
requestedAt: date$2().optional()
|
|
48693
|
-
});
|
|
48694
48705
|
const HealthCheckPayloadSchema = object$1({
|
|
48695
48706
|
__healthCheck: literal(true),
|
|
48696
|
-
correlationId: string$3()
|
|
48707
|
+
correlationId: string$3(),
|
|
48708
|
+
/**
|
|
48709
|
+
* The run id the caller is about to create, when the probe is being used to
|
|
48710
|
+
* prepare a cross-deployment `start()`.
|
|
48711
|
+
*
|
|
48712
|
+
* The responder runs inside the target deployment, so it can derive that
|
|
48713
|
+
* run's public key locally from its own key material and return it in the
|
|
48714
|
+
* probe response. That lets the caller seal the workflow arguments without
|
|
48715
|
+
* a separate key lookup. Absent for probes issued for other reasons (CLI
|
|
48716
|
+
* health command, dashboard), in which case no key is returned.
|
|
48717
|
+
*/
|
|
48718
|
+
runId: string$3().optional()
|
|
48697
48719
|
});
|
|
48698
48720
|
const QueuePayloadSchema = union([
|
|
48699
|
-
|
|
48700
|
-
|
|
48701
|
-
HealthCheckPayloadSchema
|
|
48721
|
+
HealthCheckPayloadSchema,
|
|
48722
|
+
WorkflowInvokePayloadSchema
|
|
48702
48723
|
]);
|
|
48724
|
+
const HookResumeContextSchema = object$1({
|
|
48725
|
+
deploymentId: string$3(),
|
|
48726
|
+
workflowName: string$3(),
|
|
48727
|
+
// Named `runSpecVersion` to distinguish it from the hook's own `specVersion`.
|
|
48728
|
+
runSpecVersion: number$3().optional(),
|
|
48729
|
+
workflowCoreVersion: string$3().optional(),
|
|
48730
|
+
traceCarrier: TraceCarrierSchema.optional(),
|
|
48731
|
+
// The run's published X25519 public key (base64), mirrored from the run
|
|
48732
|
+
// entity. Lets a resume seal (`encp`) its payload to the run without reading
|
|
48733
|
+
// the run or fetching its symmetric key. Absent on runs created before
|
|
48734
|
+
// sealed envelopes and on projects with encryption disabled, where the
|
|
48735
|
+
// resume falls back to the symmetric per-run key.
|
|
48736
|
+
encryptionPublicKey: string$3().optional()
|
|
48737
|
+
});
|
|
48738
|
+
const HookSchema = object$1({
|
|
48739
|
+
runId: string$3(),
|
|
48740
|
+
hookId: string$3(),
|
|
48741
|
+
token: string$3(),
|
|
48742
|
+
ownerId: string$3(),
|
|
48743
|
+
projectId: string$3(),
|
|
48744
|
+
environment: string$3(),
|
|
48745
|
+
metadata: SerializedDataSchema.optional(),
|
|
48746
|
+
createdAt: date$2(),
|
|
48747
|
+
// Optional in database for backwards compatibility, defaults to 1 (legacy) when reading
|
|
48748
|
+
specVersion: number$3().optional(),
|
|
48749
|
+
isWebhook: boolean$3().optional(),
|
|
48750
|
+
isSystem: boolean$3().optional(),
|
|
48751
|
+
// Present when the server stored it (new hooks) or synthesized it from the
|
|
48752
|
+
// run (old hooks). Absent only against an old server, where the resume path
|
|
48753
|
+
// falls back to `runs.get`.
|
|
48754
|
+
resumeContext: HookResumeContextSchema.optional()
|
|
48755
|
+
});
|
|
48703
48756
|
async function reenqueueActiveRuns(runs, enqueue, label, namespace2) {
|
|
48704
48757
|
const workflowQueuePrefix = getQueueTopicPrefix("workflow", resolveQueueNamespace(namespace2));
|
|
48705
48758
|
let reenqueued = 0;
|
|
@@ -49505,19 +49558,952 @@ function stringify_primitive(thing) {
|
|
|
49505
49558
|
if (type === "bigint") return `["BigInt","${thing}"]`;
|
|
49506
49559
|
return String(thing);
|
|
49507
49560
|
}
|
|
49561
|
+
function pluralize(singular, plural, count2) {
|
|
49562
|
+
return count2 === 1 ? singular : plural;
|
|
49563
|
+
}
|
|
49564
|
+
function withResolvers$1() {
|
|
49565
|
+
let resolve2;
|
|
49566
|
+
let reject;
|
|
49567
|
+
const promise2 = new Promise((_resolve, _reject) => {
|
|
49568
|
+
resolve2 = _resolve;
|
|
49569
|
+
reject = _reject;
|
|
49570
|
+
});
|
|
49571
|
+
return { promise: promise2, resolve: resolve2, reject };
|
|
49572
|
+
}
|
|
49573
|
+
function once$1(fn2) {
|
|
49574
|
+
const result = {
|
|
49575
|
+
get value() {
|
|
49576
|
+
const value = fn2();
|
|
49577
|
+
Object.defineProperty(result, "value", { value });
|
|
49578
|
+
return value;
|
|
49579
|
+
}
|
|
49580
|
+
};
|
|
49581
|
+
return result;
|
|
49582
|
+
}
|
|
49583
|
+
var ms$1;
|
|
49584
|
+
var hasRequiredMs;
|
|
49585
|
+
function requireMs() {
|
|
49586
|
+
if (hasRequiredMs) return ms$1;
|
|
49587
|
+
hasRequiredMs = 1;
|
|
49588
|
+
var s2 = 1e3;
|
|
49589
|
+
var m2 = s2 * 60;
|
|
49590
|
+
var h2 = m2 * 60;
|
|
49591
|
+
var d2 = h2 * 24;
|
|
49592
|
+
var w2 = d2 * 7;
|
|
49593
|
+
var y2 = d2 * 365.25;
|
|
49594
|
+
ms$1 = function(val, options) {
|
|
49595
|
+
options = options || {};
|
|
49596
|
+
var type = typeof val;
|
|
49597
|
+
if (type === "string" && val.length > 0) {
|
|
49598
|
+
return parse2(val);
|
|
49599
|
+
} else if (type === "number" && isFinite(val)) {
|
|
49600
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
49601
|
+
}
|
|
49602
|
+
throw new Error(
|
|
49603
|
+
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
49604
|
+
);
|
|
49605
|
+
};
|
|
49606
|
+
function parse2(str) {
|
|
49607
|
+
str = String(str);
|
|
49608
|
+
if (str.length > 100) {
|
|
49609
|
+
return;
|
|
49610
|
+
}
|
|
49611
|
+
var match2 = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
49612
|
+
str
|
|
49613
|
+
);
|
|
49614
|
+
if (!match2) {
|
|
49615
|
+
return;
|
|
49616
|
+
}
|
|
49617
|
+
var n = parseFloat(match2[1]);
|
|
49618
|
+
var type = (match2[2] || "ms").toLowerCase();
|
|
49619
|
+
switch (type) {
|
|
49620
|
+
case "years":
|
|
49621
|
+
case "year":
|
|
49622
|
+
case "yrs":
|
|
49623
|
+
case "yr":
|
|
49624
|
+
case "y":
|
|
49625
|
+
return n * y2;
|
|
49626
|
+
case "weeks":
|
|
49627
|
+
case "week":
|
|
49628
|
+
case "w":
|
|
49629
|
+
return n * w2;
|
|
49630
|
+
case "days":
|
|
49631
|
+
case "day":
|
|
49632
|
+
case "d":
|
|
49633
|
+
return n * d2;
|
|
49634
|
+
case "hours":
|
|
49635
|
+
case "hour":
|
|
49636
|
+
case "hrs":
|
|
49637
|
+
case "hr":
|
|
49638
|
+
case "h":
|
|
49639
|
+
return n * h2;
|
|
49640
|
+
case "minutes":
|
|
49641
|
+
case "minute":
|
|
49642
|
+
case "mins":
|
|
49643
|
+
case "min":
|
|
49644
|
+
case "m":
|
|
49645
|
+
return n * m2;
|
|
49646
|
+
case "seconds":
|
|
49647
|
+
case "second":
|
|
49648
|
+
case "secs":
|
|
49649
|
+
case "sec":
|
|
49650
|
+
case "s":
|
|
49651
|
+
return n * s2;
|
|
49652
|
+
case "milliseconds":
|
|
49653
|
+
case "millisecond":
|
|
49654
|
+
case "msecs":
|
|
49655
|
+
case "msec":
|
|
49656
|
+
case "ms":
|
|
49657
|
+
return n;
|
|
49658
|
+
default:
|
|
49659
|
+
return void 0;
|
|
49660
|
+
}
|
|
49661
|
+
}
|
|
49662
|
+
function fmtShort(ms2) {
|
|
49663
|
+
var msAbs = Math.abs(ms2);
|
|
49664
|
+
if (msAbs >= d2) {
|
|
49665
|
+
return Math.round(ms2 / d2) + "d";
|
|
49666
|
+
}
|
|
49667
|
+
if (msAbs >= h2) {
|
|
49668
|
+
return Math.round(ms2 / h2) + "h";
|
|
49669
|
+
}
|
|
49670
|
+
if (msAbs >= m2) {
|
|
49671
|
+
return Math.round(ms2 / m2) + "m";
|
|
49672
|
+
}
|
|
49673
|
+
if (msAbs >= s2) {
|
|
49674
|
+
return Math.round(ms2 / s2) + "s";
|
|
49675
|
+
}
|
|
49676
|
+
return ms2 + "ms";
|
|
49677
|
+
}
|
|
49678
|
+
function fmtLong(ms2) {
|
|
49679
|
+
var msAbs = Math.abs(ms2);
|
|
49680
|
+
if (msAbs >= d2) {
|
|
49681
|
+
return plural(ms2, msAbs, d2, "day");
|
|
49682
|
+
}
|
|
49683
|
+
if (msAbs >= h2) {
|
|
49684
|
+
return plural(ms2, msAbs, h2, "hour");
|
|
49685
|
+
}
|
|
49686
|
+
if (msAbs >= m2) {
|
|
49687
|
+
return plural(ms2, msAbs, m2, "minute");
|
|
49688
|
+
}
|
|
49689
|
+
if (msAbs >= s2) {
|
|
49690
|
+
return plural(ms2, msAbs, s2, "second");
|
|
49691
|
+
}
|
|
49692
|
+
return ms2 + " ms";
|
|
49693
|
+
}
|
|
49694
|
+
function plural(ms2, msAbs, n, name2) {
|
|
49695
|
+
var isPlural = msAbs >= n * 1.5;
|
|
49696
|
+
return Math.round(ms2 / n) + " " + name2 + (isPlural ? "s" : "");
|
|
49697
|
+
}
|
|
49698
|
+
return ms$1;
|
|
49699
|
+
}
|
|
49700
|
+
var msExports = requireMs();
|
|
49701
|
+
const ms = /* @__PURE__ */ getDefaultExportFromCjs(msExports);
|
|
49702
|
+
function parseDurationToDate(param) {
|
|
49703
|
+
if (typeof param === "string") {
|
|
49704
|
+
const durationMs = ms(param);
|
|
49705
|
+
if (typeof durationMs !== "number" || durationMs < 0) {
|
|
49706
|
+
throw new Error(`Invalid duration: "${param}". Expected a valid duration string like "1s", "1m", "1h", etc.`);
|
|
49707
|
+
}
|
|
49708
|
+
return new Date(Date.now() + durationMs);
|
|
49709
|
+
} else if (typeof param === "number") {
|
|
49710
|
+
if (param < 0 || !Number.isFinite(param)) {
|
|
49711
|
+
throw new Error(`Invalid duration: ${param}. Expected a non-negative finite number of milliseconds.`);
|
|
49712
|
+
}
|
|
49713
|
+
return new Date(Date.now() + param);
|
|
49714
|
+
} else if (param instanceof Date || param && typeof param === "object" && typeof param.getTime === "function") {
|
|
49715
|
+
return param instanceof Date ? param : new Date(param.getTime());
|
|
49716
|
+
} else {
|
|
49717
|
+
throw new Error(`Invalid duration parameter. Expected a duration string, number (milliseconds), or Date object.`);
|
|
49718
|
+
}
|
|
49719
|
+
}
|
|
49720
|
+
const WORKFLOW_ROUTE_BASE = "/.well-known/workflow/v1";
|
|
49721
|
+
const BASE_PATH_SYMBOL = Symbol.for("@workflow/core/basePath");
|
|
49722
|
+
const globalConfig = globalThis;
|
|
49723
|
+
function getWorkflowBasePath() {
|
|
49724
|
+
return globalConfig[BASE_PATH_SYMBOL] ?? "";
|
|
49725
|
+
}
|
|
49726
|
+
function createWorkflowBaseUrl(origin) {
|
|
49727
|
+
new URL(origin);
|
|
49728
|
+
return `${origin.replace(/[?#].*$/, "").replace(/\/+$/, "")}${getWorkflowBasePath()}`;
|
|
49729
|
+
}
|
|
49730
|
+
function createWorkflowUrl(baseUrl, route) {
|
|
49731
|
+
const url2 = new URL(baseUrl);
|
|
49732
|
+
url2.pathname = `${url2.pathname.replace(/\/+$/, "")}${WORKFLOW_ROUTE_BASE}/${getWorkflowRouteEndpoint(route)}`;
|
|
49733
|
+
url2.search = route.type === "health" ? "__health" : "";
|
|
49734
|
+
url2.hash = "";
|
|
49735
|
+
return url2.toString();
|
|
49736
|
+
}
|
|
49737
|
+
function getWorkflowRouteEndpoint(route) {
|
|
49738
|
+
switch (route.type) {
|
|
49739
|
+
case "flow":
|
|
49740
|
+
case "health":
|
|
49741
|
+
return "flow";
|
|
49742
|
+
case "manifest":
|
|
49743
|
+
return "manifest.json";
|
|
49744
|
+
case "webhook":
|
|
49745
|
+
return `webhook/${encodeURIComponent(route.token)}`;
|
|
49746
|
+
}
|
|
49747
|
+
throw new Error(`Unsupported workflow route: ${String(route.type)}`);
|
|
49748
|
+
}
|
|
49749
|
+
function createWorkflowHealthEndpoint() {
|
|
49750
|
+
return `${getWorkflowBasePath()}${WORKFLOW_ROUTE_BASE}/flow?__health`;
|
|
49751
|
+
}
|
|
49752
|
+
function isVercelDeploymentEnv(env2 = process.env) {
|
|
49753
|
+
if (env2.VERCEL_DEPLOYMENT_ID) {
|
|
49754
|
+
return true;
|
|
49755
|
+
}
|
|
49756
|
+
if (env2.VERCEL !== "1") {
|
|
49757
|
+
return false;
|
|
49758
|
+
}
|
|
49759
|
+
return env2.VERCEL_ENV !== "development" && env2.NODE_ENV !== "development";
|
|
49760
|
+
}
|
|
49761
|
+
const BASE_URL = "https://workflow-sdk.dev/err";
|
|
49762
|
+
function isError(value) {
|
|
49763
|
+
return typeof value === "object" && value !== null && "name" in value && "message" in value;
|
|
49764
|
+
}
|
|
49765
|
+
function appendFramedDetails(title, details) {
|
|
49766
|
+
if (details.length === 0)
|
|
49767
|
+
return title;
|
|
49768
|
+
const lines = [title];
|
|
49769
|
+
details.forEach((detail, index2) => {
|
|
49770
|
+
const isLast = index2 === details.length - 1;
|
|
49771
|
+
const head = isLast ? "╰▶ " : "├▶ ";
|
|
49772
|
+
const cont = isLast ? " " : "│ ";
|
|
49773
|
+
const text2 = `${detail.label}: ${detail.value}`;
|
|
49774
|
+
text2.split("\n").forEach((line, i) => lines.push(`${i === 0 ? head : cont}${line}`));
|
|
49775
|
+
});
|
|
49776
|
+
return lines.join("\n");
|
|
49777
|
+
}
|
|
49778
|
+
function buildFramedDetails(hint2, slug) {
|
|
49779
|
+
const out = [];
|
|
49780
|
+
if (hint2)
|
|
49781
|
+
out.push({ label: "hint", value: hint2 });
|
|
49782
|
+
if (slug)
|
|
49783
|
+
out.push({ label: "docs", value: `${BASE_URL}/${slug}` });
|
|
49784
|
+
return out;
|
|
49785
|
+
}
|
|
49786
|
+
const ERROR_SLUGS = {
|
|
49787
|
+
WEBHOOK_INVALID_RESPOND_WITH_VALUE: "webhook-invalid-respond-with-value",
|
|
49788
|
+
WEBHOOK_RESPONSE_NOT_SENT: "webhook-response-not-sent",
|
|
49789
|
+
HOOK_CONFLICT: "hook-conflict",
|
|
49790
|
+
RUNTIME_DECRYPTION_FAILED: "runtime-decryption-failed"
|
|
49791
|
+
};
|
|
49792
|
+
class WorkflowError extends Error {
|
|
49793
|
+
constructor(message2, options) {
|
|
49794
|
+
const msgDocs = appendFramedDetails(message2, buildFramedDetails(void 0, options == null ? void 0 : options.slug));
|
|
49795
|
+
super(msgDocs, { cause: options == null ? void 0 : options.cause });
|
|
49796
|
+
__publicField(this, "cause");
|
|
49797
|
+
if ((options == null ? void 0 : options.cause) !== void 0) {
|
|
49798
|
+
this.cause = options.cause;
|
|
49799
|
+
}
|
|
49800
|
+
if ((options == null ? void 0 : options.cause) instanceof Error) {
|
|
49801
|
+
this.stack = `${this.stack}
|
|
49802
|
+
Caused by: ${options.cause.stack}`;
|
|
49803
|
+
}
|
|
49804
|
+
}
|
|
49805
|
+
static is(value) {
|
|
49806
|
+
return isError(value) && value.name === "WorkflowError";
|
|
49807
|
+
}
|
|
49808
|
+
}
|
|
49809
|
+
class WorkflowWorldError extends WorkflowError {
|
|
49810
|
+
constructor(message2, options) {
|
|
49811
|
+
super(message2, {
|
|
49812
|
+
cause: options == null ? void 0 : options.cause
|
|
49813
|
+
});
|
|
49814
|
+
__publicField(this, "status");
|
|
49815
|
+
__publicField(this, "code");
|
|
49816
|
+
__publicField(this, "url");
|
|
49817
|
+
/** Retry-After value in seconds, present on 429 and 425 responses */
|
|
49818
|
+
__publicField(this, "retryAfter");
|
|
49819
|
+
this.name = "WorkflowWorldError";
|
|
49820
|
+
this.status = options == null ? void 0 : options.status;
|
|
49821
|
+
this.code = options == null ? void 0 : options.code;
|
|
49822
|
+
this.url = options == null ? void 0 : options.url;
|
|
49823
|
+
this.retryAfter = options == null ? void 0 : options.retryAfter;
|
|
49824
|
+
}
|
|
49825
|
+
static is(value) {
|
|
49826
|
+
return isError(value) && value.name === "WorkflowWorldError";
|
|
49827
|
+
}
|
|
49828
|
+
}
|
|
49829
|
+
class WorkflowRunFailedError extends WorkflowError {
|
|
49830
|
+
constructor(runId, error2, options = {}) {
|
|
49831
|
+
const message2 = error2 instanceof Error ? error2.message : typeof error2 === "string" ? error2 : error2 && typeof error2 === "object" && "message" in error2 ? String(error2.message) : "Unknown error";
|
|
49832
|
+
super(`Workflow run "${runId}" failed: ${message2}`, {
|
|
49833
|
+
cause: error2
|
|
49834
|
+
});
|
|
49835
|
+
__publicField(this, "runId");
|
|
49836
|
+
/**
|
|
49837
|
+
* The high-level error category (e.g. USER_ERROR, RUNTIME_ERROR) for the
|
|
49838
|
+
* failed run, from the run_failed event's `errorCode` field.
|
|
49839
|
+
*/
|
|
49840
|
+
__publicField(this, "errorCode");
|
|
49841
|
+
this.name = "WorkflowRunFailedError";
|
|
49842
|
+
this.runId = runId;
|
|
49843
|
+
if (options.errorCode !== void 0) {
|
|
49844
|
+
this.errorCode = options.errorCode;
|
|
49845
|
+
}
|
|
49846
|
+
}
|
|
49847
|
+
static is(value) {
|
|
49848
|
+
return isError(value) && value.name === "WorkflowRunFailedError";
|
|
49849
|
+
}
|
|
49850
|
+
}
|
|
49851
|
+
class WorkflowRunNotCompletedError extends WorkflowError {
|
|
49852
|
+
constructor(runId, status) {
|
|
49853
|
+
super(`Workflow run "${runId}" has not completed`, {});
|
|
49854
|
+
__publicField(this, "runId");
|
|
49855
|
+
__publicField(this, "status");
|
|
49856
|
+
this.name = "WorkflowRunNotCompletedError";
|
|
49857
|
+
this.runId = runId;
|
|
49858
|
+
this.status = status;
|
|
49859
|
+
}
|
|
49860
|
+
static is(value) {
|
|
49861
|
+
return isError(value) && value.name === "WorkflowRunNotCompletedError";
|
|
49862
|
+
}
|
|
49863
|
+
}
|
|
49864
|
+
class WorkflowRuntimeError extends WorkflowError {
|
|
49865
|
+
constructor(message2, options) {
|
|
49866
|
+
super(message2, {
|
|
49867
|
+
...options
|
|
49868
|
+
});
|
|
49869
|
+
this.name = "WorkflowRuntimeError";
|
|
49870
|
+
}
|
|
49871
|
+
static is(value) {
|
|
49872
|
+
return isError(value) && value.name === "WorkflowRuntimeError";
|
|
49873
|
+
}
|
|
49874
|
+
}
|
|
49875
|
+
class RuntimeDecryptionError extends WorkflowRuntimeError {
|
|
49876
|
+
constructor(message2, options) {
|
|
49877
|
+
super(message2, {
|
|
49878
|
+
cause: options == null ? void 0 : options.cause,
|
|
49879
|
+
slug: ERROR_SLUGS.RUNTIME_DECRYPTION_FAILED
|
|
49880
|
+
});
|
|
49881
|
+
this.name = "RuntimeDecryptionError";
|
|
49882
|
+
if ((options == null ? void 0 : options.context) !== void 0) {
|
|
49883
|
+
this.context = options.context;
|
|
49884
|
+
}
|
|
49885
|
+
}
|
|
49886
|
+
static is(value) {
|
|
49887
|
+
return isError(value) && value.name === "RuntimeDecryptionError";
|
|
49888
|
+
}
|
|
49889
|
+
}
|
|
49890
|
+
class SerializationError extends WorkflowError {
|
|
49891
|
+
constructor(message2, options) {
|
|
49892
|
+
const body2 = appendFramedDetails(message2, buildFramedDetails(options == null ? void 0 : options.hint, void 0));
|
|
49893
|
+
super(body2, { cause: options == null ? void 0 : options.cause });
|
|
49894
|
+
__publicField(this, "hint");
|
|
49895
|
+
/**
|
|
49896
|
+
* Serialization errors are deterministic — if a step returns a non-POJO,
|
|
49897
|
+
* replaying the step will always produce the same non-serializable value.
|
|
49898
|
+
* Retrying is guaranteed to fail, so these errors are surfaced as fatal
|
|
49899
|
+
* and skip the step-retry loop. `FatalError.is()` recognizes any error
|
|
49900
|
+
* with `fatal: true` (see `packages/errors/src/index.ts`), so no other
|
|
49901
|
+
* wiring is required for user-thrown SerializationErrors.
|
|
49902
|
+
*/
|
|
49903
|
+
__publicField(this, "fatal", true);
|
|
49904
|
+
this.name = "SerializationError";
|
|
49905
|
+
this.hint = options == null ? void 0 : options.hint;
|
|
49906
|
+
}
|
|
49907
|
+
static is(value) {
|
|
49908
|
+
return isError(value) && value.name === "SerializationError";
|
|
49909
|
+
}
|
|
49910
|
+
}
|
|
49911
|
+
class WorkflowRunNotFoundError extends WorkflowError {
|
|
49912
|
+
constructor(runId) {
|
|
49913
|
+
super(`Workflow run "${runId}" not found`, {});
|
|
49914
|
+
__publicField(this, "runId");
|
|
49915
|
+
this.name = "WorkflowRunNotFoundError";
|
|
49916
|
+
this.runId = runId;
|
|
49917
|
+
}
|
|
49918
|
+
static is(value) {
|
|
49919
|
+
return isError(value) && value.name === "WorkflowRunNotFoundError";
|
|
49920
|
+
}
|
|
49921
|
+
}
|
|
49922
|
+
class HookConflictError extends WorkflowError {
|
|
49923
|
+
constructor(token, conflictingRunId) {
|
|
49924
|
+
super(`Hook token "${token}" is already in use by another workflow${conflictingRunId ? ` (run "${conflictingRunId}")` : ""}`, {
|
|
49925
|
+
slug: ERROR_SLUGS.HOOK_CONFLICT
|
|
49926
|
+
});
|
|
49927
|
+
__publicField(this, "token");
|
|
49928
|
+
// TODO: Make this required once all persisted hook_conflict events and World
|
|
49929
|
+
// implementations always include the active hook owner's run ID.
|
|
49930
|
+
__publicField(this, "conflictingRunId");
|
|
49931
|
+
this.name = "HookConflictError";
|
|
49932
|
+
this.token = token;
|
|
49933
|
+
if (conflictingRunId !== void 0) {
|
|
49934
|
+
this.conflictingRunId = conflictingRunId;
|
|
49935
|
+
}
|
|
49936
|
+
}
|
|
49937
|
+
static is(value) {
|
|
49938
|
+
return isError(value) && value.name === "HookConflictError";
|
|
49939
|
+
}
|
|
49940
|
+
}
|
|
49941
|
+
class HookNotFoundError extends WorkflowError {
|
|
49942
|
+
constructor(token) {
|
|
49943
|
+
super("Hook not found", {});
|
|
49944
|
+
__publicField(this, "token");
|
|
49945
|
+
this.name = "HookNotFoundError";
|
|
49946
|
+
this.token = token;
|
|
49947
|
+
}
|
|
49948
|
+
static is(value) {
|
|
49949
|
+
return isError(value) && value.name === "HookNotFoundError";
|
|
49950
|
+
}
|
|
49951
|
+
}
|
|
49952
|
+
class EntityConflictError extends WorkflowWorldError {
|
|
49953
|
+
constructor(message2) {
|
|
49954
|
+
super(message2);
|
|
49955
|
+
this.name = "EntityConflictError";
|
|
49956
|
+
}
|
|
49957
|
+
static is(value) {
|
|
49958
|
+
return isError(value) && value.name === "EntityConflictError";
|
|
49959
|
+
}
|
|
49960
|
+
}
|
|
49961
|
+
class RunExpiredError extends WorkflowWorldError {
|
|
49962
|
+
constructor(message2) {
|
|
49963
|
+
super(message2);
|
|
49964
|
+
this.name = "RunExpiredError";
|
|
49965
|
+
}
|
|
49966
|
+
static is(value) {
|
|
49967
|
+
return isError(value) && value.name === "RunExpiredError";
|
|
49968
|
+
}
|
|
49969
|
+
}
|
|
49970
|
+
class TooEarlyError extends WorkflowWorldError {
|
|
49971
|
+
constructor(message2, options) {
|
|
49972
|
+
super(message2, { retryAfter: options == null ? void 0 : options.retryAfter });
|
|
49973
|
+
this.name = "TooEarlyError";
|
|
49974
|
+
}
|
|
49975
|
+
static is(value) {
|
|
49976
|
+
return isError(value) && value.name === "TooEarlyError";
|
|
49977
|
+
}
|
|
49978
|
+
}
|
|
49979
|
+
class ThrottleError extends WorkflowWorldError {
|
|
49980
|
+
constructor(message2, options) {
|
|
49981
|
+
super(message2);
|
|
49982
|
+
__publicField(this, "retryAfter");
|
|
49983
|
+
this.name = "ThrottleError";
|
|
49984
|
+
this.retryAfter = options == null ? void 0 : options.retryAfter;
|
|
49985
|
+
}
|
|
49986
|
+
static is(value) {
|
|
49987
|
+
return isError(value) && value.name === "ThrottleError";
|
|
49988
|
+
}
|
|
49989
|
+
}
|
|
49990
|
+
class PreconditionFailedError extends WorkflowWorldError {
|
|
49991
|
+
constructor(message2, options) {
|
|
49992
|
+
super(message2, { status: 412, retryAfter: options == null ? void 0 : options.retryAfter });
|
|
49993
|
+
this.name = "PreconditionFailedError";
|
|
49994
|
+
}
|
|
49995
|
+
static is(value) {
|
|
49996
|
+
return isError(value) && value.name === "PreconditionFailedError";
|
|
49997
|
+
}
|
|
49998
|
+
}
|
|
49999
|
+
class WorkflowRunCancelledError extends WorkflowError {
|
|
50000
|
+
constructor(runId) {
|
|
50001
|
+
super(`Workflow run "${runId}" cancelled`, {});
|
|
50002
|
+
__publicField(this, "runId");
|
|
50003
|
+
this.name = "WorkflowRunCancelledError";
|
|
50004
|
+
this.runId = runId;
|
|
50005
|
+
}
|
|
50006
|
+
static is(value) {
|
|
50007
|
+
return isError(value) && value.name === "WorkflowRunCancelledError";
|
|
50008
|
+
}
|
|
50009
|
+
}
|
|
50010
|
+
class RunNotSupportedError extends WorkflowError {
|
|
50011
|
+
constructor(runSpecVersion, worldSpecVersion) {
|
|
50012
|
+
super(`Run requires spec version ${runSpecVersion}, but world supports version ${worldSpecVersion}. Please upgrade 'workflow' package.`);
|
|
50013
|
+
__publicField(this, "runSpecVersion");
|
|
50014
|
+
__publicField(this, "worldSpecVersion");
|
|
50015
|
+
this.name = "RunNotSupportedError";
|
|
50016
|
+
this.runSpecVersion = runSpecVersion;
|
|
50017
|
+
this.worldSpecVersion = worldSpecVersion;
|
|
50018
|
+
}
|
|
50019
|
+
static is(value) {
|
|
50020
|
+
return isError(value) && value.name === "RunNotSupportedError";
|
|
50021
|
+
}
|
|
50022
|
+
}
|
|
50023
|
+
class FatalError extends Error {
|
|
50024
|
+
constructor(message2) {
|
|
50025
|
+
super(message2);
|
|
50026
|
+
__publicField(this, "fatal", true);
|
|
50027
|
+
this.name = "FatalError";
|
|
50028
|
+
}
|
|
50029
|
+
static is(value) {
|
|
50030
|
+
if (!isError(value))
|
|
50031
|
+
return false;
|
|
50032
|
+
if (value.name === "FatalError")
|
|
50033
|
+
return true;
|
|
50034
|
+
return value.fatal === true;
|
|
50035
|
+
}
|
|
50036
|
+
}
|
|
50037
|
+
class RetryableError extends Error {
|
|
50038
|
+
constructor(message2, options = {}) {
|
|
50039
|
+
super(message2);
|
|
50040
|
+
/**
|
|
50041
|
+
* The Date when the step should be retried.
|
|
50042
|
+
*/
|
|
50043
|
+
__publicField(this, "retryAfter");
|
|
50044
|
+
this.name = "RetryableError";
|
|
50045
|
+
if (options.retryAfter !== void 0) {
|
|
50046
|
+
this.retryAfter = parseDurationToDate(options.retryAfter);
|
|
50047
|
+
} else {
|
|
50048
|
+
this.retryAfter = new Date(Date.now() + 1e3);
|
|
50049
|
+
}
|
|
50050
|
+
}
|
|
50051
|
+
static is(value) {
|
|
50052
|
+
return isError(value) && value.name === "RetryableError";
|
|
50053
|
+
}
|
|
50054
|
+
}
|
|
50055
|
+
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.";
|
|
50056
|
+
const FATAL_ERROR_KEY = Symbol.for("@workflow/errors//FatalError");
|
|
50057
|
+
const RETRYABLE_ERROR_KEY = Symbol.for("@workflow/errors//RetryableError");
|
|
50058
|
+
const HOOK_CONFLICT_ERROR_KEY = Symbol.for("@workflow/errors//HookConflictError");
|
|
50059
|
+
const RUNTIME_DECRYPTION_ERROR_KEY = Symbol.for("@workflow/errors//RuntimeDecryptionError");
|
|
50060
|
+
if (typeof globalThis !== "undefined") {
|
|
50061
|
+
if (!Object.hasOwn(globalThis, FATAL_ERROR_KEY)) {
|
|
50062
|
+
Object.defineProperty(globalThis, FATAL_ERROR_KEY, {
|
|
50063
|
+
value: FatalError,
|
|
50064
|
+
writable: false,
|
|
50065
|
+
enumerable: false,
|
|
50066
|
+
configurable: false
|
|
50067
|
+
});
|
|
50068
|
+
}
|
|
50069
|
+
if (!Object.hasOwn(globalThis, RETRYABLE_ERROR_KEY)) {
|
|
50070
|
+
Object.defineProperty(globalThis, RETRYABLE_ERROR_KEY, {
|
|
50071
|
+
value: RetryableError,
|
|
50072
|
+
writable: false,
|
|
50073
|
+
enumerable: false,
|
|
50074
|
+
configurable: false
|
|
50075
|
+
});
|
|
50076
|
+
}
|
|
50077
|
+
if (!Object.hasOwn(globalThis, HOOK_CONFLICT_ERROR_KEY)) {
|
|
50078
|
+
Object.defineProperty(globalThis, HOOK_CONFLICT_ERROR_KEY, {
|
|
50079
|
+
value: HookConflictError,
|
|
50080
|
+
writable: false,
|
|
50081
|
+
enumerable: false,
|
|
50082
|
+
configurable: false
|
|
50083
|
+
});
|
|
50084
|
+
}
|
|
50085
|
+
if (!Object.hasOwn(globalThis, RUNTIME_DECRYPTION_ERROR_KEY)) {
|
|
50086
|
+
Object.defineProperty(globalThis, RUNTIME_DECRYPTION_ERROR_KEY, {
|
|
50087
|
+
value: RuntimeDecryptionError,
|
|
50088
|
+
writable: false,
|
|
50089
|
+
enumerable: false,
|
|
50090
|
+
configurable: false
|
|
50091
|
+
});
|
|
50092
|
+
}
|
|
50093
|
+
}
|
|
50094
|
+
const NONCE_LENGTH = 12;
|
|
50095
|
+
const TAG_LENGTH = 128;
|
|
50096
|
+
const TAG_BYTES = TAG_LENGTH / 8;
|
|
50097
|
+
const KEY_LENGTH = 32;
|
|
50098
|
+
async function importKey(raw2, usages = ["encrypt", "decrypt"]) {
|
|
50099
|
+
if (raw2.byteLength !== KEY_LENGTH) {
|
|
50100
|
+
throw new WorkflowRuntimeError(`Encryption key must be exactly ${KEY_LENGTH} bytes, got ${raw2.byteLength}`);
|
|
50101
|
+
}
|
|
50102
|
+
return globalThis.crypto.subtle.importKey(
|
|
50103
|
+
"raw",
|
|
50104
|
+
raw2,
|
|
50105
|
+
"AES-GCM",
|
|
50106
|
+
false,
|
|
50107
|
+
// `KeyUsage` is a DOM-lib type that's not in scope under `es2022`.
|
|
50108
|
+
// The `ReadonlyArray<'encrypt' | 'decrypt'>` parameter type matches
|
|
50109
|
+
// a strict subset of `KeyUsage[]`, so this cast is sound.
|
|
50110
|
+
usages
|
|
50111
|
+
);
|
|
50112
|
+
}
|
|
50113
|
+
async function encrypt$1(key, data, aad) {
|
|
50114
|
+
const nonce = globalThis.crypto.getRandomValues(new Uint8Array(NONCE_LENGTH));
|
|
50115
|
+
let ciphertext;
|
|
50116
|
+
try {
|
|
50117
|
+
ciphertext = await globalThis.crypto.subtle.encrypt({
|
|
50118
|
+
name: "AES-GCM",
|
|
50119
|
+
iv: nonce,
|
|
50120
|
+
tagLength: TAG_LENGTH,
|
|
50121
|
+
...aad ? { additionalData: aad } : {}
|
|
50122
|
+
}, key, data);
|
|
50123
|
+
} catch (cause) {
|
|
50124
|
+
throw new RuntimeDecryptionError(`AES-256-GCM encryption failed: ${cause instanceof Error ? cause.message : String(cause)}`, {
|
|
50125
|
+
cause,
|
|
50126
|
+
context: {
|
|
50127
|
+
operation: "encrypt",
|
|
50128
|
+
byteLength: data.byteLength
|
|
50129
|
+
}
|
|
50130
|
+
});
|
|
50131
|
+
}
|
|
50132
|
+
const result = new Uint8Array(NONCE_LENGTH + ciphertext.byteLength);
|
|
50133
|
+
result.set(nonce, 0);
|
|
50134
|
+
result.set(new Uint8Array(ciphertext), NONCE_LENGTH);
|
|
50135
|
+
return result;
|
|
50136
|
+
}
|
|
50137
|
+
async function decrypt$1(key, data, aad) {
|
|
50138
|
+
const minLength = NONCE_LENGTH + TAG_LENGTH / 8;
|
|
50139
|
+
if (data.byteLength < minLength) {
|
|
50140
|
+
throw new RuntimeDecryptionError(`Encrypted data too short: expected at least ${minLength} bytes, got ${data.byteLength}`, {
|
|
50141
|
+
context: {
|
|
50142
|
+
operation: "decrypt",
|
|
50143
|
+
byteLength: data.byteLength
|
|
50144
|
+
}
|
|
50145
|
+
});
|
|
50146
|
+
}
|
|
50147
|
+
const nonce = data.subarray(0, NONCE_LENGTH);
|
|
50148
|
+
const ciphertext = data.subarray(NONCE_LENGTH);
|
|
50149
|
+
let plaintext;
|
|
50150
|
+
try {
|
|
50151
|
+
plaintext = await globalThis.crypto.subtle.decrypt({
|
|
50152
|
+
name: "AES-GCM",
|
|
50153
|
+
iv: nonce,
|
|
50154
|
+
tagLength: TAG_LENGTH,
|
|
50155
|
+
...aad ? { additionalData: aad } : {}
|
|
50156
|
+
}, key, ciphertext);
|
|
50157
|
+
} catch (cause) {
|
|
50158
|
+
const causeMsg = cause instanceof Error ? cause.message : String(cause);
|
|
50159
|
+
throw new RuntimeDecryptionError(`AES-256-GCM decryption failed: ${causeMsg}`, {
|
|
50160
|
+
cause,
|
|
50161
|
+
context: {
|
|
50162
|
+
operation: "decrypt",
|
|
50163
|
+
byteLength: data.byteLength
|
|
50164
|
+
}
|
|
50165
|
+
});
|
|
50166
|
+
}
|
|
50167
|
+
return new Uint8Array(plaintext);
|
|
50168
|
+
}
|
|
50169
|
+
const X25519_KEY_LENGTH = 32;
|
|
50170
|
+
const CONTENT_KEY_LENGTH = 32;
|
|
50171
|
+
const SCALAR_INFO = "workflow/encp/x25519/v1";
|
|
50172
|
+
const CONTENT_KEY_INFO = "workflow/encp/aes256gcm/v1";
|
|
50173
|
+
const PKCS8_X25519_PREFIX = new Uint8Array([
|
|
50174
|
+
48,
|
|
50175
|
+
46,
|
|
50176
|
+
2,
|
|
50177
|
+
1,
|
|
50178
|
+
0,
|
|
50179
|
+
48,
|
|
50180
|
+
5,
|
|
50181
|
+
6,
|
|
50182
|
+
3,
|
|
50183
|
+
43,
|
|
50184
|
+
101,
|
|
50185
|
+
110,
|
|
50186
|
+
4,
|
|
50187
|
+
34,
|
|
50188
|
+
4,
|
|
50189
|
+
32
|
|
50190
|
+
]);
|
|
50191
|
+
const infoEncoder = new TextEncoder();
|
|
50192
|
+
function assertKeyMaterialLength(runKeyMaterial) {
|
|
50193
|
+
if (runKeyMaterial.byteLength !== CONTENT_KEY_LENGTH) {
|
|
50194
|
+
throw new WorkflowRuntimeError(`Run key material must be exactly ${CONTENT_KEY_LENGTH} bytes, got ${runKeyMaterial.byteLength}`);
|
|
50195
|
+
}
|
|
50196
|
+
}
|
|
50197
|
+
function assertPublicKeyLength(publicKey, label) {
|
|
50198
|
+
if (publicKey.byteLength !== X25519_KEY_LENGTH) {
|
|
50199
|
+
throw new WorkflowRuntimeError(`${label} must be exactly ${X25519_KEY_LENGTH} bytes, got ${publicKey.byteLength}`);
|
|
50200
|
+
}
|
|
50201
|
+
}
|
|
50202
|
+
async function deriveRunKeyPair(runKeyMaterial) {
|
|
50203
|
+
assertKeyMaterialLength(runKeyMaterial);
|
|
50204
|
+
const hkdfKey = await globalThis.crypto.subtle.importKey("raw", runKeyMaterial, "HKDF", false, ["deriveBits"]);
|
|
50205
|
+
const scalarBits = await globalThis.crypto.subtle.deriveBits({
|
|
50206
|
+
name: "HKDF",
|
|
50207
|
+
hash: "SHA-256",
|
|
50208
|
+
salt: new Uint8Array(32),
|
|
50209
|
+
info: infoEncoder.encode(SCALAR_INFO)
|
|
50210
|
+
}, hkdfKey, X25519_KEY_LENGTH * 8);
|
|
50211
|
+
const scalar = new Uint8Array(scalarBits);
|
|
50212
|
+
const publicKey = await derivePublicKeyFromScalar(scalar);
|
|
50213
|
+
return { scalar, publicKey };
|
|
50214
|
+
}
|
|
50215
|
+
async function derivePublicKeyFromScalar(scalar) {
|
|
50216
|
+
const privateKey = await importScalar(
|
|
50217
|
+
scalar,
|
|
50218
|
+
/* extractable */
|
|
50219
|
+
true
|
|
50220
|
+
);
|
|
50221
|
+
const jwk = await globalThis.crypto.subtle.exportKey("jwk", privateKey);
|
|
50222
|
+
if (!jwk.x) {
|
|
50223
|
+
throw new WorkflowRuntimeError('X25519 JWK export did not include a public key component ("x")');
|
|
50224
|
+
}
|
|
50225
|
+
const publicKey = base64UrlToBytes(jwk.x);
|
|
50226
|
+
if (publicKey.byteLength !== X25519_KEY_LENGTH) {
|
|
50227
|
+
throw new WorkflowRuntimeError(`X25519 JWK export produced a ${publicKey.byteLength}-byte public key, expected ${X25519_KEY_LENGTH}`);
|
|
50228
|
+
}
|
|
50229
|
+
return publicKey;
|
|
50230
|
+
}
|
|
50231
|
+
async function importScalar(scalar, extractable) {
|
|
50232
|
+
const pkcs8 = new Uint8Array(PKCS8_X25519_PREFIX.length + scalar.byteLength);
|
|
50233
|
+
pkcs8.set(PKCS8_X25519_PREFIX, 0);
|
|
50234
|
+
pkcs8.set(scalar, PKCS8_X25519_PREFIX.length);
|
|
50235
|
+
return globalThis.crypto.subtle.importKey("pkcs8", pkcs8, { name: "X25519" }, extractable, ["deriveBits"]);
|
|
50236
|
+
}
|
|
50237
|
+
function importPublicKey(publicKey) {
|
|
50238
|
+
return globalThis.crypto.subtle.importKey(
|
|
50239
|
+
"raw",
|
|
50240
|
+
publicKey,
|
|
50241
|
+
{ name: "X25519" },
|
|
50242
|
+
/* extractable */
|
|
50243
|
+
true,
|
|
50244
|
+
// Public keys carry no usages for X25519 — the private key does the
|
|
50245
|
+
// deriving; the public key is only ever an argument to it.
|
|
50246
|
+
[]
|
|
50247
|
+
);
|
|
50248
|
+
}
|
|
50249
|
+
const BASE64_CHARS$1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
50250
|
+
const BASE64URL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
50251
|
+
function bytesToBase64(bytes) {
|
|
50252
|
+
let out = "";
|
|
50253
|
+
for (let i = 0; i < bytes.length; i += 3) {
|
|
50254
|
+
const b0 = bytes[i];
|
|
50255
|
+
const b1 = i + 1 < bytes.length ? bytes[i + 1] : 0;
|
|
50256
|
+
const b2 = i + 2 < bytes.length ? bytes[i + 2] : 0;
|
|
50257
|
+
out += BASE64_CHARS$1[b0 >> 2 & 63];
|
|
50258
|
+
out += BASE64_CHARS$1[(b0 & 3) << 4 | b1 >> 4 & 15];
|
|
50259
|
+
out += i + 1 < bytes.length ? BASE64_CHARS$1[(b1 & 15) << 2 | b2 >> 6 & 3] : "=";
|
|
50260
|
+
out += i + 2 < bytes.length ? BASE64_CHARS$1[b2 & 63] : "=";
|
|
50261
|
+
}
|
|
50262
|
+
return out;
|
|
50263
|
+
}
|
|
50264
|
+
function base64ToBytes(value) {
|
|
50265
|
+
let end = value.length;
|
|
50266
|
+
while (end > 0 && value[end - 1] === "=")
|
|
50267
|
+
end--;
|
|
50268
|
+
const body2 = value.slice(0, end);
|
|
50269
|
+
if (body2.includes("="))
|
|
50270
|
+
return void 0;
|
|
50271
|
+
if (body2.length % 4 === 1)
|
|
50272
|
+
return void 0;
|
|
50273
|
+
if (end !== value.length && value.length % 4 !== 0)
|
|
50274
|
+
return void 0;
|
|
50275
|
+
let accumulator = 0;
|
|
50276
|
+
let bitCount = 0;
|
|
50277
|
+
const bytes = [];
|
|
50278
|
+
for (let i = 0; i < body2.length; i++) {
|
|
50279
|
+
const index2 = BASE64_CHARS$1.indexOf(body2[i]);
|
|
50280
|
+
if (index2 === -1)
|
|
50281
|
+
return void 0;
|
|
50282
|
+
accumulator = accumulator << 6 | index2;
|
|
50283
|
+
bitCount += 6;
|
|
50284
|
+
if (bitCount >= 8) {
|
|
50285
|
+
bitCount -= 8;
|
|
50286
|
+
bytes.push(accumulator >> bitCount & 255);
|
|
50287
|
+
}
|
|
50288
|
+
}
|
|
50289
|
+
if (bitCount > 0 && (accumulator & (1 << bitCount) - 1) !== 0) {
|
|
50290
|
+
return void 0;
|
|
50291
|
+
}
|
|
50292
|
+
return new Uint8Array(bytes);
|
|
50293
|
+
}
|
|
50294
|
+
function base64UrlToBytes(value) {
|
|
50295
|
+
let accumulator = 0;
|
|
50296
|
+
let bitCount = 0;
|
|
50297
|
+
const bytes = [];
|
|
50298
|
+
for (let i = 0; i < value.length; i++) {
|
|
50299
|
+
const char = value[i];
|
|
50300
|
+
if (char === "=")
|
|
50301
|
+
break;
|
|
50302
|
+
const index2 = BASE64URL_CHARS.indexOf(char);
|
|
50303
|
+
if (index2 === -1) {
|
|
50304
|
+
throw new WorkflowRuntimeError(`Invalid base64url character "${char}" in X25519 JWK key component`);
|
|
50305
|
+
}
|
|
50306
|
+
accumulator = accumulator << 6 | index2;
|
|
50307
|
+
bitCount += 6;
|
|
50308
|
+
if (bitCount >= 8) {
|
|
50309
|
+
bitCount -= 8;
|
|
50310
|
+
bytes.push(accumulator >> bitCount & 255);
|
|
50311
|
+
}
|
|
50312
|
+
}
|
|
50313
|
+
return new Uint8Array(bytes);
|
|
50314
|
+
}
|
|
50315
|
+
async function deriveContentKey(sharedSecret, ephemeralPublicKey, recipientPublicKey, usages) {
|
|
50316
|
+
const label = infoEncoder.encode(CONTENT_KEY_INFO);
|
|
50317
|
+
const info = new Uint8Array(label.length + ephemeralPublicKey.length + recipientPublicKey.length);
|
|
50318
|
+
info.set(label, 0);
|
|
50319
|
+
info.set(ephemeralPublicKey, label.length);
|
|
50320
|
+
info.set(recipientPublicKey, label.length + ephemeralPublicKey.length);
|
|
50321
|
+
const hkdfKey = await globalThis.crypto.subtle.importKey("raw", sharedSecret, "HKDF", false, ["deriveBits"]);
|
|
50322
|
+
const contentKeyBits = await globalThis.crypto.subtle.deriveBits({ name: "HKDF", hash: "SHA-256", salt: new Uint8Array(32), info }, hkdfKey, CONTENT_KEY_LENGTH * 8);
|
|
50323
|
+
return globalThis.crypto.subtle.importKey(
|
|
50324
|
+
"raw",
|
|
50325
|
+
new Uint8Array(contentKeyBits),
|
|
50326
|
+
"AES-GCM",
|
|
50327
|
+
false,
|
|
50328
|
+
// `KeyUsage` is a DOM-lib type that is not in scope under `es2022`; the
|
|
50329
|
+
// parameter type is a strict subset of it, so this cast is sound.
|
|
50330
|
+
usages
|
|
50331
|
+
);
|
|
50332
|
+
}
|
|
50333
|
+
async function encapsulate(recipientPublicKey) {
|
|
50334
|
+
assertPublicKeyLength(recipientPublicKey, "Recipient public key");
|
|
50335
|
+
let recipientKey;
|
|
50336
|
+
try {
|
|
50337
|
+
recipientKey = await importPublicKey(recipientPublicKey);
|
|
50338
|
+
} catch (cause) {
|
|
50339
|
+
throw new WorkflowRuntimeError(`Invalid X25519 recipient public key: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
|
|
50340
|
+
}
|
|
50341
|
+
const ephemeral = await globalThis.crypto.subtle.generateKey(
|
|
50342
|
+
{ name: "X25519" },
|
|
50343
|
+
/* extractable */
|
|
50344
|
+
true,
|
|
50345
|
+
["deriveBits"]
|
|
50346
|
+
);
|
|
50347
|
+
const ephemeralPublicKey = new Uint8Array(await globalThis.crypto.subtle.exportKey("raw", ephemeral.publicKey));
|
|
50348
|
+
let sharedSecretBits;
|
|
50349
|
+
try {
|
|
50350
|
+
sharedSecretBits = await globalThis.crypto.subtle.deriveBits({ name: "X25519", public: recipientKey }, ephemeral.privateKey, X25519_KEY_LENGTH * 8);
|
|
50351
|
+
} catch (cause) {
|
|
50352
|
+
throw new WorkflowRuntimeError("X25519 key agreement failed: the recipient public key is not a valid curve point (low-order point or corrupted key material)", { cause });
|
|
50353
|
+
}
|
|
50354
|
+
const contentKey = await deriveContentKey(new Uint8Array(sharedSecretBits), ephemeralPublicKey, recipientPublicKey, ["encrypt"]);
|
|
50355
|
+
return { ephemeralPublicKey, contentKey };
|
|
50356
|
+
}
|
|
50357
|
+
async function decapsulate(keyPair, ephemeralPublicKey) {
|
|
50358
|
+
if (ephemeralPublicKey.byteLength !== X25519_KEY_LENGTH) {
|
|
50359
|
+
throw new RuntimeDecryptionError(`Sealed payload has a malformed ephemeral public key: expected ${X25519_KEY_LENGTH} bytes, got ${ephemeralPublicKey.byteLength}`, {
|
|
50360
|
+
context: {
|
|
50361
|
+
operation: "decrypt",
|
|
50362
|
+
byteLength: ephemeralPublicKey.byteLength
|
|
50363
|
+
}
|
|
50364
|
+
});
|
|
50365
|
+
}
|
|
50366
|
+
let sharedSecretBits;
|
|
50367
|
+
try {
|
|
50368
|
+
const [privateKey, senderKey] = await Promise.all([
|
|
50369
|
+
importScalar(
|
|
50370
|
+
keyPair.scalar,
|
|
50371
|
+
/* extractable */
|
|
50372
|
+
false
|
|
50373
|
+
),
|
|
50374
|
+
importPublicKey(ephemeralPublicKey)
|
|
50375
|
+
]);
|
|
50376
|
+
sharedSecretBits = await globalThis.crypto.subtle.deriveBits({ name: "X25519", public: senderKey }, privateKey, X25519_KEY_LENGTH * 8);
|
|
50377
|
+
} catch (cause) {
|
|
50378
|
+
throw new RuntimeDecryptionError(`X25519 key agreement failed while opening a sealed payload: ${cause instanceof Error ? cause.message : String(cause)}`, {
|
|
50379
|
+
cause,
|
|
50380
|
+
context: {
|
|
50381
|
+
operation: "decrypt",
|
|
50382
|
+
byteLength: ephemeralPublicKey.byteLength
|
|
50383
|
+
}
|
|
50384
|
+
});
|
|
50385
|
+
}
|
|
50386
|
+
return deriveContentKey(new Uint8Array(sharedSecretBits), ephemeralPublicKey, keyPair.publicKey, ["decrypt"]);
|
|
50387
|
+
}
|
|
50388
|
+
async function seal(recipientPublicKey, data, aad) {
|
|
50389
|
+
const { ephemeralPublicKey, contentKey } = await encapsulate(recipientPublicKey);
|
|
50390
|
+
const encrypted = await encrypt$1(contentKey, data, aad);
|
|
50391
|
+
const result = new Uint8Array(ephemeralPublicKey.byteLength + encrypted.byteLength);
|
|
50392
|
+
result.set(ephemeralPublicKey, 0);
|
|
50393
|
+
result.set(encrypted, ephemeralPublicKey.byteLength);
|
|
50394
|
+
return result;
|
|
50395
|
+
}
|
|
50396
|
+
async function open(keyPair, sealed, aad) {
|
|
50397
|
+
const minLength = X25519_KEY_LENGTH + NONCE_LENGTH + TAG_BYTES;
|
|
50398
|
+
if (sealed.byteLength < minLength) {
|
|
50399
|
+
throw new RuntimeDecryptionError(`Sealed payload too short: expected at least ${minLength} bytes, got ${sealed.byteLength}`, { context: { operation: "decrypt", byteLength: sealed.byteLength } });
|
|
50400
|
+
}
|
|
50401
|
+
const ephemeralPublicKey = sealed.subarray(0, X25519_KEY_LENGTH);
|
|
50402
|
+
const encrypted = sealed.subarray(X25519_KEY_LENGTH);
|
|
50403
|
+
const contentKey = await decapsulate(keyPair, ephemeralPublicKey);
|
|
50404
|
+
return decrypt$1(contentKey, encrypted, aad);
|
|
50405
|
+
}
|
|
50406
|
+
function createSealSession(recipientPublicKey, aad) {
|
|
50407
|
+
let encapsulation;
|
|
50408
|
+
return {
|
|
50409
|
+
async seal(data) {
|
|
50410
|
+
encapsulation ?? (encapsulation = encapsulate(recipientPublicKey));
|
|
50411
|
+
const { ephemeralPublicKey, contentKey } = await encapsulation;
|
|
50412
|
+
const encrypted = await encrypt$1(contentKey, data, aad);
|
|
50413
|
+
const result = new Uint8Array(ephemeralPublicKey.byteLength + encrypted.byteLength);
|
|
50414
|
+
result.set(ephemeralPublicKey, 0);
|
|
50415
|
+
result.set(encrypted, ephemeralPublicKey.byteLength);
|
|
50416
|
+
return result;
|
|
50417
|
+
}
|
|
50418
|
+
};
|
|
50419
|
+
}
|
|
50420
|
+
function createOpenSession(keyPair, aad) {
|
|
50421
|
+
let cachedSender;
|
|
50422
|
+
let cachedKey;
|
|
50423
|
+
return {
|
|
50424
|
+
async open(sealed) {
|
|
50425
|
+
const minLength = X25519_KEY_LENGTH + NONCE_LENGTH + TAG_BYTES;
|
|
50426
|
+
if (sealed.byteLength < minLength) {
|
|
50427
|
+
throw new RuntimeDecryptionError(`Sealed payload too short: expected at least ${minLength} bytes, got ${sealed.byteLength}`, { context: { operation: "decrypt", byteLength: sealed.byteLength } });
|
|
50428
|
+
}
|
|
50429
|
+
const ephemeralPublicKey = sealed.subarray(0, X25519_KEY_LENGTH);
|
|
50430
|
+
const encrypted = sealed.subarray(X25519_KEY_LENGTH);
|
|
50431
|
+
const sender2 = keyCacheId(ephemeralPublicKey);
|
|
50432
|
+
if (sender2 !== cachedSender || !cachedKey) {
|
|
50433
|
+
cachedSender = sender2;
|
|
50434
|
+
cachedKey = decapsulate(keyPair, ephemeralPublicKey);
|
|
50435
|
+
}
|
|
50436
|
+
let contentKey;
|
|
50437
|
+
try {
|
|
50438
|
+
contentKey = await cachedKey;
|
|
50439
|
+
} catch (error2) {
|
|
50440
|
+
cachedSender = void 0;
|
|
50441
|
+
cachedKey = void 0;
|
|
50442
|
+
throw error2;
|
|
50443
|
+
}
|
|
50444
|
+
return decrypt$1(contentKey, encrypted, aad);
|
|
50445
|
+
}
|
|
50446
|
+
};
|
|
50447
|
+
}
|
|
50448
|
+
function keyCacheId(publicKey) {
|
|
50449
|
+
let id2 = "";
|
|
50450
|
+
for (let i = 0; i < publicKey.length; i++) {
|
|
50451
|
+
id2 += publicKey[i].toString(16).padStart(2, "0");
|
|
50452
|
+
}
|
|
50453
|
+
return id2;
|
|
50454
|
+
}
|
|
50455
|
+
function decodeRunPublicKey(value) {
|
|
50456
|
+
if (!value)
|
|
50457
|
+
return void 0;
|
|
50458
|
+
const bytes = base64ToBytes(value);
|
|
50459
|
+
if (!bytes || bytes.byteLength !== X25519_KEY_LENGTH)
|
|
50460
|
+
return void 0;
|
|
50461
|
+
return bytes;
|
|
50462
|
+
}
|
|
50463
|
+
function isFormatPrefix(value) {
|
|
50464
|
+
return value.length === 4 && /^[a-z0-9]{4}$/.test(value);
|
|
50465
|
+
}
|
|
49508
50466
|
const SerializationFormat$1 = {
|
|
49509
50467
|
/** devalue stringify/parse with TextEncoder/TextDecoder */
|
|
49510
50468
|
DEVALUE_V1: "devl",
|
|
49511
|
-
/** Encrypted payload (inner payload has its own format prefix
|
|
50469
|
+
/** Encrypted payload (inner payload has its own format prefix) */
|
|
49512
50470
|
ENCRYPTED: "encr",
|
|
49513
|
-
/**
|
|
50471
|
+
/**
|
|
50472
|
+
* Sealed payload — asymmetrically encrypted to a run's X25519 public key
|
|
50473
|
+
* (inner payload has its own format prefix).
|
|
50474
|
+
*
|
|
50475
|
+
* Used for *cross-run* writes (hook payloads, forwarded stream frames),
|
|
50476
|
+
* where the writer holds only the recipient run's public key and therefore
|
|
50477
|
+
* cannot decrypt. A run's own payloads continue to use {@link ENCRYPTED}.
|
|
50478
|
+
* See `sealed-box.ts` for the construction.
|
|
50479
|
+
*/
|
|
50480
|
+
SEALED: "encp",
|
|
50481
|
+
/** Gzip-compressed payload (inner payload has its own format prefix) */
|
|
49514
50482
|
GZIP: "gzip",
|
|
49515
|
-
/** Zstandard-compressed payload (inner payload has its own format prefix
|
|
50483
|
+
/** Zstandard-compressed payload (inner payload has its own format prefix) */
|
|
49516
50484
|
ZSTD: "zstd"
|
|
49517
50485
|
};
|
|
49518
50486
|
const FORMAT_PREFIX_LENGTH$2 = 4;
|
|
49519
|
-
new TextEncoder();
|
|
50487
|
+
const formatEncoder = new TextEncoder();
|
|
49520
50488
|
const formatDecoder$2 = new TextDecoder();
|
|
50489
|
+
function encodeWithFormatPrefix(format2, payload) {
|
|
50490
|
+
if (!(payload instanceof Uint8Array)) {
|
|
50491
|
+
return payload;
|
|
50492
|
+
}
|
|
50493
|
+
const prefixBytes = formatEncoder.encode(format2);
|
|
50494
|
+
const result = new Uint8Array(FORMAT_PREFIX_LENGTH$2 + payload.length);
|
|
50495
|
+
result.set(prefixBytes, 0);
|
|
50496
|
+
result.set(payload, FORMAT_PREFIX_LENGTH$2);
|
|
50497
|
+
return result;
|
|
50498
|
+
}
|
|
50499
|
+
function peekFormatPrefix$1(data) {
|
|
50500
|
+
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$2) {
|
|
50501
|
+
return null;
|
|
50502
|
+
}
|
|
50503
|
+
const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH$2);
|
|
50504
|
+
const str = formatDecoder$2.decode(prefixBytes);
|
|
50505
|
+
return isFormatPrefix(str) ? str : null;
|
|
50506
|
+
}
|
|
49521
50507
|
function decodeFormatPrefix$1(data) {
|
|
49522
50508
|
if (!(data instanceof Uint8Array)) {
|
|
49523
50509
|
return {
|
|
@@ -49529,12 +50515,159 @@ function decodeFormatPrefix$1(data) {
|
|
|
49529
50515
|
throw new Error(`Data too short to contain format prefix: expected at least ${FORMAT_PREFIX_LENGTH$2} bytes, got ${data.length}`);
|
|
49530
50516
|
}
|
|
49531
50517
|
const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH$2);
|
|
49532
|
-
const
|
|
49533
|
-
|
|
50518
|
+
const str = formatDecoder$2.decode(prefixBytes);
|
|
50519
|
+
if (!isFormatPrefix(str)) {
|
|
50520
|
+
throw new Error(`Invalid format prefix: "${str}". Must be 4 characters of [a-z0-9].`);
|
|
50521
|
+
}
|
|
50522
|
+
const payload = data.subarray(FORMAT_PREFIX_LENGTH$2);
|
|
50523
|
+
return { format: str, payload };
|
|
50524
|
+
}
|
|
50525
|
+
const SEAL_TARGET_BRAND = Symbol.for("workflow.serialization.sealTarget");
|
|
50526
|
+
const RUN_KEYS_BRAND = Symbol.for("workflow.serialization.runKeys");
|
|
50527
|
+
function sealTo(recipientPublicKey, aad) {
|
|
50528
|
+
return { [SEAL_TARGET_BRAND]: true, recipientPublicKey, aad };
|
|
50529
|
+
}
|
|
50530
|
+
function runPayloadKeys(aes, keyPair, aad) {
|
|
50531
|
+
return { [RUN_KEYS_BRAND]: true, aes, keyPair, aad };
|
|
50532
|
+
}
|
|
50533
|
+
async function deriveRunPayloadKeys(runKeyMaterial) {
|
|
50534
|
+
const [aes, keyPair] = await Promise.all([
|
|
50535
|
+
importKey(runKeyMaterial),
|
|
50536
|
+
deriveRunKeyPair(runKeyMaterial)
|
|
50537
|
+
]);
|
|
50538
|
+
return runPayloadKeys(aes, keyPair);
|
|
50539
|
+
}
|
|
50540
|
+
function isSealTarget(value) {
|
|
50541
|
+
return typeof value === "object" && value !== null && value[SEAL_TARGET_BRAND] === true;
|
|
50542
|
+
}
|
|
50543
|
+
function isRunPayloadKeys(value) {
|
|
50544
|
+
return typeof value === "object" && value !== null && value[RUN_KEYS_BRAND] === true;
|
|
50545
|
+
}
|
|
50546
|
+
function aesKeyOf(key) {
|
|
50547
|
+
if (!key)
|
|
50548
|
+
return void 0;
|
|
50549
|
+
if (isRunPayloadKeys(key))
|
|
50550
|
+
return key.aes;
|
|
50551
|
+
if (isSealTarget(key))
|
|
50552
|
+
return void 0;
|
|
50553
|
+
return key;
|
|
50554
|
+
}
|
|
50555
|
+
async function resolveEncryptionKey(key) {
|
|
50556
|
+
return typeof key === "function" ? key() : key;
|
|
50557
|
+
}
|
|
50558
|
+
async function encrypt(data, key) {
|
|
50559
|
+
if (!key || !(data instanceof Uint8Array))
|
|
50560
|
+
return data;
|
|
50561
|
+
if (isSealTarget(key)) {
|
|
50562
|
+
const sealed = await seal(key.recipientPublicKey, data, key.aad);
|
|
50563
|
+
return encodeWithFormatPrefix(SerializationFormat$1.SEALED, sealed);
|
|
50564
|
+
}
|
|
50565
|
+
const aesKey = isRunPayloadKeys(key) ? key.aes : key;
|
|
50566
|
+
const encrypted = await encrypt$1(aesKey, data);
|
|
50567
|
+
return encodeWithFormatPrefix(SerializationFormat$1.ENCRYPTED, encrypted);
|
|
50568
|
+
}
|
|
50569
|
+
async function openSealedEnvelope(data, key) {
|
|
50570
|
+
if (!isRunPayloadKeys(key)) {
|
|
50571
|
+
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.", {
|
|
50572
|
+
context: {
|
|
50573
|
+
operation: "decrypt",
|
|
50574
|
+
byteLength: data.byteLength,
|
|
50575
|
+
formatPrefix: "encp"
|
|
50576
|
+
}
|
|
50577
|
+
});
|
|
50578
|
+
}
|
|
50579
|
+
const { payload } = decodeFormatPrefix$1(data);
|
|
50580
|
+
try {
|
|
50581
|
+
return await open(key.keyPair, payload, key.aad);
|
|
50582
|
+
} catch (error2) {
|
|
50583
|
+
if (RuntimeDecryptionError.is(error2) && error2.context) {
|
|
50584
|
+
error2.context.formatPrefix = SerializationFormat$1.SEALED;
|
|
50585
|
+
}
|
|
50586
|
+
throw error2;
|
|
50587
|
+
}
|
|
50588
|
+
}
|
|
50589
|
+
async function decrypt(data, key) {
|
|
50590
|
+
if (!(data instanceof Uint8Array))
|
|
50591
|
+
return data;
|
|
50592
|
+
const format2 = peekFormatPrefix$1(data);
|
|
50593
|
+
if (format2 === SerializationFormat$1.SEALED) {
|
|
50594
|
+
return openSealedEnvelope(data, key);
|
|
50595
|
+
}
|
|
50596
|
+
if (format2 !== SerializationFormat$1.ENCRYPTED)
|
|
50597
|
+
return data;
|
|
50598
|
+
const aesKey = aesKeyOf(key);
|
|
50599
|
+
if (!aesKey) {
|
|
50600
|
+
throw new RuntimeDecryptionError("Encrypted data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.", {
|
|
50601
|
+
context: {
|
|
50602
|
+
operation: "decrypt",
|
|
50603
|
+
byteLength: data.byteLength,
|
|
50604
|
+
formatPrefix: "encr"
|
|
50605
|
+
}
|
|
50606
|
+
});
|
|
50607
|
+
}
|
|
50608
|
+
const { payload } = decodeFormatPrefix$1(data);
|
|
50609
|
+
try {
|
|
50610
|
+
return await decrypt$1(aesKey, payload);
|
|
50611
|
+
} catch (error2) {
|
|
50612
|
+
if (RuntimeDecryptionError.is(error2) && error2.context) {
|
|
50613
|
+
error2.context.formatPrefix = format2;
|
|
50614
|
+
}
|
|
50615
|
+
throw error2;
|
|
50616
|
+
}
|
|
50617
|
+
}
|
|
50618
|
+
const encryption = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
50619
|
+
__proto__: null,
|
|
50620
|
+
aesKeyOf,
|
|
50621
|
+
decrypt,
|
|
50622
|
+
deriveRunPayloadKeys,
|
|
50623
|
+
encrypt,
|
|
50624
|
+
isRunPayloadKeys,
|
|
50625
|
+
isSealTarget,
|
|
50626
|
+
resolveEncryptionKey,
|
|
50627
|
+
runPayloadKeys,
|
|
50628
|
+
sealTo
|
|
50629
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
50630
|
+
const SerializationFormat = {
|
|
50631
|
+
/** devalue stringify/parse with TextEncoder/TextDecoder */
|
|
50632
|
+
DEVALUE_V1: "devl",
|
|
50633
|
+
/** Encrypted payload (inner payload has its own format prefix after decryption) */
|
|
50634
|
+
ENCRYPTED: "encr",
|
|
50635
|
+
/**
|
|
50636
|
+
* Sealed payload — asymmetrically encrypted to a run's X25519 public key
|
|
50637
|
+
* (inner payload has its own format prefix after opening).
|
|
50638
|
+
*
|
|
50639
|
+
* Written by cross-run writers that hold only the recipient run's public
|
|
50640
|
+
* key. Opening it requires the run's private scalar rather than the
|
|
50641
|
+
* symmetric per-run key, so o11y display treats it as ciphertext via
|
|
50642
|
+
* {@link isEncryptedData} but {@link hydrateDataWithKey} does not attempt
|
|
50643
|
+
* an AES-GCM decrypt on it.
|
|
50644
|
+
*/
|
|
50645
|
+
SEALED: "encp",
|
|
50646
|
+
/** Gzip-compressed payload (inner payload has its own format prefix after decompression) */
|
|
50647
|
+
GZIP: "gzip",
|
|
50648
|
+
/** Zstandard-compressed payload (inner payload has its own format prefix after decompression) */
|
|
50649
|
+
ZSTD: "zstd"
|
|
50650
|
+
};
|
|
50651
|
+
const FORMAT_PREFIX_LENGTH$1 = 4;
|
|
50652
|
+
new TextEncoder();
|
|
50653
|
+
const formatDecoder$1 = new TextDecoder();
|
|
50654
|
+
function decodeFormatPrefix(data) {
|
|
50655
|
+
if (!(data instanceof Uint8Array)) {
|
|
50656
|
+
return {
|
|
50657
|
+
format: SerializationFormat.DEVALUE_V1,
|
|
50658
|
+
payload: new TextEncoder().encode(JSON.stringify(data))
|
|
50659
|
+
};
|
|
50660
|
+
}
|
|
50661
|
+
if (data.length < FORMAT_PREFIX_LENGTH$1) {
|
|
50662
|
+
throw new Error(`Data too short to contain format prefix: expected at least ${FORMAT_PREFIX_LENGTH$1} bytes, got ${data.length}`);
|
|
50663
|
+
}
|
|
50664
|
+
const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH$1);
|
|
50665
|
+
const format2 = formatDecoder$1.decode(prefixBytes);
|
|
50666
|
+
const knownFormats = Object.values(SerializationFormat);
|
|
49534
50667
|
if (!knownFormats.includes(format2)) {
|
|
49535
50668
|
throw new Error(`Unknown serialization format: "${format2}". Known formats: ${knownFormats.join(", ")}`);
|
|
49536
50669
|
}
|
|
49537
|
-
const payload = data.subarray(FORMAT_PREFIX_LENGTH$
|
|
50670
|
+
const payload = data.subarray(FORMAT_PREFIX_LENGTH$1);
|
|
49538
50671
|
return { format: format2, payload };
|
|
49539
50672
|
}
|
|
49540
50673
|
function isExpiredObject(data) {
|
|
@@ -49553,18 +50686,25 @@ function isExpiredStub(data) {
|
|
|
49553
50686
|
return false;
|
|
49554
50687
|
}
|
|
49555
50688
|
function isEncryptedData(data) {
|
|
49556
|
-
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$
|
|
50689
|
+
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$1) {
|
|
50690
|
+
return false;
|
|
50691
|
+
}
|
|
50692
|
+
const prefix = formatDecoder$1.decode(data.subarray(0, FORMAT_PREFIX_LENGTH$1));
|
|
50693
|
+
return prefix === SerializationFormat.ENCRYPTED || prefix === SerializationFormat.SEALED;
|
|
50694
|
+
}
|
|
50695
|
+
function isSealedData(data) {
|
|
50696
|
+
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$1) {
|
|
49557
50697
|
return false;
|
|
49558
50698
|
}
|
|
49559
|
-
const prefix = formatDecoder$
|
|
49560
|
-
return prefix === SerializationFormat
|
|
50699
|
+
const prefix = formatDecoder$1.decode(data.subarray(0, FORMAT_PREFIX_LENGTH$1));
|
|
50700
|
+
return prefix === SerializationFormat.SEALED;
|
|
49561
50701
|
}
|
|
49562
50702
|
function isCompressedData(data) {
|
|
49563
|
-
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$
|
|
50703
|
+
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$1) {
|
|
49564
50704
|
return false;
|
|
49565
50705
|
}
|
|
49566
|
-
const prefix = formatDecoder$
|
|
49567
|
-
return prefix === SerializationFormat
|
|
50706
|
+
const prefix = formatDecoder$1.decode(data.subarray(0, FORMAT_PREFIX_LENGTH$1));
|
|
50707
|
+
return prefix === SerializationFormat.GZIP || prefix === SerializationFormat.ZSTD;
|
|
49568
50708
|
}
|
|
49569
50709
|
function getNodeZlib$2() {
|
|
49570
50710
|
var _a3, _b2;
|
|
@@ -49577,10 +50717,10 @@ function getNodeZlib$2() {
|
|
|
49577
50717
|
function decompressSyncIfAvailable(format2, payload) {
|
|
49578
50718
|
try {
|
|
49579
50719
|
const zlib = getNodeZlib$2();
|
|
49580
|
-
if (format2 === SerializationFormat
|
|
50720
|
+
if (format2 === SerializationFormat.GZIP && (zlib == null ? void 0 : zlib.gunzipSync)) {
|
|
49581
50721
|
return new Uint8Array(zlib.gunzipSync(payload));
|
|
49582
50722
|
}
|
|
49583
|
-
if (format2 === SerializationFormat
|
|
50723
|
+
if (format2 === SerializationFormat.ZSTD && (zlib == null ? void 0 : zlib.zstdDecompressSync)) {
|
|
49584
50724
|
return new Uint8Array(zlib.zstdDecompressSync(payload));
|
|
49585
50725
|
}
|
|
49586
50726
|
} catch {
|
|
@@ -49592,7 +50732,7 @@ function registerZstdDecoder(decoder2) {
|
|
|
49592
50732
|
zstdBrowserDecoder = decoder2;
|
|
49593
50733
|
}
|
|
49594
50734
|
async function decompressAsync(format2, payload) {
|
|
49595
|
-
if (format2 === SerializationFormat
|
|
50735
|
+
if (format2 === SerializationFormat.ZSTD) {
|
|
49596
50736
|
const sync = decompressSyncIfAvailable(format2, payload);
|
|
49597
50737
|
if (sync)
|
|
49598
50738
|
return sync;
|
|
@@ -49629,12 +50769,12 @@ function hydrateData(value, revivers) {
|
|
|
49629
50769
|
if (isEncryptedData(value)) {
|
|
49630
50770
|
return value;
|
|
49631
50771
|
}
|
|
49632
|
-
const { format: format2, payload } = decodeFormatPrefix
|
|
49633
|
-
if (format2 === SerializationFormat
|
|
50772
|
+
const { format: format2, payload } = decodeFormatPrefix(value);
|
|
50773
|
+
if (format2 === SerializationFormat.DEVALUE_V1) {
|
|
49634
50774
|
const str = new TextDecoder().decode(payload);
|
|
49635
50775
|
return parse$5(str, revivers);
|
|
49636
50776
|
}
|
|
49637
|
-
if (format2 === SerializationFormat
|
|
50777
|
+
if (format2 === SerializationFormat.GZIP || format2 === SerializationFormat.ZSTD) {
|
|
49638
50778
|
const inflated = decompressSyncIfAvailable(format2, payload);
|
|
49639
50779
|
if (inflated === void 0) {
|
|
49640
50780
|
return value;
|
|
@@ -49651,12 +50791,13 @@ function hydrateData(value, revivers) {
|
|
|
49651
50791
|
async function hydrateDataWithKey(value, revivers, key) {
|
|
49652
50792
|
let data = value;
|
|
49653
50793
|
if (data instanceof Uint8Array && isEncryptedData(data) && key) {
|
|
49654
|
-
const { decrypt: decrypt2 } = await Promise.resolve().then(() => encryption);
|
|
49655
|
-
|
|
49656
|
-
|
|
50794
|
+
const { decrypt: decrypt2, isRunPayloadKeys: isRunPayloadKeys2 } = await Promise.resolve().then(() => encryption);
|
|
50795
|
+
if (!isSealedData(data) || isRunPayloadKeys2(key)) {
|
|
50796
|
+
data = await decrypt2(data, key);
|
|
50797
|
+
}
|
|
49657
50798
|
}
|
|
49658
50799
|
if (data instanceof Uint8Array && isCompressedData(data)) {
|
|
49659
|
-
const { format: format2, payload } = decodeFormatPrefix
|
|
50800
|
+
const { format: format2, payload } = decodeFormatPrefix(data);
|
|
49660
50801
|
data = await decompressAsync(format2, payload);
|
|
49661
50802
|
}
|
|
49662
50803
|
return hydrateData(data, revivers);
|
|
@@ -49878,8 +51019,11 @@ const serializationFormat = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object
|
|
|
49878
51019
|
ClassInstanceRef,
|
|
49879
51020
|
RUN_REF_TYPE: RUN_REF_TYPE$1,
|
|
49880
51021
|
STREAM_REF_TYPE: STREAM_REF_TYPE$1,
|
|
49881
|
-
SerializationFormat
|
|
49882
|
-
decodeFormatPrefix
|
|
51022
|
+
SerializationFormat,
|
|
51023
|
+
decodeFormatPrefix,
|
|
51024
|
+
decryptEnvelope: decrypt,
|
|
51025
|
+
deriveRunPayloadKeys,
|
|
51026
|
+
encryptEnvelope: encrypt,
|
|
49883
51027
|
extractClassName,
|
|
49884
51028
|
hydrateData,
|
|
49885
51029
|
hydrateDataWithKey,
|
|
@@ -49887,9 +51031,14 @@ const serializationFormat = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object
|
|
|
49887
51031
|
isCompressedData,
|
|
49888
51032
|
isEncryptedData,
|
|
49889
51033
|
isExpiredStub,
|
|
51034
|
+
isRunPayloadKeys,
|
|
49890
51035
|
isRunRef: isRunRef$1,
|
|
51036
|
+
isSealTarget,
|
|
51037
|
+
isSealedData,
|
|
49891
51038
|
observabilityRevivers,
|
|
49892
51039
|
registerZstdDecoder,
|
|
51040
|
+
runPayloadKeys,
|
|
51041
|
+
sealTo,
|
|
49893
51042
|
serializedClassToString,
|
|
49894
51043
|
serializedInstanceToRef,
|
|
49895
51044
|
serializedRunToRunRef,
|
|
@@ -50169,10 +51318,10 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
|
|
|
50169
51318
|
return result;
|
|
50170
51319
|
}
|
|
50171
51320
|
async function hydrateResourceIOAsync(resource, key) {
|
|
50172
|
-
const { hydrateDataWithKey: hydrateDataWithKey2 } = await Promise.resolve().then(() => serializationFormat);
|
|
50173
|
-
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-
|
|
51321
|
+
const { hydrateDataWithKey: hydrateDataWithKey2, deriveRunPayloadKeys: deriveRunPayloadKeys2 } = await Promise.resolve().then(() => serializationFormat);
|
|
51322
|
+
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-tQARkzJ5.js");
|
|
50174
51323
|
ensureZstdDecoderRegistered();
|
|
50175
|
-
const cryptoKey = key ? await
|
|
51324
|
+
const cryptoKey = key ? await deriveRunPayloadKeys2(key) : void 0;
|
|
50176
51325
|
const revivers = getRevivers();
|
|
50177
51326
|
async function hydrateField(value) {
|
|
50178
51327
|
if (isEncryptedMarker$1(value)) {
|
|
@@ -51753,7 +52902,7 @@ function useCollapsibleContext(part) {
|
|
|
51753
52902
|
return context;
|
|
51754
52903
|
}
|
|
51755
52904
|
function CollapsibleRoot({ children: children2, variant = "section", disabled = false, defaultOpen = false, onOpenChange, className }) {
|
|
51756
|
-
const [
|
|
52905
|
+
const [open2, setOpen] = reactExports.useState(defaultOpen);
|
|
51757
52906
|
const handleToggle = (event) => {
|
|
51758
52907
|
if (event.target !== event.currentTarget)
|
|
51759
52908
|
return;
|
|
@@ -51761,7 +52910,7 @@ function CollapsibleRoot({ children: children2, variant = "section", disabled =
|
|
|
51761
52910
|
setOpen(next2);
|
|
51762
52911
|
onOpenChange == null ? void 0 : onOpenChange(next2);
|
|
51763
52912
|
};
|
|
51764
|
-
const details = jsxRuntimeExports.jsx("details", { "data-slot": "collapsible", "data-state":
|
|
52913
|
+
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 }) });
|
|
51765
52914
|
if (variant === "card") {
|
|
51766
52915
|
return details;
|
|
51767
52916
|
}
|
|
@@ -52177,8 +53326,8 @@ function PrimitiveValue({ field, value, isLast }) {
|
|
|
52177
53326
|
const { text: text2, cls } = describePrimitive(value);
|
|
52178
53327
|
return jsxRuntimeExports.jsx(LeafRow, { field, isLast, children: jsxRuntimeExports.jsx("span", { className: cls, children: text2 }) });
|
|
52179
53328
|
}
|
|
52180
|
-
function EmptyContainer({ field, prefix, open, close, isLast }) {
|
|
52181
|
-
return jsxRuntimeExports.jsxs("div", { className: CLS.child, role: "treeitem", tabIndex: -1, children: [jsxRuntimeExports.jsx(Label$2, { field }), prefix ? jsxRuntimeExports.jsx("span", { className: CLS.className, children: prefix }) : null, jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children:
|
|
53329
|
+
function EmptyContainer({ field, prefix, open: open2, close, isLast }) {
|
|
53330
|
+
return jsxRuntimeExports.jsxs("div", { className: CLS.child, role: "treeitem", tabIndex: -1, children: [jsxRuntimeExports.jsx(Label$2, { 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 })] });
|
|
52182
53331
|
}
|
|
52183
53332
|
function focusExpander(button, outerRef) {
|
|
52184
53333
|
var _a3;
|
|
@@ -52207,13 +53356,13 @@ function moveExpanderFocus(outerRef, direction) {
|
|
|
52207
53356
|
buttons[next2].tabIndex = 0;
|
|
52208
53357
|
buttons[next2].focus();
|
|
52209
53358
|
}
|
|
52210
|
-
function ExpandableContainer({ field, entries, open, close, prefix, ctx, isLast }) {
|
|
53359
|
+
function ExpandableContainer({ field, entries, open: open2, close, prefix, ctx, isLast }) {
|
|
52211
53360
|
const { level, shouldExpand, outerRef } = ctx;
|
|
52212
53361
|
const [expanded2, setExpanded] = reactExports.useState(() => shouldExpand(level));
|
|
52213
53362
|
const rowRef = reactExports.useRef(null);
|
|
52214
53363
|
const contentsId = reactExports.useId();
|
|
52215
53364
|
if (entries.length === 0) {
|
|
52216
|
-
return jsxRuntimeExports.jsx(EmptyContainer, { field, prefix, open, close, isLast });
|
|
53365
|
+
return jsxRuntimeExports.jsx(EmptyContainer, { field, prefix, open: open2, close, isLast });
|
|
52217
53366
|
}
|
|
52218
53367
|
const toggle = () => {
|
|
52219
53368
|
setExpanded((value) => !value);
|
|
@@ -52242,7 +53391,7 @@ function ExpandableContainer({ field, entries, open, close, prefix, ctx, isLast
|
|
|
52242
53391
|
}
|
|
52243
53392
|
};
|
|
52244
53393
|
const lastIndex = entries.length - 1;
|
|
52245
|
-
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:
|
|
53394
|
+
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 })] });
|
|
52246
53395
|
}
|
|
52247
53396
|
function DataRender({ field, value, isLast, ctx }) {
|
|
52248
53397
|
if (isBytesDisplay(value)) {
|
|
@@ -53330,11 +54479,11 @@ function LoadMoreButton({ loading = false, onClick, label = "Load more", loading
|
|
|
53330
54479
|
const STYLES = `.wf-menu-btn{appearance:none;-webkit-appearance:none;border:none;display:inline-flex;align-items:center;justify-content:center;height:40px;padding:0 12px;border-radius:6px;font-size:14px;font-weight:500;line-height:20px;color:var(--ds-gray-1000);background:var(--ds-background-100);box-shadow:0 0 0 1px var(--ds-gray-400);cursor:pointer;white-space:nowrap;transition:background 150ms}.wf-menu-btn:hover{background:var(--ds-gray-alpha-200)}.wf-menu-item{appearance:none;-webkit-appearance:none;border:none;display:flex;align-items:center;width:100%;height:40px;padding:0 8px;border-radius:6px;font-size:14px;color:var(--ds-gray-1000);background:transparent;cursor:pointer;transition:background 150ms}.wf-menu-item:hover{background:var(--ds-gray-alpha-100)}`;
|
|
53331
54480
|
function MenuDropdown({ options, value, onChange }) {
|
|
53332
54481
|
var _a3, _b2;
|
|
53333
|
-
const [
|
|
54482
|
+
const [open2, setOpen] = reactExports.useState(false);
|
|
53334
54483
|
const ref = reactExports.useRef(null);
|
|
53335
54484
|
const label = ((_a3 = options.find((o) => o.value === value)) == null ? void 0 : _a3.label) ?? ((_b2 = options[0]) == null ? void 0 : _b2.label) ?? "";
|
|
53336
54485
|
reactExports.useEffect(() => {
|
|
53337
|
-
if (!
|
|
54486
|
+
if (!open2)
|
|
53338
54487
|
return;
|
|
53339
54488
|
function handleClickOutside(e) {
|
|
53340
54489
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
@@ -53343,12 +54492,12 @@ function MenuDropdown({ options, value, onChange }) {
|
|
|
53343
54492
|
}
|
|
53344
54493
|
document.addEventListener("mousedown", handleClickOutside);
|
|
53345
54494
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
53346
|
-
}, [
|
|
53347
|
-
return jsxRuntimeExports.jsxs("div", { ref, style: { position: "relative", flexShrink: 0 }, children: [jsxRuntimeExports.jsx("style", { dangerouslySetInnerHTML: { __html: STYLES } }), jsxRuntimeExports.jsxs("button", { type: "button", className: "wf-menu-btn", onClick: () => setOpen(!
|
|
54495
|
+
}, [open2]);
|
|
54496
|
+
return jsxRuntimeExports.jsxs("div", { ref, style: { position: "relative", flexShrink: 0 }, children: [jsxRuntimeExports.jsx("style", { dangerouslySetInnerHTML: { __html: STYLES } }), jsxRuntimeExports.jsxs("button", { type: "button", className: "wf-menu-btn", onClick: () => setOpen(!open2), children: [jsxRuntimeExports.jsx("span", { children: label }), jsxRuntimeExports.jsx("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", style: {
|
|
53348
54497
|
marginLeft: 16,
|
|
53349
54498
|
marginRight: -4,
|
|
53350
54499
|
color: "var(--ds-gray-900)"
|
|
53351
|
-
}, children: jsxRuntimeExports.jsx("path", { d: "M4.5 6L8 9.5L11.5 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })] }),
|
|
54500
|
+
}, children: jsxRuntimeExports.jsx("path", { d: "M4.5 6L8 9.5L11.5 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), open2 && jsxRuntimeExports.jsx("div", { style: {
|
|
53352
54501
|
position: "absolute",
|
|
53353
54502
|
right: 0,
|
|
53354
54503
|
top: "100%",
|
|
@@ -69725,12 +70874,12 @@ function emphasis$1(node2, _2, state, info) {
|
|
|
69725
70874
|
})
|
|
69726
70875
|
);
|
|
69727
70876
|
const betweenHead = between.charCodeAt(0);
|
|
69728
|
-
const
|
|
70877
|
+
const open2 = encodeInfo(
|
|
69729
70878
|
info.before.charCodeAt(info.before.length - 1),
|
|
69730
70879
|
betweenHead,
|
|
69731
70880
|
marker2
|
|
69732
70881
|
);
|
|
69733
|
-
if (
|
|
70882
|
+
if (open2.inside) {
|
|
69734
70883
|
between = encodeCharacterReference(betweenHead) + between.slice(1);
|
|
69735
70884
|
}
|
|
69736
70885
|
const betweenTail = between.charCodeAt(between.length - 1);
|
|
@@ -69742,7 +70891,7 @@ function emphasis$1(node2, _2, state, info) {
|
|
|
69742
70891
|
exit2();
|
|
69743
70892
|
state.attentionEncodeSurroundingInfo = {
|
|
69744
70893
|
after: close.outside,
|
|
69745
|
-
before:
|
|
70894
|
+
before: open2.outside
|
|
69746
70895
|
};
|
|
69747
70896
|
return before + between + after;
|
|
69748
70897
|
}
|
|
@@ -70275,12 +71424,12 @@ function strong$1(node2, _2, state, info) {
|
|
|
70275
71424
|
})
|
|
70276
71425
|
);
|
|
70277
71426
|
const betweenHead = between.charCodeAt(0);
|
|
70278
|
-
const
|
|
71427
|
+
const open2 = encodeInfo(
|
|
70279
71428
|
info.before.charCodeAt(info.before.length - 1),
|
|
70280
71429
|
betweenHead,
|
|
70281
71430
|
marker2
|
|
70282
71431
|
);
|
|
70283
|
-
if (
|
|
71432
|
+
if (open2.inside) {
|
|
70284
71433
|
between = encodeCharacterReference(betweenHead) + between.slice(1);
|
|
70285
71434
|
}
|
|
70286
71435
|
const betweenTail = between.charCodeAt(between.length - 1);
|
|
@@ -70292,7 +71441,7 @@ function strong$1(node2, _2, state, info) {
|
|
|
70292
71441
|
exit2();
|
|
70293
71442
|
state.attentionEncodeSurroundingInfo = {
|
|
70294
71443
|
after: close.outside,
|
|
70295
|
-
before:
|
|
71444
|
+
before: open2.outside
|
|
70296
71445
|
};
|
|
70297
71446
|
return before + between + after;
|
|
70298
71447
|
}
|
|
@@ -73206,7 +74355,7 @@ const attention = {
|
|
|
73206
74355
|
};
|
|
73207
74356
|
function resolveAllAttention(events2, context) {
|
|
73208
74357
|
let index2 = -1;
|
|
73209
|
-
let
|
|
74358
|
+
let open2;
|
|
73210
74359
|
let group;
|
|
73211
74360
|
let text2;
|
|
73212
74361
|
let openingSequence;
|
|
@@ -73216,16 +74365,16 @@ function resolveAllAttention(events2, context) {
|
|
|
73216
74365
|
let offset2;
|
|
73217
74366
|
while (++index2 < events2.length) {
|
|
73218
74367
|
if (events2[index2][0] === "enter" && events2[index2][1].type === "attentionSequence" && events2[index2][1]._close) {
|
|
73219
|
-
|
|
73220
|
-
while (
|
|
73221
|
-
if (events2[
|
|
73222
|
-
context.sliceSerialize(events2[
|
|
73223
|
-
if ((events2[
|
|
74368
|
+
open2 = index2;
|
|
74369
|
+
while (open2--) {
|
|
74370
|
+
if (events2[open2][0] === "exit" && events2[open2][1].type === "attentionSequence" && events2[open2][1]._open && // If the markers are the same:
|
|
74371
|
+
context.sliceSerialize(events2[open2][1]).charCodeAt(0) === context.sliceSerialize(events2[index2][1]).charCodeAt(0)) {
|
|
74372
|
+
if ((events2[open2][1]._close || events2[index2][1]._open) && (events2[index2][1].end.offset - events2[index2][1].start.offset) % 3 && !((events2[open2][1].end.offset - events2[open2][1].start.offset + events2[index2][1].end.offset - events2[index2][1].start.offset) % 3)) {
|
|
73224
74373
|
continue;
|
|
73225
74374
|
}
|
|
73226
|
-
use2 = events2[
|
|
74375
|
+
use2 = events2[open2][1].end.offset - events2[open2][1].start.offset > 1 && events2[index2][1].end.offset - events2[index2][1].start.offset > 1 ? 2 : 1;
|
|
73227
74376
|
const start2 = {
|
|
73228
|
-
...events2[
|
|
74377
|
+
...events2[open2][1].end
|
|
73229
74378
|
};
|
|
73230
74379
|
const end = {
|
|
73231
74380
|
...events2[index2][1].start
|
|
@@ -73236,7 +74385,7 @@ function resolveAllAttention(events2, context) {
|
|
|
73236
74385
|
type: use2 > 1 ? "strongSequence" : "emphasisSequence",
|
|
73237
74386
|
start: start2,
|
|
73238
74387
|
end: {
|
|
73239
|
-
...events2[
|
|
74388
|
+
...events2[open2][1].end
|
|
73240
74389
|
}
|
|
73241
74390
|
};
|
|
73242
74391
|
closingSequence = {
|
|
@@ -73249,7 +74398,7 @@ function resolveAllAttention(events2, context) {
|
|
|
73249
74398
|
text2 = {
|
|
73250
74399
|
type: use2 > 1 ? "strongText" : "emphasisText",
|
|
73251
74400
|
start: {
|
|
73252
|
-
...events2[
|
|
74401
|
+
...events2[open2][1].end
|
|
73253
74402
|
},
|
|
73254
74403
|
end: {
|
|
73255
74404
|
...events2[index2][1].start
|
|
@@ -73264,18 +74413,18 @@ function resolveAllAttention(events2, context) {
|
|
|
73264
74413
|
...closingSequence.end
|
|
73265
74414
|
}
|
|
73266
74415
|
};
|
|
73267
|
-
events2[
|
|
74416
|
+
events2[open2][1].end = {
|
|
73268
74417
|
...openingSequence.start
|
|
73269
74418
|
};
|
|
73270
74419
|
events2[index2][1].start = {
|
|
73271
74420
|
...closingSequence.end
|
|
73272
74421
|
};
|
|
73273
74422
|
nextEvents = [];
|
|
73274
|
-
if (events2[
|
|
73275
|
-
nextEvents = push(nextEvents, [["enter", events2[
|
|
74423
|
+
if (events2[open2][1].end.offset - events2[open2][1].start.offset) {
|
|
74424
|
+
nextEvents = push(nextEvents, [["enter", events2[open2][1], context], ["exit", events2[open2][1], context]]);
|
|
73276
74425
|
}
|
|
73277
74426
|
nextEvents = push(nextEvents, [["enter", group, context], ["enter", openingSequence, context], ["exit", openingSequence, context], ["enter", text2, context]]);
|
|
73278
|
-
nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events2.slice(
|
|
74427
|
+
nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events2.slice(open2 + 1, index2), context));
|
|
73279
74428
|
nextEvents = push(nextEvents, [["exit", text2, context], ["enter", closingSequence, context], ["exit", closingSequence, context], ["exit", group, context]]);
|
|
73280
74429
|
if (events2[index2][1].end.offset - events2[index2][1].start.offset) {
|
|
73281
74430
|
offset2 = 2;
|
|
@@ -73283,8 +74432,8 @@ function resolveAllAttention(events2, context) {
|
|
|
73283
74432
|
} else {
|
|
73284
74433
|
offset2 = 0;
|
|
73285
74434
|
}
|
|
73286
|
-
splice(events2,
|
|
73287
|
-
index2 =
|
|
74435
|
+
splice(events2, open2 - 1, index2 - open2 + 3, nextEvents);
|
|
74436
|
+
index2 = open2 + nextEvents.length - offset2 - 2;
|
|
73288
74437
|
break;
|
|
73289
74438
|
}
|
|
73290
74439
|
}
|
|
@@ -73316,10 +74465,10 @@ function tokenizeAttention(effects, ok2) {
|
|
|
73316
74465
|
}
|
|
73317
74466
|
const token = effects.exit("attentionSequence");
|
|
73318
74467
|
const after = classifyCharacter(code2);
|
|
73319
|
-
const
|
|
74468
|
+
const open2 = !after || after === 2 && before || attentionMarkers2.includes(code2);
|
|
73320
74469
|
const close = !before || before === 2 && after || attentionMarkers2.includes(previous2);
|
|
73321
|
-
token._open = Boolean(marker2 === 42 ?
|
|
73322
|
-
token._close = Boolean(marker2 === 42 ? close : close && (after || !
|
|
74470
|
+
token._open = Boolean(marker2 === 42 ? open2 : open2 && (before || !close));
|
|
74471
|
+
token._close = Boolean(marker2 === 42 ? close : close && (after || !open2));
|
|
73323
74472
|
return ok2(code2);
|
|
73324
74473
|
}
|
|
73325
74474
|
}
|
|
@@ -73341,9 +74490,9 @@ function tokenizeAutolink(effects, ok2, nok) {
|
|
|
73341
74490
|
effects.consume(code2);
|
|
73342
74491
|
effects.exit("autolinkMarker");
|
|
73343
74492
|
effects.enter("autolinkProtocol");
|
|
73344
|
-
return
|
|
74493
|
+
return open2;
|
|
73345
74494
|
}
|
|
73346
|
-
function
|
|
74495
|
+
function open2(code2) {
|
|
73347
74496
|
if (asciiAlpha(code2)) {
|
|
73348
74497
|
effects.consume(code2);
|
|
73349
74498
|
return schemeOrEmailAtext;
|
|
@@ -73555,9 +74704,9 @@ function tokenizeCharacterReference(effects, ok2, nok) {
|
|
|
73555
74704
|
effects.enter("characterReferenceMarker");
|
|
73556
74705
|
effects.consume(code2);
|
|
73557
74706
|
effects.exit("characterReferenceMarker");
|
|
73558
|
-
return
|
|
74707
|
+
return open2;
|
|
73559
74708
|
}
|
|
73560
|
-
function
|
|
74709
|
+
function open2(code2) {
|
|
73561
74710
|
if (code2 === 35) {
|
|
73562
74711
|
effects.enter("characterReferenceMarkerNumeric");
|
|
73563
74712
|
effects.consume(code2);
|
|
@@ -74895,9 +76044,9 @@ function tokenizeHtmlFlow(effects, ok2, nok) {
|
|
|
74895
76044
|
effects.enter("htmlFlow");
|
|
74896
76045
|
effects.enter("htmlFlowData");
|
|
74897
76046
|
effects.consume(code2);
|
|
74898
|
-
return
|
|
76047
|
+
return open2;
|
|
74899
76048
|
}
|
|
74900
|
-
function
|
|
76049
|
+
function open2(code2) {
|
|
74901
76050
|
if (code2 === 33) {
|
|
74902
76051
|
effects.consume(code2);
|
|
74903
76052
|
return declarationOpen;
|
|
@@ -75243,9 +76392,9 @@ function tokenizeHtmlText(effects, ok2, nok) {
|
|
|
75243
76392
|
effects.enter("htmlText");
|
|
75244
76393
|
effects.enter("htmlTextData");
|
|
75245
76394
|
effects.consume(code2);
|
|
75246
|
-
return
|
|
76395
|
+
return open2;
|
|
75247
76396
|
}
|
|
75248
|
-
function
|
|
76397
|
+
function open2(code2) {
|
|
75249
76398
|
if (code2 === 33) {
|
|
75250
76399
|
effects.consume(code2);
|
|
75251
76400
|
return declarationOpen;
|
|
@@ -75569,12 +76718,12 @@ function resolveToLabelEnd(events2, context) {
|
|
|
75569
76718
|
let index2 = events2.length;
|
|
75570
76719
|
let offset2 = 0;
|
|
75571
76720
|
let token;
|
|
75572
|
-
let
|
|
76721
|
+
let open2;
|
|
75573
76722
|
let close;
|
|
75574
76723
|
let media;
|
|
75575
76724
|
while (index2--) {
|
|
75576
76725
|
token = events2[index2][1];
|
|
75577
|
-
if (
|
|
76726
|
+
if (open2) {
|
|
75578
76727
|
if (token.type === "link" || token.type === "labelLink" && token._inactive) {
|
|
75579
76728
|
break;
|
|
75580
76729
|
}
|
|
@@ -75583,7 +76732,7 @@ function resolveToLabelEnd(events2, context) {
|
|
|
75583
76732
|
}
|
|
75584
76733
|
} else if (close) {
|
|
75585
76734
|
if (events2[index2][0] === "enter" && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) {
|
|
75586
|
-
|
|
76735
|
+
open2 = index2;
|
|
75587
76736
|
if (token.type !== "labelLink") {
|
|
75588
76737
|
offset2 = 2;
|
|
75589
76738
|
break;
|
|
@@ -75594,9 +76743,9 @@ function resolveToLabelEnd(events2, context) {
|
|
|
75594
76743
|
}
|
|
75595
76744
|
}
|
|
75596
76745
|
const group = {
|
|
75597
|
-
type: events2[
|
|
76746
|
+
type: events2[open2][1].type === "labelLink" ? "link" : "image",
|
|
75598
76747
|
start: {
|
|
75599
|
-
...events2[
|
|
76748
|
+
...events2[open2][1].start
|
|
75600
76749
|
},
|
|
75601
76750
|
end: {
|
|
75602
76751
|
...events2[events2.length - 1][1].end
|
|
@@ -75605,7 +76754,7 @@ function resolveToLabelEnd(events2, context) {
|
|
|
75605
76754
|
const label = {
|
|
75606
76755
|
type: "label",
|
|
75607
76756
|
start: {
|
|
75608
|
-
...events2[
|
|
76757
|
+
...events2[open2][1].start
|
|
75609
76758
|
},
|
|
75610
76759
|
end: {
|
|
75611
76760
|
...events2[close][1].end
|
|
@@ -75614,20 +76763,20 @@ function resolveToLabelEnd(events2, context) {
|
|
|
75614
76763
|
const text2 = {
|
|
75615
76764
|
type: "labelText",
|
|
75616
76765
|
start: {
|
|
75617
|
-
...events2[
|
|
76766
|
+
...events2[open2 + offset2 + 2][1].end
|
|
75618
76767
|
},
|
|
75619
76768
|
end: {
|
|
75620
76769
|
...events2[close - 2][1].start
|
|
75621
76770
|
}
|
|
75622
76771
|
};
|
|
75623
76772
|
media = [["enter", group, context], ["enter", label, context]];
|
|
75624
|
-
media = push(media, events2.slice(
|
|
76773
|
+
media = push(media, events2.slice(open2 + 1, open2 + offset2 + 3));
|
|
75625
76774
|
media = push(media, [["enter", text2, context]]);
|
|
75626
|
-
media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events2.slice(
|
|
76775
|
+
media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events2.slice(open2 + offset2 + 4, close - 3), context));
|
|
75627
76776
|
media = push(media, [["exit", text2, context], events2[close - 2], events2[close - 1], ["exit", label, context]]);
|
|
75628
76777
|
media = push(media, events2.slice(close + 1));
|
|
75629
76778
|
media = push(media, [["exit", group, context]]);
|
|
75630
|
-
splice(events2,
|
|
76779
|
+
splice(events2, open2, events2.length, media);
|
|
75631
76780
|
return events2;
|
|
75632
76781
|
}
|
|
75633
76782
|
function tokenizeLabelEnd(effects, ok2, nok) {
|
|
@@ -75770,9 +76919,9 @@ function tokenizeLabelStartImage(effects, ok2, nok) {
|
|
|
75770
76919
|
effects.enter("labelImageMarker");
|
|
75771
76920
|
effects.consume(code2);
|
|
75772
76921
|
effects.exit("labelImageMarker");
|
|
75773
|
-
return
|
|
76922
|
+
return open2;
|
|
75774
76923
|
}
|
|
75775
|
-
function
|
|
76924
|
+
function open2(code2) {
|
|
75776
76925
|
if (code2 === 91) {
|
|
75777
76926
|
effects.enter("labelMarker");
|
|
75778
76927
|
effects.consume(code2);
|
|
@@ -76372,30 +77521,30 @@ function gfmStrikethrough(options) {
|
|
|
76372
77521
|
let index2 = -1;
|
|
76373
77522
|
while (++index2 < events2.length) {
|
|
76374
77523
|
if (events2[index2][0] === "enter" && events2[index2][1].type === "strikethroughSequenceTemporary" && events2[index2][1]._close) {
|
|
76375
|
-
let
|
|
76376
|
-
while (
|
|
76377
|
-
if (events2[
|
|
76378
|
-
events2[index2][1].end.offset - events2[index2][1].start.offset === events2[
|
|
77524
|
+
let open2 = index2;
|
|
77525
|
+
while (open2--) {
|
|
77526
|
+
if (events2[open2][0] === "exit" && events2[open2][1].type === "strikethroughSequenceTemporary" && events2[open2][1]._open && // If the sizes are the same:
|
|
77527
|
+
events2[index2][1].end.offset - events2[index2][1].start.offset === events2[open2][1].end.offset - events2[open2][1].start.offset) {
|
|
76379
77528
|
events2[index2][1].type = "strikethroughSequence";
|
|
76380
|
-
events2[
|
|
77529
|
+
events2[open2][1].type = "strikethroughSequence";
|
|
76381
77530
|
const strikethrough2 = {
|
|
76382
77531
|
type: "strikethrough",
|
|
76383
|
-
start: Object.assign({}, events2[
|
|
77532
|
+
start: Object.assign({}, events2[open2][1].start),
|
|
76384
77533
|
end: Object.assign({}, events2[index2][1].end)
|
|
76385
77534
|
};
|
|
76386
77535
|
const text2 = {
|
|
76387
77536
|
type: "strikethroughText",
|
|
76388
|
-
start: Object.assign({}, events2[
|
|
77537
|
+
start: Object.assign({}, events2[open2][1].end),
|
|
76389
77538
|
end: Object.assign({}, events2[index2][1].start)
|
|
76390
77539
|
};
|
|
76391
|
-
const nextEvents = [["enter", strikethrough2, context], ["enter", events2[
|
|
77540
|
+
const nextEvents = [["enter", strikethrough2, context], ["enter", events2[open2][1], context], ["exit", events2[open2][1], context], ["enter", text2, context]];
|
|
76392
77541
|
const insideSpan2 = context.parser.constructs.insideSpan.null;
|
|
76393
77542
|
if (insideSpan2) {
|
|
76394
|
-
splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan2, events2.slice(
|
|
77543
|
+
splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan2, events2.slice(open2 + 1, index2), context));
|
|
76395
77544
|
}
|
|
76396
77545
|
splice(nextEvents, nextEvents.length, 0, [["exit", text2, context], ["enter", events2[index2][1], context], ["exit", events2[index2][1], context], ["exit", strikethrough2, context]]);
|
|
76397
|
-
splice(events2,
|
|
76398
|
-
index2 =
|
|
77546
|
+
splice(events2, open2 - 1, index2 - open2 + 3, nextEvents);
|
|
77547
|
+
index2 = open2 + nextEvents.length - 2;
|
|
76399
77548
|
break;
|
|
76400
77549
|
}
|
|
76401
77550
|
}
|
|
@@ -76937,8 +78086,8 @@ function gfmTaskListItem() {
|
|
|
76937
78086
|
}
|
|
76938
78087
|
function tokenizeTasklistCheck(effects, ok2, nok) {
|
|
76939
78088
|
const self2 = this;
|
|
76940
|
-
return
|
|
76941
|
-
function
|
|
78089
|
+
return open2;
|
|
78090
|
+
function open2(code2) {
|
|
76942
78091
|
if (
|
|
76943
78092
|
// Exit if there’s stuff before.
|
|
76944
78093
|
self2.previous !== null || // Exit if not in the first content that is the first child of a list
|
|
@@ -79371,8 +80520,8 @@ function compiler(options) {
|
|
|
79371
80520
|
return length;
|
|
79372
80521
|
}
|
|
79373
80522
|
function opener(create2, and) {
|
|
79374
|
-
return
|
|
79375
|
-
function
|
|
80523
|
+
return open2;
|
|
80524
|
+
function open2(token) {
|
|
79376
80525
|
enter.call(this, create2(token), token);
|
|
79377
80526
|
if (and) and.call(this, token);
|
|
79378
80527
|
}
|
|
@@ -79404,18 +80553,18 @@ function compiler(options) {
|
|
|
79404
80553
|
}
|
|
79405
80554
|
function exit2(token, onExitError) {
|
|
79406
80555
|
const node2 = this.stack.pop();
|
|
79407
|
-
const
|
|
79408
|
-
if (!
|
|
80556
|
+
const open2 = this.tokenStack.pop();
|
|
80557
|
+
if (!open2) {
|
|
79409
80558
|
throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({
|
|
79410
80559
|
start: token.start,
|
|
79411
80560
|
end: token.end
|
|
79412
80561
|
}) + "): it’s not open");
|
|
79413
|
-
} else if (
|
|
80562
|
+
} else if (open2[0].type !== token.type) {
|
|
79414
80563
|
if (onExitError) {
|
|
79415
|
-
onExitError.call(this, token,
|
|
80564
|
+
onExitError.call(this, token, open2[0]);
|
|
79416
80565
|
} else {
|
|
79417
|
-
const handler =
|
|
79418
|
-
handler.call(this, token,
|
|
80566
|
+
const handler = open2[1] || defaultOnError;
|
|
80567
|
+
handler.call(this, token, open2[0]);
|
|
79419
80568
|
}
|
|
79420
80569
|
}
|
|
79421
80570
|
node2.position.end = point(token.end);
|
|
@@ -83135,7 +84284,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
|
|
|
83135
84284
|
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 });
|
|
83136
84285
|
var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
|
|
83137
84286
|
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 }) });
|
|
83138
|
-
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-
|
|
84287
|
+
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-DE3KXslx.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
|
|
83139
84288
|
let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
|
|
83140
84289
|
`).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
|
|
83141
84290
|
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 }) })] }) });
|
|
@@ -83457,7 +84606,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
|
|
|
83457
84606
|
}, []), 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] });
|
|
83458
84607
|
};
|
|
83459
84608
|
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 }) })] });
|
|
83460
|
-
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-
|
|
84609
|
+
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-DjL45D7x.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
|
|
83461
84610
|
function ke(e, t) {
|
|
83462
84611
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
83463
84612
|
if (!(e != null && e.position && (t != null && t.position))) return false;
|
|
@@ -84203,6 +85352,8 @@ const attributeToDisplayFn = {
|
|
|
84203
85352
|
receivedCount: (value) => String(value),
|
|
84204
85353
|
lastReceivedAt: localMillisecondTimeOrNull,
|
|
84205
85354
|
disposedAt: localMillisecondTimeOrNull,
|
|
85355
|
+
// Internal resume plumbing — not surfaced in the UI
|
|
85356
|
+
resumeContext: (_value) => null,
|
|
84206
85357
|
// Event details
|
|
84207
85358
|
eventType: (value) => String(value),
|
|
84208
85359
|
correlationId: (value) => String(value),
|
|
@@ -84308,7 +85459,11 @@ const attributeToDisplayFn = {
|
|
|
84308
85459
|
if (typeof value !== "string" || value.length === 0)
|
|
84309
85460
|
return null;
|
|
84310
85461
|
return String(value);
|
|
84311
|
-
}
|
|
85462
|
+
},
|
|
85463
|
+
// Internal encryption plumbing: the run's X25519 public key, used by
|
|
85464
|
+
// cross-run writers to seal payloads to this run. Not actionable for users
|
|
85465
|
+
// and not secret — hidden rather than rendered as 44 opaque base64 chars.
|
|
85466
|
+
encryptionPublicKey: (_value) => null
|
|
84312
85467
|
};
|
|
84313
85468
|
const resolvableAttributes = [
|
|
84314
85469
|
"input",
|
|
@@ -84347,8 +85502,8 @@ const loadingSectionLabels = {
|
|
|
84347
85502
|
const AttributeBlock = ({ attribute, value, isLoading, inline = false, context }) => {
|
|
84348
85503
|
const decryptCtx = reactExports.useContext(DecryptClickContext);
|
|
84349
85504
|
const sectionOpenRef = reactExports.useRef(false);
|
|
84350
|
-
const handleSectionOpenChange = reactExports.useCallback((
|
|
84351
|
-
sectionOpenRef.current =
|
|
85505
|
+
const handleSectionOpenChange = reactExports.useCallback((open2) => {
|
|
85506
|
+
sectionOpenRef.current = open2;
|
|
84352
85507
|
}, []);
|
|
84353
85508
|
const label = loadingSectionLabels[attribute];
|
|
84354
85509
|
if (isLoading && label && !hasDisplayContent(value)) {
|
|
@@ -84518,8 +85673,8 @@ function EventItem({ event, onLoadEventData, encryptionKey, showSeparateEventOcc
|
|
|
84518
85673
|
second: "numeric"
|
|
84519
85674
|
});
|
|
84520
85675
|
const displayPayload = isLoading ? loadedData : mergedDisplay;
|
|
84521
|
-
return jsxRuntimeExports.jsxs(CollapsibleRoot, { variant: "card", onOpenChange: canHaveData ? (
|
|
84522
|
-
if (
|
|
85676
|
+
return jsxRuntimeExports.jsxs(CollapsibleRoot, { variant: "card", onOpenChange: canHaveData ? (open2) => {
|
|
85677
|
+
if (open2)
|
|
84523
85678
|
handleExpand();
|
|
84524
85679
|
} : void 0, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { className: "px-3 py-2", children: jsxRuntimeExports.jsxs("div", { className: "flex w-full items-center justify-between gap-3", children: [jsxRuntimeExports.jsx("span", { className: "text-gray-1000 text-label-12 font-mono", children: event.eventType }), jsxRuntimeExports.jsx("span", { className: "shrink-0 text-label-13 text-gray-900", children: displayedCreatedAtTime })] }) }), jsxRuntimeExports.jsxs(CollapsibleContent, { children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col bg-background-200 [&:has(+_*)]:border-b [&:has(+_*)]:border-gray-alpha-400", children: [showSeparateEventOccurrenceTimestamps && occurredAt && jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 py-2 px-3", children: [jsxRuntimeExports.jsx("span", { className: "text-label-12 text-gray-900", children: "Occurred" }), jsxRuntimeExports.jsx(TimestampTooltip, { date: occurredAt, children: jsxRuntimeExports.jsx("span", { className: "max-w-[70%] truncate text-right text-label-12 font-mono", children: formatEventTimestamp(occurredAt) }) })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 py-2 px-3", children: [jsxRuntimeExports.jsx("span", { className: "text-label-12 text-gray-900", children: "Event ID" }), jsxRuntimeExports.jsx("span", { className: "max-w-[70%] truncate text-right text-label-12 font-mono", children: event.eventId })] }), event.correlationId && jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 py-2 px-3", children: [jsxRuntimeExports.jsx("span", { className: "text-label-12 text-gray-900", children: "Correlation ID" }), jsxRuntimeExports.jsx("span", { className: "max-w-[70%] truncate text-right text-label-12 font-mono", children: event.correlationId })] })] }), isLoading && jsxRuntimeExports.jsxs("div", { className: "p-3", children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "h-4 w-[35%]" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "mt-2 h-4 w-[90%]" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "mt-2 h-4 w-[75%]" })] }), loadError && jsxRuntimeExports.jsx(ErrorCard, { title: "Failed to load event data", details: loadError, className: "mt-2" }), displayPayload != null && jsxRuntimeExports.jsx("div", { className: "[&>div]:border-none [&>div]:rounded-none", children: jsxRuntimeExports.jsx(EventDataBlock, { eventType: event.eventType, data: displayPayload }) })] })] });
|
|
84525
85680
|
}
|
|
@@ -87924,15 +89079,14 @@ function NewTraceViewerContent({ trace: trace2, onLoadMore, hasMore, isLoadingMo
|
|
|
87924
89079
|
}, [animateTo, clampToRoot]);
|
|
87925
89080
|
const ZOOM_FACTOR = 0.5;
|
|
87926
89081
|
const zoomBy = reactExports.useCallback((factor) => {
|
|
87927
|
-
|
|
87928
|
-
|
|
87929
|
-
|
|
87930
|
-
|
|
87931
|
-
|
|
87932
|
-
|
|
87933
|
-
|
|
87934
|
-
|
|
87935
|
-
}, [setViewport, clampToRoot]);
|
|
89082
|
+
const { start: start2, end } = viewportRef.current;
|
|
89083
|
+
const center = (start2 + end) / 2;
|
|
89084
|
+
const newDuration = Math.max(MIN_VIEWPORT_MS, (end - start2) * factor);
|
|
89085
|
+
animateTo(clampToRoot({
|
|
89086
|
+
start: center - newDuration / 2,
|
|
89087
|
+
end: center + newDuration / 2
|
|
89088
|
+
}));
|
|
89089
|
+
}, [animateTo, clampToRoot]);
|
|
87936
89090
|
const zoomIn = reactExports.useCallback(() => zoomBy(ZOOM_FACTOR), [zoomBy]);
|
|
87937
89091
|
const zoomOut = reactExports.useCallback(() => zoomBy(1 / ZOOM_FACTOR), [zoomBy]);
|
|
87938
89092
|
const isAtMinZoom = viewDuration >= root2.duration;
|
|
@@ -90730,8 +91884,8 @@ async function fetchStreams$1(worldEnv, runId) {
|
|
|
90730
91884
|
async function fetchWorkflowsManifest$1(worldEnv) {
|
|
90731
91885
|
return rpc("fetchWorkflowsManifest", { worldEnv });
|
|
90732
91886
|
}
|
|
90733
|
-
async function runHealthCheck$1(worldEnv,
|
|
90734
|
-
return rpc("runHealthCheck", { worldEnv,
|
|
91887
|
+
async function runHealthCheck$1(worldEnv, options) {
|
|
91888
|
+
return rpc("runHealthCheck", { worldEnv, options });
|
|
90735
91889
|
}
|
|
90736
91890
|
async function getEncryptionKeyForRun$1(worldEnv, runId) {
|
|
90737
91891
|
return rpc("getEncryptionKeyForRun", { worldEnv, runId });
|
|
@@ -90741,37 +91895,18 @@ function HealthCheckButton() {
|
|
|
90741
91895
|
const env2 = reactExports.useMemo(() => ({}), []);
|
|
90742
91896
|
const runChecks = reactExports.useCallback(async () => {
|
|
90743
91897
|
setIsChecking(true);
|
|
90744
|
-
const endpoints = ["workflow", "step"];
|
|
90745
|
-
const results = [];
|
|
90746
91898
|
try {
|
|
90747
|
-
|
|
90748
|
-
|
|
90749
|
-
|
|
90750
|
-
});
|
|
90751
|
-
if (response2.success) {
|
|
90752
|
-
results.push({ endpoint, result: response2.data });
|
|
90753
|
-
}
|
|
91899
|
+
const response2 = await runHealthCheck$1(env2, { timeout: 3e4 });
|
|
91900
|
+
if (!response2.success) {
|
|
91901
|
+
throw new Error(response2.error.message);
|
|
90754
91902
|
}
|
|
90755
|
-
|
|
90756
|
-
|
|
90757
|
-
|
|
90758
|
-
const totalLatency = results.reduce(
|
|
90759
|
-
(sum, r2) => sum + (r2.result.latencyMs ?? 0),
|
|
90760
|
-
0
|
|
90761
|
-
);
|
|
90762
|
-
toast.success("All endpoints healthy", {
|
|
90763
|
-
description: `Workflow and Step endpoints are responding (${totalLatency}ms total)`
|
|
90764
|
-
});
|
|
90765
|
-
} else if (anyHealthy) {
|
|
90766
|
-
const healthy = results.filter((r2) => r2.result.healthy);
|
|
90767
|
-
const unhealthy = results.filter((r2) => !r2.result.healthy);
|
|
90768
|
-
toast.warning("Partial health check success", {
|
|
90769
|
-
description: `${healthy.map((r2) => r2.endpoint).join(", ")} OK; ${unhealthy.map((r2) => `${r2.endpoint}: ${r2.result.error || "failed"}`).join(", ")}`
|
|
91903
|
+
if (response2.data.healthy) {
|
|
91904
|
+
toast.success("Workflow endpoint healthy", {
|
|
91905
|
+
description: `The queue-based check completed in ${response2.data.latencyMs ?? 0}ms.`
|
|
90770
91906
|
});
|
|
90771
91907
|
} else {
|
|
90772
|
-
const errors2 = results.map((r2) => `${r2.endpoint}: ${r2.result.error || "failed"}`).join("; ");
|
|
90773
91908
|
toast.error("Health check failed", {
|
|
90774
|
-
description:
|
|
91909
|
+
description: response2.data.error || "Workflow endpoint is unhealthy."
|
|
90775
91910
|
});
|
|
90776
91911
|
}
|
|
90777
91912
|
} catch (error2) {
|
|
@@ -90799,7 +91934,7 @@ function HealthCheckButton() {
|
|
|
90799
91934
|
}
|
|
90800
91935
|
) }),
|
|
90801
91936
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [
|
|
90802
|
-
"Run a queue-based health check on workflow
|
|
91937
|
+
"Run a queue-based health check on the workflow endpoint.",
|
|
90803
91938
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
90804
91939
|
"This bypasses Deployment Protection."
|
|
90805
91940
|
] }) })
|
|
@@ -90987,533 +92122,6 @@ function Logo({ className } = {}) {
|
|
|
90987
92122
|
}
|
|
90988
92123
|
);
|
|
90989
92124
|
}
|
|
90990
|
-
function pluralize(singular, plural, count2) {
|
|
90991
|
-
return count2 === 1 ? singular : plural;
|
|
90992
|
-
}
|
|
90993
|
-
function withResolvers$1() {
|
|
90994
|
-
let resolve2;
|
|
90995
|
-
let reject;
|
|
90996
|
-
const promise2 = new Promise((_resolve, _reject) => {
|
|
90997
|
-
resolve2 = _resolve;
|
|
90998
|
-
reject = _reject;
|
|
90999
|
-
});
|
|
91000
|
-
return { promise: promise2, resolve: resolve2, reject };
|
|
91001
|
-
}
|
|
91002
|
-
function once$1(fn2) {
|
|
91003
|
-
const result = {
|
|
91004
|
-
get value() {
|
|
91005
|
-
const value = fn2();
|
|
91006
|
-
Object.defineProperty(result, "value", { value });
|
|
91007
|
-
return value;
|
|
91008
|
-
}
|
|
91009
|
-
};
|
|
91010
|
-
return result;
|
|
91011
|
-
}
|
|
91012
|
-
var ms$1;
|
|
91013
|
-
var hasRequiredMs;
|
|
91014
|
-
function requireMs() {
|
|
91015
|
-
if (hasRequiredMs) return ms$1;
|
|
91016
|
-
hasRequiredMs = 1;
|
|
91017
|
-
var s2 = 1e3;
|
|
91018
|
-
var m2 = s2 * 60;
|
|
91019
|
-
var h2 = m2 * 60;
|
|
91020
|
-
var d2 = h2 * 24;
|
|
91021
|
-
var w2 = d2 * 7;
|
|
91022
|
-
var y2 = d2 * 365.25;
|
|
91023
|
-
ms$1 = function(val, options) {
|
|
91024
|
-
options = options || {};
|
|
91025
|
-
var type = typeof val;
|
|
91026
|
-
if (type === "string" && val.length > 0) {
|
|
91027
|
-
return parse2(val);
|
|
91028
|
-
} else if (type === "number" && isFinite(val)) {
|
|
91029
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
91030
|
-
}
|
|
91031
|
-
throw new Error(
|
|
91032
|
-
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
91033
|
-
);
|
|
91034
|
-
};
|
|
91035
|
-
function parse2(str) {
|
|
91036
|
-
str = String(str);
|
|
91037
|
-
if (str.length > 100) {
|
|
91038
|
-
return;
|
|
91039
|
-
}
|
|
91040
|
-
var match2 = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
91041
|
-
str
|
|
91042
|
-
);
|
|
91043
|
-
if (!match2) {
|
|
91044
|
-
return;
|
|
91045
|
-
}
|
|
91046
|
-
var n = parseFloat(match2[1]);
|
|
91047
|
-
var type = (match2[2] || "ms").toLowerCase();
|
|
91048
|
-
switch (type) {
|
|
91049
|
-
case "years":
|
|
91050
|
-
case "year":
|
|
91051
|
-
case "yrs":
|
|
91052
|
-
case "yr":
|
|
91053
|
-
case "y":
|
|
91054
|
-
return n * y2;
|
|
91055
|
-
case "weeks":
|
|
91056
|
-
case "week":
|
|
91057
|
-
case "w":
|
|
91058
|
-
return n * w2;
|
|
91059
|
-
case "days":
|
|
91060
|
-
case "day":
|
|
91061
|
-
case "d":
|
|
91062
|
-
return n * d2;
|
|
91063
|
-
case "hours":
|
|
91064
|
-
case "hour":
|
|
91065
|
-
case "hrs":
|
|
91066
|
-
case "hr":
|
|
91067
|
-
case "h":
|
|
91068
|
-
return n * h2;
|
|
91069
|
-
case "minutes":
|
|
91070
|
-
case "minute":
|
|
91071
|
-
case "mins":
|
|
91072
|
-
case "min":
|
|
91073
|
-
case "m":
|
|
91074
|
-
return n * m2;
|
|
91075
|
-
case "seconds":
|
|
91076
|
-
case "second":
|
|
91077
|
-
case "secs":
|
|
91078
|
-
case "sec":
|
|
91079
|
-
case "s":
|
|
91080
|
-
return n * s2;
|
|
91081
|
-
case "milliseconds":
|
|
91082
|
-
case "millisecond":
|
|
91083
|
-
case "msecs":
|
|
91084
|
-
case "msec":
|
|
91085
|
-
case "ms":
|
|
91086
|
-
return n;
|
|
91087
|
-
default:
|
|
91088
|
-
return void 0;
|
|
91089
|
-
}
|
|
91090
|
-
}
|
|
91091
|
-
function fmtShort(ms2) {
|
|
91092
|
-
var msAbs = Math.abs(ms2);
|
|
91093
|
-
if (msAbs >= d2) {
|
|
91094
|
-
return Math.round(ms2 / d2) + "d";
|
|
91095
|
-
}
|
|
91096
|
-
if (msAbs >= h2) {
|
|
91097
|
-
return Math.round(ms2 / h2) + "h";
|
|
91098
|
-
}
|
|
91099
|
-
if (msAbs >= m2) {
|
|
91100
|
-
return Math.round(ms2 / m2) + "m";
|
|
91101
|
-
}
|
|
91102
|
-
if (msAbs >= s2) {
|
|
91103
|
-
return Math.round(ms2 / s2) + "s";
|
|
91104
|
-
}
|
|
91105
|
-
return ms2 + "ms";
|
|
91106
|
-
}
|
|
91107
|
-
function fmtLong(ms2) {
|
|
91108
|
-
var msAbs = Math.abs(ms2);
|
|
91109
|
-
if (msAbs >= d2) {
|
|
91110
|
-
return plural(ms2, msAbs, d2, "day");
|
|
91111
|
-
}
|
|
91112
|
-
if (msAbs >= h2) {
|
|
91113
|
-
return plural(ms2, msAbs, h2, "hour");
|
|
91114
|
-
}
|
|
91115
|
-
if (msAbs >= m2) {
|
|
91116
|
-
return plural(ms2, msAbs, m2, "minute");
|
|
91117
|
-
}
|
|
91118
|
-
if (msAbs >= s2) {
|
|
91119
|
-
return plural(ms2, msAbs, s2, "second");
|
|
91120
|
-
}
|
|
91121
|
-
return ms2 + " ms";
|
|
91122
|
-
}
|
|
91123
|
-
function plural(ms2, msAbs, n, name2) {
|
|
91124
|
-
var isPlural = msAbs >= n * 1.5;
|
|
91125
|
-
return Math.round(ms2 / n) + " " + name2 + (isPlural ? "s" : "");
|
|
91126
|
-
}
|
|
91127
|
-
return ms$1;
|
|
91128
|
-
}
|
|
91129
|
-
var msExports = requireMs();
|
|
91130
|
-
const ms = /* @__PURE__ */ getDefaultExportFromCjs(msExports);
|
|
91131
|
-
function parseDurationToDate(param) {
|
|
91132
|
-
if (typeof param === "string") {
|
|
91133
|
-
const durationMs = ms(param);
|
|
91134
|
-
if (typeof durationMs !== "number" || durationMs < 0) {
|
|
91135
|
-
throw new Error(`Invalid duration: "${param}". Expected a valid duration string like "1s", "1m", "1h", etc.`);
|
|
91136
|
-
}
|
|
91137
|
-
return new Date(Date.now() + durationMs);
|
|
91138
|
-
} else if (typeof param === "number") {
|
|
91139
|
-
if (param < 0 || !Number.isFinite(param)) {
|
|
91140
|
-
throw new Error(`Invalid duration: ${param}. Expected a non-negative finite number of milliseconds.`);
|
|
91141
|
-
}
|
|
91142
|
-
return new Date(Date.now() + param);
|
|
91143
|
-
} else if (param instanceof Date || param && typeof param === "object" && typeof param.getTime === "function") {
|
|
91144
|
-
return param instanceof Date ? param : new Date(param.getTime());
|
|
91145
|
-
} else {
|
|
91146
|
-
throw new Error(`Invalid duration parameter. Expected a duration string, number (milliseconds), or Date object.`);
|
|
91147
|
-
}
|
|
91148
|
-
}
|
|
91149
|
-
const WORKFLOW_ROUTE_BASE = "/.well-known/workflow/v1";
|
|
91150
|
-
const BASE_PATH_SYMBOL = Symbol.for("@workflow/core/basePath");
|
|
91151
|
-
const globalConfig = globalThis;
|
|
91152
|
-
function getWorkflowBasePath() {
|
|
91153
|
-
return globalConfig[BASE_PATH_SYMBOL] ?? "";
|
|
91154
|
-
}
|
|
91155
|
-
function createWorkflowBaseUrl(origin) {
|
|
91156
|
-
new URL(origin);
|
|
91157
|
-
return `${origin.replace(/[?#].*$/, "").replace(/\/+$/, "")}${getWorkflowBasePath()}`;
|
|
91158
|
-
}
|
|
91159
|
-
function createWorkflowUrl(baseUrl, route) {
|
|
91160
|
-
const url2 = new URL(baseUrl);
|
|
91161
|
-
url2.pathname = `${url2.pathname.replace(/\/+$/, "")}${WORKFLOW_ROUTE_BASE}/${getWorkflowRouteEndpoint(route)}`;
|
|
91162
|
-
url2.search = route.type === "health" ? "__health" : "";
|
|
91163
|
-
url2.hash = "";
|
|
91164
|
-
return url2.toString();
|
|
91165
|
-
}
|
|
91166
|
-
function getWorkflowRouteEndpoint(route) {
|
|
91167
|
-
switch (route.type) {
|
|
91168
|
-
case "flow":
|
|
91169
|
-
case "health":
|
|
91170
|
-
return "flow";
|
|
91171
|
-
case "step":
|
|
91172
|
-
return "step";
|
|
91173
|
-
case "manifest":
|
|
91174
|
-
return "manifest.json";
|
|
91175
|
-
case "webhook":
|
|
91176
|
-
return `webhook/${encodeURIComponent(route.token)}`;
|
|
91177
|
-
}
|
|
91178
|
-
const exhaustive = route;
|
|
91179
|
-
return exhaustive;
|
|
91180
|
-
}
|
|
91181
|
-
function createWorkflowHealthEndpoint() {
|
|
91182
|
-
return `${getWorkflowBasePath()}${WORKFLOW_ROUTE_BASE}/flow?__health`;
|
|
91183
|
-
}
|
|
91184
|
-
const BASE_URL = "https://workflow-sdk.dev/err";
|
|
91185
|
-
function isError(value) {
|
|
91186
|
-
return typeof value === "object" && value !== null && "name" in value && "message" in value;
|
|
91187
|
-
}
|
|
91188
|
-
function appendFramedDetails(title, details) {
|
|
91189
|
-
if (details.length === 0)
|
|
91190
|
-
return title;
|
|
91191
|
-
const lines = [title];
|
|
91192
|
-
details.forEach((detail, index2) => {
|
|
91193
|
-
const isLast = index2 === details.length - 1;
|
|
91194
|
-
const head = isLast ? "╰▶ " : "├▶ ";
|
|
91195
|
-
const cont = isLast ? " " : "│ ";
|
|
91196
|
-
const text2 = `${detail.label}: ${detail.value}`;
|
|
91197
|
-
text2.split("\n").forEach((line, i) => lines.push(`${i === 0 ? head : cont}${line}`));
|
|
91198
|
-
});
|
|
91199
|
-
return lines.join("\n");
|
|
91200
|
-
}
|
|
91201
|
-
function buildFramedDetails(hint2, slug) {
|
|
91202
|
-
const out = [];
|
|
91203
|
-
if (hint2)
|
|
91204
|
-
out.push({ label: "hint", value: hint2 });
|
|
91205
|
-
if (slug)
|
|
91206
|
-
out.push({ label: "docs", value: `${BASE_URL}/${slug}` });
|
|
91207
|
-
return out;
|
|
91208
|
-
}
|
|
91209
|
-
const ERROR_SLUGS = {
|
|
91210
|
-
WEBHOOK_INVALID_RESPOND_WITH_VALUE: "webhook-invalid-respond-with-value",
|
|
91211
|
-
WEBHOOK_RESPONSE_NOT_SENT: "webhook-response-not-sent",
|
|
91212
|
-
HOOK_CONFLICT: "hook-conflict",
|
|
91213
|
-
RUNTIME_DECRYPTION_FAILED: "runtime-decryption-failed"
|
|
91214
|
-
};
|
|
91215
|
-
class WorkflowError extends Error {
|
|
91216
|
-
constructor(message2, options) {
|
|
91217
|
-
const msgDocs = appendFramedDetails(message2, buildFramedDetails(void 0, options == null ? void 0 : options.slug));
|
|
91218
|
-
super(msgDocs, { cause: options == null ? void 0 : options.cause });
|
|
91219
|
-
__publicField(this, "cause");
|
|
91220
|
-
if ((options == null ? void 0 : options.cause) !== void 0) {
|
|
91221
|
-
this.cause = options.cause;
|
|
91222
|
-
}
|
|
91223
|
-
if ((options == null ? void 0 : options.cause) instanceof Error) {
|
|
91224
|
-
this.stack = `${this.stack}
|
|
91225
|
-
Caused by: ${options.cause.stack}`;
|
|
91226
|
-
}
|
|
91227
|
-
}
|
|
91228
|
-
static is(value) {
|
|
91229
|
-
return isError(value) && value.name === "WorkflowError";
|
|
91230
|
-
}
|
|
91231
|
-
}
|
|
91232
|
-
class WorkflowWorldError extends WorkflowError {
|
|
91233
|
-
constructor(message2, options) {
|
|
91234
|
-
super(message2, {
|
|
91235
|
-
cause: options == null ? void 0 : options.cause
|
|
91236
|
-
});
|
|
91237
|
-
__publicField(this, "status");
|
|
91238
|
-
__publicField(this, "code");
|
|
91239
|
-
__publicField(this, "url");
|
|
91240
|
-
/** Retry-After value in seconds, present on 429 and 425 responses */
|
|
91241
|
-
__publicField(this, "retryAfter");
|
|
91242
|
-
this.name = "WorkflowWorldError";
|
|
91243
|
-
this.status = options == null ? void 0 : options.status;
|
|
91244
|
-
this.code = options == null ? void 0 : options.code;
|
|
91245
|
-
this.url = options == null ? void 0 : options.url;
|
|
91246
|
-
this.retryAfter = options == null ? void 0 : options.retryAfter;
|
|
91247
|
-
}
|
|
91248
|
-
static is(value) {
|
|
91249
|
-
return isError(value) && value.name === "WorkflowWorldError";
|
|
91250
|
-
}
|
|
91251
|
-
}
|
|
91252
|
-
class WorkflowRunFailedError extends WorkflowError {
|
|
91253
|
-
constructor(runId, error2, options = {}) {
|
|
91254
|
-
const message2 = error2 instanceof Error ? error2.message : typeof error2 === "string" ? error2 : error2 && typeof error2 === "object" && "message" in error2 ? String(error2.message) : "Unknown error";
|
|
91255
|
-
super(`Workflow run "${runId}" failed: ${message2}`, {
|
|
91256
|
-
cause: error2
|
|
91257
|
-
});
|
|
91258
|
-
__publicField(this, "runId");
|
|
91259
|
-
/**
|
|
91260
|
-
* The high-level error category (e.g. USER_ERROR, RUNTIME_ERROR) for the
|
|
91261
|
-
* failed run, from the run_failed event's `errorCode` field.
|
|
91262
|
-
*/
|
|
91263
|
-
__publicField(this, "errorCode");
|
|
91264
|
-
this.name = "WorkflowRunFailedError";
|
|
91265
|
-
this.runId = runId;
|
|
91266
|
-
if (options.errorCode !== void 0) {
|
|
91267
|
-
this.errorCode = options.errorCode;
|
|
91268
|
-
}
|
|
91269
|
-
}
|
|
91270
|
-
static is(value) {
|
|
91271
|
-
return isError(value) && value.name === "WorkflowRunFailedError";
|
|
91272
|
-
}
|
|
91273
|
-
}
|
|
91274
|
-
class WorkflowRunNotCompletedError extends WorkflowError {
|
|
91275
|
-
constructor(runId, status) {
|
|
91276
|
-
super(`Workflow run "${runId}" has not completed`, {});
|
|
91277
|
-
__publicField(this, "runId");
|
|
91278
|
-
__publicField(this, "status");
|
|
91279
|
-
this.name = "WorkflowRunNotCompletedError";
|
|
91280
|
-
this.runId = runId;
|
|
91281
|
-
this.status = status;
|
|
91282
|
-
}
|
|
91283
|
-
static is(value) {
|
|
91284
|
-
return isError(value) && value.name === "WorkflowRunNotCompletedError";
|
|
91285
|
-
}
|
|
91286
|
-
}
|
|
91287
|
-
class WorkflowRuntimeError extends WorkflowError {
|
|
91288
|
-
constructor(message2, options) {
|
|
91289
|
-
super(message2, {
|
|
91290
|
-
...options
|
|
91291
|
-
});
|
|
91292
|
-
this.name = "WorkflowRuntimeError";
|
|
91293
|
-
}
|
|
91294
|
-
static is(value) {
|
|
91295
|
-
return isError(value) && value.name === "WorkflowRuntimeError";
|
|
91296
|
-
}
|
|
91297
|
-
}
|
|
91298
|
-
class RuntimeDecryptionError extends WorkflowRuntimeError {
|
|
91299
|
-
constructor(message2, options) {
|
|
91300
|
-
super(message2, {
|
|
91301
|
-
cause: options == null ? void 0 : options.cause,
|
|
91302
|
-
slug: ERROR_SLUGS.RUNTIME_DECRYPTION_FAILED
|
|
91303
|
-
});
|
|
91304
|
-
this.name = "RuntimeDecryptionError";
|
|
91305
|
-
if ((options == null ? void 0 : options.context) !== void 0) {
|
|
91306
|
-
this.context = options.context;
|
|
91307
|
-
}
|
|
91308
|
-
}
|
|
91309
|
-
static is(value) {
|
|
91310
|
-
return isError(value) && value.name === "RuntimeDecryptionError";
|
|
91311
|
-
}
|
|
91312
|
-
}
|
|
91313
|
-
class SerializationError extends WorkflowError {
|
|
91314
|
-
constructor(message2, options) {
|
|
91315
|
-
const body2 = appendFramedDetails(message2, buildFramedDetails(options == null ? void 0 : options.hint, void 0));
|
|
91316
|
-
super(body2, { cause: options == null ? void 0 : options.cause });
|
|
91317
|
-
__publicField(this, "hint");
|
|
91318
|
-
/**
|
|
91319
|
-
* Serialization errors are deterministic — if a step returns a non-POJO,
|
|
91320
|
-
* replaying the step will always produce the same non-serializable value.
|
|
91321
|
-
* Retrying is guaranteed to fail, so these errors are surfaced as fatal
|
|
91322
|
-
* and skip the step-retry loop. `FatalError.is()` recognizes any error
|
|
91323
|
-
* with `fatal: true` (see `packages/errors/src/index.ts`), so no other
|
|
91324
|
-
* wiring is required for user-thrown SerializationErrors.
|
|
91325
|
-
*/
|
|
91326
|
-
__publicField(this, "fatal", true);
|
|
91327
|
-
this.name = "SerializationError";
|
|
91328
|
-
this.hint = options == null ? void 0 : options.hint;
|
|
91329
|
-
}
|
|
91330
|
-
static is(value) {
|
|
91331
|
-
return isError(value) && value.name === "SerializationError";
|
|
91332
|
-
}
|
|
91333
|
-
}
|
|
91334
|
-
class WorkflowRunNotFoundError extends WorkflowError {
|
|
91335
|
-
constructor(runId) {
|
|
91336
|
-
super(`Workflow run "${runId}" not found`, {});
|
|
91337
|
-
__publicField(this, "runId");
|
|
91338
|
-
this.name = "WorkflowRunNotFoundError";
|
|
91339
|
-
this.runId = runId;
|
|
91340
|
-
}
|
|
91341
|
-
static is(value) {
|
|
91342
|
-
return isError(value) && value.name === "WorkflowRunNotFoundError";
|
|
91343
|
-
}
|
|
91344
|
-
}
|
|
91345
|
-
class HookConflictError extends WorkflowError {
|
|
91346
|
-
constructor(token, conflictingRunId) {
|
|
91347
|
-
super(`Hook token "${token}" is already in use by another workflow${conflictingRunId ? ` (run "${conflictingRunId}")` : ""}`, {
|
|
91348
|
-
slug: ERROR_SLUGS.HOOK_CONFLICT
|
|
91349
|
-
});
|
|
91350
|
-
__publicField(this, "token");
|
|
91351
|
-
// TODO: Make this required once all persisted hook_conflict events and World
|
|
91352
|
-
// implementations always include the active hook owner's run ID.
|
|
91353
|
-
__publicField(this, "conflictingRunId");
|
|
91354
|
-
this.name = "HookConflictError";
|
|
91355
|
-
this.token = token;
|
|
91356
|
-
if (conflictingRunId !== void 0) {
|
|
91357
|
-
this.conflictingRunId = conflictingRunId;
|
|
91358
|
-
}
|
|
91359
|
-
}
|
|
91360
|
-
static is(value) {
|
|
91361
|
-
return isError(value) && value.name === "HookConflictError";
|
|
91362
|
-
}
|
|
91363
|
-
}
|
|
91364
|
-
class HookNotFoundError extends WorkflowError {
|
|
91365
|
-
constructor(token) {
|
|
91366
|
-
super("Hook not found", {});
|
|
91367
|
-
__publicField(this, "token");
|
|
91368
|
-
this.name = "HookNotFoundError";
|
|
91369
|
-
this.token = token;
|
|
91370
|
-
}
|
|
91371
|
-
static is(value) {
|
|
91372
|
-
return isError(value) && value.name === "HookNotFoundError";
|
|
91373
|
-
}
|
|
91374
|
-
}
|
|
91375
|
-
class EntityConflictError extends WorkflowWorldError {
|
|
91376
|
-
constructor(message2) {
|
|
91377
|
-
super(message2);
|
|
91378
|
-
this.name = "EntityConflictError";
|
|
91379
|
-
}
|
|
91380
|
-
static is(value) {
|
|
91381
|
-
return isError(value) && value.name === "EntityConflictError";
|
|
91382
|
-
}
|
|
91383
|
-
}
|
|
91384
|
-
class RunExpiredError extends WorkflowWorldError {
|
|
91385
|
-
constructor(message2) {
|
|
91386
|
-
super(message2);
|
|
91387
|
-
this.name = "RunExpiredError";
|
|
91388
|
-
}
|
|
91389
|
-
static is(value) {
|
|
91390
|
-
return isError(value) && value.name === "RunExpiredError";
|
|
91391
|
-
}
|
|
91392
|
-
}
|
|
91393
|
-
class TooEarlyError extends WorkflowWorldError {
|
|
91394
|
-
constructor(message2, options) {
|
|
91395
|
-
super(message2, { retryAfter: options == null ? void 0 : options.retryAfter });
|
|
91396
|
-
this.name = "TooEarlyError";
|
|
91397
|
-
}
|
|
91398
|
-
static is(value) {
|
|
91399
|
-
return isError(value) && value.name === "TooEarlyError";
|
|
91400
|
-
}
|
|
91401
|
-
}
|
|
91402
|
-
class ThrottleError extends WorkflowWorldError {
|
|
91403
|
-
constructor(message2, options) {
|
|
91404
|
-
super(message2);
|
|
91405
|
-
__publicField(this, "retryAfter");
|
|
91406
|
-
this.name = "ThrottleError";
|
|
91407
|
-
this.retryAfter = options == null ? void 0 : options.retryAfter;
|
|
91408
|
-
}
|
|
91409
|
-
static is(value) {
|
|
91410
|
-
return isError(value) && value.name === "ThrottleError";
|
|
91411
|
-
}
|
|
91412
|
-
}
|
|
91413
|
-
class PreconditionFailedError extends WorkflowWorldError {
|
|
91414
|
-
constructor(message2, options) {
|
|
91415
|
-
super(message2, { status: 412, retryAfter: options == null ? void 0 : options.retryAfter });
|
|
91416
|
-
this.name = "PreconditionFailedError";
|
|
91417
|
-
}
|
|
91418
|
-
static is(value) {
|
|
91419
|
-
return isError(value) && value.name === "PreconditionFailedError";
|
|
91420
|
-
}
|
|
91421
|
-
}
|
|
91422
|
-
class WorkflowRunCancelledError extends WorkflowError {
|
|
91423
|
-
constructor(runId) {
|
|
91424
|
-
super(`Workflow run "${runId}" cancelled`, {});
|
|
91425
|
-
__publicField(this, "runId");
|
|
91426
|
-
this.name = "WorkflowRunCancelledError";
|
|
91427
|
-
this.runId = runId;
|
|
91428
|
-
}
|
|
91429
|
-
static is(value) {
|
|
91430
|
-
return isError(value) && value.name === "WorkflowRunCancelledError";
|
|
91431
|
-
}
|
|
91432
|
-
}
|
|
91433
|
-
class RunNotSupportedError extends WorkflowError {
|
|
91434
|
-
constructor(runSpecVersion, worldSpecVersion) {
|
|
91435
|
-
super(`Run requires spec version ${runSpecVersion}, but world supports version ${worldSpecVersion}. Please upgrade 'workflow' package.`);
|
|
91436
|
-
__publicField(this, "runSpecVersion");
|
|
91437
|
-
__publicField(this, "worldSpecVersion");
|
|
91438
|
-
this.name = "RunNotSupportedError";
|
|
91439
|
-
this.runSpecVersion = runSpecVersion;
|
|
91440
|
-
this.worldSpecVersion = worldSpecVersion;
|
|
91441
|
-
}
|
|
91442
|
-
static is(value) {
|
|
91443
|
-
return isError(value) && value.name === "RunNotSupportedError";
|
|
91444
|
-
}
|
|
91445
|
-
}
|
|
91446
|
-
class FatalError extends Error {
|
|
91447
|
-
constructor(message2) {
|
|
91448
|
-
super(message2);
|
|
91449
|
-
__publicField(this, "fatal", true);
|
|
91450
|
-
this.name = "FatalError";
|
|
91451
|
-
}
|
|
91452
|
-
static is(value) {
|
|
91453
|
-
if (!isError(value))
|
|
91454
|
-
return false;
|
|
91455
|
-
if (value.name === "FatalError")
|
|
91456
|
-
return true;
|
|
91457
|
-
return value.fatal === true;
|
|
91458
|
-
}
|
|
91459
|
-
}
|
|
91460
|
-
class RetryableError extends Error {
|
|
91461
|
-
constructor(message2, options = {}) {
|
|
91462
|
-
super(message2);
|
|
91463
|
-
/**
|
|
91464
|
-
* The Date when the step should be retried.
|
|
91465
|
-
*/
|
|
91466
|
-
__publicField(this, "retryAfter");
|
|
91467
|
-
this.name = "RetryableError";
|
|
91468
|
-
if (options.retryAfter !== void 0) {
|
|
91469
|
-
this.retryAfter = parseDurationToDate(options.retryAfter);
|
|
91470
|
-
} else {
|
|
91471
|
-
this.retryAfter = new Date(Date.now() + 1e3);
|
|
91472
|
-
}
|
|
91473
|
-
}
|
|
91474
|
-
static is(value) {
|
|
91475
|
-
return isError(value) && value.name === "RetryableError";
|
|
91476
|
-
}
|
|
91477
|
-
}
|
|
91478
|
-
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.";
|
|
91479
|
-
const FATAL_ERROR_KEY = Symbol.for("@workflow/errors//FatalError");
|
|
91480
|
-
const RETRYABLE_ERROR_KEY = Symbol.for("@workflow/errors//RetryableError");
|
|
91481
|
-
const HOOK_CONFLICT_ERROR_KEY = Symbol.for("@workflow/errors//HookConflictError");
|
|
91482
|
-
const RUNTIME_DECRYPTION_ERROR_KEY = Symbol.for("@workflow/errors//RuntimeDecryptionError");
|
|
91483
|
-
if (typeof globalThis !== "undefined") {
|
|
91484
|
-
if (!Object.hasOwn(globalThis, FATAL_ERROR_KEY)) {
|
|
91485
|
-
Object.defineProperty(globalThis, FATAL_ERROR_KEY, {
|
|
91486
|
-
value: FatalError,
|
|
91487
|
-
writable: false,
|
|
91488
|
-
enumerable: false,
|
|
91489
|
-
configurable: false
|
|
91490
|
-
});
|
|
91491
|
-
}
|
|
91492
|
-
if (!Object.hasOwn(globalThis, RETRYABLE_ERROR_KEY)) {
|
|
91493
|
-
Object.defineProperty(globalThis, RETRYABLE_ERROR_KEY, {
|
|
91494
|
-
value: RetryableError,
|
|
91495
|
-
writable: false,
|
|
91496
|
-
enumerable: false,
|
|
91497
|
-
configurable: false
|
|
91498
|
-
});
|
|
91499
|
-
}
|
|
91500
|
-
if (!Object.hasOwn(globalThis, HOOK_CONFLICT_ERROR_KEY)) {
|
|
91501
|
-
Object.defineProperty(globalThis, HOOK_CONFLICT_ERROR_KEY, {
|
|
91502
|
-
value: HookConflictError,
|
|
91503
|
-
writable: false,
|
|
91504
|
-
enumerable: false,
|
|
91505
|
-
configurable: false
|
|
91506
|
-
});
|
|
91507
|
-
}
|
|
91508
|
-
if (!Object.hasOwn(globalThis, RUNTIME_DECRYPTION_ERROR_KEY)) {
|
|
91509
|
-
Object.defineProperty(globalThis, RUNTIME_DECRYPTION_ERROR_KEY, {
|
|
91510
|
-
value: RuntimeDecryptionError,
|
|
91511
|
-
writable: false,
|
|
91512
|
-
enumerable: false,
|
|
91513
|
-
configurable: false
|
|
91514
|
-
});
|
|
91515
|
-
}
|
|
91516
|
-
}
|
|
91517
92125
|
const RETRYABLE_WORLD_ERROR_CODES = /* @__PURE__ */ new Set(["TRANSPORT", "TIMEOUT"]);
|
|
91518
92126
|
function isRetryableWorldError(err) {
|
|
91519
92127
|
if (ThrottleError.is(err)) {
|
|
@@ -91538,7 +92146,7 @@ const colorEnabled = (() => {
|
|
|
91538
92146
|
return false;
|
|
91539
92147
|
return Boolean((_a3 = p2.stdout) == null ? void 0 : _a3.isTTY);
|
|
91540
92148
|
})();
|
|
91541
|
-
const sgr = (
|
|
92149
|
+
const sgr = (open2, close) => (s2) => colorEnabled ? `\x1B[${open2}m${s2}\x1B[${close}m` : s2;
|
|
91542
92150
|
const chalk = {
|
|
91543
92151
|
bold: sgr(1, 22),
|
|
91544
92152
|
dim: sgr(2, 22),
|
|
@@ -92033,83 +92641,78 @@ createLogger("adapter");
|
|
|
92033
92641
|
createLogger("build", {
|
|
92034
92642
|
debugNamespace: "workflow:build"
|
|
92035
92643
|
});
|
|
92036
|
-
const
|
|
92037
|
-
const
|
|
92038
|
-
const
|
|
92039
|
-
|
|
92040
|
-
|
|
92041
|
-
|
|
92644
|
+
const RegisteredStepsKey = Symbol.for("@workflow/core//registeredSteps");
|
|
92645
|
+
const globalSymbols$1 = globalThis;
|
|
92646
|
+
const registeredSteps = globalSymbols$1[RegisteredStepsKey] ?? (globalSymbols$1[RegisteredStepsKey] = /* @__PURE__ */ new Map());
|
|
92647
|
+
const BUILTIN_RESPONSE_STEP_NAMES = /* @__PURE__ */ new Set([
|
|
92648
|
+
"__builtin_response_array_buffer",
|
|
92649
|
+
"__builtin_response_json",
|
|
92650
|
+
"__builtin_response_text"
|
|
92651
|
+
]);
|
|
92652
|
+
function getStepIdAliasCandidates(stepId) {
|
|
92653
|
+
const parts = stepId.split("//");
|
|
92654
|
+
if (parts.length !== 3 || parts[0] !== "step") {
|
|
92655
|
+
return [];
|
|
92042
92656
|
}
|
|
92043
|
-
|
|
92044
|
-
|
|
92045
|
-
|
|
92046
|
-
|
|
92047
|
-
|
|
92048
|
-
|
|
92049
|
-
|
|
92050
|
-
|
|
92051
|
-
|
|
92052
|
-
|
|
92657
|
+
const modulePath = parts[1];
|
|
92658
|
+
const fnName = parts[2];
|
|
92659
|
+
const modulePathAliases = /* @__PURE__ */ new Set();
|
|
92660
|
+
const addAlias = (aliasModulePath) => {
|
|
92661
|
+
if (aliasModulePath !== modulePath) {
|
|
92662
|
+
modulePathAliases.add(aliasModulePath);
|
|
92663
|
+
}
|
|
92664
|
+
};
|
|
92665
|
+
if (modulePath.startsWith("./workflows/")) {
|
|
92666
|
+
const workflowRelativePath = modulePath.slice("./".length);
|
|
92667
|
+
addAlias(`./example/${workflowRelativePath}`);
|
|
92668
|
+
addAlias(`./src/${workflowRelativePath}`);
|
|
92669
|
+
} else if (modulePath.startsWith("./example/workflows/")) {
|
|
92670
|
+
const workflowRelativePath = modulePath.slice("./example/".length);
|
|
92671
|
+
addAlias(`./${workflowRelativePath}`);
|
|
92672
|
+
addAlias(`./src/${workflowRelativePath}`);
|
|
92673
|
+
} else if (modulePath.startsWith("./src/workflows/")) {
|
|
92674
|
+
const workflowRelativePath = modulePath.slice("./src/".length);
|
|
92675
|
+
addAlias(`./${workflowRelativePath}`);
|
|
92676
|
+
addAlias(`./example/${workflowRelativePath}`);
|
|
92677
|
+
}
|
|
92678
|
+
return Array.from(modulePathAliases, (aliasModulePath) => `step//${aliasModulePath}//${fnName}`);
|
|
92053
92679
|
}
|
|
92054
|
-
|
|
92055
|
-
|
|
92056
|
-
|
|
92057
|
-
try {
|
|
92058
|
-
ciphertext = await globalThis.crypto.subtle.encrypt({ name: "AES-GCM", iv: nonce, tagLength: TAG_LENGTH }, key, data);
|
|
92059
|
-
} catch (cause) {
|
|
92060
|
-
throw new RuntimeDecryptionError(`AES-256-GCM encryption failed: ${cause instanceof Error ? cause.message : String(cause)}`, {
|
|
92061
|
-
cause,
|
|
92062
|
-
context: {
|
|
92063
|
-
operation: "encrypt",
|
|
92064
|
-
byteLength: data.byteLength
|
|
92065
|
-
}
|
|
92066
|
-
});
|
|
92680
|
+
function getBuiltinResponseStepAlias(stepId) {
|
|
92681
|
+
if (!BUILTIN_RESPONSE_STEP_NAMES.has(stepId)) {
|
|
92682
|
+
return void 0;
|
|
92067
92683
|
}
|
|
92068
|
-
const
|
|
92069
|
-
|
|
92070
|
-
|
|
92071
|
-
|
|
92684
|
+
for (const [registeredStepId, stepFn] of registeredSteps.entries()) {
|
|
92685
|
+
if (registeredStepId.endsWith(`//${stepId}`)) {
|
|
92686
|
+
return stepFn;
|
|
92687
|
+
}
|
|
92688
|
+
}
|
|
92689
|
+
return void 0;
|
|
92072
92690
|
}
|
|
92073
|
-
|
|
92074
|
-
const
|
|
92075
|
-
if (
|
|
92076
|
-
|
|
92077
|
-
context: {
|
|
92078
|
-
operation: "decrypt",
|
|
92079
|
-
byteLength: data.byteLength
|
|
92080
|
-
}
|
|
92081
|
-
});
|
|
92691
|
+
function getStepFunction(stepId) {
|
|
92692
|
+
const directMatch = registeredSteps.get(stepId);
|
|
92693
|
+
if (directMatch) {
|
|
92694
|
+
return directMatch;
|
|
92082
92695
|
}
|
|
92083
|
-
const
|
|
92084
|
-
|
|
92085
|
-
|
|
92086
|
-
|
|
92087
|
-
|
|
92088
|
-
} catch (cause) {
|
|
92089
|
-
const causeMsg = cause instanceof Error ? cause.message : String(cause);
|
|
92090
|
-
throw new RuntimeDecryptionError(`AES-256-GCM decryption failed: ${causeMsg}`, {
|
|
92091
|
-
cause,
|
|
92092
|
-
context: {
|
|
92093
|
-
operation: "decrypt",
|
|
92094
|
-
byteLength: data.byteLength
|
|
92095
|
-
}
|
|
92096
|
-
});
|
|
92696
|
+
for (const aliasStepId of getStepIdAliasCandidates(stepId)) {
|
|
92697
|
+
const aliasMatch = registeredSteps.get(aliasStepId);
|
|
92698
|
+
if (aliasMatch) {
|
|
92699
|
+
return aliasMatch;
|
|
92700
|
+
}
|
|
92097
92701
|
}
|
|
92098
|
-
|
|
92702
|
+
const builtinAliasMatch = getBuiltinResponseStepAlias(stepId);
|
|
92703
|
+
if (builtinAliasMatch) {
|
|
92704
|
+
return builtinAliasMatch;
|
|
92705
|
+
}
|
|
92706
|
+
return void 0;
|
|
92099
92707
|
}
|
|
92100
|
-
const encryption = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
92101
|
-
__proto__: null,
|
|
92102
|
-
decrypt: decrypt$1,
|
|
92103
|
-
encrypt: encrypt$1,
|
|
92104
|
-
importKey
|
|
92105
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
92106
92708
|
const STABLE_ULID = Symbol.for("WORKFLOW_STABLE_ULID");
|
|
92107
92709
|
const STREAM_NAME_SYMBOL = Symbol.for("WORKFLOW_STREAM_NAME");
|
|
92108
92710
|
const STREAM_TYPE_SYMBOL = Symbol.for("WORKFLOW_STREAM_TYPE");
|
|
92109
92711
|
const STREAM_FRAMING_SYMBOL = Symbol.for("WORKFLOW_STREAM_FRAMING");
|
|
92110
92712
|
const STREAM_SERVER_RUN_ID_SYMBOL = Symbol.for("WORKFLOW_STREAM_SERVER_RUN_ID");
|
|
92111
92713
|
const STREAM_SERVER_DEPLOYMENT_ID_SYMBOL = Symbol.for("WORKFLOW_STREAM_SERVER_DEPLOYMENT_ID");
|
|
92112
|
-
const
|
|
92714
|
+
const STREAM_SERVER_PUBLIC_KEY_SYMBOL = Symbol.for("WORKFLOW_STREAM_SERVER_PUBLIC_KEY");
|
|
92715
|
+
const STREAM_DRAIN_SYMBOL = Symbol.for("WORKFLOW_STREAM_DRAIN");
|
|
92113
92716
|
const BODY_INIT_SYMBOL = Symbol.for("BODY_INIT");
|
|
92114
92717
|
const WEBHOOK_RESPONSE_WRITABLE = Symbol.for("WEBHOOK_RESPONSE_WRITABLE");
|
|
92115
92718
|
const WORKFLOW_CLASS_REGISTRY = Symbol.for("workflow-class-registry");
|
|
@@ -92132,6 +92735,11 @@ const getMaxBytesPerBatch = () => envNumber("WORKFLOW_STREAM_MAX_BYTES_PER_BATCH
|
|
|
92132
92735
|
integer: true,
|
|
92133
92736
|
min: 1
|
|
92134
92737
|
});
|
|
92738
|
+
const MAX_BUFFERED_BYTES = 8 * 1024 * 1024;
|
|
92739
|
+
const getMaxBufferedBytes = () => envNumber("WORKFLOW_STREAM_MAX_BUFFERED_BYTES", MAX_BUFFERED_BYTES, {
|
|
92740
|
+
integer: true,
|
|
92741
|
+
min: 1
|
|
92742
|
+
});
|
|
92135
92743
|
const LOCK_POLL_INTERVAL_MS = 10;
|
|
92136
92744
|
const getLockPollIntervalMs = () => envNumber("WORKFLOW_LOCK_POLL_INTERVAL_MS", LOCK_POLL_INTERVAL_MS, {
|
|
92137
92745
|
integer: true,
|
|
@@ -92180,6 +92788,14 @@ function isReadableUnlockedNotClosed(readable2) {
|
|
|
92180
92788
|
}
|
|
92181
92789
|
return true;
|
|
92182
92790
|
}
|
|
92791
|
+
function resolveAfterDrain(state) {
|
|
92792
|
+
const barrier = state.drainBarrier;
|
|
92793
|
+
if (!barrier) {
|
|
92794
|
+
state.resolve();
|
|
92795
|
+
return;
|
|
92796
|
+
}
|
|
92797
|
+
barrier().then(() => state.resolve(), (err) => state.reject(err));
|
|
92798
|
+
}
|
|
92183
92799
|
function pollWritableLock(writable, state) {
|
|
92184
92800
|
if (state.writablePollingInterval !== void 0) {
|
|
92185
92801
|
return;
|
|
@@ -92192,9 +92808,9 @@ function pollWritableLock(writable, state) {
|
|
|
92192
92808
|
}
|
|
92193
92809
|
if (isWritableUnlockedNotClosed(writable) && state.pendingOps === 0) {
|
|
92194
92810
|
state.doneResolved = true;
|
|
92195
|
-
state.resolve();
|
|
92196
92811
|
clearInterval(intervalId);
|
|
92197
92812
|
state.writablePollingInterval = void 0;
|
|
92813
|
+
resolveAfterDrain(state);
|
|
92198
92814
|
}
|
|
92199
92815
|
}, getLockPollIntervalMs());
|
|
92200
92816
|
state.writablePollingInterval = intervalId;
|
|
@@ -92211,16 +92827,19 @@ function pollReadableLock(readable2, state) {
|
|
|
92211
92827
|
}
|
|
92212
92828
|
if (isReadableUnlockedNotClosed(readable2) && state.pendingOps === 0) {
|
|
92213
92829
|
state.doneResolved = true;
|
|
92214
|
-
state.resolve();
|
|
92215
92830
|
clearInterval(intervalId);
|
|
92216
92831
|
state.readablePollingInterval = void 0;
|
|
92832
|
+
resolveAfterDrain(state);
|
|
92217
92833
|
}
|
|
92218
92834
|
}, getLockPollIntervalMs());
|
|
92219
92835
|
state.readablePollingInterval = intervalId;
|
|
92220
92836
|
}
|
|
92221
92837
|
function flushablePipe(source, sink, state) {
|
|
92222
|
-
const
|
|
92223
|
-
|
|
92838
|
+
const drain = sink[STREAM_DRAIN_SYMBOL];
|
|
92839
|
+
if (typeof drain === "function") {
|
|
92840
|
+
state.drainBarrier = drain;
|
|
92841
|
+
}
|
|
92842
|
+
return flushablePipePerChunk(source, sink, state);
|
|
92224
92843
|
}
|
|
92225
92844
|
async function flushablePipePerChunk(source, sink, state) {
|
|
92226
92845
|
const reader = source.getReader();
|
|
@@ -92259,124 +92878,10 @@ async function flushablePipePerChunk(source, sink, state) {
|
|
|
92259
92878
|
} catch (err) {
|
|
92260
92879
|
state.streamEnded = true;
|
|
92261
92880
|
cancelReason = err;
|
|
92262
|
-
if (
|
|
92263
|
-
state.
|
|
92264
|
-
state.reject(err);
|
|
92265
|
-
}
|
|
92266
|
-
throw err;
|
|
92267
|
-
} finally {
|
|
92268
|
-
reader.cancel(cancelReason).catch(() => {
|
|
92269
|
-
});
|
|
92270
|
-
reader.releaseLock();
|
|
92271
|
-
writer.releaseLock();
|
|
92272
|
-
}
|
|
92273
|
-
}
|
|
92274
|
-
function wake$1(ctx, which) {
|
|
92275
|
-
const resolve2 = ctx[which];
|
|
92276
|
-
if (resolve2) {
|
|
92277
|
-
ctx[which] = null;
|
|
92278
|
-
resolve2();
|
|
92279
|
-
}
|
|
92280
|
-
}
|
|
92281
|
-
function nextBatchSize(ctx) {
|
|
92282
|
-
let count2 = 0;
|
|
92283
|
-
let bytes = 0;
|
|
92284
|
-
for (const chunk of ctx.queue) {
|
|
92285
|
-
if (count2 >= ctx.maxChunksPerBatch)
|
|
92286
|
-
break;
|
|
92287
|
-
if (count2 > 0 && bytes + chunk.byteLength > ctx.maxBytesPerBatch)
|
|
92288
|
-
break;
|
|
92289
|
-
count2++;
|
|
92290
|
-
bytes += chunk.byteLength;
|
|
92291
|
-
}
|
|
92292
|
-
return count2;
|
|
92293
|
-
}
|
|
92294
|
-
async function drainBatches(ctx) {
|
|
92295
|
-
while (true) {
|
|
92296
|
-
if (ctx.queue.length === 0) {
|
|
92297
|
-
if (ctx.sourceDone)
|
|
92298
|
-
return;
|
|
92299
|
-
await new Promise((resolve2) => {
|
|
92300
|
-
ctx.wakeConsumer = resolve2;
|
|
92881
|
+
if (state.drainBarrier) {
|
|
92882
|
+
await state.drainBarrier().catch(() => {
|
|
92301
92883
|
});
|
|
92302
|
-
continue;
|
|
92303
92884
|
}
|
|
92304
|
-
const count2 = nextBatchSize(ctx);
|
|
92305
|
-
const batch = ctx.queue.slice(0, count2);
|
|
92306
|
-
ctx.queue = ctx.queue.slice(count2);
|
|
92307
|
-
await ctx.batchWrite(batch);
|
|
92308
|
-
ctx.state.pendingOps -= batch.length;
|
|
92309
|
-
wake$1(ctx, "wakeProducer");
|
|
92310
|
-
}
|
|
92311
|
-
}
|
|
92312
|
-
function readNextChunk(reader, writer, consumer) {
|
|
92313
|
-
return Promise.race([
|
|
92314
|
-
reader.read(),
|
|
92315
|
-
writer.closed.then(() => {
|
|
92316
|
-
throw new WorkflowRuntimeError("Writable stream closed prematurely");
|
|
92317
|
-
}),
|
|
92318
|
-
consumer.then(() => {
|
|
92319
|
-
throw new WorkflowRuntimeError("Stream consumer ended prematurely");
|
|
92320
|
-
}, (err) => {
|
|
92321
|
-
throw err;
|
|
92322
|
-
})
|
|
92323
|
-
]);
|
|
92324
|
-
}
|
|
92325
|
-
async function awaitBackpressureRelief(ctx, consumer, maxInflight) {
|
|
92326
|
-
if (ctx.state.pendingOps < maxInflight)
|
|
92327
|
-
return;
|
|
92328
|
-
await Promise.race([
|
|
92329
|
-
new Promise((resolve2) => {
|
|
92330
|
-
ctx.wakeProducer = resolve2;
|
|
92331
|
-
}),
|
|
92332
|
-
consumer.then(() => void 0, () => void 0)
|
|
92333
|
-
]);
|
|
92334
|
-
}
|
|
92335
|
-
async function flushablePipeCoalescing(source, sink, state, batchWrite) {
|
|
92336
|
-
const reader = source.getReader();
|
|
92337
|
-
const writer = sink.getWriter();
|
|
92338
|
-
const maxInflight = getMaxInflightChunks();
|
|
92339
|
-
let cancelReason;
|
|
92340
|
-
const ctx = {
|
|
92341
|
-
state,
|
|
92342
|
-
batchWrite,
|
|
92343
|
-
queue: [],
|
|
92344
|
-
sourceDone: false,
|
|
92345
|
-
wakeConsumer: null,
|
|
92346
|
-
wakeProducer: null,
|
|
92347
|
-
maxChunksPerBatch: getMaxChunksPerBatch(),
|
|
92348
|
-
maxBytesPerBatch: getMaxBytesPerBatch()
|
|
92349
|
-
};
|
|
92350
|
-
const consumer = drainBatches(ctx);
|
|
92351
|
-
try {
|
|
92352
|
-
while (!state.streamEnded) {
|
|
92353
|
-
const readResult = await readNextChunk(reader, writer, consumer);
|
|
92354
|
-
if (state.streamEnded)
|
|
92355
|
-
return;
|
|
92356
|
-
if (readResult.done) {
|
|
92357
|
-
ctx.sourceDone = true;
|
|
92358
|
-
wake$1(ctx, "wakeConsumer");
|
|
92359
|
-
await consumer;
|
|
92360
|
-
state.streamEnded = true;
|
|
92361
|
-
await writer.close();
|
|
92362
|
-
if (!state.doneResolved) {
|
|
92363
|
-
state.doneResolved = true;
|
|
92364
|
-
state.resolve();
|
|
92365
|
-
}
|
|
92366
|
-
return;
|
|
92367
|
-
}
|
|
92368
|
-
ctx.queue.push(readResult.value);
|
|
92369
|
-
state.pendingOps++;
|
|
92370
|
-
wake$1(ctx, "wakeConsumer");
|
|
92371
|
-
await awaitBackpressureRelief(ctx, consumer, maxInflight);
|
|
92372
|
-
}
|
|
92373
|
-
} catch (err) {
|
|
92374
|
-
state.streamEnded = true;
|
|
92375
|
-
cancelReason = err;
|
|
92376
|
-
ctx.sourceDone = true;
|
|
92377
|
-
wake$1(ctx, "wakeConsumer");
|
|
92378
|
-
await consumer.catch(() => {
|
|
92379
|
-
});
|
|
92380
92885
|
if (!state.doneResolved) {
|
|
92381
92886
|
state.doneResolved = true;
|
|
92382
92887
|
state.reject(err);
|
|
@@ -92389,70 +92894,6 @@ async function flushablePipeCoalescing(source, sink, state, batchWrite) {
|
|
|
92389
92894
|
writer.releaseLock();
|
|
92390
92895
|
}
|
|
92391
92896
|
}
|
|
92392
|
-
const RegisteredStepsKey = Symbol.for("@workflow/core//registeredSteps");
|
|
92393
|
-
const globalSymbols$1 = globalThis;
|
|
92394
|
-
const registeredSteps = globalSymbols$1[RegisteredStepsKey] ?? (globalSymbols$1[RegisteredStepsKey] = /* @__PURE__ */ new Map());
|
|
92395
|
-
const BUILTIN_RESPONSE_STEP_NAMES = /* @__PURE__ */ new Set([
|
|
92396
|
-
"__builtin_response_array_buffer",
|
|
92397
|
-
"__builtin_response_json",
|
|
92398
|
-
"__builtin_response_text"
|
|
92399
|
-
]);
|
|
92400
|
-
function getStepIdAliasCandidates(stepId) {
|
|
92401
|
-
const parts = stepId.split("//");
|
|
92402
|
-
if (parts.length !== 3 || parts[0] !== "step") {
|
|
92403
|
-
return [];
|
|
92404
|
-
}
|
|
92405
|
-
const modulePath = parts[1];
|
|
92406
|
-
const fnName = parts[2];
|
|
92407
|
-
const modulePathAliases = /* @__PURE__ */ new Set();
|
|
92408
|
-
const addAlias = (aliasModulePath) => {
|
|
92409
|
-
if (aliasModulePath !== modulePath) {
|
|
92410
|
-
modulePathAliases.add(aliasModulePath);
|
|
92411
|
-
}
|
|
92412
|
-
};
|
|
92413
|
-
if (modulePath.startsWith("./workflows/")) {
|
|
92414
|
-
const workflowRelativePath = modulePath.slice("./".length);
|
|
92415
|
-
addAlias(`./example/${workflowRelativePath}`);
|
|
92416
|
-
addAlias(`./src/${workflowRelativePath}`);
|
|
92417
|
-
} else if (modulePath.startsWith("./example/workflows/")) {
|
|
92418
|
-
const workflowRelativePath = modulePath.slice("./example/".length);
|
|
92419
|
-
addAlias(`./${workflowRelativePath}`);
|
|
92420
|
-
addAlias(`./src/${workflowRelativePath}`);
|
|
92421
|
-
} else if (modulePath.startsWith("./src/workflows/")) {
|
|
92422
|
-
const workflowRelativePath = modulePath.slice("./src/".length);
|
|
92423
|
-
addAlias(`./${workflowRelativePath}`);
|
|
92424
|
-
addAlias(`./example/${workflowRelativePath}`);
|
|
92425
|
-
}
|
|
92426
|
-
return Array.from(modulePathAliases, (aliasModulePath) => `step//${aliasModulePath}//${fnName}`);
|
|
92427
|
-
}
|
|
92428
|
-
function getBuiltinResponseStepAlias(stepId) {
|
|
92429
|
-
if (!BUILTIN_RESPONSE_STEP_NAMES.has(stepId)) {
|
|
92430
|
-
return void 0;
|
|
92431
|
-
}
|
|
92432
|
-
for (const [registeredStepId, stepFn] of registeredSteps.entries()) {
|
|
92433
|
-
if (registeredStepId.endsWith(`//${stepId}`)) {
|
|
92434
|
-
return stepFn;
|
|
92435
|
-
}
|
|
92436
|
-
}
|
|
92437
|
-
return void 0;
|
|
92438
|
-
}
|
|
92439
|
-
function getStepFunction(stepId) {
|
|
92440
|
-
const directMatch = registeredSteps.get(stepId);
|
|
92441
|
-
if (directMatch) {
|
|
92442
|
-
return directMatch;
|
|
92443
|
-
}
|
|
92444
|
-
for (const aliasStepId of getStepIdAliasCandidates(stepId)) {
|
|
92445
|
-
const aliasMatch = registeredSteps.get(aliasStepId);
|
|
92446
|
-
if (aliasMatch) {
|
|
92447
|
-
return aliasMatch;
|
|
92448
|
-
}
|
|
92449
|
-
}
|
|
92450
|
-
const builtinAliasMatch = getBuiltinResponseStepAlias(stepId);
|
|
92451
|
-
if (builtinAliasMatch) {
|
|
92452
|
-
return builtinAliasMatch;
|
|
92453
|
-
}
|
|
92454
|
-
return void 0;
|
|
92455
|
-
}
|
|
92456
92897
|
function assertWorldSupportsRuntimeProtocol(world) {
|
|
92457
92898
|
if (world.specVersion === SPEC_VERSION_CURRENT) {
|
|
92458
92899
|
return;
|
|
@@ -92928,19 +93369,6 @@ function getStepFunctionReviver(global2 = globalThis) {
|
|
|
92928
93369
|
}
|
|
92929
93370
|
};
|
|
92930
93371
|
}
|
|
92931
|
-
function isFormatPrefix(value) {
|
|
92932
|
-
return value.length === 4 && /^[a-z0-9]{4}$/.test(value);
|
|
92933
|
-
}
|
|
92934
|
-
const SerializationFormat = {
|
|
92935
|
-
/** devalue stringify/parse with TextEncoder/TextDecoder */
|
|
92936
|
-
DEVALUE_V1: "devl",
|
|
92937
|
-
/** Encrypted payload (inner payload has its own format prefix) */
|
|
92938
|
-
ENCRYPTED: "encr",
|
|
92939
|
-
/** Gzip-compressed payload (inner payload has its own format prefix) */
|
|
92940
|
-
GZIP: "gzip",
|
|
92941
|
-
/** Zstandard-compressed payload (inner payload has its own format prefix) */
|
|
92942
|
-
ZSTD: "zstd"
|
|
92943
|
-
};
|
|
92944
93372
|
const encoder = new TextEncoder();
|
|
92945
93373
|
const decoder = new TextDecoder();
|
|
92946
93374
|
function getReducersForMode(mode, global2 = globalThis, extraReducers) {
|
|
@@ -93003,7 +93431,7 @@ function getReviversForMode(mode, global2 = globalThis, extraRevivers) {
|
|
|
93003
93431
|
return base;
|
|
93004
93432
|
}
|
|
93005
93433
|
const devalueCodec = {
|
|
93006
|
-
formatPrefix: SerializationFormat.DEVALUE_V1,
|
|
93434
|
+
formatPrefix: SerializationFormat$1.DEVALUE_V1,
|
|
93007
93435
|
serialize(value, mode, options) {
|
|
93008
93436
|
const reducers = getReducersForMode(mode, options == null ? void 0 : options.global, options == null ? void 0 : options.extraReducers);
|
|
93009
93437
|
const str = stringify$2(value, reducers);
|
|
@@ -93019,45 +93447,6 @@ const devalueCodec = {
|
|
|
93019
93447
|
return unflatten(data, revivers);
|
|
93020
93448
|
}
|
|
93021
93449
|
};
|
|
93022
|
-
const FORMAT_PREFIX_LENGTH$1 = 4;
|
|
93023
|
-
const formatEncoder = new TextEncoder();
|
|
93024
|
-
const formatDecoder$1 = new TextDecoder();
|
|
93025
|
-
function encodeWithFormatPrefix(format2, payload) {
|
|
93026
|
-
if (!(payload instanceof Uint8Array)) {
|
|
93027
|
-
return payload;
|
|
93028
|
-
}
|
|
93029
|
-
const prefixBytes = formatEncoder.encode(format2);
|
|
93030
|
-
const result = new Uint8Array(FORMAT_PREFIX_LENGTH$1 + payload.length);
|
|
93031
|
-
result.set(prefixBytes, 0);
|
|
93032
|
-
result.set(payload, FORMAT_PREFIX_LENGTH$1);
|
|
93033
|
-
return result;
|
|
93034
|
-
}
|
|
93035
|
-
function peekFormatPrefix$1(data) {
|
|
93036
|
-
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$1) {
|
|
93037
|
-
return null;
|
|
93038
|
-
}
|
|
93039
|
-
const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH$1);
|
|
93040
|
-
const str = formatDecoder$1.decode(prefixBytes);
|
|
93041
|
-
return isFormatPrefix(str) ? str : null;
|
|
93042
|
-
}
|
|
93043
|
-
function decodeFormatPrefix(data) {
|
|
93044
|
-
if (!(data instanceof Uint8Array)) {
|
|
93045
|
-
return {
|
|
93046
|
-
format: SerializationFormat.DEVALUE_V1,
|
|
93047
|
-
payload: new TextEncoder().encode(JSON.stringify(data))
|
|
93048
|
-
};
|
|
93049
|
-
}
|
|
93050
|
-
if (data.length < FORMAT_PREFIX_LENGTH$1) {
|
|
93051
|
-
throw new Error(`Data too short to contain format prefix: expected at least ${FORMAT_PREFIX_LENGTH$1} bytes, got ${data.length}`);
|
|
93052
|
-
}
|
|
93053
|
-
const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH$1);
|
|
93054
|
-
const str = formatDecoder$1.decode(prefixBytes);
|
|
93055
|
-
if (!isFormatPrefix(str)) {
|
|
93056
|
-
throw new Error(`Invalid format prefix: "${str}". Must be 4 characters of [a-z0-9].`);
|
|
93057
|
-
}
|
|
93058
|
-
const payload = data.subarray(FORMAT_PREFIX_LENGTH$1);
|
|
93059
|
-
return { format: str, payload };
|
|
93060
|
-
}
|
|
93061
93450
|
const COMPRESSION_MIN_BYTES = 1024;
|
|
93062
93451
|
const COMPRESSION_MIN_SAVINGS_RATIO = 0.05;
|
|
93063
93452
|
const ZSTD_LEVEL = 3;
|
|
@@ -93169,7 +93558,7 @@ async function compress(data, enabled, stats2) {
|
|
|
93169
93558
|
return data;
|
|
93170
93559
|
}
|
|
93171
93560
|
const compressed = codec2 === "zstd" ? zstdBytes(data) : await gzipBytes(data);
|
|
93172
|
-
const format2 = codec2 === "zstd" ? SerializationFormat.ZSTD : SerializationFormat.GZIP;
|
|
93561
|
+
const format2 = codec2 === "zstd" ? SerializationFormat$1.ZSTD : SerializationFormat$1.GZIP;
|
|
93173
93562
|
const wrappedLength = 4 + compressed.length;
|
|
93174
93563
|
if (wrappedLength >= data.length * (1 - COMPRESSION_MIN_SAVINGS_RATIO)) {
|
|
93175
93564
|
recordStats(stats2, "none", data.length, data.length);
|
|
@@ -93182,17 +93571,17 @@ async function decompress$2(data, stats2) {
|
|
|
93182
93571
|
if (!(data instanceof Uint8Array))
|
|
93183
93572
|
return data;
|
|
93184
93573
|
const prefix = peekFormatPrefix$1(data);
|
|
93185
|
-
if (prefix === SerializationFormat.ZSTD) {
|
|
93186
|
-
const { payload } = decodeFormatPrefix(data);
|
|
93574
|
+
if (prefix === SerializationFormat$1.ZSTD) {
|
|
93575
|
+
const { payload } = decodeFormatPrefix$1(data);
|
|
93187
93576
|
const inflated = unzstdBytes(payload);
|
|
93188
93577
|
recordStats(stats2, "zstd", inflated.length, data.length);
|
|
93189
93578
|
return inflated;
|
|
93190
93579
|
}
|
|
93191
|
-
if (prefix === SerializationFormat.GZIP) {
|
|
93580
|
+
if (prefix === SerializationFormat$1.GZIP) {
|
|
93192
93581
|
if (!isGzipAvailable()) {
|
|
93193
93582
|
throw new Error("Compressed (gzip) workflow data encountered but DecompressionStream is not available in this runtime. Node.js 18+, browsers, and edge runtimes all support it.");
|
|
93194
93583
|
}
|
|
93195
|
-
const { payload } = decodeFormatPrefix(data);
|
|
93584
|
+
const { payload } = decodeFormatPrefix$1(data);
|
|
93196
93585
|
const inflated = await gunzipBytes(payload);
|
|
93197
93586
|
recordStats(stats2, "gzip", inflated.length, data.length);
|
|
93198
93587
|
return inflated;
|
|
@@ -93200,40 +93589,6 @@ async function decompress$2(data, stats2) {
|
|
|
93200
93589
|
recordStats(stats2, "none", data.length, data.length);
|
|
93201
93590
|
return data;
|
|
93202
93591
|
}
|
|
93203
|
-
async function resolveEncryptionKey(key) {
|
|
93204
|
-
return typeof key === "function" ? key() : key;
|
|
93205
|
-
}
|
|
93206
|
-
async function encrypt(data, key) {
|
|
93207
|
-
if (!key || !(data instanceof Uint8Array))
|
|
93208
|
-
return data;
|
|
93209
|
-
const encrypted = await encrypt$1(key, data);
|
|
93210
|
-
return encodeWithFormatPrefix(SerializationFormat.ENCRYPTED, encrypted);
|
|
93211
|
-
}
|
|
93212
|
-
async function decrypt(data, key) {
|
|
93213
|
-
if (!(data instanceof Uint8Array))
|
|
93214
|
-
return data;
|
|
93215
|
-
const format2 = peekFormatPrefix$1(data);
|
|
93216
|
-
if (format2 === SerializationFormat.ENCRYPTED && !key) {
|
|
93217
|
-
throw new RuntimeDecryptionError("Encrypted data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.", {
|
|
93218
|
-
context: {
|
|
93219
|
-
operation: "decrypt",
|
|
93220
|
-
byteLength: data.byteLength,
|
|
93221
|
-
formatPrefix: "encr"
|
|
93222
|
-
}
|
|
93223
|
-
});
|
|
93224
|
-
}
|
|
93225
|
-
if (format2 !== SerializationFormat.ENCRYPTED)
|
|
93226
|
-
return data;
|
|
93227
|
-
const { payload } = decodeFormatPrefix(data);
|
|
93228
|
-
try {
|
|
93229
|
-
return await decrypt$1(key, payload);
|
|
93230
|
-
} catch (error2) {
|
|
93231
|
-
if (RuntimeDecryptionError.is(error2) && error2.context) {
|
|
93232
|
-
error2.context.formatPrefix = format2;
|
|
93233
|
-
}
|
|
93234
|
-
throw error2;
|
|
93235
|
-
}
|
|
93236
|
-
}
|
|
93237
93592
|
function rethrowIfRuntimeError(error2) {
|
|
93238
93593
|
if (RuntimeDecryptionError.is(error2)) {
|
|
93239
93594
|
throw error2;
|
|
@@ -93257,7 +93612,7 @@ function formatSerializationError(context, error2) {
|
|
|
93257
93612
|
async function serialize$3(value, encryptionKey, options) {
|
|
93258
93613
|
try {
|
|
93259
93614
|
const payload = devalueCodec.serialize(value, "client", options);
|
|
93260
|
-
const prefixed = encodeWithFormatPrefix(SerializationFormat.DEVALUE_V1, payload);
|
|
93615
|
+
const prefixed = encodeWithFormatPrefix(SerializationFormat$1.DEVALUE_V1, payload);
|
|
93261
93616
|
const compressed = await compress(prefixed, (options == null ? void 0 : options.compression) === true, options == null ? void 0 : options.compressionStats);
|
|
93262
93617
|
return encrypt(compressed, encryptionKey);
|
|
93263
93618
|
} catch (error2) {
|
|
@@ -93274,8 +93629,8 @@ async function deserialize$2(data, encryptionKey, options) {
|
|
|
93274
93629
|
}
|
|
93275
93630
|
throw new Error("Cannot deserialize non-binary data without legacy support");
|
|
93276
93631
|
}
|
|
93277
|
-
const { format: format2, payload } = decodeFormatPrefix(decrypted);
|
|
93278
|
-
if (format2 === SerializationFormat.DEVALUE_V1) {
|
|
93632
|
+
const { format: format2, payload } = decodeFormatPrefix$1(decrypted);
|
|
93633
|
+
if (format2 === SerializationFormat$1.DEVALUE_V1) {
|
|
93279
93634
|
return devalueCodec.deserialize(payload, "client", options);
|
|
93280
93635
|
}
|
|
93281
93636
|
throw new Error(`Unsupported serialization format: ${format2}`);
|
|
@@ -93283,7 +93638,7 @@ async function deserialize$2(data, encryptionKey, options) {
|
|
|
93283
93638
|
async function serialize$2(value, encryptionKey, options) {
|
|
93284
93639
|
try {
|
|
93285
93640
|
const payload = devalueCodec.serialize(value, "step", options);
|
|
93286
|
-
const prefixed = encodeWithFormatPrefix(SerializationFormat.DEVALUE_V1, payload);
|
|
93641
|
+
const prefixed = encodeWithFormatPrefix(SerializationFormat$1.DEVALUE_V1, payload);
|
|
93287
93642
|
const compressed = await compress(prefixed, (options == null ? void 0 : options.compression) === true, options == null ? void 0 : options.compressionStats);
|
|
93288
93643
|
return encrypt(compressed, encryptionKey);
|
|
93289
93644
|
} catch (error2) {
|
|
@@ -93300,8 +93655,8 @@ async function deserialize$1(data, encryptionKey, options) {
|
|
|
93300
93655
|
}
|
|
93301
93656
|
throw new Error("Cannot deserialize non-binary data without legacy support");
|
|
93302
93657
|
}
|
|
93303
|
-
const { format: format2, payload } = decodeFormatPrefix(decrypted);
|
|
93304
|
-
if (format2 === SerializationFormat.DEVALUE_V1) {
|
|
93658
|
+
const { format: format2, payload } = decodeFormatPrefix$1(decrypted);
|
|
93659
|
+
if (format2 === SerializationFormat$1.DEVALUE_V1) {
|
|
93305
93660
|
return devalueCodec.deserialize(payload, "step", options);
|
|
93306
93661
|
}
|
|
93307
93662
|
throw new Error(`Unsupported serialization format: ${format2}`);
|
|
@@ -93313,8 +93668,8 @@ function deserialize(data, options) {
|
|
|
93313
93668
|
}
|
|
93314
93669
|
throw new Error("Cannot deserialize non-binary data without legacy support");
|
|
93315
93670
|
}
|
|
93316
|
-
const { format: format2, payload } = decodeFormatPrefix(data);
|
|
93317
|
-
if (format2 === SerializationFormat.DEVALUE_V1) {
|
|
93671
|
+
const { format: format2, payload } = decodeFormatPrefix$1(data);
|
|
93672
|
+
if (format2 === SerializationFormat$1.DEVALUE_V1) {
|
|
93318
93673
|
return devalueCodec.deserialize(payload, "workflow", options);
|
|
93319
93674
|
}
|
|
93320
93675
|
throw new Error(`Unsupported serialization format: ${format2}`);
|
|
@@ -93441,20 +93796,28 @@ async function recordCompression(stats2, operation) {
|
|
|
93441
93796
|
}
|
|
93442
93797
|
function getSerializeStream(reducers, cryptoKey) {
|
|
93443
93798
|
const encoder2 = new TextEncoder();
|
|
93444
|
-
const keyState = {
|
|
93799
|
+
const keyState = {
|
|
93800
|
+
resolved: false,
|
|
93801
|
+
key: void 0
|
|
93802
|
+
};
|
|
93803
|
+
let sealSession;
|
|
93445
93804
|
const stream = new TransformStream({
|
|
93446
93805
|
async transform(chunk, controller) {
|
|
93447
93806
|
try {
|
|
93448
93807
|
if (!keyState.resolved) {
|
|
93449
93808
|
keyState.key = await resolveEncryptionKey(cryptoKey);
|
|
93450
93809
|
keyState.resolved = true;
|
|
93810
|
+
if (isSealTarget(keyState.key)) {
|
|
93811
|
+
sealSession = createSealSession(keyState.key.recipientPublicKey, keyState.key.aad);
|
|
93812
|
+
}
|
|
93451
93813
|
}
|
|
93452
93814
|
const serialized = stringify$2(chunk, reducers);
|
|
93453
93815
|
const payload = encoder2.encode(serialized);
|
|
93454
|
-
let prefixed = encodeWithFormatPrefix(SerializationFormat.DEVALUE_V1, payload);
|
|
93455
|
-
if (
|
|
93456
|
-
|
|
93457
|
-
|
|
93816
|
+
let prefixed = encodeWithFormatPrefix(SerializationFormat$1.DEVALUE_V1, payload);
|
|
93817
|
+
if (sealSession) {
|
|
93818
|
+
prefixed = encodeWithFormatPrefix(SerializationFormat$1.SEALED, await sealSession.seal(prefixed));
|
|
93819
|
+
} else if (keyState.key) {
|
|
93820
|
+
prefixed = await encrypt(prefixed, keyState.key);
|
|
93458
93821
|
}
|
|
93459
93822
|
const frame2 = new Uint8Array(FRAME_HEADER_SIZE$1 + prefixed.length);
|
|
93460
93823
|
new DataView(frame2.buffer).setUint32(0, prefixed.length, false);
|
|
@@ -93475,7 +93838,11 @@ function getSerializeStream(reducers, cryptoKey) {
|
|
|
93475
93838
|
function getDeserializeStream(revivers, cryptoKey) {
|
|
93476
93839
|
const decoder2 = new TextDecoder();
|
|
93477
93840
|
let buffer2 = new Uint8Array(0);
|
|
93478
|
-
const keyState = {
|
|
93841
|
+
const keyState = {
|
|
93842
|
+
resolved: false,
|
|
93843
|
+
key: void 0
|
|
93844
|
+
};
|
|
93845
|
+
let openSession;
|
|
93479
93846
|
function appendToBuffer(data) {
|
|
93480
93847
|
const newBuffer = new Uint8Array(buffer2.length + data.length);
|
|
93481
93848
|
newBuffer.set(buffer2, 0);
|
|
@@ -93486,6 +93853,9 @@ function getDeserializeStream(revivers, cryptoKey) {
|
|
|
93486
93853
|
if (!keyState.resolved) {
|
|
93487
93854
|
keyState.key = await resolveEncryptionKey(cryptoKey);
|
|
93488
93855
|
keyState.resolved = true;
|
|
93856
|
+
if (isRunPayloadKeys(keyState.key)) {
|
|
93857
|
+
openSession = createOpenSession(keyState.key.keyPair, keyState.key.aad);
|
|
93858
|
+
}
|
|
93489
93859
|
}
|
|
93490
93860
|
while (buffer2.length >= FRAME_HEADER_SIZE$1) {
|
|
93491
93861
|
const frameLength = new DataView(buffer2.buffer, buffer2.byteOffset, buffer2.byteLength).getUint32(0, false);
|
|
@@ -93494,30 +93864,32 @@ function getDeserializeStream(revivers, cryptoKey) {
|
|
|
93494
93864
|
}
|
|
93495
93865
|
const frameData = buffer2.slice(FRAME_HEADER_SIZE$1, FRAME_HEADER_SIZE$1 + frameLength);
|
|
93496
93866
|
buffer2 = buffer2.slice(FRAME_HEADER_SIZE$1 + frameLength);
|
|
93497
|
-
let { format: format2, payload } = decodeFormatPrefix(frameData);
|
|
93498
|
-
if (format2 === SerializationFormat.ENCRYPTED) {
|
|
93499
|
-
|
|
93500
|
-
|
|
93867
|
+
let { format: format2, payload } = decodeFormatPrefix$1(frameData);
|
|
93868
|
+
if (format2 === SerializationFormat$1.ENCRYPTED || format2 === SerializationFormat$1.SEALED) {
|
|
93869
|
+
const sealed = format2 === SerializationFormat$1.SEALED;
|
|
93870
|
+
const usable = sealed ? isRunPayloadKeys(keyState.key) : aesKeyOf(keyState.key) !== void 0;
|
|
93871
|
+
if (!usable) {
|
|
93872
|
+
controller.error(new RuntimeDecryptionError(sealed ? "Sealed stream data encountered but no run keypair is available. Opening a sealed frame requires the run's own encryption key material." : "Encrypted stream data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.", {
|
|
93501
93873
|
context: {
|
|
93502
93874
|
operation: "decrypt",
|
|
93503
93875
|
byteLength: payload.byteLength,
|
|
93504
|
-
formatPrefix: "encr"
|
|
93876
|
+
formatPrefix: sealed ? "encp" : "encr"
|
|
93505
93877
|
}
|
|
93506
93878
|
}));
|
|
93507
93879
|
return;
|
|
93508
93880
|
}
|
|
93509
93881
|
let decrypted;
|
|
93510
93882
|
try {
|
|
93511
|
-
decrypted = await
|
|
93883
|
+
decrypted = sealed ? await openSession.open(decodeFormatPrefix$1(frameData).payload) : await decrypt(frameData, keyState.key);
|
|
93512
93884
|
} catch (error2) {
|
|
93513
93885
|
if (RuntimeDecryptionError.is(error2) && error2.context) {
|
|
93514
93886
|
error2.context.formatPrefix = format2;
|
|
93515
93887
|
}
|
|
93516
93888
|
throw error2;
|
|
93517
93889
|
}
|
|
93518
|
-
({ format: format2, payload } = decodeFormatPrefix(decrypted));
|
|
93890
|
+
({ format: format2, payload } = decodeFormatPrefix$1(decrypted));
|
|
93519
93891
|
}
|
|
93520
|
-
if (format2 === SerializationFormat.DEVALUE_V1) {
|
|
93892
|
+
if (format2 === SerializationFormat$1.DEVALUE_V1) {
|
|
93521
93893
|
const text2 = decoder2.decode(payload);
|
|
93522
93894
|
controller.enqueue(parse$5(text2, revivers));
|
|
93523
93895
|
}
|
|
@@ -93823,10 +94195,13 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
93823
94195
|
}
|
|
93824
94196
|
});
|
|
93825
94197
|
}
|
|
93826
|
-
const STREAM_FLUSH_INTERVAL_MS =
|
|
93827
|
-
const
|
|
93828
|
-
|
|
93829
|
-
|
|
94198
|
+
const STREAM_FLUSH_INTERVAL_MS = 0;
|
|
94199
|
+
const getEnvStreamFlushIntervalMs = () => {
|
|
94200
|
+
const value = envNumber("WORKFLOW_STREAM_FLUSH_INTERVAL_MS", Number.NaN, {
|
|
94201
|
+
integer: true
|
|
94202
|
+
});
|
|
94203
|
+
return Number.isNaN(value) ? void 0 : value;
|
|
94204
|
+
};
|
|
93830
94205
|
function recordStreamWriteFlush(startEpochMs, dispatchEpochMs, runId, name2, chunkCount, byteCount, rpcMs) {
|
|
93831
94206
|
void (async () => {
|
|
93832
94207
|
await recordElapsedSpan("workflow.stream.flush", startEpochMs, {
|
|
@@ -93888,112 +94263,190 @@ class WorkflowServerWritableStream extends WritableStream {
|
|
|
93888
94263
|
}
|
|
93889
94264
|
};
|
|
93890
94265
|
let buffer2 = [];
|
|
94266
|
+
let bufferBytes = 0;
|
|
94267
|
+
let inFlightChunks = 0;
|
|
94268
|
+
let inFlightBytes = 0;
|
|
93891
94269
|
let flushTimer = null;
|
|
93892
|
-
let
|
|
93893
|
-
let
|
|
93894
|
-
let
|
|
93895
|
-
|
|
93896
|
-
|
|
93897
|
-
|
|
93898
|
-
|
|
94270
|
+
let inFlight = null;
|
|
94271
|
+
let sinkError;
|
|
94272
|
+
let resolvedFlushIntervalMs = getEnvStreamFlushIntervalMs();
|
|
94273
|
+
let flushIntervalResolution = null;
|
|
94274
|
+
const maxChunksPerRequest = getMaxChunksPerBatch();
|
|
94275
|
+
const maxBytesPerRequest = getMaxBytesPerBatch();
|
|
94276
|
+
const maxBufferedChunks = getMaxInflightChunks();
|
|
94277
|
+
const maxBufferedBytes = getMaxBufferedBytes();
|
|
94278
|
+
let bufferT0;
|
|
94279
|
+
let capacityWaiters = [];
|
|
94280
|
+
let drainWaiters = [];
|
|
94281
|
+
const rejectWaiters = (err) => {
|
|
94282
|
+
const all2 = [...capacityWaiters, ...drainWaiters];
|
|
94283
|
+
capacityWaiters = [];
|
|
94284
|
+
drainWaiters = [];
|
|
94285
|
+
for (const w2 of all2)
|
|
94286
|
+
w2.reject(err);
|
|
94287
|
+
};
|
|
94288
|
+
const takeGroup = () => {
|
|
94289
|
+
let count2 = 0;
|
|
94290
|
+
let bytes = 0;
|
|
94291
|
+
for (const chunk of buffer2) {
|
|
94292
|
+
if (count2 >= maxChunksPerRequest)
|
|
94293
|
+
break;
|
|
94294
|
+
if (count2 > 0 && bytes + chunk.byteLength > maxBytesPerRequest)
|
|
94295
|
+
break;
|
|
94296
|
+
count2++;
|
|
94297
|
+
bytes += chunk.byteLength;
|
|
93899
94298
|
}
|
|
93900
|
-
|
|
93901
|
-
|
|
94299
|
+
const group = buffer2.slice(0, count2);
|
|
94300
|
+
buffer2 = buffer2.slice(count2);
|
|
94301
|
+
bufferBytes -= bytes;
|
|
94302
|
+
return { group, bytes };
|
|
94303
|
+
};
|
|
94304
|
+
const sendGroup = async (group, bytes, groupT0) => {
|
|
93902
94305
|
await ensureRunReady();
|
|
93903
|
-
const chunksToFlush = buffer2.slice();
|
|
93904
|
-
const batchStart = batchStartAt;
|
|
93905
|
-
batchStartAt = void 0;
|
|
93906
|
-
const dispatchAt = Date.now();
|
|
93907
94306
|
const world = await worldPromise;
|
|
93908
|
-
|
|
93909
|
-
|
|
94307
|
+
const dispatchAt = Date.now();
|
|
94308
|
+
if (typeof world.streams.writeMulti === "function" && group.length > 1) {
|
|
94309
|
+
await world.streams.writeMulti(runId, name2, group);
|
|
94310
|
+
} else {
|
|
94311
|
+
for (const chunk of group) {
|
|
94312
|
+
await world.streams.write(runId, name2, chunk);
|
|
94313
|
+
}
|
|
93910
94314
|
}
|
|
93911
|
-
|
|
93912
|
-
|
|
93913
|
-
|
|
93914
|
-
|
|
93915
|
-
|
|
93916
|
-
|
|
93917
|
-
|
|
93918
|
-
|
|
94315
|
+
if (groupT0 !== void 0) {
|
|
94316
|
+
recordStreamWriteFlush(groupT0, dispatchAt, runId, name2, group.length, bytes, Date.now() - dispatchAt);
|
|
94317
|
+
}
|
|
94318
|
+
};
|
|
94319
|
+
const dispatchLoop = async () => {
|
|
94320
|
+
while (buffer2.length > 0) {
|
|
94321
|
+
if (flushTimer) {
|
|
94322
|
+
clearTimeout(flushTimer);
|
|
94323
|
+
flushTimer = null;
|
|
93919
94324
|
}
|
|
93920
|
-
|
|
93921
|
-
|
|
93922
|
-
|
|
94325
|
+
const groupT0 = bufferT0;
|
|
94326
|
+
const groupTakenAt = Date.now();
|
|
94327
|
+
const { group, bytes } = takeGroup();
|
|
94328
|
+
inFlightChunks = group.length;
|
|
94329
|
+
inFlightBytes = bytes;
|
|
94330
|
+
bufferT0 = buffer2.length > 0 ? groupTakenAt : void 0;
|
|
94331
|
+
try {
|
|
94332
|
+
await sendGroup(group, bytes, groupT0);
|
|
94333
|
+
inFlightChunks = 0;
|
|
94334
|
+
inFlightBytes = 0;
|
|
94335
|
+
} catch (error2) {
|
|
94336
|
+
buffer2 = group.concat(buffer2);
|
|
94337
|
+
bufferBytes += bytes;
|
|
94338
|
+
inFlightChunks = 0;
|
|
94339
|
+
inFlightBytes = 0;
|
|
94340
|
+
bufferT0 = groupT0 !== void 0 && bufferT0 !== void 0 ? Math.min(groupT0, bufferT0) : groupT0 ?? bufferT0;
|
|
94341
|
+
throw error2;
|
|
93923
94342
|
}
|
|
93924
|
-
|
|
93925
|
-
|
|
93926
|
-
|
|
93927
|
-
|
|
94343
|
+
const relieved = capacityWaiters;
|
|
94344
|
+
capacityWaiters = [];
|
|
94345
|
+
for (const w2 of relieved)
|
|
94346
|
+
w2.resolve();
|
|
93928
94347
|
}
|
|
93929
|
-
buffer2 = [];
|
|
93930
94348
|
};
|
|
93931
|
-
|
|
93932
|
-
|
|
93933
|
-
|
|
94349
|
+
const startDispatch = () => {
|
|
94350
|
+
if (inFlight || sinkError !== void 0 || buffer2.length === 0)
|
|
94351
|
+
return;
|
|
94352
|
+
inFlight = dispatchLoop().then(() => {
|
|
94353
|
+
inFlight = null;
|
|
94354
|
+
if (buffer2.length > 0) {
|
|
94355
|
+
startDispatch();
|
|
94356
|
+
return;
|
|
94357
|
+
}
|
|
94358
|
+
const settled = drainWaiters;
|
|
94359
|
+
drainWaiters = [];
|
|
94360
|
+
for (const w2 of settled)
|
|
94361
|
+
w2.resolve();
|
|
94362
|
+
}, (error2) => {
|
|
94363
|
+
inFlight = null;
|
|
94364
|
+
sinkError ?? (sinkError = error2);
|
|
94365
|
+
rejectWaiters(sinkError);
|
|
94366
|
+
});
|
|
94367
|
+
};
|
|
94368
|
+
const scheduleGroupCommit = () => {
|
|
94369
|
+
if (flushTimer || inFlight)
|
|
94370
|
+
return;
|
|
94371
|
+
if (resolvedFlushIntervalMs === void 0) {
|
|
94372
|
+
flushIntervalResolution ?? (flushIntervalResolution = Promise.resolve(worldPromise).then((world) => {
|
|
94373
|
+
resolvedFlushIntervalMs = world.streamFlushIntervalMs ?? STREAM_FLUSH_INTERVAL_MS;
|
|
94374
|
+
}, () => {
|
|
94375
|
+
resolvedFlushIntervalMs = STREAM_FLUSH_INTERVAL_MS;
|
|
94376
|
+
}).then(() => {
|
|
94377
|
+
if (buffer2.length > 0)
|
|
94378
|
+
scheduleGroupCommit();
|
|
94379
|
+
}));
|
|
93934
94380
|
return;
|
|
94381
|
+
}
|
|
94382
|
+
if (resolvedFlushIntervalMs <= 0) {
|
|
94383
|
+
startDispatch();
|
|
94384
|
+
return;
|
|
94385
|
+
}
|
|
93935
94386
|
flushTimer = setTimeout(() => {
|
|
93936
94387
|
flushTimer = null;
|
|
93937
|
-
|
|
93938
|
-
|
|
93939
|
-
|
|
93940
|
-
|
|
93941
|
-
|
|
93942
|
-
|
|
93943
|
-
|
|
93944
|
-
|
|
94388
|
+
startDispatch();
|
|
94389
|
+
}, resolvedFlushIntervalMs);
|
|
94390
|
+
};
|
|
94391
|
+
const drain = async () => {
|
|
94392
|
+
while (true) {
|
|
94393
|
+
if (sinkError !== void 0)
|
|
94394
|
+
throw sinkError;
|
|
94395
|
+
if (buffer2.length === 0 && !inFlight)
|
|
94396
|
+
return;
|
|
94397
|
+
startDispatch();
|
|
94398
|
+
await new Promise((resolve2, reject) => {
|
|
94399
|
+
drainWaiters.push({ resolve: resolve2, reject });
|
|
93945
94400
|
});
|
|
93946
|
-
}
|
|
94401
|
+
}
|
|
93947
94402
|
};
|
|
93948
94403
|
super({
|
|
93949
94404
|
async write(chunk) {
|
|
93950
|
-
if (
|
|
93951
|
-
|
|
93952
|
-
if (
|
|
93953
|
-
|
|
93954
|
-
flushPromise = null;
|
|
93955
|
-
}
|
|
94405
|
+
if (sinkError !== void 0)
|
|
94406
|
+
throw sinkError;
|
|
94407
|
+
if (bufferT0 === void 0)
|
|
94408
|
+
bufferT0 = Date.now();
|
|
93956
94409
|
buffer2.push(chunk);
|
|
93957
|
-
|
|
93958
|
-
|
|
93959
|
-
|
|
93960
|
-
}
|
|
94410
|
+
bufferBytes += chunk.byteLength;
|
|
94411
|
+
if (buffer2.length >= maxChunksPerRequest || bufferBytes >= maxBytesPerRequest) {
|
|
94412
|
+
startDispatch();
|
|
94413
|
+
} else {
|
|
94414
|
+
scheduleGroupCommit();
|
|
94415
|
+
}
|
|
94416
|
+
while (sinkError === void 0 && (buffer2.length + inFlightChunks >= maxBufferedChunks || bufferBytes + inFlightBytes >= maxBufferedBytes)) {
|
|
94417
|
+
startDispatch();
|
|
94418
|
+
await new Promise((resolve2, reject) => {
|
|
94419
|
+
capacityWaiters.push({ resolve: resolve2, reject });
|
|
94420
|
+
});
|
|
94421
|
+
}
|
|
94422
|
+
if (sinkError !== void 0)
|
|
94423
|
+
throw sinkError;
|
|
93961
94424
|
},
|
|
93962
94425
|
async close() {
|
|
93963
|
-
|
|
93964
|
-
await flushPromise;
|
|
93965
|
-
flushPromise = null;
|
|
93966
|
-
}
|
|
93967
|
-
await flush();
|
|
94426
|
+
await drain();
|
|
93968
94427
|
await ensureRunReady();
|
|
93969
94428
|
const world = await worldPromise;
|
|
93970
94429
|
const closeStart = Date.now();
|
|
93971
94430
|
await world.streams.close(runId, name2);
|
|
93972
94431
|
recordStreamClose(closeStart, runId, name2);
|
|
93973
94432
|
},
|
|
93974
|
-
abort(reason) {
|
|
94433
|
+
async abort(reason) {
|
|
94434
|
+
try {
|
|
94435
|
+
await drain();
|
|
94436
|
+
} catch {
|
|
94437
|
+
}
|
|
93975
94438
|
if (flushTimer) {
|
|
93976
94439
|
clearTimeout(flushTimer);
|
|
93977
94440
|
flushTimer = null;
|
|
93978
94441
|
}
|
|
93979
94442
|
buffer2 = [];
|
|
93980
|
-
|
|
93981
|
-
|
|
93982
|
-
|
|
93983
|
-
for (const w2 of waiters)
|
|
93984
|
-
w2.reject(abortError);
|
|
94443
|
+
bufferBytes = 0;
|
|
94444
|
+
sinkError ?? (sinkError = reason ?? new Error("Stream aborted"));
|
|
94445
|
+
rejectWaiters(sinkError);
|
|
93985
94446
|
}
|
|
93986
94447
|
});
|
|
93987
|
-
Object.defineProperty(this,
|
|
93988
|
-
value:
|
|
93989
|
-
if (chunks.length === 0)
|
|
93990
|
-
return;
|
|
93991
|
-
if (batchStartAt === void 0)
|
|
93992
|
-
batchStartAt = Date.now();
|
|
93993
|
-
for (const chunk of chunks)
|
|
93994
|
-
buffer2.push(chunk);
|
|
93995
|
-
await flush();
|
|
93996
|
-
},
|
|
94448
|
+
Object.defineProperty(this, STREAM_DRAIN_SYMBOL, {
|
|
94449
|
+
value: drain,
|
|
93997
94450
|
enumerable: false,
|
|
93998
94451
|
writable: false
|
|
93999
94452
|
});
|
|
@@ -94137,6 +94590,10 @@ function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framed
|
|
|
94137
94590
|
name: existingName,
|
|
94138
94591
|
runId: existingRunId
|
|
94139
94592
|
};
|
|
94593
|
+
const existingPublicKey = value[STREAM_SERVER_PUBLIC_KEY_SYMBOL];
|
|
94594
|
+
if (typeof existingPublicKey === "string") {
|
|
94595
|
+
descriptor.encryptionPublicKey = existingPublicKey;
|
|
94596
|
+
}
|
|
94140
94597
|
const existingDeploymentId = value[STREAM_SERVER_DEPLOYMENT_ID_SYMBOL];
|
|
94141
94598
|
if (typeof existingDeploymentId === "string") {
|
|
94142
94599
|
descriptor.deploymentId = existingDeploymentId;
|
|
@@ -94201,6 +94658,10 @@ function getWorkflowReducers(global2 = globalThis) {
|
|
|
94201
94658
|
if (typeof foreignDeploymentId === "string") {
|
|
94202
94659
|
s2.deploymentId = foreignDeploymentId;
|
|
94203
94660
|
}
|
|
94661
|
+
const foreignPublicKey = value[STREAM_SERVER_PUBLIC_KEY_SYMBOL];
|
|
94662
|
+
if (typeof foreignPublicKey === "string") {
|
|
94663
|
+
s2.encryptionPublicKey = foreignPublicKey;
|
|
94664
|
+
}
|
|
94204
94665
|
return s2;
|
|
94205
94666
|
},
|
|
94206
94667
|
// AbortController/AbortSignal in workflow context — just read symbols (handles).
|
|
@@ -94278,6 +94739,10 @@ function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByte
|
|
|
94278
94739
|
const s2 = { name: name2 };
|
|
94279
94740
|
if (typeof foreignRunId === "string")
|
|
94280
94741
|
s2.runId = foreignRunId;
|
|
94742
|
+
const foreignPublicKey = value[STREAM_SERVER_PUBLIC_KEY_SYMBOL];
|
|
94743
|
+
if (typeof foreignPublicKey === "string") {
|
|
94744
|
+
s2.encryptionPublicKey = foreignPublicKey;
|
|
94745
|
+
}
|
|
94281
94746
|
const foreignDeploymentId = value[STREAM_SERVER_DEPLOYMENT_ID_SYMBOL];
|
|
94282
94747
|
if (typeof foreignDeploymentId === "string") {
|
|
94283
94748
|
s2.deploymentId = foreignDeploymentId;
|
|
@@ -94422,7 +94887,10 @@ function getCommonRevivers(global2 = globalThis) {
|
|
|
94422
94887
|
...getCommonRevivers$1(global2)
|
|
94423
94888
|
};
|
|
94424
94889
|
}
|
|
94425
|
-
async function getForwardedWritableEncryptionKey(runId, deploymentId) {
|
|
94890
|
+
async function getForwardedWritableEncryptionKey(runId, deploymentId, encryptionPublicKey) {
|
|
94891
|
+
const ownerPublicKey = decodeRunPublicKey(encryptionPublicKey);
|
|
94892
|
+
if (ownerPublicKey)
|
|
94893
|
+
return sealTo(ownerPublicKey);
|
|
94426
94894
|
const world = await getWorldLazy();
|
|
94427
94895
|
if (!world.getEncryptionKeyForRun)
|
|
94428
94896
|
return void 0;
|
|
@@ -94492,7 +94960,7 @@ function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey) {
|
|
|
94492
94960
|
},
|
|
94493
94961
|
WritableStream: (value) => {
|
|
94494
94962
|
const targetRunId = typeof value.runId === "string" ? value.runId : runId;
|
|
94495
|
-
const targetKey = targetRunId === runId ? cryptoKey : getForwardedWritableEncryptionKey(targetRunId, value.deploymentId);
|
|
94963
|
+
const targetKey = targetRunId === runId ? cryptoKey : getForwardedWritableEncryptionKey(targetRunId, value.deploymentId, value.encryptionPublicKey);
|
|
94496
94964
|
const serialize2 = getSerializeStream(getExternalReducers(global2, ops, targetRunId, targetKey), targetKey);
|
|
94497
94965
|
const serverWritable = new WorkflowServerWritableStream(targetRunId, value.name);
|
|
94498
94966
|
const state = createFlushableState();
|
|
@@ -94514,6 +94982,12 @@ function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey) {
|
|
|
94514
94982
|
writable: false
|
|
94515
94983
|
});
|
|
94516
94984
|
}
|
|
94985
|
+
if (typeof value.encryptionPublicKey === "string") {
|
|
94986
|
+
Object.defineProperty(serialize2.writable, STREAM_SERVER_PUBLIC_KEY_SYMBOL, {
|
|
94987
|
+
value: value.encryptionPublicKey,
|
|
94988
|
+
writable: false
|
|
94989
|
+
});
|
|
94990
|
+
}
|
|
94517
94991
|
return serialize2.writable;
|
|
94518
94992
|
},
|
|
94519
94993
|
AbortController: (value) => reviveAbortController(value, ops, runId),
|
|
@@ -94599,6 +95073,12 @@ function getWorkflowRevivers(global2 = globalThis) {
|
|
|
94599
95073
|
writable: false
|
|
94600
95074
|
};
|
|
94601
95075
|
}
|
|
95076
|
+
if (typeof value.encryptionPublicKey === "string") {
|
|
95077
|
+
descriptor[STREAM_SERVER_PUBLIC_KEY_SYMBOL] = {
|
|
95078
|
+
value: value.encryptionPublicKey,
|
|
95079
|
+
writable: false
|
|
95080
|
+
};
|
|
95081
|
+
}
|
|
94602
95082
|
return Object.create(global2.WritableStream.prototype, descriptor);
|
|
94603
95083
|
},
|
|
94604
95084
|
// AbortController/AbortSignal revived inside the workflow VM. Use the
|
|
@@ -94756,7 +95236,7 @@ function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deployment
|
|
|
94756
95236
|
WritableStream: (value) => {
|
|
94757
95237
|
const targetRunId = typeof value.runId === "string" ? value.runId : runId;
|
|
94758
95238
|
const targetDeploymentId = typeof value.deploymentId === "string" ? value.deploymentId : targetRunId === runId ? deploymentId : void 0;
|
|
94759
|
-
const targetKey = targetRunId === runId ? cryptoKey : getForwardedWritableEncryptionKey(targetRunId, targetDeploymentId);
|
|
95239
|
+
const targetKey = targetRunId === runId ? cryptoKey : getForwardedWritableEncryptionKey(targetRunId, targetDeploymentId, value.encryptionPublicKey);
|
|
94760
95240
|
const serialize2 = getSerializeStream(getStepReducers(global2, ops, targetRunId, targetKey), targetKey);
|
|
94761
95241
|
const serverWritable = new WorkflowServerWritableStream(targetRunId, value.name);
|
|
94762
95242
|
const state = createFlushableState();
|
|
@@ -94778,6 +95258,18 @@ function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deployment
|
|
|
94778
95258
|
writable: false
|
|
94779
95259
|
});
|
|
94780
95260
|
}
|
|
95261
|
+
if (typeof value.encryptionPublicKey !== "string" && targetRunId === runId && isRunPayloadKeys(cryptoKey)) {
|
|
95262
|
+
Object.defineProperty(serialize2.writable, STREAM_SERVER_PUBLIC_KEY_SYMBOL, {
|
|
95263
|
+
value: bytesToBase64(cryptoKey.keyPair.publicKey),
|
|
95264
|
+
writable: false
|
|
95265
|
+
});
|
|
95266
|
+
}
|
|
95267
|
+
if (typeof value.encryptionPublicKey === "string") {
|
|
95268
|
+
Object.defineProperty(serialize2.writable, STREAM_SERVER_PUBLIC_KEY_SYMBOL, {
|
|
95269
|
+
value: value.encryptionPublicKey,
|
|
95270
|
+
writable: false
|
|
95271
|
+
});
|
|
95272
|
+
}
|
|
94781
95273
|
return serialize2.writable;
|
|
94782
95274
|
},
|
|
94783
95275
|
AbortController: (value) => reviveAbortController(value, ops, runId),
|
|
@@ -94901,8 +95393,8 @@ async function hydrateRunError(value, runId, key, ops = [], global2 = globalThis
|
|
|
94901
95393
|
...extraRevivers
|
|
94902
95394
|
});
|
|
94903
95395
|
}
|
|
94904
|
-
const { format: format2, payload } = decodeFormatPrefix(decrypted);
|
|
94905
|
-
if (format2 === SerializationFormat.DEVALUE_V1) {
|
|
95396
|
+
const { format: format2, payload } = decodeFormatPrefix$1(decrypted);
|
|
95397
|
+
if (format2 === SerializationFormat$1.DEVALUE_V1) {
|
|
94906
95398
|
const str = new TextDecoder().decode(payload);
|
|
94907
95399
|
return parse$5(str, {
|
|
94908
95400
|
...getExternalRevivers(global2, ops, runId, key),
|
|
@@ -94942,7 +95434,7 @@ function getStreamAndRequestRevivers(allRevivers) {
|
|
|
94942
95434
|
}
|
|
94943
95435
|
return extra;
|
|
94944
95436
|
}
|
|
94945
|
-
const version$1 = "5.0.0-beta.
|
|
95437
|
+
const version$1 = "5.0.0-beta.37";
|
|
94946
95438
|
const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
|
|
94947
95439
|
const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@]+$/;
|
|
94948
95440
|
function getWorkflowQueueName(workflowName, namespace2) {
|
|
@@ -95020,17 +95512,24 @@ function parseHealthCheckResponse(chunks) {
|
|
|
95020
95512
|
if (typeof r2.workflowCoreVersion === "string") {
|
|
95021
95513
|
parsed.workflowCoreVersion = r2.workflowCoreVersion;
|
|
95022
95514
|
}
|
|
95515
|
+
if (typeof r2.encryptionPublicKey === "string") {
|
|
95516
|
+
parsed.encryptionPublicKey = r2.encryptionPublicKey;
|
|
95517
|
+
}
|
|
95023
95518
|
return parsed;
|
|
95024
95519
|
}
|
|
95025
|
-
async function healthCheck(world,
|
|
95520
|
+
async function healthCheck(world, options) {
|
|
95026
95521
|
var _a3;
|
|
95027
95522
|
const timeout2 = (options == null ? void 0 : options.timeout) ?? DEFAULT_HEALTH_CHECK_TIMEOUT;
|
|
95028
95523
|
const correlationId = ((_a3 = world.createRunId) == null ? void 0 : _a3.call(world)) ?? generateId();
|
|
95029
95524
|
const streamName = getHealthCheckStreamName(correlationId);
|
|
95030
|
-
const queueName = `${getQueueTopicPrefix(
|
|
95525
|
+
const queueName = `${getQueueTopicPrefix("workflow", resolveQueueNamespace(options == null ? void 0 : options.namespace))}health_check`;
|
|
95031
95526
|
const startTime = Date.now();
|
|
95032
95527
|
try {
|
|
95033
|
-
await world.queue(queueName, {
|
|
95528
|
+
await world.queue(queueName, {
|
|
95529
|
+
__healthCheck: true,
|
|
95530
|
+
correlationId,
|
|
95531
|
+
...(options == null ? void 0 : options.runId) ? { runId: options.runId } : {}
|
|
95532
|
+
}, {
|
|
95034
95533
|
// Use JSON transport so the health check works against both
|
|
95035
95534
|
// old (JSON-only) and new (dual) deployments.
|
|
95036
95535
|
specVersion: SPEC_VERSION_LEGACY,
|
|
@@ -95090,12 +95589,6 @@ function createWorldFromModule(mod) {
|
|
|
95090
95589
|
if (typeof mod.createWorld === "function") {
|
|
95091
95590
|
return mod.createWorld();
|
|
95092
95591
|
}
|
|
95093
|
-
if (typeof mod.createLocalWorld === "function") {
|
|
95094
|
-
return mod.createLocalWorld();
|
|
95095
|
-
}
|
|
95096
|
-
if (typeof mod.createVercelWorld === "function") {
|
|
95097
|
-
return mod.createVercelWorld();
|
|
95098
|
-
}
|
|
95099
95592
|
if (typeof mod.default === "function") {
|
|
95100
95593
|
return mod.default();
|
|
95101
95594
|
}
|
|
@@ -97941,22 +98434,28 @@ function requireSemver() {
|
|
|
97941
98434
|
var semverExports = requireSemver();
|
|
97942
98435
|
const semver = /* @__PURE__ */ getDefaultExportFromCjs(semverExports);
|
|
97943
98436
|
const FORMAT_VERSION_TABLE = [
|
|
97944
|
-
{ format: SerializationFormat.ENCRYPTED, minVersion: "4.2.0-beta.64" },
|
|
98437
|
+
{ format: SerializationFormat$1.ENCRYPTED, minVersion: "4.2.0-beta.64" },
|
|
97945
98438
|
// TODO(release): verify this matches the actual version that ships payload
|
|
97946
98439
|
// compression. If a "Version Packages (beta)" PR merges before this change,
|
|
97947
98440
|
// bump to the next beta. A too-low cutoff makes new producers write
|
|
97948
98441
|
// compressed payloads to consumers that cannot decompress them; too-high
|
|
97949
98442
|
// merely delays the optimization (safe). gzip and zstd ship together, so
|
|
97950
98443
|
// they share a min version — a run that can read one can read both.
|
|
97951
|
-
{ format: SerializationFormat.GZIP, minVersion: "5.0.0-beta.18" },
|
|
97952
|
-
{ format: SerializationFormat.ZSTD, minVersion: "5.0.0-beta.18" }
|
|
98444
|
+
{ format: SerializationFormat$1.GZIP, minVersion: "5.0.0-beta.18" },
|
|
98445
|
+
{ format: SerializationFormat$1.ZSTD, minVersion: "5.0.0-beta.18" },
|
|
98446
|
+
// TODO(release): verify this matches the actual version that ships sealed-box
|
|
98447
|
+
// encryption. If a "Version Packages (beta)" PR merges before this change,
|
|
98448
|
+
// bump to the next beta. Unlike the entries above, a wrong cutoff here is
|
|
98449
|
+
// not a correctness hazard: producers gate `encp` on the target run carrying
|
|
98450
|
+
// an `encryptionPublicKey`, not on this table (see History above).
|
|
98451
|
+
{ format: SerializationFormat$1.SEALED, minVersion: "5.0.0-beta.37" }
|
|
97953
98452
|
// Future entries:
|
|
97954
98453
|
// { format: SerializationFormat.CBOR, minVersion: '5.x.y' },
|
|
97955
98454
|
// { format: SerializationFormat.ENCRYPTED_V2, minVersion: '5.x.y' },
|
|
97956
98455
|
];
|
|
97957
98456
|
const CAPABILITY_VERSION_TABLE = [{ capability: "framedByteStreams", minVersion: "5.0.0-beta.15" }];
|
|
97958
98457
|
const BASELINE_FORMATS = /* @__PURE__ */ new Set([
|
|
97959
|
-
SerializationFormat.DEVALUE_V1
|
|
98458
|
+
SerializationFormat$1.DEVALUE_V1
|
|
97960
98459
|
]);
|
|
97961
98460
|
function getRunCapabilities(workflowCoreVersion) {
|
|
97962
98461
|
if (!workflowCoreVersion || !semver.valid(workflowCoreVersion)) {
|
|
@@ -97982,18 +98481,49 @@ function getRunCapabilities(workflowCoreVersion) {
|
|
|
97982
98481
|
}
|
|
97983
98482
|
return result;
|
|
97984
98483
|
}
|
|
97985
|
-
|
|
98484
|
+
function resumeContextFromRun(run2) {
|
|
98485
|
+
var _a3, _b2;
|
|
98486
|
+
const coreVersion = (_a3 = run2.executionContext) == null ? void 0 : _a3.workflowCoreVersion;
|
|
98487
|
+
const traceCarrier = (_b2 = run2.executionContext) == null ? void 0 : _b2.traceCarrier;
|
|
98488
|
+
return {
|
|
98489
|
+
deploymentId: run2.deploymentId,
|
|
98490
|
+
workflowName: run2.workflowName,
|
|
98491
|
+
runSpecVersion: run2.specVersion,
|
|
98492
|
+
workflowCoreVersion: typeof coreVersion === "string" ? coreVersion : void 0,
|
|
98493
|
+
traceCarrier: traceCarrier && typeof traceCarrier === "object" ? traceCarrier : void 0,
|
|
98494
|
+
encryptionPublicKey: run2.encryptionPublicKey
|
|
98495
|
+
};
|
|
98496
|
+
}
|
|
98497
|
+
async function resolveHookResumeInfo(hook) {
|
|
98498
|
+
if (hook.resumeContext) {
|
|
98499
|
+
return { resumeContext: hook.resumeContext, source: "hook" };
|
|
98500
|
+
}
|
|
98501
|
+
const run2 = await (await getWorldLazy()).runs.get(hook.runId);
|
|
98502
|
+
return {
|
|
98503
|
+
resumeContext: resumeContextFromRun(run2),
|
|
98504
|
+
source: "run_fallback",
|
|
98505
|
+
run: run2
|
|
98506
|
+
};
|
|
98507
|
+
}
|
|
98508
|
+
async function resolveHookEncryptionKey(hook, info) {
|
|
98509
|
+
var _a3, _b2;
|
|
97986
98510
|
const world = await getWorldLazy();
|
|
97987
|
-
const
|
|
97988
|
-
|
|
97989
|
-
|
|
98511
|
+
const rawKey = info.run ? await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, info.run)) : await ((_b2 = world.getEncryptionKeyForRun) == null ? void 0 : _b2.call(world, hook.runId, {
|
|
98512
|
+
deploymentId: info.resumeContext.deploymentId
|
|
98513
|
+
}));
|
|
98514
|
+
return rawKey ? await importKey(rawKey) : void 0;
|
|
97990
98515
|
}
|
|
97991
98516
|
async function getHookByTokenWithKey(token) {
|
|
97992
98517
|
var _a3, _b2;
|
|
97993
|
-
const
|
|
97994
|
-
const
|
|
97995
|
-
|
|
98518
|
+
const world = await getWorldLazy();
|
|
98519
|
+
const hook = await world.hooks.getByToken(token);
|
|
98520
|
+
let encryptionKey;
|
|
97996
98521
|
if (typeof hook.metadata !== "undefined") {
|
|
98522
|
+
const info = await resolveHookResumeInfo(hook);
|
|
98523
|
+
const rawKey = info.run ? await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, info.run)) : await ((_b2 = world.getEncryptionKeyForRun) == null ? void 0 : _b2.call(world, hook.runId, {
|
|
98524
|
+
deploymentId: info.resumeContext.deploymentId
|
|
98525
|
+
}));
|
|
98526
|
+
encryptionKey = rawKey ? await deriveRunPayloadKeys(rawKey) : void 0;
|
|
97997
98527
|
hook.metadata = await hydrateStepArguments(hook.metadata, hook.runId, encryptionKey);
|
|
97998
98528
|
}
|
|
97999
98529
|
return { hook, encryptionKey };
|
|
@@ -98005,41 +98535,42 @@ async function getHookByToken$1(token) {
|
|
|
98005
98535
|
async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
|
|
98006
98536
|
return await waitedUntil(() => {
|
|
98007
98537
|
return trace$2("hook.resume", async (span) => {
|
|
98008
|
-
var _a3
|
|
98538
|
+
var _a3;
|
|
98009
98539
|
const world = await getWorldLazy();
|
|
98010
98540
|
try {
|
|
98011
|
-
|
|
98012
|
-
|
|
98013
|
-
|
|
98014
|
-
const result = await getHookAndRun(tokenOrHook);
|
|
98015
|
-
hook = result.hook;
|
|
98016
|
-
workflowRun = result.run;
|
|
98017
|
-
} else {
|
|
98018
|
-
hook = tokenOrHook;
|
|
98019
|
-
workflowRun = await world.runs.get(hook.runId);
|
|
98020
|
-
}
|
|
98541
|
+
const hook = typeof tokenOrHook === "string" ? await world.hooks.getByToken(tokenOrHook) : tokenOrHook;
|
|
98542
|
+
const info = await resolveHookResumeInfo(hook);
|
|
98543
|
+
const { resumeContext } = info;
|
|
98021
98544
|
span == null ? void 0 : span.setAttributes({
|
|
98022
98545
|
...HookToken(hook.token),
|
|
98023
98546
|
...HookId(hook.hookId),
|
|
98024
|
-
...WorkflowRunId$2(hook.runId)
|
|
98547
|
+
...WorkflowRunId$2(hook.runId),
|
|
98548
|
+
"workflow.hook.resume_context_source": info.source
|
|
98025
98549
|
});
|
|
98026
|
-
if (isTerminalWorkflowRunStatus(
|
|
98550
|
+
if (info.run && isTerminalWorkflowRunStatus(info.run.status)) {
|
|
98027
98551
|
throw new HookNotFoundError(hook.token);
|
|
98028
98552
|
}
|
|
98029
|
-
|
|
98030
|
-
|
|
98031
|
-
|
|
98032
|
-
|
|
98033
|
-
|
|
98034
|
-
|
|
98035
|
-
|
|
98036
|
-
|
|
98037
|
-
|
|
98553
|
+
const capabilities = getRunCapabilities(resumeContext.workflowCoreVersion);
|
|
98554
|
+
let payloadKey;
|
|
98555
|
+
const runPublicKey = encryptionKeyOverride ? (
|
|
98556
|
+
// The caller already holds a key (resumeWebhook resolved one to
|
|
98557
|
+
// hydrate hook metadata), so sealing would add an ECDH for no
|
|
98558
|
+
// saved round trip. Reuse what it resolved.
|
|
98559
|
+
void 0
|
|
98560
|
+
) : decodeRunPublicKey(resumeContext.encryptionPublicKey);
|
|
98561
|
+
if (runPublicKey) {
|
|
98562
|
+
payloadKey = sealTo(runPublicKey);
|
|
98563
|
+
} else {
|
|
98564
|
+
let encryptionKey = encryptionKeyOverride ?? await resolveHookEncryptionKey(hook, info);
|
|
98565
|
+
if (!capabilities.supportedFormats.has(SerializationFormat$1.ENCRYPTED)) {
|
|
98566
|
+
encryptionKey = void 0;
|
|
98567
|
+
}
|
|
98568
|
+
payloadKey = encryptionKey;
|
|
98038
98569
|
}
|
|
98039
|
-
const compression = (
|
|
98570
|
+
const compression = (resumeContext.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION && capabilities.supportedFormats.has(SerializationFormat$1.GZIP);
|
|
98040
98571
|
const ops = [];
|
|
98041
98572
|
const v1Compat = isLegacySpecVersion(hook.specVersion);
|
|
98042
|
-
const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId,
|
|
98573
|
+
const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, payloadKey, ops, globalThis, v1Compat, capabilities.framedByteStreams, compression);
|
|
98043
98574
|
safeWaitUntil(Promise.all(ops), (err) => {
|
|
98044
98575
|
if (err === void 0)
|
|
98045
98576
|
return;
|
|
@@ -98049,29 +98580,36 @@ async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
|
|
|
98049
98580
|
error: err instanceof Error ? err.message : String(err)
|
|
98050
98581
|
});
|
|
98051
98582
|
});
|
|
98052
|
-
|
|
98053
|
-
|
|
98054
|
-
|
|
98055
|
-
|
|
98056
|
-
|
|
98057
|
-
|
|
98058
|
-
|
|
98583
|
+
try {
|
|
98584
|
+
await world.events.create(hook.runId, {
|
|
98585
|
+
eventType: "hook_received",
|
|
98586
|
+
specVersion: SPEC_VERSION_CURRENT,
|
|
98587
|
+
correlationId: hook.hookId,
|
|
98588
|
+
eventData: {
|
|
98589
|
+
...v1Compat ? {} : { token: hook.token },
|
|
98590
|
+
payload: dehydratedPayload
|
|
98591
|
+
}
|
|
98592
|
+
}, { v1Compat });
|
|
98593
|
+
} catch (err) {
|
|
98594
|
+
if (HookNotFoundError.is(err) || EntityConflictError.is(err) || RunExpiredError.is(err)) {
|
|
98595
|
+
throw new HookNotFoundError(hook.token);
|
|
98059
98596
|
}
|
|
98060
|
-
|
|
98597
|
+
throw err;
|
|
98598
|
+
}
|
|
98061
98599
|
span == null ? void 0 : span.setAttributes({
|
|
98062
|
-
...WorkflowName(
|
|
98600
|
+
...WorkflowName(resumeContext.workflowName)
|
|
98063
98601
|
});
|
|
98064
|
-
const originLink = await linkToTraceCarrier(
|
|
98602
|
+
const originLink = await linkToTraceCarrier(resumeContext.traceCarrier);
|
|
98065
98603
|
if (originLink) {
|
|
98066
|
-
(
|
|
98604
|
+
(_a3 = span == null ? void 0 : span.addLink) == null ? void 0 : _a3.call(span, originLink);
|
|
98067
98605
|
}
|
|
98068
|
-
await world.queue(getWorkflowQueueName(
|
|
98606
|
+
await world.queue(getWorkflowQueueName(resumeContext.workflowName), {
|
|
98069
98607
|
runId: hook.runId,
|
|
98070
|
-
// attach the trace carrier from the
|
|
98071
|
-
traceCarrier:
|
|
98608
|
+
// attach the trace carrier from the run's resume context
|
|
98609
|
+
traceCarrier: resumeContext.traceCarrier ?? void 0
|
|
98072
98610
|
}, {
|
|
98073
|
-
deploymentId:
|
|
98074
|
-
specVersion:
|
|
98611
|
+
deploymentId: resumeContext.deploymentId,
|
|
98612
|
+
specVersion: resumeContext.runSpecVersion ?? SPEC_VERSION_LEGACY
|
|
98075
98613
|
});
|
|
98076
98614
|
return hook;
|
|
98077
98615
|
} catch (err) {
|
|
@@ -98200,8 +98738,10 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
98200
98738
|
deploymentId = currentDeploymentId;
|
|
98201
98739
|
}
|
|
98202
98740
|
}
|
|
98741
|
+
const runId = `wrun_${world.createRunId ? world.createRunId(opts) : ulid$2()}`;
|
|
98203
98742
|
let framedByteStreams;
|
|
98204
98743
|
let targetSupportsCompression;
|
|
98744
|
+
let probedRunPublicKey;
|
|
98205
98745
|
if (deploymentId === currentDeploymentId) {
|
|
98206
98746
|
framedByteStreams = true;
|
|
98207
98747
|
targetSupportsCompression = true;
|
|
@@ -98209,17 +98749,18 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
98209
98749
|
framedByteStreams = false;
|
|
98210
98750
|
targetSupportsCompression = false;
|
|
98211
98751
|
} else {
|
|
98212
|
-
const probe = await healthCheck(world,
|
|
98752
|
+
const probe = await healthCheck(world, {
|
|
98213
98753
|
deploymentId,
|
|
98754
|
+
runId,
|
|
98214
98755
|
timeout: CROSS_DEPLOYMENT_CAPABILITY_PROBE_TIMEOUT_MS,
|
|
98215
98756
|
namespace: opts.namespace
|
|
98216
98757
|
}).catch(() => void 0);
|
|
98758
|
+
probedRunPublicKey = probe == null ? void 0 : probe.encryptionPublicKey;
|
|
98217
98759
|
const capabilities = getRunCapabilities(probe == null ? void 0 : probe.workflowCoreVersion);
|
|
98218
98760
|
framedByteStreams = capabilities.framedByteStreams;
|
|
98219
|
-
targetSupportsCompression = capabilities.supportedFormats.has(SerializationFormat.GZIP);
|
|
98761
|
+
targetSupportsCompression = capabilities.supportedFormats.has(SerializationFormat$1.GZIP);
|
|
98220
98762
|
}
|
|
98221
98763
|
const ops = [];
|
|
98222
|
-
const runId = `wrun_${world.createRunId ? world.createRunId(opts) : ulid$2()}`;
|
|
98223
98764
|
const traceCarrier = await serializeTraceCarrier();
|
|
98224
98765
|
const specVersion = opts.specVersion ?? world.specVersion;
|
|
98225
98766
|
const v1Compat = isLegacySpecVersion(specVersion);
|
|
@@ -98248,11 +98789,20 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
98248
98789
|
if (opts.replayedFromRunId !== void 0 && !workflowRunIdSchema.safeParse(opts.replayedFromRunId).success) {
|
|
98249
98790
|
throw new WorkflowRuntimeError(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(opts.replayedFromRunId).slice(0, 64))}.`);
|
|
98250
98791
|
}
|
|
98251
|
-
const
|
|
98252
|
-
|
|
98253
|
-
|
|
98254
|
-
|
|
98255
|
-
|
|
98792
|
+
const probedPublicKey = decodeRunPublicKey(probedRunPublicKey);
|
|
98793
|
+
let encryptionKey;
|
|
98794
|
+
let encryptionPublicKey;
|
|
98795
|
+
if (probedPublicKey) {
|
|
98796
|
+
encryptionKey = sealTo(probedPublicKey);
|
|
98797
|
+
encryptionPublicKey = probedRunPublicKey;
|
|
98798
|
+
} else {
|
|
98799
|
+
const rawKey = await ((_b2 = world.getEncryptionKeyForRun) == null ? void 0 : _b2.call(world, runId, {
|
|
98800
|
+
...opts,
|
|
98801
|
+
deploymentId
|
|
98802
|
+
}));
|
|
98803
|
+
encryptionKey = rawKey ? await importKey(rawKey) : void 0;
|
|
98804
|
+
encryptionPublicKey = rawKey ? bytesToBase64((await deriveRunKeyPair(rawKey)).publicKey) : void 0;
|
|
98805
|
+
}
|
|
98256
98806
|
const compression = targetSupportsCompression && specVersion >= SPEC_VERSION_SUPPORTS_COMPRESSION;
|
|
98257
98807
|
const workflowArguments = await dehydrateWorkflowArguments(args, runId, encryptionKey, ops, globalThis, v1Compat, framedByteStreams, compression);
|
|
98258
98808
|
const executionContext = {
|
|
@@ -98270,6 +98820,7 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
98270
98820
|
workflowName,
|
|
98271
98821
|
input: workflowArguments,
|
|
98272
98822
|
executionContext,
|
|
98823
|
+
...encryptionPublicKey ? { encryptionPublicKey } : {},
|
|
98273
98824
|
...attributeSeed
|
|
98274
98825
|
}
|
|
98275
98826
|
}, { v1Compat }),
|
|
@@ -98283,6 +98834,7 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
98283
98834
|
workflowName,
|
|
98284
98835
|
specVersion,
|
|
98285
98836
|
executionContext,
|
|
98837
|
+
...encryptionPublicKey ? { encryptionPublicKey } : {},
|
|
98286
98838
|
...attributeSeed
|
|
98287
98839
|
}
|
|
98288
98840
|
} : {}
|
|
@@ -98341,7 +98893,7 @@ async function recreateRunFromExisting(world, runId, options = {}) {
|
|
|
98341
98893
|
try {
|
|
98342
98894
|
const run2 = await world.runs.get(runId, { resolveData: "all" });
|
|
98343
98895
|
const rawKey = await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, run2));
|
|
98344
|
-
const encryptionKey = rawKey ? await
|
|
98896
|
+
const encryptionKey = rawKey ? await deriveRunPayloadKeys(rawKey) : void 0;
|
|
98345
98897
|
const workflowArgs = normalizeWorkflowArgs(await hydrateWorkflowArguments(run2.input, runId, encryptionKey, globalThis));
|
|
98346
98898
|
const specVersion = options.specVersion ?? run2.specVersion ?? SPEC_VERSION_LEGACY;
|
|
98347
98899
|
const deploymentId = options.deploymentId ?? run2.deploymentId;
|
|
@@ -98632,7 +99184,7 @@ getEncryptionKey_fn = function() {
|
|
|
98632
99184
|
const world = await __privateGet(this, _Run_instances, lazyWorldPromise_get);
|
|
98633
99185
|
const run2 = await world.runs.get(this.runId);
|
|
98634
99186
|
const rawKey = await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, run2));
|
|
98635
|
-
return rawKey ? await
|
|
99187
|
+
return rawKey ? await deriveRunPayloadKeys(rawKey) : void 0;
|
|
98636
99188
|
})());
|
|
98637
99189
|
}
|
|
98638
99190
|
return __privateGet(this, _encryptionKeyPromise);
|
|
@@ -98793,6 +99345,35 @@ async function findWorkflowDataDir(cwd) {
|
|
|
98793
99345
|
shortName: getDirShortName(absoluteCwd)
|
|
98794
99346
|
};
|
|
98795
99347
|
}
|
|
99348
|
+
const REBUILD_AGAINST_VERCEL_ADVICE = "The world is selected when the app is built, not when it runs, so this reflects the build environment: when a build cannot be identified as a Vercel build (for example `vercel build` followed by `vercel deploy --prebuilt`, or a build that runs before Vercel system environment variables are available), set WORKFLOW_TARGET_WORLD=vercel in the build environment and rebuild.";
|
|
99349
|
+
class UnwritableDataDirError extends WorkflowWorldError {
|
|
99350
|
+
constructor(dataDir, code2) {
|
|
99351
|
+
super(`[workflow] The local (filesystem) world cannot create its data directory "${dataDir}" (${code2}). Workflow runs cannot be stored, so every run will fail before its first step. If this is a Vercel deployment, its filesystem is read-only and the local world cannot work there. ${REBUILD_AGAINST_VERCEL_ADVICE} Otherwise point WORKFLOW_LOCAL_DATA_DIR at a writable directory.`, { code: code2 });
|
|
99352
|
+
__publicField(this, "dataDir");
|
|
99353
|
+
this.name = "UnwritableDataDirError";
|
|
99354
|
+
this.dataDir = dataDir;
|
|
99355
|
+
}
|
|
99356
|
+
static is(value) {
|
|
99357
|
+
return value instanceof Error && value.name === "UnwritableDataDirError";
|
|
99358
|
+
}
|
|
99359
|
+
}
|
|
99360
|
+
const UNWRITABLE_DIR_CODES = /* @__PURE__ */ new Set(["EROFS", "EACCES", "EPERM"]);
|
|
99361
|
+
function isUnwritableDirCode(code2) {
|
|
99362
|
+
return code2 !== void 0 && UNWRITABLE_DIR_CODES.has(code2);
|
|
99363
|
+
}
|
|
99364
|
+
let warnedAboutVercelDeployment = false;
|
|
99365
|
+
function warnIfRunningInVercelDeployment(dataDir) {
|
|
99366
|
+
if (warnedAboutVercelDeployment || !isVercelDeploymentEnv()) {
|
|
99367
|
+
return;
|
|
99368
|
+
}
|
|
99369
|
+
const resolvedDataDir = path$3.resolve(dataDir);
|
|
99370
|
+
const tmp = tmpdir();
|
|
99371
|
+
if (resolvedDataDir === tmp || resolvedDataDir.startsWith(`${tmp}${path$3.sep}`)) {
|
|
99372
|
+
return;
|
|
99373
|
+
}
|
|
99374
|
+
warnedAboutVercelDeployment = true;
|
|
99375
|
+
console.warn(`[workflow] Warning: the local (filesystem) world is running inside a Vercel deployment, writing to ${resolvedDataDir}. That filesystem is read-only, so workflow runs will fail before their first step. ` + REBUILD_AGAINST_VERCEL_ADVICE);
|
|
99376
|
+
}
|
|
98796
99377
|
function parsePort$2(value, radix = 10) {
|
|
98797
99378
|
const port = parseInt(value, radix);
|
|
98798
99379
|
if (!Number.isNaN(port) && port >= 0 && port <= 65535) {
|
|
@@ -99176,7 +99757,18 @@ async function ensureDir(dirPath) {
|
|
|
99176
99757
|
try {
|
|
99177
99758
|
await promises.mkdir(resolvedPath, { recursive: true });
|
|
99178
99759
|
createdDirectoriesCache.add(resolvedPath);
|
|
99179
|
-
} catch (
|
|
99760
|
+
} catch (error2) {
|
|
99761
|
+
const code2 = error2.code;
|
|
99762
|
+
if (isUnwritableDirCode(code2) && !await isExistingDirectory(resolvedPath)) {
|
|
99763
|
+
throw new UnwritableDataDirError(resolvedPath, code2);
|
|
99764
|
+
}
|
|
99765
|
+
}
|
|
99766
|
+
}
|
|
99767
|
+
async function isExistingDirectory(dirPath) {
|
|
99768
|
+
try {
|
|
99769
|
+
return (await promises.stat(dirPath)).isDirectory();
|
|
99770
|
+
} catch {
|
|
99771
|
+
return false;
|
|
99180
99772
|
}
|
|
99181
99773
|
}
|
|
99182
99774
|
async function withEnsuredDirectory(dirPath, operation) {
|
|
@@ -125355,13 +125947,6 @@ function isDetachedArrayBufferQueueError(error2) {
|
|
|
125355
125947
|
}
|
|
125356
125948
|
return false;
|
|
125357
125949
|
}
|
|
125358
|
-
function getQueueRoute(queueName) {
|
|
125359
|
-
const { kind, prefix } = parseQueueName(queueName);
|
|
125360
|
-
return {
|
|
125361
|
-
pathname: kind === "workflow" ? "flow" : "step",
|
|
125362
|
-
prefix
|
|
125363
|
-
};
|
|
125364
|
-
}
|
|
125365
125950
|
function createQueue$2(config2) {
|
|
125366
125951
|
const httpAgent = new undiciExports.Agent({
|
|
125367
125952
|
headersTimeout: 0,
|
|
@@ -125384,10 +125969,10 @@ function createQueue$2(config2) {
|
|
|
125384
125969
|
}
|
|
125385
125970
|
}
|
|
125386
125971
|
const body2 = transport.serialize(message2);
|
|
125387
|
-
const {
|
|
125972
|
+
const { prefix } = parseQueueName(queueName);
|
|
125388
125973
|
const messageId = MessageId.parse(`msg_${generateId2()}`);
|
|
125389
125974
|
const msg = message2;
|
|
125390
|
-
const runId = msg.runId ??
|
|
125975
|
+
const runId = msg.runId ?? void 0;
|
|
125391
125976
|
const stepId = msg.stepId ?? void 0;
|
|
125392
125977
|
if (opts == null ? void 0 : opts.idempotencyKey) {
|
|
125393
125978
|
const key = opts.idempotencyKey;
|
|
@@ -125422,12 +126007,12 @@ function createQueue$2(config2) {
|
|
|
125422
126007
|
try {
|
|
125423
126008
|
if (directHandler) {
|
|
125424
126009
|
const req = new Request(createWorkflowUrl(resolveDirectBaseUrl(config2), {
|
|
125425
|
-
type:
|
|
126010
|
+
type: "flow"
|
|
125426
126011
|
}), { method: "POST", headers: headers2, body: body2 });
|
|
125427
126012
|
response2 = await directHandler(req);
|
|
125428
126013
|
} else {
|
|
125429
126014
|
const baseUrl = await resolveBaseUrl$1(config2);
|
|
125430
|
-
response2 = await fetch(createWorkflowUrl(baseUrl, { type:
|
|
126015
|
+
response2 = await fetch(createWorkflowUrl(baseUrl, { type: "flow" }), {
|
|
125431
126016
|
method: "POST",
|
|
125432
126017
|
duplex: "half",
|
|
125433
126018
|
dispatcher: httpAgent,
|
|
@@ -126578,6 +127163,10 @@ function createEventsStorage(basedir, tag) {
|
|
|
126578
127163
|
startedAt: void 0,
|
|
126579
127164
|
completedAt: void 0,
|
|
126580
127165
|
attributes: runInputData.attributes ?? {},
|
|
127166
|
+
// Must be mirrored here too: this is the path that recreates a
|
|
127167
|
+
// run from the queued message, which is exactly when the key
|
|
127168
|
+
// would otherwise be lost for the rest of the run's life.
|
|
127169
|
+
encryptionPublicKey: runInputData.encryptionPublicKey,
|
|
126581
127170
|
createdAt: now2,
|
|
126582
127171
|
updatedAt: now2
|
|
126583
127172
|
};
|
|
@@ -126597,7 +127186,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
126597
127186
|
input: runInputData.input,
|
|
126598
127187
|
executionContext: runInputData.executionContext,
|
|
126599
127188
|
attributes: runInputData.attributes,
|
|
126600
|
-
allowReservedAttributes: runInputData.allowReservedAttributes
|
|
127189
|
+
allowReservedAttributes: runInputData.allowReservedAttributes,
|
|
127190
|
+
encryptionPublicKey: runInputData.encryptionPublicKey
|
|
126601
127191
|
}
|
|
126602
127192
|
};
|
|
126603
127193
|
await storeEvent(runCreatedEvent);
|
|
@@ -126734,6 +127324,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
126734
127324
|
startedAt: void 0,
|
|
126735
127325
|
completedAt: void 0,
|
|
126736
127326
|
attributes: runData.attributes ?? {},
|
|
127327
|
+
encryptionPublicKey: runData.encryptionPublicKey,
|
|
126737
127328
|
createdAt: now2,
|
|
126738
127329
|
updatedAt: now2
|
|
126739
127330
|
};
|
|
@@ -126762,7 +127353,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
126762
127353
|
completedAt: void 0,
|
|
126763
127354
|
startedAt: currentRun.startedAt ?? now2,
|
|
126764
127355
|
updatedAt: now2,
|
|
126765
|
-
attributes: currentRun.attributes
|
|
127356
|
+
attributes: currentRun.attributes,
|
|
127357
|
+
encryptionPublicKey: currentRun.encryptionPublicKey
|
|
126766
127358
|
});
|
|
126767
127359
|
}
|
|
126768
127360
|
} else if (data.eventType === "run_completed" && "eventData" in data) {
|
|
@@ -126783,7 +127375,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
126783
127375
|
error: void 0,
|
|
126784
127376
|
completedAt: now2,
|
|
126785
127377
|
updatedAt: now2,
|
|
126786
|
-
attributes: currentRun.attributes
|
|
127378
|
+
attributes: currentRun.attributes,
|
|
127379
|
+
encryptionPublicKey: currentRun.encryptionPublicKey
|
|
126787
127380
|
});
|
|
126788
127381
|
await Promise.all([
|
|
126789
127382
|
deleteAllHooksForRun(basedir, effectiveRunId),
|
|
@@ -126809,7 +127402,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
126809
127402
|
errorCode: failedData.errorCode,
|
|
126810
127403
|
completedAt: now2,
|
|
126811
127404
|
updatedAt: now2,
|
|
126812
|
-
attributes: currentRun.attributes
|
|
127405
|
+
attributes: currentRun.attributes,
|
|
127406
|
+
encryptionPublicKey: currentRun.encryptionPublicKey
|
|
126813
127407
|
});
|
|
126814
127408
|
await Promise.all([
|
|
126815
127409
|
deleteAllHooksForRun(basedir, effectiveRunId),
|
|
@@ -126833,7 +127427,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
126833
127427
|
error: void 0,
|
|
126834
127428
|
completedAt: now2,
|
|
126835
127429
|
updatedAt: now2,
|
|
126836
|
-
attributes: currentRun.attributes
|
|
127430
|
+
attributes: currentRun.attributes,
|
|
127431
|
+
encryptionPublicKey: currentRun.encryptionPublicKey
|
|
126837
127432
|
});
|
|
126838
127433
|
await Promise.all([
|
|
126839
127434
|
deleteAllHooksForRun(basedir, effectiveRunId),
|
|
@@ -127778,6 +128373,7 @@ function createStreamer$1(basedir, tag) {
|
|
|
127778
128373
|
function createWorld$1(args) {
|
|
127779
128374
|
const definedArgs = {};
|
|
127780
128375
|
const mergedConfig = { ...config.value, ...definedArgs };
|
|
128376
|
+
warnIfRunningInVercelDeployment(mergedConfig.dataDir);
|
|
127781
128377
|
const tag = mergedConfig.tag;
|
|
127782
128378
|
const queue = createQueue$2(mergedConfig);
|
|
127783
128379
|
const { clearCache: clearStorageCache, ...storage } = createStorage$1(mergedConfig.dataDir, tag);
|
|
@@ -127817,7 +128413,7 @@ function createWorld$1(args) {
|
|
|
127817
128413
|
const basedir = mergedConfig.dataDir;
|
|
127818
128414
|
const hooksDir = path$3.join(basedir, "hooks");
|
|
127819
128415
|
const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
|
|
127820
|
-
const { HookSchema: HookSchema2 } = await import("./index-
|
|
128416
|
+
const { HookSchema: HookSchema2 } = await import("./index-M4Ai7vsa.js");
|
|
127821
128417
|
await Promise.all(taggedHookFiles.map(async (hookFile) => {
|
|
127822
128418
|
const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
|
|
127823
128419
|
if (hook == null ? void 0 : hook.token) {
|
|
@@ -128000,8 +128596,8 @@ function requireGetVercelOidcToken() {
|
|
|
128000
128596
|
}
|
|
128001
128597
|
try {
|
|
128002
128598
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
128003
|
-
await import("./token-util-
|
|
128004
|
-
await import("./token-
|
|
128599
|
+
await import("./token-util-CiVcDWD3.js").then((n) => n.t),
|
|
128600
|
+
await import("./token-Ulh8Tdgw.js").then((n) => n.t)
|
|
128005
128601
|
]);
|
|
128006
128602
|
if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
|
|
128007
128603
|
await refreshToken(options);
|
|
@@ -128911,7 +129507,7 @@ async function instrumentedFetch(opts) {
|
|
|
128911
129507
|
return response2;
|
|
128912
129508
|
});
|
|
128913
129509
|
}
|
|
128914
|
-
const version = "5.0.0-beta.
|
|
129510
|
+
const version = "5.0.0-beta.33";
|
|
128915
129511
|
const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
128916
129512
|
const MAX_BODY_PARSE_RETRIES = 2;
|
|
128917
129513
|
const BODY_PARSE_RETRY_BASE_MS = 100;
|
|
@@ -131636,10 +132232,10 @@ class Minimatch {
|
|
|
131636
132232
|
}
|
|
131637
132233
|
return filtered.join("/");
|
|
131638
132234
|
}).join("|");
|
|
131639
|
-
const [
|
|
131640
|
-
re2 = "^" +
|
|
132235
|
+
const [open2, close] = set2.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
132236
|
+
re2 = "^" + open2 + re2 + close + "$";
|
|
131641
132237
|
if (this.partial) {
|
|
131642
|
-
re2 = "^(?:\\/|" +
|
|
132238
|
+
re2 = "^(?:\\/|" + open2 + re2.slice(1, -1) + close + ")$";
|
|
131643
132239
|
}
|
|
131644
132240
|
if (this.negate)
|
|
131645
132241
|
re2 = "^(?!" + re2 + ").+$";
|
|
@@ -131853,9 +132449,9 @@ function requirePicocolors() {
|
|
|
131853
132449
|
hasRequiredPicocolors = 1;
|
|
131854
132450
|
let p2 = process || {}, argv = p2.argv || [], env2 = p2.env || {};
|
|
131855
132451
|
let isColorSupported = !(!!env2.NO_COLOR || argv.includes("--no-color")) && (!!env2.FORCE_COLOR || argv.includes("--color") || p2.platform === "win32" || (p2.stdout || {}).isTTY && env2.TERM !== "dumb" || !!env2.CI);
|
|
131856
|
-
let formatter = (
|
|
131857
|
-
let string2 = "" + input, index2 = string2.indexOf(close,
|
|
131858
|
-
return ~index2 ?
|
|
132452
|
+
let formatter = (open2, close, replace2 = open2) => (input) => {
|
|
132453
|
+
let string2 = "" + input, index2 = string2.indexOf(close, open2.length);
|
|
132454
|
+
return ~index2 ? open2 + replaceClose(string2, close, replace2, index2) + close : open2 + string2 + close;
|
|
131859
132455
|
};
|
|
131860
132456
|
let replaceClose = (string2, close, replace2, index2) => {
|
|
131861
132457
|
let result = "", cursor = 0;
|
|
@@ -134289,6 +134885,9 @@ var QueueClient = class {
|
|
|
134289
134885
|
setApi(this, new ApiClient({ ...options, region }));
|
|
134290
134886
|
}
|
|
134291
134887
|
};
|
|
134888
|
+
function missingDeploymentIdMessage(operation) {
|
|
134889
|
+
return `${operation} requires VERCEL_DEPLOYMENT_ID, which Vercel sets in every deployment, so this process is not running inside one. The Vercel world was selected when the app was built (and compiled into the server bundles), which happens whenever the build environment looks like Vercel — including a production server started locally or in CI with an env file from \`vercel env pull\`. To run that build against the local filesystem world instead, set WORKFLOW_TARGET_WORLD=local and rebuild.`;
|
|
134890
|
+
}
|
|
134292
134891
|
class CborTransport {
|
|
134293
134892
|
constructor() {
|
|
134294
134893
|
__publicField(this, "contentType", "application/cbor");
|
|
@@ -134381,9 +134980,6 @@ function getRunIdFromPayload(payload) {
|
|
|
134381
134980
|
if ("runId" in payload && typeof payload.runId === "string") {
|
|
134382
134981
|
return payload.runId;
|
|
134383
134982
|
}
|
|
134384
|
-
if ("workflowRunId" in payload && typeof payload.workflowRunId === "string") {
|
|
134385
|
-
return payload.workflowRunId;
|
|
134386
|
-
}
|
|
134387
134983
|
return void 0;
|
|
134388
134984
|
}
|
|
134389
134985
|
const RUN_ID_PREFIX = "wrun_";
|
|
@@ -134418,9 +135014,6 @@ function getHeadersFromPayload(payload) {
|
|
|
134418
135014
|
if ("runId" in payload && typeof payload.runId === "string") {
|
|
134419
135015
|
headers2["x-vercel-workflow-run-id"] = payload.runId;
|
|
134420
135016
|
}
|
|
134421
|
-
if ("workflowRunId" in payload && typeof payload.workflowRunId === "string") {
|
|
134422
|
-
headers2["x-vercel-workflow-run-id"] = payload.workflowRunId;
|
|
134423
|
-
}
|
|
134424
135017
|
if ("stepId" in payload && typeof payload.stepId === "string") {
|
|
134425
135018
|
headers2["x-vercel-workflow-step-id"] = payload.stepId;
|
|
134426
135019
|
}
|
|
@@ -134439,15 +135032,15 @@ function getPhysicalQueueName(queueName, payload) {
|
|
|
134439
135032
|
loggedSequentialReplays = true;
|
|
134440
135033
|
console.warn("[workflow] WORKFLOW_SEQUENTIAL_REPLAYS=1: routing flow messages to per-run queue topics");
|
|
134441
135034
|
}
|
|
135035
|
+
if ("__healthCheck" in payload && typeof payload.correlationId === "string") {
|
|
135036
|
+
return `${queueName}_${payload.correlationId}`;
|
|
135037
|
+
}
|
|
134442
135038
|
if ("runId" in payload && typeof payload.runId === "string") {
|
|
134443
135039
|
if ("stepId" in payload && typeof payload.stepId === "string") {
|
|
134444
135040
|
return `${queueName}_${payload.runId}_${payload.stepId}`;
|
|
134445
135041
|
}
|
|
134446
135042
|
return `${queueName}_${payload.runId}`;
|
|
134447
135043
|
}
|
|
134448
|
-
if ("__healthCheck" in payload && typeof payload.correlationId === "string") {
|
|
134449
|
-
return `${queueName}_${payload.correlationId}`;
|
|
134450
|
-
}
|
|
134451
135044
|
return queueName;
|
|
134452
135045
|
}
|
|
134453
135046
|
function createQueue$1(config2) {
|
|
@@ -134470,7 +135063,7 @@ function createQueue$1(config2) {
|
|
|
134470
135063
|
const queue = async (queueName, payload, opts) => {
|
|
134471
135064
|
const deploymentId = (opts == null ? void 0 : opts.deploymentId) ?? process.env.VERCEL_DEPLOYMENT_ID;
|
|
134472
135065
|
if (!deploymentId) {
|
|
134473
|
-
throw new Error("
|
|
135066
|
+
throw new Error(`${missingDeploymentIdMessage("Enqueuing a workflow message")} Callers outside a deployment can instead pass an explicit deploymentId in options.`);
|
|
134474
135067
|
}
|
|
134475
135068
|
const useCbor = ((opts == null ? void 0 : opts.specVersion) ?? SPEC_VERSION_CURRENT) >= SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT;
|
|
134476
135069
|
const transport = useCbor ? cborTransport : jsonTransport;
|
|
@@ -134565,7 +135158,7 @@ function createQueue$1(config2) {
|
|
|
134565
135158
|
const getDeploymentId = async () => {
|
|
134566
135159
|
const deploymentId = process.env.VERCEL_DEPLOYMENT_ID;
|
|
134567
135160
|
if (!deploymentId) {
|
|
134568
|
-
throw new Error("
|
|
135161
|
+
throw new Error(missingDeploymentIdMessage("Starting a workflow run"));
|
|
134569
135162
|
}
|
|
134570
135163
|
return deploymentId;
|
|
134571
135164
|
};
|
|
@@ -134578,7 +135171,7 @@ function createResolveLatestDeploymentId(config2) {
|
|
|
134578
135171
|
return async function resolveLatestDeploymentId() {
|
|
134579
135172
|
const currentDeploymentId = process.env.VERCEL_DEPLOYMENT_ID;
|
|
134580
135173
|
if (!currentDeploymentId) {
|
|
134581
|
-
throw new Error("
|
|
135174
|
+
throw new Error(missingDeploymentIdMessage("Resolving the latest deployment for deploymentId: 'latest'"));
|
|
134582
135175
|
}
|
|
134583
135176
|
const token = await resolveVercelApiToken(config2);
|
|
134584
135177
|
if (!token) {
|
|
@@ -134948,6 +135541,9 @@ function buildPostFrameMeta(input) {
|
|
|
134948
135541
|
if (input.allowReservedAttributes !== void 0) {
|
|
134949
135542
|
meta2.allowReservedAttributes = input.allowReservedAttributes;
|
|
134950
135543
|
}
|
|
135544
|
+
if (input.encryptionPublicKey !== void 0) {
|
|
135545
|
+
meta2.encryptionPublicKey = input.encryptionPublicKey;
|
|
135546
|
+
}
|
|
134951
135547
|
if (input.ttfs !== void 0)
|
|
134952
135548
|
meta2.ttfs = input.ttfs;
|
|
134953
135549
|
if (input.stso !== void 0)
|
|
@@ -135506,6 +136102,9 @@ function splitEventDataForV4(data) {
|
|
|
135506
136102
|
if (typeof eventData.allowReservedAttributes === "boolean") {
|
|
135507
136103
|
meta2.allowReservedAttributes = eventData.allowReservedAttributes;
|
|
135508
136104
|
}
|
|
136105
|
+
if (typeof eventData.encryptionPublicKey === "string") {
|
|
136106
|
+
meta2.encryptionPublicKey = eventData.encryptionPublicKey;
|
|
136107
|
+
}
|
|
135509
136108
|
if (typeof eventData.ttfs === "number") {
|
|
135510
136109
|
meta2.ttfs = eventData.ttfs;
|
|
135511
136110
|
}
|
|
@@ -136010,13 +136609,8 @@ function createWorld(config2) {
|
|
|
136010
136609
|
var _a3, _b2;
|
|
136011
136610
|
const projectId = ((_a3 = config2 == null ? void 0 : config2.projectConfig) == null ? void 0 : _a3.projectId) || process.env.VERCEL_PROJECT_ID;
|
|
136012
136611
|
return {
|
|
136013
|
-
// Spec v5
|
|
136014
|
-
//
|
|
136015
|
-
// via RemoteRef and never deserializes them). Spec 5 is a superset of
|
|
136016
|
-
// spec 4, so native `attr_set` events and initial run attributes still
|
|
136017
|
-
// work. New runs are stamped with this version; the server must support
|
|
136018
|
-
// at least it — workflow-server declared spec-5 support in
|
|
136019
|
-
// vercel/workflow-server#520.
|
|
136612
|
+
// Spec v5 adds client-side zstd/gzip payload compression. The server stores
|
|
136613
|
+
// those payloads opaquely, and v5 remains a superset of v4 attributes.
|
|
136020
136614
|
specVersion: SPEC_VERSION_SUPPORTS_COMPRESSION,
|
|
136021
136615
|
capabilities: {
|
|
136022
136616
|
// workflow-server enforces the `stateUpdatedAt` optimistic-concurrency
|
|
@@ -136037,7 +136631,11 @@ function createWorld(config2) {
|
|
|
136037
136631
|
processExitTriggersQueueRedelivery: true,
|
|
136038
136632
|
...createQueue$1(config2),
|
|
136039
136633
|
...createStorage(config2),
|
|
136040
|
-
|
|
136634
|
+
// Analytics list reads are served from an eventually-ingested store.
|
|
136635
|
+
// Tooling that needs read-your-writes listings immediately after a
|
|
136636
|
+
// write (e.g. deterministic e2e assertions) can force the CLI/world
|
|
136637
|
+
// list paths back onto primary storage by disabling the namespace.
|
|
136638
|
+
analytics: process.env.WORKFLOW_DISABLE_ANALYTICS_READS === "1" ? void 0 : createAnalytics(config2),
|
|
136041
136639
|
...instrumentObject("world.streams", createStreamer(config2)),
|
|
136042
136640
|
createRunId,
|
|
136043
136641
|
describeRun,
|
|
@@ -136815,10 +137413,10 @@ async function fetchWorkflowsManifest(_worldEnv) {
|
|
|
136815
137413
|
workflows: {}
|
|
136816
137414
|
});
|
|
136817
137415
|
}
|
|
136818
|
-
async function runHealthCheck(worldEnv,
|
|
137416
|
+
async function runHealthCheck(worldEnv, options) {
|
|
136819
137417
|
try {
|
|
136820
137418
|
const world = await getWorldFromEnv(worldEnv);
|
|
136821
|
-
const result = await healthCheck(world,
|
|
137419
|
+
const result = await healthCheck(world, options);
|
|
136822
137420
|
return createResponse({
|
|
136823
137421
|
...result
|
|
136824
137422
|
});
|
|
@@ -139392,7 +139990,7 @@ var useRovingFocusGroupScope$1 = createRovingFocusGroupScope$1();
|
|
|
139392
139990
|
var [MenuProvider, useMenuContext] = createMenuContext(MENU_NAME);
|
|
139393
139991
|
var [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME);
|
|
139394
139992
|
var Menu = (props) => {
|
|
139395
|
-
const { __scopeMenu, open = false, children: children2, dir, onOpenChange, modal = true } = props;
|
|
139993
|
+
const { __scopeMenu, open: open2 = false, children: children2, dir, onOpenChange, modal = true } = props;
|
|
139396
139994
|
const popperScope = usePopperScope$1(__scopeMenu);
|
|
139397
139995
|
const [content2, setContent] = reactExports.useState(null);
|
|
139398
139996
|
const isUsingKeyboardRef = reactExports.useRef(false);
|
|
@@ -139416,7 +140014,7 @@ var Menu = (props) => {
|
|
|
139416
140014
|
MenuProvider,
|
|
139417
140015
|
{
|
|
139418
140016
|
scope: __scopeMenu,
|
|
139419
|
-
open,
|
|
140017
|
+
open: open2,
|
|
139420
140018
|
onOpenChange: handleOpenChange,
|
|
139421
140019
|
content: content2,
|
|
139422
140020
|
onContentChange: setContent,
|
|
@@ -140087,8 +140685,8 @@ var MenuSubContent = reactExports.forwardRef(
|
|
|
140087
140685
|
}
|
|
140088
140686
|
);
|
|
140089
140687
|
MenuSubContent.displayName = SUB_CONTENT_NAME$1;
|
|
140090
|
-
function getOpenState(
|
|
140091
|
-
return
|
|
140688
|
+
function getOpenState(open2) {
|
|
140689
|
+
return open2 ? "open" : "closed";
|
|
140092
140690
|
}
|
|
140093
140691
|
function isIndeterminate$1(checked) {
|
|
140094
140692
|
return checked === "indeterminate";
|
|
@@ -140174,7 +140772,7 @@ var DropdownMenu$1 = (props) => {
|
|
|
140174
140772
|
} = props;
|
|
140175
140773
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
140176
140774
|
const triggerRef = reactExports.useRef(null);
|
|
140177
|
-
const [
|
|
140775
|
+
const [open2 = false, setOpen] = useControllableState({
|
|
140178
140776
|
prop: openProp,
|
|
140179
140777
|
defaultProp: defaultOpen,
|
|
140180
140778
|
onChange: onOpenChange
|
|
@@ -140186,11 +140784,11 @@ var DropdownMenu$1 = (props) => {
|
|
|
140186
140784
|
triggerId: useId(),
|
|
140187
140785
|
triggerRef,
|
|
140188
140786
|
contentId: useId(),
|
|
140189
|
-
open,
|
|
140787
|
+
open: open2,
|
|
140190
140788
|
onOpenChange: setOpen,
|
|
140191
140789
|
onOpenToggle: reactExports.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
140192
140790
|
modal,
|
|
140193
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Root3, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children: children2 })
|
|
140791
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Root3, { ...menuScope, open: open2, onOpenChange: setOpen, dir, modal, children: children2 })
|
|
140194
140792
|
}
|
|
140195
140793
|
);
|
|
140196
140794
|
};
|
|
@@ -143501,7 +144099,7 @@ var Select$1 = (props) => {
|
|
|
143501
144099
|
const [valueNode, setValueNode] = reactExports.useState(null);
|
|
143502
144100
|
const [valueNodeHasChildren, setValueNodeHasChildren] = reactExports.useState(false);
|
|
143503
144101
|
const direction = useDirection(dir);
|
|
143504
|
-
const [
|
|
144102
|
+
const [open2, setOpen] = useControllableState$1({
|
|
143505
144103
|
prop: openProp,
|
|
143506
144104
|
defaultProp: defaultOpen ?? false,
|
|
143507
144105
|
onChange: onOpenChange,
|
|
@@ -143531,7 +144129,7 @@ var Select$1 = (props) => {
|
|
|
143531
144129
|
contentId: useId$1(),
|
|
143532
144130
|
value,
|
|
143533
144131
|
onValueChange: setValue,
|
|
143534
|
-
open,
|
|
144132
|
+
open: open2,
|
|
143535
144133
|
onOpenChange: setOpen,
|
|
143536
144134
|
dir: direction,
|
|
143537
144135
|
triggerPointerDownPosRef,
|
|
@@ -156156,7 +156754,7 @@ var Dialog$1 = (props) => {
|
|
|
156156
156754
|
} = props;
|
|
156157
156755
|
const triggerRef = reactExports.useRef(null);
|
|
156158
156756
|
const contentRef = reactExports.useRef(null);
|
|
156159
|
-
const [
|
|
156757
|
+
const [open2, setOpen] = useControllableState$1({
|
|
156160
156758
|
prop: openProp,
|
|
156161
156759
|
defaultProp: defaultOpen ?? false,
|
|
156162
156760
|
onChange: onOpenChange,
|
|
@@ -156171,7 +156769,7 @@ var Dialog$1 = (props) => {
|
|
|
156171
156769
|
contentId: useId$1(),
|
|
156172
156770
|
titleId: useId$1(),
|
|
156173
156771
|
descriptionId: useId$1(),
|
|
156174
|
-
open,
|
|
156772
|
+
open: open2,
|
|
156175
156773
|
onOpenChange: setOpen,
|
|
156176
156774
|
onOpenToggle: reactExports.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
156177
156775
|
modal,
|
|
@@ -156402,8 +157000,8 @@ var DialogClose$1 = reactExports.forwardRef(
|
|
|
156402
157000
|
}
|
|
156403
157001
|
);
|
|
156404
157002
|
DialogClose$1.displayName = CLOSE_NAME$1;
|
|
156405
|
-
function getState$1(
|
|
156406
|
-
return
|
|
157003
|
+
function getState$1(open2) {
|
|
157004
|
+
return open2 ? "open" : "closed";
|
|
156407
157005
|
}
|
|
156408
157006
|
var TITLE_WARNING_NAME$1 = "DialogTitleWarning";
|
|
156409
157007
|
var [WarningProvider$1, useWarningContext$1] = createContext2$1(TITLE_WARNING_NAME$1, {
|
|
@@ -157373,7 +157971,7 @@ var Dialog = (props) => {
|
|
|
157373
157971
|
} = props;
|
|
157374
157972
|
const triggerRef = reactExports.useRef(null);
|
|
157375
157973
|
const contentRef = reactExports.useRef(null);
|
|
157376
|
-
const [
|
|
157974
|
+
const [open2 = false, setOpen] = useControllableState({
|
|
157377
157975
|
prop: openProp,
|
|
157378
157976
|
defaultProp: defaultOpen,
|
|
157379
157977
|
onChange: onOpenChange
|
|
@@ -157387,7 +157985,7 @@ var Dialog = (props) => {
|
|
|
157387
157985
|
contentId: useId(),
|
|
157388
157986
|
titleId: useId(),
|
|
157389
157987
|
descriptionId: useId(),
|
|
157390
|
-
open,
|
|
157988
|
+
open: open2,
|
|
157391
157989
|
onOpenChange: setOpen,
|
|
157392
157990
|
onOpenToggle: reactExports.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
157393
157991
|
modal,
|
|
@@ -157617,8 +158215,8 @@ var DialogClose = reactExports.forwardRef(
|
|
|
157617
158215
|
}
|
|
157618
158216
|
);
|
|
157619
158217
|
DialogClose.displayName = CLOSE_NAME;
|
|
157620
|
-
function getState(
|
|
157621
|
-
return
|
|
158218
|
+
function getState(open2) {
|
|
158219
|
+
return open2 ? "open" : "closed";
|
|
157622
158220
|
}
|
|
157623
158221
|
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
157624
158222
|
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
@@ -158200,9 +158798,8 @@ function useStreamReader(env2, streamId, runId, encryptionKey, runStatus) {
|
|
|
158200
158798
|
if (!cryptoKey) {
|
|
158201
158799
|
return { encrypted: true };
|
|
158202
158800
|
}
|
|
158203
|
-
const payload = frameData.slice(4);
|
|
158204
158801
|
hydrated = hydrateData(
|
|
158205
|
-
await decrypt
|
|
158802
|
+
await decrypt(frameData, cryptoKey),
|
|
158206
158803
|
revivers
|
|
158207
158804
|
);
|
|
158208
158805
|
} else {
|
|
@@ -158355,7 +158952,7 @@ function useStreamReader(env2, streamId, runId, encryptionKey, runStatus) {
|
|
|
158355
158952
|
};
|
|
158356
158953
|
const readStreamData = async () => {
|
|
158357
158954
|
try {
|
|
158358
|
-
const cryptoKey = encryptionKey ? await
|
|
158955
|
+
const cryptoKey = encryptionKey ? await deriveRunPayloadKeys(encryptionKey) : void 0;
|
|
158359
158956
|
const initialChunks = [];
|
|
158360
158957
|
const result = await fetchAndParse(initialChunks, cryptoKey);
|
|
158361
158958
|
if (result.encrypted) {
|
|
@@ -159011,7 +159608,7 @@ const handlers = {
|
|
|
159011
159608
|
resumeHook: (p2) => resumeHook$1(p2.worldEnv ?? {}, p2.token, p2.payload),
|
|
159012
159609
|
fetchStreams: (p2) => fetchStreams(p2.worldEnv ?? {}, p2.runId),
|
|
159013
159610
|
fetchWorkflowsManifest: (p2) => fetchWorkflowsManifest(p2.worldEnv ?? {}),
|
|
159014
|
-
runHealthCheck: (p2) => runHealthCheck(p2.worldEnv ?? {}, p2.
|
|
159611
|
+
runHealthCheck: (p2) => runHealthCheck(p2.worldEnv ?? {}, p2.options),
|
|
159015
159612
|
getEncryptionKeyForRun: (p2) => getEncryptionKeyForRun(p2.worldEnv ?? {}, p2.runId),
|
|
159016
159613
|
getPublicServerConfig: () => getPublicServerConfig()
|
|
159017
159614
|
};
|
|
@@ -159149,7 +159746,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
159149
159746
|
__proto__: null,
|
|
159150
159747
|
loader
|
|
159151
159748
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
159152
|
-
const serverManifest = { "entry": { "module": "/assets/entry.client-
|
|
159749
|
+
const serverManifest = { "entry": { "module": "/assets/entry.client-LwI3HNYl.js", "imports": ["/assets/index-PFjW8YjQ.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-2ub-CsWS.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/mermaid-3ZIDBTTL-CMP9Tato.js", "/assets/arrow-up-right-DDNPFYmg.js"], "css": ["/assets/root-15oK726f.css", "/assets/mermaid-3ZIDBTTL-DDxQhcP4.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-BqvW8ODs.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-DOLwtzSv.js", "/assets/mermaid-3ZIDBTTL-CMP9Tato.js"], "css": ["/assets/workflow-graph-viewer-DnlNuQQH.css", "/assets/mermaid-3ZIDBTTL-DDxQhcP4.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-B1PK-m7y.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-DOLwtzSv.js", "/assets/mermaid-3ZIDBTTL-CMP9Tato.js", "/assets/arrow-up-right-DDNPFYmg.js"], "css": ["/assets/run-detail-CWoGxu_0.css", "/assets/workflow-graph-viewer-DnlNuQQH.css", "/assets/mermaid-3ZIDBTTL-DDxQhcP4.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-7f03c136.js", "version": "7f03c136", "sri": void 0 };
|
|
159153
159750
|
const assetsBuildDirectory = "build/client";
|
|
159154
159751
|
const basename = "/";
|
|
159155
159752
|
const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
|
|
@@ -159218,7 +159815,7 @@ const serverBuild = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
159218
159815
|
ssr
|
|
159219
159816
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
159220
159817
|
export {
|
|
159221
|
-
|
|
159818
|
+
WAIT_EVENT_TYPES as $,
|
|
159222
159819
|
ATTRIBUTE_KEY_MAX_LENGTH as A,
|
|
159223
159820
|
BaseEventSchema as B,
|
|
159224
159821
|
CHILD_ENTITY_CREATION_EVENT_TYPES as C,
|
|
@@ -159228,67 +159825,66 @@ export {
|
|
|
159228
159825
|
STEP_EVENT_TYPES as G,
|
|
159229
159826
|
HookSchema as H,
|
|
159230
159827
|
SerializedDataSchema as I,
|
|
159231
|
-
|
|
159232
|
-
|
|
159828
|
+
StepSchema as J,
|
|
159829
|
+
StepStatusSchema as K,
|
|
159233
159830
|
LegacySerializedDataSchemaV1 as L,
|
|
159234
159831
|
MessageId as M,
|
|
159235
159832
|
Nt as N,
|
|
159236
|
-
|
|
159833
|
+
StructuredErrorSchema as O,
|
|
159237
159834
|
PARENT_RUN_ID_ATTRIBUTE as P,
|
|
159238
159835
|
QueuePayloadSchema as Q,
|
|
159239
159836
|
RESERVED_ATTRIBUTE_KEY_PREFIX as R,
|
|
159240
159837
|
SPEC_VERSION_CURRENT as S,
|
|
159241
|
-
|
|
159242
|
-
|
|
159243
|
-
|
|
159244
|
-
|
|
159245
|
-
|
|
159246
|
-
|
|
159247
|
-
|
|
159248
|
-
|
|
159838
|
+
TERMINAL_RUN_EVENT_TYPES as T,
|
|
159839
|
+
TERMINAL_STEP_EVENT_TYPES as U,
|
|
159840
|
+
TERMINAL_STEP_STATUSES as V,
|
|
159841
|
+
TERMINAL_WORKFLOW_RUN_STATUSES as W,
|
|
159842
|
+
TerminalRunEventTypeSchema as X,
|
|
159843
|
+
TerminalStepStatusSchema as Y,
|
|
159844
|
+
TerminalWorkflowRunStatusSchema as Z,
|
|
159845
|
+
ValidQueueName as _,
|
|
159249
159846
|
ATTRIBUTE_MAX_PER_RUN as a,
|
|
159250
|
-
|
|
159251
|
-
|
|
159252
|
-
|
|
159253
|
-
|
|
159254
|
-
|
|
159255
|
-
|
|
159256
|
-
|
|
159257
|
-
|
|
159258
|
-
|
|
159259
|
-
|
|
159260
|
-
|
|
159261
|
-
|
|
159262
|
-
|
|
159263
|
-
|
|
159264
|
-
|
|
159265
|
-
|
|
159266
|
-
|
|
159267
|
-
|
|
159268
|
-
|
|
159269
|
-
|
|
159270
|
-
|
|
159271
|
-
|
|
159272
|
-
|
|
159273
|
-
|
|
159274
|
-
|
|
159275
|
-
|
|
159276
|
-
|
|
159277
|
-
|
|
159278
|
-
|
|
159279
|
-
|
|
159280
|
-
|
|
159281
|
-
|
|
159282
|
-
|
|
159283
|
-
|
|
159284
|
-
|
|
159285
|
-
|
|
159286
|
-
|
|
159287
|
-
|
|
159288
|
-
|
|
159289
|
-
|
|
159290
|
-
|
|
159291
|
-
Ks as az,
|
|
159847
|
+
WaitSchema as a0,
|
|
159848
|
+
WaitStatusSchema as a1,
|
|
159849
|
+
WorkflowInvokePayloadSchema as a2,
|
|
159850
|
+
WorkflowRunBaseSchema as a3,
|
|
159851
|
+
WorkflowRunSchema as a4,
|
|
159852
|
+
WorkflowRunStatusSchema as a5,
|
|
159853
|
+
applyAttributeChanges as a6,
|
|
159854
|
+
envNumber as a7,
|
|
159855
|
+
getEventDataPayloadField as a8,
|
|
159856
|
+
getEventDataRefFields as a9,
|
|
159857
|
+
Qe as aA,
|
|
159858
|
+
registerZstdDecoder as aB,
|
|
159859
|
+
requireTokenUtil as aC,
|
|
159860
|
+
requireTokenError as aD,
|
|
159861
|
+
serverBuild as aE,
|
|
159862
|
+
getQueueTopicPrefix as aa,
|
|
159863
|
+
isChildEntityCreationEvent as ab,
|
|
159864
|
+
isChildEntityCreationEventType as ac,
|
|
159865
|
+
isHookEventRequiringExistence as ad,
|
|
159866
|
+
isHookLifecycleEventType as ae,
|
|
159867
|
+
isLegacySpecVersion as af,
|
|
159868
|
+
isStepEventType as ag,
|
|
159869
|
+
isTerminalRunEventType as ah,
|
|
159870
|
+
isTerminalStepEventType as ai,
|
|
159871
|
+
isTerminalStepStatus as aj,
|
|
159872
|
+
isTerminalWorkflowRunStatus as ak,
|
|
159873
|
+
isWaitEventType as al,
|
|
159874
|
+
parseQueueName as am,
|
|
159875
|
+
reenqueueActiveRuns as an,
|
|
159876
|
+
requiresNewerWorld as ao,
|
|
159877
|
+
resolveQueueNamespace as ap,
|
|
159878
|
+
stripEventDataRefs as aq,
|
|
159879
|
+
ulidToDate as ar,
|
|
159880
|
+
validateAttributeChanges as as,
|
|
159881
|
+
validateAttributeKey as at,
|
|
159882
|
+
validateAttributeValue as au,
|
|
159883
|
+
validateUlidTimestamp as av,
|
|
159884
|
+
workflowRunIdSchema as aw,
|
|
159885
|
+
R as ax,
|
|
159886
|
+
Ks as ay,
|
|
159887
|
+
jsxRuntimeExports as az,
|
|
159292
159888
|
ATTRIBUTE_VALUE_MAX_BYTES as b,
|
|
159293
159889
|
AnalyticsAttributeKeySchema as c,
|
|
159294
159890
|
AnalyticsEventSchema as d,
|