@voyant-travel/workflows 0.107.10 → 0.108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -8
- package/dist/auth/index.d.ts +8 -56
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +8 -114
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/driver.d.ts +7 -8
- package/dist/driver.d.ts.map +1 -1
- package/dist/driver.js +2 -2
- package/dist/events/manifest-builder.d.ts +1 -1
- package/dist/events/manifest-builder.d.ts.map +1 -1
- package/dist/events/manifest-builder.js +1 -1
- package/dist/handler/index.d.ts +0 -14
- package/dist/handler/index.d.ts.map +1 -1
- package/dist/handler/index.js +2 -3
- package/dist/http-ingest.js +4 -4
- package/dist/protocol/index.d.ts +3 -3
- package/dist/protocol/index.d.ts.map +1 -1
- package/dist/runtime/executor.d.ts +7 -19
- package/dist/runtime/executor.d.ts.map +1 -1
- package/dist/runtime/executor.js +8 -11
- package/dist/runtime/journal.d.ts +2 -4
- package/dist/runtime/journal.d.ts.map +1 -1
- package/dist/types.d.ts +1 -19
- package/dist/types.d.ts.map +1 -1
- package/dist/workflow.d.ts +10 -2
- package/dist/workflow.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/auth/index.ts +8 -125
- package/src/config.ts +2 -3
- package/src/driver.ts +9 -10
- package/src/events/manifest-builder.ts +2 -2
- package/src/handler/index.ts +2 -17
- package/src/http-ingest.ts +4 -4
- package/src/protocol/index.ts +4 -4
- package/src/runtime/executor.ts +17 -30
- package/src/runtime/journal.ts +2 -4
- package/src/types.ts +1 -19
- package/src/workflow.ts +10 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/runtime/executor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAgB,KAAK,W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qBAAqB,EAAE,CAAA;IACnC,eAAe,EAAE,gBAAgB,EAAE,CAAA;IACnC,OAAO,EAAE,YAAY,CAAA;IACrB,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B,GACD;IACE,MAAM,EAAE,aAAa,CAAA;IACrB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,kBAAkB,EAAE,CAAA;IACnC,eAAe,EAAE,gBAAgB,EAAE,CAAA;IACnC,OAAO,EAAE,YAAY,CAAA;IACrB,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B,GACD;IACE,MAAM,EAAE,qBAAqB,CAAA;IAC7B,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,kBAAkB,EAAE,CAAA;IACnC,eAAe,EAAE,gBAAgB,EAAE,CAAA;IACnC,OAAO,EAAE,YAAY,CAAA;IACrB,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B,CAAA;AAQL,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,kBAAkB,EACvB,GAAG,EAAE,0BAA0B,GAC9B,OAAO,CAAC,2BAA2B,CAAC,CAoKtC;AA4ED,YAAY,EAAE,SAAS,EAAE,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAA"}
|
package/dist/runtime/executor.js
CHANGED
|
@@ -34,15 +34,13 @@ export async function executeWorkflowStep(def, req) {
|
|
|
34
34
|
signal: abortSignal,
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
`pass { nodeStepRunner } to createStepHandler() or remove options.runtime`);
|
|
42
|
-
e.code = "NODE_RUNTIME_UNAVAILABLE";
|
|
37
|
+
const requestedRuntime = args.options.runtime;
|
|
38
|
+
if (requestedRuntime !== undefined && requestedRuntime !== "node") {
|
|
39
|
+
const e = new Error(`step "${args.stepId}" declared runtime="${String(requestedRuntime)}" but workflows are node-only; remove options.runtime or use runtime="node"`);
|
|
40
|
+
e.code = "UNSUPPORTED_WORKFLOW_RUNTIME";
|
|
43
41
|
throw e;
|
|
44
42
|
}
|
|
45
|
-
const entry = await
|
|
43
|
+
const entry = await req.stepRunner({
|
|
46
44
|
stepId: args.stepId,
|
|
47
45
|
attempt: args.attempt,
|
|
48
46
|
input: args.input,
|
|
@@ -56,10 +54,9 @@ export async function executeWorkflowStep(def, req) {
|
|
|
56
54
|
options: args.options,
|
|
57
55
|
journal: req.journal,
|
|
58
56
|
});
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
entry.runtime = runtime;
|
|
57
|
+
// Keep the runtime stamp for downstream consumers that display
|
|
58
|
+
// execution metadata. There is one supported runtime now.
|
|
59
|
+
entry.runtime = "node";
|
|
63
60
|
return entry;
|
|
64
61
|
},
|
|
65
62
|
registerWaitpoint(args) {
|
|
@@ -8,11 +8,9 @@ export interface StepJournalEntry {
|
|
|
8
8
|
startedAt: number;
|
|
9
9
|
finishedAt: number;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* routing between `stepRunner` (edge) and `nodeStepRunner`.
|
|
13
|
-
* Informational only — doesn't affect replay.
|
|
11
|
+
* Runtime that executed the step. Informational only — doesn't affect replay.
|
|
14
12
|
*/
|
|
15
|
-
runtime?: "
|
|
13
|
+
runtime?: "node";
|
|
16
14
|
}
|
|
17
15
|
export interface WaitpointResolutionEntry {
|
|
18
16
|
kind: WaitpointKind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../../src/runtime/journal.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,IAAI,GAA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,CAAC,CAAA;IAC5D,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAA;IAC1D,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACtC;;;;;;OAMG;IACH,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzD;AAED,wBAAgB,YAAY,IAAI,YAAY,CAQ3C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,YAAY,GAAG,YAAY,CAQzD"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
export type Duration = number | `${number}${"ms" | "s" | "m" | "h" | "d" | "w"}`;
|
|
2
|
-
/**
|
|
3
|
-
* Cloudflare Container instance types — the set Voyant Cloud honors
|
|
4
|
-
* for `runtime: "node"` steps. Match the sizes published at
|
|
5
|
-
* https://developers.cloudflare.com/containers/ (as of
|
|
6
|
-
* compat-date 2026-04-01).
|
|
7
|
-
*
|
|
8
|
-
* | name | vCPU | memory | disk |
|
|
9
|
-
* | ----------- | ----- | ------- | ----- |
|
|
10
|
-
* | lite | 1/16 | 256 MiB | 2 GB |
|
|
11
|
-
* | basic | 1/4 | 1 GiB | 4 GB |
|
|
12
|
-
* | standard-1 | 1/2 | 4 GiB | 8 GB |
|
|
13
|
-
* | standard-2 | 1 | 6 GiB | 12 GB |
|
|
14
|
-
* | standard-3 | 2 | 8 GiB | 16 GB |
|
|
15
|
-
* | standard-4 | 4 | 12 GiB | 20 GB |
|
|
16
|
-
*
|
|
17
|
-
* The open `(string & {})` escape hatch accepts CF custom instance
|
|
18
|
-
* types (up to 4 vCPU / 12 GiB / 20 GB, min 3 GiB RAM per vCPU) —
|
|
19
|
-
* rendered as `"custom-<vcpu>-<ramGiB>"` by convention.
|
|
20
|
-
*/
|
|
2
|
+
/** Hosted/self-hosted Node runner profile. */
|
|
21
3
|
export type MachineType = "lite" | "basic" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | (string & {});
|
|
22
4
|
export type EnvironmentName = "production" | "preview" | "development";
|
|
23
5
|
export type RunStatus = "pending" | "queued" | "running" | "waiting" | "completed" | "failed" | "cancelled" | "cancelled_by_dev_reload" | "cancelled_by_version_sunset" | "compensated" | "compensation_failed" | "timed_out";
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE,CAAA;AAEhF
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE,CAAA;AAEhF,8CAA8C;AAC9C,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,OAAO,GACP,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEjB,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA;AAEtE,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,QAAQ,GACR,SAAS,GACT,SAAS,GACT,WAAW,GACX,QAAQ,GACR,WAAW,GACX,yBAAyB,GACzB,6BAA6B,GAC7B,aAAa,GACb,qBAAqB,GACrB,WAAW,CAAA;AAEf,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,QAAQ,GACR,WAAW,GACX,2BAA2B,GAC3B,WAAW,GACX,gBAAgB,GAChB,UAAU,CAAA;AAEd,MAAM,MA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AM,CAAA;CAAE,CAAA"}
|
package/dist/workflow.d.ts
CHANGED
|
@@ -16,7 +16,11 @@ export interface WorkflowConfig<TInput, TOutput> {
|
|
|
16
16
|
concurrency?: ConcurrencyPolicy<TInput>;
|
|
17
17
|
retry?: RetryPolicy;
|
|
18
18
|
timeout?: Duration;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Workflows execute on the Node runtime. Kept as an optional field so
|
|
21
|
+
* existing manifests/configs can annotate the runtime explicitly.
|
|
22
|
+
*/
|
|
23
|
+
defaultRuntime?: "node";
|
|
20
24
|
tags?: string[];
|
|
21
25
|
run: (input: TInput, ctx: WorkflowContext<TInput>) => Promise<TOutput>;
|
|
22
26
|
}
|
|
@@ -135,7 +139,11 @@ export interface StepContext {
|
|
|
135
139
|
log: (level: "info" | "warn" | "error", msg: string, data?: object) => void;
|
|
136
140
|
}
|
|
137
141
|
export interface StepOptions<T = unknown> {
|
|
138
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Steps execute on the Node runtime. Kept as an optional no-op annotation
|
|
144
|
+
* for callers that already specify `runtime: "node"`.
|
|
145
|
+
*/
|
|
146
|
+
runtime?: "node";
|
|
139
147
|
machine?: MachineType;
|
|
140
148
|
timeout?: Duration;
|
|
141
149
|
retry?: RetryPolicy | {
|
package/dist/workflow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,WAAW,EACX,aAAa,EACb,WAAW,EACX,SAAS,EACT,UAAU,EACX,MAAM,YAAY,CAAA;AAInB,MAAM,WAAW,cAAc,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IACjE,Q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,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;AAC7F,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAA;IACb,UAAU,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,CAAA;CACjC;AAID,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,aAAa,EAAE,GACf;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,CAAA;AAEpC,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;IAC5C,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;IACtC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,WAAY,SAAQ,qBAAqB;IACxD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,MAAM,CAAC,EAAE,qBAAqB,CAAA;IAC9B,IAAI,CAAC,EAAE,qBAAqB,CAAA;CAC7B;AAED,YAAY,EAAE,SAAS,EAAE,CAAA"}
|
package/package.json
CHANGED
package/src/auth/index.ts
CHANGED
|
@@ -24,36 +24,11 @@
|
|
|
24
24
|
|
|
25
25
|
export const AUTH_HEADER = "x-voyant-dispatch-auth" as const
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* HMAC header carried on orchestrator → node-step-container dispatches
|
|
29
|
-
* (`POST /step`). Signed over the raw request body with the shared
|
|
30
|
-
* `VOYANT_WORKFLOW_STEP_AUTH_SECRET`. See `createCfContainerStepRunner`
|
|
31
|
-
* (signing side) and `apps/workflows-node-step-container` (verifying side).
|
|
32
|
-
*/
|
|
33
|
-
export const STEP_AUTH_HEADER = "x-voyant-step-auth" as const
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* HMAC header returned by the node-step-container on successful `/step`
|
|
37
|
-
* responses. Signed over the raw JSON response body with the same
|
|
38
|
-
* `VOYANT_WORKFLOW_STEP_AUTH_SECRET` so the orchestrator can reject
|
|
39
|
-
* forged step journal entries before committing run state.
|
|
40
|
-
*/
|
|
41
|
-
export const STEP_RESPONSE_AUTH_HEADER = "x-voyant-step-response-auth" as const
|
|
42
|
-
|
|
43
|
-
/** Parse a comma-separated token/origin list env var into trimmed, non-empty entries. */
|
|
44
|
-
export function parseTokenList(raw: string | null | undefined): string[] {
|
|
45
|
-
return (raw ?? "")
|
|
46
|
-
.split(",")
|
|
47
|
-
.map((s) => s.trim())
|
|
48
|
-
.filter((s) => s.length > 0)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
27
|
/**
|
|
52
28
|
* Returns a verifier that accepts `Authorization: Bearer <token>`
|
|
53
29
|
* where `<token>` matches any of the `validTokens` (case-sensitive,
|
|
54
|
-
* constant-time compared). Usable as the `verifyRequest` dep on
|
|
55
|
-
*
|
|
56
|
-
* surface of an orchestrator or tenant Worker.
|
|
30
|
+
* constant-time compared). Usable as the `verifyRequest` dep on HTTP
|
|
31
|
+
* workflow handlers and `createStepHandler`.
|
|
57
32
|
*
|
|
58
33
|
* Intended for dev + single-tenant deployments. Production should
|
|
59
34
|
* issue per-tenant, short-lived tokens from a control plane.
|
|
@@ -98,8 +73,8 @@ function constantTimeEquals(a: string, b: string): boolean {
|
|
|
98
73
|
/**
|
|
99
74
|
* Error thrown by verifiers produced in this module. Carries an HTTP
|
|
100
75
|
* `status` + machine-readable `code` so HTTP surfaces
|
|
101
|
-
* (
|
|
102
|
-
*
|
|
76
|
+
* (the node dashboard server and step handlers) can map auth failures
|
|
77
|
+
* to the right response instead of a blanket 401.
|
|
103
78
|
*/
|
|
104
79
|
export class RequestAuthError extends Error {
|
|
105
80
|
readonly status: number
|
|
@@ -197,10 +172,10 @@ export function createBearerAuthorizer(
|
|
|
197
172
|
|
|
198
173
|
/**
|
|
199
174
|
* Resolve a `verifyRequest` hook (the dep consumed by
|
|
200
|
-
* `
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
175
|
+
* `createStepHandler`) with fail-closed defaults — the missing-token
|
|
176
|
+
* case yields a verifier that rejects every request with a 503
|
|
177
|
+
* `auth_not_configured` `RequestAuthError` instead of `undefined`
|
|
178
|
+
* (which would skip auth entirely).
|
|
204
179
|
*
|
|
205
180
|
* Returns `undefined` (auth skipped) ONLY when no tokens are
|
|
206
181
|
* configured AND `allowUnauthenticated` is explicitly set.
|
|
@@ -262,98 +237,6 @@ export async function createHmacVerifier(secret: string): Promise<(req: Request)
|
|
|
262
237
|
}
|
|
263
238
|
}
|
|
264
239
|
|
|
265
|
-
/**
|
|
266
|
-
* Returns a verifier over a raw body string + detached base64 HMAC
|
|
267
|
-
* signature (the value of `STEP_AUTH_HEADER`). Suitable for servers
|
|
268
|
-
* that have already buffered the request body (e.g. the node step
|
|
269
|
-
* container). `crypto.subtle.verify` is constant-time; malformed
|
|
270
|
-
* base64 or a missing signature simply yields `false`.
|
|
271
|
-
*/
|
|
272
|
-
export async function createHmacBodyVerifier(
|
|
273
|
-
secret: string,
|
|
274
|
-
): Promise<(body: string, signatureBase64: string | null | undefined) => Promise<boolean>> {
|
|
275
|
-
const key = await importKey(secret, ["verify"])
|
|
276
|
-
return async (body, signatureBase64) => {
|
|
277
|
-
if (!signatureBase64) return false
|
|
278
|
-
let sig: ArrayBuffer
|
|
279
|
-
try {
|
|
280
|
-
sig = fromBase64(signatureBase64)
|
|
281
|
-
} catch {
|
|
282
|
-
return false
|
|
283
|
-
}
|
|
284
|
-
return crypto.subtle.verify("HMAC", key, sig, encode(body))
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// ---- Bundle URL origin policy ----
|
|
289
|
-
|
|
290
|
-
export type BundleUrlDecision = { ok: true } | { ok: false; message: string }
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Default bundle source: Cloudflare R2's S3 endpoint
|
|
294
|
-
* (`<account>.r2.cloudflarestorage.com`), which is where deploy
|
|
295
|
-
* pipelines stage `container.mjs` and the orchestrator mints
|
|
296
|
-
* short-lived signed URLs. Anything else must be explicitly
|
|
297
|
-
* allowlisted via `allowedOrigins`.
|
|
298
|
-
*/
|
|
299
|
-
const R2_HOST_SUFFIX = ".r2.cloudflarestorage.com"
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Build an origin allowlist check for caller-supplied `bundle.url`
|
|
303
|
-
* values (the node step container dynamically `import()`s the fetched
|
|
304
|
-
* bytes, so an unrestricted URL is remote-code-execution-adjacent —
|
|
305
|
-
* the SHA-256 hash pin is supplied by the same caller and is not a
|
|
306
|
-
* security control on its own).
|
|
307
|
-
*
|
|
308
|
-
* - `allowedOrigins` set (e.g. from `VOYANT_BUNDLE_ALLOWED_ORIGINS`):
|
|
309
|
-
* the URL's origin must match one of the entries exactly.
|
|
310
|
-
* Invalid entries throw at creation time (misconfiguration should
|
|
311
|
-
* fail loudly, not silently widen).
|
|
312
|
-
* - unset/empty: only HTTPS URLs on `*.r2.cloudflarestorage.com`
|
|
313
|
-
* are allowed — the production bundle source.
|
|
314
|
-
*/
|
|
315
|
-
export function createBundleUrlPolicy(opts?: {
|
|
316
|
-
allowedOrigins?: readonly string[]
|
|
317
|
-
}): (url: string) => BundleUrlDecision {
|
|
318
|
-
const entries = (opts?.allowedOrigins ?? []).filter((entry) => entry.length > 0)
|
|
319
|
-
const allowed = new Set<string>()
|
|
320
|
-
for (const entry of entries) {
|
|
321
|
-
let parsed: URL
|
|
322
|
-
try {
|
|
323
|
-
parsed = new URL(entry)
|
|
324
|
-
} catch {
|
|
325
|
-
throw new Error(`createBundleUrlPolicy: invalid origin in allowlist: "${entry}"`)
|
|
326
|
-
}
|
|
327
|
-
allowed.add(parsed.origin)
|
|
328
|
-
}
|
|
329
|
-
return (url) => {
|
|
330
|
-
let parsed: URL
|
|
331
|
-
try {
|
|
332
|
-
parsed = new URL(url)
|
|
333
|
-
} catch {
|
|
334
|
-
return { ok: false, message: `bundle url is not a valid URL: "${url}"` }
|
|
335
|
-
}
|
|
336
|
-
if (allowed.size > 0) {
|
|
337
|
-
if (allowed.has(parsed.origin)) return { ok: true }
|
|
338
|
-
return {
|
|
339
|
-
ok: false,
|
|
340
|
-
message:
|
|
341
|
-
`bundle url origin "${parsed.origin}" is not in the configured allowlist ` +
|
|
342
|
-
"(VOYANT_BUNDLE_ALLOWED_ORIGINS)",
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
if (parsed.protocol === "https:" && parsed.hostname.endsWith(R2_HOST_SUFFIX)) {
|
|
346
|
-
return { ok: true }
|
|
347
|
-
}
|
|
348
|
-
return {
|
|
349
|
-
ok: false,
|
|
350
|
-
message:
|
|
351
|
-
`bundle url origin "${parsed.origin}" rejected: with no VOYANT_BUNDLE_ALLOWED_ORIGINS ` +
|
|
352
|
-
`configured, only https://*${R2_HOST_SUFFIX} bundle sources are allowed`,
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
240
|
// ---- Internals ----
|
|
358
241
|
|
|
359
242
|
async function importKey(
|
package/src/config.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
export type Duration = number | `${number}${"ms" | "s" | "m" | "h" | "d" | "w"}`
|
|
7
7
|
|
|
8
|
-
/**
|
|
8
|
+
/** Hosted/self-hosted Node runner profile. */
|
|
9
9
|
export type MachineType =
|
|
10
10
|
| "lite"
|
|
11
11
|
| "basic"
|
|
@@ -18,8 +18,7 @@ export type MachineType =
|
|
|
18
18
|
export type EnvironmentName = "production" | "preview" | "development"
|
|
19
19
|
|
|
20
20
|
export type MeterKey =
|
|
21
|
-
| "
|
|
22
|
-
| "containerSeconds"
|
|
21
|
+
| "runnerSeconds"
|
|
23
22
|
| "warmSlotHours"
|
|
24
23
|
| "runCount"
|
|
25
24
|
| "activeScheduleHours"
|
package/src/driver.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// A driver is the runtime-side object that backs `createApp({ workflows })`:
|
|
4
4
|
// it owns manifest registration, run triggering, event ingest, and (optionally)
|
|
5
5
|
// admin reads. Concrete drivers live in downstream packages
|
|
6
|
-
// (`@voyant-travel/workflows-orchestrator` for InMemory
|
|
7
|
-
// `-
|
|
6
|
+
// (`@voyant-travel/workflows-orchestrator` for InMemory and
|
|
7
|
+
// `-node` for Postgres-backed self-hosting).
|
|
8
8
|
//
|
|
9
9
|
// Drivers are constructed via *factories* — `DriverFactory` is a function the
|
|
10
10
|
// framework invokes after `createApp()` has assembled its `ModuleContainer`.
|
|
@@ -139,9 +139,9 @@ export type IngestEventResponse =
|
|
|
139
139
|
// ---- Driver — execution contract ----
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
|
-
* The mandatory driver contract. Every concrete driver
|
|
143
|
-
*
|
|
144
|
-
*
|
|
142
|
+
* The mandatory driver contract. Every concrete driver implements all five
|
|
143
|
+
* methods. The compliance test suite (`driver-compliance.test.ts`) is the
|
|
144
|
+
* contract.
|
|
145
145
|
*/
|
|
146
146
|
export interface WorkflowDriver {
|
|
147
147
|
/**
|
|
@@ -194,10 +194,9 @@ export interface WorkflowDriver {
|
|
|
194
194
|
// ---- Driver — admin (optional) ----
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
|
-
* Read-side operations. Implemented natively by the
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* See architecture doc §6.2 + §8.3.
|
|
197
|
+
* Read-side operations. Implemented natively by the Postgres-backed Node
|
|
198
|
+
* driver; other drivers expose the subset they can support.
|
|
199
|
+
* See architecture doc §6.2.
|
|
201
200
|
*/
|
|
202
201
|
export interface WorkflowAdmin {
|
|
203
202
|
listRuns(opts?: ListRunsOptions): Promise<{ runs: RunSummary[]; nextCursor?: string }>
|
|
@@ -217,7 +216,7 @@ export interface WorkflowAdmin {
|
|
|
217
216
|
*/
|
|
218
217
|
export type AdminStreamEvent =
|
|
219
218
|
| { kind: "run.snapshot"; at: number; status: string; metadata: Record<string, unknown> }
|
|
220
|
-
| { kind: "step.started"; at: number; stepId: string; runtime: "
|
|
219
|
+
| { kind: "step.started"; at: number; stepId: string; runtime: "node" }
|
|
221
220
|
| { kind: "step.ok"; at: number; stepId: string; durationMs: number }
|
|
222
221
|
| { kind: "step.err"; at: number; stepId: string; error: { code: string; message: string } }
|
|
223
222
|
| { kind: "waitpoint.registered"; at: number; waitpointId: string; waitpointKind: WaitpointKind }
|
|
@@ -34,7 +34,7 @@ export interface BuildManifestArgs {
|
|
|
34
34
|
description?: string
|
|
35
35
|
input?: unknown
|
|
36
36
|
output?: unknown
|
|
37
|
-
defaultRuntime?: "
|
|
37
|
+
defaultRuntime?: "node"
|
|
38
38
|
concurrency?: ConcurrencyPolicy<unknown>
|
|
39
39
|
retry?: unknown
|
|
40
40
|
timeout?: unknown
|
|
@@ -87,7 +87,7 @@ export async function buildManifest(args: BuildManifestArgs): Promise<WorkflowMa
|
|
|
87
87
|
steps: [],
|
|
88
88
|
concurrency: serializeConcurrency(wf.config?.concurrency),
|
|
89
89
|
schedules,
|
|
90
|
-
defaultRuntime: wf.config?.defaultRuntime ?? "
|
|
90
|
+
defaultRuntime: wf.config?.defaultRuntime ?? "node",
|
|
91
91
|
hasCompensation: false,
|
|
92
92
|
sourceLocation: { file: "<runtime>", line: 0 },
|
|
93
93
|
}
|
package/src/handler/index.ts
CHANGED
|
@@ -59,20 +59,6 @@ export interface StepHandlerDeps {
|
|
|
59
59
|
* intended cardinality — state is kept in the limiter's closure.
|
|
60
60
|
*/
|
|
61
61
|
rateLimiter?: RateLimiter
|
|
62
|
-
/**
|
|
63
|
-
* Runner for steps declared with `options.runtime === "node"`.
|
|
64
|
-
* Leave unset for handlers that only run edge steps; any node step
|
|
65
|
-
* will then fail with `NODE_RUNTIME_UNAVAILABLE`.
|
|
66
|
-
*
|
|
67
|
-
* Typical impl dispatches to a separate sandboxed context:
|
|
68
|
-
* - Local dev: an in-process passthrough (same Node process).
|
|
69
|
-
* - CF production: a Cloudflare Container binding, via
|
|
70
|
-
* `createCfContainerStepRunner` from `@voyant-travel/workflows-orchestrator-cloudflare`.
|
|
71
|
-
*
|
|
72
|
-
* This is bring-your-own because the right dispatch shape depends on
|
|
73
|
-
* the target runtime; the executor only cares that a runner exists.
|
|
74
|
-
*/
|
|
75
|
-
nodeStepRunner?: StepRunner
|
|
76
62
|
/**
|
|
77
63
|
* Read-only service resolver, surfaced to step bodies as `ctx.services`.
|
|
78
64
|
* The framework's `createApp()` wires this from its `ModuleContainer`;
|
|
@@ -252,7 +238,6 @@ async function runStepInner(
|
|
|
252
238
|
runStartedAt: reqBody.runMeta.startedAt,
|
|
253
239
|
tags: reqBody.runMeta.tags,
|
|
254
240
|
stepRunner,
|
|
255
|
-
nodeStepRunner: deps.nodeStepRunner,
|
|
256
241
|
rateLimiter: deps.rateLimiter,
|
|
257
242
|
services: deps.services,
|
|
258
243
|
now,
|
|
@@ -273,8 +258,8 @@ async function runStepInner(
|
|
|
273
258
|
|
|
274
259
|
/**
|
|
275
260
|
* Build a step runner that executes the step body in the same
|
|
276
|
-
* process.
|
|
277
|
-
*
|
|
261
|
+
* process. Hosted runtimes can replace this with a dispatching runner
|
|
262
|
+
* that POSTs to a Node execution service.
|
|
278
263
|
*/
|
|
279
264
|
function createInProcessStepRunner(now: () => number): StepRunner {
|
|
280
265
|
return async ({ stepId: _stepId, attempt, fn, stepCtx }): Promise<StepJournalEntry> => {
|
package/src/http-ingest.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// Optional HTTP ingest adapter — mounts `/api/manifests` and `/api/events`
|
|
2
2
|
// on a Hono-shaped app, forwarding into a `WorkflowDriver`.
|
|
3
3
|
//
|
|
4
|
-
// Self-host
|
|
4
|
+
// Self-host Node deployments mount this when external emitters need to
|
|
5
5
|
// fire events into the runtime (storefront BFF, third-party webhooks,
|
|
6
|
-
// sibling-process pairs across machines).
|
|
7
|
-
//
|
|
6
|
+
// sibling-process pairs across machines). Managed Cloud mounts its own
|
|
7
|
+
// HTTP boundary in the cloud repository.
|
|
8
8
|
//
|
|
9
9
|
// Transport-agnostic: takes a minimal `HttpAppLike` interface so the SDK
|
|
10
10
|
// stays a leaf package (no `hono` dep). `@voyant-travel/voyant-hono`'s `Hono`
|
|
11
11
|
// instance satisfies the shape via TypeScript structural compat.
|
|
12
12
|
//
|
|
13
|
-
// Architecture: docs/architecture/workflows-runtime-architecture.md
|
|
13
|
+
// Architecture: docs/architecture/workflows-runtime-architecture.md.
|
|
14
14
|
|
|
15
15
|
import type { IngestEventArgs, WorkflowDriver } from "./driver.js"
|
|
16
16
|
import type { EnvironmentName } from "./types.js"
|
package/src/protocol/index.ts
CHANGED
|
@@ -69,7 +69,7 @@ export interface WorkflowManifestEntry {
|
|
|
69
69
|
concurrency?: ManifestConcurrencyPolicy
|
|
70
70
|
steps: ManifestStep[]
|
|
71
71
|
schedules: ManifestSchedule[]
|
|
72
|
-
defaultRuntime: "
|
|
72
|
+
defaultRuntime: "node"
|
|
73
73
|
hasCompensation: boolean
|
|
74
74
|
sourceLocation: { file: string; line: number }
|
|
75
75
|
}
|
|
@@ -145,7 +145,7 @@ export interface ManifestConcurrencyPolicy {
|
|
|
145
145
|
|
|
146
146
|
export interface ManifestStep {
|
|
147
147
|
id: string
|
|
148
|
-
runtime: "
|
|
148
|
+
runtime: "node"
|
|
149
149
|
hasCompensation: boolean
|
|
150
150
|
sourceLocation: { file: string; line: number }
|
|
151
151
|
}
|
|
@@ -382,7 +382,7 @@ export type StreamEvent =
|
|
|
382
382
|
eventId: string
|
|
383
383
|
at: number
|
|
384
384
|
stepId: string
|
|
385
|
-
runtime: "
|
|
385
|
+
runtime: "node"
|
|
386
386
|
machine?: string
|
|
387
387
|
}
|
|
388
388
|
| {
|
|
@@ -458,7 +458,7 @@ export type StreamEvent =
|
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
// Shared envelope for journal events written by the orchestrator,
|
|
461
|
-
//
|
|
461
|
+
// tenant runtime, or Node runner. Concrete `kind`
|
|
462
462
|
// discriminants are owned by the emitting layer.
|
|
463
463
|
export interface JournalEventEnvelope<TKind extends string = string, TData = unknown> {
|
|
464
464
|
eventId: string
|
package/src/runtime/executor.ts
CHANGED
|
@@ -23,11 +23,10 @@ export type StepRunner = (
|
|
|
23
23
|
/**
|
|
24
24
|
* Executes a step body and returns the journal entry to record.
|
|
25
25
|
*
|
|
26
|
-
* In-process runners (
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* and
|
|
30
|
-
* remote container and POST the required context.
|
|
26
|
+
* In-process runners call `fn(stepCtx)` directly. Dispatching runners
|
|
27
|
+
* ignore `fn` — they can't serialize a closure — and use the
|
|
28
|
+
* run/workflow identity + step options to address a remote Node runner
|
|
29
|
+
* and POST the required context.
|
|
31
30
|
*/
|
|
32
31
|
args: {
|
|
33
32
|
stepId: string
|
|
@@ -43,7 +42,7 @@ export type StepRunner = (
|
|
|
43
42
|
* dispatching runners to resolve per-tenant bundle storage keys. */
|
|
44
43
|
projectId: string
|
|
45
44
|
organizationId: string
|
|
46
|
-
/** Merged step options (
|
|
45
|
+
/** Merged step options (machine, timeout, …). */
|
|
47
46
|
options: import("../workflow.js").StepOptions<unknown>
|
|
48
47
|
/**
|
|
49
48
|
* Current journal slice at dispatch time — steps already completed,
|
|
@@ -99,21 +98,10 @@ export interface ExecuteWorkflowStepRequest {
|
|
|
99
98
|
tags: string[]
|
|
100
99
|
abortSignal?: AbortSignal
|
|
101
100
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* explicitly `"edge"`.
|
|
101
|
+
* Step executor. The default handler runs step bodies in-process on Node.
|
|
102
|
+
* Hosted runtimes may replace it with a dispatching runner.
|
|
105
103
|
*/
|
|
106
104
|
stepRunner: StepRunner
|
|
107
|
-
/**
|
|
108
|
-
* Optional runner for steps declared with `options.runtime === "node"`.
|
|
109
|
-
* Typical impl dispatches to a Cloudflare Container sized for the
|
|
110
|
-
* step (or, in local dev, an in-process passthrough).
|
|
111
|
-
*
|
|
112
|
-
* If a step requests `"node"` and this is unset, the step fails with
|
|
113
|
-
* `NODE_RUNTIME_UNAVAILABLE` — declaring a runtime and then silently
|
|
114
|
-
* falling back to edge would hide deployment bugs.
|
|
115
|
-
*/
|
|
116
|
-
nodeStepRunner?: StepRunner
|
|
117
105
|
/**
|
|
118
106
|
* Optional rate limiter. When a step declares `options.rateLimit`,
|
|
119
107
|
* the executor calls `rateLimiter.acquire(...)` before invoking the
|
|
@@ -225,17 +213,17 @@ export async function executeWorkflowStep(
|
|
|
225
213
|
signal: abortSignal,
|
|
226
214
|
})
|
|
227
215
|
}
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
if (!runner) {
|
|
216
|
+
const requestedRuntime = (args.options as { runtime?: unknown }).runtime
|
|
217
|
+
if (requestedRuntime !== undefined && requestedRuntime !== "node") {
|
|
231
218
|
const e = new Error(
|
|
232
|
-
`step "${args.stepId}" declared runtime="
|
|
233
|
-
|
|
219
|
+
`step "${args.stepId}" declared runtime="${String(
|
|
220
|
+
requestedRuntime,
|
|
221
|
+
)}" but workflows are node-only; remove options.runtime or use runtime="node"`,
|
|
234
222
|
)
|
|
235
|
-
;(e as Error & { code?: string }).code = "
|
|
223
|
+
;(e as Error & { code?: string }).code = "UNSUPPORTED_WORKFLOW_RUNTIME"
|
|
236
224
|
throw e
|
|
237
225
|
}
|
|
238
|
-
const entry = await
|
|
226
|
+
const entry = await req.stepRunner({
|
|
239
227
|
stepId: args.stepId,
|
|
240
228
|
attempt: args.attempt,
|
|
241
229
|
input: args.input,
|
|
@@ -249,10 +237,9 @@ export async function executeWorkflowStep(
|
|
|
249
237
|
options: args.options,
|
|
250
238
|
journal: req.journal,
|
|
251
239
|
})
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
|
|
255
|
-
entry.runtime = runtime
|
|
240
|
+
// Keep the runtime stamp for downstream consumers that display
|
|
241
|
+
// execution metadata. There is one supported runtime now.
|
|
242
|
+
entry.runtime = "node"
|
|
256
243
|
return entry
|
|
257
244
|
},
|
|
258
245
|
registerWaitpoint(args) {
|
package/src/runtime/journal.ts
CHANGED
|
@@ -14,11 +14,9 @@ export interface StepJournalEntry {
|
|
|
14
14
|
startedAt: number
|
|
15
15
|
finishedAt: number
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
* routing between `stepRunner` (edge) and `nodeStepRunner`.
|
|
19
|
-
* Informational only — doesn't affect replay.
|
|
17
|
+
* Runtime that executed the step. Informational only — doesn't affect replay.
|
|
20
18
|
*/
|
|
21
|
-
runtime?: "
|
|
19
|
+
runtime?: "node"
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
export interface WaitpointResolutionEntry {
|