@lovable.dev/workflows-sdk 0.0.0-dev.32 → 0.0.0-dev.33
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/dist/{branch-metadata-DmTc2agd.js → branch-metadata-6pwT4Ei_.js} +1 -1
- package/dist/{context-escapes-DjpWclA6.js → context-escapes-B66nJs0o.js} +1 -1
- package/dist/{duplicate-ids-D7HMDNMh.js → duplicate-ids-CTd1_la_.js} +1 -1
- package/dist/{generate-D1zt5ZZf.js → generate-CDOP4pMi.js} +8 -8
- package/dist/{graph-Cd9aL2HY.js → graph-ZthZ8l6y.js} +1 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.js +22 -34
- package/dist/{nested-operations-DgjRz2Ps.js → nested-operations-CuDUxJl4.js} +1 -1
- package/dist/{operation-descriptions-5RfHLwu3.js → operation-descriptions-F6LKn5jJ.js} +1 -1
- package/dist/{step-metadata-BdT25yO4.js → step-metadata-B3mdzOIH.js} +1 -1
- package/dist/vite.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadTypeScript, t as workflowHandlerSource } from "./graph-
|
|
1
|
+
import { loadTypeScript, t as workflowHandlerSource } from "./graph-ZthZ8l6y.js";
|
|
2
2
|
//#region src/manifests/duplicate-ids.ts
|
|
3
3
|
/** Where an explicit `{ id }` would sit for each operation. */
|
|
4
4
|
const optionsArgument = {
|
|
@@ -6626,7 +6626,7 @@ function listValueFromJson(listValue, json) {
|
|
|
6626
6626
|
}
|
|
6627
6627
|
//#endregion
|
|
6628
6628
|
//#region package.json
|
|
6629
|
-
var version = "0.0.0-dev.
|
|
6629
|
+
var version = "0.0.0-dev.33";
|
|
6630
6630
|
//#endregion
|
|
6631
6631
|
//#region src/proto/lovable/appworkflows/v1/workflow_manifest_pb.ts
|
|
6632
6632
|
/**
|
|
@@ -6819,14 +6819,14 @@ function serializeSchema(schema, direction, label) {
|
|
|
6819
6819
|
}
|
|
6820
6820
|
}
|
|
6821
6821
|
async function generateManifests(definition, options = {}) {
|
|
6822
|
-
const { extractWorkflowGraph } = await import("./graph-
|
|
6823
|
-
const { findBranchMetadataIssues } = await import("./branch-metadata-
|
|
6824
|
-
const { findWorkflowContextEscapes } = await import("./context-escapes-
|
|
6825
|
-
const { findDuplicateOperationIds } = await import("./duplicate-ids-
|
|
6822
|
+
const { extractWorkflowGraph } = await import("./graph-ZthZ8l6y.js");
|
|
6823
|
+
const { findBranchMetadataIssues } = await import("./branch-metadata-6pwT4Ei_.js");
|
|
6824
|
+
const { findWorkflowContextEscapes } = await import("./context-escapes-B66nJs0o.js");
|
|
6825
|
+
const { findDuplicateOperationIds } = await import("./duplicate-ids-CTd1_la_.js");
|
|
6826
6826
|
const { DURABLE_ID_REQUIRED } = await import("./durable-ids-Cx341nJQ.js").then((n) => n.n);
|
|
6827
|
-
const { findNestedDurableOperations } = await import("./nested-operations-
|
|
6828
|
-
const { findOperationDescriptionIssues } = await import("./operation-descriptions-
|
|
6829
|
-
const { findStepMetadataIssues } = await import("./step-metadata-
|
|
6827
|
+
const { findNestedDurableOperations } = await import("./nested-operations-CuDUxJl4.js");
|
|
6828
|
+
const { findOperationDescriptionIssues } = await import("./operation-descriptions-F6LKn5jJ.js");
|
|
6829
|
+
const { findStepMetadataIssues } = await import("./step-metadata-B3mdzOIH.js");
|
|
6830
6830
|
const collection = registerWorkflows(definition);
|
|
6831
6831
|
const manifests = [];
|
|
6832
6832
|
for (const workflow of collection.workflows.flatMap(workflowVersions)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as WorkflowManifestUnknownNodeV1Schema, a as WorkflowManifestGraphEdgeV1Schema, b as create, c as WorkflowManifestLoopNodeV1Schema, d as WorkflowManifestParallelNodeV1Schema, f as WorkflowManifestRepeatedStepV1Schema, g as WorkflowManifestStepNodeV1Schema, h as WorkflowManifestStepExecutionPolicyV1Schema, i as WorkflowManifestBranchNodeV1Schema, l as WorkflowManifestNowNodeV1Schema, m as WorkflowManifestSleepUntilNodeV1Schema, n as WorkflowManifestApproveNodeV1Schema, o as WorkflowManifestGraphNodeV1Schema, p as WorkflowManifestSleepNodeV1Schema, r as WorkflowManifestBranchEdgeV1Schema, s as WorkflowManifestGraphV1Schema, u as WorkflowManifestOrderEdgeV1Schema, v as WorkflowManifestUuidNodeV1Schema, y as WorkflowManifestWaitForEventNodeV1Schema } from "./generate-
|
|
1
|
+
import { _ as WorkflowManifestUnknownNodeV1Schema, a as WorkflowManifestGraphEdgeV1Schema, b as create, c as WorkflowManifestLoopNodeV1Schema, d as WorkflowManifestParallelNodeV1Schema, f as WorkflowManifestRepeatedStepV1Schema, g as WorkflowManifestStepNodeV1Schema, h as WorkflowManifestStepExecutionPolicyV1Schema, i as WorkflowManifestBranchNodeV1Schema, l as WorkflowManifestNowNodeV1Schema, m as WorkflowManifestSleepUntilNodeV1Schema, n as WorkflowManifestApproveNodeV1Schema, o as WorkflowManifestGraphNodeV1Schema, p as WorkflowManifestSleepNodeV1Schema, r as WorkflowManifestBranchEdgeV1Schema, s as WorkflowManifestGraphV1Schema, u as WorkflowManifestOrderEdgeV1Schema, v as WorkflowManifestUuidNodeV1Schema, y as WorkflowManifestWaitForEventNodeV1Schema } from "./generate-CDOP4pMi.js";
|
|
2
2
|
//#region src/manifests/handler-source.ts
|
|
3
3
|
const nativeFunctionSource = /\{\s*\[native code\]\s*\}\s*$/;
|
|
4
4
|
function workflowHandlerSource(handler) {
|
package/dist/index.d.ts
CHANGED
|
@@ -734,8 +734,6 @@ interface MemoEntry {
|
|
|
734
734
|
* branches can order differently on a later pass, so it is not the key. */
|
|
735
735
|
seq: number;
|
|
736
736
|
stepId: string;
|
|
737
|
-
/** Which call of this `stepId` in the run, from 0. */
|
|
738
|
-
occurrence: number;
|
|
739
737
|
/** Key of the step whose body recorded this, if any; a memoized parent hides it. */
|
|
740
738
|
parent?: string;
|
|
741
739
|
kind: StepKind;
|
|
@@ -747,7 +745,6 @@ interface MemoEntry {
|
|
|
747
745
|
interface StepIntentBase {
|
|
748
746
|
seq: number;
|
|
749
747
|
stepId: string;
|
|
750
|
-
occurrence: number;
|
|
751
748
|
/** Kind-specific detail: sleep `ms`, `waitForEvent` name, approval title. */
|
|
752
749
|
config?: Record<string, unknown>;
|
|
753
750
|
meta?: WorkflowMetadata;
|
|
@@ -761,7 +758,6 @@ type StepIntent = StepIntentBase & ({
|
|
|
761
758
|
interface StepResult<K extends StepKind = StepKind> {
|
|
762
759
|
seq: number;
|
|
763
760
|
stepId: string;
|
|
764
|
-
occurrence: number;
|
|
765
761
|
kind: K;
|
|
766
762
|
meta?: WorkflowMetadata;
|
|
767
763
|
status: "completed" | "failed";
|
|
@@ -788,7 +784,6 @@ interface ReplayOutcome {
|
|
|
788
784
|
interface StepReference {
|
|
789
785
|
kind: "step";
|
|
790
786
|
stepId: string;
|
|
791
|
-
occurrence: number;
|
|
792
787
|
}
|
|
793
788
|
//#endregion
|
|
794
789
|
//#region src/stacks/tanstack/project-auth.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as DURABLE_ID_REQUIRED } from "./durable-ids-Cx341nJQ.js";
|
|
2
|
-
import { C as registerWorkflows, D as hourly, E as daily, O as weekly, S as createWorkflow, T as defineSchedule, t as generateManifests, w as workflowVersions, x as createMiddleware } from "./generate-
|
|
2
|
+
import { C as registerWorkflows, D as hourly, E as daily, O as weekly, S as createWorkflow, T as defineSchedule, t as generateManifests, w as workflowVersions, x as createMiddleware } from "./generate-CDOP4pMi.js";
|
|
3
3
|
import { WorkflowRequestParseError, inMemoryRunStore, parseWorkflowRequest, runWorkflow } from "@tanstack/workflow-core";
|
|
4
4
|
//#region src/stacks/tanstack/sse.ts
|
|
5
5
|
const HEADERS = {
|
|
@@ -127,9 +127,6 @@ async function hashInput(input) {
|
|
|
127
127
|
//#region src/runtime/replay.ts
|
|
128
128
|
/** How long a pass waits for handler work that is not a durable operation. */
|
|
129
129
|
const DEFAULT_SETTLE_MS = 5e3;
|
|
130
|
-
function memoKey(stepId, occurrence) {
|
|
131
|
-
return `${stepId}#${occurrence}`;
|
|
132
|
-
}
|
|
133
130
|
const EXECUTABLE = /* @__PURE__ */ new Set([
|
|
134
131
|
"step",
|
|
135
132
|
"now",
|
|
@@ -169,13 +166,13 @@ async function throughMiddleware(middlewares, ctx, handler) {
|
|
|
169
166
|
}
|
|
170
167
|
async function replay(options) {
|
|
171
168
|
const { workflow, input, runId } = options;
|
|
172
|
-
const byKey = new Map(options.memo.map((entry) => [
|
|
169
|
+
const byKey = new Map(options.memo.map((entry) => [entry.stepId, entry]));
|
|
173
170
|
const allow = options.shouldExecute ?? (() => true);
|
|
174
171
|
const never = new Promise(() => {});
|
|
175
172
|
const pending = [];
|
|
176
173
|
const settled = /* @__PURE__ */ new Map();
|
|
177
174
|
const pass = { stepsSettled: 0 };
|
|
178
|
-
const
|
|
175
|
+
const reached = /* @__PURE__ */ new Set();
|
|
179
176
|
const consumed = /* @__PURE__ */ new Set();
|
|
180
177
|
let lastProgress = Date.now();
|
|
181
178
|
let currentParent;
|
|
@@ -185,13 +182,12 @@ async function replay(options) {
|
|
|
185
182
|
let seq = 0;
|
|
186
183
|
let nonDeterminism;
|
|
187
184
|
function record(entry) {
|
|
188
|
-
settled.set(
|
|
185
|
+
settled.set(entry.stepId, entry);
|
|
189
186
|
lastProgress = Date.now();
|
|
190
187
|
if (entry.kind === "step") pass.stepsSettled += 1;
|
|
191
188
|
const result = {
|
|
192
189
|
seq: entry.seq,
|
|
193
190
|
stepId: entry.stepId,
|
|
194
|
-
occurrence: entry.occurrence,
|
|
195
191
|
kind: entry.kind,
|
|
196
192
|
...entry.meta ? { meta: entry.meta } : {},
|
|
197
193
|
status: entry.status,
|
|
@@ -207,18 +203,16 @@ async function replay(options) {
|
|
|
207
203
|
return never;
|
|
208
204
|
}
|
|
209
205
|
const index = seq++;
|
|
210
|
-
|
|
211
|
-
occurrences.set(stepId, occurrence + 1);
|
|
212
|
-
if (occurrence > 0) {
|
|
206
|
+
if (reached.has(stepId)) {
|
|
213
207
|
nonDeterminism = `id "${stepId}" was reached more than once; every durable operation id must be unique within a workflow`;
|
|
214
208
|
return never;
|
|
215
209
|
}
|
|
216
|
-
|
|
217
|
-
consumed.add(
|
|
218
|
-
const answered = byKey.get(
|
|
210
|
+
reached.add(stepId);
|
|
211
|
+
consumed.add(stepId);
|
|
212
|
+
const answered = byKey.get(stepId) ?? settled.get(stepId);
|
|
219
213
|
if (answered) {
|
|
220
214
|
if (answered.kind !== kind) {
|
|
221
|
-
nonDeterminism = `memo has ${answered.kind} "${stepId}"
|
|
215
|
+
nonDeterminism = `memo has ${answered.kind} "${stepId}", replay produced ${kind}`;
|
|
222
216
|
return never;
|
|
223
217
|
}
|
|
224
218
|
const recordedGroupId = groupId(answered.meta);
|
|
@@ -233,7 +227,6 @@ async function replay(options) {
|
|
|
233
227
|
const intent = {
|
|
234
228
|
seq: index,
|
|
235
229
|
stepId,
|
|
236
|
-
occurrence,
|
|
237
230
|
kind,
|
|
238
231
|
...config ? { config } : {},
|
|
239
232
|
...meta ? { meta } : {}
|
|
@@ -244,7 +237,7 @@ async function replay(options) {
|
|
|
244
237
|
}
|
|
245
238
|
options.onStepStart?.(intent);
|
|
246
239
|
const enclosing = currentParent;
|
|
247
|
-
currentParent =
|
|
240
|
+
currentParent = stepId;
|
|
248
241
|
let body;
|
|
249
242
|
try {
|
|
250
243
|
body = run();
|
|
@@ -255,7 +248,6 @@ async function replay(options) {
|
|
|
255
248
|
record({
|
|
256
249
|
seq: index,
|
|
257
250
|
stepId,
|
|
258
|
-
occurrence,
|
|
259
251
|
kind,
|
|
260
252
|
status: "completed",
|
|
261
253
|
result,
|
|
@@ -267,7 +259,6 @@ async function replay(options) {
|
|
|
267
259
|
record({
|
|
268
260
|
seq: index,
|
|
269
261
|
stepId,
|
|
270
|
-
occurrence,
|
|
271
262
|
kind,
|
|
272
263
|
status: "failed",
|
|
273
264
|
error: describe(error),
|
|
@@ -472,7 +463,7 @@ function resolveWorkflowId(ctx, param) {
|
|
|
472
463
|
}
|
|
473
464
|
function isMemoEntry(value) {
|
|
474
465
|
const entry = value;
|
|
475
|
-
return typeof entry === "object" && entry !== null && Number.isInteger(entry.seq) && entry.seq >= 0 && typeof entry.stepId === "string" && Number.isInteger(entry.seq) &&
|
|
466
|
+
return typeof entry === "object" && entry !== null && Number.isInteger(entry.seq) && entry.seq >= 0 && typeof entry.stepId === "string" && Number.isInteger(entry.seq) && (entry.status === "completed" || entry.status === "failed");
|
|
476
467
|
}
|
|
477
468
|
function parseBody(value) {
|
|
478
469
|
if (value === null || typeof value !== "object") return "body must be a JSON object";
|
|
@@ -480,10 +471,10 @@ function parseBody(value) {
|
|
|
480
471
|
if (body.workflowVersion !== void 0 && typeof body.workflowVersion !== "string") return "workflowVersion must be a string";
|
|
481
472
|
if (body.memo !== void 0) {
|
|
482
473
|
if (!Array.isArray(body.memo) || !body.memo.every(isMemoEntry)) return "memo must be an array of settled step entries";
|
|
483
|
-
if (new Set(body.memo.map((entry) =>
|
|
474
|
+
if (new Set(body.memo.map((entry) => entry.stepId)).size !== body.memo.length) return "memo entries must be unique per stepId";
|
|
484
475
|
}
|
|
485
476
|
if (body.action !== void 0 && body.action !== "advance" && body.action !== "execute") return "action must be \"advance\" or \"execute\"";
|
|
486
|
-
if (body.action === "execute" && !isStepReference(body.step)) return "step must be a { kind: \"step\", stepId
|
|
477
|
+
if (body.action === "execute" && !isStepReference(body.step)) return "step must be a { kind: \"step\", stepId } reference when action is \"execute\"";
|
|
487
478
|
if (body.action !== "execute" && body.step !== void 0) return "step is only valid when action is \"execute\"";
|
|
488
479
|
if (body.memo !== void 0 && body.memo.length > 0 && !("input" in value)) return "input must be sent with every call, including a resume";
|
|
489
480
|
return body;
|
|
@@ -493,12 +484,9 @@ async function readBody(request) {
|
|
|
493
484
|
if (!text.trim()) return {};
|
|
494
485
|
return JSON.parse(text);
|
|
495
486
|
}
|
|
496
|
-
function operationKey(operation) {
|
|
497
|
-
return memoKey(operation.stepId, operation.occurrence);
|
|
498
|
-
}
|
|
499
487
|
function isStepReference(value) {
|
|
500
488
|
const step = value;
|
|
501
|
-
return typeof step === "object" && step !== null && step.kind === "step" && typeof step.stepId === "string"
|
|
489
|
+
return typeof step === "object" && step !== null && step.kind === "step" && typeof step.stepId === "string";
|
|
502
490
|
}
|
|
503
491
|
function disposition(outcome) {
|
|
504
492
|
if (outcome.status === "completed") return "completed";
|
|
@@ -507,8 +495,8 @@ function disposition(outcome) {
|
|
|
507
495
|
return outcome.steps.length > 1 ? "fork" : "advanced";
|
|
508
496
|
}
|
|
509
497
|
function memoDelta(before, after) {
|
|
510
|
-
const existing = new Set(before.map((entry) =>
|
|
511
|
-
return after.filter((entry) => !existing.has(
|
|
498
|
+
const existing = new Set(before.map((entry) => entry.stepId));
|
|
499
|
+
return after.filter((entry) => !existing.has(entry.stepId));
|
|
512
500
|
}
|
|
513
501
|
function respond(runId, inputHash, workflowVersion, before, outcome, executed) {
|
|
514
502
|
const { steps, emitted, output, error } = outcome;
|
|
@@ -654,12 +642,12 @@ function createStepsHandler(collection, options = {}) {
|
|
|
654
642
|
input,
|
|
655
643
|
memo: before,
|
|
656
644
|
runId,
|
|
657
|
-
shouldExecute: (intent) => intent.kind !== "step" ||
|
|
645
|
+
shouldExecute: (intent) => intent.kind !== "step" || intent.stepId === selected.stepId
|
|
658
646
|
}));
|
|
659
|
-
const executed = outcome.results.find((result) => result.kind === "step" &&
|
|
647
|
+
const executed = outcome.results.find((result) => result.kind === "step" && result.stepId === selected.stepId);
|
|
660
648
|
if (executed === void 0 && outcome.status !== "failed") return json(409, {
|
|
661
649
|
error: "stale_step",
|
|
662
|
-
message: `step "${selected.stepId}"
|
|
650
|
+
message: `step "${selected.stepId}" is not executable from this memo`
|
|
663
651
|
});
|
|
664
652
|
return respond(runId, inputHash, workflow.version, before, outcome, executed);
|
|
665
653
|
}
|
|
@@ -677,12 +665,12 @@ function createStepsHandler(collection, options = {}) {
|
|
|
677
665
|
input,
|
|
678
666
|
memo: described.memo,
|
|
679
667
|
runId,
|
|
680
|
-
shouldExecute: (intent) => intent.kind !== "step" ||
|
|
668
|
+
shouldExecute: (intent) => intent.kind !== "step" || intent.stepId === only.stepId
|
|
681
669
|
}));
|
|
682
|
-
const executed = outcome.results.find((result) => result.kind === "step" &&
|
|
670
|
+
const executed = outcome.results.find((result) => result.kind === "step" && result.stepId === only.stepId);
|
|
683
671
|
if (executed === void 0 && outcome.status !== "failed") return json(409, {
|
|
684
672
|
error: "stale_step",
|
|
685
|
-
message: `step "${only.stepId}"
|
|
673
|
+
message: `step "${only.stepId}" is not executable from this memo`
|
|
686
674
|
});
|
|
687
675
|
return respond(runId, inputHash, workflow.version, before, outcome, executed);
|
|
688
676
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadTypeScript, t as workflowHandlerSource } from "./graph-
|
|
1
|
+
import { loadTypeScript, t as workflowHandlerSource } from "./graph-ZthZ8l6y.js";
|
|
2
2
|
//#region src/manifests/step-metadata.ts
|
|
3
3
|
async function findStepMetadataIssues(handler) {
|
|
4
4
|
const api = await loadTypeScript();
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as generateManifests } from "./generate-
|
|
1
|
+
import { t as generateManifests } from "./generate-CDOP4pMi.js";
|
|
2
2
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
3
3
|
import { createServer } from "vite";
|
|
4
4
|
import { lstat, mkdir, mkdtemp, readdir, rename, rm, writeFile } from "node:fs/promises";
|