@vite-hub/workflow 0.6.1 → 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 (49) hide show
  1. package/README.md +33 -9
  2. package/dist/{app-DXUHElAz.js → app-Cpa9qCXr.js} +1 -1
  3. package/dist/{client-CbBg4HlH.js → client-T41cNf3k.js} +41 -52
  4. package/dist/cloudflare-concurrency-counter-CDHHiMfn.js +136 -0
  5. package/dist/{config-CizNRTMi.js → config-G0z9jHLM.js} +6 -6
  6. package/dist/definition.d.ts +1 -1
  7. package/dist/definition.js +4 -1
  8. package/dist/{delay-CtT3442d.js → delay-B4azP18B.js} +7 -5
  9. package/dist/durability.d.ts +3 -1
  10. package/dist/durability.js +7 -1
  11. package/dist/{error-diagnostics--2cV_ER1.js → error-diagnostics-35AEmfve.js} +25 -5
  12. package/dist/{error-diagnostics-kKXseq8d.js → error-diagnostics-CsiNo_oI.js} +3 -3
  13. package/dist/{errors-CJZuvOcx.d.ts → errors-DwKy5MQ8.d.ts} +1 -1
  14. package/dist/execute-zu08sWGG.js +353 -0
  15. package/dist/index.d.ts +12 -10
  16. package/dist/index.js +3 -3
  17. package/dist/{openworkflow-defaults-DfQWtSRU.js → invariant-Dj2R1eMr.js} +1 -4
  18. package/dist/{openworkflow-CdKbUGGa.d.ts → openworkflow-DHuxMJQB.d.ts} +23 -4
  19. package/dist/openworkflow-defaults-1n0DbLdb.js +4 -0
  20. package/dist/openworkflow-zD8luED5.js +749 -0
  21. package/dist/{operation-definition-CqZkx1Rm.d.ts → operations-Blwi3jQF.d.ts} +1 -0
  22. package/dist/{operations-BBTmDm2H.js → operations-C2XbDDDV.js} +71 -15
  23. package/dist/operations.d.ts +3 -59
  24. package/dist/operations.js +5 -5
  25. package/dist/results-DqbEUMCH.d.ts +60 -0
  26. package/dist/{run-error-8p4BtTMv.js → run-error-zZh1_IBo.js} +5 -21
  27. package/dist/runtime/cloudflare-concurrency.d.ts +21 -0
  28. package/dist/runtime/cloudflare-concurrency.js +21 -0
  29. package/dist/runtime/cloudflare-runner.d.ts +1 -1
  30. package/dist/runtime/cloudflare-runner.js +7 -3
  31. package/dist/runtime/cloudflare-vite.d.ts +1 -1
  32. package/dist/runtime/cloudflare-vite.js +2 -2
  33. package/dist/runtime/execute.d.ts +8 -2
  34. package/dist/runtime/execute.js +1 -278
  35. package/dist/runtime/openworkflow-worker.d.ts +2 -2
  36. package/dist/runtime/openworkflow-worker.js +5 -6
  37. package/dist/runtime/openworkflow.d.ts +2 -2
  38. package/dist/runtime/openworkflow.js +1 -481
  39. package/dist/runtime/state.d.ts +1 -1
  40. package/dist/runtime/state.js +2 -2
  41. package/dist/runtime/vercel-vite.d.ts +1 -1
  42. package/dist/runtime/vercel-vite.js +2 -2
  43. package/dist/{signals-BHQdxoJo.js → signals-CdaxRNjN.js} +1 -1
  44. package/dist/{types-DvYcvbPG.d.ts → types-DrhUXMsE.d.ts} +34 -4
  45. package/dist/{vercel-Cw_Z9-j4.js → vercel-DRezYOUp.js} +8 -6
  46. package/dist/vite.d.ts +19 -4
  47. package/dist/vite.js +970 -212
  48. package/package.json +3 -3
  49. package/dist/cloudflare-Sgywkm1N.js +0 -57
@@ -48,16 +48,16 @@ const workflowErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
48
48
  fix: "Restart the dev server. In development the Workflow Vite plugin installs the registry with the Nitro plugin .vitehub/nitro/workflow/dev-plugin.mjs."
49
49
  },
50
50
  WORKFLOW_RUNS_UNAVAILABLE: {
51
- why: "This runtime keeps no Workflow run history. Only `vite dev` records runs.",
52
- fix: "Run the app with `vite dev`. On a deployment, read one run with `vitehub workflow runs get <runId> --workflow <name>`, or use the provider dashboard."
51
+ why: "This runtime keeps no Workflow run history that ViteHub can read. OpenWorkflow stores its runs, and `vite dev` records inline runs.",
52
+ fix: "Run the app with its dev server (`nuxt dev` or `vite dev`). On a deployment, read one run with `vitehub workflow runs get <runId> --workflow <name>`, or use the provider dashboard."
53
53
  },
54
54
  WORKFLOW_RUN_AMBIGUOUS: {
55
55
  why: ({ id, workflows }) => `Runs of ${workflows} have the id ${id}.`,
56
56
  fix: "Pass the name of the Workflow with `--workflow <name>`."
57
57
  },
58
58
  WORKFLOW_RUN_UNKNOWN: {
59
- why: ({ runId }) => `Run ${runId} was not started by \`workflow.start\` in this runtime.`,
60
- fix: "Pass the name of the Workflow with `--workflow <name>`."
59
+ why: ({ operation, runId, stored }) => stored ? `No run has the id ${runId}. OpenWorkflow storage, the inline runs that \`vite dev\` recorded, and the runs that this runtime started with \`workflow.start\` do not have it.` : `ViteHub needs the Workflow name to ${operation === "get" ? "read" : "cancel"} run ${runId}. Without the name, it finds only ${operation === "get" ? "the inline runs that `vite dev` recorded and " : ""}the runs that this runtime started with \`workflow.start\`.`,
60
+ fix: "Check the run id. On OpenWorkflow, check that the app uses the database that stores the run. On other providers, pass the name of the Workflow with `--workflow <name>`."
61
61
  },
62
62
  WORKFLOW_C0001: {
63
63
  ...dynamicError,
@@ -117,7 +117,7 @@ const workflowErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
117
117
  },
118
118
  WORKFLOW_C0015: {
119
119
  ...dynamicError,
120
- fix: "Pass one object to `defineWorkflow()`, such as `defineWorkflow({ handler, native })`, with only `handler`, `native`, and `rootStep`. The file path is the Workflow name, so do not pass a name."
120
+ fix: "Pass one object to `defineWorkflow()`, such as `defineWorkflow({ handler, native })`, with only `concurrency`, `handler`, `native`, and `rootStep`. The file path is the Workflow name, so do not pass a name."
121
121
  },
122
122
  WORKFLOW_C0016: {
123
123
  ...dynamicError,
@@ -135,6 +135,18 @@ const workflowErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
135
135
  why: ({ id }) => `[vitehub] Cloudflare does not accept the run id ${JSON.stringify(id)}. A Cloudflare instance id starts with a letter, a digit, or \`_\`, then uses only letters, digits, \`-\`, and \`_\`, up to 100 characters.`,
136
136
  fix: "Build the id from allowed characters only, for example `checkout-${orderId}` instead of `checkout:${orderId}`. Hash a long or free-form value first."
137
137
  },
138
+ WORKFLOW_CONCURRENCY_BINDING_MISSING: {
139
+ why: ({ name }) => `[vitehub] The Workflow ${JSON.stringify(name)} sets \`concurrency\`, but the Worker has no \`VITEHUB_WORKFLOW_CONCURRENCY\` Durable Object binding to count its runs. The build adds the binding when it reads \`concurrency\` as a number in the \`defineWorkflow()\` call.`,
140
+ fix: "Write `concurrency` as a number literal in the object that the Workflow file passes to `defineWorkflow()`, such as `defineWorkflow({ concurrency: 3, handler })`, and build again."
141
+ },
142
+ WORKFLOW_CONCURRENCY_INVALID: {
143
+ why: ({ value }) => `[vitehub] \`defineWorkflow()\` received \`concurrency: ${value}\`. It must be a whole number of 1 or more.`,
144
+ fix: "Set `concurrency` to the most runs that can run at the same time, such as `concurrency: 3`, or remove it."
145
+ },
146
+ WORKFLOW_CONCURRENCY_VERCEL_UNSUPPORTED: {
147
+ why: ({ name }) => `[vitehub] The Workflow ${JSON.stringify(name)} sets \`concurrency\`. Vercel Workflow has no store that counts the runs of a Workflow on all instances, so ViteHub cannot keep the limit on Vercel.`,
148
+ fix: "Run the Workflow on Cloudflare or OpenWorkflow to keep the limit. On Vercel, remove `concurrency` and limit the work inside the steps, for example with a Queue consumer that starts fewer runs."
149
+ },
138
150
  WORKFLOW_OPENWORKFLOW_DATABASE_URL_IGNORED: {
139
151
  why: "DATABASE_URL contains a Postgres URL, but OpenWorkflow no longer selects storage from DATABASE_URL alone. Falling back to a local SQLite file would leave existing Postgres runs behind and stop sharing runs between servers.",
140
152
  fix: "Set OPENWORKFLOW_POSTGRES_URL or `workflow.postgres.url` to the same Postgres URL, or add a Postgres Default Database. To choose local storage intentionally, set `workflow.sqlite.path` or OPENWORKFLOW_SQLITE_PATH."
@@ -328,6 +340,14 @@ const workflowErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
328
340
  WORKFLOW_STEP_TIMEOUT: {
329
341
  why: ({ step, timeout }) => `[vitehub] The Workflow step ${JSON.stringify(step)} ran longer than its timeout of ${timeout}. ViteHub aborted the step's signal and failed this attempt.`,
330
342
  fix: "Make the step finish sooner, or set a longer `timeout` in the step file. Pass the `signal` of the step to `fetch()` and other calls, so they stop when the attempt times out. The provider retries the step as its `retries` say."
343
+ },
344
+ WORKFLOW_VERCEL_DISCOVERED_NOT_NATIVE: {
345
+ why: ({ name }) => `[vitehub] The discovered Workflow ${JSON.stringify(name)} has no runnable Workflow DevKit entry. ViteHub does not run discovered Workflows inline on Vercel.`,
346
+ fix: "Default-export `defineWorkflow({ handler })` from a single file, use numbered step files without an index handler, or provide a `native` entry with a Workflow DevKit `use workflow` directive."
347
+ },
348
+ WORKFLOW_VERCEL_INDEX_NOT_NATIVE: {
349
+ why: ({ file, name }) => `[vitehub] The Workflow ${JSON.stringify(name)} has the index handler ${JSON.stringify(file)} and no \`native\` entry. On Vercel, ViteHub cannot make a durable run from an index handler, and an inline run is lost when the function stops.`,
350
+ fix: "Remove the index file and keep the numbered step files, such as `01.create-user.ts`. ViteHub then generates a Workflow DevKit entry that runs the steps in order. If the Workflow needs code between the steps, keep the index file and add a `native` entry that you write with Workflow DevKit."
331
351
  }
332
352
  }
333
353
  });
@@ -29,7 +29,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
29
29
  why: ({ message }) => message === void 0 ? "" : String(message)
30
30
  },
31
31
  INTERNAL_R0024: {
32
- fix: "Start the dev server with `vite dev`, or pass `--url <origin>` of a deployed app and set VITEHUB_CONSOLE_PRIVATE_KEY_<NAME> to a private key whose public key the app has in VITEHUB_CONSOLE_KEY_<NAME>.",
32
+ fix: "Start the dev server (`nuxt dev` or `vite dev`), or pass `--url <origin>` of a deployed app and set VITEHUB_CONSOLE_PRIVATE_KEY_<NAME> to a private key whose public key the app has in VITEHUB_CONSOLE_KEY_<NAME>.",
33
33
  why: ({ message }) => message === void 0 ? "" : String(message)
34
34
  },
35
35
  INTERNAL_R0023: {
@@ -145,7 +145,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
145
145
  fix: "Give a switch column `format: \"switch\"` and `switch: { operation, input }` with a registered operation name, or remove both."
146
146
  },
147
147
  INTERNAL_R0025: {
148
- fix: "Start `vite dev` in the project that you run the command from, or pass `--url` of that server.",
148
+ fix: "Start the dev server (`nuxt dev` or `vite dev`) in the project that you run the command from, or pass `--url` of that server.",
149
149
  why: ({ message }) => message === void 0 ? "" : String(message)
150
150
  },
151
151
  INTERNAL_R0026: {
@@ -166,7 +166,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
166
166
  },
167
167
  INTERNAL_R0002: {
168
168
  ...dynamicError,
169
- fix: "Stop using the feature that the message names, or set `host` in `vitehub()` to a host that provides it. For Blob, you can also set `blob: { driver: \"s3\" }` with a remote store."
169
+ fix: ({ fix }) => fix ?? "Build for a host that provides this capability, or set the option named in the message to `false`."
170
170
  },
171
171
  INTERNAL_R0004: {
172
172
  ...dynamicError,
@@ -14,7 +14,7 @@ declare const workflowErrorMessages: {
14
14
  readonly WORKFLOW_RUN_ID_UNSUPPORTED: "Native Vercel workflows assign their own run IDs.";
15
15
  };
16
16
  declare const workflowProviderNames: readonly ["cloudflare", "openworkflow", "vercel"];
17
- declare const workflowOperationNames: readonly ["cancel", "cancellation", "connect", "create", "delay", "get", "get-run", "import", "list-steps", "resume-signal", "run", "signals", "start", "status"];
17
+ declare const workflowOperationNames: readonly ["cancel", "cancellation", "connect", "create", "delay", "get", "get-run", "import", "list-runs", "list-steps", "resume-signal", "run", "signals", "start", "status"];
18
18
  type WorkflowErrorCode = keyof typeof workflowErrorMessages;
19
19
  type WorkflowOperationName = typeof workflowOperationNames[number];
20
20
  type WorkflowProviderName = typeof workflowProviderNames[number];
@@ -0,0 +1,353 @@
1
+ import { n as invariantError } from "./invariant-Dj2R1eMr.js";
2
+ import { t as workflowErrorDiagnostics } from "./error-diagnostics-35AEmfve.js";
3
+ import { n as createWorkflowError, r as isNonRetryableError, t as NonRetryableError } from "./errors-CZf7oz4k.js";
4
+ import { t as getWorkflowDevRecorder } from "./dev-recorder-Dltdmlkv.js";
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";
7
+ import { isResponse, serializeResponse, toResponse } from "@vite-hub/runtime/internal/response";
8
+ // src/runtime/concurrency.ts
9
+ const inlinePlaces = /* @__PURE__ */ new Map();
10
+ const retryDelay = {
11
+ first: 1e3,
12
+ max: 6e4
13
+ };
14
+ const slotStepOptions = { retries: {
15
+ backoff: "exponential",
16
+ delay: "1 second",
17
+ limit: 5
18
+ } };
19
+ async function takeInlinePlace(name, limit) {
20
+ let places = inlinePlaces.get(name);
21
+ if (!places) inlinePlaces.set(name, places = {
22
+ active: 0,
23
+ waiting: []
24
+ });
25
+ const state = places;
26
+ if (state.active < limit) state.active++;
27
+ else await new Promise((resolve) => state.waiting.push(resolve));
28
+ let released = false;
29
+ return () => {
30
+ if (released) return;
31
+ released = true;
32
+ const next = state.waiting.shift();
33
+ if (next) return next();
34
+ state.active--;
35
+ if (state.active === 0 && inlinePlaces.get(name) === state) inlinePlaces.delete(name);
36
+ };
37
+ }
38
+ /**
39
+ * Runs `run` when the Workflow has a free place for this run. A durable run asks its store in a step and sleeps between
40
+ * tries, so a waiting run holds no server. It frees its place in a step after `run` ends. When the run fails, the store
41
+ * frees the place the next time it counts, because it drops runs that ended.
42
+ */
43
+ async function runInWorkflowPlace(context, limit, run) {
44
+ if (limit === void 0) return await run();
45
+ const step = context.step;
46
+ if (!step?.do) {
47
+ const release = await takeInlinePlace(context.name, limit);
48
+ try {
49
+ return await run();
50
+ } finally {
51
+ release();
52
+ }
53
+ }
54
+ const slots = context.slots;
55
+ if (!slots || !step.sleep) throw invariantError(`The ${context.provider} runner started the Workflow ${JSON.stringify(context.name)} without the store that counts its runs.`);
56
+ for (let attempt = 1;; attempt++) {
57
+ if (await step.do(`vitehub-concurrency-${attempt}`, slotStepOptions, async () => await slots.acquire(limit))) break;
58
+ await step.sleep(`vitehub-concurrency-wait-${attempt}`, Math.min(retryDelay.first * 2 ** (attempt - 1), retryDelay.max));
59
+ }
60
+ const result = await run();
61
+ await step.do("vitehub-concurrency-release", slotStepOptions, async () => {
62
+ await slots.release();
63
+ return null;
64
+ });
65
+ return result;
66
+ }
67
+ // src/runtime/execute.ts
68
+ const defaultRetries = {
69
+ backoff: "exponential",
70
+ delay: "10 seconds",
71
+ limit: 3
72
+ };
73
+ const stepOptionKeys = /* @__PURE__ */ new Set(["retries", "timeout"]);
74
+ const retryOptionKeys = /* @__PURE__ */ new Set([
75
+ "backoff",
76
+ "delay",
77
+ "limit"
78
+ ]);
79
+ /**
80
+ * Checks the options of a step and fills in the default retries. A step file, `context.step.do()`, and every provider
81
+ * read the options through this function, so an invalid value fails the same way everywhere.
82
+ */
83
+ function resolveWorkflowStepOptions(step, options) {
84
+ const invalid = (option, value) => workflowErrorDiagnostics.WORKFLOW_STEP_OPTIONS_INVALID({
85
+ option,
86
+ step,
87
+ value: typeof value === "string" ? JSON.stringify(value) : String(value)
88
+ });
89
+ if (options === void 0) return { retries: { ...defaultRetries } };
90
+ if (!isRecord(options)) throw invalid("options", options);
91
+ for (const key of Object.keys(options)) if (!stepOptionKeys.has(key)) throw invalid(key, options[key]);
92
+ const retries = options.retries ?? {};
93
+ if (!isRecord(retries)) throw invalid("retries", retries);
94
+ for (const key of Object.keys(retries)) if (!retryOptionKeys.has(key)) throw invalid(`retries.${key}`, retries[key]);
95
+ const { backoff = defaultRetries.backoff, delay = defaultRetries.delay, limit = defaultRetries.limit } = retries;
96
+ if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 0) throw invalid("retries.limit", limit);
97
+ if (toDurationMilliseconds(delay) === void 0) throw invalid("retries.delay", delay);
98
+ if (backoff !== "constant" && backoff !== "exponential") throw invalid("retries.backoff", backoff);
99
+ const timeout = options.timeout;
100
+ if (timeout !== void 0 && !toDurationMilliseconds(timeout)) throw invalid("timeout", timeout);
101
+ return {
102
+ retries: {
103
+ backoff,
104
+ delay,
105
+ limit
106
+ },
107
+ ...timeout === void 0 ? {} : { timeout }
108
+ };
109
+ }
110
+ function onTimeout(milliseconds, callback) {
111
+ const deadline = Date.now() + milliseconds;
112
+ let timer;
113
+ const arm = () => {
114
+ timer = setTimeout(() => Date.now() >= deadline ? callback() : arm(), Math.min(Math.max(deadline - Date.now(), 0), maxTimerDelay));
115
+ };
116
+ arm();
117
+ return () => clearTimeout(timer);
118
+ }
119
+ /**
120
+ * Runs one attempt of a step. When `timeout` passes, the step's `signal` aborts and the attempt fails with
121
+ * `WORKFLOW_STEP_TIMEOUT`, so the provider retries it. A step that ignores the signal keeps running in the background:
122
+ * JavaScript cannot stop a promise.
123
+ */
124
+ async function runWorkflowStepAttempt(step, timeout, run) {
125
+ const controller = new AbortController();
126
+ const milliseconds = timeout === void 0 ? void 0 : toDurationMilliseconds(timeout);
127
+ if (milliseconds === void 0) return await run({ signal: controller.signal });
128
+ const label = typeof timeout === "number" ? `${timeout} ms` : String(timeout);
129
+ let cancel = () => {};
130
+ const expired = new Promise((_resolve, reject) => {
131
+ cancel = onTimeout(milliseconds, () => {
132
+ const error = workflowErrorDiagnostics.WORKFLOW_STEP_TIMEOUT({
133
+ step,
134
+ timeout: label
135
+ });
136
+ controller.abort(error);
137
+ reject(error);
138
+ });
139
+ });
140
+ try {
141
+ return await Promise.race([Promise.resolve().then(() => run({ signal: controller.signal })), expired]);
142
+ } finally {
143
+ cancel();
144
+ }
145
+ }
146
+ const timedAttempts = /* @__PURE__ */ new WeakSet();
147
+ /** Adds a timeout once, including when a provider receives an already wrapped folder step. */
148
+ function withWorkflowStepTimeout(name, timeout, run) {
149
+ if (timeout === void 0 || timedAttempts.has(run)) return run;
150
+ const attempt = () => runWorkflowStepAttempt(name, timeout, run);
151
+ timedAttempts.add(attempt);
152
+ return attempt;
153
+ }
154
+ async function runProviderStep(step, name, run, options) {
155
+ const resolved = resolveWorkflowStepOptions(name, options);
156
+ const attempt = () => runWorkflowStepAttempt(name, resolved.timeout, run);
157
+ timedAttempts.add(attempt);
158
+ if (typeof step?.do === "function") return await step.do(name, resolved, attempt);
159
+ const recorder = getWorkflowDevRecorder();
160
+ return recorder ? await recorder.step(name, attempt) : await attempt();
161
+ }
162
+ /** `01.create-user.ts` becomes the `createUser` step. */
163
+ function toStepPropertyName(file) {
164
+ return file.split("/").pop().replace(/\.(?:c|m)?[jt]s$/i, "").replace(/^\d+[.-]?/, "").replace(/[-_.]+([a-z0-9])/gi, (_, char) => char.toUpperCase());
165
+ }
166
+ function createWorkflowSteps(context, stepModules) {
167
+ const names = /* @__PURE__ */ new Map();
168
+ return Object.fromEntries(stepModules.map((module) => {
169
+ const propertyName = toStepPropertyName(module.name);
170
+ if (!propertyName) throw workflowErrorDiagnostics.WORKFLOW_C0011({ message: `[vitehub] Workflow step file ${JSON.stringify(module.name)} normalizes to an empty step property. Rename the file so the step property is non-empty.` });
171
+ const previousName = names.get(propertyName);
172
+ if (previousName) throw workflowErrorDiagnostics.WORKFLOW_C0010({ message: `[vitehub] Workflow step files ${JSON.stringify(previousName)} and ${JSON.stringify(module.name)} both normalize to the \`${propertyName}\` step property. Rename one file so each step property is unique.` });
173
+ names.set(propertyName, module.name);
174
+ return [propertyName, async (input) => await runProviderStep(context.step, `${context.name}/${module.name}`, (stepContext) => module.run(input, stepContext), module.options)];
175
+ }));
176
+ }
177
+ const durationUnits = {
178
+ second: 1e3,
179
+ minute: 6e4,
180
+ hour: 36e5,
181
+ day: 864e5,
182
+ week: 6048e5,
183
+ month: 2592e6,
184
+ year: 315576e5
185
+ };
186
+ const durationPattern = /^(\d+(?:\.\d+)?) (second|minute|hour|day|week|month|year)s?$/;
187
+ /** The milliseconds of a `WorkflowDuration`: a number of 0 or more, or a string such as `'30 seconds'`. */
188
+ function toDurationMilliseconds(value) {
189
+ if (typeof value === "number") return Number.isFinite(value) && value >= 0 ? value : void 0;
190
+ if (typeof value !== "string") return void 0;
191
+ const match = durationPattern.exec(value);
192
+ return match ? Number(match[1]) * durationUnits[match[2]] : void 0;
193
+ }
194
+ function toSleepTarget(name, until) {
195
+ if (Object.prototype.toString.call(until) === "[object Date]") {
196
+ const date = new Date(until.getTime());
197
+ if (Number.isFinite(date.getTime())) return date;
198
+ } else {
199
+ const milliseconds = toDurationMilliseconds(until);
200
+ if (milliseconds !== void 0) return milliseconds;
201
+ }
202
+ const value = typeof until === "string" ? JSON.stringify(until) : String(until);
203
+ throw workflowErrorDiagnostics.WORKFLOW_SLEEP_DURATION_INVALID({
204
+ name,
205
+ value
206
+ });
207
+ }
208
+ const maxTimerDelay = 2147483647;
209
+ async function waitUntil(time) {
210
+ for (let left = time - Date.now(); left > 0; left = time - Date.now()) await new Promise((resolve) => setTimeout(resolve, Math.min(left, maxTimerDelay)));
211
+ }
212
+ function createSleep(context) {
213
+ let count = 0;
214
+ return async (until) => {
215
+ const target = toSleepTarget(context.name, until);
216
+ const name = `sleep-${++count}`;
217
+ const step = context.step;
218
+ if (step?.sleep) {
219
+ if (typeof target === "number") return await step.sleep(name, target);
220
+ if (step.sleepUntil) return await step.sleepUntil(name, target);
221
+ return await step.sleep(name, Math.max(0, target.getTime() - Date.now()));
222
+ }
223
+ const time = typeof target === "number" ? Date.now() + target : target.getTime();
224
+ await runProviderStep(void 0, name, async () => await waitUntil(time));
225
+ };
226
+ }
227
+ function createSignals(context, wait) {
228
+ let count = 0;
229
+ const inlineTokens = [];
230
+ const createSignal = () => {
231
+ if (context.provider === "vercel") throw workflowErrorDiagnostics.WORKFLOW_SIGNAL_VERCEL_UNSUPPORTED({ name: context.name });
232
+ const step = context.step;
233
+ if (step?.do && !step.waitForSignal) throw createWorkflowError({
234
+ code: "WORKFLOW_OPERATION_UNSUPPORTED",
235
+ details: {
236
+ operation: "signals",
237
+ provider: context.provider
238
+ }
239
+ });
240
+ const name = `signal-${++count}`;
241
+ const inline = !step?.waitForSignal;
242
+ const token = createWorkflowSignalToken({
243
+ host: inline ? "inline" : context.provider,
244
+ run: context.id ?? "",
245
+ signal: name,
246
+ workflow: context.name
247
+ });
248
+ if (inline) {
249
+ openInlineWorkflowSignal(token);
250
+ inlineTokens.push(token);
251
+ }
252
+ let waiting;
253
+ return {
254
+ token,
255
+ wait: () => waiting ??= wait ? wait() : inline ? runProviderStep(void 0, name, async () => await waitForInlineWorkflowSignal(token)) : step.waitForSignal(name, token)
256
+ };
257
+ };
258
+ return {
259
+ close: () => closeInlineWorkflowSignals(inlineTokens),
260
+ createSignal
261
+ };
262
+ }
263
+ function toExecutionContext(context, sleep, createSignal) {
264
+ return {
265
+ ...context,
266
+ createSignal,
267
+ sleep,
268
+ steps: {}
269
+ };
270
+ }
271
+ const rootStepSleepResult = { "~vitehubRootStepSleep": true };
272
+ const rootStepSignalResult = { "~vitehubRootStepSignal": true };
273
+ function toNonRetryableStepResult(error) {
274
+ if (!isNonRetryableError(error)) return void 0;
275
+ const code = Reflect.get(error, "code");
276
+ return { "~vitehubNonRetryableError": {
277
+ ...typeof code === "string" ? { code } : {},
278
+ message: error.message,
279
+ name: error.name
280
+ } };
281
+ }
282
+ function readNonRetryableStepResult(value) {
283
+ if (typeof value !== "object" || value === null || !Object.hasOwn(value, "~vitehubNonRetryableError")) return void 0;
284
+ const { code, message, name } = value["~vitehubNonRetryableError"];
285
+ const error = new NonRetryableError(message);
286
+ error.name = name;
287
+ return code === void 0 ? error : Object.assign(error, { code });
288
+ }
289
+ async function runInRootStep(context, definition, encode) {
290
+ return await runInWorkflowPlace(context, definition.concurrency, () => runHandler(context, definition, encode));
291
+ }
292
+ async function runHandler(context, definition, encode) {
293
+ if (definition.rootStep === false) {
294
+ const signals = createSignals(context);
295
+ try {
296
+ return await encode(await definition.handler(toExecutionContext(context, createSleep(context), signals.createSignal)));
297
+ } finally {
298
+ signals.close();
299
+ }
300
+ }
301
+ let suspended;
302
+ const sleepError = () => workflowErrorDiagnostics.WORKFLOW_ROOT_STEP_SLEEP({ name: context.name });
303
+ const signalError = () => workflowErrorDiagnostics.WORKFLOW_ROOT_STEP_SIGNAL({ name: context.name });
304
+ const sleep = async () => {
305
+ suspended = rootStepSleepResult;
306
+ throw sleepError();
307
+ };
308
+ const signals = createSignals(context, async () => {
309
+ suspended = rootStepSignalResult;
310
+ throw signalError();
311
+ });
312
+ const output = await runProviderStep(context.step, context.name, async () => {
313
+ try {
314
+ const value = await encode(await definition.handler(toExecutionContext(context, sleep, signals.createSignal)));
315
+ return suspended ?? value;
316
+ } catch (error) {
317
+ if (suspended) return suspended;
318
+ throw error;
319
+ } finally {
320
+ signals.close();
321
+ }
322
+ });
323
+ if (typeof output === "object" && output !== null && "~vitehubRootStepSleep" in output) throw sleepError();
324
+ if (typeof output === "object" && output !== null && "~vitehubRootStepSignal" in output) throw signalError();
325
+ return output;
326
+ }
327
+ async function runWorkflowHandler(context, definition) {
328
+ return toResponse(await runInRootStep(context, definition, (value) => value));
329
+ }
330
+ /**
331
+ * Runs the handler of a single-file Workflow as its root step. The generated Vercel native entry calls it inside its one
332
+ * `"use step"`, so Workflow DevKit stores the result as the Cloudflare root step does.
333
+ */
334
+ async function runWorkflowRootStep(context, definition) {
335
+ if (definition.concurrency !== void 0) throw workflowErrorDiagnostics.WORKFLOW_CONCURRENCY_VERCEL_UNSUPPORTED({ name: context.name });
336
+ return await runSerializedWorkflowHandler(context, {
337
+ ...definition,
338
+ rootStep: true
339
+ });
340
+ }
341
+ function rejectDirectGeneratedWorkflowCall() {
342
+ throw invariantError("Start generated Workflows with Workflow DevKit.");
343
+ }
344
+ async function toStoredWorkflowResult(value) {
345
+ if (isResponse(value)) return await serializeResponse(value);
346
+ const json = JSON.stringify(value);
347
+ return json === void 0 ? void 0 : JSON.parse(json);
348
+ }
349
+ /** Encode inside the root step so both checkpoints and final outputs survive replay. */
350
+ async function runSerializedWorkflowHandler(context, definition) {
351
+ return await runInRootStep(context, definition, toStoredWorkflowResult);
352
+ }
353
+ export { runProviderStep as a, runWorkflowRootStep as c, toNonRetryableStepResult as d, toStepPropertyName as f, resolveWorkflowStepOptions as i, runWorkflowStepAttempt as l, readNonRetryableStepResult as n, runSerializedWorkflowHandler as o, withWorkflowStepTimeout as p, rejectDirectGeneratedWorkflowCall as r, runWorkflowHandler as s, createWorkflowSteps as t, toDurationMilliseconds as u };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineWorkflow } from "./definition.js";
2
- import { a as WorkflowProviderFailure, i as WorkflowOperationName, n as WorkflowErrorCode, o as WorkflowProviderName, r as WorkflowErrorDetails, t as NonRetryableError } from "./errors-CJZuvOcx.js";
3
- import { A as WorkflowRun, B as WorkflowStartOptions, C as WorkflowName, D as WorkflowProviderStep, E as WorkflowProviderContext, F as WorkflowSharedOptions, G as WorkflowStepOptions, H as WorkflowStepBackoff, I as WorkflowSignal, J as WorkflowSteps, K as WorkflowStepRegistry, L as WorkflowSignalResult, M as WorkflowRunStatus, N as WorkflowRunStep, O as WorkflowRegistry, R as WorkflowStartArguments, S as WorkflowModuleDriverOptions, T as WorkflowPayload, U as WorkflowStepContext, V as WorkflowStep, W as WorkflowStepFunction, _ as WorkflowDuration, a as InferredWorkflowDriverOptions, b as WorkflowHandle, c as OpenWorkflowWorkerOptions, d as WorkflowCreateOptions, f as WorkflowDefinition, g as WorkflowDriverOptions, h as WorkflowDriver, i as DiscoveredWorkflowDefinition, j as WorkflowRunError, k as WorkflowResultErrorCode, l as ResolvedWorkflowOptions, m as WorkflowDefinitionRegistry, n as CloudflareWorkflowDriverOptions, o as OpenWorkflowDriverOptions, p as WorkflowDefinitionOptions, q as WorkflowStepRetries, r as CloudflareWorkflowInstance, s as OpenWorkflowPostgresOptions, t as CloudflareWorkflowBinding, u as VercelWorkflowDriverOptions, v as WorkflowDurationUnit, w as WorkflowOptions, x as WorkflowHandler, y as WorkflowExecutionContext, z as WorkflowStartDelay } from "./types-DvYcvbPG.js";
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-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> & {
@@ -20,18 +20,20 @@ export declare function createWorkflow<TPayload = unknown, TResult = unknown>(na
20
20
  * A provider failure, an unsupported option, or an invalid `delay` is `error`. Config errors, for example an unknown
21
21
  * Workflow name, throw.
22
22
  */
23
- export declare function startWorkflow<TArgs extends WorkflowStartCall>(...args: TArgs): Promise<Result<WorkflowRun<WorkflowPayload<TArgs[0]>, unknown>, WorkflowResultErrorCode>>;
23
+ export declare function startWorkflow<TArgs extends WorkflowStartCall>(...args: TArgs): Promise<Result<NamedWorkflowRun<TArgs[0]>, WorkflowResultErrorCode>>;
24
24
  type WorkflowStartCall = { [TName in WorkflowName]: [name: TName, ...WorkflowStartArguments<WorkflowPayload<TName>>]; }[WorkflowName];
25
25
  /**
26
- * Reads one run and returns `[error, run]`. A provider failure is `error`. A run that the provider does not know has
27
- * `status: "unknown"`. Config errors throw.
26
+ * Reads one run and returns `[error, run]`. Standalone Workflow names and types come from `WorkflowRegistry`.
27
+ * Discovered Agent Workflows have unknown payload and result types. A provider failure is
28
+ * `error`. A run that the provider does not know has `status: "unknown"`. Config errors throw.
28
29
  */
29
- export declare function getWorkflowRun(name: string, id: string): Promise<Result<WorkflowRun<unknown, unknown>, WorkflowResultErrorCode>>;
30
+ export declare function getWorkflowRun<TName extends WorkflowRunName>(name: TName, id: string): Promise<Result<NamedWorkflowRun<TName>, WorkflowResultErrorCode>>;
30
31
  /**
31
- * Cancels one run and returns `[error, run]`. A provider failure, or a provider that cannot cancel the run, is
32
- * `error`. Config errors, for example an unknown Workflow name, throw.
32
+ * Cancels one run and returns `[error, run]` with the same run types as `getWorkflowRun()`.
33
+ * A provider failure, or a provider that cannot cancel the run, is `error`. Config errors, for
34
+ * example an unknown Workflow name, throw.
33
35
  */
34
- export declare function cancelWorkflow(name: string, id: string): Promise<Result<WorkflowRun<unknown, unknown>, WorkflowResultErrorCode>>;
36
+ export declare function cancelWorkflow<TName extends WorkflowRunName>(name: TName, id: string): Promise<Result<NamedWorkflowRun<TName>, WorkflowResultErrorCode>>;
35
37
  /**
36
38
  * Resumes a run that waits for a signal and returns `[error, signal]`. `token` is `signal.token` from
37
39
  * `context.createSignal()`, or the hook token of a native Vercel entry. `payload` is the value that `signal.wait()`
@@ -59,4 +61,4 @@ type PayloadValidator<T> = PayloadSchema<T> | ParsePayloadSchema<T> | ((payload:
59
61
  export declare function readRequestPayload(request: Request): Promise<unknown>;
60
62
  export declare function validatePayload<T>(payload: unknown, schema: PayloadValidator<T>): Promise<T>;
61
63
  export declare function readValidatedPayload<T>(request: Request, schema: PayloadValidator<T>): Promise<T>;
62
- export { type CloudflareWorkflowBinding, type CloudflareWorkflowDriverOptions, type CloudflareWorkflowInstance, type DiscoveredWorkflowDefinition, type InferredWorkflowDriverOptions, NonRetryableError, type OpenWorkflowDriverOptions, type OpenWorkflowPostgresOptions, type OpenWorkflowWorkerOptions, type ResolvedWorkflowOptions, type VercelWorkflowDriverOptions, type WorkflowCreateOptions, type WorkflowDefinition, type WorkflowDefinitionOptions, type WorkflowDefinitionRegistry, type WorkflowDriver, type WorkflowDriverOptions, type WorkflowDuration, type WorkflowDurationUnit, type WorkflowErrorCode, type WorkflowErrorDetails, type WorkflowExecutionContext, type WorkflowHandle, type WorkflowHandler, type WorkflowModuleDriverOptions, type WorkflowName, type WorkflowOperationName, type WorkflowOptions, type WorkflowPayload, type WorkflowProviderContext, type WorkflowProviderFailure, type WorkflowProviderName, type WorkflowProviderStep, type WorkflowRegistry, type WorkflowResultErrorCode, type WorkflowRun, type WorkflowRunError, type WorkflowRunStatus, type WorkflowRunStep, type WorkflowSharedOptions, type WorkflowSignal, type WorkflowSignalResult, type WorkflowStartDelay, type WorkflowStartOptions, type WorkflowStep, type WorkflowStepBackoff, type WorkflowStepContext, type WorkflowStepFunction, type WorkflowStepOptions, type WorkflowStepRegistry, type WorkflowStepRetries, type WorkflowSteps, defineWorkflow };
64
+ export { type AgentWorkflowRegistry, type CloudflareWorkflowBinding, type CloudflareWorkflowDriverOptions, type CloudflareWorkflowInstance, type DiscoveredWorkflowDefinition, type InferredWorkflowDriverOptions, NonRetryableError, type OpenWorkflowDriverOptions, type OpenWorkflowPostgresOptions, type OpenWorkflowWorkerOptions, type ResolvedWorkflowOptions, type VercelWorkflowDriverOptions, type WorkflowCreateOptions, type WorkflowDefinition, type WorkflowDefinitionOptions, type WorkflowDefinitionRegistry, type WorkflowDriver, type WorkflowDriverOptions, type WorkflowDuration, type WorkflowDurationUnit, type WorkflowErrorCode, type WorkflowErrorDetails, type WorkflowExecutionContext, type WorkflowHandle, type WorkflowHandler, type WorkflowModuleDriverOptions, type WorkflowName, type WorkflowOperationName, type WorkflowOptions, type WorkflowPayload, type WorkflowProviderContext, type WorkflowProviderFailure, type WorkflowProviderName, type WorkflowProviderStep, type WorkflowRegistry, type WorkflowResult, type WorkflowResultErrorCode, type WorkflowRun, type WorkflowRunError, type WorkflowRunStatus, type WorkflowRunStep, type WorkflowSharedOptions, type WorkflowSignal, type WorkflowSignalResult, type WorkflowStartDelay, type WorkflowStartOptions, type WorkflowStep, type WorkflowStepBackoff, type WorkflowStepContext, type WorkflowStepFunction, type WorkflowStepOptions, type WorkflowStepRegistry, type WorkflowStepRetries, type WorkflowSteps, defineWorkflow };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { defineWorkflow } from "./definition.js";
2
2
  import { t as NonRetryableError } from "./errors-CZf7oz4k.js";
3
- import { n as getCloudflareWorkflowBindingName } from "./cloudflare-Sgywkm1N.js";
4
- import { a as resumeWorkflow, i as getWorkflowRun, n as createWorkflow, o as startWorkflow, r as deferWorkflow, t as cancelWorkflow } from "./client-CbBg4HlH.js";
5
- import { t as workflowErrorDiagnostics } from "./error-diagnostics--2cV_ER1.js";
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-T41cNf3k.js";
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()`. */
8
8
  async function readRequestPayload(request) {
@@ -18,7 +18,4 @@ function invariantError(what) {
18
18
  function invariant(condition, what) {
19
19
  if (!condition) throw invariantError(what);
20
20
  }
21
- // src/internal/openworkflow-defaults.ts
22
- /** The SQLite file that OpenWorkflow uses without configured storage, relative to the working directory of the server. */
23
- const defaultOpenWorkflowSqlitePath = ".vitehub/data/openworkflow.sqlite.db";
24
- export { invariant as n, invariantError as r, defaultOpenWorkflowSqlitePath as t };
21
+ export { invariantError as n, invariant as t };
@@ -1,4 +1,5 @@
1
- import { A as WorkflowRun, B as WorkflowStartOptions, f as WorkflowDefinition, l as ResolvedWorkflowOptions } from "./types-DvYcvbPG.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";
2
3
  type OpenWorkflowModule = typeof import("openworkflow");
3
4
  type OpenWorkflowPostgresModule = typeof import("openworkflow/postgres");
4
5
  type OpenWorkflowSqliteModule = typeof import("openworkflow/sqlite");
@@ -11,6 +12,8 @@ interface OpenWorkflowRuntime {
11
12
  client: OpenWorkflowClient;
12
13
  definitions: Map<string, WorkflowDefinition>;
13
14
  findRunId: (name: string, key: string) => Promise<string | undefined>;
15
+ findRuns: (id: string, name?: string) => Promise<StoredRunIdentity[]>;
16
+ slots: (workflow: string, run: string) => WorkflowConcurrencySlots;
14
17
  workflows: Map<string, OpenWorkflowRunnable>;
15
18
  }
16
19
  /**
@@ -23,6 +26,10 @@ type OpenWorkflowStorageSource = "configured" | "database" | "default";
23
26
  * generated startup plugin installs it when the build has a Postgres Default Database.
24
27
  */
25
28
  declare function setOpenWorkflowDatabaseUrl(resolve: (() => string | undefined) | undefined): void;
29
+ interface StoredRunIdentity {
30
+ id: string;
31
+ workflow: string;
32
+ }
26
33
  /** The storage that OpenWorkflow uses for `config` now, without credentials. */
27
34
  declare function describeOpenWorkflowStorage(config: ResolvedWorkflowOptions): {
28
35
  backend: "postgres" | "sqlite";
@@ -37,8 +44,20 @@ declare function getOpenWorkflowRuntime(config: ResolvedWorkflowOptions): Promis
37
44
  declare function resumeOpenWorkflowSignal(config: ResolvedWorkflowOptions, workflow: string, id: string, token: string, value: unknown): Promise<boolean>;
38
45
  declare function registerOpenWorkflowDefinition(runtime: OpenWorkflowRuntime, name: string, definition: WorkflowDefinition): Promise<OpenWorkflowRunnable>;
39
46
  declare function runOpenWorkflow<TPayload = unknown, TResult = unknown>(config: ResolvedWorkflowOptions, name: string, payload: TPayload | undefined, definition: WorkflowDefinition<TPayload, TResult>, options: WorkflowStartOptions, onDispatch?: () => void, startAt?: number): Promise<WorkflowRun<TPayload, TResult>>;
40
- declare function getOpenWorkflowRun<TPayload = unknown, TResult = unknown>(config: ResolvedWorkflowOptions, name: string, id: string): Promise<WorkflowRun<TPayload, TResult>>;
41
- declare function cancelOpenWorkflowRun<TPayload = unknown, TResult = unknown>(config: ResolvedWorkflowOptions, name: string, id: string): Promise<WorkflowRun<TPayload, TResult>>;
47
+ declare function getOpenWorkflowRun<TPayload = unknown, TResult = unknown>(config: ResolvedWorkflowOptions, name: string, id: string, lookup?: "key-or-id" | "provider-id"): Promise<WorkflowRun<TPayload, TResult>>;
48
+ declare function findOpenWorkflowRuns(config: ResolvedWorkflowOptions, id: string, name?: string): Promise<StoredRunIdentity[]>;
49
+ interface OpenWorkflowRunListing {
50
+ run: WorkflowRun<unknown, unknown>;
51
+ stepCount: number;
52
+ workflow: string;
53
+ }
54
+ /** Lists the stored OpenWorkflow runs, newest first, with the number of steps of each run. */
55
+ declare function listOpenWorkflowRuns(config: ResolvedWorkflowOptions, input: {
56
+ limit: number;
57
+ status?: WorkflowRunsListStatus;
58
+ workflow?: string;
59
+ }): Promise<OpenWorkflowRunListing[]>;
60
+ declare function cancelOpenWorkflowRun<TPayload = unknown, TResult = unknown>(config: ResolvedWorkflowOptions, name: string, id: string, lookup?: "key-or-id" | "provider-id"): Promise<WorkflowRun<TPayload, TResult>>;
42
61
  declare function resetOpenWorkflowRuntime(): Promise<void>;
43
62
  /**
44
63
  * Starts a new runtime cache, so the next acquisition opens a fresh backend. Returns a function that closes the
@@ -46,4 +65,4 @@ declare function resetOpenWorkflowRuntime(): Promise<void>;
46
65
  */
47
66
  declare function detachOpenWorkflowRuntimes(): () => Promise<void>;
48
67
  declare function setOpenWorkflowImporter(importer: OpenWorkflowImporter): void;
49
- export { getOpenWorkflowRun as a, resetOpenWorkflowRuntime as c, setOpenWorkflowDatabaseUrl as d, setOpenWorkflowImporter as f, detachOpenWorkflowRuntimes as i, resumeOpenWorkflowSignal as l, cancelOpenWorkflowRun as n, getOpenWorkflowRuntime as o, describeOpenWorkflowStorage as r, registerOpenWorkflowDefinition as s, OpenWorkflowStorageSource as t, runOpenWorkflow as u };
68
+ export { detachOpenWorkflowRuntimes as a, getOpenWorkflowRuntime as c, resetOpenWorkflowRuntime as d, resumeOpenWorkflowSignal as f, setOpenWorkflowImporter as h, describeOpenWorkflowStorage as i, listOpenWorkflowRuns as l, setOpenWorkflowDatabaseUrl as m, OpenWorkflowStorageSource as n, findOpenWorkflowRuns as o, runOpenWorkflow as p, cancelOpenWorkflowRun as r, getOpenWorkflowRun as s, OpenWorkflowRunListing as t, registerOpenWorkflowDefinition as u };
@@ -0,0 +1,4 @@
1
+ // src/internal/openworkflow-defaults.ts
2
+ /** The SQLite file that OpenWorkflow uses without configured storage, relative to the working directory of the server. */
3
+ const defaultOpenWorkflowSqlitePath = ".vitehub/data/openworkflow.sqlite.db";
4
+ export { defaultOpenWorkflowSqlitePath as t };