@lovable.dev/workflows-sdk 0.0.0-dev.58 → 0.0.0-dev.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/{branch-metadata-DR6L1610.js → branch-metadata-D1b9OmsG.js} +1 -1
- package/dist/{context-escapes-DhO7d5UB.js → context-escapes-CcYvmmKH.js} +1 -1
- package/dist/{duplicate-ids-C3J0tTFi.js → duplicate-ids-BZhMnS7n.js} +1 -1
- package/dist/{generate-sHCzFBzN.js → generate-DI9qaUrI.js} +9 -9
- package/dist/{graph-DNM6HACw.js → graph-CwRl2SGh.js} +1 -1
- package/dist/index.js +14 -4
- package/dist/{nested-operations-DroMYJeg.js → nested-operations-CoaLLZl0.js} +1 -1
- package/dist/{operation-descriptions-CA9zrZ3y.js → operation-descriptions-DlYyD27h.js} +1 -1
- package/dist/{step-metadata-BsrM_6XU.js → step-metadata-CCsEws4V.js} +1 -1
- package/dist/vite.js +1 -1
- package/dist/{wait-deadlines-9IpZV-qZ.js → wait-deadlines-CCgWwxqQ.js} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,9 +53,10 @@ Steps responses include `workflowVersion`. Persist it with the run and send it
|
|
|
53
53
|
on every later request, including an empty memo. A missing version on a
|
|
54
54
|
resume or an unavailable version fails before replay.
|
|
55
55
|
|
|
56
|
-
Keep old
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
Keep an old definition and its relevant helpers unchanged while the published
|
|
57
|
+
app still uses that version: it is the published version, or it has open runs.
|
|
58
|
+
Remove them after that. Removing a definition makes its version unavailable;
|
|
59
|
+
existing runs never switch to the current version automatically.
|
|
59
60
|
|
|
60
61
|
## Durable operations
|
|
61
62
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadTypeScript, t as workflowHandlerSource } from "./graph-
|
|
1
|
+
import { loadTypeScript, t as workflowHandlerSource } from "./graph-CwRl2SGh.js";
|
|
2
2
|
//#region src/manifests/duplicate-ids.ts
|
|
3
3
|
/** Where an explicit `{ id }` would sit for each operation. */
|
|
4
4
|
const optionsArgument = {
|
|
@@ -6644,7 +6644,7 @@ function listValueFromJson(listValue, json) {
|
|
|
6644
6644
|
}
|
|
6645
6645
|
//#endregion
|
|
6646
6646
|
//#region package.json
|
|
6647
|
-
var version = "0.0.0-dev.
|
|
6647
|
+
var version = "0.0.0-dev.59";
|
|
6648
6648
|
//#endregion
|
|
6649
6649
|
//#region src/proto/lovable/appworkflows/v1/workflow_manifest_pb.ts
|
|
6650
6650
|
/**
|
|
@@ -6866,15 +6866,15 @@ function serializeSchema(schema, direction, label) {
|
|
|
6866
6866
|
}
|
|
6867
6867
|
}
|
|
6868
6868
|
async function generateManifests(definition, options = {}) {
|
|
6869
|
-
const { extractWorkflowGraph } = await import("./graph-
|
|
6870
|
-
const { findBranchMetadataIssues } = await import("./branch-metadata-
|
|
6871
|
-
const { findWorkflowContextEscapes } = await import("./context-escapes-
|
|
6872
|
-
const { findDuplicateOperationIds } = await import("./duplicate-ids-
|
|
6869
|
+
const { extractWorkflowGraph } = await import("./graph-CwRl2SGh.js");
|
|
6870
|
+
const { findBranchMetadataIssues } = await import("./branch-metadata-D1b9OmsG.js");
|
|
6871
|
+
const { findWorkflowContextEscapes } = await import("./context-escapes-CcYvmmKH.js");
|
|
6872
|
+
const { findDuplicateOperationIds } = await import("./duplicate-ids-BZhMnS7n.js");
|
|
6873
6873
|
const { DURABLE_ID_REQUIRED } = await import("./durable-ids-Cx341nJQ.js").then((n) => n.n);
|
|
6874
|
-
const { findNestedDurableOperations } = await import("./nested-operations-
|
|
6875
|
-
const { findOperationDescriptionIssues } = await import("./operation-descriptions-
|
|
6876
|
-
const { findStepMetadataIssues } = await import("./step-metadata-
|
|
6877
|
-
const { findWaitDeadlineIssues } = await import("./wait-deadlines-
|
|
6874
|
+
const { findNestedDurableOperations } = await import("./nested-operations-CoaLLZl0.js");
|
|
6875
|
+
const { findOperationDescriptionIssues } = await import("./operation-descriptions-DlYyD27h.js");
|
|
6876
|
+
const { findStepMetadataIssues } = await import("./step-metadata-CCsEws4V.js");
|
|
6877
|
+
const { findWaitDeadlineIssues } = await import("./wait-deadlines-CCgWwxqQ.js");
|
|
6878
6878
|
const { WAIT_DEADLINE_REQUIRED } = await import("./wait-deadlines-DpK-Fgnd.js");
|
|
6879
6879
|
const collection = registerWorkflows(definition);
|
|
6880
6880
|
const manifests = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as WorkflowManifestWaitForEventNodeV1Schema, S as WorkflowManifestUuidNodeV1Schema, _ as WorkflowManifestSleepNodeV1Schema, a as WorkflowManifestConnectorNodeV1Schema, b as WorkflowManifestStepNodeV1Schema, c as WorkflowManifestGraphV1Schema, d as WorkflowManifestNowNodeV1Schema, f as WorkflowManifestOrderEdgeV1Schema, g as WorkflowManifestRepeatedStepV1Schema, h as WorkflowManifestRepeatedLlmV1Schema, i as WorkflowManifestBranchNodeV1Schema, l as WorkflowManifestLlmNodeV1Schema, m as WorkflowManifestRepeatedConnectorV1Schema, n as WorkflowManifestApproveNodeV1Schema, o as WorkflowManifestGraphEdgeV1Schema, p as WorkflowManifestParallelNodeV1Schema, r as WorkflowManifestBranchEdgeV1Schema, s as WorkflowManifestGraphNodeV1Schema, u as WorkflowManifestLoopNodeV1Schema, v as WorkflowManifestSleepUntilNodeV1Schema, w as create, x as WorkflowManifestUnknownNodeV1Schema, y as WorkflowManifestStepExecutionPolicyV1Schema } from "./generate-
|
|
1
|
+
import { C as WorkflowManifestWaitForEventNodeV1Schema, S as WorkflowManifestUuidNodeV1Schema, _ as WorkflowManifestSleepNodeV1Schema, a as WorkflowManifestConnectorNodeV1Schema, b as WorkflowManifestStepNodeV1Schema, c as WorkflowManifestGraphV1Schema, d as WorkflowManifestNowNodeV1Schema, f as WorkflowManifestOrderEdgeV1Schema, g as WorkflowManifestRepeatedStepV1Schema, h as WorkflowManifestRepeatedLlmV1Schema, i as WorkflowManifestBranchNodeV1Schema, l as WorkflowManifestLlmNodeV1Schema, m as WorkflowManifestRepeatedConnectorV1Schema, n as WorkflowManifestApproveNodeV1Schema, o as WorkflowManifestGraphEdgeV1Schema, p as WorkflowManifestParallelNodeV1Schema, r as WorkflowManifestBranchEdgeV1Schema, s as WorkflowManifestGraphNodeV1Schema, u as WorkflowManifestLoopNodeV1Schema, v as WorkflowManifestSleepUntilNodeV1Schema, w as create, x as WorkflowManifestUnknownNodeV1Schema, y as WorkflowManifestStepExecutionPolicyV1Schema } from "./generate-DI9qaUrI.js";
|
|
2
2
|
import { n as assertLlmOptions, t as assertLlmModel } from "./llm-validation-DdDO6csU.js";
|
|
3
3
|
//#region src/manifests/handler-source.ts
|
|
4
4
|
const nativeFunctionSource = /\{\s*\[native code\]\s*\}\s*$/;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as DURABLE_ID_REQUIRED } from "./durable-ids-Cx341nJQ.js";
|
|
2
|
-
import { A as daily, D as registerWorkflows, E as createWorkflow, M as hourly, N as weekly, O as workflowVersions, P as WORKFLOW_ID_PATTERN, T as createMiddleware, j as every, k as defineSchedule, t as generateManifests } from "./generate-
|
|
2
|
+
import { A as daily, D as registerWorkflows, E as createWorkflow, M as hourly, N as weekly, O as workflowVersions, P as WORKFLOW_ID_PATTERN, T as createMiddleware, j as every, k as defineSchedule, t as generateManifests } from "./generate-DI9qaUrI.js";
|
|
3
3
|
import { n as assertLlmOptions, r as assertLlmRequest } from "./llm-validation-DdDO6csU.js";
|
|
4
4
|
import { WorkflowRequestParseError, inMemoryRunStore, parseWorkflowRequest, runWorkflow } from "@tanstack/workflow-core";
|
|
5
5
|
import { generateChatCompletion, generateMessage } from "@lovable.dev/ai-gateway";
|
|
@@ -299,6 +299,7 @@ async function throughMiddleware(middlewares, ctx, handler) {
|
|
|
299
299
|
}
|
|
300
300
|
async function replay(options) {
|
|
301
301
|
const { workflow, input, runId } = options;
|
|
302
|
+
const attempt = options.attempt ?? 1;
|
|
302
303
|
const byKey = new Map(options.memo.map((entry) => [entry.stepId, entry]));
|
|
303
304
|
const allow = options.shouldExecute ?? (() => true);
|
|
304
305
|
const settled = /* @__PURE__ */ new Map();
|
|
@@ -386,7 +387,7 @@ async function replay(options) {
|
|
|
386
387
|
return durable("connector", id, async () => {
|
|
387
388
|
const result = await callback({
|
|
388
389
|
id,
|
|
389
|
-
attempt
|
|
390
|
+
attempt,
|
|
390
391
|
runtime,
|
|
391
392
|
signal
|
|
392
393
|
});
|
|
@@ -418,7 +419,7 @@ async function replay(options) {
|
|
|
418
419
|
llm,
|
|
419
420
|
step: (id, fn, stepOptions) => durable("step", id, async () => fn({
|
|
420
421
|
id,
|
|
421
|
-
attempt
|
|
422
|
+
attempt,
|
|
422
423
|
runtime,
|
|
423
424
|
signal
|
|
424
425
|
}), void 0, stepOptions?.meta),
|
|
@@ -617,6 +618,11 @@ function stepsResponse(runId, inputHash, workflowVersion, before, outcome, execu
|
|
|
617
618
|
}
|
|
618
619
|
//#endregion
|
|
619
620
|
//#region src/stacks/tanstack/steps.ts
|
|
621
|
+
const ATTEMPT_HEADER = "x-lovable-workflow-attempt";
|
|
622
|
+
function attemptOf(request) {
|
|
623
|
+
const attempt = Number(request.headers.get(ATTEMPT_HEADER));
|
|
624
|
+
return Number.isInteger(attempt) && attempt > 0 ? attempt : 1;
|
|
625
|
+
}
|
|
620
626
|
function json(status, body) {
|
|
621
627
|
return new Response(JSON.stringify(body), {
|
|
622
628
|
status,
|
|
@@ -789,6 +795,7 @@ function createStepsHandler(collection, options = {}) {
|
|
|
789
795
|
if (resolved instanceof Response) return resolved;
|
|
790
796
|
const { workflow, body, input, runId, inputHash } = resolved;
|
|
791
797
|
const before = body.memo ?? [];
|
|
798
|
+
const attempt = attemptOf(ctx.request);
|
|
792
799
|
if (body.action === "execute") {
|
|
793
800
|
const selected = body.step;
|
|
794
801
|
const outcome = await validateOutput(workflow, await replay({
|
|
@@ -797,6 +804,7 @@ function createStepsHandler(collection, options = {}) {
|
|
|
797
804
|
memo: before,
|
|
798
805
|
runId,
|
|
799
806
|
signal: ctx.request.signal,
|
|
807
|
+
attempt,
|
|
800
808
|
shouldExecute: (intent) => !isRunnableKind(intent.kind) || intent.kind === selected.kind && intent.stepId === selected.stepId
|
|
801
809
|
}));
|
|
802
810
|
const executed = outcome.results.find((result) => result.kind === selected.kind && result.stepId === selected.stepId);
|
|
@@ -812,6 +820,7 @@ function createStepsHandler(collection, options = {}) {
|
|
|
812
820
|
memo: before,
|
|
813
821
|
runId,
|
|
814
822
|
signal: ctx.request.signal,
|
|
823
|
+
attempt,
|
|
815
824
|
shouldExecute: (intent) => !isRunnableKind(intent.kind)
|
|
816
825
|
}));
|
|
817
826
|
const only = described.steps.length === 1 ? described.steps[0] : void 0;
|
|
@@ -822,6 +831,7 @@ function createStepsHandler(collection, options = {}) {
|
|
|
822
831
|
memo: described.memo,
|
|
823
832
|
runId,
|
|
824
833
|
signal: ctx.request.signal,
|
|
834
|
+
attempt,
|
|
825
835
|
shouldExecute: (intent) => !isRunnableKind(intent.kind) || intent.kind === only.kind && intent.stepId === only.stepId
|
|
826
836
|
}));
|
|
827
837
|
const executed = outcome.results.find((result) => result.kind === only.kind && result.stepId === only.stepId);
|
|
@@ -1113,7 +1123,7 @@ async function send(request) {
|
|
|
1113
1123
|
const headers = new Headers(request.headers);
|
|
1114
1124
|
headers.set("Authorization", `Bearer ${connection.apiKey}`);
|
|
1115
1125
|
headers.set("Accept", "application/json");
|
|
1116
|
-
headers.set("User-Agent", `lovable-workflows-sdk/0.0.0-dev.
|
|
1126
|
+
headers.set("User-Agent", `lovable-workflows-sdk/0.0.0-dev.59`);
|
|
1117
1127
|
if (request.body !== void 0) headers.set("Content-Type", "application/json");
|
|
1118
1128
|
let response;
|
|
1119
1129
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadTypeScript, t as workflowHandlerSource } from "./graph-
|
|
1
|
+
import { loadTypeScript, t as workflowHandlerSource } from "./graph-CwRl2SGh.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-DI9qaUrI.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";
|