@workflow/web 5.0.0-beta.26 → 5.0.0-beta.27
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/{encryption-g14N5vQl.js → encryption-BQTnudEZ.js} +1 -1
- package/build/client/assets/{highlighted-body-B3W2YXNL-QrddlyZu.js → highlighted-body-B3W2YXNL-B-EF8R0t.js} +1 -1
- package/build/client/assets/{home-BNApVOct.js → home-DQkixJk4.js} +3 -3
- package/build/client/assets/{index-B6-SzLmT.js → index-ConSkUmc.js} +0 -2
- package/build/client/assets/{manifest-379f050f.js → manifest-ce6dd06d.js} +1 -1
- package/build/client/assets/{mermaid-3ZIDBTTL-Cg-Mp5Kj.js → mermaid-3ZIDBTTL-aixonSAh.js} +445 -260
- package/build/client/assets/root-BlaSucTH.css +1 -0
- package/build/client/assets/{root-BsPxYsbK.js → root-CsCdj08f.js} +1 -1
- package/build/client/assets/{run-detail-sr7StYc6.js → run-detail-CCsVqid_.js} +975 -760
- package/build/client/assets/server-build-DPrKlhgf.css +1 -0
- package/build/client/assets/{workflow-graph-viewer-CcCwLmnF.js → workflow-graph-viewer-BlPvo_5I.js} +44 -62
- package/build/client/assets/{zstd-browser-decoder-OOeWOMJw.js → zstd-browser-decoder-RyHgsNO3.js} +1 -1
- package/build/server/assets/{app-DQ35jFT1.js → app-kYNGZFkW.js} +1 -1
- package/build/server/assets/{highlighted-body-B3W2YXNL-DUlvgLoF.js → highlighted-body-B3W2YXNL-D1QWoqJB.js} +3 -3
- package/build/server/assets/index-fWQcXKhC.js +115 -0
- package/build/server/assets/{mermaid-3ZIDBTTL-BdnRYE9a.js → mermaid-3ZIDBTTL-BOh-zwwU.js} +3 -3
- package/build/server/assets/{server-build-0CazaFkH.js → server-build-B21fZEey.js} +2114 -1175
- package/build/server/assets/{token-DK_R23fr.js → token-DmIqmbeU.js} +2 -2
- package/build/server/assets/{token-util-CaJAmsYa.js → token-util-D4JYdrFc.js} +2 -2
- package/build/server/assets/{zstd-browser-decoder-pCjqxVHM.js → zstd-browser-decoder-DgO7NCG6.js} +3 -3
- package/build/server/index.js +1 -1
- package/package.json +8 -8
- package/build/client/assets/root-F_dqJDC7.css +0 -1
- package/build/client/assets/server-build-DVBDkRDS.css +0 -1
- package/build/server/assets/index-BgRt1-Z6.js +0 -100
|
@@ -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-kYNGZFkW.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";
|
|
@@ -53,13 +53,13 @@ import require$$2$2 from "node:worker_threads";
|
|
|
53
53
|
import require$$1$4 from "node:console";
|
|
54
54
|
import require$$2$3 from "node:timers";
|
|
55
55
|
import require$$1$5 from "node:dns";
|
|
56
|
+
import os, { homedir } from "node:os";
|
|
56
57
|
import * as path$2 from "path";
|
|
57
58
|
import path__default from "path";
|
|
58
59
|
import * as fs from "fs";
|
|
59
60
|
import fs__default from "fs";
|
|
60
61
|
import require$$2$4 from "os";
|
|
61
62
|
import * as net from "net";
|
|
62
|
-
import os, { homedir } from "node:os";
|
|
63
63
|
var jsxRuntime = { exports: {} };
|
|
64
64
|
var reactJsxRuntime_production = {};
|
|
65
65
|
/**
|
|
@@ -23900,7 +23900,7 @@ const oppositeAlignmentMap = {
|
|
|
23900
23900
|
start: "end",
|
|
23901
23901
|
end: "start"
|
|
23902
23902
|
};
|
|
23903
|
-
function clamp$
|
|
23903
|
+
function clamp$3(start2, value, end) {
|
|
23904
23904
|
return max(start2, min(value, end));
|
|
23905
23905
|
}
|
|
23906
23906
|
function evaluate(value, param) {
|
|
@@ -24251,7 +24251,7 @@ const arrow$3 = (options) => ({
|
|
|
24251
24251
|
const min$1 = minPadding;
|
|
24252
24252
|
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
24253
24253
|
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
24254
|
-
const offset2 = clamp$
|
|
24254
|
+
const offset2 = clamp$3(min$1, center, max2);
|
|
24255
24255
|
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
24256
24256
|
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
24257
24257
|
return {
|
|
@@ -24548,14 +24548,14 @@ const shift$2 = function(options) {
|
|
|
24548
24548
|
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
24549
24549
|
const min2 = mainAxisCoord + overflow[minSide];
|
|
24550
24550
|
const max2 = mainAxisCoord - overflow[maxSide];
|
|
24551
|
-
mainAxisCoord = clamp$
|
|
24551
|
+
mainAxisCoord = clamp$3(min2, mainAxisCoord, max2);
|
|
24552
24552
|
}
|
|
24553
24553
|
if (checkCrossAxis) {
|
|
24554
24554
|
const minSide = crossAxis === "y" ? "top" : "left";
|
|
24555
24555
|
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
24556
24556
|
const min2 = crossAxisCoord + overflow[minSide];
|
|
24557
24557
|
const max2 = crossAxisCoord - overflow[maxSide];
|
|
24558
|
-
crossAxisCoord = clamp$
|
|
24558
|
+
crossAxisCoord = clamp$3(min2, crossAxisCoord, max2);
|
|
24559
24559
|
}
|
|
24560
24560
|
const limitedCoords = limiter.fn({
|
|
24561
24561
|
...state,
|
|
@@ -34695,9 +34695,9 @@ const SerializationFormat$1 = {
|
|
|
34695
34695
|
/** Zstandard-compressed payload (inner payload has its own format prefix after decompression) */
|
|
34696
34696
|
ZSTD: "zstd"
|
|
34697
34697
|
};
|
|
34698
|
-
const FORMAT_PREFIX_LENGTH$
|
|
34698
|
+
const FORMAT_PREFIX_LENGTH$2 = 4;
|
|
34699
34699
|
new TextEncoder();
|
|
34700
|
-
const formatDecoder$
|
|
34700
|
+
const formatDecoder$2 = new TextDecoder();
|
|
34701
34701
|
function decodeFormatPrefix$1(data) {
|
|
34702
34702
|
if (!(data instanceof Uint8Array)) {
|
|
34703
34703
|
return {
|
|
@@ -34705,16 +34705,16 @@ function decodeFormatPrefix$1(data) {
|
|
|
34705
34705
|
payload: new TextEncoder().encode(JSON.stringify(data))
|
|
34706
34706
|
};
|
|
34707
34707
|
}
|
|
34708
|
-
if (data.length < FORMAT_PREFIX_LENGTH$
|
|
34709
|
-
throw new Error(`Data too short to contain format prefix: expected at least ${FORMAT_PREFIX_LENGTH$
|
|
34708
|
+
if (data.length < FORMAT_PREFIX_LENGTH$2) {
|
|
34709
|
+
throw new Error(`Data too short to contain format prefix: expected at least ${FORMAT_PREFIX_LENGTH$2} bytes, got ${data.length}`);
|
|
34710
34710
|
}
|
|
34711
|
-
const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH$
|
|
34712
|
-
const format2 = formatDecoder$
|
|
34711
|
+
const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH$2);
|
|
34712
|
+
const format2 = formatDecoder$2.decode(prefixBytes);
|
|
34713
34713
|
const knownFormats = Object.values(SerializationFormat$1);
|
|
34714
34714
|
if (!knownFormats.includes(format2)) {
|
|
34715
34715
|
throw new Error(`Unknown serialization format: "${format2}". Known formats: ${knownFormats.join(", ")}`);
|
|
34716
34716
|
}
|
|
34717
|
-
const payload = data.subarray(FORMAT_PREFIX_LENGTH$
|
|
34717
|
+
const payload = data.subarray(FORMAT_PREFIX_LENGTH$2);
|
|
34718
34718
|
return { format: format2, payload };
|
|
34719
34719
|
}
|
|
34720
34720
|
function isExpiredObject(data) {
|
|
@@ -34733,20 +34733,20 @@ function isExpiredStub(data) {
|
|
|
34733
34733
|
return false;
|
|
34734
34734
|
}
|
|
34735
34735
|
function isEncryptedData(data) {
|
|
34736
|
-
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$
|
|
34736
|
+
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$2) {
|
|
34737
34737
|
return false;
|
|
34738
34738
|
}
|
|
34739
|
-
const prefix = formatDecoder$
|
|
34739
|
+
const prefix = formatDecoder$2.decode(data.subarray(0, FORMAT_PREFIX_LENGTH$2));
|
|
34740
34740
|
return prefix === SerializationFormat$1.ENCRYPTED;
|
|
34741
34741
|
}
|
|
34742
34742
|
function isCompressedData(data) {
|
|
34743
|
-
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$
|
|
34743
|
+
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$2) {
|
|
34744
34744
|
return false;
|
|
34745
34745
|
}
|
|
34746
|
-
const prefix = formatDecoder$
|
|
34746
|
+
const prefix = formatDecoder$2.decode(data.subarray(0, FORMAT_PREFIX_LENGTH$2));
|
|
34747
34747
|
return prefix === SerializationFormat$1.GZIP || prefix === SerializationFormat$1.ZSTD;
|
|
34748
34748
|
}
|
|
34749
|
-
function getNodeZlib$
|
|
34749
|
+
function getNodeZlib$2() {
|
|
34750
34750
|
var _a3, _b2;
|
|
34751
34751
|
try {
|
|
34752
34752
|
return (_b2 = (_a3 = globalThis.process) == null ? void 0 : _a3.getBuiltinModule) == null ? void 0 : _b2.call(_a3, "node:zlib");
|
|
@@ -34756,7 +34756,7 @@ function getNodeZlib$1() {
|
|
|
34756
34756
|
}
|
|
34757
34757
|
function decompressSyncIfAvailable(format2, payload) {
|
|
34758
34758
|
try {
|
|
34759
|
-
const zlib = getNodeZlib$
|
|
34759
|
+
const zlib = getNodeZlib$2();
|
|
34760
34760
|
if (format2 === SerializationFormat$1.GZIP && (zlib == null ? void 0 : zlib.gunzipSync)) {
|
|
34761
34761
|
return new Uint8Array(zlib.gunzipSync(payload));
|
|
34762
34762
|
}
|
|
@@ -48908,6 +48908,15 @@ const EventTypeSchema = _enum([
|
|
|
48908
48908
|
"wait_created",
|
|
48909
48909
|
"wait_completed"
|
|
48910
48910
|
]);
|
|
48911
|
+
const TerminalRunEventTypeSchema = EventTypeSchema.extract([
|
|
48912
|
+
"run_completed",
|
|
48913
|
+
"run_failed",
|
|
48914
|
+
"run_cancelled"
|
|
48915
|
+
]);
|
|
48916
|
+
const TERMINAL_RUN_EVENT_TYPES = TerminalRunEventTypeSchema.options;
|
|
48917
|
+
function isTerminalRunEventType(eventType) {
|
|
48918
|
+
return TERMINAL_RUN_EVENT_TYPES.includes(eventType);
|
|
48919
|
+
}
|
|
48911
48920
|
const BaseEventSchema = object$1({
|
|
48912
48921
|
eventType: EventTypeSchema,
|
|
48913
48922
|
correlationId: string$3().optional(),
|
|
@@ -49134,125 +49143,6 @@ const EventSchema = AllEventsSchema.and(object$1({
|
|
|
49134
49143
|
occurredAt: date$2().optional(),
|
|
49135
49144
|
specVersion: number$3().optional()
|
|
49136
49145
|
}));
|
|
49137
|
-
const HookSchema = object$1({
|
|
49138
|
-
runId: string$3(),
|
|
49139
|
-
hookId: string$3(),
|
|
49140
|
-
token: string$3(),
|
|
49141
|
-
ownerId: string$3(),
|
|
49142
|
-
projectId: string$3(),
|
|
49143
|
-
environment: string$3(),
|
|
49144
|
-
metadata: SerializedDataSchema.optional(),
|
|
49145
|
-
createdAt: date$2(),
|
|
49146
|
-
// Optional in database for backwards compatibility, defaults to 1 (legacy) when reading
|
|
49147
|
-
specVersion: number$3().optional(),
|
|
49148
|
-
isWebhook: boolean$3().optional(),
|
|
49149
|
-
isSystem: boolean$3().optional()
|
|
49150
|
-
});
|
|
49151
|
-
const QueuePrefix = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_(?:workflow|step)_$/, "Must match __wkf_{workflow|step}_ or __{namespace}_wkf_{workflow|step}_");
|
|
49152
|
-
const ValidQueueName = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_(?:workflow|step)_.+$/, "Must be a valid queue name with a recognized prefix");
|
|
49153
|
-
const QueueNamespace = string$3().regex(/^[a-z][a-z0-9]*$/, "Must be lowercase alphanumeric, starting with a letter");
|
|
49154
|
-
function resolveQueueNamespace(namespace2) {
|
|
49155
|
-
return namespace2 ?? process.env.WORKFLOW_QUEUE_NAMESPACE ?? void 0;
|
|
49156
|
-
}
|
|
49157
|
-
function getQueueTopicPrefix(kind, namespace2) {
|
|
49158
|
-
if (namespace2 !== void 0) {
|
|
49159
|
-
QueueNamespace.parse(namespace2);
|
|
49160
|
-
return `__${namespace2}_wkf_${kind}_`;
|
|
49161
|
-
}
|
|
49162
|
-
return `__wkf_${kind}_`;
|
|
49163
|
-
}
|
|
49164
|
-
function parseQueueName(name2) {
|
|
49165
|
-
const match2 = name2.match(/^(__(?:[a-z][a-z0-9]*_)?wkf_(workflow|step)_)(.+)$/);
|
|
49166
|
-
if (!match2) {
|
|
49167
|
-
throw new Error(`Invalid queue name: ${name2}`);
|
|
49168
|
-
}
|
|
49169
|
-
return {
|
|
49170
|
-
prefix: QueuePrefix.parse(match2[1]),
|
|
49171
|
-
kind: match2[2],
|
|
49172
|
-
id: match2[3]
|
|
49173
|
-
};
|
|
49174
|
-
}
|
|
49175
|
-
const MessageId = string$3().brand().describe("A stored queue message ID");
|
|
49176
|
-
const TraceCarrierSchema = record(string$3(), string$3());
|
|
49177
|
-
const RunInputSchema = object$1({
|
|
49178
|
-
input: unknown$1(),
|
|
49179
|
-
deploymentId: string$3(),
|
|
49180
|
-
workflowName: string$3(),
|
|
49181
|
-
specVersion: number$3(),
|
|
49182
|
-
executionContext: record(string$3(), any()).optional(),
|
|
49183
|
-
/** Initial plaintext run attributes, for resilient run creation. */
|
|
49184
|
-
attributes: record(string$3(), string$3()).optional(),
|
|
49185
|
-
/**
|
|
49186
|
-
* Permits reserved `$`-prefixed keys in `attributes`, mirrored from the
|
|
49187
|
-
* `start()` option so resilient run creation validates the same way as
|
|
49188
|
-
* the original `run_created` attempt.
|
|
49189
|
-
*/
|
|
49190
|
-
allowReservedAttributes: literal(true).optional()
|
|
49191
|
-
});
|
|
49192
|
-
const WorkflowInvokePayloadSchema = object$1({
|
|
49193
|
-
runId: string$3(),
|
|
49194
|
-
traceCarrier: TraceCarrierSchema.optional(),
|
|
49195
|
-
requestedAt: date$2().optional(),
|
|
49196
|
-
/** Consecutive replay divergences in this recovery chain and latest position. */
|
|
49197
|
-
replayDivergence: object$1({
|
|
49198
|
-
eventId: string$3(),
|
|
49199
|
-
count: number$3().int().positive()
|
|
49200
|
-
}).optional(),
|
|
49201
|
-
/** Number of times this message has been re-enqueued due to server errors (5xx) */
|
|
49202
|
-
serverErrorRetryCount: number$3().int().optional(),
|
|
49203
|
-
/** Step ID for inline step execution in combined handler. If provided, the flow execution
|
|
49204
|
-
* will jump directly to execute the step with the given ID before doing an event replay. */
|
|
49205
|
-
stepId: string$3().optional(),
|
|
49206
|
-
/** Step name, sent alongside stepId to avoid loading the event log just to resolve the name. */
|
|
49207
|
-
stepName: string$3().optional(),
|
|
49208
|
-
/** Run creation data, only present on the first queue delivery from start() */
|
|
49209
|
-
runInput: RunInputSchema.optional()
|
|
49210
|
-
});
|
|
49211
|
-
const StepInvokePayloadSchema = object$1({
|
|
49212
|
-
workflowName: string$3(),
|
|
49213
|
-
workflowRunId: string$3(),
|
|
49214
|
-
workflowStartedAt: number$3(),
|
|
49215
|
-
stepId: string$3(),
|
|
49216
|
-
traceCarrier: TraceCarrierSchema.optional(),
|
|
49217
|
-
requestedAt: date$2().optional()
|
|
49218
|
-
});
|
|
49219
|
-
const HealthCheckPayloadSchema = object$1({
|
|
49220
|
-
__healthCheck: literal(true),
|
|
49221
|
-
correlationId: string$3()
|
|
49222
|
-
});
|
|
49223
|
-
const QueuePayloadSchema = union([
|
|
49224
|
-
WorkflowInvokePayloadSchema,
|
|
49225
|
-
StepInvokePayloadSchema,
|
|
49226
|
-
HealthCheckPayloadSchema
|
|
49227
|
-
]);
|
|
49228
|
-
async function reenqueueActiveRuns(runs, enqueue, label) {
|
|
49229
|
-
let reenqueued = 0;
|
|
49230
|
-
for (const status of ["pending", "running"]) {
|
|
49231
|
-
let cursor;
|
|
49232
|
-
let hasMore = true;
|
|
49233
|
-
while (hasMore) {
|
|
49234
|
-
const page = await runs.list({
|
|
49235
|
-
status,
|
|
49236
|
-
resolveData: "none",
|
|
49237
|
-
pagination: { cursor }
|
|
49238
|
-
});
|
|
49239
|
-
for (const run2 of page.data) {
|
|
49240
|
-
try {
|
|
49241
|
-
const queueName = `__wkf_workflow_${run2.workflowName}`;
|
|
49242
|
-
await enqueue(queueName, { runId: run2.runId });
|
|
49243
|
-
reenqueued++;
|
|
49244
|
-
} catch (err) {
|
|
49245
|
-
console.warn(`[${label}] Failed to re-enqueue run ${run2.runId}: ${err}`);
|
|
49246
|
-
}
|
|
49247
|
-
}
|
|
49248
|
-
hasMore = page.hasMore;
|
|
49249
|
-
cursor = page.cursor ?? void 0;
|
|
49250
|
-
}
|
|
49251
|
-
}
|
|
49252
|
-
if (reenqueued > 0) {
|
|
49253
|
-
console.log(`[${label}] Re-enqueued ${reenqueued} active run(s) on startup`);
|
|
49254
|
-
}
|
|
49255
|
-
}
|
|
49256
49146
|
const WorkflowRunStatusSchema = _enum([
|
|
49257
49147
|
"pending",
|
|
49258
49148
|
"running",
|
|
@@ -49260,6 +49150,15 @@ const WorkflowRunStatusSchema = _enum([
|
|
|
49260
49150
|
"failed",
|
|
49261
49151
|
"cancelled"
|
|
49262
49152
|
]);
|
|
49153
|
+
const TerminalWorkflowRunStatusSchema = WorkflowRunStatusSchema.extract([
|
|
49154
|
+
"completed",
|
|
49155
|
+
"failed",
|
|
49156
|
+
"cancelled"
|
|
49157
|
+
]);
|
|
49158
|
+
const TERMINAL_WORKFLOW_RUN_STATUSES = TerminalWorkflowRunStatusSchema.options;
|
|
49159
|
+
function isTerminalWorkflowRunStatus(status) {
|
|
49160
|
+
return TERMINAL_WORKFLOW_RUN_STATUSES.includes(status);
|
|
49161
|
+
}
|
|
49263
49162
|
const WorkflowRunBaseSchema = object$1({
|
|
49264
49163
|
runId: string$3(),
|
|
49265
49164
|
status: WorkflowRunStatusSchema,
|
|
@@ -49358,41 +49257,6 @@ const WorkflowRunSchema = discriminatedUnion("status", [
|
|
|
49358
49257
|
completedAt: date$2()
|
|
49359
49258
|
})
|
|
49360
49259
|
]);
|
|
49361
|
-
const zodJsonSchema = lazy(() => {
|
|
49362
|
-
return union([
|
|
49363
|
-
string$3(),
|
|
49364
|
-
number$3(),
|
|
49365
|
-
boolean$3(),
|
|
49366
|
-
_null(),
|
|
49367
|
-
array$1(zodJsonSchema),
|
|
49368
|
-
record(string$3(), zodJsonSchema)
|
|
49369
|
-
]);
|
|
49370
|
-
});
|
|
49371
|
-
const PaginatedResponseSchema = (dataSchema) => object$1({
|
|
49372
|
-
data: array$1(dataSchema),
|
|
49373
|
-
cursor: string$3().nullable(),
|
|
49374
|
-
hasMore: boolean$3()
|
|
49375
|
-
});
|
|
49376
|
-
object$1({
|
|
49377
|
-
message: string$3(),
|
|
49378
|
-
stack: string$3().optional(),
|
|
49379
|
-
code: string$3().optional()
|
|
49380
|
-
// Populated with RunErrorCode values (USER_ERROR, RUNTIME_ERROR, etc.) for run_failed events
|
|
49381
|
-
});
|
|
49382
|
-
const SPEC_VERSION_LEGACY = 1;
|
|
49383
|
-
const SPEC_VERSION_SUPPORTS_EVENT_SOURCING = 2;
|
|
49384
|
-
const SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT = 3;
|
|
49385
|
-
const SPEC_VERSION_SUPPORTS_ATTRIBUTES = 4;
|
|
49386
|
-
const SPEC_VERSION_SUPPORTS_COMPRESSION = 5;
|
|
49387
|
-
const SPEC_VERSION_CURRENT = SPEC_VERSION_SUPPORTS_COMPRESSION;
|
|
49388
|
-
function isLegacySpecVersion(v2) {
|
|
49389
|
-
return v2 === void 0 || v2 === null || v2 <= SPEC_VERSION_LEGACY;
|
|
49390
|
-
}
|
|
49391
|
-
function requiresNewerWorld(v2) {
|
|
49392
|
-
if (v2 === void 0 || v2 === null)
|
|
49393
|
-
return false;
|
|
49394
|
-
return v2 > SPEC_VERSION_CURRENT;
|
|
49395
|
-
}
|
|
49396
49260
|
const StepStatusSchema = _enum([
|
|
49397
49261
|
"pending",
|
|
49398
49262
|
"running",
|
|
@@ -49451,6 +49315,294 @@ const StepSchema = object$1({
|
|
|
49451
49315
|
// Optional in database for backwards compatibility, defaults to 1 (legacy) when reading
|
|
49452
49316
|
specVersion: number$3().optional()
|
|
49453
49317
|
});
|
|
49318
|
+
const TerminalStepStatusSchema = StepStatusSchema.extract([
|
|
49319
|
+
"completed",
|
|
49320
|
+
"failed",
|
|
49321
|
+
"cancelled"
|
|
49322
|
+
]);
|
|
49323
|
+
const TERMINAL_STEP_STATUSES = TerminalStepStatusSchema.options;
|
|
49324
|
+
function isTerminalStepStatus(status) {
|
|
49325
|
+
return TERMINAL_STEP_STATUSES.includes(status);
|
|
49326
|
+
}
|
|
49327
|
+
const WaitStatusSchema = _enum(["waiting", "completed"]);
|
|
49328
|
+
const WaitSchema = object$1({
|
|
49329
|
+
waitId: string$3(),
|
|
49330
|
+
runId: string$3(),
|
|
49331
|
+
status: WaitStatusSchema,
|
|
49332
|
+
resumeAt: date$2().optional(),
|
|
49333
|
+
completedAt: date$2().optional(),
|
|
49334
|
+
createdAt: date$2(),
|
|
49335
|
+
updatedAt: date$2(),
|
|
49336
|
+
specVersion: number$3().optional()
|
|
49337
|
+
});
|
|
49338
|
+
const NullableDateSchema = date$2().nullable().optional();
|
|
49339
|
+
const NullableStringSchema = string$3().nullable().optional();
|
|
49340
|
+
const NullableBooleanSchema = boolean$3().nullable().optional();
|
|
49341
|
+
const AnalyticsRunSchema = object$1({
|
|
49342
|
+
runId: string$3(),
|
|
49343
|
+
status: WorkflowRunStatusSchema,
|
|
49344
|
+
deploymentId: string$3(),
|
|
49345
|
+
workflowName: string$3(),
|
|
49346
|
+
specVersion: number$2().optional(),
|
|
49347
|
+
attributes: record(string$3(), string$3()).default({}),
|
|
49348
|
+
createdAt: date$2(),
|
|
49349
|
+
updatedAt: date$2(),
|
|
49350
|
+
startedAt: NullableDateSchema,
|
|
49351
|
+
completedAt: NullableDateSchema,
|
|
49352
|
+
errorCode: NullableStringSchema,
|
|
49353
|
+
workflowCoreVersion: NullableStringSchema,
|
|
49354
|
+
workflowEncryptionEnabled: NullableBooleanSchema
|
|
49355
|
+
});
|
|
49356
|
+
const AnalyticsStepSchema = object$1({
|
|
49357
|
+
runId: string$3(),
|
|
49358
|
+
stepId: string$3(),
|
|
49359
|
+
stepName: NullableStringSchema,
|
|
49360
|
+
status: StepStatusSchema,
|
|
49361
|
+
attempt: number$3().optional(),
|
|
49362
|
+
createdAt: date$2(),
|
|
49363
|
+
updatedAt: date$2(),
|
|
49364
|
+
startedAt: NullableDateSchema,
|
|
49365
|
+
completedAt: NullableDateSchema,
|
|
49366
|
+
retryAfter: NullableDateSchema,
|
|
49367
|
+
errorCode: NullableStringSchema,
|
|
49368
|
+
workflowCoreVersion: NullableStringSchema,
|
|
49369
|
+
workflowEncryptionEnabled: NullableBooleanSchema
|
|
49370
|
+
});
|
|
49371
|
+
const AnalyticsEventSchema = object$1({
|
|
49372
|
+
runId: string$3(),
|
|
49373
|
+
eventId: string$3(),
|
|
49374
|
+
eventType: EventTypeSchema,
|
|
49375
|
+
correlationId: NullableStringSchema,
|
|
49376
|
+
entityId: NullableStringSchema,
|
|
49377
|
+
stepName: NullableStringSchema,
|
|
49378
|
+
workflowName: string$3(),
|
|
49379
|
+
deploymentId: string$3(),
|
|
49380
|
+
specVersion: number$2().optional(),
|
|
49381
|
+
runCreatedAt: date$2(),
|
|
49382
|
+
createdAt: date$2(),
|
|
49383
|
+
region: NullableStringSchema,
|
|
49384
|
+
vercelId: NullableStringSchema,
|
|
49385
|
+
requestId: NullableStringSchema,
|
|
49386
|
+
resumeAt: NullableDateSchema,
|
|
49387
|
+
retryAfter: NullableDateSchema,
|
|
49388
|
+
errorCode: NullableStringSchema,
|
|
49389
|
+
workflowCoreVersion: NullableStringSchema,
|
|
49390
|
+
isWebhook: NullableBooleanSchema,
|
|
49391
|
+
isSystem: NullableBooleanSchema,
|
|
49392
|
+
workflowEncryptionEnabled: NullableBooleanSchema
|
|
49393
|
+
});
|
|
49394
|
+
const AnalyticsHookSchema = object$1({
|
|
49395
|
+
runId: string$3(),
|
|
49396
|
+
hookId: string$3(),
|
|
49397
|
+
status: _enum(["created", "received", "disposed", "conflict"]),
|
|
49398
|
+
createdAt: date$2(),
|
|
49399
|
+
updatedAt: date$2(),
|
|
49400
|
+
receivedAt: NullableDateSchema,
|
|
49401
|
+
disposedAt: NullableDateSchema,
|
|
49402
|
+
isWebhook: NullableBooleanSchema,
|
|
49403
|
+
isSystem: NullableBooleanSchema,
|
|
49404
|
+
workflowCoreVersion: NullableStringSchema,
|
|
49405
|
+
workflowEncryptionEnabled: NullableBooleanSchema
|
|
49406
|
+
});
|
|
49407
|
+
const AnalyticsWaitSchema = object$1({
|
|
49408
|
+
runId: string$3(),
|
|
49409
|
+
waitId: string$3(),
|
|
49410
|
+
status: WaitStatusSchema,
|
|
49411
|
+
resumeAt: NullableDateSchema,
|
|
49412
|
+
createdAt: date$2(),
|
|
49413
|
+
updatedAt: date$2(),
|
|
49414
|
+
completedAt: NullableDateSchema,
|
|
49415
|
+
workflowCoreVersion: NullableStringSchema,
|
|
49416
|
+
workflowEncryptionEnabled: NullableBooleanSchema
|
|
49417
|
+
});
|
|
49418
|
+
const warnedEnvValues = /* @__PURE__ */ new Set();
|
|
49419
|
+
function warnOnce(key, message2) {
|
|
49420
|
+
if (warnedEnvValues.has(key))
|
|
49421
|
+
return;
|
|
49422
|
+
warnedEnvValues.add(key);
|
|
49423
|
+
console.warn(`[workflow] ${message2}`);
|
|
49424
|
+
}
|
|
49425
|
+
function envNumber(name2, fallback, options = {}) {
|
|
49426
|
+
const raw2 = process.env[name2];
|
|
49427
|
+
if (raw2 === void 0 || raw2 === "")
|
|
49428
|
+
return fallback;
|
|
49429
|
+
const { min: min2 = 0, max: max2, integer: integer2 = false } = options;
|
|
49430
|
+
const parsed = Number(raw2);
|
|
49431
|
+
if (!Number.isFinite(parsed) || integer2 && !Number.isInteger(parsed)) {
|
|
49432
|
+
warnOnce(`${name2}=${raw2}`, `Ignoring ${name2}: not a ${integer2 ? "finite integer" : "finite number"}; using default ${fallback}`);
|
|
49433
|
+
return fallback;
|
|
49434
|
+
}
|
|
49435
|
+
if (parsed < min2) {
|
|
49436
|
+
warnOnce(`${name2}=${raw2}`, `${name2} below minimum ${min2}; clamped`);
|
|
49437
|
+
return min2;
|
|
49438
|
+
}
|
|
49439
|
+
if (max2 !== void 0 && parsed > max2) {
|
|
49440
|
+
warnOnce(`${name2}=${raw2}`, `${name2} above maximum ${max2}; clamped`);
|
|
49441
|
+
return max2;
|
|
49442
|
+
}
|
|
49443
|
+
return parsed;
|
|
49444
|
+
}
|
|
49445
|
+
const HookSchema = object$1({
|
|
49446
|
+
runId: string$3(),
|
|
49447
|
+
hookId: string$3(),
|
|
49448
|
+
token: string$3(),
|
|
49449
|
+
ownerId: string$3(),
|
|
49450
|
+
projectId: string$3(),
|
|
49451
|
+
environment: string$3(),
|
|
49452
|
+
metadata: SerializedDataSchema.optional(),
|
|
49453
|
+
createdAt: date$2(),
|
|
49454
|
+
// Optional in database for backwards compatibility, defaults to 1 (legacy) when reading
|
|
49455
|
+
specVersion: number$3().optional(),
|
|
49456
|
+
isWebhook: boolean$3().optional(),
|
|
49457
|
+
isSystem: boolean$3().optional()
|
|
49458
|
+
});
|
|
49459
|
+
const QueuePrefix = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_(?:workflow|step)_$/, "Must match __wkf_{workflow|step}_ or __{namespace}_wkf_{workflow|step}_");
|
|
49460
|
+
const ValidQueueName = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_(?:workflow|step)_.+$/, "Must be a valid queue name with a recognized prefix");
|
|
49461
|
+
const QueueNamespace = string$3().regex(/^[a-z][a-z0-9]*$/, "Must be lowercase alphanumeric, starting with a letter");
|
|
49462
|
+
function resolveQueueNamespace(namespace2) {
|
|
49463
|
+
return namespace2 ?? process.env.WORKFLOW_QUEUE_NAMESPACE ?? void 0;
|
|
49464
|
+
}
|
|
49465
|
+
function getQueueTopicPrefix(kind, namespace2) {
|
|
49466
|
+
if (namespace2 !== void 0) {
|
|
49467
|
+
QueueNamespace.parse(namespace2);
|
|
49468
|
+
return `__${namespace2}_wkf_${kind}_`;
|
|
49469
|
+
}
|
|
49470
|
+
return `__wkf_${kind}_`;
|
|
49471
|
+
}
|
|
49472
|
+
function parseQueueName(name2) {
|
|
49473
|
+
const match2 = name2.match(/^(__(?:[a-z][a-z0-9]*_)?wkf_(workflow|step)_)(.+)$/);
|
|
49474
|
+
if (!match2) {
|
|
49475
|
+
throw new Error(`Invalid queue name: ${name2}`);
|
|
49476
|
+
}
|
|
49477
|
+
return {
|
|
49478
|
+
prefix: QueuePrefix.parse(match2[1]),
|
|
49479
|
+
kind: match2[2],
|
|
49480
|
+
id: match2[3]
|
|
49481
|
+
};
|
|
49482
|
+
}
|
|
49483
|
+
const MessageId = string$3().brand().describe("A stored queue message ID");
|
|
49484
|
+
const TraceCarrierSchema = record(string$3(), string$3());
|
|
49485
|
+
const RunInputSchema = object$1({
|
|
49486
|
+
input: unknown$1(),
|
|
49487
|
+
deploymentId: string$3(),
|
|
49488
|
+
workflowName: string$3(),
|
|
49489
|
+
specVersion: number$3(),
|
|
49490
|
+
executionContext: record(string$3(), any()).optional(),
|
|
49491
|
+
/** Initial plaintext run attributes, for resilient run creation. */
|
|
49492
|
+
attributes: record(string$3(), string$3()).optional(),
|
|
49493
|
+
/**
|
|
49494
|
+
* Permits reserved `$`-prefixed keys in `attributes`, mirrored from the
|
|
49495
|
+
* `start()` option so resilient run creation validates the same way as
|
|
49496
|
+
* the original `run_created` attempt.
|
|
49497
|
+
*/
|
|
49498
|
+
allowReservedAttributes: literal(true).optional()
|
|
49499
|
+
});
|
|
49500
|
+
const WorkflowInvokePayloadSchema = object$1({
|
|
49501
|
+
runId: string$3(),
|
|
49502
|
+
traceCarrier: TraceCarrierSchema.optional(),
|
|
49503
|
+
requestedAt: date$2().optional(),
|
|
49504
|
+
/** Consecutive replay divergences in this recovery chain and latest position. */
|
|
49505
|
+
replayDivergence: object$1({
|
|
49506
|
+
eventId: string$3(),
|
|
49507
|
+
count: number$3().int().positive()
|
|
49508
|
+
}).optional(),
|
|
49509
|
+
/** Number of times this message has been re-enqueued due to server errors (5xx) */
|
|
49510
|
+
serverErrorRetryCount: number$3().int().optional(),
|
|
49511
|
+
/** Step ID for inline step execution in combined handler. If provided, the flow execution
|
|
49512
|
+
* will jump directly to execute the step with the given ID before doing an event replay. */
|
|
49513
|
+
stepId: string$3().optional(),
|
|
49514
|
+
/** Step name, sent alongside stepId to avoid loading the event log just to resolve the name. */
|
|
49515
|
+
stepName: string$3().optional(),
|
|
49516
|
+
/** Run creation data, only present on the first queue delivery from start() */
|
|
49517
|
+
runInput: RunInputSchema.optional()
|
|
49518
|
+
});
|
|
49519
|
+
const StepInvokePayloadSchema = object$1({
|
|
49520
|
+
workflowName: string$3(),
|
|
49521
|
+
workflowRunId: string$3(),
|
|
49522
|
+
workflowStartedAt: number$3(),
|
|
49523
|
+
stepId: string$3(),
|
|
49524
|
+
traceCarrier: TraceCarrierSchema.optional(),
|
|
49525
|
+
requestedAt: date$2().optional()
|
|
49526
|
+
});
|
|
49527
|
+
const HealthCheckPayloadSchema = object$1({
|
|
49528
|
+
__healthCheck: literal(true),
|
|
49529
|
+
correlationId: string$3()
|
|
49530
|
+
});
|
|
49531
|
+
const QueuePayloadSchema = union([
|
|
49532
|
+
WorkflowInvokePayloadSchema,
|
|
49533
|
+
StepInvokePayloadSchema,
|
|
49534
|
+
HealthCheckPayloadSchema
|
|
49535
|
+
]);
|
|
49536
|
+
async function reenqueueActiveRuns(runs, enqueue, label) {
|
|
49537
|
+
let reenqueued = 0;
|
|
49538
|
+
for (const status of ["pending", "running"]) {
|
|
49539
|
+
let cursor;
|
|
49540
|
+
let hasMore = true;
|
|
49541
|
+
while (hasMore) {
|
|
49542
|
+
const page = await runs.list({
|
|
49543
|
+
status,
|
|
49544
|
+
resolveData: "none",
|
|
49545
|
+
pagination: { cursor }
|
|
49546
|
+
});
|
|
49547
|
+
for (const run2 of page.data) {
|
|
49548
|
+
try {
|
|
49549
|
+
const queueName = `__wkf_workflow_${run2.workflowName}`;
|
|
49550
|
+
await enqueue(queueName, { runId: run2.runId });
|
|
49551
|
+
reenqueued++;
|
|
49552
|
+
} catch (err) {
|
|
49553
|
+
console.warn(`[${label}] Failed to re-enqueue run ${run2.runId}: ${err}`);
|
|
49554
|
+
}
|
|
49555
|
+
}
|
|
49556
|
+
hasMore = page.hasMore;
|
|
49557
|
+
cursor = page.cursor ?? void 0;
|
|
49558
|
+
}
|
|
49559
|
+
}
|
|
49560
|
+
if (reenqueued > 0) {
|
|
49561
|
+
console.log(`[${label}] Re-enqueued ${reenqueued} active run(s) on startup`);
|
|
49562
|
+
}
|
|
49563
|
+
}
|
|
49564
|
+
const zodJsonSchema = lazy(() => {
|
|
49565
|
+
return union([
|
|
49566
|
+
string$3(),
|
|
49567
|
+
number$3(),
|
|
49568
|
+
boolean$3(),
|
|
49569
|
+
_null(),
|
|
49570
|
+
array$1(zodJsonSchema),
|
|
49571
|
+
record(string$3(), zodJsonSchema)
|
|
49572
|
+
]);
|
|
49573
|
+
});
|
|
49574
|
+
const PageInfoSchema = object$1({
|
|
49575
|
+
currentLookbackDays: number$3(),
|
|
49576
|
+
maxLookbackDays: number$3(),
|
|
49577
|
+
currentWindowStart: date$2(),
|
|
49578
|
+
maxWindowStart: date$2(),
|
|
49579
|
+
upgradeAvailable: boolean$3()
|
|
49580
|
+
});
|
|
49581
|
+
const PaginatedResponseSchema = (dataSchema) => object$1({
|
|
49582
|
+
data: array$1(dataSchema),
|
|
49583
|
+
cursor: string$3().nullable(),
|
|
49584
|
+
hasMore: boolean$3(),
|
|
49585
|
+
pageInfo: PageInfoSchema.optional()
|
|
49586
|
+
});
|
|
49587
|
+
object$1({
|
|
49588
|
+
message: string$3(),
|
|
49589
|
+
stack: string$3().optional(),
|
|
49590
|
+
code: string$3().optional()
|
|
49591
|
+
// Populated with RunErrorCode values (USER_ERROR, RUNTIME_ERROR, etc.) for run_failed events
|
|
49592
|
+
});
|
|
49593
|
+
const SPEC_VERSION_LEGACY = 1;
|
|
49594
|
+
const SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT = 3;
|
|
49595
|
+
const SPEC_VERSION_SUPPORTS_ATTRIBUTES = 4;
|
|
49596
|
+
const SPEC_VERSION_SUPPORTS_COMPRESSION = 5;
|
|
49597
|
+
const SPEC_VERSION_CURRENT = SPEC_VERSION_SUPPORTS_COMPRESSION;
|
|
49598
|
+
function isLegacySpecVersion(v2) {
|
|
49599
|
+
return v2 === void 0 || v2 === null || v2 <= SPEC_VERSION_LEGACY;
|
|
49600
|
+
}
|
|
49601
|
+
function requiresNewerWorld(v2) {
|
|
49602
|
+
if (v2 === void 0 || v2 === null)
|
|
49603
|
+
return false;
|
|
49604
|
+
return v2 > SPEC_VERSION_CURRENT;
|
|
49605
|
+
}
|
|
49454
49606
|
const ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
49455
49607
|
const ENCODING_LEN = 32;
|
|
49456
49608
|
const RANDOM_LEN = 16;
|
|
@@ -49626,17 +49778,18 @@ function validateUlidTimestamp(prefixedUlid, prefix, pastThresholdMs = DEFAULT_T
|
|
|
49626
49778
|
const thresholdSeconds = Math.round(thresholdMs / 1e3);
|
|
49627
49779
|
return `Invalid runId timestamp: embedded timestamp is ${driftSeconds}s in the ${direction} (threshold: ${thresholdSeconds}s)`;
|
|
49628
49780
|
}
|
|
49629
|
-
const
|
|
49630
|
-
|
|
49631
|
-
|
|
49632
|
-
|
|
49633
|
-
|
|
49634
|
-
|
|
49635
|
-
|
|
49636
|
-
|
|
49637
|
-
|
|
49638
|
-
|
|
49639
|
-
|
|
49781
|
+
const V4_EXTRA_EVENT_DATA_REF_FIELDS$1 = {
|
|
49782
|
+
run_started: ["input"],
|
|
49783
|
+
step_started: ["input"]
|
|
49784
|
+
};
|
|
49785
|
+
function getEventDataRefFields(eventType) {
|
|
49786
|
+
return [
|
|
49787
|
+
.../* @__PURE__ */ new Set([
|
|
49788
|
+
...EVENT_DATA_REF_FIELDS[eventType] ?? [],
|
|
49789
|
+
...V4_EXTRA_EVENT_DATA_REF_FIELDS$1[eventType] ?? []
|
|
49790
|
+
])
|
|
49791
|
+
];
|
|
49792
|
+
}
|
|
49640
49793
|
function base64ToArrayBuffer(base642) {
|
|
49641
49794
|
if (base642 === "" || base642 === ".") {
|
|
49642
49795
|
return new ArrayBuffer(0);
|
|
@@ -49898,7 +50051,7 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
|
|
|
49898
50051
|
}
|
|
49899
50052
|
if (result.eventData && typeof result.eventData === "object") {
|
|
49900
50053
|
const eventType = typeof result.eventType === "string" ? result.eventType : "";
|
|
49901
|
-
const refKeys =
|
|
50054
|
+
const refKeys = getEventDataRefFields(eventType);
|
|
49902
50055
|
const ed = { ...result.eventData };
|
|
49903
50056
|
for (const key of refKeys) {
|
|
49904
50057
|
if (key in ed) {
|
|
@@ -49909,20 +50062,19 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
|
|
|
49909
50062
|
}
|
|
49910
50063
|
return result;
|
|
49911
50064
|
}
|
|
49912
|
-
async function
|
|
50065
|
+
async function hydrateResourceIOAsync(resource, key) {
|
|
49913
50066
|
const { hydrateDataWithKey: hydrateDataWithKey2 } = await Promise.resolve().then(() => serializationFormat);
|
|
49914
|
-
const {
|
|
49915
|
-
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-pCjqxVHM.js");
|
|
50067
|
+
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-DgO7NCG6.js");
|
|
49916
50068
|
ensureZstdDecoderRegistered();
|
|
49917
|
-
const cryptoKey = await importKey2(key);
|
|
50069
|
+
const cryptoKey = key ? await Promise.resolve().then(() => encryption).then(({ importKey: importKey2 }) => importKey2(key)) : void 0;
|
|
49918
50070
|
const revivers = getRevivers();
|
|
49919
|
-
async function
|
|
50071
|
+
async function hydrateField(value) {
|
|
49920
50072
|
if (isEncryptedMarker$1(value)) {
|
|
49921
50073
|
const raw2 = value.__encryptedData;
|
|
49922
|
-
return hydrateDataWithKey2(raw2,
|
|
50074
|
+
return cryptoKey ? hydrateDataWithKey2(raw2, revivers, cryptoKey) : value;
|
|
49923
50075
|
}
|
|
49924
50076
|
if (value instanceof Uint8Array) {
|
|
49925
|
-
return hydrateDataWithKey2(value,
|
|
50077
|
+
return hydrateDataWithKey2(value, revivers, cryptoKey);
|
|
49926
50078
|
}
|
|
49927
50079
|
return value;
|
|
49928
50080
|
}
|
|
@@ -49930,21 +50082,21 @@ async function hydrateResourceIOWithKey(resource, key) {
|
|
|
49930
50082
|
const result = { ...r2 };
|
|
49931
50083
|
for (const field of ["input", "output", "metadata", "error"]) {
|
|
49932
50084
|
if (field in result) {
|
|
49933
|
-
result[field] = await
|
|
50085
|
+
result[field] = await hydrateField(result[field]);
|
|
49934
50086
|
}
|
|
49935
50087
|
}
|
|
49936
50088
|
if (result.eventData && typeof result.eventData === "object") {
|
|
49937
50089
|
const eventType = typeof result.eventType === "string" ? result.eventType : "";
|
|
49938
|
-
const refKeys =
|
|
50090
|
+
const refKeys = getEventDataRefFields(eventType);
|
|
49939
50091
|
const eventData = { ...result.eventData };
|
|
49940
50092
|
for (const field of refKeys) {
|
|
49941
50093
|
if (field in eventData) {
|
|
49942
|
-
eventData[field] = await
|
|
50094
|
+
eventData[field] = await hydrateField(eventData[field]);
|
|
49943
50095
|
}
|
|
49944
50096
|
}
|
|
49945
50097
|
result.eventData = eventData;
|
|
49946
50098
|
}
|
|
49947
|
-
return result;
|
|
50099
|
+
return replaceEncryptedAndExpiredWithMarkers(result);
|
|
49948
50100
|
}
|
|
49949
50101
|
function hasEncryptedFields(resource) {
|
|
49950
50102
|
if (!resource || typeof resource !== "object")
|
|
@@ -49956,7 +50108,7 @@ function hasEncryptedFields(resource) {
|
|
|
49956
50108
|
}
|
|
49957
50109
|
if (r2.eventData && typeof r2.eventData === "object") {
|
|
49958
50110
|
const eventType = typeof r2.eventType === "string" ? r2.eventType : "";
|
|
49959
|
-
const refKeys =
|
|
50111
|
+
const refKeys = getEventDataRefFields(eventType);
|
|
49960
50112
|
const ed = r2.eventData;
|
|
49961
50113
|
for (const key of refKeys) {
|
|
49962
50114
|
if (key in ed && isEncryptedMarker$1(ed[key]))
|
|
@@ -51148,27 +51300,6 @@ function extractConversation(stepInput) {
|
|
|
51148
51300
|
}
|
|
51149
51301
|
return firstArg;
|
|
51150
51302
|
}
|
|
51151
|
-
function CopyButton({ copyText, ariaLabel, className }) {
|
|
51152
|
-
const [copied, setCopied] = reactExports.useState(false);
|
|
51153
|
-
const timeoutRef = reactExports.useRef(null);
|
|
51154
|
-
reactExports.useEffect(() => {
|
|
51155
|
-
return () => {
|
|
51156
|
-
if (timeoutRef.current) {
|
|
51157
|
-
clearTimeout(timeoutRef.current);
|
|
51158
|
-
}
|
|
51159
|
-
};
|
|
51160
|
-
}, []);
|
|
51161
|
-
return jsxRuntimeExports.jsx("button", { type: "button", "aria-label": ariaLabel, className: cn$4("cursor-pointer text-gray-800 hover:text-gray-1000 bg-transparent border-0 p-1 m-0", className), onClick: (e) => {
|
|
51162
|
-
e.stopPropagation();
|
|
51163
|
-
if (timeoutRef.current) {
|
|
51164
|
-
clearTimeout(timeoutRef.current);
|
|
51165
|
-
}
|
|
51166
|
-
void navigator.clipboard.writeText(copyText).then(() => {
|
|
51167
|
-
setCopied(true);
|
|
51168
|
-
timeoutRef.current = setTimeout(() => setCopied(false), 1e3);
|
|
51169
|
-
});
|
|
51170
|
-
}, children: jsxRuntimeExports.jsxs("div", { className: "relative w-3 h-3", children: [jsxRuntimeExports.jsx("div", { className: cn$4("absolute inset-0 flex items-center justify-center transition-all duration-150 ease-out", copied ? "scale-100 opacity-100" : "scale-0 opacity-0"), children: jsxRuntimeExports.jsx(Check, { className: "w-3 h-3" }) }), jsxRuntimeExports.jsx("div", { className: cn$4("absolute inset-0 flex items-center justify-center transition-all duration-150 ease-out", copied ? "scale-0 opacity-0" : "scale-100 opacity-100"), children: jsxRuntimeExports.jsx(Copy, { className: "w-3 h-3" }) })] }) });
|
|
51171
|
-
}
|
|
51172
51303
|
const falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
51173
51304
|
const cx = clsx;
|
|
51174
51305
|
const cva = (base, config2) => (props) => {
|
|
@@ -51209,6 +51340,348 @@ const cva = (base, config2) => (props) => {
|
|
|
51209
51340
|
}, []);
|
|
51210
51341
|
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
51211
51342
|
};
|
|
51343
|
+
function CopyButton({ copyText, ariaLabel, className }) {
|
|
51344
|
+
const [copied, setCopied] = reactExports.useState(false);
|
|
51345
|
+
const timeoutRef = reactExports.useRef(null);
|
|
51346
|
+
reactExports.useEffect(() => {
|
|
51347
|
+
return () => {
|
|
51348
|
+
if (timeoutRef.current) {
|
|
51349
|
+
clearTimeout(timeoutRef.current);
|
|
51350
|
+
}
|
|
51351
|
+
};
|
|
51352
|
+
}, []);
|
|
51353
|
+
return jsxRuntimeExports.jsx("button", { type: "button", "aria-label": ariaLabel, className: cn$4("cursor-pointer text-gray-800 hover:text-gray-1000 bg-transparent border-0 p-1 m-0", className), onClick: (e) => {
|
|
51354
|
+
e.stopPropagation();
|
|
51355
|
+
if (timeoutRef.current) {
|
|
51356
|
+
clearTimeout(timeoutRef.current);
|
|
51357
|
+
}
|
|
51358
|
+
void navigator.clipboard.writeText(copyText).then(() => {
|
|
51359
|
+
setCopied(true);
|
|
51360
|
+
timeoutRef.current = setTimeout(() => setCopied(false), 1e3);
|
|
51361
|
+
});
|
|
51362
|
+
}, children: jsxRuntimeExports.jsxs("div", { className: "relative w-3 h-3", children: [jsxRuntimeExports.jsx("div", { className: cn$4("absolute inset-0 flex items-center justify-center transition-all duration-150 ease-out", copied ? "scale-100 opacity-100" : "scale-0 opacity-0"), children: jsxRuntimeExports.jsx(Check, { className: "w-3 h-3" }) }), jsxRuntimeExports.jsx("div", { className: cn$4("absolute inset-0 flex items-center justify-center transition-all duration-150 ease-out", copied ? "scale-0 opacity-0" : "scale-100 opacity-100"), children: jsxRuntimeExports.jsx(Copy, { className: "w-3 h-3" }) })] }) });
|
|
51363
|
+
}
|
|
51364
|
+
const ELLIPSIS = "…";
|
|
51365
|
+
const MIN_START = 3;
|
|
51366
|
+
const MIN_END = 3;
|
|
51367
|
+
const MIN_KEPT = MIN_START + MIN_END;
|
|
51368
|
+
const graphemeSegmenter = typeof Intl !== "undefined" && "Segmenter" in Intl ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
|
|
51369
|
+
function toGraphemes(text2) {
|
|
51370
|
+
if (graphemeSegmenter) {
|
|
51371
|
+
return [...graphemeSegmenter.segment(text2)].map((s2) => s2.segment);
|
|
51372
|
+
}
|
|
51373
|
+
return Array.from(text2);
|
|
51374
|
+
}
|
|
51375
|
+
function buildCandidate(graphemes, kept) {
|
|
51376
|
+
if (kept <= 0) {
|
|
51377
|
+
return {
|
|
51378
|
+
prefixText: "",
|
|
51379
|
+
prefixGraphemeCount: 0,
|
|
51380
|
+
suffixText: "",
|
|
51381
|
+
suffixGraphemeCount: 0,
|
|
51382
|
+
text: ELLIPSIS,
|
|
51383
|
+
truncated: true
|
|
51384
|
+
};
|
|
51385
|
+
}
|
|
51386
|
+
const suffixGraphemeCount = kept >= MIN_KEPT ? Math.max(MIN_END, Math.floor(kept / 2)) : Math.floor(kept / 2);
|
|
51387
|
+
const prefixGraphemeCount = kept - suffixGraphemeCount;
|
|
51388
|
+
const prefixText = graphemes.slice(0, prefixGraphemeCount).join("");
|
|
51389
|
+
const suffixText = suffixGraphemeCount > 0 ? graphemes.slice(-suffixGraphemeCount).join("") : "";
|
|
51390
|
+
return {
|
|
51391
|
+
prefixText,
|
|
51392
|
+
prefixGraphemeCount,
|
|
51393
|
+
suffixText,
|
|
51394
|
+
suffixGraphemeCount,
|
|
51395
|
+
text: prefixText + ELLIPSIS + suffixText,
|
|
51396
|
+
truncated: true
|
|
51397
|
+
};
|
|
51398
|
+
}
|
|
51399
|
+
function middleTruncate(graphemes, availableWidth, measure, fullWidth) {
|
|
51400
|
+
const fullText = graphemes.join("");
|
|
51401
|
+
const resolvedFullWidth = fullWidth ?? measure(fullText);
|
|
51402
|
+
if (availableWidth <= 0 || graphemes.length === 0) {
|
|
51403
|
+
return {
|
|
51404
|
+
prefixText: fullText,
|
|
51405
|
+
prefixGraphemeCount: graphemes.length,
|
|
51406
|
+
suffixText: "",
|
|
51407
|
+
suffixGraphemeCount: 0,
|
|
51408
|
+
text: fullText,
|
|
51409
|
+
truncated: false
|
|
51410
|
+
};
|
|
51411
|
+
}
|
|
51412
|
+
if (resolvedFullWidth <= availableWidth) {
|
|
51413
|
+
return {
|
|
51414
|
+
prefixText: fullText,
|
|
51415
|
+
prefixGraphemeCount: graphemes.length,
|
|
51416
|
+
suffixText: "",
|
|
51417
|
+
suffixGraphemeCount: 0,
|
|
51418
|
+
text: fullText,
|
|
51419
|
+
truncated: false
|
|
51420
|
+
};
|
|
51421
|
+
}
|
|
51422
|
+
let lo2 = 0;
|
|
51423
|
+
let hi = graphemes.length - 1;
|
|
51424
|
+
let best = -1;
|
|
51425
|
+
while (lo2 <= hi) {
|
|
51426
|
+
const mid = lo2 + hi >>> 1;
|
|
51427
|
+
const candidate = buildCandidate(graphemes, mid);
|
|
51428
|
+
if (measure(candidate.text) <= availableWidth) {
|
|
51429
|
+
best = mid;
|
|
51430
|
+
lo2 = mid + 1;
|
|
51431
|
+
} else {
|
|
51432
|
+
hi = mid - 1;
|
|
51433
|
+
}
|
|
51434
|
+
}
|
|
51435
|
+
if (best === -1) {
|
|
51436
|
+
return {
|
|
51437
|
+
prefixText: "",
|
|
51438
|
+
prefixGraphemeCount: 0,
|
|
51439
|
+
suffixText: "",
|
|
51440
|
+
suffixGraphemeCount: 0,
|
|
51441
|
+
text: "",
|
|
51442
|
+
truncated: true
|
|
51443
|
+
};
|
|
51444
|
+
}
|
|
51445
|
+
return buildCandidate(graphemes, best);
|
|
51446
|
+
}
|
|
51447
|
+
function getMiddleTruncateCopyText({ prefixText, selectionEnd, selectionStart, suffixText, value }) {
|
|
51448
|
+
const visibleText = prefixText + ELLIPSIS + suffixText;
|
|
51449
|
+
if (selectionStart < 0 || selectionEnd > visibleText.length || selectionStart >= selectionEnd) {
|
|
51450
|
+
return null;
|
|
51451
|
+
}
|
|
51452
|
+
if (selectionStart === 0 && selectionEnd === visibleText.length) {
|
|
51453
|
+
return value;
|
|
51454
|
+
}
|
|
51455
|
+
const ellipsisStart = prefixText.length;
|
|
51456
|
+
const ellipsisEnd = ellipsisStart + ELLIPSIS.length;
|
|
51457
|
+
if (selectionStart > ellipsisStart || selectionEnd < ellipsisEnd) {
|
|
51458
|
+
return null;
|
|
51459
|
+
}
|
|
51460
|
+
const originalGraphemes = toGraphemes(value);
|
|
51461
|
+
const selectedPrefixGraphemeCount = toGraphemes(visibleText.slice(0, selectionStart)).length;
|
|
51462
|
+
const selectedSuffixGraphemeCount = toGraphemes(visibleText.slice(ellipsisEnd, selectionEnd)).length;
|
|
51463
|
+
const suffixStart = originalGraphemes.length - toGraphemes(suffixText).length;
|
|
51464
|
+
return originalGraphemes.slice(selectedPrefixGraphemeCount, suffixStart + selectedSuffixGraphemeCount).join("");
|
|
51465
|
+
}
|
|
51466
|
+
function getMiddleTruncateCopyTextFromSelectionText({ prefixText, selectionText, suffixText, value }) {
|
|
51467
|
+
const visibleText = prefixText + ELLIPSIS + suffixText;
|
|
51468
|
+
const trimmedSelectionText = selectionText.trim();
|
|
51469
|
+
if (!trimmedSelectionText) {
|
|
51470
|
+
return null;
|
|
51471
|
+
}
|
|
51472
|
+
const leading = selectionText.slice(0, selectionText.length - selectionText.trimStart().length);
|
|
51473
|
+
const trailing = selectionText.slice(selectionText.trimEnd().length);
|
|
51474
|
+
if (trimmedSelectionText === visibleText) {
|
|
51475
|
+
return leading + value + trailing;
|
|
51476
|
+
}
|
|
51477
|
+
if (!trimmedSelectionText.includes(ELLIPSIS)) {
|
|
51478
|
+
return null;
|
|
51479
|
+
}
|
|
51480
|
+
const selectionStart = visibleText.indexOf(trimmedSelectionText);
|
|
51481
|
+
if (selectionStart === -1) {
|
|
51482
|
+
return null;
|
|
51483
|
+
}
|
|
51484
|
+
const selectionEnd = selectionStart + trimmedSelectionText.length;
|
|
51485
|
+
const mappedText = getMiddleTruncateCopyText({
|
|
51486
|
+
prefixText,
|
|
51487
|
+
selectionEnd,
|
|
51488
|
+
selectionStart,
|
|
51489
|
+
suffixText,
|
|
51490
|
+
value
|
|
51491
|
+
});
|
|
51492
|
+
return mappedText === null ? null : leading + mappedText + trailing;
|
|
51493
|
+
}
|
|
51494
|
+
const useIsomorphicLayoutEffect$2 = typeof window === "undefined" ? reactExports.useEffect : reactExports.useLayoutEffect;
|
|
51495
|
+
function createFullState(value, graphemes) {
|
|
51496
|
+
return {
|
|
51497
|
+
displayText: value,
|
|
51498
|
+
isTruncated: false,
|
|
51499
|
+
prefixGraphemeCount: graphemes.length,
|
|
51500
|
+
prefixText: value,
|
|
51501
|
+
suffixGraphemeCount: 0,
|
|
51502
|
+
suffixText: ""
|
|
51503
|
+
};
|
|
51504
|
+
}
|
|
51505
|
+
function useMiddleTruncate(value) {
|
|
51506
|
+
const graphemes = reactExports.useMemo(() => toGraphemes(value), [value]);
|
|
51507
|
+
const fullState = reactExports.useMemo(() => createFullState(value, graphemes), [graphemes, value]);
|
|
51508
|
+
const ref = reactExports.useRef(null);
|
|
51509
|
+
const measureRef = reactExports.useRef(null);
|
|
51510
|
+
const [state, setState] = reactExports.useState(() => fullState);
|
|
51511
|
+
const rafRef = reactExports.useRef(0);
|
|
51512
|
+
const updateState = reactExports.useCallback((nextState) => {
|
|
51513
|
+
setState((currentState) => {
|
|
51514
|
+
if (currentState.displayText === nextState.displayText && currentState.isTruncated === nextState.isTruncated && currentState.prefixText === nextState.prefixText && currentState.prefixGraphemeCount === nextState.prefixGraphemeCount && currentState.suffixText === nextState.suffixText && currentState.suffixGraphemeCount === nextState.suffixGraphemeCount) {
|
|
51515
|
+
return currentState;
|
|
51516
|
+
}
|
|
51517
|
+
return nextState;
|
|
51518
|
+
});
|
|
51519
|
+
}, []);
|
|
51520
|
+
const recalculate = reactExports.useCallback(() => {
|
|
51521
|
+
const el = ref.current;
|
|
51522
|
+
const measureEl = measureRef.current;
|
|
51523
|
+
if (!el || !measureEl)
|
|
51524
|
+
return;
|
|
51525
|
+
const available = el.clientWidth;
|
|
51526
|
+
if (available <= 0) {
|
|
51527
|
+
updateState(fullState);
|
|
51528
|
+
return;
|
|
51529
|
+
}
|
|
51530
|
+
const measure = (text2) => {
|
|
51531
|
+
measureEl.textContent = text2;
|
|
51532
|
+
return measureEl.scrollWidth;
|
|
51533
|
+
};
|
|
51534
|
+
const fullWidth = measure(value);
|
|
51535
|
+
if (fullWidth <= available) {
|
|
51536
|
+
updateState(fullState);
|
|
51537
|
+
return;
|
|
51538
|
+
}
|
|
51539
|
+
const result = middleTruncate(graphemes, available, measure, fullWidth);
|
|
51540
|
+
updateState({
|
|
51541
|
+
displayText: result.text,
|
|
51542
|
+
isTruncated: result.truncated,
|
|
51543
|
+
prefixGraphemeCount: result.prefixGraphemeCount,
|
|
51544
|
+
prefixText: result.prefixText,
|
|
51545
|
+
suffixGraphemeCount: result.suffixGraphemeCount,
|
|
51546
|
+
suffixText: result.suffixText
|
|
51547
|
+
});
|
|
51548
|
+
}, [fullState, graphemes, updateState, value]);
|
|
51549
|
+
useIsomorphicLayoutEffect$2(() => {
|
|
51550
|
+
recalculate();
|
|
51551
|
+
}, [recalculate]);
|
|
51552
|
+
reactExports.useEffect(() => {
|
|
51553
|
+
var _a3;
|
|
51554
|
+
const el = ref.current;
|
|
51555
|
+
if (!el)
|
|
51556
|
+
return;
|
|
51557
|
+
const debouncedRecalc = () => {
|
|
51558
|
+
cancelAnimationFrame(rafRef.current);
|
|
51559
|
+
rafRef.current = requestAnimationFrame(recalculate);
|
|
51560
|
+
};
|
|
51561
|
+
const ro2 = typeof ResizeObserver !== "undefined" ? new ResizeObserver(debouncedRecalc) : null;
|
|
51562
|
+
ro2 == null ? void 0 : ro2.observe(el);
|
|
51563
|
+
window.addEventListener("resize", debouncedRecalc);
|
|
51564
|
+
const onFontsLoaded = () => {
|
|
51565
|
+
debouncedRecalc();
|
|
51566
|
+
};
|
|
51567
|
+
const fontSet = "fonts" in document ? document.fonts : null;
|
|
51568
|
+
(_a3 = fontSet == null ? void 0 : fontSet.addEventListener) == null ? void 0 : _a3.call(fontSet, "loadingdone", onFontsLoaded);
|
|
51569
|
+
return () => {
|
|
51570
|
+
var _a4;
|
|
51571
|
+
ro2 == null ? void 0 : ro2.disconnect();
|
|
51572
|
+
window.removeEventListener("resize", debouncedRecalc);
|
|
51573
|
+
cancelAnimationFrame(rafRef.current);
|
|
51574
|
+
(_a4 = fontSet == null ? void 0 : fontSet.removeEventListener) == null ? void 0 : _a4.call(fontSet, "loadingdone", onFontsLoaded);
|
|
51575
|
+
};
|
|
51576
|
+
}, [recalculate]);
|
|
51577
|
+
return {
|
|
51578
|
+
ref,
|
|
51579
|
+
measureRef,
|
|
51580
|
+
displayText: state.displayText,
|
|
51581
|
+
isTruncated: state.isTruncated,
|
|
51582
|
+
prefixGraphemeCount: state.prefixGraphemeCount,
|
|
51583
|
+
prefixText: state.prefixText,
|
|
51584
|
+
suffixGraphemeCount: state.suffixGraphemeCount,
|
|
51585
|
+
suffixText: state.suffixText
|
|
51586
|
+
};
|
|
51587
|
+
}
|
|
51588
|
+
function getRangeOffsets(container, range2) {
|
|
51589
|
+
if (!container.contains(range2.startContainer) || !container.contains(range2.endContainer)) {
|
|
51590
|
+
return null;
|
|
51591
|
+
}
|
|
51592
|
+
const startRange = document.createRange();
|
|
51593
|
+
startRange.selectNodeContents(container);
|
|
51594
|
+
startRange.setEnd(range2.startContainer, range2.startOffset);
|
|
51595
|
+
const endRange = document.createRange();
|
|
51596
|
+
endRange.selectNodeContents(container);
|
|
51597
|
+
endRange.setEnd(range2.endContainer, range2.endOffset);
|
|
51598
|
+
return {
|
|
51599
|
+
end: endRange.toString().length,
|
|
51600
|
+
start: startRange.toString().length
|
|
51601
|
+
};
|
|
51602
|
+
}
|
|
51603
|
+
function MiddleTruncate({ value, className, onCopy: onCopyProp, ...props }) {
|
|
51604
|
+
const { ref, measureRef, displayText, isTruncated, prefixText, suffixText } = useMiddleTruncate(value);
|
|
51605
|
+
const visibleRef = reactExports.useRef(null);
|
|
51606
|
+
const handleCopy = reactExports.useCallback((e) => {
|
|
51607
|
+
onCopyProp == null ? void 0 : onCopyProp(e);
|
|
51608
|
+
if (e.defaultPrevented || !isTruncated)
|
|
51609
|
+
return;
|
|
51610
|
+
const selection2 = window.getSelection();
|
|
51611
|
+
if (!selection2 || selection2.rangeCount === 0)
|
|
51612
|
+
return;
|
|
51613
|
+
const selectionText = selection2.toString();
|
|
51614
|
+
if (!selectionText)
|
|
51615
|
+
return;
|
|
51616
|
+
const range2 = selection2.getRangeAt(0);
|
|
51617
|
+
const visibleEl = visibleRef.current;
|
|
51618
|
+
let copyText = null;
|
|
51619
|
+
if (e.currentTarget.contains(range2.startContainer) && e.currentTarget.contains(range2.endContainer) && visibleEl) {
|
|
51620
|
+
const offsets = getRangeOffsets(visibleEl, range2);
|
|
51621
|
+
if (offsets) {
|
|
51622
|
+
copyText = getMiddleTruncateCopyText({
|
|
51623
|
+
prefixText,
|
|
51624
|
+
selectionEnd: offsets.end,
|
|
51625
|
+
selectionStart: offsets.start,
|
|
51626
|
+
suffixText,
|
|
51627
|
+
value
|
|
51628
|
+
});
|
|
51629
|
+
}
|
|
51630
|
+
}
|
|
51631
|
+
copyText ?? (copyText = getMiddleTruncateCopyTextFromSelectionText({
|
|
51632
|
+
prefixText,
|
|
51633
|
+
selectionText,
|
|
51634
|
+
suffixText,
|
|
51635
|
+
value
|
|
51636
|
+
}));
|
|
51637
|
+
if (copyText === null)
|
|
51638
|
+
return;
|
|
51639
|
+
e.preventDefault();
|
|
51640
|
+
e.clipboardData.setData("text/plain", copyText);
|
|
51641
|
+
}, [onCopyProp, isTruncated, prefixText, suffixText, value]);
|
|
51642
|
+
return jsxRuntimeExports.jsxs("span", { title: isTruncated ? value : void 0, ...props, ref, className: cn$4("relative inline-grid min-w-0 max-w-full overflow-hidden whitespace-nowrap", className), onCopy: handleCopy, children: [isTruncated && jsxRuntimeExports.jsx("span", { className: "sr-only select-none", children: value }), jsxRuntimeExports.jsx("span", { "aria-hidden": "true", className: "pointer-events-none col-start-1 row-start-1 invisible select-none whitespace-nowrap", children: value }), jsxRuntimeExports.jsx("span", { "aria-hidden": isTruncated || void 0, className: "col-start-1 row-start-1 min-w-0 overflow-hidden", ref: visibleRef, children: isTruncated ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("span", { children: prefixText }), jsxRuntimeExports.jsx("span", { children: ELLIPSIS }), jsxRuntimeExports.jsx("span", { children: suffixText })] }) : displayText }), jsxRuntimeExports.jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute left-0 top-0 inline-block invisible select-none whitespace-nowrap", ref: measureRef })] });
|
|
51643
|
+
}
|
|
51644
|
+
const CollapsibleContext = reactExports.createContext(null);
|
|
51645
|
+
function useCollapsibleContext(part) {
|
|
51646
|
+
const context = reactExports.useContext(CollapsibleContext);
|
|
51647
|
+
if (!context) {
|
|
51648
|
+
throw new Error(`<Collapsible${part}> must be rendered inside <CollapsibleRoot>`);
|
|
51649
|
+
}
|
|
51650
|
+
return context;
|
|
51651
|
+
}
|
|
51652
|
+
function CollapsibleRoot({ children: children2, variant = "section", disabled = false, defaultOpen = false, onOpenChange, className }) {
|
|
51653
|
+
const [open, setOpen] = reactExports.useState(defaultOpen);
|
|
51654
|
+
const handleToggle = (event) => {
|
|
51655
|
+
if (event.target !== event.currentTarget)
|
|
51656
|
+
return;
|
|
51657
|
+
const next2 = event.currentTarget.open;
|
|
51658
|
+
setOpen(next2);
|
|
51659
|
+
onOpenChange == null ? void 0 : onOpenChange(next2);
|
|
51660
|
+
};
|
|
51661
|
+
const details = jsxRuntimeExports.jsx("details", { "data-slot": "collapsible", "data-state": open ? "open" : "closed", open, onToggle: disabled ? void 0 : handleToggle, className: cn$4(variant === "card" ? "group/card border-gray-alpha-400 last:border-b" : "group", className), children: jsxRuntimeExports.jsx(CollapsibleContext.Provider, { value: { variant, disabled }, children: children2 }) });
|
|
51662
|
+
if (variant === "card") {
|
|
51663
|
+
return details;
|
|
51664
|
+
}
|
|
51665
|
+
return jsxRuntimeExports.jsx("section", { className: "-mx-4 border-t border-gray-alpha-400 px-4 py-2", children: details });
|
|
51666
|
+
}
|
|
51667
|
+
function CollapsibleTrigger({ children: children2, className }) {
|
|
51668
|
+
const { variant, disabled } = useCollapsibleContext("Trigger");
|
|
51669
|
+
if (variant === "card") {
|
|
51670
|
+
return jsxRuntimeExports.jsxs("summary", { "data-slot": "collapsible-trigger", className: cn$4("flex cursor-pointer list-none items-center gap-1.5 border-t border-gray-alpha-400 bg-background-200 px-3 py-4 hover:bg-gray-100 [&::-webkit-details-marker]:hidden", className), children: [jsxRuntimeExports.jsx(ChevronRight, { size: 14, className: "shrink-0 text-gray-700 group-hover/card:text-gray-1000 group-open/card:rotate-90" }), children2] });
|
|
51671
|
+
}
|
|
51672
|
+
const row = "flex h-9 items-center gap-2 -mx-2 px-2 text-heading-14 font-medium list-none [&::-webkit-details-marker]:hidden";
|
|
51673
|
+
if (disabled) {
|
|
51674
|
+
return jsxRuntimeExports.jsx("summary", { "data-slot": "collapsible-trigger", className: cn$4(row, "pointer-events-none text-gray-700", className), children: jsxRuntimeExports.jsx("span", { className: "min-w-0 flex-1", children: children2 }) });
|
|
51675
|
+
}
|
|
51676
|
+
return jsxRuntimeExports.jsxs("summary", { "data-slot": "collapsible-trigger", className: cn$4(row, "group/trigger cursor-pointer rounded hover:bg-gray-alpha-100", className), children: [jsxRuntimeExports.jsxs("span", { className: "relative isolate h-3.5 w-3.5 shrink-0 text-gray-700 group-hover/trigger:text-gray-1000", children: [jsxRuntimeExports.jsx(ChevronRight, { size: 14, className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 opacity-100 group-open:opacity-0" }), jsxRuntimeExports.jsx(ChevronDown, { size: 14, className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 opacity-0 group-open:opacity-100" })] }), jsxRuntimeExports.jsx("span", { className: "min-w-0 flex-1", children: children2 })] });
|
|
51677
|
+
}
|
|
51678
|
+
function CollapsibleContent({ children: children2, className }) {
|
|
51679
|
+
const { variant } = useCollapsibleContext("Content");
|
|
51680
|
+
return jsxRuntimeExports.jsx("div", { "data-slot": "collapsible-content", className: cn$4(variant === "section" && "mt-2 mb-3", className), children: children2 });
|
|
51681
|
+
}
|
|
51682
|
+
function Collapsible({ label, children: children2, disabled, defaultOpen, onOpenChange }) {
|
|
51683
|
+
return jsxRuntimeExports.jsxs(CollapsibleRoot, { disabled, defaultOpen, onOpenChange, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { children: label }), children2 != null && jsxRuntimeExports.jsx(CollapsibleContent, { children: children2 })] });
|
|
51684
|
+
}
|
|
51212
51685
|
const buttonVariants$1 = cva([
|
|
51213
51686
|
"outline-none m-0 border-0 align-baseline no-underline group/trigger",
|
|
51214
51687
|
"relative cursor-pointer select-none transform translate-z-0",
|
|
@@ -51666,14 +52139,7 @@ function ExpandableContainer({ field, entries, open, close, prefix, ctx, isLast
|
|
|
51666
52139
|
}
|
|
51667
52140
|
};
|
|
51668
52141
|
const lastIndex = entries.length - 1;
|
|
51669
|
-
return (
|
|
51670
|
-
// The treeitem row is the focusable, keyboard-operable control (roving
|
|
51671
|
-
// tabindex + arrow keys); the disclosure marker below is purely decorative.
|
|
51672
|
-
jsxRuntimeExports.jsxs("div", { className: CLS.child, role: "treeitem", "aria-expanded": expanded2, "aria-controls": expanded2 ? contentsId : void 0, "data-json-expander": true, ref: rowRef, tabIndex: level === 0 ? 0 : -1, onClick, onKeyDown, children: [jsxRuntimeExports.jsx("span", { className: expanded2 ? CLS.collapseIcon : CLS.expandIcon, "aria-hidden": "true" }), field !== void 0 && jsxRuntimeExports.jsx("span", { className: CLS.clickableLabel, children: `${formatField(field)}:` }), prefix ? jsxRuntimeExports.jsx("span", { className: CLS.className, children: prefix }) : null, jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: open }), expanded2 ? (
|
|
51673
|
-
// biome-ignore lint/a11y/useSemanticElements: ARIA tree group is the correct role here
|
|
51674
|
-
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)) })
|
|
51675
|
-
) : jsxRuntimeExports.jsx("span", { className: CLS.collapsedContent, "aria-hidden": "true" }), jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: close }), jsxRuntimeExports.jsx(Comma, { isLast })] })
|
|
51676
|
-
);
|
|
52142
|
+
return jsxRuntimeExports.jsxs("div", { className: CLS.child, role: "treeitem", "aria-expanded": expanded2, "aria-controls": expanded2 ? contentsId : void 0, "data-json-expander": true, ref: rowRef, tabIndex: level === 0 ? 0 : -1, onClick, onKeyDown, children: [jsxRuntimeExports.jsx("span", { className: expanded2 ? CLS.collapseIcon : CLS.expandIcon, "aria-hidden": "true" }), field !== void 0 && jsxRuntimeExports.jsx("span", { className: CLS.clickableLabel, children: `${formatField(field)}:` }), prefix ? jsxRuntimeExports.jsx("span", { className: CLS.className, children: prefix }) : null, jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: open }), expanded2 ? jsxRuntimeExports.jsx("ul", { id: contentsId, className: CLS.childFields, role: "group", children: entries.map(([childField, childValue], index2) => jsxRuntimeExports.jsx(DataRender, { field: childField, value: childValue, isLast: index2 === lastIndex, ctx: { ...ctx, level: level + 1 } }, childField ?? index2)) }) : jsxRuntimeExports.jsx("span", { className: CLS.collapsedContent, "aria-hidden": "true" }), jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: close }), jsxRuntimeExports.jsx(Comma, { isLast })] });
|
|
51677
52143
|
}
|
|
51678
52144
|
function DataRender({ field, value, isLast, ctx }) {
|
|
51679
52145
|
if (isBytesDisplay(value)) {
|
|
@@ -51880,41 +52346,43 @@ const serializeForClipboard = (value) => {
|
|
|
51880
52346
|
function CopyableDataBlock({ data }) {
|
|
51881
52347
|
return jsxRuntimeExports.jsxs("div", { className: "relative overflow-x-auto rounded-md border border-gray-alpha-400 p-3", children: [jsxRuntimeExports.jsx(CopyButton, { copyText: serializeForClipboard(data), ariaLabel: "Copy data", className: "absolute right-2 top-2 z-10 flex h-6 w-6 items-center justify-center rounded-md border border-gray-alpha-400 !bg-background-100 p-0 text-gray-900 transition-transform transition-colors duration-100 hover:bg-gray-200 active:scale-95 active:bg-gray-300" }), jsxRuntimeExports.jsx(DataInspector, { data })] });
|
|
51882
52348
|
}
|
|
51883
|
-
function
|
|
51884
|
-
|
|
51885
|
-
|
|
51886
|
-
|
|
51887
|
-
|
|
51888
|
-
|
|
51889
|
-
|
|
51890
|
-
|
|
51891
|
-
};
|
|
51892
|
-
if (variant === "card") {
|
|
51893
|
-
if (disabled) {
|
|
51894
|
-
return jsxRuntimeExports.jsx("div", { className: cn$4("list-none px-3 py-4 bg-background-200 [&::-webkit-details-marker]:hidden", summaryClassName), style: { cursor: "not-allowed", opacity: 0.8 }, children: summary });
|
|
52349
|
+
function isReservedAttributeKey(key) {
|
|
52350
|
+
return key.startsWith(RESERVED_ATTRIBUTE_KEY_PREFIX);
|
|
52351
|
+
}
|
|
52352
|
+
const rowValueVariants = cva("max-w-[60%] truncate text-right text-copy-13 text-gray-1000", {
|
|
52353
|
+
variants: {
|
|
52354
|
+
variant: {
|
|
52355
|
+
default: "",
|
|
52356
|
+
mono: "font-mono"
|
|
51895
52357
|
}
|
|
51896
|
-
|
|
51897
|
-
|
|
51898
|
-
|
|
51899
|
-
if (trailing) {
|
|
51900
|
-
return jsxRuntimeExports.jsx("section", { className: "-mx-4 border-t px-4 border-gray-alpha-400", children: jsxRuntimeExports.jsxs("div", { className: cn$4(rowClasses, summaryClassName), children: [jsxRuntimeExports.jsx("div", { className: "isolate relative shrink-0 w-3.5 h-3.5 text-gray-700", children: jsxRuntimeExports.jsx(ChevronRight, { size: 14, className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2" }) }), jsxRuntimeExports.jsx("span", { className: "min-w-0 flex-1", children: summary }), jsxRuntimeExports.jsx("div", { className: "shrink-0 pr-1", children: trailing })] }) });
|
|
52358
|
+
},
|
|
52359
|
+
defaultVariants: {
|
|
52360
|
+
variant: "default"
|
|
51901
52361
|
}
|
|
51902
|
-
|
|
51903
|
-
|
|
52362
|
+
});
|
|
52363
|
+
const rowCopyValueVariants = cva("flex min-w-0 max-w-[60%] items-center justify-end gap-1 text-copy-13 text-gray-1000", {
|
|
52364
|
+
variants: {
|
|
52365
|
+
variant: {
|
|
52366
|
+
default: "",
|
|
52367
|
+
mono: "font-mono"
|
|
52368
|
+
}
|
|
52369
|
+
},
|
|
52370
|
+
defaultVariants: {
|
|
52371
|
+
variant: "default"
|
|
51904
52372
|
}
|
|
51905
|
-
|
|
52373
|
+
});
|
|
52374
|
+
function DetailKeyValueRowBase({ label, value, copyText, removed = false, variant }) {
|
|
52375
|
+
const stringValue = typeof value === "string" ? value : void 0;
|
|
52376
|
+
return jsxRuntimeExports.jsxs("div", { className: "px-1.5 hover:bg-gray-100 flex justify-between gap-3 -mx-1.5 py-0.5 rounded items-center", children: [jsxRuntimeExports.jsx("span", { className: "flex min-w-0 items-center gap-1.5 truncate text-label-13 text-gray-900", children: label }), removed ? jsxRuntimeExports.jsx("span", { className: "shrink-0 text-copy-13 italic text-gray-700", children: "removed" }) : copyText ? jsxRuntimeExports.jsxs("div", { className: cn$4(rowCopyValueVariants({ variant })), title: copyText, children: [jsxRuntimeExports.jsx(MiddleTruncate, { value: copyText, className: cn$4(rowValueVariants({ variant, className: "text-right" })), style: { gridTemplateColumns: "minmax(0, 1fr)" } }), jsxRuntimeExports.jsx(CopyButton, { copyText, ariaLabel: `Copy ${label}`, className: "shrink-0 -mr-1" })] }) : jsxRuntimeExports.jsx("span", { className: cn$4(rowValueVariants({ variant })), title: stringValue, children: value })] });
|
|
51906
52377
|
}
|
|
51907
|
-
|
|
51908
|
-
|
|
51909
|
-
|
|
51910
|
-
|
|
51911
|
-
|
|
51912
|
-
color: "var(--ds-gray-700)"
|
|
51913
|
-
}, title: `Keys prefixed with "${RESERVED_ATTRIBUTE_KEY_PREFIX}" are reserved for framework and library code`, children: "Reserved" });
|
|
52378
|
+
function DetailKeyValueRow(props) {
|
|
52379
|
+
return jsxRuntimeExports.jsx(DetailKeyValueRowBase, { ...props });
|
|
52380
|
+
}
|
|
52381
|
+
function DetailMonoKeyValueRow(props) {
|
|
52382
|
+
return jsxRuntimeExports.jsx(DetailKeyValueRowBase, { ...props, variant: "mono" });
|
|
51914
52383
|
}
|
|
51915
52384
|
function AttributeRow({ attributeKey, value, removed = false }) {
|
|
51916
|
-
|
|
51917
|
-
return jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-3 py-0.5", children: [jsxRuntimeExports.jsxs("span", { className: "flex min-w-0 items-center gap-1.5 text-label-13 text-gray-900", style: reserved ? { color: "var(--ds-gray-700)" } : void 0, children: [jsxRuntimeExports.jsx("span", { className: "truncate", children: attributeKey }), reserved && jsxRuntimeExports.jsx(ReservedBadge, {})] }), removed ? jsxRuntimeExports.jsx("span", { className: "shrink-0 text-copy-13 italic text-gray-700", children: "removed" }) : jsxRuntimeExports.jsx("span", { className: "max-w-[60%] truncate text-copy-13 text-gray-1000", title: value, children: value })] });
|
|
52385
|
+
return jsxRuntimeExports.jsx(DetailKeyValueRow, { label: attributeKey, value, removed });
|
|
51918
52386
|
}
|
|
51919
52387
|
function sortAttributeKeys(keys2) {
|
|
51920
52388
|
return [...keys2].sort((a2, b2) => {
|
|
@@ -51929,7 +52397,35 @@ function RunAttributesCard({ attributes }) {
|
|
|
51929
52397
|
const keys2 = sortAttributeKeys(Object.keys(attributes));
|
|
51930
52398
|
if (keys2.length === 0)
|
|
51931
52399
|
return null;
|
|
51932
|
-
return jsxRuntimeExports.jsx(
|
|
52400
|
+
return jsxRuntimeExports.jsxs(CollapsibleRoot, { defaultOpen: true, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { children: "Attributes" }), jsxRuntimeExports.jsx(CollapsibleContent, { className: "mb-4", children: jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: keys2.map((key) => jsxRuntimeExports.jsx(AttributeRow, { attributeKey: key, value: attributes[key] }, key)) }) })] });
|
|
52401
|
+
}
|
|
52402
|
+
function formatMetadataValue(value) {
|
|
52403
|
+
if (value == null) {
|
|
52404
|
+
return String(value);
|
|
52405
|
+
}
|
|
52406
|
+
if (typeof value === "string") {
|
|
52407
|
+
return value;
|
|
52408
|
+
}
|
|
52409
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
52410
|
+
return String(value);
|
|
52411
|
+
}
|
|
52412
|
+
try {
|
|
52413
|
+
return JSON.stringify(value);
|
|
52414
|
+
} catch {
|
|
52415
|
+
return String(value);
|
|
52416
|
+
}
|
|
52417
|
+
}
|
|
52418
|
+
function isMetadataRecord(value) {
|
|
52419
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
52420
|
+
}
|
|
52421
|
+
function RunMetadataCard({ metadata }) {
|
|
52422
|
+
if (!isMetadataRecord(metadata)) {
|
|
52423
|
+
return jsxRuntimeExports.jsxs(CollapsibleRoot, { defaultOpen: true, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { children: "Metadata" }), jsxRuntimeExports.jsx(CollapsibleContent, { className: "mb-4", children: jsxRuntimeExports.jsx(CopyableDataBlock, { data: metadata }) })] });
|
|
52424
|
+
}
|
|
52425
|
+
const keys2 = Object.keys(metadata).sort((a2, b2) => a2.localeCompare(b2));
|
|
52426
|
+
if (keys2.length === 0)
|
|
52427
|
+
return null;
|
|
52428
|
+
return jsxRuntimeExports.jsxs(CollapsibleRoot, { defaultOpen: true, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { children: "Metadata" }), jsxRuntimeExports.jsx(CollapsibleContent, { className: "mb-4", children: jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: keys2.map((key) => jsxRuntimeExports.jsx(AttributeRow, { attributeKey: key, value: formatMetadataValue(metadata[key]) }, key)) }) })] });
|
|
51933
52429
|
}
|
|
51934
52430
|
function isAttrSetEventData(data) {
|
|
51935
52431
|
if (data === null || typeof data !== "object")
|
|
@@ -53864,7 +54360,13 @@ function HookResolveModalWrapper({ hookActions }) {
|
|
|
53864
54360
|
const { selectedHook, closeResolveModal, handleResolve, isResolving } = hookActions;
|
|
53865
54361
|
return jsxRuntimeExports.jsx(ResolveHookModal, { isOpen: selectedHook !== null, onClose: closeResolveModal, onSubmit: handleResolve, isSubmitting: isResolving });
|
|
53866
54362
|
}
|
|
53867
|
-
const
|
|
54363
|
+
const GUTTER_PX = 1;
|
|
54364
|
+
const MIN_PX = 50;
|
|
54365
|
+
const DEFAULT_START_PX = 340;
|
|
54366
|
+
function paneColTemplate(startPx) {
|
|
54367
|
+
return `${startPx}px ${GUTTER_PX}px minmax(${MIN_PX}px, 1fr)`;
|
|
54368
|
+
}
|
|
54369
|
+
const COL_TEMPLATE = paneColTemplate(DEFAULT_START_PX);
|
|
53868
54370
|
const ROWS = [
|
|
53869
54371
|
{ id: "r0", name: 62, off: 0, bar: 72 },
|
|
53870
54372
|
{ id: "r1", name: 78, off: 6, bar: 48 },
|
|
@@ -55900,286 +56402,6 @@ function formatRelative(date2, baseDate, options) {
|
|
|
55900
56402
|
});
|
|
55901
56403
|
return format(date_, formatStr, { locale, weekStartsOn });
|
|
55902
56404
|
}
|
|
55903
|
-
const ELLIPSIS = "...";
|
|
55904
|
-
const MIN_START = 3;
|
|
55905
|
-
const MIN_END = 3;
|
|
55906
|
-
const MIN_KEPT = MIN_START + MIN_END;
|
|
55907
|
-
const graphemeSegmenter = typeof Intl !== "undefined" && "Segmenter" in Intl ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
|
|
55908
|
-
function toGraphemes(text2) {
|
|
55909
|
-
if (graphemeSegmenter) {
|
|
55910
|
-
return [...graphemeSegmenter.segment(text2)].map((s2) => s2.segment);
|
|
55911
|
-
}
|
|
55912
|
-
return Array.from(text2);
|
|
55913
|
-
}
|
|
55914
|
-
function buildCandidate(graphemes, kept) {
|
|
55915
|
-
if (kept <= 0) {
|
|
55916
|
-
return {
|
|
55917
|
-
prefixText: "",
|
|
55918
|
-
prefixGraphemeCount: 0,
|
|
55919
|
-
suffixText: "",
|
|
55920
|
-
suffixGraphemeCount: 0,
|
|
55921
|
-
text: ELLIPSIS,
|
|
55922
|
-
truncated: true
|
|
55923
|
-
};
|
|
55924
|
-
}
|
|
55925
|
-
const suffixGraphemeCount = kept >= MIN_KEPT ? Math.max(MIN_END, Math.floor(kept / 2)) : Math.floor(kept / 2);
|
|
55926
|
-
const prefixGraphemeCount = kept - suffixGraphemeCount;
|
|
55927
|
-
const prefixText = graphemes.slice(0, prefixGraphemeCount).join("");
|
|
55928
|
-
const suffixText = suffixGraphemeCount > 0 ? graphemes.slice(-suffixGraphemeCount).join("") : "";
|
|
55929
|
-
return {
|
|
55930
|
-
prefixText,
|
|
55931
|
-
prefixGraphemeCount,
|
|
55932
|
-
suffixText,
|
|
55933
|
-
suffixGraphemeCount,
|
|
55934
|
-
text: prefixText + ELLIPSIS + suffixText,
|
|
55935
|
-
truncated: true
|
|
55936
|
-
};
|
|
55937
|
-
}
|
|
55938
|
-
function middleTruncate(graphemes, availableWidth, measure, fullWidth) {
|
|
55939
|
-
const fullText = graphemes.join("");
|
|
55940
|
-
const resolvedFullWidth = fullWidth ?? measure(fullText);
|
|
55941
|
-
if (availableWidth <= 0 || graphemes.length === 0) {
|
|
55942
|
-
return {
|
|
55943
|
-
prefixText: fullText,
|
|
55944
|
-
prefixGraphemeCount: graphemes.length,
|
|
55945
|
-
suffixText: "",
|
|
55946
|
-
suffixGraphemeCount: 0,
|
|
55947
|
-
text: fullText,
|
|
55948
|
-
truncated: false
|
|
55949
|
-
};
|
|
55950
|
-
}
|
|
55951
|
-
if (resolvedFullWidth <= availableWidth) {
|
|
55952
|
-
return {
|
|
55953
|
-
prefixText: fullText,
|
|
55954
|
-
prefixGraphemeCount: graphemes.length,
|
|
55955
|
-
suffixText: "",
|
|
55956
|
-
suffixGraphemeCount: 0,
|
|
55957
|
-
text: fullText,
|
|
55958
|
-
truncated: false
|
|
55959
|
-
};
|
|
55960
|
-
}
|
|
55961
|
-
let lo2 = 0;
|
|
55962
|
-
let hi = graphemes.length - 1;
|
|
55963
|
-
let best = -1;
|
|
55964
|
-
while (lo2 <= hi) {
|
|
55965
|
-
const mid = lo2 + hi >>> 1;
|
|
55966
|
-
const candidate = buildCandidate(graphemes, mid);
|
|
55967
|
-
if (measure(candidate.text) <= availableWidth) {
|
|
55968
|
-
best = mid;
|
|
55969
|
-
lo2 = mid + 1;
|
|
55970
|
-
} else {
|
|
55971
|
-
hi = mid - 1;
|
|
55972
|
-
}
|
|
55973
|
-
}
|
|
55974
|
-
if (best === -1) {
|
|
55975
|
-
return {
|
|
55976
|
-
prefixText: "",
|
|
55977
|
-
prefixGraphemeCount: 0,
|
|
55978
|
-
suffixText: "",
|
|
55979
|
-
suffixGraphemeCount: 0,
|
|
55980
|
-
text: "",
|
|
55981
|
-
truncated: true
|
|
55982
|
-
};
|
|
55983
|
-
}
|
|
55984
|
-
return buildCandidate(graphemes, best);
|
|
55985
|
-
}
|
|
55986
|
-
function getMiddleTruncateCopyText({ prefixText, selectionEnd, selectionStart, suffixText, value }) {
|
|
55987
|
-
const visibleText = prefixText + ELLIPSIS + suffixText;
|
|
55988
|
-
if (selectionStart < 0 || selectionEnd > visibleText.length || selectionStart >= selectionEnd) {
|
|
55989
|
-
return null;
|
|
55990
|
-
}
|
|
55991
|
-
if (selectionStart === 0 && selectionEnd === visibleText.length) {
|
|
55992
|
-
return value;
|
|
55993
|
-
}
|
|
55994
|
-
const ellipsisStart = prefixText.length;
|
|
55995
|
-
const ellipsisEnd = ellipsisStart + ELLIPSIS.length;
|
|
55996
|
-
if (selectionStart > ellipsisStart || selectionEnd < ellipsisEnd) {
|
|
55997
|
-
return null;
|
|
55998
|
-
}
|
|
55999
|
-
const originalGraphemes = toGraphemes(value);
|
|
56000
|
-
const selectedPrefixGraphemeCount = toGraphemes(visibleText.slice(0, selectionStart)).length;
|
|
56001
|
-
const selectedSuffixGraphemeCount = toGraphemes(visibleText.slice(ellipsisEnd, selectionEnd)).length;
|
|
56002
|
-
const suffixStart = originalGraphemes.length - toGraphemes(suffixText).length;
|
|
56003
|
-
return originalGraphemes.slice(selectedPrefixGraphemeCount, suffixStart + selectedSuffixGraphemeCount).join("");
|
|
56004
|
-
}
|
|
56005
|
-
function getMiddleTruncateCopyTextFromSelectionText({ prefixText, selectionText, suffixText, value }) {
|
|
56006
|
-
const visibleText = prefixText + ELLIPSIS + suffixText;
|
|
56007
|
-
const trimmedSelectionText = selectionText.trim();
|
|
56008
|
-
if (!trimmedSelectionText) {
|
|
56009
|
-
return null;
|
|
56010
|
-
}
|
|
56011
|
-
const leading = selectionText.slice(0, selectionText.length - selectionText.trimStart().length);
|
|
56012
|
-
const trailing = selectionText.slice(selectionText.trimEnd().length);
|
|
56013
|
-
if (trimmedSelectionText === visibleText) {
|
|
56014
|
-
return leading + value + trailing;
|
|
56015
|
-
}
|
|
56016
|
-
if (!trimmedSelectionText.includes(ELLIPSIS)) {
|
|
56017
|
-
return null;
|
|
56018
|
-
}
|
|
56019
|
-
const selectionStart = visibleText.indexOf(trimmedSelectionText);
|
|
56020
|
-
if (selectionStart === -1) {
|
|
56021
|
-
return null;
|
|
56022
|
-
}
|
|
56023
|
-
const selectionEnd = selectionStart + trimmedSelectionText.length;
|
|
56024
|
-
const mappedText = getMiddleTruncateCopyText({
|
|
56025
|
-
prefixText,
|
|
56026
|
-
selectionEnd,
|
|
56027
|
-
selectionStart,
|
|
56028
|
-
suffixText,
|
|
56029
|
-
value
|
|
56030
|
-
});
|
|
56031
|
-
return mappedText === null ? null : leading + mappedText + trailing;
|
|
56032
|
-
}
|
|
56033
|
-
const useIsomorphicLayoutEffect$2 = typeof window === "undefined" ? reactExports.useEffect : reactExports.useLayoutEffect;
|
|
56034
|
-
function createFullState(value, graphemes) {
|
|
56035
|
-
return {
|
|
56036
|
-
displayText: value,
|
|
56037
|
-
isTruncated: false,
|
|
56038
|
-
prefixGraphemeCount: graphemes.length,
|
|
56039
|
-
prefixText: value,
|
|
56040
|
-
suffixGraphemeCount: 0,
|
|
56041
|
-
suffixText: ""
|
|
56042
|
-
};
|
|
56043
|
-
}
|
|
56044
|
-
function useMiddleTruncate(value) {
|
|
56045
|
-
const graphemes = reactExports.useMemo(() => toGraphemes(value), [value]);
|
|
56046
|
-
const fullState = reactExports.useMemo(() => createFullState(value, graphemes), [graphemes, value]);
|
|
56047
|
-
const ref = reactExports.useRef(null);
|
|
56048
|
-
const measureRef = reactExports.useRef(null);
|
|
56049
|
-
const [state, setState] = reactExports.useState(() => fullState);
|
|
56050
|
-
const rafRef = reactExports.useRef(0);
|
|
56051
|
-
const updateState = reactExports.useCallback((nextState) => {
|
|
56052
|
-
setState((currentState) => {
|
|
56053
|
-
if (currentState.displayText === nextState.displayText && currentState.isTruncated === nextState.isTruncated && currentState.prefixText === nextState.prefixText && currentState.prefixGraphemeCount === nextState.prefixGraphemeCount && currentState.suffixText === nextState.suffixText && currentState.suffixGraphemeCount === nextState.suffixGraphemeCount) {
|
|
56054
|
-
return currentState;
|
|
56055
|
-
}
|
|
56056
|
-
return nextState;
|
|
56057
|
-
});
|
|
56058
|
-
}, []);
|
|
56059
|
-
const recalculate = reactExports.useCallback(() => {
|
|
56060
|
-
const el = ref.current;
|
|
56061
|
-
const measureEl = measureRef.current;
|
|
56062
|
-
if (!el || !measureEl)
|
|
56063
|
-
return;
|
|
56064
|
-
const available = el.clientWidth;
|
|
56065
|
-
if (available <= 0) {
|
|
56066
|
-
updateState(fullState);
|
|
56067
|
-
return;
|
|
56068
|
-
}
|
|
56069
|
-
const measure = (text2) => {
|
|
56070
|
-
measureEl.textContent = text2;
|
|
56071
|
-
return measureEl.scrollWidth;
|
|
56072
|
-
};
|
|
56073
|
-
const fullWidth = measure(value);
|
|
56074
|
-
if (fullWidth <= available) {
|
|
56075
|
-
updateState(fullState);
|
|
56076
|
-
return;
|
|
56077
|
-
}
|
|
56078
|
-
const result = middleTruncate(graphemes, available, measure, fullWidth);
|
|
56079
|
-
updateState({
|
|
56080
|
-
displayText: result.text,
|
|
56081
|
-
isTruncated: result.truncated,
|
|
56082
|
-
prefixGraphemeCount: result.prefixGraphemeCount,
|
|
56083
|
-
prefixText: result.prefixText,
|
|
56084
|
-
suffixGraphemeCount: result.suffixGraphemeCount,
|
|
56085
|
-
suffixText: result.suffixText
|
|
56086
|
-
});
|
|
56087
|
-
}, [fullState, graphemes, updateState, value]);
|
|
56088
|
-
useIsomorphicLayoutEffect$2(() => {
|
|
56089
|
-
recalculate();
|
|
56090
|
-
}, [recalculate]);
|
|
56091
|
-
reactExports.useEffect(() => {
|
|
56092
|
-
var _a3;
|
|
56093
|
-
const el = ref.current;
|
|
56094
|
-
if (!el)
|
|
56095
|
-
return;
|
|
56096
|
-
const debouncedRecalc = () => {
|
|
56097
|
-
cancelAnimationFrame(rafRef.current);
|
|
56098
|
-
rafRef.current = requestAnimationFrame(recalculate);
|
|
56099
|
-
};
|
|
56100
|
-
const ro2 = typeof ResizeObserver !== "undefined" ? new ResizeObserver(debouncedRecalc) : null;
|
|
56101
|
-
ro2 == null ? void 0 : ro2.observe(el);
|
|
56102
|
-
window.addEventListener("resize", debouncedRecalc);
|
|
56103
|
-
const onFontsLoaded = () => {
|
|
56104
|
-
debouncedRecalc();
|
|
56105
|
-
};
|
|
56106
|
-
const fontSet = "fonts" in document ? document.fonts : null;
|
|
56107
|
-
(_a3 = fontSet == null ? void 0 : fontSet.addEventListener) == null ? void 0 : _a3.call(fontSet, "loadingdone", onFontsLoaded);
|
|
56108
|
-
return () => {
|
|
56109
|
-
var _a4;
|
|
56110
|
-
ro2 == null ? void 0 : ro2.disconnect();
|
|
56111
|
-
window.removeEventListener("resize", debouncedRecalc);
|
|
56112
|
-
cancelAnimationFrame(rafRef.current);
|
|
56113
|
-
(_a4 = fontSet == null ? void 0 : fontSet.removeEventListener) == null ? void 0 : _a4.call(fontSet, "loadingdone", onFontsLoaded);
|
|
56114
|
-
};
|
|
56115
|
-
}, [recalculate]);
|
|
56116
|
-
return {
|
|
56117
|
-
ref,
|
|
56118
|
-
measureRef,
|
|
56119
|
-
displayText: state.displayText,
|
|
56120
|
-
isTruncated: state.isTruncated,
|
|
56121
|
-
prefixGraphemeCount: state.prefixGraphemeCount,
|
|
56122
|
-
prefixText: state.prefixText,
|
|
56123
|
-
suffixGraphemeCount: state.suffixGraphemeCount,
|
|
56124
|
-
suffixText: state.suffixText
|
|
56125
|
-
};
|
|
56126
|
-
}
|
|
56127
|
-
function getRangeOffsets(container, range2) {
|
|
56128
|
-
if (!container.contains(range2.startContainer) || !container.contains(range2.endContainer)) {
|
|
56129
|
-
return null;
|
|
56130
|
-
}
|
|
56131
|
-
const startRange = document.createRange();
|
|
56132
|
-
startRange.selectNodeContents(container);
|
|
56133
|
-
startRange.setEnd(range2.startContainer, range2.startOffset);
|
|
56134
|
-
const endRange = document.createRange();
|
|
56135
|
-
endRange.selectNodeContents(container);
|
|
56136
|
-
endRange.setEnd(range2.endContainer, range2.endOffset);
|
|
56137
|
-
return {
|
|
56138
|
-
end: endRange.toString().length,
|
|
56139
|
-
start: startRange.toString().length
|
|
56140
|
-
};
|
|
56141
|
-
}
|
|
56142
|
-
function MiddleTruncate({ value, className, onCopy: onCopyProp, ...props }) {
|
|
56143
|
-
const { ref, measureRef, displayText, isTruncated, prefixText, suffixText } = useMiddleTruncate(value);
|
|
56144
|
-
const visibleRef = reactExports.useRef(null);
|
|
56145
|
-
const handleCopy = reactExports.useCallback((e) => {
|
|
56146
|
-
onCopyProp == null ? void 0 : onCopyProp(e);
|
|
56147
|
-
if (e.defaultPrevented || !isTruncated)
|
|
56148
|
-
return;
|
|
56149
|
-
const selection2 = window.getSelection();
|
|
56150
|
-
if (!selection2 || selection2.rangeCount === 0)
|
|
56151
|
-
return;
|
|
56152
|
-
const selectionText = selection2.toString();
|
|
56153
|
-
if (!selectionText)
|
|
56154
|
-
return;
|
|
56155
|
-
const range2 = selection2.getRangeAt(0);
|
|
56156
|
-
const visibleEl = visibleRef.current;
|
|
56157
|
-
let copyText = null;
|
|
56158
|
-
if (e.currentTarget.contains(range2.startContainer) && e.currentTarget.contains(range2.endContainer) && visibleEl) {
|
|
56159
|
-
const offsets = getRangeOffsets(visibleEl, range2);
|
|
56160
|
-
if (offsets) {
|
|
56161
|
-
copyText = getMiddleTruncateCopyText({
|
|
56162
|
-
prefixText,
|
|
56163
|
-
selectionEnd: offsets.end,
|
|
56164
|
-
selectionStart: offsets.start,
|
|
56165
|
-
suffixText,
|
|
56166
|
-
value
|
|
56167
|
-
});
|
|
56168
|
-
}
|
|
56169
|
-
}
|
|
56170
|
-
copyText ?? (copyText = getMiddleTruncateCopyTextFromSelectionText({
|
|
56171
|
-
prefixText,
|
|
56172
|
-
selectionText,
|
|
56173
|
-
suffixText,
|
|
56174
|
-
value
|
|
56175
|
-
}));
|
|
56176
|
-
if (copyText === null)
|
|
56177
|
-
return;
|
|
56178
|
-
e.preventDefault();
|
|
56179
|
-
e.clipboardData.setData("text/plain", copyText);
|
|
56180
|
-
}, [onCopyProp, isTruncated, prefixText, suffixText, value]);
|
|
56181
|
-
return jsxRuntimeExports.jsxs("span", { title: isTruncated ? value : void 0, ...props, ref, className: cn$4("relative inline-grid min-w-0 max-w-full overflow-hidden whitespace-nowrap", className), onCopy: handleCopy, children: [isTruncated && jsxRuntimeExports.jsx("span", { className: "sr-only select-none", children: value }), jsxRuntimeExports.jsx("span", { "aria-hidden": "true", className: "pointer-events-none col-start-1 row-start-1 invisible select-none whitespace-nowrap", children: value }), jsxRuntimeExports.jsx("span", { "aria-hidden": isTruncated || void 0, className: "col-start-1 row-start-1 min-w-0 overflow-hidden", ref: visibleRef, children: isTruncated ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("span", { children: prefixText }), jsxRuntimeExports.jsx("span", { children: ELLIPSIS }), jsxRuntimeExports.jsx("span", { children: suffixText })] }) : displayText }), jsxRuntimeExports.jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute left-0 top-0 inline-block invisible select-none whitespace-nowrap", ref: measureRef })] });
|
|
56182
|
-
}
|
|
56183
56405
|
const convert = (
|
|
56184
56406
|
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
|
56185
56407
|
/**
|
|
@@ -82803,7 +83025,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
|
|
|
82803
83025
|
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 });
|
|
82804
83026
|
var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
|
|
82805
83027
|
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 }) });
|
|
82806
|
-
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-
|
|
83028
|
+
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-D1QWoqJB.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
|
|
82807
83029
|
let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
|
|
82808
83030
|
`).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
|
|
82809
83031
|
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 }) })] }) });
|
|
@@ -83125,7 +83347,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
|
|
|
83125
83347
|
}, []), 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] });
|
|
83126
83348
|
};
|
|
83127
83349
|
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 }) })] });
|
|
83128
|
-
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-
|
|
83350
|
+
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-BOh-zwwU.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
|
|
83129
83351
|
function ke(e, t) {
|
|
83130
83352
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
83131
83353
|
if (!(e != null && e.position && (t != null && t.position))) return false;
|
|
@@ -83712,7 +83934,7 @@ const conversationTabs = [
|
|
|
83712
83934
|
];
|
|
83713
83935
|
function ConversationWithTabs({ conversation, args }) {
|
|
83714
83936
|
const [activeTab, setActiveTab] = reactExports.useState("conversation");
|
|
83715
|
-
return jsxRuntimeExports.jsx(
|
|
83937
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Input", children: jsxRuntimeExports.jsx(TabbedContainer, { tabs: conversationTabs, activeTab, onTabChange: setActiveTab, ariaLabel: "Conversation view", children: activeTab === "conversation" ? jsxRuntimeExports.jsx(ConversationView, { messages: conversation }) : jsxRuntimeExports.jsx("div", { className: "p-3", children: Array.isArray(args) ? args.map((v2, i) => jsxRuntimeExports.jsx("div", { className: "mt-2 first:mt-0", children: JsonBlock(v2) }, i)) : JsonBlock(args) }) }) });
|
|
83716
83938
|
}
|
|
83717
83939
|
function EncryptedFieldBlock() {
|
|
83718
83940
|
return jsxRuntimeExports.jsx(EncryptedDataBlock, {});
|
|
@@ -83884,7 +84106,7 @@ const attributeToDisplayFn = {
|
|
|
83884
84106
|
environment: (_value) => null,
|
|
83885
84107
|
executionContext: (_value) => null,
|
|
83886
84108
|
// Attributes — string-string metadata attached to the run.
|
|
83887
|
-
// Rendered as key-value rows in its own collapsible
|
|
84109
|
+
// Rendered as key-value rows in its own collapsible section;
|
|
83888
84110
|
// if empty/missing, hidden by the hasDisplayContent gate.
|
|
83889
84111
|
attributes: (value) => {
|
|
83890
84112
|
if (!hasDisplayContent(value))
|
|
@@ -83904,15 +84126,17 @@ const attributeToDisplayFn = {
|
|
|
83904
84126
|
metadata: (value) => {
|
|
83905
84127
|
if (!hasDisplayContent(value))
|
|
83906
84128
|
return null;
|
|
83907
|
-
if (isEncryptedMarker$1(value))
|
|
83908
|
-
return jsxRuntimeExports.jsx(EncryptedDataBlock, {});
|
|
83909
|
-
|
|
83910
|
-
|
|
83911
|
-
|
|
84129
|
+
if (isEncryptedMarker$1(value)) {
|
|
84130
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Metadata", children: jsxRuntimeExports.jsx(EncryptedDataBlock, {}) });
|
|
84131
|
+
}
|
|
84132
|
+
if (isExpiredMarker(value)) {
|
|
84133
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Metadata", children: jsxRuntimeExports.jsx(ExpiredFieldBlock, {}) });
|
|
84134
|
+
}
|
|
84135
|
+
return jsxRuntimeExports.jsx(RunMetadataCard, { metadata: value });
|
|
83912
84136
|
},
|
|
83913
84137
|
input: (value, context) => {
|
|
83914
84138
|
if (isEncryptedMarker$1(value)) {
|
|
83915
|
-
return jsxRuntimeExports.jsx(
|
|
84139
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Input", children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
|
|
83916
84140
|
}
|
|
83917
84141
|
if (isExpiredMarker(value))
|
|
83918
84142
|
return jsxRuntimeExports.jsx(ExpiredFieldBlock, {});
|
|
@@ -83924,51 +84148,51 @@ const attributeToDisplayFn = {
|
|
|
83924
84148
|
if ((context == null ? void 0 : context.stepName) && isDoStreamStep(context.stepName)) {
|
|
83925
84149
|
const conversation = extractConversation(args);
|
|
83926
84150
|
if (conversation && conversation.length > 0) {
|
|
83927
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(ConversationWithTabs, { conversation, args }), hasClosureVars && jsxRuntimeExports.jsx(
|
|
84151
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(ConversationWithTabs, { conversation, args }), hasClosureVars && jsxRuntimeExports.jsx(Collapsible, { label: "Closure Variables", children: JsonBlock(closureVars) }), hasThisVal && jsxRuntimeExports.jsx(Collapsible, { label: "This Value", children: JsonBlock(thisVal) })] });
|
|
83928
84152
|
}
|
|
83929
84153
|
}
|
|
83930
84154
|
if (!hasArgs && !hasClosureVars && !hasThisVal) {
|
|
83931
|
-
return jsxRuntimeExports.jsx(
|
|
84155
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Input (no data)", disabled: true });
|
|
83932
84156
|
}
|
|
83933
|
-
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(
|
|
84157
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Collapsible, { label: "Input", children: Array.isArray(args) ? args.map((v2, i) => jsxRuntimeExports.jsx("div", { className: "mt-2 first:mt-0", children: JsonBlock(v2) }, i)) : JsonBlock(args) }), hasClosureVars && jsxRuntimeExports.jsx(Collapsible, { label: "Closure Variables", children: JsonBlock(closureVars) }), hasThisVal && jsxRuntimeExports.jsx(Collapsible, { label: "Context", children: JsonBlock(thisVal) })] });
|
|
83934
84158
|
}
|
|
83935
84159
|
if (!hasDisplayContent(value)) {
|
|
83936
|
-
return jsxRuntimeExports.jsx(
|
|
84160
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Input (no data)", disabled: true });
|
|
83937
84161
|
}
|
|
83938
|
-
return jsxRuntimeExports.jsx(
|
|
84162
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Input", children: Array.isArray(value) ? value.map((v2, i) => jsxRuntimeExports.jsx("div", { className: "mt-2 first:mt-0", children: JsonBlock(v2) }, i)) : JsonBlock(value) });
|
|
83939
84163
|
},
|
|
83940
84164
|
output: (value) => {
|
|
83941
84165
|
if (isEncryptedMarker$1(value)) {
|
|
83942
|
-
return jsxRuntimeExports.jsx(
|
|
84166
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Output", children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
|
|
83943
84167
|
}
|
|
83944
84168
|
if (!hasDisplayContent(value))
|
|
83945
84169
|
return null;
|
|
83946
84170
|
if (isExpiredMarker(value))
|
|
83947
84171
|
return jsxRuntimeExports.jsx(ExpiredFieldBlock, {});
|
|
83948
|
-
return jsxRuntimeExports.jsx(
|
|
84172
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Output", children: JsonBlock(value) });
|
|
83949
84173
|
},
|
|
83950
84174
|
error: (value) => {
|
|
83951
84175
|
if (isEncryptedMarker$1(value)) {
|
|
83952
|
-
return jsxRuntimeExports.jsx(
|
|
84176
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Error", defaultOpen: true, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
|
|
83953
84177
|
}
|
|
83954
84178
|
if (isExpiredMarker(value))
|
|
83955
84179
|
return jsxRuntimeExports.jsx(ExpiredFieldBlock, {});
|
|
83956
84180
|
if (!hasDisplayContent(value))
|
|
83957
84181
|
return null;
|
|
83958
84182
|
if (isStructuredError(value)) {
|
|
83959
|
-
return jsxRuntimeExports.jsx(
|
|
84183
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Error", defaultOpen: true, children: jsxRuntimeExports.jsx(ErrorStackBlock, { value }) });
|
|
83960
84184
|
}
|
|
83961
|
-
return jsxRuntimeExports.jsx(
|
|
84185
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Error", defaultOpen: true, children: JsonBlock(value) });
|
|
83962
84186
|
},
|
|
83963
84187
|
eventData: (value) => {
|
|
83964
84188
|
if (isEncryptedMarker$1(value)) {
|
|
83965
|
-
return jsxRuntimeExports.jsx(
|
|
84189
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Event Data", defaultOpen: true, children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
|
|
83966
84190
|
}
|
|
83967
84191
|
if (isExpiredMarker(value))
|
|
83968
84192
|
return jsxRuntimeExports.jsx(ExpiredFieldBlock, {});
|
|
83969
84193
|
if (!hasDisplayContent(value))
|
|
83970
84194
|
return null;
|
|
83971
|
-
return jsxRuntimeExports.jsx(
|
|
84195
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Event Data", defaultOpen: true, children: JsonBlock(value) });
|
|
83972
84196
|
},
|
|
83973
84197
|
errorCode: (value) => {
|
|
83974
84198
|
if (typeof value !== "string" || value.length === 0)
|
|
@@ -83988,6 +84212,7 @@ const selfHeaderedAttributes = /* @__PURE__ */ new Set([
|
|
|
83988
84212
|
"input",
|
|
83989
84213
|
"output",
|
|
83990
84214
|
"error",
|
|
84215
|
+
"metadata",
|
|
83991
84216
|
"attributes",
|
|
83992
84217
|
"eventData"
|
|
83993
84218
|
]);
|
|
@@ -84009,9 +84234,9 @@ const AttributeBlock = ({ attribute, value, isLoading, inline = false, context }
|
|
|
84009
84234
|
if (isLoading && isExpandableLoadingTarget && !hasDisplayContent(value)) {
|
|
84010
84235
|
const label = attribute === "eventData" ? "Event Data" : attribute === "output" ? "Output" : "Input";
|
|
84011
84236
|
if (decryptCtx == null ? void 0 : decryptCtx.hasEncryptedData) {
|
|
84012
|
-
return jsxRuntimeExports.jsx(
|
|
84237
|
+
return jsxRuntimeExports.jsx(Collapsible, { label, defaultOpen: attribute === "eventData", children: jsxRuntimeExports.jsx(EncryptedFieldBlock, {}) });
|
|
84013
84238
|
}
|
|
84014
|
-
return jsxRuntimeExports.jsx(
|
|
84239
|
+
return jsxRuntimeExports.jsx(Collapsible, { label });
|
|
84015
84240
|
}
|
|
84016
84241
|
const displayFn = attributeToDisplayFn[attribute];
|
|
84017
84242
|
if (!displayFn) {
|
|
@@ -84097,12 +84322,13 @@ const AttributePanel = ({ data, moduleSpecifier, isLoading, error: error2, expir
|
|
|
84097
84322
|
isDecrypting,
|
|
84098
84323
|
hasEncryptedData: outerDecryptCtx == null ? void 0 : outerDecryptCtx.hasEncryptedData
|
|
84099
84324
|
} : outerDecryptCtx;
|
|
84100
|
-
return jsxRuntimeExports.jsx(ContextCardProvider, { children: jsxRuntimeExports.jsx(RunClickContext.Provider, { value: onRunClick, children: jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: jsxRuntimeExports.jsxs(DecryptClickContext.Provider, { value: decryptValue, children: [visibleBasicAttributes.length > 0 && jsxRuntimeExports.jsxs("
|
|
84325
|
+
return jsxRuntimeExports.jsx(ContextCardProvider, { children: jsxRuntimeExports.jsx(RunClickContext.Provider, { value: onRunClick, children: jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: jsxRuntimeExports.jsxs(DecryptClickContext.Provider, { value: decryptValue, children: [visibleBasicAttributes.length > 0 && jsxRuntimeExports.jsxs(CollapsibleRoot, { defaultOpen: true, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { children: "Metadata" }), jsxRuntimeExports.jsx(CollapsibleContent, { className: "mt-0 mb-2", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [orderedBasicAttributes.map((attribute) => {
|
|
84101
84326
|
var _a3;
|
|
84102
84327
|
const displayValue = (_a3 = attributeToDisplayFn[attribute]) == null ? void 0 : _a3.call(attributeToDisplayFn, displayData[attribute]);
|
|
84103
84328
|
const isCopyableBasicAttribute = copyableBasicAttributes.has(attribute) && typeof displayValue === "string";
|
|
84104
|
-
|
|
84105
|
-
|
|
84329
|
+
const label = getAttributeDisplayName(attribute);
|
|
84330
|
+
return jsxRuntimeExports.jsx(DetailMonoKeyValueRow, { label, value: displayValue, copyText: isCopyableBasicAttribute ? displayValue : void 0 }, attribute);
|
|
84331
|
+
}), isLoading && resource === "sleep" && !displayData.resumeAt && jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-3 py-0.5", children: [jsxRuntimeExports.jsx("span", { className: "text-label-13 text-gray-900", children: "Resume" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-4 w-[55%]" })] })] }) })] }), error2 ? jsxRuntimeExports.jsx(ErrorCard, { title: "Failed to load resource details", details: error2.message, className: "my-4" }) : hasExpired ? jsxRuntimeExports.jsx(ExpiredDataMessage, {}) : resolvedAttributes.length > 0 ? resolvedAttributes.map((attribute) => jsxRuntimeExports.jsx(AttributeBlock, { isLoading, attribute, value: displayData[attribute], context: displayContext }, attribute)) : null] }) }) }) });
|
|
84106
84332
|
};
|
|
84107
84333
|
const ERROR_EVENT_TYPES = /* @__PURE__ */ new Set(["step_failed", "step_retrying"]);
|
|
84108
84334
|
const DATA_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -84184,17 +84410,17 @@ function EventItem({ event, onLoadEventData, encryptionKey, showSeparateEventOcc
|
|
|
84184
84410
|
second: "numeric"
|
|
84185
84411
|
});
|
|
84186
84412
|
const displayPayload = isLoading ? loadedData : mergedDisplay;
|
|
84187
|
-
return jsxRuntimeExports.jsxs(
|
|
84413
|
+
return jsxRuntimeExports.jsxs(CollapsibleRoot, { variant: "card", onOpenChange: canHaveData ? (open) => {
|
|
84188
84414
|
if (open)
|
|
84189
84415
|
handleExpand();
|
|
84190
|
-
} : void 0, 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 }) })] });
|
|
84416
|
+
} : 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 }) })] })] });
|
|
84191
84417
|
}
|
|
84192
84418
|
function hasOnlyExpiredFields(data, eventType) {
|
|
84193
84419
|
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
84194
84420
|
return false;
|
|
84195
84421
|
}
|
|
84196
84422
|
const record2 = data;
|
|
84197
|
-
const refKeys =
|
|
84423
|
+
const refKeys = getEventDataRefFields(eventType);
|
|
84198
84424
|
const presentKeys = refKeys.filter((k2) => k2 in record2);
|
|
84199
84425
|
return presentKeys.length > 0 && presentKeys.every((k2) => isExpiredMarker(record2[k2]));
|
|
84200
84426
|
}
|
|
@@ -84227,9 +84453,9 @@ function EventsList({ events: events2, isLoading = false, error: error2, onLoadE
|
|
|
84227
84453
|
const sortedEvents2 = reactExports.useMemo(() => [...events2].sort((a2, b2) => getEffectiveEventDate(a2).getTime() - getEffectiveEventDate(b2).getTime()), [events2]);
|
|
84228
84454
|
const hasEvents = sortedEvents2.length > 0 && !error2;
|
|
84229
84455
|
if (!hasEvents && !isLoading) {
|
|
84230
|
-
return jsxRuntimeExports.jsx(
|
|
84456
|
+
return jsxRuntimeExports.jsx(Collapsible, { label: "Events", disabled: true });
|
|
84231
84457
|
}
|
|
84232
|
-
return jsxRuntimeExports.jsx(RunClickContext.Provider, { value: onRunClick, children: jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: jsxRuntimeExports.jsx(
|
|
84458
|
+
return jsxRuntimeExports.jsx(RunClickContext.Provider, { value: onRunClick, children: jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: jsxRuntimeExports.jsxs(CollapsibleRoot, { defaultOpen: true, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { children: "Events" }), jsxRuntimeExports.jsx(CollapsibleContent, { className: "mb-0", children: isLoading ? jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: [0, 1, 2].map((i) => jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-3 bg-background-200 px-4 py-2", children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "h-4 w-32 rounded" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3 w-16 rounded" })] }, i)) }) : jsxRuntimeExports.jsx("div", { className: "flex flex-col -mx-4", children: sortedEvents2.map((event) => jsxRuntimeExports.jsx(EventItem, { event, onLoadEventData, encryptionKey, showSeparateEventOccurrenceTimestamps }, event.eventId)) }) })] }) }) });
|
|
84233
84459
|
}
|
|
84234
84460
|
const SidebarDataContext = reactExports.createContext(null);
|
|
84235
84461
|
SidebarDataContext.displayName = "SidebarDataContext";
|
|
@@ -85904,6 +86130,301 @@ const Tooltip$1 = Root3$1;
|
|
|
85904
86130
|
const TooltipTrigger$1 = Trigger$4;
|
|
85905
86131
|
const TooltipContent$1 = reactExports.forwardRef(({ className, sideOffset = 8, showArrow = true, children: children2, ...props }, ref) => jsxRuntimeExports.jsx(Portal$6, { children: jsxRuntimeExports.jsxs(Content2$4, { ref, sideOffset, className: cn$4("z-[99999] flex items-center gap-1 rounded-[10px] bg-gray-1000 px-2 py-1.5 !text-label-13 text-background-100 shadow-md select-none", className), ...props, children: [children2, showArrow ? jsxRuntimeExports.jsx(Arrow2$1, { width: 11, height: 5, className: "fill-gray-1000" }) : null] }) }));
|
|
85906
86132
|
TooltipContent$1.displayName = Content2$4.displayName;
|
|
86133
|
+
const ActiveSpanContext = reactExports.createContext(null);
|
|
86134
|
+
ActiveSpanContext.displayName = "ActiveSpanContext";
|
|
86135
|
+
function ActiveSpanProvider({ spans, children: children2 }) {
|
|
86136
|
+
const [activeSpanId, setActiveSpanId] = reactExports.useState(null);
|
|
86137
|
+
reactExports.useEffect(() => {
|
|
86138
|
+
setActiveSpanId((currentSpanId) => {
|
|
86139
|
+
if (!currentSpanId) {
|
|
86140
|
+
return null;
|
|
86141
|
+
}
|
|
86142
|
+
const hasCurrentSpan = spans.some((span) => span.spanId === currentSpanId);
|
|
86143
|
+
if (hasCurrentSpan) {
|
|
86144
|
+
return currentSpanId;
|
|
86145
|
+
}
|
|
86146
|
+
return null;
|
|
86147
|
+
});
|
|
86148
|
+
}, [spans]);
|
|
86149
|
+
const activeSpan = reactExports.useMemo(() => {
|
|
86150
|
+
if (!activeSpanId) {
|
|
86151
|
+
return null;
|
|
86152
|
+
}
|
|
86153
|
+
return spans.find((span) => span.spanId === activeSpanId) ?? null;
|
|
86154
|
+
}, [activeSpanId, spans]);
|
|
86155
|
+
const setActiveSpan = reactExports.useCallback((spanId) => {
|
|
86156
|
+
setActiveSpanId(spanId);
|
|
86157
|
+
}, []);
|
|
86158
|
+
const clearActiveSpan = reactExports.useCallback(() => {
|
|
86159
|
+
setActiveSpanId(null);
|
|
86160
|
+
}, []);
|
|
86161
|
+
const value = reactExports.useMemo(() => ({
|
|
86162
|
+
activeSpanId,
|
|
86163
|
+
activeSpan,
|
|
86164
|
+
spans,
|
|
86165
|
+
setActiveSpan,
|
|
86166
|
+
clearActiveSpan
|
|
86167
|
+
}), [activeSpanId, activeSpan, spans, setActiveSpan, clearActiveSpan]);
|
|
86168
|
+
return jsxRuntimeExports.jsx(ActiveSpanContext.Provider, { value, children: children2 });
|
|
86169
|
+
}
|
|
86170
|
+
const useActiveSpan = () => {
|
|
86171
|
+
const context = reactExports.useContext(ActiveSpanContext);
|
|
86172
|
+
if (!context) {
|
|
86173
|
+
throw new Error("useActiveSpan must be used within ActiveSpanProvider");
|
|
86174
|
+
}
|
|
86175
|
+
return context;
|
|
86176
|
+
};
|
|
86177
|
+
const PANEL_MIN_WIDTH = 280;
|
|
86178
|
+
const PANEL_HARD_MAX_WIDTH = 1300;
|
|
86179
|
+
const PANEL_DEFAULT_WIDTH = 360;
|
|
86180
|
+
const MAIN_MIN_WIDTH = 400;
|
|
86181
|
+
const PANEL_WIDTH_STORAGE_KEY = "workflow-trace-detail-panel-width";
|
|
86182
|
+
function clamp$2(value, min2, max2) {
|
|
86183
|
+
return Math.min(Math.max(value, min2), max2);
|
|
86184
|
+
}
|
|
86185
|
+
function computeMaxPanelWidth(availableWidth) {
|
|
86186
|
+
if (availableWidth <= 0)
|
|
86187
|
+
return PANEL_HARD_MAX_WIDTH;
|
|
86188
|
+
return Math.min(Math.max(availableWidth - MAIN_MIN_WIDTH, 0), PANEL_HARD_MAX_WIDTH);
|
|
86189
|
+
}
|
|
86190
|
+
function clampPanelWidth(width, availableWidth) {
|
|
86191
|
+
return clamp$2(width, PANEL_MIN_WIDTH, computeMaxPanelWidth(availableWidth));
|
|
86192
|
+
}
|
|
86193
|
+
function readStoredPanelWidth() {
|
|
86194
|
+
if (typeof window === "undefined")
|
|
86195
|
+
return PANEL_DEFAULT_WIDTH;
|
|
86196
|
+
try {
|
|
86197
|
+
const raw2 = window.localStorage.getItem(PANEL_WIDTH_STORAGE_KEY);
|
|
86198
|
+
const value = raw2 ? Number(raw2) : Number.NaN;
|
|
86199
|
+
if (!Number.isFinite(value))
|
|
86200
|
+
return PANEL_DEFAULT_WIDTH;
|
|
86201
|
+
return clamp$2(value, PANEL_MIN_WIDTH, PANEL_HARD_MAX_WIDTH);
|
|
86202
|
+
} catch {
|
|
86203
|
+
return PANEL_DEFAULT_WIDTH;
|
|
86204
|
+
}
|
|
86205
|
+
}
|
|
86206
|
+
function writeStoredPanelWidth(width) {
|
|
86207
|
+
if (typeof window === "undefined")
|
|
86208
|
+
return;
|
|
86209
|
+
try {
|
|
86210
|
+
window.localStorage.setItem(PANEL_WIDTH_STORAGE_KEY, String(Math.round(width)));
|
|
86211
|
+
} catch {
|
|
86212
|
+
}
|
|
86213
|
+
}
|
|
86214
|
+
function DraggableBorder({ element: element2, position: position2, onWidthChange, onReset, "aria-label": ariaLabel, "aria-controls": ariaControls, "aria-valuemin": ariaValueMin, "aria-valuemax": ariaValueMax, "aria-valuenow": ariaValueNow }) {
|
|
86215
|
+
const [isDragging, setIsDragging] = reactExports.useState(false);
|
|
86216
|
+
const pointerIdRef = reactExports.useRef(null);
|
|
86217
|
+
const startXRef = reactExports.useRef(0);
|
|
86218
|
+
const startWidthRef = reactExports.useRef(0);
|
|
86219
|
+
const pendingWidthRef = reactExports.useRef(0);
|
|
86220
|
+
const rafRef = reactExports.useRef(null);
|
|
86221
|
+
const movedRef = reactExports.useRef(false);
|
|
86222
|
+
const lastDragEndAtRef = reactExports.useRef(0);
|
|
86223
|
+
reactExports.useEffect(() => {
|
|
86224
|
+
return () => {
|
|
86225
|
+
if (rafRef.current)
|
|
86226
|
+
cancelAnimationFrame(rafRef.current);
|
|
86227
|
+
};
|
|
86228
|
+
}, []);
|
|
86229
|
+
reactExports.useEffect(() => {
|
|
86230
|
+
if (!isDragging)
|
|
86231
|
+
return;
|
|
86232
|
+
const previous2 = document.body.style.userSelect;
|
|
86233
|
+
document.body.style.userSelect = "none";
|
|
86234
|
+
return () => {
|
|
86235
|
+
document.body.style.userSelect = previous2;
|
|
86236
|
+
};
|
|
86237
|
+
}, [isDragging]);
|
|
86238
|
+
const stopDrag = () => {
|
|
86239
|
+
pointerIdRef.current = null;
|
|
86240
|
+
setIsDragging(false);
|
|
86241
|
+
if (rafRef.current) {
|
|
86242
|
+
cancelAnimationFrame(rafRef.current);
|
|
86243
|
+
rafRef.current = null;
|
|
86244
|
+
if (movedRef.current)
|
|
86245
|
+
onWidthChange(pendingWidthRef.current);
|
|
86246
|
+
}
|
|
86247
|
+
if (movedRef.current) {
|
|
86248
|
+
movedRef.current = false;
|
|
86249
|
+
lastDragEndAtRef.current = performance.now();
|
|
86250
|
+
}
|
|
86251
|
+
};
|
|
86252
|
+
const handlePointerDown = (e) => {
|
|
86253
|
+
if (pointerIdRef.current !== null)
|
|
86254
|
+
return;
|
|
86255
|
+
const el = element2.current;
|
|
86256
|
+
if (!el)
|
|
86257
|
+
return;
|
|
86258
|
+
if (e.pointerType === "mouse" && e.button !== 0)
|
|
86259
|
+
return;
|
|
86260
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
86261
|
+
pointerIdRef.current = e.pointerId;
|
|
86262
|
+
startXRef.current = e.clientX;
|
|
86263
|
+
startWidthRef.current = el.offsetWidth;
|
|
86264
|
+
movedRef.current = false;
|
|
86265
|
+
setIsDragging(true);
|
|
86266
|
+
};
|
|
86267
|
+
const handlePointerMove = (e) => {
|
|
86268
|
+
if (pointerIdRef.current !== e.pointerId)
|
|
86269
|
+
return;
|
|
86270
|
+
if (Math.abs(e.clientX - startXRef.current) > 4) {
|
|
86271
|
+
movedRef.current = true;
|
|
86272
|
+
}
|
|
86273
|
+
const delta = position2 === "left" ? startXRef.current - e.clientX : e.clientX - startXRef.current;
|
|
86274
|
+
pendingWidthRef.current = startWidthRef.current + delta;
|
|
86275
|
+
if (!rafRef.current) {
|
|
86276
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
86277
|
+
rafRef.current = null;
|
|
86278
|
+
onWidthChange(pendingWidthRef.current);
|
|
86279
|
+
});
|
|
86280
|
+
}
|
|
86281
|
+
};
|
|
86282
|
+
const handlePointerEnd = (e) => {
|
|
86283
|
+
if (pointerIdRef.current !== e.pointerId)
|
|
86284
|
+
return;
|
|
86285
|
+
stopDrag();
|
|
86286
|
+
};
|
|
86287
|
+
const handleLostPointerCapture = (e) => {
|
|
86288
|
+
if (pointerIdRef.current !== null && e.pointerId !== pointerIdRef.current) {
|
|
86289
|
+
return;
|
|
86290
|
+
}
|
|
86291
|
+
stopDrag();
|
|
86292
|
+
};
|
|
86293
|
+
const handleDoubleClick = () => {
|
|
86294
|
+
if (movedRef.current || performance.now() - lastDragEndAtRef.current < 500) {
|
|
86295
|
+
return;
|
|
86296
|
+
}
|
|
86297
|
+
onReset == null ? void 0 : onReset();
|
|
86298
|
+
};
|
|
86299
|
+
const handleKeyDown = (e) => {
|
|
86300
|
+
const el = element2.current;
|
|
86301
|
+
if (!el)
|
|
86302
|
+
return;
|
|
86303
|
+
const step = e.shiftKey ? 64 : 16;
|
|
86304
|
+
const grow = position2 === "left" ? 1 : -1;
|
|
86305
|
+
let next2 = null;
|
|
86306
|
+
if (e.key === "ArrowLeft") {
|
|
86307
|
+
next2 = el.offsetWidth + grow * step;
|
|
86308
|
+
} else if (e.key === "ArrowRight") {
|
|
86309
|
+
next2 = el.offsetWidth - grow * step;
|
|
86310
|
+
} else if (e.key === "Home" && ariaValueMin !== void 0) {
|
|
86311
|
+
next2 = ariaValueMin;
|
|
86312
|
+
} else if (e.key === "End" && ariaValueMax !== void 0) {
|
|
86313
|
+
next2 = ariaValueMax;
|
|
86314
|
+
}
|
|
86315
|
+
if (next2 === null)
|
|
86316
|
+
return;
|
|
86317
|
+
e.preventDefault();
|
|
86318
|
+
onWidthChange(next2);
|
|
86319
|
+
};
|
|
86320
|
+
return jsxRuntimeExports.jsx("div", { role: "separator", "aria-orientation": "vertical", "aria-label": ariaLabel, "aria-controls": ariaControls, "aria-valuemin": ariaValueMin, "aria-valuemax": ariaValueMax, "aria-valuenow": ariaValueNow, tabIndex: 0, className: cn$4("group absolute inset-y-0 z-10 w-[17px] cursor-col-resize touch-none outline-none", position2 === "left" ? "-left-2" : "-right-2"), onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onPointerUp: handlePointerEnd, onPointerCancel: handlePointerEnd, onLostPointerCapture: handleLostPointerCapture, onDoubleClick: handleDoubleClick, onKeyDown: handleKeyDown, children: jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: cn$4("pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors delay-75 duration-100", "group-hover:bg-gray-500 group-focus-visible:bg-[var(--ds-focus-color)]", isDragging && "bg-gray-500") }) });
|
|
86321
|
+
}
|
|
86322
|
+
function useElementWidth(ref, enabled = true) {
|
|
86323
|
+
const [width, setWidth] = reactExports.useState(0);
|
|
86324
|
+
reactExports.useLayoutEffect(() => {
|
|
86325
|
+
if (!enabled)
|
|
86326
|
+
return;
|
|
86327
|
+
const el = ref.current;
|
|
86328
|
+
if (!el)
|
|
86329
|
+
return;
|
|
86330
|
+
setWidth(Math.round(el.getBoundingClientRect().width));
|
|
86331
|
+
const observer = new ResizeObserver(([entry2]) => {
|
|
86332
|
+
setWidth(Math.round((entry2 == null ? void 0 : entry2.contentRect.width) ?? 0));
|
|
86333
|
+
});
|
|
86334
|
+
observer.observe(el);
|
|
86335
|
+
return () => observer.disconnect();
|
|
86336
|
+
}, [ref, enabled]);
|
|
86337
|
+
return width;
|
|
86338
|
+
}
|
|
86339
|
+
const DETAIL_PANEL_ID = "trace-detail-panel";
|
|
86340
|
+
function useSelectedSpanInfo() {
|
|
86341
|
+
const { activeSpan } = useActiveSpan();
|
|
86342
|
+
const sidebar = useSidebarData();
|
|
86343
|
+
return reactExports.useMemo(() => {
|
|
86344
|
+
var _a3, _b2;
|
|
86345
|
+
if (!activeSpan)
|
|
86346
|
+
return null;
|
|
86347
|
+
const resource = (_a3 = activeSpan.attributes) == null ? void 0 : _a3.resource;
|
|
86348
|
+
const rawEvents = filterSpanRawEvents(sidebar.events, resource, activeSpan.spanId);
|
|
86349
|
+
return {
|
|
86350
|
+
data: (_b2 = activeSpan.attributes) == null ? void 0 : _b2.data,
|
|
86351
|
+
resource,
|
|
86352
|
+
spanId: activeSpan.spanId,
|
|
86353
|
+
rawEvents
|
|
86354
|
+
};
|
|
86355
|
+
}, [activeSpan, sidebar]);
|
|
86356
|
+
}
|
|
86357
|
+
function TraceDetailPanel({ containerRef, onNavigateToSpan, onClose }) {
|
|
86358
|
+
const { activeSpan, activeSpanId, spans } = useActiveSpan();
|
|
86359
|
+
const sidebar = useSidebarData();
|
|
86360
|
+
const selectedSpan = useSelectedSpanInfo();
|
|
86361
|
+
const isOpen = Boolean(activeSpan);
|
|
86362
|
+
const [storedWidth, setStoredWidth] = reactExports.useState(() => readStoredPanelWidth());
|
|
86363
|
+
const containerWidth = useElementWidth(containerRef, isOpen);
|
|
86364
|
+
const asideRef = reactExports.useRef(null);
|
|
86365
|
+
const handleResize = reactExports.useCallback((next2) => {
|
|
86366
|
+
const clamped = clampPanelWidth(next2, containerWidth);
|
|
86367
|
+
setStoredWidth(clamped);
|
|
86368
|
+
writeStoredPanelWidth(clamped);
|
|
86369
|
+
}, [containerWidth]);
|
|
86370
|
+
const panelWidth = clampPanelWidth(storedWidth, containerWidth);
|
|
86371
|
+
const panelMaxWidth = Math.max(PANEL_MIN_WIDTH, computeMaxPanelWidth(containerWidth));
|
|
86372
|
+
const { prevSpanId, nextSpanId } = reactExports.useMemo(() => {
|
|
86373
|
+
var _a3, _b2;
|
|
86374
|
+
if (!activeSpanId)
|
|
86375
|
+
return { prevSpanId: null, nextSpanId: null };
|
|
86376
|
+
const i = spans.findIndex((s2) => s2.spanId === activeSpanId);
|
|
86377
|
+
if (i === -1)
|
|
86378
|
+
return { prevSpanId: null, nextSpanId: null };
|
|
86379
|
+
return {
|
|
86380
|
+
prevSpanId: ((_a3 = spans[i - 1]) == null ? void 0 : _a3.spanId) ?? null,
|
|
86381
|
+
nextSpanId: ((_b2 = spans[i + 1]) == null ? void 0 : _b2.spanId) ?? null
|
|
86382
|
+
};
|
|
86383
|
+
}, [activeSpanId, spans]);
|
|
86384
|
+
const handleSelectPrev = reactExports.useCallback(() => {
|
|
86385
|
+
if (prevSpanId)
|
|
86386
|
+
onNavigateToSpan(prevSpanId);
|
|
86387
|
+
}, [prevSpanId, onNavigateToSpan]);
|
|
86388
|
+
const handleSelectNext = reactExports.useCallback(() => {
|
|
86389
|
+
if (nextSpanId)
|
|
86390
|
+
onNavigateToSpan(nextSpanId);
|
|
86391
|
+
}, [nextSpanId, onNavigateToSpan]);
|
|
86392
|
+
reactExports.useEffect(() => {
|
|
86393
|
+
if (!isOpen)
|
|
86394
|
+
return;
|
|
86395
|
+
const onKeyDown = (e) => {
|
|
86396
|
+
if (e.key !== "j" && e.key !== "k" && e.key !== "ArrowDown" && e.key !== "ArrowUp") {
|
|
86397
|
+
return;
|
|
86398
|
+
}
|
|
86399
|
+
const target2 = e.target;
|
|
86400
|
+
if (target2 instanceof HTMLInputElement || target2 instanceof HTMLTextAreaElement || (target2 == null ? void 0 : target2.isContentEditable)) {
|
|
86401
|
+
return;
|
|
86402
|
+
}
|
|
86403
|
+
const targetId = e.key === "k" || e.key === "ArrowUp" ? prevSpanId : nextSpanId;
|
|
86404
|
+
if (targetId) {
|
|
86405
|
+
e.preventDefault();
|
|
86406
|
+
onNavigateToSpan(targetId);
|
|
86407
|
+
}
|
|
86408
|
+
};
|
|
86409
|
+
window.addEventListener("keydown", onKeyDown);
|
|
86410
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
86411
|
+
}, [isOpen, prevSpanId, nextSpanId, onNavigateToSpan]);
|
|
86412
|
+
const selectedSpanName = reactExports.useMemo(() => {
|
|
86413
|
+
var _a3, _b2;
|
|
86414
|
+
if (!(selectedSpan == null ? void 0 : selectedSpan.data))
|
|
86415
|
+
return "Details";
|
|
86416
|
+
const data = selectedSpan.data;
|
|
86417
|
+
if (selectedSpan.resource === "hook") {
|
|
86418
|
+
return data.token ?? data.hookId;
|
|
86419
|
+
}
|
|
86420
|
+
const stepName = data.stepName;
|
|
86421
|
+
const workflowName = data.workflowName;
|
|
86422
|
+
return (stepName ? (_a3 = parseStepName(stepName)) == null ? void 0 : _a3.shortName : void 0) ?? (workflowName ? (_b2 = parseWorkflowName(workflowName)) == null ? void 0 : _b2.shortName : void 0) ?? stepName ?? workflowName ?? data.hookId ?? "Details";
|
|
86423
|
+
}, [selectedSpan == null ? void 0 : selectedSpan.data, selectedSpan == null ? void 0 : selectedSpan.resource]);
|
|
86424
|
+
if (!activeSpan)
|
|
86425
|
+
return null;
|
|
86426
|
+
return jsxRuntimeExports.jsxs("aside", { ref: asideRef, id: DETAIL_PANEL_ID, className: "relative flex flex-col h-full max-h-full shrink-0 bg-background-100 border-l border-gray-alpha-400", style: { width: panelWidth }, children: [jsxRuntimeExports.jsx(DraggableBorder, { element: asideRef, position: "left", onWidthChange: handleResize, onReset: () => handleResize(PANEL_DEFAULT_WIDTH), "aria-label": "Resize span details panel", "aria-controls": DETAIL_PANEL_ID, "aria-valuemin": PANEL_MIN_WIDTH, "aria-valuemax": panelMaxWidth, "aria-valuenow": Math.min(Math.max(Math.round(panelWidth), PANEL_MIN_WIDTH), panelMaxWidth) }), jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 shrink-0 px-4 py-[7.5px]", children: [jsxRuntimeExports.jsx("span", { className: "text-label-14 font-medium text-gray-1000 truncate block", children: selectedSpanName }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0.5 shrink-0", children: [jsxRuntimeExports.jsxs(Tooltip$1, { children: [jsxRuntimeExports.jsx(TooltipTrigger$1, { asChild: true, children: jsxRuntimeExports.jsx(IconButton, { "aria-label": "Navigate up", "aria-keyshortcuts": "K", onClick: handleSelectPrev, disabled: !prevSpanId, children: jsxRuntimeExports.jsx(ChevronUp, { className: "w-4 h-4" }) }) }), prevSpanId ? jsxRuntimeExports.jsxs(TooltipContent$1, { children: ["Navigate up", jsxRuntimeExports.jsx(Kbd, { children: "K" })] }) : null] }), jsxRuntimeExports.jsxs(Tooltip$1, { children: [jsxRuntimeExports.jsx(TooltipTrigger$1, { asChild: true, children: jsxRuntimeExports.jsx(IconButton, { "aria-label": "Navigate down", "aria-keyshortcuts": "J", onClick: handleSelectNext, disabled: !nextSpanId, children: jsxRuntimeExports.jsx(ChevronDown, { className: "w-4 h-4" }) }) }), nextSpanId ? jsxRuntimeExports.jsxs(TooltipContent$1, { children: ["Navigate down", jsxRuntimeExports.jsx(Kbd, { children: "J" })] }) : null] }), jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: "w-px h-4 bg-gray-alpha-400 mx-1" }), jsxRuntimeExports.jsx(IconButton, { "aria-label": "Close span details", "aria-keyshortcuts": "Escape", onClick: onClose, children: jsxRuntimeExports.jsx(X$3, { className: "w-4 h-4" }) })] })] }), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto", children: jsxRuntimeExports.jsx(ErrorBoundary$1, { children: jsxRuntimeExports.jsx(EntityDetailPanel, { run: sidebar.run, onStreamClick: sidebar.onStreamClick, onRunClick: sidebar.onRunClick, fetchSpanDetail: sidebar.fetchSpanDetail, onWakeUpSleep: sidebar.onWakeUpSleep, onLoadEventData: sidebar.onLoadEventData, onResolveHook: sidebar.onResolveHook, encryptionKey: sidebar.encryptionKey, onDecrypt: sidebar.onDecrypt, isDecrypting: sidebar.isDecrypting, selectedSpan, showSeparateEventOccurrenceTimestamps: sidebar.showSeparateEventOccurrenceTimestamps }) }) })] });
|
|
86427
|
+
}
|
|
85907
86428
|
const WorkflowIcon = () => {
|
|
85908
86429
|
return jsxRuntimeExports.jsx("svg", { "data-testid": "geist-icon", height: "16", strokeLinejoin: "round", style: { color: "currentColor" }, viewBox: "0 0 16 16", width: "16", children: jsxRuntimeExports.jsx("path", { d: "M5.75 7L6.4209 7.33594L4.85254 10.4717C5.38789 10.771 5.75 11.3431 5.75 12V14C5.75 14.9665 4.96648 15.75 4 15.75H2C1.03352 15.75 0.25 14.9665 0.25 14V12C0.25 11.0335 1.03352 10.25 2 10.25H3.28711L5.0791 6.66504L5.75 7ZM14 10.25C14.9665 10.25 15.75 11.0335 15.75 12V14C15.75 14.9665 14.9665 15.75 14 15.75H12C11.1185 15.75 10.3909 15.098 10.2695 14.25H7V12.75H10.25V12C10.25 11.0335 11.0335 10.25 12 10.25H14ZM2 11.75C1.86192 11.75 1.75 11.8619 1.75 12V14C1.75 14.1381 1.86192 14.25 2 14.25H4C4.13808 14.25 4.25 14.1381 4.25 14V12C4.25 11.8619 4.13808 11.75 4 11.75H2ZM12 11.75C11.8619 11.75 11.75 11.8619 11.75 12V14C11.75 14.1381 11.8619 14.25 12 14.25H14C14.1381 14.25 14.25 14.1381 14.25 14V12C14.25 11.8619 14.1381 11.75 14 11.75H12ZM9 0.25C9.96649 0.25 10.75 1.03351 10.75 2V4C10.75 4.44642 10.5808 4.85197 10.3057 5.16113L12.2041 8.6416L10.8877 9.36035L8.91895 5.75H7C6.03351 5.75 5.25 4.96649 5.25 4V2C5.25 1.03351 6.03351 0.25 7 0.25H9ZM7 1.75C6.86193 1.75 6.75 1.86193 6.75 2V4C6.75 4.13807 6.86193 4.25 7 4.25H9C9.13807 4.25 9.25 4.13807 9.25 4V2C9.25 1.86193 9.13807 1.75 9 1.75H7Z", fill: "currentColor" }) });
|
|
85909
86430
|
};
|
|
@@ -86484,22 +87005,20 @@ const EventList = ({ spans, activeSpanId, searchResult, onSelectSpan }) => {
|
|
|
86484
87005
|
paddingBottom: (spans.length - end) * ROW_HEIGHT_PX
|
|
86485
87006
|
}, children: spans.slice(start2, end).map((span) => jsxRuntimeExports.jsx(EventRow, { span, isSelected: span.spanId === activeSpanId, isDimmed: isSpanDimmedBySearch(span.spanId, searchResult), onSelectSpan }, span.spanId)) });
|
|
86486
87007
|
};
|
|
86487
|
-
|
|
86488
|
-
const MIN_PX = 50;
|
|
86489
|
-
const DEFAULT_START_PX = 340;
|
|
86490
|
-
function SplitPane({ children: children2, className, defaultStartWidth = DEFAULT_START_PX, startHeader, endHeader, scrollContainerRef }) {
|
|
87008
|
+
function SplitPane({ children: children2, className, startHeader, endHeader, scrollContainerRef }) {
|
|
86491
87009
|
const parts = reactExports.Children.toArray(children2);
|
|
86492
87010
|
if (parts.length !== 2) {
|
|
86493
87011
|
throw new Error("SplitPane expects exactly two children");
|
|
86494
87012
|
}
|
|
86495
87013
|
const [start2, end] = parts;
|
|
86496
|
-
const [startPx, setStartPx] = reactExports.useState(
|
|
87014
|
+
const [startPx, setStartPx] = reactExports.useState(DEFAULT_START_PX);
|
|
86497
87015
|
const [isDragging, setIsDragging] = reactExports.useState(false);
|
|
86498
87016
|
const containerRef = reactExports.useRef(null);
|
|
86499
87017
|
const gutterRef = reactExports.useRef(null);
|
|
86500
87018
|
const rafRef = reactExports.useRef(null);
|
|
86501
|
-
const pendingPx = reactExports.useRef(
|
|
87019
|
+
const pendingPx = reactExports.useRef(DEFAULT_START_PX);
|
|
86502
87020
|
const pointerIdRef = reactExports.useRef(null);
|
|
87021
|
+
const containerWidth = useElementWidth(containerRef);
|
|
86503
87022
|
reactExports.useEffect(() => {
|
|
86504
87023
|
return () => {
|
|
86505
87024
|
if (rafRef.current)
|
|
@@ -86573,13 +87092,10 @@ function SplitPane({ children: children2, className, defaultStartWidth = DEFAULT
|
|
|
86573
87092
|
rafRef.current = null;
|
|
86574
87093
|
}
|
|
86575
87094
|
};
|
|
86576
|
-
const
|
|
86577
|
-
const
|
|
87095
|
+
const effectiveStartPx = containerWidth > 0 ? Math.max(MIN_PX, Math.min(containerWidth - MIN_PX - GUTTER_PX, startPx)) : startPx;
|
|
87096
|
+
const colTemplate = paneColTemplate(effectiveStartPx);
|
|
86578
87097
|
const gutter = jsxRuntimeExports.jsx("div", { ref: gutterRef, className: "relative z-20 isolate flex shrink-0 cursor-col-resize justify-center", onPointerDown: handlePointerDown, onLostPointerCapture: handleLostPointerCapture, children: jsxRuntimeExports.jsx("span", { className: "pointer-events-none relative z-10 h-full w-px shrink-0 bg-gray-alpha-400", "aria-hidden": true }) });
|
|
86579
|
-
|
|
86580
|
-
return jsxRuntimeExports.jsxs("div", { className: cn$4("flex flex-col h-full min-h-0", className), children: [jsxRuntimeExports.jsxs("div", { className: "shrink-0 grid", style: { gridTemplateColumns: colTemplate }, children: [jsxRuntimeExports.jsx("div", { children: startHeader }), jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: jsxRuntimeExports.jsx("span", { className: "h-full w-px bg-gray-alpha-400", "aria-hidden": true }) }), jsxRuntimeExports.jsx("div", { children: endHeader })] }), jsxRuntimeExports.jsxs("div", { ref: setContainerRef, className: cn$4("grid flex-1 min-h-0 overflow-x-hidden overflow-y-auto", isDragging && "select-none"), style: { gridTemplateColumns: colTemplate }, children: [start2, gutter, end] })] });
|
|
86581
|
-
}
|
|
86582
|
-
return jsxRuntimeExports.jsxs("div", { ref: setContainerRef, className: cn$4("grid h-full min-h-0 content-start overflow-x-hidden overflow-y-auto", isDragging && "select-none", className), style: { gridTemplateColumns: colTemplate, height: "100%" }, children: [start2, gutter, end] });
|
|
87098
|
+
return jsxRuntimeExports.jsxs("div", { className: cn$4("flex flex-col h-full min-h-0", className), children: [jsxRuntimeExports.jsxs("div", { className: "shrink-0 grid", style: { gridTemplateColumns: colTemplate }, children: [jsxRuntimeExports.jsx("div", { children: startHeader }), jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: jsxRuntimeExports.jsx("span", { className: "h-full w-px bg-gray-alpha-400", "aria-hidden": true }) }), jsxRuntimeExports.jsx("div", { children: endHeader })] }), jsxRuntimeExports.jsxs("div", { ref: setContainerRef, className: cn$4("grid flex-1 min-h-0 overflow-x-hidden overflow-y-auto", isDragging && "select-none"), style: { gridTemplateColumns: colTemplate }, children: [start2, gutter, end] })] });
|
|
86583
87099
|
}
|
|
86584
87100
|
function projectMarkers(markers2, visibleStartMs, visibleEndMs) {
|
|
86585
87101
|
const visibleDurationMs = visibleEndMs - visibleStartMs;
|
|
@@ -86872,49 +87388,6 @@ function TraceShortcutHelper({ hasMultipleSpans, reducedMotion }) {
|
|
|
86872
87388
|
};
|
|
86873
87389
|
return jsxRuntimeExports.jsxs("div", { className: "group absolute bottom-3 left-1/2 z-10 hidden h-8 max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-1 text-xs leading-none text-gray-900 md:inline-flex", children: [jsxRuntimeExports.jsx("span", { "aria-live": "polite", "aria-atomic": "true", className: "inline-flex items-center whitespace-nowrap", children: reducedMotion ? jsxRuntimeExports.jsx(AltHint, {}) : jsxRuntimeExports.jsx("span", { className: `inline-flex items-center ${styles$1.hint}`, children: index2 === 0 ? jsxRuntimeExports.jsx(AltHint, {}) : jsxRuntimeExports.jsx(NavHint, {}) }, index2) }), jsxRuntimeExports.jsx("button", { type: "button", className: "inline-flex h-5 w-5 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 motion-reduce:transition-none", onClick: dismiss, "aria-label": "Dismiss trace shortcuts helper", children: jsxRuntimeExports.jsx(X$3, { className: "h-3 w-3" }) })] });
|
|
86874
87390
|
}
|
|
86875
|
-
const ActiveSpanContext = reactExports.createContext(null);
|
|
86876
|
-
ActiveSpanContext.displayName = "ActiveSpanContext";
|
|
86877
|
-
function ActiveSpanProvider({ spans, children: children2 }) {
|
|
86878
|
-
const [activeSpanId, setActiveSpanId] = reactExports.useState(null);
|
|
86879
|
-
reactExports.useEffect(() => {
|
|
86880
|
-
setActiveSpanId((currentSpanId) => {
|
|
86881
|
-
if (!currentSpanId) {
|
|
86882
|
-
return null;
|
|
86883
|
-
}
|
|
86884
|
-
const hasCurrentSpan = spans.some((span) => span.spanId === currentSpanId);
|
|
86885
|
-
if (hasCurrentSpan) {
|
|
86886
|
-
return currentSpanId;
|
|
86887
|
-
}
|
|
86888
|
-
return null;
|
|
86889
|
-
});
|
|
86890
|
-
}, [spans]);
|
|
86891
|
-
const activeSpan = reactExports.useMemo(() => {
|
|
86892
|
-
if (!activeSpanId) {
|
|
86893
|
-
return null;
|
|
86894
|
-
}
|
|
86895
|
-
return spans.find((span) => span.spanId === activeSpanId) ?? null;
|
|
86896
|
-
}, [activeSpanId, spans]);
|
|
86897
|
-
const setActiveSpan = reactExports.useCallback((spanId) => {
|
|
86898
|
-
setActiveSpanId(spanId);
|
|
86899
|
-
}, []);
|
|
86900
|
-
const clearActiveSpan = reactExports.useCallback(() => {
|
|
86901
|
-
setActiveSpanId(null);
|
|
86902
|
-
}, []);
|
|
86903
|
-
const value = reactExports.useMemo(() => ({
|
|
86904
|
-
activeSpanId,
|
|
86905
|
-
activeSpan,
|
|
86906
|
-
setActiveSpan,
|
|
86907
|
-
clearActiveSpan
|
|
86908
|
-
}), [activeSpanId, activeSpan, setActiveSpan, clearActiveSpan]);
|
|
86909
|
-
return jsxRuntimeExports.jsx(ActiveSpanContext.Provider, { value, children: children2 });
|
|
86910
|
-
}
|
|
86911
|
-
const useActiveSpan = () => {
|
|
86912
|
-
const context = reactExports.useContext(ActiveSpanContext);
|
|
86913
|
-
if (!context) {
|
|
86914
|
-
throw new Error("useActiveSpan must be used within ActiveSpanProvider");
|
|
86915
|
-
}
|
|
86916
|
-
return context;
|
|
86917
|
-
};
|
|
86918
87391
|
const MIN_VIEWPORT_MS = 1e-3;
|
|
86919
87392
|
const ZOOM_DEBOUNCE_MS = 150;
|
|
86920
87393
|
function useAnimatedViewport(initial) {
|
|
@@ -86969,33 +87442,15 @@ function useAnimatedViewport(initial) {
|
|
|
86969
87442
|
reactExports.useEffect(() => cancel, [cancel]);
|
|
86970
87443
|
return { viewport, setViewport, animateTo };
|
|
86971
87444
|
}
|
|
86972
|
-
function useSelectedSpanInfo() {
|
|
86973
|
-
const { activeSpan } = useActiveSpan();
|
|
86974
|
-
const sidebar = useSidebarData();
|
|
86975
|
-
return reactExports.useMemo(() => {
|
|
86976
|
-
var _a3, _b2;
|
|
86977
|
-
if (!activeSpan)
|
|
86978
|
-
return null;
|
|
86979
|
-
const resource = (_a3 = activeSpan.attributes) == null ? void 0 : _a3.resource;
|
|
86980
|
-
const rawEvents = filterSpanRawEvents(sidebar.events, resource, activeSpan.spanId);
|
|
86981
|
-
return {
|
|
86982
|
-
data: (_b2 = activeSpan.attributes) == null ? void 0 : _b2.data,
|
|
86983
|
-
resource,
|
|
86984
|
-
spanId: activeSpan.spanId,
|
|
86985
|
-
rawEvents
|
|
86986
|
-
};
|
|
86987
|
-
}, [activeSpan, sidebar]);
|
|
86988
|
-
}
|
|
86989
87445
|
function NewTraceViewer$1({ trace: trace2, onLoadMore, hasMore, isLoadingMore }) {
|
|
86990
87446
|
return jsxRuntimeExports.jsx(TooltipProvider, { delayDuration: 300, children: jsxRuntimeExports.jsx(ActiveSpanProvider, { spans: trace2.spans, children: jsxRuntimeExports.jsx(NewTraceViewerContent, { trace: trace2, onLoadMore, hasMore, isLoadingMore }) }) });
|
|
86991
87447
|
}
|
|
86992
87448
|
function NewTraceViewerContent({ trace: trace2, onLoadMore, hasMore, isLoadingMore }) {
|
|
86993
|
-
const {
|
|
86994
|
-
const sidebar = useSidebarData();
|
|
86995
|
-
const selectedSpan = useSelectedSpanInfo();
|
|
87449
|
+
const { activeSpanId, setActiveSpan, clearActiveSpan } = useActiveSpan();
|
|
86996
87450
|
const reducedMotion = useReducedMotion();
|
|
86997
87451
|
const [searchQuery, setSearchQuery] = reactExports.useState("");
|
|
86998
87452
|
const deferredSearchQuery = reactExports.useDeferredValue(searchQuery);
|
|
87453
|
+
const paneRootRef = reactExports.useRef(null);
|
|
86999
87454
|
const searchResult = reactExports.useMemo(() => searchSpans(trace2.spans, deferredSearchQuery), [trace2.spans, deferredSearchQuery]);
|
|
87000
87455
|
const root2 = reactExports.useMemo(() => computeRootBounds(trace2.spans), [trace2.spans]);
|
|
87001
87456
|
const scrollContainerRef = reactExports.useRef(null);
|
|
@@ -87076,6 +87531,8 @@ function NewTraceViewerContent({ trace: trace2, onLoadMore, hasMore, isLoadingMo
|
|
|
87076
87531
|
}, [setViewport, root2.startTime, root2.duration]);
|
|
87077
87532
|
const zoomIn = reactExports.useCallback(() => zoomBy(ZOOM_FACTOR), [zoomBy]);
|
|
87078
87533
|
const zoomOut = reactExports.useCallback(() => zoomBy(1 / ZOOM_FACTOR), [zoomBy]);
|
|
87534
|
+
const isAtMinZoom = viewDuration >= root2.duration;
|
|
87535
|
+
const isAtMaxZoom = viewDuration <= MIN_VIEWPORT_MS;
|
|
87079
87536
|
const focusViewportOnSpan = reactExports.useCallback((spanId) => {
|
|
87080
87537
|
const span = trace2.spans.find((s2) => s2.spanId === spanId);
|
|
87081
87538
|
if (!span)
|
|
@@ -87158,24 +87615,11 @@ function NewTraceViewerContent({ trace: trace2, onLoadMore, hasMore, isLoadingMo
|
|
|
87158
87615
|
}, [setActiveSpan, scrollSpanIntoView, cancelPendingZoom, focusViewportOnSpan]);
|
|
87159
87616
|
const [altHeld, setAltHeld] = reactExports.useState(false);
|
|
87160
87617
|
reactExports.useEffect(() => {
|
|
87161
|
-
const handleSidebarNavKey = (e) => {
|
|
87162
|
-
const target2 = e.target;
|
|
87163
|
-
if (target2 instanceof HTMLInputElement || target2 instanceof HTMLTextAreaElement || (target2 == null ? void 0 : target2.isContentEditable)) {
|
|
87164
|
-
return;
|
|
87165
|
-
}
|
|
87166
|
-
const targetId = e.key === "k" ? prevSpanIdRef.current : nextSpanIdRef.current;
|
|
87167
|
-
if (targetId) {
|
|
87168
|
-
e.preventDefault();
|
|
87169
|
-
navigateToSpanRef.current(targetId);
|
|
87170
|
-
}
|
|
87171
|
-
};
|
|
87172
87618
|
const onKeyDown = (e) => {
|
|
87173
87619
|
if (e.key === "Escape") {
|
|
87174
87620
|
handleClearActiveSpan();
|
|
87175
87621
|
} else if (e.key === "Alt") {
|
|
87176
87622
|
setAltHeld(true);
|
|
87177
|
-
} else if (e.key === "j" || e.key === "k") {
|
|
87178
|
-
handleSidebarNavKey(e);
|
|
87179
87623
|
}
|
|
87180
87624
|
};
|
|
87181
87625
|
const onKeyUp = (e) => {
|
|
@@ -87281,51 +87725,13 @@ function NewTraceViewerContent({ trace: trace2, onLoadMore, hasMore, isLoadingMo
|
|
|
87281
87725
|
el.addEventListener("wheel", onWheel, { passive: false });
|
|
87282
87726
|
return () => el.removeEventListener("wheel", onWheel);
|
|
87283
87727
|
}, [root2.startTime, root2.duration, setViewport]);
|
|
87284
|
-
|
|
87285
|
-
var _a3, _b2;
|
|
87286
|
-
if (!(selectedSpan == null ? void 0 : selectedSpan.data))
|
|
87287
|
-
return "Details";
|
|
87288
|
-
const data = selectedSpan.data;
|
|
87289
|
-
if (selectedSpan.resource === "hook") {
|
|
87290
|
-
return data.token ?? data.hookId;
|
|
87291
|
-
}
|
|
87292
|
-
const stepName = data.stepName;
|
|
87293
|
-
const workflowName = data.workflowName;
|
|
87294
|
-
return (stepName ? (_a3 = parseStepName(stepName)) == null ? void 0 : _a3.shortName : void 0) ?? (workflowName ? (_b2 = parseWorkflowName(workflowName)) == null ? void 0 : _b2.shortName : void 0) ?? stepName ?? workflowName ?? data.hookId ?? "Details";
|
|
87295
|
-
}, [selectedSpan == null ? void 0 : selectedSpan.data, selectedSpan == null ? void 0 : selectedSpan.resource]);
|
|
87296
|
-
const { prevSpanId, nextSpanId } = reactExports.useMemo(() => {
|
|
87297
|
-
var _a3, _b2;
|
|
87298
|
-
if (!activeSpanId)
|
|
87299
|
-
return { prevSpanId: null, nextSpanId: null };
|
|
87300
|
-
const i = trace2.spans.findIndex((s2) => s2.spanId === activeSpanId);
|
|
87301
|
-
if (i === -1)
|
|
87302
|
-
return { prevSpanId: null, nextSpanId: null };
|
|
87303
|
-
return {
|
|
87304
|
-
prevSpanId: ((_a3 = trace2.spans[i - 1]) == null ? void 0 : _a3.spanId) ?? null,
|
|
87305
|
-
nextSpanId: ((_b2 = trace2.spans[i + 1]) == null ? void 0 : _b2.spanId) ?? null
|
|
87306
|
-
};
|
|
87307
|
-
}, [activeSpanId, trace2.spans]);
|
|
87308
|
-
const handleSelectPrevSpan = reactExports.useCallback(() => {
|
|
87309
|
-
if (prevSpanId)
|
|
87310
|
-
navigateToSpan(prevSpanId);
|
|
87311
|
-
}, [prevSpanId, navigateToSpan]);
|
|
87312
|
-
const handleSelectNextSpan = reactExports.useCallback(() => {
|
|
87313
|
-
if (nextSpanId)
|
|
87314
|
-
navigateToSpan(nextSpanId);
|
|
87315
|
-
}, [nextSpanId, navigateToSpan]);
|
|
87316
|
-
const prevSpanIdRef = reactExports.useRef(prevSpanId);
|
|
87317
|
-
const nextSpanIdRef = reactExports.useRef(nextSpanId);
|
|
87318
|
-
const navigateToSpanRef = reactExports.useRef(navigateToSpan);
|
|
87319
|
-
prevSpanIdRef.current = prevSpanId;
|
|
87320
|
-
nextSpanIdRef.current = nextSpanId;
|
|
87321
|
-
navigateToSpanRef.current = navigateToSpan;
|
|
87322
|
-
return jsxRuntimeExports.jsxs("div", { "data-pane": "pane-root", "data-has-detail": activeSpan ? "" : void 0, className: "relative grid w-full h-full max-h-full grid-cols-[minmax(100px,1fr)] data-[has-detail]:grid-cols-[minmax(100px,1fr)_clamp(280px,360px,100%)]", children: [jsxRuntimeExports.jsxs("div", { id: "trace-parent", className: "grid grid-rows-[1fr] h-full min-h-0 overflow-hidden relative bg-background-100", children: [jsxRuntimeExports.jsxs(SplitPane, { scrollContainerRef, startHeader: jsxRuntimeExports.jsxs("div", { className: "bg-background-100 border-b border-gray-alpha-400 h-10 min-h-10 flex items-center pl-4 pr-2 gap-1.5", children: [jsxRuntimeExports.jsx(Search, { className: "w-3.5 h-3.5 shrink-0 text-gray-800" }), jsxRuntimeExports.jsx("input", { id: "trace-viewer-search", name: "trace-viewer-search", type: "text", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), onKeyDown: (e) => {
|
|
87728
|
+
return jsxRuntimeExports.jsxs("div", { ref: paneRootRef, "data-pane": "pane-root", className: "relative flex w-full h-full max-h-full", children: [jsxRuntimeExports.jsxs("div", { id: "trace-parent", className: "flex-1 min-w-0 grid grid-rows-[1fr] h-full min-h-0 overflow-hidden relative bg-background-100", children: [jsxRuntimeExports.jsxs(SplitPane, { scrollContainerRef, startHeader: jsxRuntimeExports.jsxs("div", { className: "bg-background-100 border-b border-gray-alpha-400 h-10 min-h-10 flex items-center pl-4 pr-2 gap-1.5", children: [jsxRuntimeExports.jsx(Search, { className: "w-3.5 h-3.5 shrink-0 text-gray-800" }), jsxRuntimeExports.jsx("input", { id: "trace-viewer-search", name: "trace-viewer-search", type: "text", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), onKeyDown: (e) => {
|
|
87323
87729
|
if (e.key === "Escape" && searchQuery) {
|
|
87324
87730
|
e.preventDefault();
|
|
87325
87731
|
e.stopPropagation();
|
|
87326
87732
|
setSearchQuery("");
|
|
87327
87733
|
}
|
|
87328
|
-
}, placeholder: "Search spans...", "aria-label": "Search spans", className: "flex-1 min-w-0 bg-transparent text-sm text-gray-1000 placeholder:text-gray-800 outline-none" }), searchQuery && jsxRuntimeExports.jsx("button", { type: "button", "aria-label": "Clear search", onClick: () => setSearchQuery(""), className: "-mr-2 hidden h-full max-w-full shrink-0 cursor-pointer items-center rounded-r-md border-0 bg-transparent px-2.5 font-inherit text-base text-gray-900 no-underline transition-colors duration-150 ease-in hover:text-gray-1000 focus-visible:-outline-offset-1 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--ds-focus-color)] min-[961px]:flex", children: jsxRuntimeExports.jsx(Kbd, { variant: "outline", size: "search", children: "Esc" }) })] }), endHeader: jsxRuntimeExports.jsx(TimelineHeader, { markers: timeMarkers, hoverInfo: hoverInfo2 }), children: [jsxRuntimeExports.jsxs("div", { className: "block overflow-visible", children: [jsxRuntimeExports.jsx(EventList, { spans: trace2.spans, activeSpanId, searchResult, onSelectSpan: handleSelectSpan }), jsxRuntimeExports.jsx("div", { ref: loadMoreSentinelRef, className: "flex justify-center", children: isLoadingMore ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 py-3 text-sm text-gray-800", children: [jsxRuntimeExports.jsx(Spinner, { size: 14 }), jsxRuntimeExports.jsx("span", { children: "Loading spans…" })] }) : null })] }), jsxRuntimeExports.jsx("div", { ref: timelineRef, className: "block min-h-0 overflow-visible relative", onDoubleClick: resetZoom, onMouseMove: handleTimelineMouseMove, onMouseLeave: handleTimelineMouseLeave, children: jsxRuntimeExports.jsx(Timeline, { spans: trace2.spans, viewStart: viewport.start, viewEnd: viewport.end, markers: timeMarkers, selectedId: activeSpanId, searchResult, onSelect: handleSelectSpan, onRevealTime: handleRevealTime, hoverFraction, altHeld }) })] }), jsxRuntimeExports.jsxs("div", { className: "absolute right-3 bottom-3 z-[5] flex items-center border border-gray-alpha-400 rounded-md bg-background-100 shadow-sm overflow-hidden divide-x divide-gray-alpha-400", children: [jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: zoomOut, "aria-label": "Zoom out", children: jsxRuntimeExports.jsx(ZoomOut, { className: "w-4 h-4" }) }), jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: resetZoom, "aria-label": "Reset zoom", children: jsxRuntimeExports.jsx(RotateCcw, { className: "w-3.5 h-3.5" }) }), jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: zoomIn,
|
|
87734
|
+
}, placeholder: "Search spans...", "aria-label": "Search spans", className: "flex-1 min-w-0 bg-transparent text-sm text-gray-1000 placeholder:text-gray-800 outline-none" }), searchQuery && jsxRuntimeExports.jsx("button", { type: "button", "aria-label": "Clear search", onClick: () => setSearchQuery(""), className: "-mr-2 hidden h-full max-w-full shrink-0 cursor-pointer items-center rounded-r-md border-0 bg-transparent px-2.5 font-inherit text-base text-gray-900 no-underline transition-colors duration-150 ease-in hover:text-gray-1000 focus-visible:-outline-offset-1 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--ds-focus-color)] min-[961px]:flex", children: jsxRuntimeExports.jsx(Kbd, { variant: "outline", size: "search", children: "Esc" }) })] }), endHeader: jsxRuntimeExports.jsx(TimelineHeader, { markers: timeMarkers, hoverInfo: hoverInfo2 }), children: [jsxRuntimeExports.jsxs("div", { className: "block overflow-visible", children: [jsxRuntimeExports.jsx(EventList, { spans: trace2.spans, activeSpanId, searchResult, onSelectSpan: handleSelectSpan }), jsxRuntimeExports.jsx("div", { ref: loadMoreSentinelRef, className: "flex justify-center", children: isLoadingMore ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 py-3 text-sm text-gray-800", children: [jsxRuntimeExports.jsx(Spinner, { size: 14 }), jsxRuntimeExports.jsx("span", { children: "Loading spans…" })] }) : null })] }), jsxRuntimeExports.jsx("div", { ref: timelineRef, className: "block min-h-0 overflow-visible relative", onDoubleClick: resetZoom, onMouseMove: handleTimelineMouseMove, onMouseLeave: handleTimelineMouseLeave, children: jsxRuntimeExports.jsx(Timeline, { spans: trace2.spans, viewStart: viewport.start, viewEnd: viewport.end, markers: timeMarkers, selectedId: activeSpanId, searchResult, onSelect: handleSelectSpan, onRevealTime: handleRevealTime, hoverFraction, altHeld }) })] }), jsxRuntimeExports.jsxs("div", { className: "absolute right-3 bottom-3 z-[5] flex items-center border border-gray-alpha-400 rounded-md bg-background-100 shadow-sm overflow-hidden divide-x divide-gray-alpha-400", children: [jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: zoomOut, disabled: isAtMinZoom, "aria-label": "Zoom out", children: jsxRuntimeExports.jsx(ZoomOut, { className: "w-4 h-4" }) }), jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: resetZoom, "aria-label": "Reset zoom", children: jsxRuntimeExports.jsx(RotateCcw, { className: "w-3.5 h-3.5" }) }), jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: zoomIn, disabled: isAtMaxZoom, "aria-label": "Zoom in", children: jsxRuntimeExports.jsx(ZoomIn, { className: "w-4 h-4" }) })] })] }), jsxRuntimeExports.jsx(TraceDetailPanel, { containerRef: paneRootRef, onNavigateToSpan: navigateToSpan, onClose: handleClearActiveSpan }), jsxRuntimeExports.jsx(TraceShortcutHelper, { hasMultipleSpans: trace2.spans.length > 1, reducedMotion })] });
|
|
87329
87735
|
}
|
|
87330
87736
|
const NewTraceViewer = ({ run: run2, events: events2, sidebarData, onLoadMore, hasMore, isLoadingMore, loading = false }) => {
|
|
87331
87737
|
const trace2 = reactExports.useMemo(() => {
|
|
@@ -90492,8 +90898,6 @@ class RuntimeDecryptionError extends WorkflowRuntimeError {
|
|
|
90492
90898
|
cause: options == null ? void 0 : options.cause,
|
|
90493
90899
|
slug: ERROR_SLUGS.RUNTIME_DECRYPTION_FAILED
|
|
90494
90900
|
});
|
|
90495
|
-
/** Optional structured context about the failed encrypt/decrypt call. */
|
|
90496
|
-
__publicField(this, "context");
|
|
90497
90901
|
this.name = "RuntimeDecryptionError";
|
|
90498
90902
|
if ((options == null ? void 0 : options.context) !== void 0) {
|
|
90499
90903
|
this.context = options.context;
|
|
@@ -91251,21 +91655,34 @@ const encryption = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
91251
91655
|
encrypt: encrypt$1,
|
|
91252
91656
|
importKey
|
|
91253
91657
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
91254
|
-
const version$1 = "5.0.0-beta.
|
|
91658
|
+
const version$1 = "5.0.0-beta.27";
|
|
91659
|
+
function assertWorldSupportsRuntimeProtocol(world) {
|
|
91660
|
+
if (world.specVersion === SPEC_VERSION_CURRENT) {
|
|
91661
|
+
return;
|
|
91662
|
+
}
|
|
91663
|
+
const supportedVersion = world.specVersion ?? "none";
|
|
91664
|
+
throw new WorkflowRuntimeError(`This Workflow runtime requires a World with matching spec version ${SPEC_VERSION_CURRENT}, but the configured World declares spec version ${supportedVersion}. Install a World package version compatible with the current Workflow runtime.`);
|
|
91665
|
+
}
|
|
91255
91666
|
const WorldCacheKey = Symbol.for("@workflow/world//cache");
|
|
91256
91667
|
const WorldCachePromiseKey = Symbol.for("@workflow/world//cachePromise");
|
|
91257
91668
|
const GetWorldFnKey$1 = Symbol.for("@workflow/world//getWorldFn");
|
|
91258
91669
|
async function getWorldLazy() {
|
|
91259
91670
|
const g2 = globalThis;
|
|
91260
|
-
if (g2[WorldCacheKey])
|
|
91671
|
+
if (g2[WorldCacheKey]) {
|
|
91672
|
+
assertWorldSupportsRuntimeProtocol(g2[WorldCacheKey]);
|
|
91261
91673
|
return g2[WorldCacheKey];
|
|
91674
|
+
}
|
|
91262
91675
|
if (g2[WorldCachePromiseKey]) {
|
|
91263
91676
|
g2[WorldCacheKey] = await g2[WorldCachePromiseKey];
|
|
91677
|
+
assertWorldSupportsRuntimeProtocol(g2[WorldCacheKey]);
|
|
91264
91678
|
return g2[WorldCacheKey];
|
|
91265
91679
|
}
|
|
91266
91680
|
const getWorldFn = g2[GetWorldFnKey$1];
|
|
91267
|
-
if (getWorldFn)
|
|
91268
|
-
|
|
91681
|
+
if (getWorldFn) {
|
|
91682
|
+
const world = await getWorldFn();
|
|
91683
|
+
assertWorldSupportsRuntimeProtocol(world);
|
|
91684
|
+
return world;
|
|
91685
|
+
}
|
|
91269
91686
|
const worldPath = ["./world", "js"].join(".");
|
|
91270
91687
|
const { getWorld: getWorld2 } = await import(worldPath);
|
|
91271
91688
|
return getWorld2();
|
|
@@ -91390,6 +91807,10 @@ async function healthCheck(world, endpoint, options) {
|
|
|
91390
91807
|
}
|
|
91391
91808
|
}
|
|
91392
91809
|
const LOCK_POLL_INTERVAL_MS = 10;
|
|
91810
|
+
const getLockPollIntervalMs = () => envNumber("WORKFLOW_LOCK_POLL_INTERVAL_MS", LOCK_POLL_INTERVAL_MS, {
|
|
91811
|
+
integer: true,
|
|
91812
|
+
min: 1
|
|
91813
|
+
});
|
|
91393
91814
|
function createFlushableState() {
|
|
91394
91815
|
const state = {
|
|
91395
91816
|
...withResolvers$1(),
|
|
@@ -91449,7 +91870,7 @@ function pollWritableLock(writable, state) {
|
|
|
91449
91870
|
clearInterval(intervalId);
|
|
91450
91871
|
state.writablePollingInterval = void 0;
|
|
91451
91872
|
}
|
|
91452
|
-
},
|
|
91873
|
+
}, getLockPollIntervalMs());
|
|
91453
91874
|
state.writablePollingInterval = intervalId;
|
|
91454
91875
|
}
|
|
91455
91876
|
function pollReadableLock(readable2, state) {
|
|
@@ -91468,7 +91889,7 @@ function pollReadableLock(readable2, state) {
|
|
|
91468
91889
|
clearInterval(intervalId);
|
|
91469
91890
|
state.readablePollingInterval = void 0;
|
|
91470
91891
|
}
|
|
91471
|
-
},
|
|
91892
|
+
}, getLockPollIntervalMs());
|
|
91472
91893
|
state.readablePollingInterval = intervalId;
|
|
91473
91894
|
}
|
|
91474
91895
|
async function flushablePipe(source, sink, state) {
|
|
@@ -92134,25 +92555,25 @@ const devalueCodec = {
|
|
|
92134
92555
|
return unflatten(data, revivers);
|
|
92135
92556
|
}
|
|
92136
92557
|
};
|
|
92137
|
-
const FORMAT_PREFIX_LENGTH = 4;
|
|
92558
|
+
const FORMAT_PREFIX_LENGTH$1 = 4;
|
|
92138
92559
|
const formatEncoder = new TextEncoder();
|
|
92139
|
-
const formatDecoder = new TextDecoder();
|
|
92560
|
+
const formatDecoder$1 = new TextDecoder();
|
|
92140
92561
|
function encodeWithFormatPrefix(format2, payload) {
|
|
92141
92562
|
if (!(payload instanceof Uint8Array)) {
|
|
92142
92563
|
return payload;
|
|
92143
92564
|
}
|
|
92144
92565
|
const prefixBytes = formatEncoder.encode(format2);
|
|
92145
|
-
const result = new Uint8Array(FORMAT_PREFIX_LENGTH + payload.length);
|
|
92566
|
+
const result = new Uint8Array(FORMAT_PREFIX_LENGTH$1 + payload.length);
|
|
92146
92567
|
result.set(prefixBytes, 0);
|
|
92147
|
-
result.set(payload, FORMAT_PREFIX_LENGTH);
|
|
92568
|
+
result.set(payload, FORMAT_PREFIX_LENGTH$1);
|
|
92148
92569
|
return result;
|
|
92149
92570
|
}
|
|
92150
|
-
function peekFormatPrefix(data) {
|
|
92151
|
-
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH) {
|
|
92571
|
+
function peekFormatPrefix$1(data) {
|
|
92572
|
+
if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH$1) {
|
|
92152
92573
|
return null;
|
|
92153
92574
|
}
|
|
92154
|
-
const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH);
|
|
92155
|
-
const str = formatDecoder.decode(prefixBytes);
|
|
92575
|
+
const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH$1);
|
|
92576
|
+
const str = formatDecoder$1.decode(prefixBytes);
|
|
92156
92577
|
return isFormatPrefix(str) ? str : null;
|
|
92157
92578
|
}
|
|
92158
92579
|
function decodeFormatPrefix(data) {
|
|
@@ -92162,15 +92583,15 @@ function decodeFormatPrefix(data) {
|
|
|
92162
92583
|
payload: new TextEncoder().encode(JSON.stringify(data))
|
|
92163
92584
|
};
|
|
92164
92585
|
}
|
|
92165
|
-
if (data.length < FORMAT_PREFIX_LENGTH) {
|
|
92166
|
-
throw new Error(`Data too short to contain format prefix: expected at least ${FORMAT_PREFIX_LENGTH} bytes, got ${data.length}`);
|
|
92586
|
+
if (data.length < FORMAT_PREFIX_LENGTH$1) {
|
|
92587
|
+
throw new Error(`Data too short to contain format prefix: expected at least ${FORMAT_PREFIX_LENGTH$1} bytes, got ${data.length}`);
|
|
92167
92588
|
}
|
|
92168
|
-
const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH);
|
|
92169
|
-
const str = formatDecoder.decode(prefixBytes);
|
|
92589
|
+
const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH$1);
|
|
92590
|
+
const str = formatDecoder$1.decode(prefixBytes);
|
|
92170
92591
|
if (!isFormatPrefix(str)) {
|
|
92171
92592
|
throw new Error(`Invalid format prefix: "${str}". Must be 4 characters of [a-z0-9].`);
|
|
92172
92593
|
}
|
|
92173
|
-
const payload = data.subarray(FORMAT_PREFIX_LENGTH);
|
|
92594
|
+
const payload = data.subarray(FORMAT_PREFIX_LENGTH$1);
|
|
92174
92595
|
return { format: str, payload };
|
|
92175
92596
|
}
|
|
92176
92597
|
const COMPRESSION_MIN_BYTES = 1024;
|
|
@@ -92193,7 +92614,7 @@ function codecOverrideFromEnv() {
|
|
|
92193
92614
|
return void 0;
|
|
92194
92615
|
}
|
|
92195
92616
|
}
|
|
92196
|
-
function getNodeZlib() {
|
|
92617
|
+
function getNodeZlib$1() {
|
|
92197
92618
|
var _a3, _b2;
|
|
92198
92619
|
try {
|
|
92199
92620
|
return (_b2 = (_a3 = globalThis.process) == null ? void 0 : _a3.getBuiltinModule) == null ? void 0 : _b2.call(_a3, "node:zlib");
|
|
@@ -92202,7 +92623,7 @@ function getNodeZlib() {
|
|
|
92202
92623
|
}
|
|
92203
92624
|
}
|
|
92204
92625
|
function isZstdAvailable() {
|
|
92205
|
-
const z2 = getNodeZlib();
|
|
92626
|
+
const z2 = getNodeZlib$1();
|
|
92206
92627
|
return typeof (z2 == null ? void 0 : z2.zstdCompressSync) === "function" && typeof (z2 == null ? void 0 : z2.zstdDecompressSync) === "function";
|
|
92207
92628
|
}
|
|
92208
92629
|
function isGzipAvailable() {
|
|
@@ -92240,13 +92661,13 @@ async function gunzipBytes(data) {
|
|
|
92240
92661
|
}
|
|
92241
92662
|
function zstdBytes(data) {
|
|
92242
92663
|
var _a3;
|
|
92243
|
-
const z2 = getNodeZlib();
|
|
92664
|
+
const z2 = getNodeZlib$1();
|
|
92244
92665
|
const level = (_a3 = z2 == null ? void 0 : z2.constants) == null ? void 0 : _a3.ZSTD_c_compressionLevel;
|
|
92245
92666
|
const opts = level !== void 0 ? { params: { [level]: ZSTD_LEVEL } } : void 0;
|
|
92246
92667
|
return new Uint8Array(z2.zstdCompressSync(data, opts));
|
|
92247
92668
|
}
|
|
92248
92669
|
function unzstdBytes(data) {
|
|
92249
|
-
const z2 = getNodeZlib();
|
|
92670
|
+
const z2 = getNodeZlib$1();
|
|
92250
92671
|
if (!(z2 == null ? void 0 : z2.zstdDecompressSync)) {
|
|
92251
92672
|
throw new Error("Compressed (zstd) workflow data encountered but node:zlib zstd support is not available in this runtime (requires Node.js 22.15+). In the browser, register a zstd decoder via registerZstdDecoder (serialization-format.ts).");
|
|
92252
92673
|
}
|
|
@@ -92293,10 +92714,10 @@ async function compress(data, enabled, stats2) {
|
|
|
92293
92714
|
recordStats(stats2, codec2, data.length, wrappedLength);
|
|
92294
92715
|
return encodeWithFormatPrefix(format2, compressed);
|
|
92295
92716
|
}
|
|
92296
|
-
async function decompress$
|
|
92717
|
+
async function decompress$2(data, stats2) {
|
|
92297
92718
|
if (!(data instanceof Uint8Array))
|
|
92298
92719
|
return data;
|
|
92299
|
-
const prefix = peekFormatPrefix(data);
|
|
92720
|
+
const prefix = peekFormatPrefix$1(data);
|
|
92300
92721
|
if (prefix === SerializationFormat.ZSTD) {
|
|
92301
92722
|
const { payload } = decodeFormatPrefix(data);
|
|
92302
92723
|
const inflated = unzstdBytes(payload);
|
|
@@ -92327,7 +92748,7 @@ async function encrypt(data, key) {
|
|
|
92327
92748
|
async function decrypt(data, key) {
|
|
92328
92749
|
if (!(data instanceof Uint8Array))
|
|
92329
92750
|
return data;
|
|
92330
|
-
const format2 = peekFormatPrefix(data);
|
|
92751
|
+
const format2 = peekFormatPrefix$1(data);
|
|
92331
92752
|
if (format2 === SerializationFormat.ENCRYPTED && !key) {
|
|
92332
92753
|
throw new RuntimeDecryptionError("Encrypted data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.", {
|
|
92333
92754
|
context: {
|
|
@@ -92382,7 +92803,7 @@ async function serialize$1(value, encryptionKey, options) {
|
|
|
92382
92803
|
}
|
|
92383
92804
|
}
|
|
92384
92805
|
async function deserialize$2(data, encryptionKey, options) {
|
|
92385
|
-
const decrypted = await decompress$
|
|
92806
|
+
const decrypted = await decompress$2(await decrypt(data, encryptionKey), options == null ? void 0 : options.compressionStats);
|
|
92386
92807
|
if (!(decrypted instanceof Uint8Array)) {
|
|
92387
92808
|
if (devalueCodec.deserializeLegacy) {
|
|
92388
92809
|
return devalueCodec.deserializeLegacy(decrypted, "client", options);
|
|
@@ -92408,7 +92829,7 @@ async function serialize(value, encryptionKey, options) {
|
|
|
92408
92829
|
}
|
|
92409
92830
|
}
|
|
92410
92831
|
async function deserialize$1(data, encryptionKey, options) {
|
|
92411
|
-
const decrypted = await decompress$
|
|
92832
|
+
const decrypted = await decompress$2(await decrypt(data, encryptionKey), options == null ? void 0 : options.compressionStats);
|
|
92412
92833
|
if (!(decrypted instanceof Uint8Array)) {
|
|
92413
92834
|
if (devalueCodec.deserializeLegacy) {
|
|
92414
92835
|
return devalueCodec.deserializeLegacy(decrypted, "step", options);
|
|
@@ -92757,7 +93178,12 @@ class WorkflowServerReadableStream extends ReadableStream {
|
|
|
92757
93178
|
}
|
|
92758
93179
|
_reader = new WeakMap();
|
|
92759
93180
|
const FRAMED_STREAM_MAX_RECONNECTS = 50;
|
|
93181
|
+
const getFramedStreamMaxReconnects = () => envNumber("WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS", FRAMED_STREAM_MAX_RECONNECTS, {
|
|
93182
|
+
integer: true,
|
|
93183
|
+
min: 1
|
|
93184
|
+
});
|
|
92760
93185
|
const FRAMED_STREAM_MAX_TOTAL_RECONNECTS = 1e3;
|
|
93186
|
+
const getFramedStreamMaxTotalReconnects = () => envNumber("WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS", FRAMED_STREAM_MAX_TOTAL_RECONNECTS, { integer: true, min: 1 });
|
|
92761
93187
|
function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
92762
93188
|
const reconnectSupported = startIndex === void 0 || startIndex >= 0;
|
|
92763
93189
|
let currentStartIndex = startIndex ?? 0;
|
|
@@ -92781,14 +93207,16 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
92781
93207
|
currentStartIndex += consumedFrames;
|
|
92782
93208
|
consumedFrames = 0;
|
|
92783
93209
|
buffer2 = new Uint8Array(0);
|
|
93210
|
+
const maxReconnects = getFramedStreamMaxReconnects();
|
|
93211
|
+
const maxTotalReconnects = getFramedStreamMaxTotalReconnects();
|
|
92784
93212
|
for (; ; ) {
|
|
92785
93213
|
reconnectCount++;
|
|
92786
93214
|
totalReconnectCount++;
|
|
92787
|
-
if (reconnectCount >
|
|
92788
|
-
throw new Error(`Stream "${name2}" exceeded maximum reconnection attempts (${
|
|
93215
|
+
if (reconnectCount > maxReconnects) {
|
|
93216
|
+
throw new Error(`Stream "${name2}" exceeded maximum reconnection attempts (${maxReconnects})`);
|
|
92789
93217
|
}
|
|
92790
|
-
if (totalReconnectCount >
|
|
92791
|
-
throw new Error(`Stream "${name2}" exceeded maximum total reconnection attempts (${
|
|
93218
|
+
if (totalReconnectCount > maxTotalReconnects) {
|
|
93219
|
+
throw new Error(`Stream "${name2}" exceeded maximum total reconnection attempts (${maxTotalReconnects})`);
|
|
92792
93220
|
}
|
|
92793
93221
|
try {
|
|
92794
93222
|
await connect2();
|
|
@@ -92864,6 +93292,9 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
92864
93292
|
});
|
|
92865
93293
|
}
|
|
92866
93294
|
const STREAM_FLUSH_INTERVAL_MS = 10;
|
|
93295
|
+
const getStreamFlushIntervalMs = () => envNumber("WORKFLOW_STREAM_FLUSH_INTERVAL_MS", STREAM_FLUSH_INTERVAL_MS, {
|
|
93296
|
+
integer: true
|
|
93297
|
+
});
|
|
92867
93298
|
class WorkflowServerWritableStream extends WritableStream {
|
|
92868
93299
|
/**
|
|
92869
93300
|
* @param runReadyBarrier Turbo mode only: a promise that resolves once the
|
|
@@ -92907,7 +93338,7 @@ class WorkflowServerWritableStream extends WritableStream {
|
|
|
92907
93338
|
const chunksToFlush = buffer2.slice();
|
|
92908
93339
|
const world = await worldPromise;
|
|
92909
93340
|
if (resolvedFlushIntervalMs === void 0) {
|
|
92910
|
-
resolvedFlushIntervalMs = world.streamFlushIntervalMs ??
|
|
93341
|
+
resolvedFlushIntervalMs = world.streamFlushIntervalMs ?? getStreamFlushIntervalMs();
|
|
92911
93342
|
}
|
|
92912
93343
|
if (typeof world.streams.writeMulti === "function" && chunksToFlush.length > 1) {
|
|
92913
93344
|
await world.streams.writeMulti(runId, name2, chunksToFlush);
|
|
@@ -92933,7 +93364,7 @@ class WorkflowServerWritableStream extends WritableStream {
|
|
|
92933
93364
|
for (const w2 of currentWaiters)
|
|
92934
93365
|
w2.reject(err);
|
|
92935
93366
|
});
|
|
92936
|
-
}, resolvedFlushIntervalMs ??
|
|
93367
|
+
}, resolvedFlushIntervalMs ?? getStreamFlushIntervalMs());
|
|
92937
93368
|
};
|
|
92938
93369
|
super({
|
|
92939
93370
|
async write(chunk) {
|
|
@@ -93777,7 +94208,7 @@ async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 =
|
|
|
93777
94208
|
}
|
|
93778
94209
|
async function hydrateWorkflowArguments(value, _runId, key, global2 = globalThis, extraRevivers = {}) {
|
|
93779
94210
|
const compressionStats = {};
|
|
93780
|
-
const inflated = await decompress$
|
|
94211
|
+
const inflated = await decompress$2(await maybeDecrypt(value, key), compressionStats);
|
|
93781
94212
|
await recordCompression(compressionStats, "deserialize");
|
|
93782
94213
|
return deserialize(inflated, {
|
|
93783
94214
|
global: global2,
|
|
@@ -93857,7 +94288,7 @@ async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = g
|
|
|
93857
94288
|
}
|
|
93858
94289
|
async function hydrateRunError(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}) {
|
|
93859
94290
|
const compressionStats = {};
|
|
93860
|
-
const decrypted = await decompress$
|
|
94291
|
+
const decrypted = await decompress$2(await maybeDecrypt(value, key), compressionStats);
|
|
93861
94292
|
await recordCompression(compressionStats, "deserialize");
|
|
93862
94293
|
if (!(decrypted instanceof Uint8Array)) {
|
|
93863
94294
|
return unflatten(decrypted, {
|
|
@@ -93906,6 +94337,37 @@ function getStreamAndRequestRevivers(allRevivers) {
|
|
|
93906
94337
|
}
|
|
93907
94338
|
return extra;
|
|
93908
94339
|
}
|
|
94340
|
+
function parsePort$2(value, radix = 10) {
|
|
94341
|
+
const port = parseInt(value, radix);
|
|
94342
|
+
if (!Number.isNaN(port) && port >= 0 && port <= 65535) {
|
|
94343
|
+
return port;
|
|
94344
|
+
}
|
|
94345
|
+
return void 0;
|
|
94346
|
+
}
|
|
94347
|
+
function parseWindowsNetstatPortsForPid(stdout, pid) {
|
|
94348
|
+
var _a3;
|
|
94349
|
+
const ports = [];
|
|
94350
|
+
const lines = stdout.trim().split("\n");
|
|
94351
|
+
for (const line of lines) {
|
|
94352
|
+
const parts = line.trim().split(/\s+/);
|
|
94353
|
+
if (parts.length < 5 || ((_a3 = parts[0]) == null ? void 0 : _a3.toUpperCase()) !== "TCP") {
|
|
94354
|
+
continue;
|
|
94355
|
+
}
|
|
94356
|
+
const [, localAddress, , state, rowPid] = parts;
|
|
94357
|
+
if ((state == null ? void 0 : state.toUpperCase()) !== "LISTENING" || rowPid !== pid.toString()) {
|
|
94358
|
+
continue;
|
|
94359
|
+
}
|
|
94360
|
+
const colonIndex = localAddress.lastIndexOf(":");
|
|
94361
|
+
if (colonIndex === -1) {
|
|
94362
|
+
continue;
|
|
94363
|
+
}
|
|
94364
|
+
const port = parsePort$2(localAddress.slice(colonIndex + 1));
|
|
94365
|
+
if (port !== void 0) {
|
|
94366
|
+
ports.push(port);
|
|
94367
|
+
}
|
|
94368
|
+
}
|
|
94369
|
+
return ports;
|
|
94370
|
+
}
|
|
93909
94371
|
const execFileAsync = promisify(execFile);
|
|
93910
94372
|
function parsePort$1(value, radix = 10) {
|
|
93911
94373
|
const port = parseInt(value, radix);
|
|
@@ -94023,23 +94485,9 @@ async function getWindowsPorts(pid) {
|
|
|
94023
94485
|
try {
|
|
94024
94486
|
const { stdout } = await execFileAsync("cmd", [
|
|
94025
94487
|
"/c",
|
|
94026
|
-
|
|
94488
|
+
"netstat -ano -p tcp | findstr LISTENING"
|
|
94027
94489
|
]);
|
|
94028
|
-
|
|
94029
|
-
const trimmedOutput = stdout.trim();
|
|
94030
|
-
if (trimmedOutput) {
|
|
94031
|
-
const lines = trimmedOutput.split("\n");
|
|
94032
|
-
for (const line of lines) {
|
|
94033
|
-
const match2 = line.trim().match(/^\s*TCP\s+(?:\[[\da-f:]+\]|[\d.]+):(\d+)\s+/i);
|
|
94034
|
-
if (match2) {
|
|
94035
|
-
const port = parsePort$1(match2[1]);
|
|
94036
|
-
if (port !== void 0) {
|
|
94037
|
-
ports.push(port);
|
|
94038
|
-
}
|
|
94039
|
-
}
|
|
94040
|
-
}
|
|
94041
|
-
}
|
|
94042
|
-
return ports;
|
|
94490
|
+
return parseWindowsNetstatPortsForPid(stdout, pid);
|
|
94043
94491
|
} catch {
|
|
94044
94492
|
return [];
|
|
94045
94493
|
}
|
|
@@ -94192,8 +94640,10 @@ async function withWindowsRetry(fn2, maxRetries = 5) {
|
|
|
94192
94640
|
throw new Error("Retry loop exited unexpectedly");
|
|
94193
94641
|
}
|
|
94194
94642
|
const createdFilesCache = /* @__PURE__ */ new Set();
|
|
94643
|
+
const createdDirectoriesCache = /* @__PURE__ */ new Set();
|
|
94195
94644
|
function clearCreatedFilesCache() {
|
|
94196
94645
|
createdFilesCache.clear();
|
|
94646
|
+
createdDirectoriesCache.clear();
|
|
94197
94647
|
}
|
|
94198
94648
|
const TAG_PATTERN = /\.[a-zA-Z][a-zA-Z0-9-]*$/;
|
|
94199
94649
|
function stripTag(fileId) {
|
|
@@ -94246,11 +94696,29 @@ async function listTaggedFilesByExtension(dirPath, tag, extension2) {
|
|
|
94246
94696
|
}
|
|
94247
94697
|
}
|
|
94248
94698
|
async function ensureDir(dirPath) {
|
|
94699
|
+
const resolvedPath = path$3.resolve(dirPath);
|
|
94700
|
+
if (createdDirectoriesCache.has(resolvedPath)) {
|
|
94701
|
+
return;
|
|
94702
|
+
}
|
|
94249
94703
|
try {
|
|
94250
|
-
await promises.mkdir(
|
|
94704
|
+
await promises.mkdir(resolvedPath, { recursive: true });
|
|
94705
|
+
createdDirectoriesCache.add(resolvedPath);
|
|
94251
94706
|
} catch (_error) {
|
|
94252
94707
|
}
|
|
94253
94708
|
}
|
|
94709
|
+
async function withEnsuredDirectory(dirPath, operation) {
|
|
94710
|
+
await ensureDir(dirPath);
|
|
94711
|
+
try {
|
|
94712
|
+
return await operation();
|
|
94713
|
+
} catch (error2) {
|
|
94714
|
+
if (error2.code !== "ENOENT") {
|
|
94715
|
+
throw error2;
|
|
94716
|
+
}
|
|
94717
|
+
createdDirectoriesCache.delete(path$3.resolve(dirPath));
|
|
94718
|
+
await ensureDir(dirPath);
|
|
94719
|
+
return operation();
|
|
94720
|
+
}
|
|
94721
|
+
}
|
|
94254
94722
|
function jsonReplacer(_key, value) {
|
|
94255
94723
|
if (value instanceof Uint8Array) {
|
|
94256
94724
|
return {
|
|
@@ -94287,10 +94755,11 @@ async function write(filePath, data, opts) {
|
|
|
94287
94755
|
const tempPath = `${filePath}.tmp.${ulid$1()}`;
|
|
94288
94756
|
let tempFileCreated = false;
|
|
94289
94757
|
try {
|
|
94290
|
-
await
|
|
94291
|
-
|
|
94292
|
-
|
|
94293
|
-
|
|
94758
|
+
await withEnsuredDirectory(path$3.dirname(filePath), async () => {
|
|
94759
|
+
await promises.writeFile(tempPath, data);
|
|
94760
|
+
tempFileCreated = true;
|
|
94761
|
+
await withWindowsRetry(() => promises.rename(tempPath, filePath));
|
|
94762
|
+
});
|
|
94294
94763
|
createdFilesCache.add(filePath);
|
|
94295
94764
|
} catch (error2) {
|
|
94296
94765
|
if (tempFileCreated) {
|
|
@@ -94333,21 +94802,22 @@ async function deleteJSON(filePath) {
|
|
|
94333
94802
|
}
|
|
94334
94803
|
}
|
|
94335
94804
|
async function writeExclusive(filePath, data) {
|
|
94336
|
-
await ensureDir(path$3.dirname(filePath));
|
|
94337
94805
|
const tempPath = `${filePath}.tmp.${ulid$1()}`;
|
|
94338
94806
|
let tempFileCreated = false;
|
|
94339
94807
|
try {
|
|
94340
|
-
await
|
|
94341
|
-
|
|
94342
|
-
|
|
94343
|
-
|
|
94344
|
-
|
|
94345
|
-
|
|
94346
|
-
|
|
94347
|
-
|
|
94808
|
+
return await withEnsuredDirectory(path$3.dirname(filePath), async () => {
|
|
94809
|
+
await promises.writeFile(tempPath, data, { flag: "wx" });
|
|
94810
|
+
tempFileCreated = true;
|
|
94811
|
+
try {
|
|
94812
|
+
await withWindowsRetry(() => promises.link(tempPath, filePath));
|
|
94813
|
+
return true;
|
|
94814
|
+
} catch (error2) {
|
|
94815
|
+
if (error2.code === "EEXIST") {
|
|
94816
|
+
return false;
|
|
94817
|
+
}
|
|
94818
|
+
throw error2;
|
|
94348
94819
|
}
|
|
94349
|
-
|
|
94350
|
-
}
|
|
94820
|
+
});
|
|
94351
94821
|
} finally {
|
|
94352
94822
|
if (tempFileCreated) {
|
|
94353
94823
|
await withWindowsRetry(() => promises.unlink(tempPath), 3).catch(() => {
|
|
@@ -94381,11 +94851,12 @@ function createCursor(timestamp, id2) {
|
|
|
94381
94851
|
return id2 ? `${timestamp.toISOString()}|${id2}` : timestamp.toISOString();
|
|
94382
94852
|
}
|
|
94383
94853
|
async function paginatedFileSystemQuery(config2) {
|
|
94384
|
-
const { directory, schema, filePrefix, fileIdFilter, filter: filter2, sortOrder = "desc", limit = 20, cursor, getCreatedAt, getId } = config2;
|
|
94854
|
+
const { directory, schema, cachedItems, filePrefix, fileIdFilter, filter: filter2, sortOrder = "desc", limit = 20, cursor, getCreatedAt, getId } = config2;
|
|
94385
94855
|
if (filePrefix !== void 0) {
|
|
94386
94856
|
assertSafeEntityId("filePrefix", filePrefix);
|
|
94387
94857
|
}
|
|
94388
|
-
const
|
|
94858
|
+
const resolvedDirectory = path$3.resolve(directory);
|
|
94859
|
+
const fileIds = await listJSONFiles(resolvedDirectory);
|
|
94389
94860
|
const relevantFileIds = filePrefix ? fileIds.filter((fileId) => fileId.startsWith(filePrefix)) : fileIds;
|
|
94390
94861
|
const filteredFileIds = fileIdFilter ? relevantFileIds.filter(fileIdFilter) : relevantFileIds;
|
|
94391
94862
|
const parsedCursor = parseCursor(cursor);
|
|
@@ -94407,10 +94878,11 @@ async function paginatedFileSystemQuery(config2) {
|
|
|
94407
94878
|
}
|
|
94408
94879
|
const validItems = [];
|
|
94409
94880
|
for (const fileId of candidateFileIds) {
|
|
94410
|
-
const filePath = path$3.join(
|
|
94881
|
+
const filePath = path$3.join(resolvedDirectory, `${fileId}.json`);
|
|
94411
94882
|
let item = null;
|
|
94412
94883
|
try {
|
|
94413
|
-
|
|
94884
|
+
const cachedItem = cachedItems == null ? void 0 : cachedItems.get(filePath);
|
|
94885
|
+
item = cachedItem === void 0 ? await readJSON(filePath, schema) : structuredClone(cachedItem);
|
|
94414
94886
|
} catch (error2) {
|
|
94415
94887
|
if (error2 instanceof ZodError) {
|
|
94416
94888
|
console.warn(`Skipping item ${fileId} due to malformed JSON: ${error2.message}`);
|
|
@@ -112194,11 +112666,11 @@ function requireCache$1() {
|
|
|
112194
112666
|
};
|
|
112195
112667
|
return cache$1;
|
|
112196
112668
|
}
|
|
112197
|
-
var decompress;
|
|
112669
|
+
var decompress$1;
|
|
112198
112670
|
var hasRequiredDecompress;
|
|
112199
112671
|
function requireDecompress() {
|
|
112200
112672
|
var _decompressors, _skipStatusCodes, _skipErrorResponses, _DecompressHandler_instances, shouldSkipDecompression_fn, createDecompressionChain_fn, setupDecompressorEvents_fn, setupSingleDecompressor_fn, setupMultipleDecompressors_fn, cleanupDecompressors_fn;
|
|
112201
|
-
if (hasRequiredDecompress) return decompress;
|
|
112673
|
+
if (hasRequiredDecompress) return decompress$1;
|
|
112202
112674
|
hasRequiredDecompress = 1;
|
|
112203
112675
|
const { createInflate, createGunzip, createBrotliDecompress, createZstdDecompress } = require$$3$1;
|
|
112204
112676
|
const { pipeline } = require$$0$4;
|
|
@@ -112412,8 +112884,8 @@ function requireDecompress() {
|
|
|
112412
112884
|
};
|
|
112413
112885
|
};
|
|
112414
112886
|
}
|
|
112415
|
-
decompress = createDecompressInterceptor;
|
|
112416
|
-
return decompress;
|
|
112887
|
+
decompress$1 = createDecompressInterceptor;
|
|
112888
|
+
return decompress$1;
|
|
112417
112889
|
}
|
|
112418
112890
|
var deduplicationHandler;
|
|
112419
112891
|
var hasRequiredDeduplicationHandler;
|
|
@@ -120652,6 +121124,102 @@ function filterHookData$1(hook, resolveData) {
|
|
|
120652
121124
|
}
|
|
120653
121125
|
return hook;
|
|
120654
121126
|
}
|
|
121127
|
+
function isVisibleToTag(fileId, tag) {
|
|
121128
|
+
return tag ? isUntagged(fileId) || hasTag(fileId, tag) : isUntagged(fileId);
|
|
121129
|
+
}
|
|
121130
|
+
function getHookCreatedToken(event) {
|
|
121131
|
+
if (event.eventType !== "hook_created")
|
|
121132
|
+
return void 0;
|
|
121133
|
+
const token = event.eventData.token;
|
|
121134
|
+
return typeof token === "string" ? token : void 0;
|
|
121135
|
+
}
|
|
121136
|
+
function hookFromCreatedEvent(event) {
|
|
121137
|
+
const { token, metadata, isWebhook, isSystem } = event.eventData;
|
|
121138
|
+
return {
|
|
121139
|
+
runId: event.runId,
|
|
121140
|
+
hookId: event.correlationId,
|
|
121141
|
+
token,
|
|
121142
|
+
metadata,
|
|
121143
|
+
ownerId: "local-owner",
|
|
121144
|
+
projectId: "local-project",
|
|
121145
|
+
environment: "local",
|
|
121146
|
+
createdAt: event.createdAt,
|
|
121147
|
+
specVersion: event.specVersion,
|
|
121148
|
+
isWebhook: isWebhook ?? true,
|
|
121149
|
+
isSystem: isSystem ?? false
|
|
121150
|
+
};
|
|
121151
|
+
}
|
|
121152
|
+
function isMatchingHookCreatedEvent(event, matches) {
|
|
121153
|
+
return event.eventType === "hook_created" && typeof event.correlationId === "string" && matches(event);
|
|
121154
|
+
}
|
|
121155
|
+
function closesLiveHook(event, liveEvent) {
|
|
121156
|
+
if (event.runId !== liveEvent.runId)
|
|
121157
|
+
return false;
|
|
121158
|
+
return event.eventType === "hook_disposed" && event.correlationId === liveEvent.correlationId || isTerminalRunEventType(event.eventType);
|
|
121159
|
+
}
|
|
121160
|
+
async function readEventForHookScan(filePath) {
|
|
121161
|
+
try {
|
|
121162
|
+
return await readJSON(filePath, EventSchema);
|
|
121163
|
+
} catch (error2) {
|
|
121164
|
+
if (error2 instanceof SyntaxError || error2 instanceof ZodError) {
|
|
121165
|
+
return null;
|
|
121166
|
+
}
|
|
121167
|
+
throw error2;
|
|
121168
|
+
}
|
|
121169
|
+
}
|
|
121170
|
+
async function isTerminalRunCache(basedir, runId, tag) {
|
|
121171
|
+
const run2 = await readJSONWithFallback(basedir, "runs", runId, WorkflowRunSchema, tag);
|
|
121172
|
+
return run2 ? isTerminalWorkflowRunStatus(run2.status) : false;
|
|
121173
|
+
}
|
|
121174
|
+
async function findLiveHookCreatedEvent(basedir, matches, tag) {
|
|
121175
|
+
const eventsDir = path$3.join(basedir, "events");
|
|
121176
|
+
const events2 = [];
|
|
121177
|
+
for (const fileId of await listJSONFiles(eventsDir)) {
|
|
121178
|
+
if (!isVisibleToTag(fileId, tag))
|
|
121179
|
+
continue;
|
|
121180
|
+
const event = await readEventForHookScan(path$3.join(eventsDir, `${fileId}.json`));
|
|
121181
|
+
if (event)
|
|
121182
|
+
events2.push(event);
|
|
121183
|
+
}
|
|
121184
|
+
events2.sort((a2, b2) => {
|
|
121185
|
+
const byTime = a2.createdAt.getTime() - b2.createdAt.getTime();
|
|
121186
|
+
return byTime === 0 ? a2.eventId.localeCompare(b2.eventId) : byTime;
|
|
121187
|
+
});
|
|
121188
|
+
let liveEvent = null;
|
|
121189
|
+
for (const event of events2) {
|
|
121190
|
+
if (isMatchingHookCreatedEvent(event, matches)) {
|
|
121191
|
+
liveEvent = event;
|
|
121192
|
+
continue;
|
|
121193
|
+
}
|
|
121194
|
+
if (liveEvent && closesLiveHook(event, liveEvent)) {
|
|
121195
|
+
liveEvent = null;
|
|
121196
|
+
}
|
|
121197
|
+
}
|
|
121198
|
+
if (liveEvent && await isTerminalRunCache(basedir, liveEvent.runId, tag)) {
|
|
121199
|
+
return null;
|
|
121200
|
+
}
|
|
121201
|
+
return liveEvent;
|
|
121202
|
+
}
|
|
121203
|
+
async function restoreHookCachesFromEvent(basedir, event, tag) {
|
|
121204
|
+
const hook = hookFromCreatedEvent(event);
|
|
121205
|
+
const claimPath = path$3.join(basedir, "hooks", "tokens", `${hashToken(hook.token)}.json`);
|
|
121206
|
+
await writeExclusive(claimPath, JSON.stringify({
|
|
121207
|
+
token: hook.token,
|
|
121208
|
+
hookId: hook.hookId,
|
|
121209
|
+
runId: hook.runId,
|
|
121210
|
+
eventId: event.eventId
|
|
121211
|
+
}));
|
|
121212
|
+
await writeExclusive(taggedPath(basedir, "hooks", hook.hookId, tag), JSON.stringify(hook, jsonReplacer, 2));
|
|
121213
|
+
return hook;
|
|
121214
|
+
}
|
|
121215
|
+
async function rebuildLiveHookByTokenFromEventLog(basedir, token, tag) {
|
|
121216
|
+
const event = await findLiveHookCreatedEvent(basedir, (candidate) => getHookCreatedToken(candidate) === token, tag);
|
|
121217
|
+
return event ? restoreHookCachesFromEvent(basedir, event, tag) : null;
|
|
121218
|
+
}
|
|
121219
|
+
async function rebuildLiveHookByIdFromEventLog(basedir, hookId, tag) {
|
|
121220
|
+
const event = await findLiveHookCreatedEvent(basedir, (candidate) => candidate.correlationId === hookId, tag);
|
|
121221
|
+
return event ? restoreHookCachesFromEvent(basedir, event, tag) : null;
|
|
121222
|
+
}
|
|
120655
121223
|
function createHooksStorage(basedir, tag) {
|
|
120656
121224
|
async function findHookByToken(token) {
|
|
120657
121225
|
const hooksDir = path$3.join(basedir, "hooks");
|
|
@@ -120669,13 +121237,18 @@ function createHooksStorage(basedir, tag) {
|
|
|
120669
121237
|
assertSafeEntityId("hookId", hookId);
|
|
120670
121238
|
const hook = await readJSONWithFallback(basedir, "hooks", hookId, HookSchema, tag);
|
|
120671
121239
|
if (!hook) {
|
|
120672
|
-
|
|
121240
|
+
const rebuilt = await rebuildLiveHookByIdFromEventLog(basedir, hookId, tag);
|
|
121241
|
+
if (!rebuilt) {
|
|
121242
|
+
throw new HookNotFoundError(hookId);
|
|
121243
|
+
}
|
|
121244
|
+
const resolveData2 = (params == null ? void 0 : params.resolveData) || DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
121245
|
+
return filterHookData$1({ ...rebuilt, isWebhook: rebuilt.isWebhook ?? true }, resolveData2);
|
|
120673
121246
|
}
|
|
120674
121247
|
const resolveData = (params == null ? void 0 : params.resolveData) || DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
120675
121248
|
return filterHookData$1({ ...hook, isWebhook: hook.isWebhook ?? true }, resolveData);
|
|
120676
121249
|
}
|
|
120677
121250
|
async function getByToken(token) {
|
|
120678
|
-
const hook = await findHookByToken(token);
|
|
121251
|
+
const hook = await findHookByToken(token) ?? await rebuildLiveHookByTokenFromEventLog(basedir, token, tag);
|
|
120679
121252
|
if (!hook) {
|
|
120680
121253
|
throw new HookNotFoundError(token);
|
|
120681
121254
|
}
|
|
@@ -120951,7 +121524,7 @@ async function repairHookEntityFromPersistedEvent(basedir, runId, hookId, persis
|
|
|
120951
121524
|
environment: "local",
|
|
120952
121525
|
createdAt: persistedEvent.createdAt,
|
|
120953
121526
|
specVersion: persistedEvent.specVersion,
|
|
120954
|
-
isWebhook: eventData.isWebhook ??
|
|
121527
|
+
isWebhook: eventData.isWebhook ?? true,
|
|
120955
121528
|
isSystem: eventData.isSystem ?? false
|
|
120956
121529
|
};
|
|
120957
121530
|
await writeExclusive(taggedPath(basedir, "hooks", hookId, tag), JSON.stringify(hook, jsonReplacer, 2));
|
|
@@ -121009,9 +121582,76 @@ async function writeRunUnderLifecycleLock(basedir, runId, tag, proposed) {
|
|
|
121009
121582
|
});
|
|
121010
121583
|
}
|
|
121011
121584
|
function createEventsStorage(basedir, tag) {
|
|
121585
|
+
const maxCachedEventBytes = 4 * 1024 * 1024;
|
|
121586
|
+
const maxCachedEventEntries = 1e3;
|
|
121587
|
+
const eventCache = /* @__PURE__ */ new Map();
|
|
121588
|
+
const cachedEventBytes = /* @__PURE__ */ new Map();
|
|
121589
|
+
const cachedPathsByRunId = /* @__PURE__ */ new Map();
|
|
121590
|
+
let totalCachedEventBytes = 0;
|
|
121591
|
+
function deleteCachedEvent(eventPath) {
|
|
121592
|
+
const event = eventCache.get(eventPath);
|
|
121593
|
+
if (!event) {
|
|
121594
|
+
return;
|
|
121595
|
+
}
|
|
121596
|
+
eventCache.delete(eventPath);
|
|
121597
|
+
totalCachedEventBytes -= cachedEventBytes.get(eventPath) ?? 0;
|
|
121598
|
+
cachedEventBytes.delete(eventPath);
|
|
121599
|
+
const cachedPaths = cachedPathsByRunId.get(event.runId);
|
|
121600
|
+
cachedPaths == null ? void 0 : cachedPaths.delete(eventPath);
|
|
121601
|
+
if ((cachedPaths == null ? void 0 : cachedPaths.size) === 0) {
|
|
121602
|
+
cachedPathsByRunId.delete(event.runId);
|
|
121603
|
+
}
|
|
121604
|
+
}
|
|
121605
|
+
function clearRunCache(runId) {
|
|
121606
|
+
for (const cachedPath of cachedPathsByRunId.get(runId) ?? []) {
|
|
121607
|
+
deleteCachedEvent(cachedPath);
|
|
121608
|
+
}
|
|
121609
|
+
}
|
|
121610
|
+
function clearCache() {
|
|
121611
|
+
eventCache.clear();
|
|
121612
|
+
cachedEventBytes.clear();
|
|
121613
|
+
cachedPathsByRunId.clear();
|
|
121614
|
+
totalCachedEventBytes = 0;
|
|
121615
|
+
}
|
|
121616
|
+
function cacheEvent(eventPath, cachedEvent, serializedBytes) {
|
|
121617
|
+
if (serializedBytes > maxCachedEventBytes) {
|
|
121618
|
+
return;
|
|
121619
|
+
}
|
|
121620
|
+
while (eventCache.size > 0 && (eventCache.size >= maxCachedEventEntries || totalCachedEventBytes + serializedBytes > maxCachedEventBytes)) {
|
|
121621
|
+
const oldestPath = eventCache.keys().next().value;
|
|
121622
|
+
deleteCachedEvent(oldestPath);
|
|
121623
|
+
}
|
|
121624
|
+
eventCache.set(eventPath, cachedEvent);
|
|
121625
|
+
cachedEventBytes.set(eventPath, serializedBytes);
|
|
121626
|
+
totalCachedEventBytes += serializedBytes;
|
|
121627
|
+
const cachedPaths = cachedPathsByRunId.get(cachedEvent.runId) ?? /* @__PURE__ */ new Set();
|
|
121628
|
+
cachedPaths.add(eventPath);
|
|
121629
|
+
cachedPathsByRunId.set(cachedEvent.runId, cachedPaths);
|
|
121630
|
+
}
|
|
121631
|
+
function rememberStoredEvent(event, eventPath, serializedEvent) {
|
|
121632
|
+
if (isTerminalRunEventType(event.eventType)) {
|
|
121633
|
+
clearRunCache(event.runId);
|
|
121634
|
+
return;
|
|
121635
|
+
}
|
|
121636
|
+
const serializedBytes = Buffer.byteLength(serializedEvent);
|
|
121637
|
+
if (serializedBytes > maxCachedEventBytes) {
|
|
121638
|
+
return;
|
|
121639
|
+
}
|
|
121640
|
+
const cachedEvent = EventSchema.safeParse(JSON.parse(serializedEvent, jsonReviver));
|
|
121641
|
+
if (cachedEvent.success) {
|
|
121642
|
+
cacheEvent(eventPath, cachedEvent.data, serializedBytes);
|
|
121643
|
+
}
|
|
121644
|
+
}
|
|
121645
|
+
async function storeEvent(event) {
|
|
121646
|
+
const eventPath = taggedPath(basedir, "events", `${event.runId}-${event.eventId}`, tag);
|
|
121647
|
+
const serializedEvent = JSON.stringify(event, jsonReplacer, 2);
|
|
121648
|
+
await write(eventPath, serializedEvent);
|
|
121649
|
+
rememberStoredEvent(event, eventPath, serializedEvent);
|
|
121650
|
+
}
|
|
121012
121651
|
const stepLocks = /* @__PURE__ */ new Map();
|
|
121013
121652
|
const hookLocks = /* @__PURE__ */ new Map();
|
|
121014
121653
|
return {
|
|
121654
|
+
clearCache,
|
|
121015
121655
|
async create(runId, data, params) {
|
|
121016
121656
|
if (runId != null && runId !== "") {
|
|
121017
121657
|
assertSafeEntityId("runId", runId);
|
|
@@ -121047,8 +121687,6 @@ function createEventsStorage(basedir, tag) {
|
|
|
121047
121687
|
}
|
|
121048
121688
|
}
|
|
121049
121689
|
const effectiveSpecVersion = data.specVersion ?? SPEC_VERSION_CURRENT;
|
|
121050
|
-
const isRunTerminal = (status) => ["completed", "failed", "cancelled"].includes(status);
|
|
121051
|
-
const isStepTerminal = (status) => ["completed", "failed", "cancelled"].includes(status);
|
|
121052
121690
|
let currentRun = null;
|
|
121053
121691
|
const skipRunValidationEvents = ["step_completed", "step_retrying"];
|
|
121054
121692
|
if (data.eventType !== "run_created" && !skipRunValidationEvents.includes(data.eventType)) {
|
|
@@ -121094,8 +121732,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
121094
121732
|
allowReservedAttributes: runInputData.allowReservedAttributes
|
|
121095
121733
|
}
|
|
121096
121734
|
};
|
|
121097
|
-
|
|
121098
|
-
await writeJSON(taggedPath(basedir, "events", createdCompositeKey, tag), runCreatedEvent);
|
|
121735
|
+
await storeEvent(runCreatedEvent);
|
|
121099
121736
|
currentRun = createdRun;
|
|
121100
121737
|
} else {
|
|
121101
121738
|
currentRun = await readJSONWithFallback(basedir, "runs", effectiveRunId, WorkflowRunSchema, tag);
|
|
@@ -121118,7 +121755,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
121118
121755
|
}
|
|
121119
121756
|
}
|
|
121120
121757
|
const lazyStepStart = data.eventType === "step_started" && "eventData" in data && !!data.eventData && typeof data.eventData.stepName === "string" && data.eventData.input !== void 0;
|
|
121121
|
-
if (currentRun &&
|
|
121758
|
+
if (currentRun && isTerminalWorkflowRunStatus(currentRun.status)) {
|
|
121122
121759
|
const runTerminalEvents = [
|
|
121123
121760
|
"run_started",
|
|
121124
121761
|
"run_completed",
|
|
@@ -121132,8 +121769,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
121132
121769
|
createdAt: now2,
|
|
121133
121770
|
specVersion: effectiveSpecVersion
|
|
121134
121771
|
};
|
|
121135
|
-
|
|
121136
|
-
await writeJSON(taggedPath(basedir, "events", compositeKey2, tag), event2);
|
|
121772
|
+
await storeEvent(event2);
|
|
121137
121773
|
const resolveData2 = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
121138
121774
|
return {
|
|
121139
121775
|
event: stripEventDataRefs(event2, resolveData2),
|
|
@@ -121170,10 +121806,10 @@ function createEventsStorage(basedir, tag) {
|
|
|
121170
121806
|
throw new EntityConflictError(`Step "${data.correlationId}" already created`);
|
|
121171
121807
|
}
|
|
121172
121808
|
if (validatedStep) {
|
|
121173
|
-
if (
|
|
121809
|
+
if (isTerminalStepStatus(validatedStep.status)) {
|
|
121174
121810
|
throw new EntityConflictError(`Cannot modify step in terminal state "${validatedStep.status}"`);
|
|
121175
121811
|
}
|
|
121176
|
-
if (currentRun &&
|
|
121812
|
+
if (currentRun && isTerminalWorkflowRunStatus(currentRun.status)) {
|
|
121177
121813
|
if (validatedStep.status !== "running") {
|
|
121178
121814
|
throw new RunExpiredError(`Cannot modify non-running step on run in terminal state "${currentRun.status}"`);
|
|
121179
121815
|
}
|
|
@@ -121441,7 +122077,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
121441
122077
|
}
|
|
121442
122078
|
const stepCompositeKey = `${effectiveRunId}-${data.correlationId}`;
|
|
121443
122079
|
const freshStep = await readJSONWithFallback(basedir, "steps", stepCompositeKey, StepSchema, tag);
|
|
121444
|
-
if (freshStep &&
|
|
122080
|
+
if (freshStep && isTerminalStepStatus(freshStep.status)) {
|
|
121445
122081
|
throw new EntityConflictError(`Cannot modify step in terminal state "${freshStep.status}"`);
|
|
121446
122082
|
}
|
|
121447
122083
|
step = {
|
|
@@ -121514,6 +122150,9 @@ function createEventsStorage(basedir, tag) {
|
|
|
121514
122150
|
) {
|
|
121515
122151
|
const hookData = data.eventData;
|
|
121516
122152
|
const constraintPath = path$3.join(basedir, "hooks", "tokens", `${hashToken(hookData.token)}.json`);
|
|
122153
|
+
if (!await readHookTokenClaim(constraintPath)) {
|
|
122154
|
+
await rebuildLiveHookByTokenFromEventLog(basedir, hookData.token, tag);
|
|
122155
|
+
}
|
|
121517
122156
|
const tokenClaimed = await writeExclusive(constraintPath, JSON.stringify({
|
|
121518
122157
|
token: hookData.token,
|
|
121519
122158
|
hookId: data.correlationId,
|
|
@@ -121562,8 +122201,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
121562
122201
|
createdAt: now2,
|
|
121563
122202
|
specVersion: effectiveSpecVersion
|
|
121564
122203
|
};
|
|
121565
|
-
|
|
121566
|
-
await writeJSON(taggedPath(basedir, "events", compositeKey2, tag), conflictEvent);
|
|
122204
|
+
await storeEvent(conflictEvent);
|
|
121567
122205
|
const resolveData2 = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
121568
122206
|
const filteredEvent2 = stripEventDataRefs(conflictEvent, resolveData2);
|
|
121569
122207
|
return {
|
|
@@ -121650,13 +122288,16 @@ function createEventsStorage(basedir, tag) {
|
|
|
121650
122288
|
await writeJSON(taggedPath(basedir, "waits", waitCompositeKey, tag), wait, { overwrite: true });
|
|
121651
122289
|
}
|
|
121652
122290
|
const compositeKey = `${effectiveRunId}-${eventId}`;
|
|
121653
|
-
const
|
|
122291
|
+
const eventPath = taggedPath(basedir, "events", compositeKey, tag);
|
|
122292
|
+
const serializedEvent = JSON.stringify(event, jsonReplacer, 2);
|
|
122293
|
+
const eventPublished = await writeExclusive(eventPath, serializedEvent);
|
|
121654
122294
|
if (!eventPublished) {
|
|
121655
122295
|
if (data.eventType === "hook_created" && data.correlationId) {
|
|
121656
122296
|
await repairHookEntityFromPersistedEvent(basedir, effectiveRunId, data.correlationId, eventId, tag);
|
|
121657
122297
|
}
|
|
121658
122298
|
throw new EntityConflictError(`Event "${eventId}" already exists for run "${effectiveRunId}"`);
|
|
121659
122299
|
}
|
|
122300
|
+
rememberStoredEvent(event, eventPath, serializedEvent);
|
|
121660
122301
|
if (hook && data.eventType === "hook_created") {
|
|
121661
122302
|
await writeJSON(taggedPath(basedir, "hooks", hook.hookId, tag), hook, hookEntityWriteOptions);
|
|
121662
122303
|
}
|
|
@@ -121669,6 +122310,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
121669
122310
|
const allEvents = await paginatedFileSystemQuery({
|
|
121670
122311
|
directory: path$3.join(basedir, "events"),
|
|
121671
122312
|
schema: EventSchema,
|
|
122313
|
+
cachedItems: eventCache,
|
|
121672
122314
|
filePrefix: `${effectiveRunId}-`,
|
|
121673
122315
|
sortOrder: "asc",
|
|
121674
122316
|
limit: 1e3,
|
|
@@ -121725,6 +122367,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
121725
122367
|
const result = await paginatedFileSystemQuery({
|
|
121726
122368
|
directory: path$3.join(basedir, "events"),
|
|
121727
122369
|
schema: EventSchema,
|
|
122370
|
+
cachedItems: eventCache,
|
|
121728
122371
|
filePrefix: `${runId}-`,
|
|
121729
122372
|
// Events in chronological order (oldest first) by default,
|
|
121730
122373
|
// different from the default for other list calls.
|
|
@@ -121750,6 +122393,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
121750
122393
|
const result = await paginatedFileSystemQuery({
|
|
121751
122394
|
directory: path$3.join(basedir, "events"),
|
|
121752
122395
|
schema: EventSchema,
|
|
122396
|
+
cachedItems: eventCache,
|
|
121753
122397
|
// No filePrefix - search all events
|
|
121754
122398
|
filter: (event) => event.correlationId === correlationId,
|
|
121755
122399
|
// Events in chronological order (oldest first) by default,
|
|
@@ -121820,7 +122464,8 @@ function createStorage$1(basedir, tag) {
|
|
|
121820
122464
|
runs: instrumentObject$1("world.runs", runs),
|
|
121821
122465
|
steps: instrumentObject$1("world.steps", steps),
|
|
121822
122466
|
events: instrumentObject$1("world.events", events2),
|
|
121823
|
-
hooks: instrumentObject$1("world.hooks", hooks)
|
|
122467
|
+
hooks: instrumentObject$1("world.hooks", hooks),
|
|
122468
|
+
clearCache: () => events2.clearCache()
|
|
121824
122469
|
};
|
|
121825
122470
|
}
|
|
121826
122471
|
const monotonicUlid = monotonicFactory(() => Math.random());
|
|
@@ -122202,7 +122847,7 @@ function createLocalWorld(args) {
|
|
|
122202
122847
|
const mergedConfig = { ...config.value, ...definedArgs };
|
|
122203
122848
|
const tag = mergedConfig.tag;
|
|
122204
122849
|
const queue = createQueue$2(mergedConfig);
|
|
122205
|
-
const storage = createStorage$1(mergedConfig.dataDir, tag);
|
|
122850
|
+
const { clearCache: clearStorageCache, ...storage } = createStorage$1(mergedConfig.dataDir, tag);
|
|
122206
122851
|
const recoverActiveRuns = mergedConfig.recoverActiveRuns ?? true;
|
|
122207
122852
|
return {
|
|
122208
122853
|
specVersion: SPEC_VERSION_CURRENT,
|
|
@@ -122230,14 +122875,16 @@ function createLocalWorld(args) {
|
|
|
122230
122875
|
await reenqueueActiveRuns(recoveryRuns, queue.queue, "world-local");
|
|
122231
122876
|
},
|
|
122232
122877
|
async close() {
|
|
122878
|
+
clearStorageCache();
|
|
122233
122879
|
await queue.close();
|
|
122234
122880
|
},
|
|
122235
122881
|
async clear() {
|
|
122882
|
+
clearStorageCache();
|
|
122236
122883
|
if (tag) {
|
|
122237
122884
|
const basedir = mergedConfig.dataDir;
|
|
122238
122885
|
const hooksDir = path$3.join(basedir, "hooks");
|
|
122239
122886
|
const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
|
|
122240
|
-
const { HookSchema: HookSchema2 } = await import("./index-
|
|
122887
|
+
const { HookSchema: HookSchema2 } = await import("./index-fWQcXKhC.js");
|
|
122241
122888
|
await Promise.all(taggedHookFiles.map(async (hookFile) => {
|
|
122242
122889
|
const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
|
|
122243
122890
|
if (hook == null ? void 0 : hook.token) {
|
|
@@ -122266,73 +122913,13 @@ function createLocalWorld(args) {
|
|
|
122266
122913
|
})));
|
|
122267
122914
|
clearCreatedFilesCache();
|
|
122268
122915
|
} else {
|
|
122916
|
+
clearCreatedFilesCache();
|
|
122269
122917
|
await rm(mergedConfig.dataDir, { recursive: true, force: true });
|
|
122270
122918
|
await initDataDir(mergedConfig.dataDir);
|
|
122271
122919
|
}
|
|
122272
122920
|
}
|
|
122273
122921
|
};
|
|
122274
122922
|
}
|
|
122275
|
-
let _dispatcher;
|
|
122276
|
-
let _eventsDispatcher;
|
|
122277
|
-
let _streamDispatcher;
|
|
122278
|
-
const BASE_AGENT_OPTIONS = {
|
|
122279
|
-
connections: 8,
|
|
122280
|
-
keepAliveTimeout: 1e4,
|
|
122281
|
-
// HTTP/1.1 pipelining is disabled (pipelining: 1) because it causes
|
|
122282
|
-
// head-of-line blocking that deadlocks the webhook respondWith mechanism.
|
|
122283
|
-
pipelining: 1
|
|
122284
|
-
};
|
|
122285
|
-
const DEFAULT_AGENT_OPTIONS = {
|
|
122286
|
-
...BASE_AGENT_OPTIONS,
|
|
122287
|
-
allowH2: false
|
|
122288
|
-
};
|
|
122289
|
-
const EVENTS_AGENT_OPTIONS = {
|
|
122290
|
-
...BASE_AGENT_OPTIONS,
|
|
122291
|
-
allowH2: true
|
|
122292
|
-
};
|
|
122293
|
-
const RETRY_AGENT_OPTIONS = {
|
|
122294
|
-
// Observe Retry-After header if received
|
|
122295
|
-
retryAfter: true,
|
|
122296
|
-
// Retry 5xx in-process (genuine transient blips recover fast), but NOT 429.
|
|
122297
|
-
// The Vercel firewall issues a challenge as a 429: our server-to-server
|
|
122298
|
-
// client cannot solve a challenge, so in-process retries just re-trigger it
|
|
122299
|
-
// ~5× per request and amplify load against an already-overloaded firewall
|
|
122300
|
-
// during an incident. Letting 429 pass through surfaces it immediately to
|
|
122301
|
-
// makeRequest — which maps it to a ThrottleError carrying the
|
|
122302
|
-
// `x-vercel-mitigated` / `x-vercel-id` headers — and the queue does the
|
|
122303
|
-
// (backed-off) retry instead. This is the long-standing "let 429s pass
|
|
122304
|
-
// through" intent. (undici default is [500, 502, 503, 504, 429].)
|
|
122305
|
-
statusCodes: [500, 502, 503, 504]
|
|
122306
|
-
};
|
|
122307
|
-
const STREAM_RETRY_OPTIONS = {
|
|
122308
|
-
retryAfter: true,
|
|
122309
|
-
methods: ["PUT"],
|
|
122310
|
-
statusCodes: [429]
|
|
122311
|
-
};
|
|
122312
|
-
function getDispatcher(config2) {
|
|
122313
|
-
return (config2 == null ? void 0 : config2.dispatcher) ?? getDefaultDispatcher();
|
|
122314
|
-
}
|
|
122315
|
-
function getEventsDispatcher(config2) {
|
|
122316
|
-
return (config2 == null ? void 0 : config2.dispatcher) ?? getDefaultEventsDispatcher();
|
|
122317
|
-
}
|
|
122318
|
-
function getStreamDispatcher(config2) {
|
|
122319
|
-
return (config2 == null ? void 0 : config2.dispatcher) ?? getDefaultStreamDispatcher();
|
|
122320
|
-
}
|
|
122321
|
-
function makeRetryDispatcher(agentOptions, retryOptions) {
|
|
122322
|
-
return new undiciExports.RetryAgent(new undiciExports.Agent(agentOptions), retryOptions);
|
|
122323
|
-
}
|
|
122324
|
-
function getDefaultDispatcher() {
|
|
122325
|
-
_dispatcher ?? (_dispatcher = makeRetryDispatcher(DEFAULT_AGENT_OPTIONS, RETRY_AGENT_OPTIONS));
|
|
122326
|
-
return _dispatcher;
|
|
122327
|
-
}
|
|
122328
|
-
function getDefaultEventsDispatcher() {
|
|
122329
|
-
_eventsDispatcher ?? (_eventsDispatcher = makeRetryDispatcher(EVENTS_AGENT_OPTIONS, RETRY_AGENT_OPTIONS));
|
|
122330
|
-
return _eventsDispatcher;
|
|
122331
|
-
}
|
|
122332
|
-
function getDefaultStreamDispatcher() {
|
|
122333
|
-
_streamDispatcher ?? (_streamDispatcher = makeRetryDispatcher(EVENTS_AGENT_OPTIONS, STREAM_RETRY_OPTIONS));
|
|
122334
|
-
return _streamDispatcher;
|
|
122335
|
-
}
|
|
122336
122923
|
var getContext_1;
|
|
122337
122924
|
var hasRequiredGetContext;
|
|
122338
122925
|
function requireGetContext() {
|
|
@@ -122451,8 +123038,8 @@ function requireGetVercelOidcToken() {
|
|
|
122451
123038
|
}
|
|
122452
123039
|
try {
|
|
122453
123040
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
122454
|
-
await import("./token-util-
|
|
122455
|
-
await import("./token-
|
|
123041
|
+
await import("./token-util-D4JYdrFc.js").then((n) => n.t),
|
|
123042
|
+
await import("./token-DmIqmbeU.js").then((n) => n.t)
|
|
122456
123043
|
]);
|
|
122457
123044
|
if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
|
|
122458
123045
|
await refreshToken(options);
|
|
@@ -123015,6 +123602,67 @@ function requireDist() {
|
|
|
123015
123602
|
return dist;
|
|
123016
123603
|
}
|
|
123017
123604
|
var distExports = requireDist();
|
|
123605
|
+
let _dispatcher;
|
|
123606
|
+
let _eventsDispatcher;
|
|
123607
|
+
let _streamDispatcher;
|
|
123608
|
+
const BASE_AGENT_OPTIONS = {
|
|
123609
|
+
connections: 8,
|
|
123610
|
+
keepAliveTimeout: 1e4,
|
|
123611
|
+
// HTTP/1.1 pipelining is disabled (pipelining: 1) because it causes
|
|
123612
|
+
// head-of-line blocking that deadlocks the webhook respondWith mechanism.
|
|
123613
|
+
pipelining: 1
|
|
123614
|
+
};
|
|
123615
|
+
const DEFAULT_AGENT_OPTIONS = {
|
|
123616
|
+
...BASE_AGENT_OPTIONS,
|
|
123617
|
+
allowH2: false
|
|
123618
|
+
};
|
|
123619
|
+
const EVENTS_AGENT_OPTIONS = {
|
|
123620
|
+
...BASE_AGENT_OPTIONS,
|
|
123621
|
+
allowH2: true
|
|
123622
|
+
};
|
|
123623
|
+
const RETRY_AGENT_OPTIONS = {
|
|
123624
|
+
// Observe Retry-After header if received
|
|
123625
|
+
retryAfter: true,
|
|
123626
|
+
// Retry 5xx in-process (genuine transient blips recover fast), but NOT 429.
|
|
123627
|
+
// The Vercel firewall issues a challenge as a 429: our server-to-server
|
|
123628
|
+
// client cannot solve a challenge, so in-process retries just re-trigger it
|
|
123629
|
+
// ~5× per request and amplify load against an already-overloaded firewall
|
|
123630
|
+
// during an incident. Letting 429 pass through surfaces it immediately to
|
|
123631
|
+
// makeRequest — which maps it to a ThrottleError carrying the
|
|
123632
|
+
// `x-vercel-mitigated` / `x-vercel-id` headers — and the queue does the
|
|
123633
|
+
// (backed-off) retry instead. This is the long-standing "let 429s pass
|
|
123634
|
+
// through" intent. (undici default is [500, 502, 503, 504, 429].)
|
|
123635
|
+
statusCodes: [500, 502, 503, 504]
|
|
123636
|
+
};
|
|
123637
|
+
const STREAM_RETRY_OPTIONS = {
|
|
123638
|
+
retryAfter: true,
|
|
123639
|
+
methods: ["PUT"],
|
|
123640
|
+
statusCodes: [429]
|
|
123641
|
+
};
|
|
123642
|
+
function getDispatcher(config2) {
|
|
123643
|
+
return (config2 == null ? void 0 : config2.dispatcher) ?? getDefaultDispatcher();
|
|
123644
|
+
}
|
|
123645
|
+
function getEventsDispatcher(config2) {
|
|
123646
|
+
return (config2 == null ? void 0 : config2.dispatcher) ?? getDefaultEventsDispatcher();
|
|
123647
|
+
}
|
|
123648
|
+
function getStreamDispatcher(config2) {
|
|
123649
|
+
return (config2 == null ? void 0 : config2.dispatcher) ?? getDefaultStreamDispatcher();
|
|
123650
|
+
}
|
|
123651
|
+
function makeRetryDispatcher(agentOptions, retryOptions) {
|
|
123652
|
+
return new undiciExports.RetryAgent(new undiciExports.Agent(agentOptions), retryOptions);
|
|
123653
|
+
}
|
|
123654
|
+
function getDefaultDispatcher() {
|
|
123655
|
+
_dispatcher ?? (_dispatcher = makeRetryDispatcher(DEFAULT_AGENT_OPTIONS, RETRY_AGENT_OPTIONS));
|
|
123656
|
+
return _dispatcher;
|
|
123657
|
+
}
|
|
123658
|
+
function getDefaultEventsDispatcher() {
|
|
123659
|
+
_eventsDispatcher ?? (_eventsDispatcher = makeRetryDispatcher(EVENTS_AGENT_OPTIONS, RETRY_AGENT_OPTIONS));
|
|
123660
|
+
return _eventsDispatcher;
|
|
123661
|
+
}
|
|
123662
|
+
function getDefaultStreamDispatcher() {
|
|
123663
|
+
_streamDispatcher ?? (_streamDispatcher = makeRetryDispatcher(EVENTS_AGENT_OPTIONS, STREAM_RETRY_OPTIONS));
|
|
123664
|
+
return _streamDispatcher;
|
|
123665
|
+
}
|
|
123018
123666
|
let otelApiPromise = null;
|
|
123019
123667
|
async function getOtelApi() {
|
|
123020
123668
|
if (!otelApiPromise) {
|
|
@@ -123086,6 +123734,10 @@ const RpcMethod = SemanticConvention("rpc.method");
|
|
|
123086
123734
|
const WorkflowRunId = SemanticConvention("workflow.run.id");
|
|
123087
123735
|
const StepId = SemanticConvention("step.id");
|
|
123088
123736
|
const REQUEST_TIMEOUT_MS = 6e4;
|
|
123737
|
+
const getRequestTimeoutMs = () => envNumber("WORKFLOW_REQUEST_TIMEOUT_MS", REQUEST_TIMEOUT_MS, {
|
|
123738
|
+
integer: true,
|
|
123739
|
+
min: 1
|
|
123740
|
+
});
|
|
123089
123741
|
const HTTP_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
|
|
123090
123742
|
const DIAGNOSTIC_HEADERS = [
|
|
123091
123743
|
"x-vercel-id",
|
|
@@ -123174,7 +123826,7 @@ function httpClientSpanAttributes(args) {
|
|
|
123174
123826
|
};
|
|
123175
123827
|
}
|
|
123176
123828
|
async function instrumentedFetch(opts) {
|
|
123177
|
-
const { method, url: url2, headers: headers2, body: body2, dispatcher: dispatcher2, peerService = "workflow-server", timeoutMs =
|
|
123829
|
+
const { method, url: url2, headers: headers2, body: body2, dispatcher: dispatcher2, peerService = "workflow-server", timeoutMs = getRequestTimeoutMs(), signal: callerSignal, injectTraceContext = true, cacheBust = true, logLabel, buildError } = opts;
|
|
123178
123830
|
const label = logLabel ?? url2;
|
|
123179
123831
|
return trace(`http ${method}`, { kind: await getSpanKind("CLIENT") }, async (span) => {
|
|
123180
123832
|
var _a3, _b2, _c2;
|
|
@@ -123228,6 +123880,391 @@ async function instrumentedFetch(opts) {
|
|
|
123228
123880
|
return response2;
|
|
123229
123881
|
});
|
|
123230
123882
|
}
|
|
123883
|
+
const version = "5.0.0-beta.23";
|
|
123884
|
+
const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
123885
|
+
const MAX_BODY_PARSE_RETRIES = 2;
|
|
123886
|
+
const BODY_PARSE_RETRY_BASE_MS = 100;
|
|
123887
|
+
const TRANSIENT_TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
123888
|
+
"UND_ERR_REQ_RETRY",
|
|
123889
|
+
"UND_ERR_SOCKET",
|
|
123890
|
+
"UND_ERR_CONNECT",
|
|
123891
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
123892
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
123893
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
123894
|
+
"UND_ERR_CLOSED",
|
|
123895
|
+
"ECONNRESET",
|
|
123896
|
+
"ECONNREFUSED",
|
|
123897
|
+
"ENOTFOUND",
|
|
123898
|
+
"EAI_AGAIN",
|
|
123899
|
+
"EPIPE"
|
|
123900
|
+
]);
|
|
123901
|
+
function getTransientTransportCode(error2) {
|
|
123902
|
+
let current = error2;
|
|
123903
|
+
for (let depth = 0; current != null && depth < 5; depth++) {
|
|
123904
|
+
if (typeof current === "object" && "code" in current) {
|
|
123905
|
+
const code2 = current.code;
|
|
123906
|
+
if (typeof code2 === "string" && TRANSIENT_TRANSPORT_ERROR_CODES.has(code2)) {
|
|
123907
|
+
return code2;
|
|
123908
|
+
}
|
|
123909
|
+
}
|
|
123910
|
+
current = current == null ? void 0 : current.cause;
|
|
123911
|
+
}
|
|
123912
|
+
return void 0;
|
|
123913
|
+
}
|
|
123914
|
+
const getWorkflowServerUrlOverride = () => process.env.VERCEL_WORKFLOW_SERVER_URL || "";
|
|
123915
|
+
const TEST_LIMIT_OVERRIDES_HEADER = "x-workflow-test-limit-overrides";
|
|
123916
|
+
const getTestLimitOverridesHeader = () => {
|
|
123917
|
+
var _a3;
|
|
123918
|
+
return ((_a3 = process.env.WORKFLOW_TEST_LIMIT_OVERRIDES) == null ? void 0 : _a3.trim()) || "";
|
|
123919
|
+
};
|
|
123920
|
+
const DEFAULT_RESOLVE_DATA_OPTION = "all";
|
|
123921
|
+
function deserializeError(obj) {
|
|
123922
|
+
return obj;
|
|
123923
|
+
}
|
|
123924
|
+
const getUserAgent = () => {
|
|
123925
|
+
const deploymentId = process.env.VERCEL_DEPLOYMENT_ID;
|
|
123926
|
+
if (deploymentId) {
|
|
123927
|
+
return `@workflow/world-vercel/${version} node-${process.version} ${os.platform()} (${os.arch()}) ${deploymentId}`;
|
|
123928
|
+
}
|
|
123929
|
+
return `@workflow/world-vercel/${version} node-${process.version} ${os.platform()} (${os.arch()})`;
|
|
123930
|
+
};
|
|
123931
|
+
const getHttpUrl = (config2) => {
|
|
123932
|
+
const projectConfig = config2 == null ? void 0 : config2.projectConfig;
|
|
123933
|
+
const defaultHost = getWorkflowServerUrlOverride() || "https://vercel-workflow.com";
|
|
123934
|
+
const customProxyUrl = process.env.WORKFLOW_VERCEL_BACKEND_URL;
|
|
123935
|
+
const defaultProxyUrl = "https://api.vercel.com/v1/workflow";
|
|
123936
|
+
const usingProxy = Boolean((projectConfig == null ? void 0 : projectConfig.projectId) && (projectConfig == null ? void 0 : projectConfig.teamId));
|
|
123937
|
+
const baseUrl = usingProxy ? customProxyUrl || defaultProxyUrl : `${defaultHost}/api`;
|
|
123938
|
+
return { baseUrl, usingProxy };
|
|
123939
|
+
};
|
|
123940
|
+
const getHeaders = (config2, options) => {
|
|
123941
|
+
const projectConfig = config2 == null ? void 0 : config2.projectConfig;
|
|
123942
|
+
const headers2 = new Headers(config2 == null ? void 0 : config2.headers);
|
|
123943
|
+
headers2.set("User-Agent", getUserAgent());
|
|
123944
|
+
const testLimitOverrides = getTestLimitOverridesHeader();
|
|
123945
|
+
if (testLimitOverrides) {
|
|
123946
|
+
headers2.set(TEST_LIMIT_OVERRIDES_HEADER, testLimitOverrides);
|
|
123947
|
+
}
|
|
123948
|
+
if (projectConfig) {
|
|
123949
|
+
headers2.set("x-vercel-environment", projectConfig.environment || "production");
|
|
123950
|
+
if (projectConfig.projectId) {
|
|
123951
|
+
headers2.set("x-vercel-project-id", projectConfig.projectId);
|
|
123952
|
+
}
|
|
123953
|
+
if (projectConfig.teamId) {
|
|
123954
|
+
headers2.set("x-vercel-team-id", projectConfig.teamId);
|
|
123955
|
+
}
|
|
123956
|
+
}
|
|
123957
|
+
const workflowServerUrlOverride = getWorkflowServerUrlOverride();
|
|
123958
|
+
if (workflowServerUrlOverride && options.usingProxy) {
|
|
123959
|
+
headers2.set("x-vercel-workflow-api-url", workflowServerUrlOverride);
|
|
123960
|
+
}
|
|
123961
|
+
return headers2;
|
|
123962
|
+
};
|
|
123963
|
+
async function getHttpConfig(config2) {
|
|
123964
|
+
const { baseUrl, usingProxy } = getHttpUrl(config2);
|
|
123965
|
+
const headers2 = getHeaders(config2, { usingProxy });
|
|
123966
|
+
if (usingProxy) {
|
|
123967
|
+
if (!(config2 == null ? void 0 : config2.token)) {
|
|
123968
|
+
throw new Error(`world-vercel: api-workflow proxy requested (${baseUrl}) but no Vercel auth token was provided. Pass one as \`config.token\` (the SDK reads it from \`WORKFLOW_VERCEL_AUTH_TOKEN\`).`);
|
|
123969
|
+
}
|
|
123970
|
+
headers2.set("Authorization", `Bearer ${config2.token}`);
|
|
123971
|
+
} else {
|
|
123972
|
+
let oidcToken;
|
|
123973
|
+
try {
|
|
123974
|
+
oidcToken = await distExports.getVercelOidcToken();
|
|
123975
|
+
} catch {
|
|
123976
|
+
}
|
|
123977
|
+
const authToken = (config2 == null ? void 0 : config2.token) ?? oidcToken;
|
|
123978
|
+
if (authToken) {
|
|
123979
|
+
headers2.set("Authorization", `Bearer ${authToken}`);
|
|
123980
|
+
}
|
|
123981
|
+
if (oidcToken) {
|
|
123982
|
+
headers2.set("x-vercel-trusted-oidc-idp-token", oidcToken);
|
|
123983
|
+
}
|
|
123984
|
+
}
|
|
123985
|
+
return { baseUrl, headers: headers2, usingProxy };
|
|
123986
|
+
}
|
|
123987
|
+
async function makeRequest({ endpoint, options = {}, config: config2 = {}, schema, data, onResponse }) {
|
|
123988
|
+
const method = options.method || "GET";
|
|
123989
|
+
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
123990
|
+
const url2 = `${baseUrl}${endpoint}`;
|
|
123991
|
+
return trace(`http ${method}`, { kind: await getSpanKind("CLIENT") }, async (span) => {
|
|
123992
|
+
var _a3, _b2, _c2;
|
|
123993
|
+
span == null ? void 0 : span.setAttributes(httpClientSpanAttributes({
|
|
123994
|
+
method,
|
|
123995
|
+
url: url2,
|
|
123996
|
+
peerService: "workflow-server"
|
|
123997
|
+
}));
|
|
123998
|
+
headers2.set("Accept", "application/cbor");
|
|
123999
|
+
await injectTraceContextIntoHeaders(headers2);
|
|
124000
|
+
let body2;
|
|
124001
|
+
if (data !== void 0) {
|
|
124002
|
+
headers2.set("Content-Type", "application/cbor");
|
|
124003
|
+
body2 = encode(data);
|
|
124004
|
+
}
|
|
124005
|
+
const canRetryBody = IDEMPOTENT_METHODS.has(method.toUpperCase());
|
|
124006
|
+
let parseResult;
|
|
124007
|
+
let responseDiagnostics = "";
|
|
124008
|
+
for (let attempt = 0; ; attempt++) {
|
|
124009
|
+
headers2.set("X-Request-Time", Date.now().toString());
|
|
124010
|
+
const timeoutSignal = AbortSignal.timeout(getRequestTimeoutMs());
|
|
124011
|
+
const signal = options.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal;
|
|
124012
|
+
const request2 = new Request(url2, {
|
|
124013
|
+
...options,
|
|
124014
|
+
body: body2,
|
|
124015
|
+
headers: headers2,
|
|
124016
|
+
signal
|
|
124017
|
+
});
|
|
124018
|
+
const fetchStart = Date.now();
|
|
124019
|
+
let response2;
|
|
124020
|
+
try {
|
|
124021
|
+
response2 = await fetch(request2, {
|
|
124022
|
+
dispatcher: getDispatcher(config2)
|
|
124023
|
+
});
|
|
124024
|
+
} catch (error2) {
|
|
124025
|
+
const elapsed = Date.now() - fetchStart;
|
|
124026
|
+
if (error2 instanceof Error && (error2.name === "TimeoutError" || error2.name === "AbortError")) {
|
|
124027
|
+
const timeoutError = new WorkflowWorldError(`${method} ${endpoint} timed out after ${elapsed}ms`, { url: url2, code: "TIMEOUT", cause: error2 });
|
|
124028
|
+
span == null ? void 0 : span.setAttributes({ ...ErrorType("TIMEOUT") });
|
|
124029
|
+
(_a3 = span == null ? void 0 : span.recordException) == null ? void 0 : _a3.call(span, timeoutError);
|
|
124030
|
+
throw timeoutError;
|
|
124031
|
+
}
|
|
124032
|
+
const transportCode = getTransientTransportCode(error2);
|
|
124033
|
+
if (transportCode) {
|
|
124034
|
+
const transportError = new WorkflowWorldError(`${method} ${endpoint} transport failure after ${elapsed}ms (${transportCode})`, { url: url2, code: "TRANSPORT", cause: error2 });
|
|
124035
|
+
span == null ? void 0 : span.setAttributes({ ...ErrorType("TRANSPORT") });
|
|
124036
|
+
(_b2 = span == null ? void 0 : span.recordException) == null ? void 0 : _b2.call(span, transportError);
|
|
124037
|
+
throw transportError;
|
|
124038
|
+
}
|
|
124039
|
+
throw error2;
|
|
124040
|
+
}
|
|
124041
|
+
const fetchMs = Date.now() - fetchStart;
|
|
124042
|
+
responseDiagnostics = formatVercelDiagnostics(response2.headers);
|
|
124043
|
+
httpLog(method, endpoint, response2, fetchMs);
|
|
124044
|
+
span == null ? void 0 : span.setAttributes({
|
|
124045
|
+
...HttpResponseStatusCode(response2.status)
|
|
124046
|
+
});
|
|
124047
|
+
if (!response2.ok) {
|
|
124048
|
+
const errorData = await parseResponseBody(response2).then((r2) => r2.data).catch(() => ({}));
|
|
124049
|
+
const errorCode = errorData.code ?? errorData.error;
|
|
124050
|
+
logCurlRepro(request2.method, url2, headers2);
|
|
124051
|
+
const retryAfter = parseRetryAfter(response2.headers.get("Retry-After"));
|
|
124052
|
+
const defaultMessage = (errorData.message || `${request2.method} ${endpoint} -> HTTP ${response2.status}: ${response2.statusText}`) + responseDiagnostics;
|
|
124053
|
+
const error2 = errorForResponse(response2.status, defaultMessage, {
|
|
124054
|
+
url: url2,
|
|
124055
|
+
code: errorCode,
|
|
124056
|
+
retryAfter,
|
|
124057
|
+
mitigated: response2.headers.get("x-vercel-mitigated")
|
|
124058
|
+
});
|
|
124059
|
+
span == null ? void 0 : span.setAttributes({
|
|
124060
|
+
...ErrorType(errorCode || `HTTP ${response2.status}`)
|
|
124061
|
+
});
|
|
124062
|
+
(_c2 = span == null ? void 0 : span.recordException) == null ? void 0 : _c2.call(span, error2);
|
|
124063
|
+
throw error2;
|
|
124064
|
+
}
|
|
124065
|
+
onResponse == null ? void 0 : onResponse(response2);
|
|
124066
|
+
try {
|
|
124067
|
+
parseResult = await trace("world.parse", async (parseSpan) => {
|
|
124068
|
+
const result2 = await parseResponseBody(response2);
|
|
124069
|
+
const contentType = response2.headers.get("Content-Type") || "";
|
|
124070
|
+
const isCbor = contentType.includes("application/cbor");
|
|
124071
|
+
parseSpan == null ? void 0 : parseSpan.setAttributes({
|
|
124072
|
+
...WorldParseFormat(isCbor ? "cbor" : "json")
|
|
124073
|
+
});
|
|
124074
|
+
return result2;
|
|
124075
|
+
});
|
|
124076
|
+
break;
|
|
124077
|
+
} catch (error2) {
|
|
124078
|
+
if (canRetryBody && attempt < MAX_BODY_PARSE_RETRIES) {
|
|
124079
|
+
const backoffMs = BODY_PARSE_RETRY_BASE_MS * 2 ** attempt;
|
|
124080
|
+
span == null ? void 0 : span.setAttributes({
|
|
124081
|
+
...ErrorType("PARSE_ERROR_RETRYING")
|
|
124082
|
+
});
|
|
124083
|
+
if (HTTP_DEBUG_ENABLED) {
|
|
124084
|
+
console.debug(`[workflow:world-vercel:http] ${method} ${endpoint} body parse failed (attempt ${attempt + 1}/${MAX_BODY_PARSE_RETRIES + 1}); retrying in ${backoffMs}ms: ${error2}`);
|
|
124085
|
+
}
|
|
124086
|
+
await new Promise((resolve2) => setTimeout(resolve2, backoffMs));
|
|
124087
|
+
continue;
|
|
124088
|
+
}
|
|
124089
|
+
const contentType = response2.headers.get("Content-Type") || "unknown";
|
|
124090
|
+
throw new WorkflowWorldError(`Failed to parse response body for ${method} ${endpoint}${responseDiagnostics} (Content-Type: ${contentType}):
|
|
124091
|
+
|
|
124092
|
+
${error2}`, { url: url2, code: "PARSE_ERROR", cause: error2 });
|
|
124093
|
+
}
|
|
124094
|
+
}
|
|
124095
|
+
const result = await trace("world.validate", async () => {
|
|
124096
|
+
const validationResult = schema.safeParse(parseResult.data);
|
|
124097
|
+
if (!validationResult.success) {
|
|
124098
|
+
const issues = validationResult.error.issues.map((i) => ` ${i.path.length > 0 ? i.path.join(".") : "<root>"}: ${i.message}`).join("\n");
|
|
124099
|
+
const debugContext = process.env.DEBUG ? `
|
|
124100
|
+
|
|
124101
|
+
Response context: ${parseResult.getDebugContext()}` : "";
|
|
124102
|
+
throw new WorkflowWorldError(`Schema validation failed for ${method} ${endpoint}${responseDiagnostics}:
|
|
124103
|
+
${issues}${debugContext}`, { url: url2, code: "SCHEMA_VALIDATION", cause: validationResult.error });
|
|
124104
|
+
}
|
|
124105
|
+
return validationResult.data;
|
|
124106
|
+
});
|
|
124107
|
+
return result;
|
|
124108
|
+
});
|
|
124109
|
+
}
|
|
124110
|
+
const MAX_PREVIEW_LENGTH = 500;
|
|
124111
|
+
function createPreview(data) {
|
|
124112
|
+
const str = inspect(data, { depth: 3, maxArrayLength: 10, breakLength: 120 });
|
|
124113
|
+
return str.length > MAX_PREVIEW_LENGTH ? `${str.slice(0, MAX_PREVIEW_LENGTH)}...` : str;
|
|
124114
|
+
}
|
|
124115
|
+
async function parseResponseBody(response2) {
|
|
124116
|
+
const contentType = response2.headers.get("Content-Type") || "";
|
|
124117
|
+
if (contentType.includes("application/cbor")) {
|
|
124118
|
+
const buffer2 = await response2.arrayBuffer();
|
|
124119
|
+
const data2 = decode(new Uint8Array(buffer2));
|
|
124120
|
+
return {
|
|
124121
|
+
data: data2,
|
|
124122
|
+
getDebugContext: () => `Content-Type: ${contentType}, ${buffer2.byteLength} bytes (CBOR), preview: ${createPreview(data2)}`
|
|
124123
|
+
};
|
|
124124
|
+
}
|
|
124125
|
+
const text2 = await response2.text();
|
|
124126
|
+
const data = JSON.parse(text2);
|
|
124127
|
+
return {
|
|
124128
|
+
data,
|
|
124129
|
+
getDebugContext: () => `Content-Type: ${contentType}, ${text2.length} bytes, preview: ${createPreview(data)}`
|
|
124130
|
+
};
|
|
124131
|
+
}
|
|
124132
|
+
function appendPagination(params, pagination) {
|
|
124133
|
+
if (pagination == null ? void 0 : pagination.limit)
|
|
124134
|
+
params.set("limit", pagination.limit.toString());
|
|
124135
|
+
if (pagination == null ? void 0 : pagination.cursor)
|
|
124136
|
+
params.set("cursor", pagination.cursor);
|
|
124137
|
+
if (pagination == null ? void 0 : pagination.sortOrder)
|
|
124138
|
+
params.set("sortOrder", pagination.sortOrder);
|
|
124139
|
+
}
|
|
124140
|
+
function createQueryString(params) {
|
|
124141
|
+
const query = params.toString();
|
|
124142
|
+
return query ? `?${query}` : "";
|
|
124143
|
+
}
|
|
124144
|
+
function createAnalytics(config2) {
|
|
124145
|
+
return {
|
|
124146
|
+
runs: {
|
|
124147
|
+
get(runId) {
|
|
124148
|
+
return makeRequest({
|
|
124149
|
+
endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}`,
|
|
124150
|
+
config: config2,
|
|
124151
|
+
schema: AnalyticsRunSchema
|
|
124152
|
+
});
|
|
124153
|
+
},
|
|
124154
|
+
list(params = {}) {
|
|
124155
|
+
const searchParams = new URLSearchParams();
|
|
124156
|
+
if (params.workflowName) {
|
|
124157
|
+
searchParams.set("workflowName", params.workflowName);
|
|
124158
|
+
}
|
|
124159
|
+
if (params.status) {
|
|
124160
|
+
searchParams.set("status", params.status);
|
|
124161
|
+
}
|
|
124162
|
+
appendPagination(searchParams, params.pagination);
|
|
124163
|
+
return makeRequest({
|
|
124164
|
+
endpoint: `/v2/analytics/runs${createQueryString(searchParams)}`,
|
|
124165
|
+
config: config2,
|
|
124166
|
+
schema: PaginatedResponseSchema(AnalyticsRunSchema)
|
|
124167
|
+
});
|
|
124168
|
+
}
|
|
124169
|
+
},
|
|
124170
|
+
steps: {
|
|
124171
|
+
get(runId, stepId) {
|
|
124172
|
+
return makeRequest({
|
|
124173
|
+
endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}/steps/${encodeURIComponent(stepId)}`,
|
|
124174
|
+
config: config2,
|
|
124175
|
+
schema: AnalyticsStepSchema
|
|
124176
|
+
});
|
|
124177
|
+
},
|
|
124178
|
+
list(params) {
|
|
124179
|
+
const searchParams = new URLSearchParams();
|
|
124180
|
+
appendPagination(searchParams, params.pagination);
|
|
124181
|
+
return makeRequest({
|
|
124182
|
+
endpoint: `/v2/analytics/runs/${encodeURIComponent(params.runId)}/steps${createQueryString(searchParams)}`,
|
|
124183
|
+
config: config2,
|
|
124184
|
+
schema: PaginatedResponseSchema(AnalyticsStepSchema)
|
|
124185
|
+
});
|
|
124186
|
+
}
|
|
124187
|
+
},
|
|
124188
|
+
events: {
|
|
124189
|
+
get(runId, eventId) {
|
|
124190
|
+
return makeRequest({
|
|
124191
|
+
endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}/events/${encodeURIComponent(eventId)}`,
|
|
124192
|
+
config: config2,
|
|
124193
|
+
schema: AnalyticsEventSchema
|
|
124194
|
+
});
|
|
124195
|
+
},
|
|
124196
|
+
list(params) {
|
|
124197
|
+
const searchParams = new URLSearchParams();
|
|
124198
|
+
if (params.eventType) {
|
|
124199
|
+
searchParams.set("eventType", params.eventType);
|
|
124200
|
+
}
|
|
124201
|
+
if (params.correlationId) {
|
|
124202
|
+
searchParams.set("correlationId", params.correlationId);
|
|
124203
|
+
}
|
|
124204
|
+
appendPagination(searchParams, params.pagination);
|
|
124205
|
+
return makeRequest({
|
|
124206
|
+
endpoint: `/v2/analytics/runs/${encodeURIComponent(params.runId)}/events${createQueryString(searchParams)}`,
|
|
124207
|
+
config: config2,
|
|
124208
|
+
schema: PaginatedResponseSchema(AnalyticsEventSchema)
|
|
124209
|
+
});
|
|
124210
|
+
},
|
|
124211
|
+
listByCorrelationId(params) {
|
|
124212
|
+
const searchParams = new URLSearchParams();
|
|
124213
|
+
searchParams.set("correlationId", params.correlationId);
|
|
124214
|
+
appendPagination(searchParams, params.pagination);
|
|
124215
|
+
return makeRequest({
|
|
124216
|
+
endpoint: `/v2/analytics/events${createQueryString(searchParams)}`,
|
|
124217
|
+
config: config2,
|
|
124218
|
+
schema: PaginatedResponseSchema(AnalyticsEventSchema)
|
|
124219
|
+
});
|
|
124220
|
+
}
|
|
124221
|
+
},
|
|
124222
|
+
hooks: {
|
|
124223
|
+
get(hookId, params) {
|
|
124224
|
+
const searchParams = new URLSearchParams();
|
|
124225
|
+
if (params == null ? void 0 : params.runId) {
|
|
124226
|
+
searchParams.set("runId", params.runId);
|
|
124227
|
+
}
|
|
124228
|
+
return makeRequest({
|
|
124229
|
+
endpoint: `/v2/analytics/hooks/${encodeURIComponent(hookId)}${createQueryString(searchParams)}`,
|
|
124230
|
+
config: config2,
|
|
124231
|
+
schema: AnalyticsHookSchema
|
|
124232
|
+
});
|
|
124233
|
+
},
|
|
124234
|
+
list(params) {
|
|
124235
|
+
const searchParams = new URLSearchParams();
|
|
124236
|
+
searchParams.set("runId", params.runId);
|
|
124237
|
+
appendPagination(searchParams, params.pagination);
|
|
124238
|
+
return makeRequest({
|
|
124239
|
+
endpoint: `/v2/analytics/hooks${createQueryString(searchParams)}`,
|
|
124240
|
+
config: config2,
|
|
124241
|
+
schema: PaginatedResponseSchema(AnalyticsHookSchema)
|
|
124242
|
+
});
|
|
124243
|
+
}
|
|
124244
|
+
},
|
|
124245
|
+
waits: {
|
|
124246
|
+
get(runId, waitId) {
|
|
124247
|
+
return makeRequest({
|
|
124248
|
+
endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}/waits/${encodeURIComponent(waitId)}`,
|
|
124249
|
+
config: config2,
|
|
124250
|
+
schema: AnalyticsWaitSchema
|
|
124251
|
+
});
|
|
124252
|
+
},
|
|
124253
|
+
list(params) {
|
|
124254
|
+
const searchParams = new URLSearchParams();
|
|
124255
|
+
if (params.status) {
|
|
124256
|
+
searchParams.set("status", params.status);
|
|
124257
|
+
}
|
|
124258
|
+
appendPagination(searchParams, params.pagination);
|
|
124259
|
+
return makeRequest({
|
|
124260
|
+
endpoint: `/v2/analytics/runs/${encodeURIComponent(params.runId)}/waits${createQueryString(searchParams)}`,
|
|
124261
|
+
config: config2,
|
|
124262
|
+
schema: PaginatedResponseSchema(AnalyticsWaitSchema)
|
|
124263
|
+
});
|
|
124264
|
+
}
|
|
124265
|
+
}
|
|
124266
|
+
};
|
|
124267
|
+
}
|
|
123231
124268
|
const KEY_BYTES = 32;
|
|
123232
124269
|
async function deriveRunKey(deploymentKey, projectId, runId) {
|
|
123233
124270
|
if (deploymentKey.length !== KEY_BYTES) {
|
|
@@ -127919,245 +128956,6 @@ var QueueClient = class {
|
|
|
127919
128956
|
setApi(this, new ApiClient({ ...options, region }));
|
|
127920
128957
|
}
|
|
127921
128958
|
};
|
|
127922
|
-
const version = "5.0.0-beta.22";
|
|
127923
|
-
const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
127924
|
-
const MAX_BODY_PARSE_RETRIES = 2;
|
|
127925
|
-
const BODY_PARSE_RETRY_BASE_MS = 100;
|
|
127926
|
-
const TRANSIENT_TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
127927
|
-
"UND_ERR_REQ_RETRY",
|
|
127928
|
-
"UND_ERR_SOCKET",
|
|
127929
|
-
"UND_ERR_CONNECT",
|
|
127930
|
-
"UND_ERR_CONNECT_TIMEOUT",
|
|
127931
|
-
"UND_ERR_HEADERS_TIMEOUT",
|
|
127932
|
-
"UND_ERR_BODY_TIMEOUT",
|
|
127933
|
-
"UND_ERR_CLOSED",
|
|
127934
|
-
"ECONNRESET",
|
|
127935
|
-
"ECONNREFUSED",
|
|
127936
|
-
"ENOTFOUND",
|
|
127937
|
-
"EAI_AGAIN",
|
|
127938
|
-
"EPIPE"
|
|
127939
|
-
]);
|
|
127940
|
-
function getTransientTransportCode(error2) {
|
|
127941
|
-
let current = error2;
|
|
127942
|
-
for (let depth = 0; current != null && depth < 5; depth++) {
|
|
127943
|
-
if (typeof current === "object" && "code" in current) {
|
|
127944
|
-
const code2 = current.code;
|
|
127945
|
-
if (typeof code2 === "string" && TRANSIENT_TRANSPORT_ERROR_CODES.has(code2)) {
|
|
127946
|
-
return code2;
|
|
127947
|
-
}
|
|
127948
|
-
}
|
|
127949
|
-
current = current == null ? void 0 : current.cause;
|
|
127950
|
-
}
|
|
127951
|
-
return void 0;
|
|
127952
|
-
}
|
|
127953
|
-
const getWorkflowServerUrlOverride = () => process.env.VERCEL_WORKFLOW_SERVER_URL || "";
|
|
127954
|
-
const DEFAULT_RESOLVE_DATA_OPTION = "all";
|
|
127955
|
-
function deserializeError(obj) {
|
|
127956
|
-
return obj;
|
|
127957
|
-
}
|
|
127958
|
-
const getUserAgent = () => {
|
|
127959
|
-
const deploymentId = process.env.VERCEL_DEPLOYMENT_ID;
|
|
127960
|
-
if (deploymentId) {
|
|
127961
|
-
return `@workflow/world-vercel/${version} node-${process.version} ${os.platform()} (${os.arch()}) ${deploymentId}`;
|
|
127962
|
-
}
|
|
127963
|
-
return `@workflow/world-vercel/${version} node-${process.version} ${os.platform()} (${os.arch()})`;
|
|
127964
|
-
};
|
|
127965
|
-
const getHttpUrl = (config2) => {
|
|
127966
|
-
const projectConfig = config2 == null ? void 0 : config2.projectConfig;
|
|
127967
|
-
const defaultHost = getWorkflowServerUrlOverride() || "https://vercel-workflow.com";
|
|
127968
|
-
const customProxyUrl = process.env.WORKFLOW_VERCEL_BACKEND_URL;
|
|
127969
|
-
const defaultProxyUrl = "https://api.vercel.com/v1/workflow";
|
|
127970
|
-
const usingProxy = Boolean((projectConfig == null ? void 0 : projectConfig.projectId) && (projectConfig == null ? void 0 : projectConfig.teamId));
|
|
127971
|
-
const baseUrl = usingProxy ? customProxyUrl || defaultProxyUrl : `${defaultHost}/api`;
|
|
127972
|
-
return { baseUrl, usingProxy };
|
|
127973
|
-
};
|
|
127974
|
-
const getHeaders = (config2, options) => {
|
|
127975
|
-
const projectConfig = config2 == null ? void 0 : config2.projectConfig;
|
|
127976
|
-
const headers2 = new Headers(config2 == null ? void 0 : config2.headers);
|
|
127977
|
-
headers2.set("User-Agent", getUserAgent());
|
|
127978
|
-
if (projectConfig) {
|
|
127979
|
-
headers2.set("x-vercel-environment", projectConfig.environment || "production");
|
|
127980
|
-
if (projectConfig.projectId) {
|
|
127981
|
-
headers2.set("x-vercel-project-id", projectConfig.projectId);
|
|
127982
|
-
}
|
|
127983
|
-
if (projectConfig.teamId) {
|
|
127984
|
-
headers2.set("x-vercel-team-id", projectConfig.teamId);
|
|
127985
|
-
}
|
|
127986
|
-
}
|
|
127987
|
-
const workflowServerUrlOverride = getWorkflowServerUrlOverride();
|
|
127988
|
-
if (workflowServerUrlOverride && options.usingProxy) {
|
|
127989
|
-
headers2.set("x-vercel-workflow-api-url", workflowServerUrlOverride);
|
|
127990
|
-
}
|
|
127991
|
-
return headers2;
|
|
127992
|
-
};
|
|
127993
|
-
async function getHttpConfig(config2) {
|
|
127994
|
-
const { baseUrl, usingProxy } = getHttpUrl(config2);
|
|
127995
|
-
const headers2 = getHeaders(config2, { usingProxy });
|
|
127996
|
-
if (usingProxy) {
|
|
127997
|
-
if (!(config2 == null ? void 0 : config2.token)) {
|
|
127998
|
-
throw new Error(`world-vercel: api-workflow proxy requested (${baseUrl}) but no Vercel auth token was provided. Pass one as \`config.token\` (the SDK reads it from \`WORKFLOW_VERCEL_AUTH_TOKEN\`).`);
|
|
127999
|
-
}
|
|
128000
|
-
headers2.set("Authorization", `Bearer ${config2.token}`);
|
|
128001
|
-
} else {
|
|
128002
|
-
let oidcToken;
|
|
128003
|
-
try {
|
|
128004
|
-
oidcToken = await distExports.getVercelOidcToken();
|
|
128005
|
-
} catch {
|
|
128006
|
-
}
|
|
128007
|
-
const authToken = (config2 == null ? void 0 : config2.token) ?? oidcToken;
|
|
128008
|
-
if (authToken) {
|
|
128009
|
-
headers2.set("Authorization", `Bearer ${authToken}`);
|
|
128010
|
-
}
|
|
128011
|
-
if (oidcToken) {
|
|
128012
|
-
headers2.set("x-vercel-trusted-oidc-idp-token", oidcToken);
|
|
128013
|
-
}
|
|
128014
|
-
}
|
|
128015
|
-
return { baseUrl, headers: headers2, usingProxy };
|
|
128016
|
-
}
|
|
128017
|
-
async function makeRequest({ endpoint, options = {}, config: config2 = {}, schema, data, onResponse }) {
|
|
128018
|
-
const method = options.method || "GET";
|
|
128019
|
-
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
128020
|
-
const url2 = `${baseUrl}${endpoint}`;
|
|
128021
|
-
return trace(`http ${method}`, { kind: await getSpanKind("CLIENT") }, async (span) => {
|
|
128022
|
-
var _a3, _b2, _c2;
|
|
128023
|
-
span == null ? void 0 : span.setAttributes(httpClientSpanAttributes({
|
|
128024
|
-
method,
|
|
128025
|
-
url: url2,
|
|
128026
|
-
peerService: "workflow-server"
|
|
128027
|
-
}));
|
|
128028
|
-
headers2.set("Accept", "application/cbor");
|
|
128029
|
-
await injectTraceContextIntoHeaders(headers2);
|
|
128030
|
-
let body2;
|
|
128031
|
-
if (data !== void 0) {
|
|
128032
|
-
headers2.set("Content-Type", "application/cbor");
|
|
128033
|
-
body2 = encode(data);
|
|
128034
|
-
}
|
|
128035
|
-
const canRetryBody = IDEMPOTENT_METHODS.has(method.toUpperCase());
|
|
128036
|
-
let parseResult;
|
|
128037
|
-
let responseDiagnostics = "";
|
|
128038
|
-
for (let attempt = 0; ; attempt++) {
|
|
128039
|
-
headers2.set("X-Request-Time", Date.now().toString());
|
|
128040
|
-
const timeoutSignal = AbortSignal.timeout(REQUEST_TIMEOUT_MS);
|
|
128041
|
-
const signal = options.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal;
|
|
128042
|
-
const request2 = new Request(url2, {
|
|
128043
|
-
...options,
|
|
128044
|
-
body: body2,
|
|
128045
|
-
headers: headers2,
|
|
128046
|
-
signal
|
|
128047
|
-
});
|
|
128048
|
-
const fetchStart = Date.now();
|
|
128049
|
-
let response2;
|
|
128050
|
-
try {
|
|
128051
|
-
response2 = await fetch(request2, {
|
|
128052
|
-
dispatcher: getDispatcher(config2)
|
|
128053
|
-
});
|
|
128054
|
-
} catch (error2) {
|
|
128055
|
-
const elapsed = Date.now() - fetchStart;
|
|
128056
|
-
if (error2 instanceof Error && (error2.name === "TimeoutError" || error2.name === "AbortError")) {
|
|
128057
|
-
const timeoutError = new WorkflowWorldError(`${method} ${endpoint} timed out after ${elapsed}ms`, { url: url2, code: "TIMEOUT", cause: error2 });
|
|
128058
|
-
span == null ? void 0 : span.setAttributes({ ...ErrorType("TIMEOUT") });
|
|
128059
|
-
(_a3 = span == null ? void 0 : span.recordException) == null ? void 0 : _a3.call(span, timeoutError);
|
|
128060
|
-
throw timeoutError;
|
|
128061
|
-
}
|
|
128062
|
-
const transportCode = getTransientTransportCode(error2);
|
|
128063
|
-
if (transportCode) {
|
|
128064
|
-
const transportError = new WorkflowWorldError(`${method} ${endpoint} transport failure after ${elapsed}ms (${transportCode})`, { url: url2, code: "TRANSPORT", cause: error2 });
|
|
128065
|
-
span == null ? void 0 : span.setAttributes({ ...ErrorType("TRANSPORT") });
|
|
128066
|
-
(_b2 = span == null ? void 0 : span.recordException) == null ? void 0 : _b2.call(span, transportError);
|
|
128067
|
-
throw transportError;
|
|
128068
|
-
}
|
|
128069
|
-
throw error2;
|
|
128070
|
-
}
|
|
128071
|
-
const fetchMs = Date.now() - fetchStart;
|
|
128072
|
-
responseDiagnostics = formatVercelDiagnostics(response2.headers);
|
|
128073
|
-
httpLog(method, endpoint, response2, fetchMs);
|
|
128074
|
-
span == null ? void 0 : span.setAttributes({
|
|
128075
|
-
...HttpResponseStatusCode(response2.status)
|
|
128076
|
-
});
|
|
128077
|
-
if (!response2.ok) {
|
|
128078
|
-
const errorData = await parseResponseBody(response2).then((r2) => r2.data).catch(() => ({}));
|
|
128079
|
-
logCurlRepro(request2.method, url2, headers2);
|
|
128080
|
-
const retryAfter = parseRetryAfter(response2.headers.get("Retry-After"));
|
|
128081
|
-
const defaultMessage = (errorData.message || `${request2.method} ${endpoint} -> HTTP ${response2.status}: ${response2.statusText}`) + responseDiagnostics;
|
|
128082
|
-
const error2 = errorForResponse(response2.status, defaultMessage, {
|
|
128083
|
-
url: url2,
|
|
128084
|
-
code: errorData.code,
|
|
128085
|
-
retryAfter,
|
|
128086
|
-
mitigated: response2.headers.get("x-vercel-mitigated")
|
|
128087
|
-
});
|
|
128088
|
-
span == null ? void 0 : span.setAttributes({
|
|
128089
|
-
...ErrorType(errorData.code || `HTTP ${response2.status}`)
|
|
128090
|
-
});
|
|
128091
|
-
(_c2 = span == null ? void 0 : span.recordException) == null ? void 0 : _c2.call(span, error2);
|
|
128092
|
-
throw error2;
|
|
128093
|
-
}
|
|
128094
|
-
onResponse == null ? void 0 : onResponse(response2);
|
|
128095
|
-
try {
|
|
128096
|
-
parseResult = await trace("world.parse", async (parseSpan) => {
|
|
128097
|
-
const result2 = await parseResponseBody(response2);
|
|
128098
|
-
const contentType = response2.headers.get("Content-Type") || "";
|
|
128099
|
-
const isCbor = contentType.includes("application/cbor");
|
|
128100
|
-
parseSpan == null ? void 0 : parseSpan.setAttributes({
|
|
128101
|
-
...WorldParseFormat(isCbor ? "cbor" : "json")
|
|
128102
|
-
});
|
|
128103
|
-
return result2;
|
|
128104
|
-
});
|
|
128105
|
-
break;
|
|
128106
|
-
} catch (error2) {
|
|
128107
|
-
if (canRetryBody && attempt < MAX_BODY_PARSE_RETRIES) {
|
|
128108
|
-
const backoffMs = BODY_PARSE_RETRY_BASE_MS * 2 ** attempt;
|
|
128109
|
-
span == null ? void 0 : span.setAttributes({
|
|
128110
|
-
...ErrorType("PARSE_ERROR_RETRYING")
|
|
128111
|
-
});
|
|
128112
|
-
if (HTTP_DEBUG_ENABLED) {
|
|
128113
|
-
console.debug(`[workflow:world-vercel:http] ${method} ${endpoint} body parse failed (attempt ${attempt + 1}/${MAX_BODY_PARSE_RETRIES + 1}); retrying in ${backoffMs}ms: ${error2}`);
|
|
128114
|
-
}
|
|
128115
|
-
await new Promise((resolve2) => setTimeout(resolve2, backoffMs));
|
|
128116
|
-
continue;
|
|
128117
|
-
}
|
|
128118
|
-
const contentType = response2.headers.get("Content-Type") || "unknown";
|
|
128119
|
-
throw new WorkflowWorldError(`Failed to parse response body for ${method} ${endpoint}${responseDiagnostics} (Content-Type: ${contentType}):
|
|
128120
|
-
|
|
128121
|
-
${error2}`, { url: url2, code: "PARSE_ERROR", cause: error2 });
|
|
128122
|
-
}
|
|
128123
|
-
}
|
|
128124
|
-
const result = await trace("world.validate", async () => {
|
|
128125
|
-
const validationResult = schema.safeParse(parseResult.data);
|
|
128126
|
-
if (!validationResult.success) {
|
|
128127
|
-
const issues = validationResult.error.issues.map((i) => ` ${i.path.length > 0 ? i.path.join(".") : "<root>"}: ${i.message}`).join("\n");
|
|
128128
|
-
const debugContext = process.env.DEBUG ? `
|
|
128129
|
-
|
|
128130
|
-
Response context: ${parseResult.getDebugContext()}` : "";
|
|
128131
|
-
throw new WorkflowWorldError(`Schema validation failed for ${method} ${endpoint}${responseDiagnostics}:
|
|
128132
|
-
${issues}${debugContext}`, { url: url2, code: "SCHEMA_VALIDATION", cause: validationResult.error });
|
|
128133
|
-
}
|
|
128134
|
-
return validationResult.data;
|
|
128135
|
-
});
|
|
128136
|
-
return result;
|
|
128137
|
-
});
|
|
128138
|
-
}
|
|
128139
|
-
const MAX_PREVIEW_LENGTH = 500;
|
|
128140
|
-
function createPreview(data) {
|
|
128141
|
-
const str = inspect(data, { depth: 3, maxArrayLength: 10, breakLength: 120 });
|
|
128142
|
-
return str.length > MAX_PREVIEW_LENGTH ? `${str.slice(0, MAX_PREVIEW_LENGTH)}...` : str;
|
|
128143
|
-
}
|
|
128144
|
-
async function parseResponseBody(response2) {
|
|
128145
|
-
const contentType = response2.headers.get("Content-Type") || "";
|
|
128146
|
-
if (contentType.includes("application/cbor")) {
|
|
128147
|
-
const buffer2 = await response2.arrayBuffer();
|
|
128148
|
-
const data2 = decode(new Uint8Array(buffer2));
|
|
128149
|
-
return {
|
|
128150
|
-
data: data2,
|
|
128151
|
-
getDebugContext: () => `Content-Type: ${contentType}, ${buffer2.byteLength} bytes (CBOR), preview: ${createPreview(data2)}`
|
|
128152
|
-
};
|
|
128153
|
-
}
|
|
128154
|
-
const text2 = await response2.text();
|
|
128155
|
-
const data = JSON.parse(text2);
|
|
128156
|
-
return {
|
|
128157
|
-
data,
|
|
128158
|
-
getDebugContext: () => `Content-Type: ${contentType}, ${text2.length} bytes, preview: ${createPreview(data)}`
|
|
128159
|
-
};
|
|
128160
|
-
}
|
|
128161
128959
|
class CborTransport {
|
|
128162
128960
|
constructor() {
|
|
128163
128961
|
__publicField(this, "contentType", "application/cbor");
|
|
@@ -128848,6 +129646,96 @@ async function getEventsByCorrelationIdV4(correlationId, params = {}, config2) {
|
|
|
128848
129646
|
const url2 = `${baseUrl}/v4/events?${sp.toString()}`;
|
|
128849
129647
|
return consumeListFrameStream(url2, headers2, config2, "listEventsByCorrelationId");
|
|
128850
129648
|
}
|
|
129649
|
+
const FORMAT_PREFIX_LENGTH = 4;
|
|
129650
|
+
const GZIP_FORMAT_PREFIX = "gzip";
|
|
129651
|
+
const ZSTD_FORMAT_PREFIX = "zstd";
|
|
129652
|
+
const formatDecoder = new TextDecoder();
|
|
129653
|
+
const V4_EXTRA_EVENT_DATA_REF_FIELDS = {
|
|
129654
|
+
run_started: ["input"],
|
|
129655
|
+
step_started: ["input"]
|
|
129656
|
+
};
|
|
129657
|
+
function getNodeZlib() {
|
|
129658
|
+
var _a3, _b2;
|
|
129659
|
+
try {
|
|
129660
|
+
return (_b2 = (_a3 = globalThis.process) == null ? void 0 : _a3.getBuiltinModule) == null ? void 0 : _b2.call(_a3, "node:zlib");
|
|
129661
|
+
} catch {
|
|
129662
|
+
return void 0;
|
|
129663
|
+
}
|
|
129664
|
+
}
|
|
129665
|
+
function peekFormatPrefix(value) {
|
|
129666
|
+
if (!(value instanceof Uint8Array) || value.byteLength < FORMAT_PREFIX_LENGTH) {
|
|
129667
|
+
return null;
|
|
129668
|
+
}
|
|
129669
|
+
return formatDecoder.decode(value.subarray(0, FORMAT_PREFIX_LENGTH));
|
|
129670
|
+
}
|
|
129671
|
+
function decompress(format2, payload) {
|
|
129672
|
+
const zlib = getNodeZlib();
|
|
129673
|
+
const decompress2 = format2 === ZSTD_FORMAT_PREFIX ? zlib == null ? void 0 : zlib.zstdDecompressSync : zlib == null ? void 0 : zlib.gunzipSync;
|
|
129674
|
+
if (!decompress2) {
|
|
129675
|
+
throw new WorkflowWorldError(`Received ${format2}-compressed workflow data, but this Node.js runtime does not support ${format2} decompression. Use a compatible Node.js runtime or request unresolved data.`);
|
|
129676
|
+
}
|
|
129677
|
+
return new Uint8Array(decompress2(payload));
|
|
129678
|
+
}
|
|
129679
|
+
function normalizeSerializedData(value) {
|
|
129680
|
+
const format2 = peekFormatPrefix(value);
|
|
129681
|
+
if (format2 !== ZSTD_FORMAT_PREFIX && format2 !== GZIP_FORMAT_PREFIX) {
|
|
129682
|
+
return value;
|
|
129683
|
+
}
|
|
129684
|
+
const bytes = value;
|
|
129685
|
+
return decompress(format2, bytes.subarray(FORMAT_PREFIX_LENGTH));
|
|
129686
|
+
}
|
|
129687
|
+
function normalizeWorkflowRunData(run2) {
|
|
129688
|
+
return {
|
|
129689
|
+
...run2,
|
|
129690
|
+
input: normalizeSerializedData(run2.input),
|
|
129691
|
+
output: normalizeSerializedData(run2.output),
|
|
129692
|
+
error: normalizeSerializedData(run2.error)
|
|
129693
|
+
};
|
|
129694
|
+
}
|
|
129695
|
+
function normalizeStepData(step) {
|
|
129696
|
+
return {
|
|
129697
|
+
...step,
|
|
129698
|
+
input: normalizeSerializedData(step.input),
|
|
129699
|
+
output: normalizeSerializedData(step.output),
|
|
129700
|
+
error: normalizeSerializedData(step.error)
|
|
129701
|
+
};
|
|
129702
|
+
}
|
|
129703
|
+
function normalizeHookData(hook) {
|
|
129704
|
+
return {
|
|
129705
|
+
...hook,
|
|
129706
|
+
metadata: normalizeSerializedData(hook.metadata)
|
|
129707
|
+
};
|
|
129708
|
+
}
|
|
129709
|
+
function normalizeEventData(event) {
|
|
129710
|
+
const eventData = event.eventData;
|
|
129711
|
+
if (!eventData || typeof eventData !== "object") {
|
|
129712
|
+
return event;
|
|
129713
|
+
}
|
|
129714
|
+
const eventType = typeof event.eventType === "string" ? event.eventType : "";
|
|
129715
|
+
const refFields = [
|
|
129716
|
+
.../* @__PURE__ */ new Set([
|
|
129717
|
+
...EVENT_DATA_REF_FIELDS[eventType] ?? [],
|
|
129718
|
+
...V4_EXTRA_EVENT_DATA_REF_FIELDS[eventType] ?? []
|
|
129719
|
+
])
|
|
129720
|
+
];
|
|
129721
|
+
if (refFields.length === 0) {
|
|
129722
|
+
return event;
|
|
129723
|
+
}
|
|
129724
|
+
const normalizedEventData = { ...eventData };
|
|
129725
|
+
let changed = false;
|
|
129726
|
+
for (const field of refFields) {
|
|
129727
|
+
if (!(field in normalizedEventData)) {
|
|
129728
|
+
continue;
|
|
129729
|
+
}
|
|
129730
|
+
const before = normalizedEventData[field];
|
|
129731
|
+
const after = normalizeSerializedData(before);
|
|
129732
|
+
if (after !== before) {
|
|
129733
|
+
normalizedEventData[field] = after;
|
|
129734
|
+
changed = true;
|
|
129735
|
+
}
|
|
129736
|
+
}
|
|
129737
|
+
return changed ? { ...event, eventData: normalizedEventData } : event;
|
|
129738
|
+
}
|
|
128851
129739
|
const WorkflowRunWireBaseSchema = WorkflowRunBaseSchema.omit({
|
|
128852
129740
|
error: true,
|
|
128853
129741
|
errorCode: true
|
|
@@ -128873,14 +129761,14 @@ const WorkflowRunWireWithRefsSchema = WorkflowRunWireBaseSchema.omit({
|
|
|
128873
129761
|
function filterRunData(run2, resolveData) {
|
|
128874
129762
|
if (resolveData === "none") {
|
|
128875
129763
|
const { inputRef: _inputRef, outputRef: _outputRef, ...rest } = run2;
|
|
128876
|
-
const deserialized = deserializeError(rest);
|
|
129764
|
+
const deserialized = normalizeWorkflowRunData(deserializeError(rest));
|
|
128877
129765
|
return {
|
|
128878
129766
|
...deserialized,
|
|
128879
129767
|
input: void 0,
|
|
128880
129768
|
output: void 0
|
|
128881
129769
|
};
|
|
128882
129770
|
}
|
|
128883
|
-
return deserializeError(run2);
|
|
129771
|
+
return normalizeWorkflowRunData(deserializeError(run2));
|
|
128884
129772
|
}
|
|
128885
129773
|
async function listWorkflowRuns(params = {}, config2) {
|
|
128886
129774
|
const { workflowName, status, pagination, resolveData = DEFAULT_RESOLVE_DATA_OPTION } = params;
|
|
@@ -129012,14 +129900,14 @@ function deserializeStep(wireStep) {
|
|
|
129012
129900
|
function filterStepData(step, resolveData) {
|
|
129013
129901
|
if (resolveData === "none") {
|
|
129014
129902
|
const { inputRef: _inputRef, outputRef: _outputRef, ...rest } = step;
|
|
129015
|
-
const deserialized = deserializeStep(rest);
|
|
129903
|
+
const deserialized = normalizeStepData(deserializeStep(rest));
|
|
129016
129904
|
return {
|
|
129017
129905
|
...deserialized,
|
|
129018
129906
|
input: void 0,
|
|
129019
129907
|
output: void 0
|
|
129020
129908
|
};
|
|
129021
129909
|
}
|
|
129022
|
-
return deserializeStep(step);
|
|
129910
|
+
return normalizeStepData(deserializeStep(step));
|
|
129023
129911
|
}
|
|
129024
129912
|
async function listWorkflowRunSteps(params, config2) {
|
|
129025
129913
|
const { runId, pagination, resolveData = DEFAULT_RESOLVE_DATA_OPTION } = params;
|
|
@@ -129177,12 +130065,17 @@ function coerceEventDates(raw2) {
|
|
|
129177
130065
|
}
|
|
129178
130066
|
return raw2;
|
|
129179
130067
|
}
|
|
130068
|
+
function coerceNormalizedEvent(raw2) {
|
|
130069
|
+
return coerceEventDates(normalizeEventData(raw2));
|
|
130070
|
+
}
|
|
129180
130071
|
function buildEventFromV4(decoded, payloadBody, resolveData) {
|
|
129181
130072
|
const eventData = decoded.eventData ?? {};
|
|
129182
130073
|
if (payloadBody.byteLength > 0) {
|
|
129183
130074
|
const payloadField = payloadFieldFor(decoded.eventType);
|
|
129184
|
-
|
|
129185
|
-
|
|
130075
|
+
const normalizedPayload = normalizeSerializedData(payloadBody);
|
|
130076
|
+
if (payloadField && normalizedPayload instanceof Uint8Array) {
|
|
130077
|
+
eventData[payloadField] = normalizedPayload;
|
|
130078
|
+
}
|
|
129186
130079
|
}
|
|
129187
130080
|
const raw2 = {
|
|
129188
130081
|
eventId: decoded.eventId,
|
|
@@ -129196,7 +130089,7 @@ function buildEventFromV4(decoded, payloadBody, resolveData) {
|
|
|
129196
130089
|
eventData,
|
|
129197
130090
|
...decoded.specVersion !== void 0 ? { specVersion: decoded.specVersion } : {}
|
|
129198
130091
|
};
|
|
129199
|
-
const event =
|
|
130092
|
+
const event = coerceNormalizedEvent(raw2);
|
|
129200
130093
|
return resolveData === "none" ? stripEventDataRefs(event, "none") : event;
|
|
129201
130094
|
}
|
|
129202
130095
|
async function getEvent(runId, eventId, params, config2) {
|
|
@@ -129312,7 +130205,7 @@ function filterHookData(hook, resolveData) {
|
|
|
129312
130205
|
const { metadataRef: _metadataRef, ...rest } = hook;
|
|
129313
130206
|
return rest;
|
|
129314
130207
|
}
|
|
129315
|
-
return hook;
|
|
130208
|
+
return normalizeHookData(hook);
|
|
129316
130209
|
}
|
|
129317
130210
|
const HookWithRefsSchema = HookSchema.omit({
|
|
129318
130211
|
metadata: true
|
|
@@ -129405,6 +130298,10 @@ function createStorage(config2) {
|
|
|
129405
130298
|
};
|
|
129406
130299
|
}
|
|
129407
130300
|
const MAX_CHUNKS_PER_REQUEST = 1e3;
|
|
130301
|
+
const getMaxChunksPerRequest = () => envNumber("WORKFLOW_MAX_CHUNKS_PER_REQUEST", MAX_CHUNKS_PER_REQUEST, {
|
|
130302
|
+
integer: true,
|
|
130303
|
+
min: 1
|
|
130304
|
+
});
|
|
129408
130305
|
function getStreamUrl(name2, runId, httpConfig) {
|
|
129409
130306
|
return new URL(`${httpConfig.baseUrl}/v2/runs/${encodeURIComponent(runId)}/stream/${encodeURIComponent(name2)}`);
|
|
129410
130307
|
}
|
|
@@ -129476,8 +130373,9 @@ function createStreamer(config2) {
|
|
|
129476
130373
|
const resolvedRunId = await runId;
|
|
129477
130374
|
const httpConfig = await getHttpConfig(config2);
|
|
129478
130375
|
httpConfig.headers.set("X-Stream-Multi", "true");
|
|
129479
|
-
|
|
129480
|
-
|
|
130376
|
+
const maxChunksPerRequest = getMaxChunksPerRequest();
|
|
130377
|
+
for (let i = 0; i < chunks.length; i += maxChunksPerRequest) {
|
|
130378
|
+
const batch = chunks.slice(i, i + maxChunksPerRequest);
|
|
129481
130379
|
const body2 = encodeMultiChunks(batch);
|
|
129482
130380
|
const url2 = getStreamUrl(name2, resolvedRunId, httpConfig);
|
|
129483
130381
|
const response2 = await instrumentedFetch({
|
|
@@ -129590,6 +130488,7 @@ function createVercelWorld(config2) {
|
|
|
129590
130488
|
processExitTriggersQueueRedelivery: true,
|
|
129591
130489
|
...createQueue$1(config2),
|
|
129592
130490
|
...createStorage(config2),
|
|
130491
|
+
analytics: createAnalytics(config2),
|
|
129593
130492
|
...instrumentObject("world.streams", createStreamer(config2)),
|
|
129594
130493
|
getEncryptionKeyForRun: createGetEncryptionKeyForRun(projectId, (_b2 = config2 == null ? void 0 : config2.projectConfig) == null ? void 0 : _b2.teamId, config2 == null ? void 0 : config2.token, config2 == null ? void 0 : config2.dispatcher),
|
|
129595
130494
|
resolveLatestDeploymentId: createResolveLatestDeploymentId(config2)
|
|
@@ -129597,9 +130496,17 @@ function createVercelWorld(config2) {
|
|
|
129597
130496
|
}
|
|
129598
130497
|
function getRuntimeRequire() {
|
|
129599
130498
|
try {
|
|
129600
|
-
return createRequire$1(
|
|
130499
|
+
return createRequire$1(
|
|
130500
|
+
/* webpackIgnore: true */
|
|
130501
|
+
/* turbopackIgnore: true */
|
|
130502
|
+
pathToFileURL(process.cwd() + "/package.json").href
|
|
130503
|
+
);
|
|
129601
130504
|
} catch {
|
|
129602
|
-
return createRequire$1(
|
|
130505
|
+
return createRequire$1(
|
|
130506
|
+
/* webpackIgnore: true */
|
|
130507
|
+
/* turbopackIgnore: true */
|
|
130508
|
+
import.meta.url
|
|
130509
|
+
);
|
|
129603
130510
|
}
|
|
129604
130511
|
}
|
|
129605
130512
|
const WorldCache = Symbol.for("@workflow/world//cache");
|
|
@@ -129610,16 +130517,29 @@ function resolveModulePath(specifier) {
|
|
|
129610
130517
|
return specifier;
|
|
129611
130518
|
}
|
|
129612
130519
|
if (specifier.startsWith("/")) {
|
|
129613
|
-
return pathToFileURL(
|
|
130520
|
+
return pathToFileURL(
|
|
130521
|
+
/* webpackIgnore: true */
|
|
130522
|
+
/* turbopackIgnore: true */
|
|
130523
|
+
specifier
|
|
130524
|
+
).href;
|
|
129614
130525
|
}
|
|
129615
130526
|
if (specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
129616
130527
|
return pathToFileURL(
|
|
130528
|
+
/* webpackIgnore: true */
|
|
129617
130529
|
/* turbopackIgnore: true */
|
|
129618
130530
|
process.cwd() + "/" + specifier
|
|
129619
130531
|
).href;
|
|
129620
130532
|
}
|
|
129621
130533
|
try {
|
|
129622
|
-
return pathToFileURL(
|
|
130534
|
+
return pathToFileURL(
|
|
130535
|
+
/* webpackIgnore: true */
|
|
130536
|
+
/* turbopackIgnore: true */
|
|
130537
|
+
getRuntimeRequire().resolve(
|
|
130538
|
+
/* webpackIgnore: true */
|
|
130539
|
+
/* turbopackIgnore: true */
|
|
130540
|
+
specifier
|
|
130541
|
+
)
|
|
130542
|
+
).href;
|
|
129623
130543
|
} catch {
|
|
129624
130544
|
return specifier;
|
|
129625
130545
|
}
|
|
@@ -129645,11 +130565,16 @@ const createWorld = async () => {
|
|
|
129645
130565
|
}
|
|
129646
130566
|
let mod;
|
|
129647
130567
|
try {
|
|
129648
|
-
mod = getRuntimeRequire()(
|
|
130568
|
+
mod = getRuntimeRequire()(
|
|
130569
|
+
/* webpackIgnore: true */
|
|
130570
|
+
/* turbopackIgnore: true */
|
|
130571
|
+
targetWorld
|
|
130572
|
+
);
|
|
129649
130573
|
} catch {
|
|
129650
130574
|
const resolvedPath = resolveModulePath(targetWorld);
|
|
129651
130575
|
mod = await import(
|
|
129652
130576
|
/* webpackIgnore: true */
|
|
130577
|
+
/* turbopackIgnore: true */
|
|
129653
130578
|
resolvedPath
|
|
129654
130579
|
);
|
|
129655
130580
|
}
|
|
@@ -129664,6 +130589,7 @@ const createWorld = async () => {
|
|
|
129664
130589
|
};
|
|
129665
130590
|
const getWorld = async () => {
|
|
129666
130591
|
if (globalSymbols[WorldCache]) {
|
|
130592
|
+
assertWorldSupportsRuntimeProtocol(globalSymbols[WorldCache]);
|
|
129667
130593
|
return globalSymbols[WorldCache];
|
|
129668
130594
|
}
|
|
129669
130595
|
if (!globalSymbols[WorldCachePromise]) {
|
|
@@ -129673,6 +130599,7 @@ const getWorld = async () => {
|
|
|
129673
130599
|
});
|
|
129674
130600
|
}
|
|
129675
130601
|
globalSymbols[WorldCache] = await globalSymbols[WorldCachePromise];
|
|
130602
|
+
assertWorldSupportsRuntimeProtocol(globalSymbols[WorldCache]);
|
|
129676
130603
|
return globalSymbols[WorldCache];
|
|
129677
130604
|
};
|
|
129678
130605
|
const GetWorldFnKey = Symbol.for("@workflow/world//getWorldFn");
|
|
@@ -132548,7 +133475,8 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
132548
133475
|
span == null ? void 0 : span.setAttributes({
|
|
132549
133476
|
...WorkflowArgumentsCount(args.length)
|
|
132550
133477
|
});
|
|
132551
|
-
const world =
|
|
133478
|
+
const world = opts.world ?? await getWorldLazy();
|
|
133479
|
+
assertWorldSupportsRuntimeProtocol(world);
|
|
132552
133480
|
const currentDeploymentId = await world.getDeploymentId();
|
|
132553
133481
|
let deploymentId = opts.deploymentId ?? currentDeploymentId;
|
|
132554
133482
|
if (deploymentId === "latest") {
|
|
@@ -132582,7 +133510,7 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
132582
133510
|
const ops = [];
|
|
132583
133511
|
const runId = `wrun_${ulid()}`;
|
|
132584
133512
|
const traceCarrier = await serializeTraceCarrier();
|
|
132585
|
-
const specVersion = opts.specVersion ?? world.specVersion
|
|
133513
|
+
const specVersion = opts.specVersion ?? world.specVersion;
|
|
132586
133514
|
const v1Compat = isLegacySpecVersion(specVersion);
|
|
132587
133515
|
const allowReservedAttributes = opts.allowReservedAttributes === true;
|
|
132588
133516
|
let attributes;
|
|
@@ -138003,7 +138931,7 @@ async function fetchResourceWithCorrelationId(env2, resource, resourceId, option
|
|
|
138003
138931
|
async function fetchSpanDetailResource(env2, selection2, options = {}) {
|
|
138004
138932
|
const { resource, resourceId, runId } = selection2;
|
|
138005
138933
|
const { encryptionKey } = options;
|
|
138006
|
-
const hydrate = async (value) =>
|
|
138934
|
+
const hydrate = async (value) => hydrateResourceIOAsync(value, encryptionKey);
|
|
138007
138935
|
if (resource === "hook") {
|
|
138008
138936
|
const result = await unwrapOrThrow(fetchHook$1(env2, resourceId, "all"));
|
|
138009
138937
|
return hydrate(result);
|
|
@@ -138018,11 +138946,8 @@ async function fetchSpanDetailResource(env2, selection2, options = {}) {
|
|
|
138018
138946
|
const result = await unwrapOrThrow(
|
|
138019
138947
|
fetchEvents$1(env2, runId, { sortOrder: "asc", limit: 1e3, withData: true })
|
|
138020
138948
|
);
|
|
138021
|
-
const allEvents = result.data.map(
|
|
138022
|
-
hydrateResourceIO
|
|
138023
|
-
);
|
|
138024
138949
|
const waitEvents = await Promise.all(
|
|
138025
|
-
|
|
138950
|
+
result.data.filter((e) => e.correlationId === resourceId).map(hydrate)
|
|
138026
138951
|
);
|
|
138027
138952
|
const data2 = waitEventsToWaitEntity(waitEvents);
|
|
138028
138953
|
if (data2 === null) {
|
|
@@ -153505,14 +154430,8 @@ function useEventsListData(env2, runId, options = {}) {
|
|
|
153505
154430
|
const encryptionKeyRef = reactExports.useRef(encryptionKey);
|
|
153506
154431
|
encryptionKeyRef.current = encryptionKey;
|
|
153507
154432
|
const hydrateEvents = reactExports.useCallback(async (rawEvents) => {
|
|
153508
|
-
const hydrated = rawEvents.map(hydrateResourceIO);
|
|
153509
154433
|
const key = encryptionKeyRef.current;
|
|
153510
|
-
|
|
153511
|
-
return Promise.all(
|
|
153512
|
-
hydrated.map((ev) => hydrateResourceIOWithKey(ev, key))
|
|
153513
|
-
);
|
|
153514
|
-
}
|
|
153515
|
-
return hydrated;
|
|
154434
|
+
return Promise.all(rawEvents.map((ev) => hydrateResourceIOAsync(ev, key)));
|
|
153516
154435
|
}, []);
|
|
153517
154436
|
const fetchInitial = reactExports.useCallback(async () => {
|
|
153518
154437
|
if (isFetchingRef.current) return;
|
|
@@ -153550,7 +154469,7 @@ function useEventsListData(env2, runId, options = {}) {
|
|
|
153550
154469
|
reactExports.useEffect(() => {
|
|
153551
154470
|
if (!encryptionKey || events2.length === 0) return;
|
|
153552
154471
|
let cancelled = false;
|
|
153553
|
-
Promise.all(events2.map((ev) =>
|
|
154472
|
+
Promise.all(events2.map((ev) => hydrateResourceIOAsync(ev, encryptionKey))).then((decrypted) => {
|
|
153554
154473
|
if (!cancelled) setEvents(decrypted);
|
|
153555
154474
|
}).catch(() => {
|
|
153556
154475
|
});
|
|
@@ -153953,7 +154872,6 @@ function LiveStatus({ hasError, errorMessage }) {
|
|
|
153953
154872
|
});
|
|
153954
154873
|
function RunDetailView({
|
|
153955
154874
|
runId,
|
|
153956
|
-
// TODO: This should open the right sidebar within the trace viewer
|
|
153957
154875
|
selectedId: _selectedId
|
|
153958
154876
|
}) {
|
|
153959
154877
|
var _a3;
|
|
@@ -154031,7 +154949,10 @@ function RunDetailView({
|
|
|
154031
154949
|
if (error22) {
|
|
154032
154950
|
throw error22;
|
|
154033
154951
|
}
|
|
154034
|
-
const fullEvent =
|
|
154952
|
+
const fullEvent = await hydrateResourceIOAsync(
|
|
154953
|
+
result,
|
|
154954
|
+
encryptionKeyRef.current ?? void 0
|
|
154955
|
+
);
|
|
154035
154956
|
if ("eventData" in fullEvent) {
|
|
154036
154957
|
return fullEvent.eventData;
|
|
154037
154958
|
}
|
|
@@ -154047,7 +154968,10 @@ function RunDetailView({
|
|
|
154047
154968
|
if (error22) {
|
|
154048
154969
|
throw error22;
|
|
154049
154970
|
}
|
|
154050
|
-
const fullEvent =
|
|
154971
|
+
const fullEvent = await hydrateResourceIOAsync(
|
|
154972
|
+
result,
|
|
154973
|
+
encryptionKeyRef.current ?? void 0
|
|
154974
|
+
);
|
|
154051
154975
|
if ("eventData" in fullEvent) {
|
|
154052
154976
|
return fullEvent.eventData;
|
|
154053
154977
|
}
|
|
@@ -154654,7 +155578,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
154654
155578
|
__proto__: null,
|
|
154655
155579
|
loader
|
|
154656
155580
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
154657
|
-
const serverManifest = { "entry": { "module": "/assets/entry.client-DOJDY_4b.js", "imports": ["/assets/index-BXZSIDEp.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-
|
|
155581
|
+
const serverManifest = { "entry": { "module": "/assets/entry.client-DOJDY_4b.js", "imports": ["/assets/index-BXZSIDEp.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-CsCdj08f.js", "imports": ["/assets/index-BXZSIDEp.js", "/assets/mermaid-3ZIDBTTL-aixonSAh.js"], "css": ["/assets/root-BlaSucTH.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-DQkixJk4.js", "imports": ["/assets/index-BXZSIDEp.js", "/assets/workflow-graph-viewer-BlPvo_5I.js", "/assets/mermaid-3ZIDBTTL-aixonSAh.js", "/assets/index-ConSkUmc.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-CCsVqid_.js", "imports": ["/assets/index-BXZSIDEp.js", "/assets/workflow-graph-viewer-BlPvo_5I.js", "/assets/mermaid-3ZIDBTTL-aixonSAh.js", "/assets/encryption-BQTnudEZ.js", "/assets/index-ConSkUmc.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-ce6dd06d.js", "version": "ce6dd06d", "sri": void 0 };
|
|
154658
155582
|
const assetsBuildDirectory = "build/client";
|
|
154659
155583
|
const basename = "/";
|
|
154660
155584
|
const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
|
|
@@ -154723,64 +155647,79 @@ const serverBuild = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
154723
155647
|
ssr
|
|
154724
155648
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
154725
155649
|
export {
|
|
154726
|
-
|
|
155650
|
+
isLegacySpecVersion as $,
|
|
154727
155651
|
ATTRIBUTE_KEY_MAX_LENGTH as A,
|
|
154728
155652
|
BaseEventSchema as B,
|
|
154729
|
-
|
|
155653
|
+
TERMINAL_WORKFLOW_RUN_STATUSES as C,
|
|
154730
155654
|
DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS as D,
|
|
154731
155655
|
EVENT_DATA_REF_FIELDS as E,
|
|
154732
|
-
|
|
154733
|
-
|
|
155656
|
+
TerminalRunEventTypeSchema as F,
|
|
155657
|
+
TerminalStepStatusSchema as G,
|
|
154734
155658
|
HookSchema as H,
|
|
154735
|
-
|
|
154736
|
-
|
|
154737
|
-
|
|
155659
|
+
TerminalWorkflowRunStatusSchema as I,
|
|
155660
|
+
WaitStatusSchema as J,
|
|
155661
|
+
WorkflowInvokePayloadSchema as K,
|
|
154738
155662
|
LegacySerializedDataSchemaV1 as L,
|
|
154739
155663
|
MessageId as M,
|
|
154740
155664
|
Nt as N,
|
|
154741
|
-
|
|
155665
|
+
WorkflowRunBaseSchema as O,
|
|
154742
155666
|
PaginatedResponseSchema as P,
|
|
154743
155667
|
QueuePayloadSchema as Q,
|
|
154744
155668
|
RESERVED_ATTRIBUTE_KEY_PREFIX as R,
|
|
154745
155669
|
SPEC_VERSION_CURRENT as S,
|
|
154746
|
-
|
|
154747
|
-
|
|
155670
|
+
TERMINAL_RUN_EVENT_TYPES as T,
|
|
155671
|
+
WorkflowRunSchema as U,
|
|
154748
155672
|
ValidQueueName as V,
|
|
154749
155673
|
WaitSchema as W,
|
|
154750
|
-
|
|
154751
|
-
|
|
154752
|
-
|
|
154753
|
-
|
|
155674
|
+
WorkflowRunStatusSchema as X,
|
|
155675
|
+
applyAttributeChanges as Y,
|
|
155676
|
+
envNumber as Z,
|
|
155677
|
+
getQueueTopicPrefix as _,
|
|
154754
155678
|
ATTRIBUTE_MAX_PER_RUN as a,
|
|
154755
|
-
|
|
154756
|
-
|
|
154757
|
-
|
|
154758
|
-
|
|
154759
|
-
|
|
154760
|
-
|
|
155679
|
+
isTerminalRunEventType as a0,
|
|
155680
|
+
isTerminalStepStatus as a1,
|
|
155681
|
+
isTerminalWorkflowRunStatus as a2,
|
|
155682
|
+
parseQueueName as a3,
|
|
155683
|
+
reenqueueActiveRuns as a4,
|
|
155684
|
+
requiresNewerWorld as a5,
|
|
155685
|
+
resolveQueueNamespace as a6,
|
|
155686
|
+
stripEventDataRefs as a7,
|
|
155687
|
+
ulidToDate as a8,
|
|
155688
|
+
validateAttributeChanges as a9,
|
|
155689
|
+
validateAttributeKey as aa,
|
|
155690
|
+
validateAttributeValue as ab,
|
|
155691
|
+
validateUlidTimestamp as ac,
|
|
155692
|
+
R as ad,
|
|
155693
|
+
Ks as ae,
|
|
155694
|
+
jsxRuntimeExports as af,
|
|
155695
|
+
Qe as ag,
|
|
155696
|
+
registerZstdDecoder as ah,
|
|
155697
|
+
requireTokenUtil as ai,
|
|
155698
|
+
requireTokenError as aj,
|
|
155699
|
+
serverBuild as ak,
|
|
154761
155700
|
ATTRIBUTE_VALUE_MAX_BYTES as b,
|
|
154762
|
-
|
|
154763
|
-
|
|
154764
|
-
|
|
154765
|
-
|
|
154766
|
-
|
|
154767
|
-
|
|
154768
|
-
|
|
154769
|
-
|
|
154770
|
-
|
|
154771
|
-
|
|
154772
|
-
|
|
154773
|
-
|
|
154774
|
-
|
|
154775
|
-
|
|
154776
|
-
|
|
154777
|
-
|
|
154778
|
-
|
|
154779
|
-
|
|
154780
|
-
|
|
154781
|
-
|
|
154782
|
-
|
|
154783
|
-
|
|
154784
|
-
|
|
154785
|
-
|
|
155701
|
+
AnalyticsEventSchema as c,
|
|
155702
|
+
AnalyticsHookSchema as d,
|
|
155703
|
+
AnalyticsRunSchema as e,
|
|
155704
|
+
AnalyticsStepSchema as f,
|
|
155705
|
+
AnalyticsWaitSchema as g,
|
|
155706
|
+
AttributeChangeSchema as h,
|
|
155707
|
+
AttributeChangesSchema as i,
|
|
155708
|
+
AttributeValidationError as j,
|
|
155709
|
+
DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS as k,
|
|
155710
|
+
EventSchema as l,
|
|
155711
|
+
EventTypeSchema as m,
|
|
155712
|
+
HealthCheckPayloadSchema as n,
|
|
155713
|
+
HookCreatedEventSchema as o,
|
|
155714
|
+
QueuePrefix as p,
|
|
155715
|
+
RunInputSchema as q,
|
|
155716
|
+
SPEC_VERSION_LEGACY as r,
|
|
155717
|
+
SPEC_VERSION_SUPPORTS_ATTRIBUTES as s,
|
|
155718
|
+
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT as t,
|
|
155719
|
+
SPEC_VERSION_SUPPORTS_COMPRESSION as u,
|
|
155720
|
+
SerializedDataSchema as v,
|
|
155721
|
+
StepInvokePayloadSchema as w,
|
|
155722
|
+
StepSchema as x,
|
|
155723
|
+
StepStatusSchema as y,
|
|
155724
|
+
TERMINAL_STEP_STATUSES as z
|
|
154786
155725
|
};
|