@lovable.dev/workflows-sdk 0.0.0-dev.3 → 0.0.0-dev.31

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 CHANGED
@@ -1,33 +1,23 @@
1
1
  # @lovable.dev/workflows-sdk
2
2
 
3
- Author workflows with TanStack workflow-core and register them in an explicit
4
- collection for Lovable. This development SDK generates build manifests; execution
5
- and schedule installation on Lovable are not implemented yet.
6
-
7
- Experimental: every release stays in the `0.0.0-dev` series. The API may
8
- change without compatibility guarantees; this SDK is not production-ready.
9
-
10
- ## Authoring
11
-
12
- Use `createWorkflow({ id, input, output }).handler(...)` to define a workflow
13
- and `createMiddleware` to extend its typed context. Both builders come directly
14
- from [`@tanstack/workflow-core`](https://github.com/TanStack/workflow).
15
- Schema validation libraries implementing Standard Schema, such as Zod, provide
16
- input and output inference.
17
-
18
- Keep the app's workflow collection in `src/lib/workflows/index.ts`. Each workflow
19
- lives in `src/lib/workflows/{workflow-name}/index.ts`, with its helpers alongside it:
20
-
21
- ```text
22
- src/lib/workflows/
23
- ├── index.ts
24
- └── greet/
25
- ├── index.ts
26
- └── helpers.ts
3
+ Experimental SDK for authoring workflows in Lovable apps with
4
+ [`@tanstack/workflow-core`](https://github.com/TanStack/workflow). Releases stay
5
+ in the `0.0.0-dev` series and may change without compatibility guarantees.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install @lovable.dev/workflows-sdk
27
11
  ```
28
12
 
29
- Each workflow's `index.ts` exports its definition. The collection entry imports
30
- all workflow definitions and default-exports `registerWorkflows(...)`:
13
+ ## Define workflows
14
+
15
+ Use `createWorkflow({ id, version, input, output }).handler(...)` to define a workflow
16
+ and `createMiddleware` to extend its typed context. Standard Schema libraries
17
+ such as Zod provide input and output inference.
18
+
19
+ Keep definitions under `src/lib/workflows/{workflow-name}/` and default-export
20
+ one collection from `src/lib/workflows/index.ts`:
31
21
 
32
22
  ```ts
33
23
  import { registerWorkflows } from "@lovable.dev/workflows-sdk";
@@ -36,126 +26,145 @@ import { greet } from "./greet";
36
26
  export default registerWorkflows({ workflows: [greet] });
37
27
  ```
38
28
 
39
- The `id` passed to `createWorkflow` is its app-wide unique name and should match
40
- its folder name. Names contain 1–128 lowercase letters, digits, hyphens, or
41
- underscores, starting with a letter or digit. The app collection rejects duplicate
42
- names. An empty collection is valid. Registration copies the list, retains the
43
- definitions, and does not execute handlers or register global state. Treat
44
- definitions as immutable after registration.
29
+ Workflow IDs contain 1–128 lowercase letters, digits, hyphens, or underscores,
30
+ starting with a letter or digit. They must be unique within the collection.
31
+ See the [authoring example](examples/src/lib/workflows/greet/index.ts) for
32
+ schemas, typed middleware, and a durable step.
33
+
34
+ ## Workflow versions
35
+
36
+ Every workflow requires an explicit `version`, including retained definitions.
37
+ Start with `"v1"`; introduce a new label when changing behavior, schemas, or
38
+ relevant helpers. Keep existing version implementations unchanged while runs drain.
39
+ Registration rejects missing, empty, and invalid labels. Existing unversioned
40
+ runs must drain on their original SDK deployment before upgrading.
41
+
42
+ Keep the current definition in `workflows` and attach older definitions with
43
+ `.previousVersions([v1])` before `.handler(...)`. Each definition has the same
44
+ workflow ID and a distinct `version` passed to `createWorkflow`. Versions accept
45
+ 1–128 letters, digits, dots, hyphens, or underscores, starting with a letter or
46
+ digit. The combined manifest filename must fit 255 characters. See the [versioned example](examples/src/lib/workflows/versioned/index.ts).
47
+
48
+ The build emits one manifest per version. The top-level definition has
49
+ `current: true`; retained definitions have `current: false` and no triggers.
50
+ Schedules reference the top-level definition and start its version.
51
+
52
+ Steps responses include `workflowVersion`. Persist it with the run and send it
53
+ on every later request, including an empty memo. A missing version on a
54
+ resume or an unavailable version fails before replay.
55
+
56
+ Keep old definitions and their relevant helpers unchanged until their runs and
57
+ pending execution attempts drain. Removing a definition makes its version
58
+ unavailable; existing runs never switch to the current version automatically.
59
+
60
+ ## Durable operations
61
+
62
+ Every durable operation needs a static, user-facing description:
63
+
64
+ | Operation | Description field |
65
+ | --- | --- |
66
+ | `ctx.step` | Third argument: `meta.description` |
67
+ | `ctx.sleep`, `ctx.sleepUntil` | Second argument: `meta.description` |
68
+ | `ctx.waitForEvent` | Second argument: `meta.description` |
69
+ | `ctx.now`, `ctx.uuid` | First argument: `meta.description` |
70
+ | `ctx.approve` | First argument: `description` |
71
+
72
+ ```ts
73
+ await ctx.step("load-customer", () => loadCustomer(ctx.input.customerId), {
74
+ meta: { description: "Load the customer record" },
75
+ });
76
+ ```
77
+
78
+ Step IDs must be unique within a workflow. Keep side effects inside step bodies;
79
+ handler code outside a step may run more than once. A step body is one atomic
80
+ execution unit and cannot contain another durable operation.
81
+
82
+ Keep durable control flow in the workflow handler. Do not pass, alias,
83
+ destructure, or return `ctx`, and do not detach methods such as `ctx.step`.
84
+ Pass extracted data such as `ctx.input.customerId` to helpers instead.
85
+
86
+ ### Repeated steps
87
+
88
+ A step inside a loop or callback needs `meta.group` with a stable ID and
89
+ user-facing label. Each repeated step still needs its own dynamic ID:
90
+
91
+ ```ts
92
+ ctx.step(`process-${item.id}`, () => processItem(item), {
93
+ meta: { description: "Process an item", group: { id: "process-items", label: "Process items" } },
94
+ });
95
+ ```
96
+
97
+ For dynamic sequential work, await one step directly as the only statement in
98
+ a `for...of` loop. For dynamic parallel work, use a mapped `Promise.all()`.
99
+ Fixed `Promise.all([stepA, stepB])` branches and ordinary sequential steps do
100
+ not need a group.
45
101
 
46
- See [the authoring example](examples/src/lib/workflows/greet/index.ts) for schemas,
47
- typed middleware, and a durable step. The package typecheck includes this example.
102
+ ### Conditional steps
103
+
104
+ Durable operations inside `if` and `else` branches include an outer-to-inner
105
+ `meta.branches` path. Both sides of one condition use the same static ID and
106
+ description:
107
+
108
+ ```ts
109
+ meta: {
110
+ description: "Publish the approved draft",
111
+ branches: [{ id: "editor-approved", description: "The editor approved the draft" }],
112
+ }
113
+ ```
48
114
 
49
115
  ## Schedules
50
116
 
51
- Declare a schedule with `defineSchedule({ id, workflow, cron, timeZone, input })`
52
- and include it in `registerWorkflows({ workflows, schedules })`. `workflow` refers
53
- to the same definition object included in `workflows`; `input` is required and
54
- inferred from that workflow. Multiple schedules can target one workflow.
55
-
56
- Use a five-field cron expression (minute, hour, day, month, weekday) and an IANA
57
- time zone; the default is UTC. Schedule IDs must be unique within the app's
58
- collection. Registration checks field count and time zone; cron syntax and
59
- calendar semantics remain the engine's responsibility. This API declares
60
- schedules but does not install timers or start runs. Periodic intervals,
61
- catch-up, and overlap policies remain follow-ups.
62
-
63
- The [example](examples/src/lib/workflows/index.ts) declares a daily greeting at 09:00 in
64
- Europe/Stockholm with static workflow input.
65
-
66
- ## Manifest generation
67
-
68
- Add `workflowsManifest({ entry: "src/lib/workflows/index.ts" })` from
69
- `@lovable.dev/workflows-sdk/vite` to the app's Vite plugins. The entry must
70
- default-export its `registerWorkflows()` collection. Each production build writes
71
- one manifest per workflow to `.lovable/workflows/{workflow-name}.json` relative
72
- to the app root. For example, `greet` produces `.lovable/workflows/greet.json`.
73
- Generation errors fail the build. See [the Vite example](examples/vite.config.ts).
74
-
75
- Each version-1 manifest contains a single `workflow` with its ID, description,
76
- version, and input/output/state JSON Schemas, a `graph` for visualization, and a
77
- `schedules` array containing only that workflow's schedules and static inputs. It is an SDK discovery format,
78
- not the engine's deployment or execution contract. Handlers and middleware stay
79
- in app code. Schedule IDs and JSON object keys are sorted for stable output.
80
-
81
- The SDK manages the JSON files in `.lovable/workflows/`. Successful generation
82
- removes manifests for deleted or renamed workflows; an empty collection removes
83
- all JSON manifests. Other files and subdirectories are preserved. All definitions
84
- are validated before writing, and each file is replaced by rename so readers
85
- never see a partially written JSON document.
86
-
87
- Schemas must implement [Standard JSON Schema](https://standardschema.dev/json-schema)
88
- conversion to draft 2020-12, as Zod 4 does. Missing conversion support and
89
- conversion errors fail generation. Schedule inputs must be plain JSON and pass
90
- the workflow's input schema; the manifest retains the raw input for validation
91
- when a run starts. Functions, undefined values, non-finite numbers, class
92
- instances, and cycles are rejected. `previousVersions` is rejected until version
93
- routing has a manifest contract.
94
-
95
- The plugin evaluates the entry using a separate Vite SSR loader with the app's
96
- aliases, mode, defines, and SSR dependency rules. Module-level code and schema
97
- validators run during extraction; workflow handlers and middleware do not.
98
- Custom app transform plugins and virtual modules are not loaded by this loader.
99
- For another build system, call `await generateManifests(collection)` and make
100
- synchronizing the returned manifests to `.lovable/workflows/` a required build step.
101
-
102
- ### Step graph
103
-
104
- Each manifest's `graph` contains `nodes` and directed `edges`. The SDK parses the
105
- handler's function source without executing it. No additional registration is needed.
106
-
107
- Graph inference reads the app's own `typescript`, an optional peer. Apps built
108
- from a Lovable template already have it. Without it — or with a copy exposing no
109
- stable JS API, as TypeScript 7 does before 7.1 — the build still succeeds and
110
- every graph carries one `unknown` node and the diagnostic
111
- `Install typescript to infer step graphs`.
112
- Sequential awaited `ctx.step("name", callback)` calls produce order edges;
113
- `await Promise.all([ctx.step(...), ctx.step(...)])` produces parallel branches
114
- that join at the next step. Returned step promises work too. Keep step IDs literal.
115
-
116
- | Field | Meaning |
117
+ Declare schedules with `defineSchedule({ id, workflow, cadence, timeZone,
118
+ input })` and include them in the collection's `triggers`. The workflow must be
119
+ part of the same collection, and schedule IDs must be unique. This API declares
120
+ schedules; Lovable execution is not available yet.
121
+
122
+ ```ts
123
+ const morning = defineSchedule({
124
+ id: "morning-digest", workflow: digest, cadence: daily({ at: [9] }), timeZone: "Europe/Stockholm", input: {},
125
+ });
126
+ ```
127
+
128
+ | Field | Default | Meaning |
129
+ | --- | --- | --- |
130
+ | `cadence` | — | `hourly()`, `daily({ at })`, or `weekly({ on, at })` |
131
+ | `timeZone` | — | Canonical IANA region name |
132
+ | `overlapPolicy` | `"skip"` | `skip`, `allow`, or `buffer-one` |
133
+ | `enabled` | `true` | `false` declares a paused schedule |
134
+
135
+ | Cadence | Example |
136
+ | --- | --- |
137
+ | Hourly | `hourly()` |
138
+ | Selected hours | `daily({ at: [0, 6, 12, 18] })` |
139
+ | Weekly | `weekly({ on: ["mon", "fri"], at: [0, 12] })` |
140
+
141
+ `daily` requires a non-empty `at` list. `weekly` requires non-empty `on` and
142
+ `at` lists and runs at every selected hour on every selected weekday. Hours are
143
+ whole numbers from 0 through 23; schedules do not accept minute or raw-cron
144
+ fields. `timeZone` is required and accepts `"UTC"` or a canonical IANA region
145
+ such as `"America/New_York"`. A scheduled hour is approximate: Lovable chooses
146
+ a stable offset within the corresponding scheduling window.
147
+
148
+ `overlapPolicy` controls what happens when a schedule becomes due while its
149
+ previous run is active. `skip` drops it, `allow` starts another run, and
150
+ `buffer-one` starts the earliest missed run after the active run finishes.
151
+
152
+ ## Build integration
153
+
154
+ Add `workflowsPlugin()` before the TanStack Start plugin. Its `entry` defaults
155
+ to `src/lib/workflows/index.ts` and must default-export the registered
156
+ collection. See [the Vite example](examples/vite.config.ts).
157
+
158
+ ```ts
159
+ plugins: [
160
+ workflowsPlugin(),
161
+ tanstackStart(),
162
+ ];
163
+ ```
164
+
165
+ ## Imports
166
+
167
+ | Import | Provides |
117
168
  | --- | --- |
118
- | `nodes[].id` | Unique occurrence ID within this graph; use as the UI node key |
119
- | `nodes[].kind` | `step` or `unknown` |
120
- | `nodes[].stepId` | Literal step name, present for known steps |
121
- | `nodes[].label` | Step name or explanation of unsupported code |
122
- | `edges[]` | `{ source, target, kind: "order" }`, referencing node IDs |
123
- | `complete` | Whether the handler uses only supported syntax |
124
- | `diagnostics` | Reasons the graph is partial |
125
-
126
- For example, `read` followed by parallel `transform-a` and `transform-b`, then
127
- `save`, produces `read → transform-a → save` and `read → transform-b → save`.
128
- Repeated step names remain separate nodes. Node IDs are deterministic for the
129
- same source, but may change when the handler is edited.
130
-
131
- Graphs have `source: "inferred"` and `scope: "handler"`. They describe source
132
- structure, not run history or data dependencies, and exclude middleware and
133
- initialization. Branches, loops, helper calls, dynamic step IDs, nested steps,
134
- and unawaited steps produce `unknown` nodes and `complete: false`; steps inside
135
- unsupported code are not expanded. The UI should show these unknown nodes and
136
- mark partial graphs. Transforms that rewrite the handler may also produce a
137
- partial graph. A handler with no steps can have an empty graph.
138
-
139
- ## Next PRs
140
-
141
- Connect the manifest and app code to Lovable deployment and runtime execution.
142
- Define support for TanStack primitives, version routing, and schedule policies.
143
-
144
- ## Publishing dev builds
145
-
146
- The [publishing workflow](../../.github/workflows/publish-workflows-sdk.yml)
147
- publishes the version committed in `package.json` to npm's `latest` tag when SDK
148
- changes land on `main`. Manage versions manually: `0.0.0-dev`, `0.0.0-dev.1`,
149
- `0.0.0-dev.2`, and so on. The workflow rejects versions outside this series and
150
- skips versions already published. Manual runs default to a dry run.
151
- See [the setup guide](PUBLISHING.md) for the
152
- one-time bootstrap and npm trusted-publisher configuration.
153
-
154
- Install the newest build with `npm install @lovable.dev/workflows-sdk`, or pin
155
- the exact version shown in the workflow run's summary. `latest` tracks every dev
156
- publish while the SDK is pre-1.0; the older `dev` tag is frozen at `0.0.0-dev.2`.
157
-
158
- The existing internal [`@lovable/workflow-sdk`](../../packages/workflow-sdk)
159
- provides the engine contract. Use [`mcp-js`](../lovable-mcp-js) as the reference
160
- for separating authoring, manifest extraction, and framework integration. The
161
- workflow prototype's `ts/workflow-sdk` supplies adapter and manifest examples.
169
+ | `@lovable.dev/workflows-sdk` | Workflow authoring, registration, cadences, and schedules |
170
+ | `@lovable.dev/workflows-sdk/vite` | Lovable build integration |
@@ -0,0 +1,111 @@
1
+ import { loadTypeScript, t as workflowHandlerSource } from "./graph-CBdqyIz5.js";
2
+ //#region src/manifests/branch-metadata.ts
3
+ const optionsArgument = {
4
+ step: 2,
5
+ approve: 0,
6
+ sleep: 1,
7
+ sleepUntil: 1,
8
+ waitForEvent: 1,
9
+ now: 0,
10
+ uuid: 0
11
+ };
12
+ async function findBranchMetadataIssues(handler) {
13
+ const api = await loadTypeScript();
14
+ if (!api) return [];
15
+ const ts = api;
16
+ const handlerSource = workflowHandlerSource(handler);
17
+ if (!handlerSource) return [];
18
+ const declaration = ts.createSourceFile("handler.js", `const handler = ${handlerSource};`, ts.ScriptTarget.ESNext, true, ts.ScriptKind.JS).statements[0];
19
+ const fn = declaration && ts.isVariableStatement(declaration) ? declaration.declarationList.declarations[0]?.initializer : void 0;
20
+ if (!fn || !ts.isArrowFunction(fn) && !ts.isFunctionExpression(fn)) return [];
21
+ const parameter = fn.parameters[0]?.name;
22
+ if (!parameter || !ts.isIdentifier(parameter)) return [];
23
+ const context = parameter.text;
24
+ function property(node, name) {
25
+ if (!node || !ts.isObjectLiteralExpression(node)) return void 0;
26
+ for (const entry of node.properties) {
27
+ if (!ts.isPropertyAssignment(entry)) continue;
28
+ if ((ts.isIdentifier(entry.name) || ts.isStringLiteral(entry.name) ? entry.name.text : void 0) === name) return entry.initializer;
29
+ }
30
+ }
31
+ function literalString(node) {
32
+ return node && (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) ? node.text : void 0;
33
+ }
34
+ function durableCall(node) {
35
+ if (!ts.isCallExpression(node) || !ts.isPropertyAccessExpression(node.expression) || !ts.isIdentifier(node.expression.expression) || node.expression.expression.text !== context || !(node.expression.name.text in optionsArgument)) return;
36
+ return {
37
+ call: node,
38
+ method: node.expression.name.text
39
+ };
40
+ }
41
+ function branchPath(call, method) {
42
+ const options = call.arguments[optionsArgument[method]];
43
+ const branches = property(property(options, "meta"), "branches");
44
+ if (!branches || !ts.isArrayLiteralExpression(branches)) return void 0;
45
+ const path = [];
46
+ for (const element of branches.elements) {
47
+ if (!ts.isObjectLiteralExpression(element)) return void 0;
48
+ const id = literalString(property(element, "id"));
49
+ const description = literalString(property(element, "description"));
50
+ if (id === void 0 || description === void 0) return void 0;
51
+ path.push({
52
+ id,
53
+ description
54
+ });
55
+ }
56
+ return path;
57
+ }
58
+ const issues = [];
59
+ const metadataByBranch = /* @__PURE__ */ new Map();
60
+ const branchById = /* @__PURE__ */ new Map();
61
+ function visit(node, branches) {
62
+ if (issues.length > 0) return;
63
+ if (ts.isIfStatement(node)) {
64
+ visit(node.expression, branches);
65
+ visit(node.thenStatement, [...branches, node]);
66
+ if (node.elseStatement) visit(node.elseStatement, [...branches, node]);
67
+ return;
68
+ }
69
+ const durable = durableCall(node);
70
+ if (durable) {
71
+ const path = branchPath(durable.call, durable.method);
72
+ const stepId = durable.method === "step" ? literalString(durable.call.arguments[0]) : void 0;
73
+ if (branches.length === 0 && path !== void 0 || branches.length > 0 && (path === void 0 || path.length !== branches.length)) {
74
+ issues.push({
75
+ kind: "path",
76
+ method: durable.method,
77
+ ...stepId === void 0 ? {} : { stepId }
78
+ });
79
+ return;
80
+ }
81
+ for (let index = 0; index < branches.length; index++) {
82
+ const branch = branches[index];
83
+ const entry = path?.[index];
84
+ if (!branch || !entry) continue;
85
+ const existing = metadataByBranch.get(branch);
86
+ if (existing && (existing.id !== entry.id || existing.description !== entry.description)) {
87
+ issues.push({
88
+ kind: "inconsistent",
89
+ branchId: existing.id
90
+ });
91
+ return;
92
+ }
93
+ const existingNode = branchById.get(entry.id);
94
+ if (existingNode && existingNode !== branch) {
95
+ issues.push({
96
+ kind: "duplicate-id",
97
+ branchId: entry.id
98
+ });
99
+ return;
100
+ }
101
+ metadataByBranch.set(branch, entry);
102
+ branchById.set(entry.id, branch);
103
+ }
104
+ }
105
+ ts.forEachChild(node, (child) => visit(child, branches));
106
+ }
107
+ visit(fn, []);
108
+ return issues;
109
+ }
110
+ //#endregion
111
+ export { findBranchMetadataIssues };
@@ -0,0 +1,78 @@
1
+ import { loadTypeScript, t as workflowHandlerSource } from "./graph-CBdqyIz5.js";
2
+ //#region src/manifests/context-escapes.ts
3
+ const durableMethods = /* @__PURE__ */ new Set([
4
+ "step",
5
+ "approve",
6
+ "waitForEvent",
7
+ "sleep",
8
+ "sleepUntil",
9
+ "now",
10
+ "uuid"
11
+ ]);
12
+ async function findWorkflowContextEscapes(handler) {
13
+ const api = await loadTypeScript();
14
+ if (!api) return [];
15
+ const ts = api;
16
+ const handlerSource = workflowHandlerSource(handler);
17
+ if (!handlerSource) return [];
18
+ const declaration = ts.createSourceFile("handler.js", `const handler = ${handlerSource};`, ts.ScriptTarget.ESNext, true, ts.ScriptKind.JS).statements[0];
19
+ const fn = declaration && ts.isVariableStatement(declaration) ? declaration.declarationList.declarations[0]?.initializer : void 0;
20
+ if (!fn || !ts.isArrowFunction(fn) && !ts.isFunctionExpression(fn)) return [];
21
+ const parameter = fn.parameters[0]?.name;
22
+ if (!parameter) return [];
23
+ if (!ts.isIdentifier(parameter)) return [{ kind: "destructured" }];
24
+ const context = parameter.text;
25
+ function bindingContains(node, name) {
26
+ if (ts.isIdentifier(node)) return node.text === name;
27
+ return node.elements.some((element) => !ts.isOmittedExpression(element) && bindingContains(element.name, name));
28
+ }
29
+ function contextMethod(node) {
30
+ if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === context) return node.name.text;
31
+ if (ts.isElementAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === context && node.argumentExpression && (ts.isStringLiteral(node.argumentExpression) || ts.isNoSubstitutionTemplateLiteral(node.argumentExpression))) return node.argumentExpression.text;
32
+ }
33
+ function directCallTarget(node) {
34
+ let target = node;
35
+ while (ts.isParenthesizedExpression(target.parent)) target = target.parent;
36
+ return ts.isCallExpression(target.parent) && target.parent.expression === target;
37
+ }
38
+ function identifierIsValue(node) {
39
+ const parent = node.parent;
40
+ if (parent.name === node && !ts.isShorthandPropertyAssignment(parent)) return false;
41
+ return parent.label !== node;
42
+ }
43
+ const escapes = [];
44
+ const visit = (node, shadowed) => {
45
+ if (escapes.length > 0) return;
46
+ if (node !== fn && ts.isFunctionLike(node)) {
47
+ const hidesContext = node.parameters.some((item) => bindingContains(item.name, context));
48
+ ts.forEachChild(node, (child) => visit(child, shadowed || hidesContext));
49
+ return;
50
+ }
51
+ if (!shadowed) {
52
+ const method = contextMethod(node);
53
+ if (method && durableMethods.has(method) && !directCallTarget(node)) {
54
+ escapes.push({
55
+ kind: "method",
56
+ context,
57
+ method
58
+ });
59
+ return;
60
+ }
61
+ if (ts.isIdentifier(node) && node.text === context && identifierIsValue(node)) {
62
+ const parent = node.parent;
63
+ if (!(ts.isPropertyAccessExpression(parent) && parent.expression === node || ts.isElementAccessExpression(parent) && parent.expression === node && parent.argumentExpression && (ts.isStringLiteral(parent.argumentExpression) || ts.isNoSubstitutionTemplateLiteral(parent.argumentExpression)))) {
64
+ escapes.push({
65
+ kind: "context",
66
+ context
67
+ });
68
+ return;
69
+ }
70
+ }
71
+ }
72
+ ts.forEachChild(node, (child) => visit(child, shadowed));
73
+ };
74
+ visit(fn, false);
75
+ return escapes;
76
+ }
77
+ //#endregion
78
+ export { findWorkflowContextEscapes };