@vite-hub/workflow 0.7.0 → 0.8.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.
Files changed (35) hide show
  1. package/README.md +1 -1
  2. package/dist/{client-CPxPxsl5.js → client-T41cNf3k.js} +10 -21
  3. package/dist/{config-CwCwuZqv.js → config-G0z9jHLM.js} +5 -5
  4. package/dist/definition.d.ts +1 -1
  5. package/dist/{delay-JrpW40UF.js → delay-B4azP18B.js} +3 -3
  6. package/dist/durability.d.ts +1 -1
  7. package/dist/{execute-CLmIXnON.js → execute-zu08sWGG.js} +3 -5
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/{openworkflow-C65AWQSJ.d.ts → openworkflow-DHuxMJQB.d.ts} +2 -2
  11. package/dist/{openworkflow-BiwPTYEz.js → openworkflow-zD8luED5.js} +10 -13
  12. package/dist/{operations-DyaGK9zW.js → operations-C2XbDDDV.js} +3 -3
  13. package/dist/operations.d.ts +1 -1
  14. package/dist/operations.js +1 -1
  15. package/dist/{results-DBp_bmUP.d.ts → results-DqbEUMCH.d.ts} +1 -1
  16. package/dist/{run-error-8p4BtTMv.js → run-error-zZh1_IBo.js} +5 -21
  17. package/dist/runtime/cloudflare-concurrency.d.ts +1 -1
  18. package/dist/runtime/cloudflare-runner.d.ts +1 -1
  19. package/dist/runtime/cloudflare-runner.js +2 -2
  20. package/dist/runtime/cloudflare-vite.d.ts +1 -1
  21. package/dist/runtime/cloudflare-vite.js +1 -1
  22. package/dist/runtime/execute.d.ts +1 -1
  23. package/dist/runtime/execute.js +1 -1
  24. package/dist/runtime/openworkflow-worker.d.ts +2 -2
  25. package/dist/runtime/openworkflow-worker.js +4 -5
  26. package/dist/runtime/openworkflow.d.ts +1 -1
  27. package/dist/runtime/openworkflow.js +1 -1
  28. package/dist/runtime/state.d.ts +1 -1
  29. package/dist/runtime/vercel-vite.d.ts +1 -1
  30. package/dist/runtime/vercel-vite.js +1 -1
  31. package/dist/{types-CvyOEp0V.d.ts → types-DrhUXMsE.d.ts} +1 -0
  32. package/dist/{vercel-ADMH2MK8.js → vercel-DRezYOUp.js} +5 -5
  33. package/dist/vite.d.ts +2 -1
  34. package/dist/vite.js +425 -104
  35. package/package.json +3 -3
package/README.md CHANGED
@@ -173,7 +173,7 @@ Keep this process running while it should consume queued runs, and do not start
173
173
  ```ts fragment
174
174
  // server/api/onboard.post.ts
175
175
  import { getWorkflowRun, startWorkflow } from "@vite-hub/workflow";
176
- import { defineEventHandler, readBody } from "h3";
176
+ import { defineEventHandler, readBody } from "nitro/h3";
177
177
  import { installWorkflowRuntime } from "../workflow-runtime.ts";
178
178
 
179
179
  installWorkflowRuntime();
@@ -1,18 +1,18 @@
1
1
  import { a as getCloudflareEnv, n as resolveWaitUntil } from "./cloudflare-env-DHhzRZOs.js";
2
- import { t as normalizeWorkflowOptions } from "./config-CwCwuZqv.js";
2
+ import { t as normalizeWorkflowOptions } from "./config-G0z9jHLM.js";
3
3
  import { n as createWorkflowError } from "./errors-CZf7oz4k.js";
4
4
  import { t as workflowErrorDiagnostics } from "./error-diagnostics-35AEmfve.js";
5
5
  import { d as encodeNameHex, s as getCloudflareWorkflowBindingName, u as isCloudflareInstanceNotFound } from "./cloudflare-concurrency-counter-CDHHiMfn.js";
6
- import { a as toCloudflareStartParams, i as resolveWorkflowStartAt } from "./delay-JrpW40UF.js";
6
+ import { a as toCloudflareStartParams, i as resolveWorkflowStartAt } from "./delay-B4azP18B.js";
7
7
  import { t as getWorkflowDevRecorder } from "./dev-recorder-Dltdmlkv.js";
8
- import { o as runSerializedWorkflowHandler } from "./execute-CLmIXnON.js";
8
+ import { o as runSerializedWorkflowHandler } from "./execute-zu08sWGG.js";
9
9
  import { cloudflareSignalEventType } from "./runtime/cloudflare-runner.js";
10
- import { a as getOpenWorkflowRun, d as runOpenWorkflow, t as cancelOpenWorkflowRun, u as resumeOpenWorkflowSignal } from "./openworkflow-BiwPTYEz.js";
11
- import { a as safeWorkflowName, i as runWorkflowProviderOperation, t as toWorkflowRunError } from "./run-error-8p4BtTMv.js";
10
+ import { a as getOpenWorkflowRun, d as runOpenWorkflow, t as cancelOpenWorkflowRun, u as resumeOpenWorkflowSignal } from "./openworkflow-zD8luED5.js";
11
+ import { a as safeWorkflowName, i as runWorkflowProviderOperation, t as toWorkflowRunError } from "./run-error-zZh1_IBo.js";
12
12
  import { t as emitWorkflowFailed } from "./run-failed-BcSjSU2t.js";
13
13
  import { i as readWorkflowSignalToken, o as resumeInlineWorkflowSignal } from "./signals-CdaxRNjN.js";
14
14
  import { getInlineWorkflowDefinitions, getWorkflowRunState, getWorkflowRuntimeConfig, getWorkflowRuntimeEvent, getWorkflowRuntimeRegistry, loadWorkflowDefinition, registerInlineWorkflowDefinition, runWithWorkflowRuntimeEvent, setWorkflowRun } from "./runtime/state.js";
15
- import { a as startVercelWorkflow, n as inspectVercelWorkflowRun, r as resumeVercelWorkflowSignal, t as cancelVercelWorkflow } from "./vercel-ADMH2MK8.js";
15
+ import { a as startVercelWorkflow, n as inspectVercelWorkflowRun, r as resumeVercelWorkflowSignal, t as cancelVercelWorkflow } from "./vercel-DRezYOUp.js";
16
16
  import { getViteHubErrorShape, isRuntimeDiagnostic, toResultError } from "@vite-hub/runtime";
17
17
  import { getViteHubTestMode } from "@vite-hub/runtime/internal/test-mode";
18
18
  import { deserializeResponse, isSerializedResponse } from "@vite-hub/runtime/internal/response";
@@ -79,9 +79,8 @@ function resolveCloudflareBinding(event, binding, name, definition) {
79
79
  function resolveCloudflareInspectionBinding(event, binding, name) {
80
80
  return resolveCloudflareBinding(event, binding, name, getWorkflowRuntimeRegistry()?.[name]);
81
81
  }
82
- function invalidCloudflareWorkflowStart(cause) {
82
+ function invalidCloudflareWorkflowStart() {
83
83
  return createWorkflowError({
84
- ...cause === void 0 ? {} : { cause },
85
84
  code: "WORKFLOW_PROVIDER_OPERATION_FAILED",
86
85
  details: {
87
86
  acknowledgement: "unknown",
@@ -93,12 +92,7 @@ function invalidCloudflareWorkflowStart(cause) {
93
92
  }
94
93
  function normalizeCloudflareWorkflowStart(value, expectedId) {
95
94
  if (typeof value !== "object" || value === null) throw invalidCloudflareWorkflowStart();
96
- let id;
97
- try {
98
- id = Reflect.get(value, "id");
99
- } catch (cause) {
100
- throw invalidCloudflareWorkflowStart(cause);
101
- }
95
+ const id = "id" in value ? value.id : void 0;
102
96
  if (typeof id !== "string" || !id || id !== expectedId) throw invalidCloudflareWorkflowStart();
103
97
  return { id };
104
98
  }
@@ -136,12 +130,7 @@ function ownStatusError(metadata) {
136
130
  }
137
131
  function isCloudflareRejection(error) {
138
132
  if (typeof error !== "object" || error === null) return false;
139
- try {
140
- const message = Reflect.get(error, "message");
141
- return typeof message === "string" && /\((?:instance|workflow)\.[a-z_]+\)|^Workflow instance has invalid id/.test(message);
142
- } catch {
143
- return false;
144
- }
133
+ return "message" in error && typeof error.message === "string" && /\((?:instance|workflow)\.[a-z_]+\)|^Workflow instance has invalid id/.test(error.message);
145
134
  }
146
135
  function hasUnknownWorkflowAcknowledgement(error) {
147
136
  if (!error || typeof error !== "object") return false;
@@ -464,7 +453,7 @@ function createVercelAdapter(config) {
464
453
  const registry = getWorkflowRuntimeRegistry();
465
454
  if (!agentTurn && registry && Object.hasOwn(registry, name) && Reflect.get(registry, Symbol.for("vitehub.vercel.nativeWorkflowRegistry")) === true) {
466
455
  const native = definition?.native;
467
- if (typeof native !== "function" || typeof Reflect.get(native, "workflowId") !== "string" || !Reflect.get(native, "workflowId")) throw workflowErrorDiagnostics.WORKFLOW_VERCEL_DISCOVERED_NOT_NATIVE({ name });
456
+ if (typeof native !== "function" || !("workflowId" in native) || typeof native.workflowId !== "string" || !native.workflowId) throw workflowErrorDiagnostics.WORKFLOW_VERCEL_DISCOVERED_NOT_NATIVE({ name });
468
457
  }
469
458
  if (!runsNatively(definition)) {
470
459
  if (!agentTurn && !isDiscoveredWorkflow(name) && !isDevelopmentServer()) warnInlineWorkflow(name, "Workflow DevKit");
@@ -28,7 +28,7 @@ const knownDrivers = /* @__PURE__ */ new Set([
28
28
  "openworkflow",
29
29
  "vercel"
30
30
  ]);
31
- function readString(value, label) {
31
+ function readOptionalNonEmptyString(value, label) {
32
32
  if (typeof value === "undefined") return;
33
33
  if (typeof value !== "string" || !value.trim()) throw workflowErrorDiagnostics.WORKFLOW_C0001({ message: `\`${label}\` must be a non-empty string when provided.` });
34
34
  return value.trim();
@@ -36,7 +36,7 @@ function readString(value, label) {
36
36
  function readRuntimeConfigValue(value, label, preserveWhitespace = false) {
37
37
  if (typeof value === "undefined") return;
38
38
  if (typeof value === "string") {
39
- const normalized = readString(value, label);
39
+ const normalized = readOptionalNonEmptyString(value, label);
40
40
  return preserveWhitespace ? value : normalized;
41
41
  }
42
42
  if (!isRuntimeEnvDeclaration(value)) throw workflowErrorDiagnostics.WORKFLOW_C0002({ message: `\`${label}\` must be a string or runtime env declaration.` });
@@ -61,9 +61,9 @@ function readPositiveInteger(value, label) {
61
61
  function normalizeOpenWorkflowPostgresOptions(value) {
62
62
  if (typeof value === "undefined") return;
63
63
  if (!isRecord(value)) throw workflowErrorDiagnostics.WORKFLOW_C0005({ message: "`workflow.postgres` must be a plain object." });
64
- const namespaceId = readString(value.namespaceId, "workflow.postgres.namespaceId");
64
+ const namespaceId = readOptionalNonEmptyString(value.namespaceId, "workflow.postgres.namespaceId");
65
65
  const runMigrations = readBoolean(value.runMigrations, "workflow.postgres.runMigrations");
66
- const schema = readString(value.schema, "workflow.postgres.schema");
66
+ const schema = readOptionalNonEmptyString(value.schema, "workflow.postgres.schema");
67
67
  const url = readRuntimeConfigValue(value.url, "workflow.postgres.url");
68
68
  return {
69
69
  ...namespaceId ? { namespaceId } : {},
@@ -75,7 +75,7 @@ function normalizeOpenWorkflowPostgresOptions(value) {
75
75
  function normalizeOpenWorkflowSqliteOptions(value) {
76
76
  if (typeof value === "undefined") return;
77
77
  if (!isRecord(value)) throw workflowErrorDiagnostics.WORKFLOW_C0006({ message: "`workflow.sqlite` must be a plain object." });
78
- const namespaceId = readString(value.namespaceId, "workflow.sqlite.namespaceId");
78
+ const namespaceId = readOptionalNonEmptyString(value.namespaceId, "workflow.sqlite.namespaceId");
79
79
  const path = readRuntimeConfigValue(value.path, "workflow.sqlite.path", true);
80
80
  const runMigrations = readBoolean(value.runMigrations, "workflow.sqlite.runMigrations");
81
81
  return {
@@ -1,4 +1,4 @@
1
- import { h as WorkflowDefinition } from "./types-CvyOEp0V.js";
1
+ import { h as WorkflowDefinition } from "./types-DrhUXMsE.js";
2
2
  /**
3
3
  * Defines a Workflow from one object: `defineWorkflow({ handler, ...options })`. The file path is the Workflow name.
4
4
  * The handler receives one object, `{ payload, steps, sleep, ...context }`. Pass the payload type as the type argument.
@@ -34,12 +34,12 @@ function toCloudflareStartParams(payload, startAt) {
34
34
  }
35
35
  /** Reads the params of a Cloudflare run. The handler gets only the payload. */
36
36
  function fromCloudflareStartParams(params) {
37
- if (typeof params !== "object" || params === null || !Object.hasOwn(params, "~vitehubStartAt")) return { payload: params };
38
- const startAt = Reflect.get(params, workflowStartAtKey);
37
+ if (typeof params !== "object" || params === null || !("~vitehubStartAt" in params)) return { payload: params };
38
+ const startAt = params[workflowStartAtKey];
39
39
  const keys = Object.keys(params);
40
40
  if (typeof startAt !== "number" || !keys.every((key) => key === "~vitehubStartAt" || key === "payload")) return { payload: params };
41
41
  return {
42
- payload: Reflect.get(params, "payload"),
42
+ payload: "payload" in params ? params.payload : void 0,
43
43
  startAt
44
44
  };
45
45
  }
@@ -1,4 +1,4 @@
1
- import { z as WorkflowRuntimeConfigValue } from "./types-CvyOEp0V.js";
1
+ import { z as WorkflowRuntimeConfigValue } from "./types-DrhUXMsE.js";
2
2
  import { Durability, DurabilityContext } from "@vite-hub/runtime/durability";
3
3
  /** What the build passes to `workflowDurability()`. The storage values may name runtime environment variables. */
4
4
  export interface WorkflowDurabilityInput {
@@ -3,6 +3,7 @@ import { t as workflowErrorDiagnostics } from "./error-diagnostics-35AEmfve.js";
3
3
  import { n as createWorkflowError, r as isNonRetryableError, t as NonRetryableError } from "./errors-CZf7oz4k.js";
4
4
  import { t as getWorkflowDevRecorder } from "./dev-recorder-Dltdmlkv.js";
5
5
  import { n as createWorkflowSignalToken, r as openInlineWorkflowSignal, s as waitForInlineWorkflowSignal, t as closeInlineWorkflowSignals } from "./signals-CdaxRNjN.js";
6
+ import { t as isRecord } from "./object-CAK6UYR5.js";
6
7
  import { isResponse, serializeResponse, toResponse } from "@vite-hub/runtime/internal/response";
7
8
  // src/runtime/concurrency.ts
8
9
  const inlinePlaces = /* @__PURE__ */ new Map();
@@ -75,9 +76,6 @@ const retryOptionKeys = /* @__PURE__ */ new Set([
75
76
  "delay",
76
77
  "limit"
77
78
  ]);
78
- function isPlainObject(value) {
79
- return typeof value === "object" && value !== null && !Array.isArray(value);
80
- }
81
79
  /**
82
80
  * Checks the options of a step and fills in the default retries. A step file, `context.step.do()`, and every provider
83
81
  * read the options through this function, so an invalid value fails the same way everywhere.
@@ -89,10 +87,10 @@ function resolveWorkflowStepOptions(step, options) {
89
87
  value: typeof value === "string" ? JSON.stringify(value) : String(value)
90
88
  });
91
89
  if (options === void 0) return { retries: { ...defaultRetries } };
92
- if (!isPlainObject(options)) throw invalid("options", options);
90
+ if (!isRecord(options)) throw invalid("options", options);
93
91
  for (const key of Object.keys(options)) if (!stepOptionKeys.has(key)) throw invalid(key, options[key]);
94
92
  const retries = options.retries ?? {};
95
- if (!isPlainObject(retries)) throw invalid("retries", retries);
93
+ if (!isRecord(retries)) throw invalid("retries", retries);
96
94
  for (const key of Object.keys(retries)) if (!retryOptionKeys.has(key)) throw invalid(`retries.${key}`, retries[key]);
97
95
  const { backoff = defaultRetries.backoff, delay = defaultRetries.delay, limit = defaultRetries.limit } = retries;
98
96
  if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 0) throw invalid("retries.limit", limit);
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineWorkflow } from "./definition.js";
2
2
  import { a as WorkflowProviderFailure, i as WorkflowOperationName, n as WorkflowErrorCode, o as WorkflowProviderName, r as WorkflowErrorDetails, t as NonRetryableError } from "./errors-DwKy5MQ8.js";
3
- import { $ as WorkflowSteps, A as WorkflowProviderStep, B as WorkflowSharedOptions, C as WorkflowHandle, D as WorkflowOptions, E as WorkflowName, F as WorkflowRunError, G as WorkflowStartOptions, H as WorkflowSignalResult, I as WorkflowRunName, J as WorkflowStepContext, K as WorkflowStep, L as WorkflowRunStatus, M as WorkflowResult, N as WorkflowResultErrorCode, O as WorkflowPayload, P as WorkflowRun, Q as WorkflowStepRetries, R as WorkflowRunStep, S as WorkflowExecutionContext, T as WorkflowModuleDriverOptions, U as WorkflowStartArguments, V as WorkflowSignal, W as WorkflowStartDelay, X as WorkflowStepOptions, Y as WorkflowStepFunction, Z as WorkflowStepRegistry, _ as WorkflowDefinitionRegistry, a as DiscoveredWorkflowDefinition, b as WorkflowDuration, c as OpenWorkflowDriverOptions, d as ResolvedWorkflowOptions, f as VercelWorkflowDriverOptions, g as WorkflowDefinitionOptions, h as WorkflowDefinition, i as CloudflareWorkflowInstance, j as WorkflowRegistry, k as WorkflowProviderContext, l as OpenWorkflowPostgresOptions, m as WorkflowCreateOptions, n as CloudflareWorkflowBinding, o as InferredWorkflowDriverOptions, q as WorkflowStepBackoff, r as CloudflareWorkflowDriverOptions, s as NamedWorkflowRun, t as AgentWorkflowRegistry, u as OpenWorkflowWorkerOptions, v as WorkflowDriver, w as WorkflowHandler, x as WorkflowDurationUnit, y as WorkflowDriverOptions } from "./types-CvyOEp0V.js";
3
+ import { $ as WorkflowSteps, A as WorkflowProviderStep, B as WorkflowSharedOptions, C as WorkflowHandle, D as WorkflowOptions, E as WorkflowName, F as WorkflowRunError, G as WorkflowStartOptions, H as WorkflowSignalResult, I as WorkflowRunName, J as WorkflowStepContext, K as WorkflowStep, L as WorkflowRunStatus, M as WorkflowResult, N as WorkflowResultErrorCode, O as WorkflowPayload, P as WorkflowRun, Q as WorkflowStepRetries, R as WorkflowRunStep, S as WorkflowExecutionContext, T as WorkflowModuleDriverOptions, U as WorkflowStartArguments, V as WorkflowSignal, W as WorkflowStartDelay, X as WorkflowStepOptions, Y as WorkflowStepFunction, Z as WorkflowStepRegistry, _ as WorkflowDefinitionRegistry, a as DiscoveredWorkflowDefinition, b as WorkflowDuration, c as OpenWorkflowDriverOptions, d as ResolvedWorkflowOptions, f as VercelWorkflowDriverOptions, g as WorkflowDefinitionOptions, h as WorkflowDefinition, i as CloudflareWorkflowInstance, j as WorkflowRegistry, k as WorkflowProviderContext, l as OpenWorkflowPostgresOptions, m as WorkflowCreateOptions, n as CloudflareWorkflowBinding, o as InferredWorkflowDriverOptions, q as WorkflowStepBackoff, r as CloudflareWorkflowDriverOptions, s as NamedWorkflowRun, t as AgentWorkflowRegistry, u as OpenWorkflowWorkerOptions, v as WorkflowDriver, w as WorkflowHandler, x as WorkflowDurationUnit, y as WorkflowDriverOptions } from "./types-DrhUXMsE.js";
4
4
  import { Result } from "@vite-hub/runtime";
5
5
  export declare function getCloudflareWorkflowBindingName(name: string): string;
6
6
  export declare function createWorkflow<TPayload = unknown, TResult = unknown>(options: WorkflowCreateOptions<TPayload, TResult> & {
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineWorkflow } from "./definition.js";
2
2
  import { t as NonRetryableError } from "./errors-CZf7oz4k.js";
3
3
  import { s as getCloudflareWorkflowBindingName } from "./cloudflare-concurrency-counter-CDHHiMfn.js";
4
- import { a as resumeWorkflow, i as getWorkflowRun, n as createWorkflow, o as startWorkflow, r as deferWorkflow, t as cancelWorkflow } from "./client-CPxPxsl5.js";
4
+ import { a as resumeWorkflow, i as getWorkflowRun, n as createWorkflow, o as startWorkflow, r as deferWorkflow, t as cancelWorkflow } from "./client-T41cNf3k.js";
5
5
  import { t as workflowErrorDiagnostics } from "./error-diagnostics-35AEmfve.js";
6
6
  // src/runtime/payload.ts
7
7
  /** Reads a JSON body as parsed JSON and any other body as text. The value is not checked: pass it to `validatePayload()`. */
@@ -1,5 +1,5 @@
1
- import { s as WorkflowRunsListStatus } from "./results-DBp_bmUP.js";
2
- import { G as WorkflowStartOptions, P as WorkflowRun, d as ResolvedWorkflowOptions, h as WorkflowDefinition, p as WorkflowConcurrencySlots } from "./types-CvyOEp0V.js";
1
+ import { s as WorkflowRunsListStatus } from "./results-DqbEUMCH.js";
2
+ import { G as WorkflowStartOptions, P as WorkflowRun, d as ResolvedWorkflowOptions, h as WorkflowDefinition, p as WorkflowConcurrencySlots } from "./types-DrhUXMsE.js";
3
3
  type OpenWorkflowModule = typeof import("openworkflow");
4
4
  type OpenWorkflowPostgresModule = typeof import("openworkflow/postgres");
5
5
  type OpenWorkflowSqliteModule = typeof import("openworkflow/sqlite");
@@ -1,7 +1,7 @@
1
1
  import { n as invariantError } from "./invariant-Dj2R1eMr.js";
2
- import { d as toNonRetryableStepResult, i as resolveWorkflowStepOptions, n as readNonRetryableStepResult, o as runSerializedWorkflowHandler, p as withWorkflowStepTimeout, u as toDurationMilliseconds } from "./execute-CLmIXnON.js";
2
+ import { d as toNonRetryableStepResult, i as resolveWorkflowStepOptions, n as readNonRetryableStepResult, o as runSerializedWorkflowHandler, p as withWorkflowStepTimeout, u as toDurationMilliseconds } from "./execute-zu08sWGG.js";
3
3
  import { n as createWorkflowError } from "./errors-CZf7oz4k.js";
4
- import { i as runWorkflowProviderOperation, n as getWorkflowProviderStatus, t as toWorkflowRunError } from "./run-error-8p4BtTMv.js";
4
+ import { i as runWorkflowProviderOperation, n as getWorkflowProviderStatus, t as toWorkflowRunError } from "./run-error-zZh1_IBo.js";
5
5
  import { t as emitWorkflowFailed } from "./run-failed-BcSjSU2t.js";
6
6
  import { t as resolveOpenWorkflowStorage } from "./openworkflow-storage-Dde_f0es.js";
7
7
  import { t as workflowErrorDiagnostics } from "./error-diagnostics-35AEmfve.js";
@@ -297,15 +297,14 @@ async function createOpenWorkflowRuntime(options, importer) {
297
297
  };
298
298
  }
299
299
  function isSqliteHandle(value) {
300
- return typeof value === "object" && value !== null && typeof Reflect.get(value, "prepare") === "function";
300
+ return typeof value === "object" && value !== null && "prepare" in value && typeof value.prepare === "function";
301
301
  }
302
302
  function isPostgresHandle(value) {
303
303
  return typeof value === "function";
304
304
  }
305
305
  function readRowId(row) {
306
306
  if (typeof row !== "object" || row === null) return void 0;
307
- const id = Reflect.get(row, "id");
308
- return typeof id === "string" ? id : void 0;
307
+ return "id" in row && typeof row.id === "string" ? row.id : void 0;
309
308
  }
310
309
  function missingBackendConnection(backend) {
311
310
  throw invariantError(`OpenWorkflow backends keep their connection in \`db\` (SQLite) or \`pg\` (Postgres), but the ${backend} backend has neither`);
@@ -324,10 +323,9 @@ function createRunIdLookup(backend, options) {
324
323
  function readStoredRunIdentity(row) {
325
324
  if (typeof row !== "object" || row === null) return void 0;
326
325
  const id = readRowId(row);
327
- const workflow = Reflect.get(row, "workflowName");
328
- return id !== void 0 && typeof workflow === "string" ? {
326
+ return id !== void 0 && "workflowName" in row && typeof row.workflowName === "string" ? {
329
327
  id,
330
- workflow
328
+ workflow: row.workflowName
331
329
  } : void 0;
332
330
  }
333
331
  function createStoredRunLookup(backend, options) {
@@ -408,16 +406,15 @@ function toFailedStepResult(error) {
408
406
  message: String(error),
409
407
  name: "Error"
410
408
  } };
411
- const code = Reflect.get(error, "code");
412
409
  return { "~vitehubStepError": {
413
- ...typeof code === "string" ? { code } : {},
410
+ ..."code" in error && typeof error.code === "string" ? { code: error.code } : {},
414
411
  message: error.message,
415
412
  name: error.name
416
413
  } };
417
414
  }
418
415
  function readFailedStepResult(value) {
419
- if (typeof value !== "object" || value === null || !Object.hasOwn(value, "~vitehubStepError")) return void 0;
420
- const payload = Reflect.get(value, "~vitehubStepError");
416
+ if (typeof value !== "object" || value === null || !("~vitehubStepError" in value)) return void 0;
417
+ const payload = value["~vitehubStepError"];
421
418
  if (typeof payload !== "object" || payload === null || !("message" in payload) || !("name" in payload)) return void 0;
422
419
  const { message, name } = payload;
423
420
  const code = "code" in payload ? payload.code : void 0;
@@ -596,7 +593,7 @@ function serializeOpenWorkflowRun(run, name) {
596
593
  };
597
594
  }
598
595
  function toWorkflowRunStepError(error) {
599
- const message = typeof error === "object" && error !== null ? Reflect.get(error, "message") : void 0;
596
+ const message = typeof error === "object" && error !== null && "message" in error ? error.message : void 0;
600
597
  return { message: typeof message === "string" && message ? message : "Workflow step failed." };
601
598
  }
602
599
  function toWorkflowRunSteps(attempts) {
@@ -1,10 +1,10 @@
1
1
  import { n as redactInspectionValue, t as redactInspectionText } from "./inspect-NBCAwsxi.js";
2
2
  import { t as isRecord } from "./object-CAK6UYR5.js";
3
3
  import { t as workflowErrorDiagnostics } from "./error-diagnostics-35AEmfve.js";
4
- import { a as resumeWorkflow, i as getWorkflowRun, o as startWorkflow, t as cancelWorkflow } from "./client-CPxPxsl5.js";
4
+ import { a as resumeWorkflow, i as getWorkflowRun, o as startWorkflow, t as cancelWorkflow } from "./client-T41cNf3k.js";
5
5
  import { t as getWorkflowDevRecorder } from "./dev-recorder-Dltdmlkv.js";
6
- import { a as getOpenWorkflowRun, i as findOpenWorkflowRuns, s as listOpenWorkflowRuns, t as cancelOpenWorkflowRun } from "./openworkflow-BiwPTYEz.js";
7
- import { t as toWorkflowRunError } from "./run-error-8p4BtTMv.js";
6
+ import { a as getOpenWorkflowRun, i as findOpenWorkflowRuns, s as listOpenWorkflowRuns, t as cancelOpenWorkflowRun } from "./openworkflow-zD8luED5.js";
7
+ import { t as toWorkflowRunError } from "./run-error-zZh1_IBo.js";
8
8
  import { getInlineWorkflowDefinitions, getWorkflowRuntimeConfig, getWorkflowRuntimeRegistry } from "./runtime/state.js";
9
9
  import { getViteHubTestMode } from "@vite-hub/runtime/internal/test-mode";
10
10
  import { deserializeResponse, isSerializedResponse } from "@vite-hub/runtime/internal/response";
@@ -1,5 +1,5 @@
1
1
  import { t as AnyOperation } from "./operations-Blwi3jQF.js";
2
- import { a as WorkflowRunsClearResult, c as WorkflowSignalResult, i as WorkflowRunView, l as WorkflowSignalView, n as WorkflowRunResult, o as WorkflowRunsListResult, r as WorkflowRunStepView, s as WorkflowRunsListStatus, t as WorkflowRunDetailView } from "./results-DBp_bmUP.js";
2
+ import { a as WorkflowRunsClearResult, c as WorkflowSignalResult, i as WorkflowRunView, l as WorkflowSignalView, n as WorkflowRunResult, o as WorkflowRunsListResult, r as WorkflowRunStepView, s as WorkflowRunsListStatus, t as WorkflowRunDetailView } from "./results-DqbEUMCH.js";
3
3
  /**
4
4
  * The `workflow.*` operations: start, get, cancel, resume, and the run history of `vite dev`. The Console,
5
5
  * `vitehub workflow`, and agents run them.
@@ -139,7 +139,7 @@ function table(rows) {
139
139
  return rows.map((row) => row.map((cell, column) => column === row.length - 1 ? cell : cell.padEnd(widths[column])).join(" ")).join("\n");
140
140
  }
141
141
  // src/operations.ts
142
- const runtime = () => import("./operations-DyaGK9zW.js");
142
+ const runtime = () => import("./operations-C2XbDDDV.js");
143
143
  const name = v.pipe(v.string(), v.check((value) => value.trim() !== "", "Name a Workflow."));
144
144
  const runId = v.pipe(v.string(), v.check((value) => value.trim() !== "", "Pass the id of a run."));
145
145
  const maxRequestBytes = 1048576;
@@ -1,4 +1,4 @@
1
- import { L as WorkflowRunStatus, v as WorkflowDriver } from "./types-CvyOEp0V.js";
1
+ import { L as WorkflowRunStatus, v as WorkflowDriver } from "./types-DrhUXMsE.js";
2
2
  /** One Workflow run as the operations return it. The start payload is not included. */
3
3
  interface WorkflowRunView {
4
4
  completedAt?: string;
@@ -6,22 +6,12 @@ import { getViteHubErrorShape } from "@vite-hub/runtime";
6
6
  function isWorkflowBoundaryError(error) {
7
7
  if (getViteHubErrorShape(error)) return true;
8
8
  if (typeof error !== "object" || error === null) return false;
9
- try {
10
- return "name" in error && error.name === "AbortError";
11
- } catch {
12
- return false;
13
- }
9
+ return "name" in error && error.name === "AbortError";
14
10
  }
15
11
  function getWorkflowProviderStatus(error) {
16
12
  if (typeof error !== "object" || error === null) return void 0;
17
- try {
18
- const value = error;
19
- const response = typeof value.response === "object" && value.response !== null ? value.response : void 0;
20
- const status = value.status ?? value.statusCode ?? response?.status;
21
- return typeof status === "number" && Number.isInteger(status) && status >= 400 && status <= 599 ? status : void 0;
22
- } catch {
23
- return;
24
- }
13
+ const status = ("status" in error ? error.status : void 0) ?? ("statusCode" in error ? error.statusCode : void 0) ?? ("response" in error && typeof error.response === "object" && error.response !== null && "status" in error.response ? error.response.status : void 0);
14
+ return typeof status === "number" && Number.isInteger(status) && status >= 400 && status <= 599 ? status : void 0;
25
15
  }
26
16
  const maxReasonLength = 200;
27
17
  /**
@@ -30,14 +20,8 @@ const maxReasonLength = 200;
30
20
  */
31
21
  function getWorkflowProviderReason(error) {
32
22
  if (typeof error !== "object" || error === null) return void 0;
33
- let name;
34
- let message;
35
- try {
36
- name = Reflect.get(error, "name");
37
- message = Reflect.get(error, "message");
38
- } catch {
39
- return;
40
- }
23
+ const name = "name" in error ? error.name : void 0;
24
+ const message = "message" in error ? error.message : void 0;
41
25
  const firstLine = typeof message === "string" ? message.split(/\r?\n/, 1)[0].trim() : "";
42
26
  const safeName = typeof name === "string" && /^[A-Za-z][\w$]{0,63}$/.test(name) ? name : void 0;
43
27
  if (!firstLine) return safeName;
@@ -1,4 +1,4 @@
1
- import "../types-CvyOEp0V.js";
1
+ import "../types-DrhUXMsE.js";
2
2
  import { DurableObject } from "cloudflare:workers";
3
3
  interface CounterStorage {
4
4
  get: (key: string) => Promise<unknown>;
@@ -1,5 +1,5 @@
1
1
  import { t as CloudflareWorkerEnv } from "../cloudflare-env-lookup-BqomAHN5.js";
2
- import { A as WorkflowProviderStep, _ as WorkflowDefinitionRegistry, d as ResolvedWorkflowOptions } from "../types-CvyOEp0V.js";
2
+ import { A as WorkflowProviderStep, _ as WorkflowDefinitionRegistry, d as ResolvedWorkflowOptions } from "../types-DrhUXMsE.js";
3
3
  export interface CloudflareWorkflowEvent {
4
4
  id?: string;
5
5
  instanceId?: string;
@@ -1,8 +1,8 @@
1
1
  import { r as runWithActiveCloudflareEnv } from "../cloudflare-env-DHhzRZOs.js";
2
2
  import { n as createWorkflowError, r as isNonRetryableError } from "../errors-CZf7oz4k.js";
3
3
  import { a as createCloudflareConcurrencySlots, s as getCloudflareWorkflowBindingName } from "../cloudflare-concurrency-counter-CDHHiMfn.js";
4
- import { t as fromCloudflareStartParams } from "../delay-JrpW40UF.js";
5
- import { i as resolveWorkflowStepOptions, o as runSerializedWorkflowHandler } from "../execute-CLmIXnON.js";
4
+ import { t as fromCloudflareStartParams } from "../delay-B4azP18B.js";
5
+ import { i as resolveWorkflowStepOptions, o as runSerializedWorkflowHandler } from "../execute-zu08sWGG.js";
6
6
  import { t as emitWorkflowFailed } from "../run-failed-BcSjSU2t.js";
7
7
  import { loadWorkflowDefinition, runWithWorkflowRuntimeEvent, setWorkflowRuntimeConfig, setWorkflowRuntimeRegistry } from "./state.js";
8
8
  import { t as workflowErrorDiagnostics } from "../error-diagnostics-35AEmfve.js";
@@ -1,7 +1,7 @@
1
1
  import { t as VitehubApp } from "../app-wkVFd7m-.js";
2
2
  import { t as CloudflareWorkerEnv } from "../cloudflare-env-lookup-BqomAHN5.js";
3
3
  import { t as CloudflareWorkerExecutionContext } from "../cloudflare-shared-B9cY3-jD.js";
4
- import { _ as WorkflowDefinitionRegistry, d as ResolvedWorkflowOptions } from "../types-CvyOEp0V.js";
4
+ import { _ as WorkflowDefinitionRegistry, d as ResolvedWorkflowOptions } from "../types-DrhUXMsE.js";
5
5
  export type CloudflareWorkerApp = VitehubApp;
6
6
  export interface WorkflowCloudflareWorkerOptions {
7
7
  app?: CloudflareWorkerApp;
@@ -1,5 +1,5 @@
1
1
  import { t as resolveAppFetch } from "../app-Cpa9qCXr.js";
2
- import { t as normalizeWorkflowOptions } from "../config-CwCwuZqv.js";
2
+ import { t as normalizeWorkflowOptions } from "../config-G0z9jHLM.js";
3
3
  import { r as runWithActiveCloudflareEnv, t as createCloudflareRuntimeEvent } from "../cloudflare-env-DHhzRZOs.js";
4
4
  import { runWithWorkflowRuntimeEvent, setWorkflowRuntimeConfig, setWorkflowRuntimeRegistry } from "./state.js";
5
5
  import "./cloudflare-shared.js";
@@ -1,4 +1,4 @@
1
- import { J as WorkflowStepContext, Q as WorkflowStepRetries, X as WorkflowStepOptions, Y as WorkflowStepFunction, b as WorkflowDuration, h as WorkflowDefinition, k as WorkflowProviderContext } from "../types-CvyOEp0V.js";
1
+ import { J as WorkflowStepContext, Q as WorkflowStepRetries, X as WorkflowStepOptions, Y as WorkflowStepFunction, b as WorkflowDuration, h as WorkflowDefinition, k as WorkflowProviderContext } from "../types-DrhUXMsE.js";
2
2
  import { t as NonRetryableError } from "../errors-DwKy5MQ8.js";
3
3
  /** The options of a step with the default retries filled in. */
4
4
  export interface ResolvedWorkflowStepOptions {
@@ -1 +1 @@
1
- export { t as createWorkflowSteps, n as readNonRetryableStepResult, r as rejectDirectGeneratedWorkflowCall, i as resolveWorkflowStepOptions, a as runProviderStep, o as runSerializedWorkflowHandler, s as runWorkflowHandler, c as runWorkflowRootStep, l as runWorkflowStepAttempt, u as toDurationMilliseconds, d as toNonRetryableStepResult, f as toStepPropertyName, p as withWorkflowStepTimeout } from "../execute-CLmIXnON.js";
1
+ export { t as createWorkflowSteps, n as readNonRetryableStepResult, r as rejectDirectGeneratedWorkflowCall, i as resolveWorkflowStepOptions, a as runProviderStep, o as runSerializedWorkflowHandler, s as runWorkflowHandler, c as runWorkflowRootStep, l as runWorkflowStepAttempt, u as toDurationMilliseconds, d as toNonRetryableStepResult, f as toStepPropertyName, p as withWorkflowStepTimeout } from "../execute-zu08sWGG.js";
@@ -1,5 +1,5 @@
1
- import { c as getOpenWorkflowRuntime } from "../openworkflow-C65AWQSJ.js";
2
- import { _ as WorkflowDefinitionRegistry, d as ResolvedWorkflowOptions } from "../types-CvyOEp0V.js";
1
+ import { c as getOpenWorkflowRuntime } from "../openworkflow-DHuxMJQB.js";
2
+ import { _ as WorkflowDefinitionRegistry, d as ResolvedWorkflowOptions } from "../types-DrhUXMsE.js";
3
3
  import { ViteHubError } from "@vite-hub/runtime";
4
4
  import { ShutdownApp } from "@vite-hub/runtime/internal/shutdown";
5
5
  type OpenWorkflowWorker = ReturnType<Awaited<ReturnType<typeof getOpenWorkflowRuntime>>["client"]["newWorker"]>;
@@ -1,5 +1,5 @@
1
- import { c as registerOpenWorkflowDefinition, f as setOpenWorkflowDatabaseUrl, n as describeOpenWorkflowStorage, o as getOpenWorkflowRuntime, p as setOpenWorkflowImporter, r as detachOpenWorkflowRuntimes } from "../openworkflow-BiwPTYEz.js";
2
- import { i as runWorkflowProviderOperation } from "../run-error-8p4BtTMv.js";
1
+ import { c as registerOpenWorkflowDefinition, f as setOpenWorkflowDatabaseUrl, n as describeOpenWorkflowStorage, o as getOpenWorkflowRuntime, p as setOpenWorkflowImporter, r as detachOpenWorkflowRuntimes } from "../openworkflow-zD8luED5.js";
2
+ import { i as runWorkflowProviderOperation } from "../run-error-zZh1_IBo.js";
3
3
  import { getWorkflowRuntimeConfig, getWorkflowRuntimeRegistry, loadWorkflowDefinition, setWorkflowRuntimeConfig, setWorkflowRuntimeRegistry } from "./state.js";
4
4
  import { n as createWorkflowError } from "../errors-CZf7oz4k.js";
5
5
  import { t as workflowErrorDiagnostics } from "../error-diagnostics-35AEmfve.js";
@@ -140,9 +140,8 @@ const openWorkflowStartDelayMs = 500;
140
140
  const permanentSetupErrorCodes = /* @__PURE__ */ new Set(["WORKFLOW_OPENWORKFLOW_DATABASE_URL_MISSING", "WORKFLOW_OPENWORKFLOW_DATABASE_URL_IGNORED"]);
141
141
  function hasPermanentSetupError(error) {
142
142
  for (let current = error, depth = 0; current && typeof current === "object" && depth < 8; depth++) {
143
- const code = Reflect.get(current, "code");
144
- if (typeof code === "string" && permanentSetupErrorCodes.has(code)) return true;
145
- current = Reflect.get(current, "cause");
143
+ if ("code" in current && typeof current.code === "string" && permanentSetupErrorCodes.has(current.code)) return true;
144
+ current = "cause" in current ? current.cause : void 0;
146
145
  }
147
146
  return false;
148
147
  }
@@ -1,2 +1,2 @@
1
- import { a as detachOpenWorkflowRuntimes, c as getOpenWorkflowRuntime, d as resetOpenWorkflowRuntime, f as resumeOpenWorkflowSignal, h as setOpenWorkflowImporter, i as describeOpenWorkflowStorage, l as listOpenWorkflowRuns, m as setOpenWorkflowDatabaseUrl, n as OpenWorkflowStorageSource, o as findOpenWorkflowRuns, p as runOpenWorkflow, r as cancelOpenWorkflowRun, s as getOpenWorkflowRun, t as OpenWorkflowRunListing, u as registerOpenWorkflowDefinition } from "../openworkflow-C65AWQSJ.js";
1
+ import { a as detachOpenWorkflowRuntimes, c as getOpenWorkflowRuntime, d as resetOpenWorkflowRuntime, f as resumeOpenWorkflowSignal, h as setOpenWorkflowImporter, i as describeOpenWorkflowStorage, l as listOpenWorkflowRuns, m as setOpenWorkflowDatabaseUrl, n as OpenWorkflowStorageSource, o as findOpenWorkflowRuns, p as runOpenWorkflow, r as cancelOpenWorkflowRun, s as getOpenWorkflowRun, t as OpenWorkflowRunListing, u as registerOpenWorkflowDefinition } from "../openworkflow-DHuxMJQB.js";
2
2
  export { OpenWorkflowRunListing, OpenWorkflowStorageSource, cancelOpenWorkflowRun, describeOpenWorkflowStorage, detachOpenWorkflowRuntimes, findOpenWorkflowRuns, getOpenWorkflowRun, getOpenWorkflowRuntime, listOpenWorkflowRuns, registerOpenWorkflowDefinition, resetOpenWorkflowRuntime, resumeOpenWorkflowSignal, runOpenWorkflow, setOpenWorkflowDatabaseUrl, setOpenWorkflowImporter };
@@ -1 +1 @@
1
- export { t as cancelOpenWorkflowRun, n as describeOpenWorkflowStorage, r as detachOpenWorkflowRuntimes, i as findOpenWorkflowRuns, a as getOpenWorkflowRun, o as getOpenWorkflowRuntime, s as listOpenWorkflowRuns, c as registerOpenWorkflowDefinition, l as resetOpenWorkflowRuntime, u as resumeOpenWorkflowSignal, d as runOpenWorkflow, f as setOpenWorkflowDatabaseUrl, p as setOpenWorkflowImporter } from "../openworkflow-BiwPTYEz.js";
1
+ export { t as cancelOpenWorkflowRun, n as describeOpenWorkflowStorage, r as detachOpenWorkflowRuntimes, i as findOpenWorkflowRuns, a as getOpenWorkflowRun, o as getOpenWorkflowRuntime, s as listOpenWorkflowRuns, c as registerOpenWorkflowDefinition, l as resetOpenWorkflowRuntime, u as resumeOpenWorkflowSignal, d as runOpenWorkflow, f as setOpenWorkflowDatabaseUrl, p as setOpenWorkflowImporter } from "../openworkflow-zD8luED5.js";
@@ -1,4 +1,4 @@
1
- import { _ as WorkflowDefinitionRegistry, d as ResolvedWorkflowOptions, h as WorkflowDefinition } from "../types-CvyOEp0V.js";
1
+ import { _ as WorkflowDefinitionRegistry, d as ResolvedWorkflowOptions, h as WorkflowDefinition } from "../types-DrhUXMsE.js";
2
2
  export interface WorkflowRunState<TResult = unknown> {
3
3
  error?: unknown;
4
4
  expiresAt?: number;
@@ -1,5 +1,5 @@
1
1
  import { t as VitehubApp } from "../app-wkVFd7m-.js";
2
- import { _ as WorkflowDefinitionRegistry, d as ResolvedWorkflowOptions } from "../types-CvyOEp0V.js";
2
+ import { _ as WorkflowDefinitionRegistry, d as ResolvedWorkflowOptions } from "../types-DrhUXMsE.js";
3
3
  import { IncomingMessage, ServerResponse } from "node:http";
4
4
  interface VercelRun {
5
5
  cancel: () => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { t as resolveAppFetch } from "../app-Cpa9qCXr.js";
2
2
  import { runWithWorkflowRuntimeEvent, setWorkflowRuntimeConfig, setWorkflowRuntimeRegistry } from "./state.js";
3
- import { i as setVercelWorkflowRuntimeModules } from "../vercel-ADMH2MK8.js";
3
+ import { i as setVercelWorkflowRuntimeModules } from "../vercel-DRezYOUp.js";
4
4
  import { waitUntil } from "@vercel/functions";
5
5
  import { H3 } from "h3";
6
6
  // ../internal/src/runtime/vercel-hosted.ts
@@ -334,6 +334,7 @@ interface DiscoveredWorkflowDefinition {
334
334
  handler: string;
335
335
  name: string;
336
336
  source?: "agent-workflow" | "agent-workflow-recovery" | "inline" | "server-workflows" | "vite-suffix";
337
+ sourceRootDir?: string;
337
338
  steps?: string[];
338
339
  }
339
340
  export { WorkflowSteps as $, WorkflowProviderStep as A, WorkflowSharedOptions as B, WorkflowHandle as C, WorkflowOptions as D, WorkflowName as E, WorkflowRunError as F, WorkflowStartOptions as G, WorkflowSignalResult as H, WorkflowRunName as I, WorkflowStepContext as J, WorkflowStep as K, WorkflowRunStatus as L, WorkflowResult as M, WorkflowResultErrorCode as N, WorkflowPayload as O, WorkflowRun as P, WorkflowStepRetries as Q, WorkflowRunStep as R, WorkflowExecutionContext as S, WorkflowModuleDriverOptions as T, WorkflowStartArguments as U, WorkflowSignal as V, WorkflowStartDelay as W, WorkflowStepOptions as X, WorkflowStepFunction as Y, WorkflowStepRegistry as Z, WorkflowDefinitionRegistry as _, DiscoveredWorkflowDefinition as a, WorkflowDuration as b, OpenWorkflowDriverOptions as c, ResolvedWorkflowOptions as d, VercelWorkflowDriverOptions as f, WorkflowDefinitionOptions as g, WorkflowDefinition as h, CloudflareWorkflowInstance as i, WorkflowRegistry as j, WorkflowProviderContext as k, OpenWorkflowPostgresOptions as l, WorkflowCreateOptions as m, CloudflareWorkflowBinding as n, InferredWorkflowDriverOptions as o, WorkflowConcurrencySlots as p, WorkflowStepBackoff as q, CloudflareWorkflowDriverOptions as r, NamedWorkflowRun as s, AgentWorkflowRegistry as t, OpenWorkflowWorkerOptions as u, WorkflowDriver as v, WorkflowHandler as w, WorkflowDurationUnit as x, WorkflowDriverOptions as y, WorkflowRuntimeConfigValue as z };
@@ -1,6 +1,6 @@
1
1
  import { n as createWorkflowError } from "./errors-CZf7oz4k.js";
2
- import { s as workflowStartAtKey } from "./delay-JrpW40UF.js";
3
- import { a as safeWorkflowName, i as runWorkflowProviderOperation, r as isWorkflowBoundaryError, t as toWorkflowRunError } from "./run-error-8p4BtTMv.js";
2
+ import { s as workflowStartAtKey } from "./delay-B4azP18B.js";
3
+ import { a as safeWorkflowName, i as runWorkflowProviderOperation, r as isWorkflowBoundaryError, t as toWorkflowRunError } from "./run-error-zZh1_IBo.js";
4
4
  import { t as workflowErrorDiagnostics } from "./error-diagnostics-35AEmfve.js";
5
5
  import { deserializeResponse, isSerializedResponse } from "@vite-hub/runtime/internal/response";
6
6
  // src/runtime/vercel.ts
@@ -152,7 +152,7 @@ async function readVercelRunError(run) {
152
152
  try {
153
153
  await run.returnValue;
154
154
  } catch (error) {
155
- const cause = typeof error === "object" && error !== null && Reflect.get(error, "name") === "WorkflowRunFailedError" ? Reflect.get(error, "cause") : void 0;
155
+ const cause = typeof error === "object" && error !== null && "name" in error && error.name === "WorkflowRunFailedError" && "cause" in error ? error.cause : void 0;
156
156
  return toWorkflowRunError(cause ?? error);
157
157
  }
158
158
  return toWorkflowRunError(void 0);
@@ -192,7 +192,7 @@ async function inspectVercelWorkflowRun(name, definition, id, payload) {
192
192
  };
193
193
  }), runWorkflowProviderOperation("vercel", "list-steps", async () => normalizeSteps(await runtime.listSteps(id)))]);
194
194
  const output = snapshot.status === "completed" ? await runWorkflowProviderOperation("vercel", "get-run", () => run.returnValue) : void 0;
195
- const result = definition.native && Reflect.get(definition.native, "~vitehubGeneratedRootStep") === true && isSerializedResponse(output) ? deserializeResponse(output) : output;
195
+ const result = definition.native && "~vitehubGeneratedRootStep" in definition.native && definition.native["~vitehubGeneratedRootStep"] === true && isSerializedResponse(output) ? deserializeResponse(output) : output;
196
196
  const error = snapshot.status === "failed" ? await readVercelRunError(run) : void 0;
197
197
  return {
198
198
  completedAt: snapshot.completedAt,
@@ -217,7 +217,7 @@ async function startVercelWorkflow(name, definition, payload, observeSettlement,
217
217
  provider: "vercel"
218
218
  }
219
219
  });
220
- if (startAt !== void 0 && Reflect.get(native, "~vitehubGenerated") !== true) throw createWorkflowError({
220
+ if (startAt !== void 0 && !("~vitehubGenerated" in native && native["~vitehubGenerated"] === true)) throw createWorkflowError({
221
221
  code: "WORKFLOW_OPERATION_UNSUPPORTED",
222
222
  details: {
223
223
  operation: "delay",
package/dist/vite.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as OperationContributionEntry } from "./operations-Blwi3jQF.js";
2
- import { D as WorkflowOptions, a as DiscoveredWorkflowDefinition } from "./types-CvyOEp0V.js";
2
+ import { D as WorkflowOptions, a as DiscoveredWorkflowDefinition } from "./types-DrhUXMsE.js";
3
3
  import { Plugin, ResolvedConfig, Rolldown, UserConfig } from "vite";
4
4
  type WorkflowRuntimeModuleName = "cloudflare-concurrency" | "cloudflare-runner" | "cloudflare-vite" | "dev-runs" | "execute" | "openworkflow-worker" | "state" | "vercel-vite";
5
5
  /**
@@ -149,6 +149,7 @@ type NitroPackageLoadingOptions = {
149
149
  };
150
150
  export declare function discoverWorkflowDefinitions(options: {
151
151
  mode?: "vite-suffix" | "standalone";
152
+ projectRoot?: string;
152
153
  rootDir: string;
153
154
  scanDirs?: string[];
154
155
  serverDirs?: string[];