-
Notifications
You must be signed in to change notification settings - Fork 263
Fix step functions nested multiple levels deep in an object #923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
TooTallNate
merged 4 commits into
main
from
02-03-fix_step_functions_nested_multiple_levels_deep_in_an_object
Feb 7, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f582ce8
Fix step functions nested multiple levels deep in an object
TooTallNate c1ebb03
Fix tests and add another unit test with deeper nesting
TooTallNate 7e45ef7
Add fixture test for shorthand method step functions in nested objects
TooTallNate 8cee6a5
.
TooTallNate File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@workflow/swc-plugin": patch | ||
| --- | ||
|
|
||
| Fix step functions nested multiple levels deep in an object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
...wc-plugin-workflow/transform/tests/fixture/agent-with-tool-step-shorthand-method/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { agent } from "experimental-agent"; | ||
|
|
||
| export const vade = agent({ | ||
| tools: { | ||
| VercelRequest: { | ||
| async execute(input, { experimental_context }) { | ||
| "use step"; | ||
| return 1+1 | ||
| }, | ||
| }, | ||
| }, | ||
| }); |
10 changes: 10 additions & 0 deletions
10
...n-workflow/transform/tests/fixture/agent-with-tool-step-shorthand-method/output-client.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { agent } from "experimental-agent"; | ||
| export const vade = agent({ | ||
| tools: { | ||
| VercelRequest: { | ||
| async execute (input, { experimental_context }) { | ||
| return 1 + 1; | ||
| } | ||
| } | ||
| } | ||
| }); |
14 changes: 14 additions & 0 deletions
14
...gin-workflow/transform/tests/fixture/agent-with-tool-step-shorthand-method/output-step.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { registerStepFunction } from "workflow/internal/private"; | ||
| import { agent } from "experimental-agent"; | ||
| /**__internal_workflows{"steps":{"input.js":{"vade/tools/VercelRequest/execute":{"stepId":"step//./input//vade/tools/VercelRequest/execute"}}}}*/; | ||
| var vade$tools$VercelRequest$execute = async function(input, { experimental_context }) { | ||
| return 1 + 1; | ||
| }; | ||
| export const vade = agent({ | ||
| tools: { | ||
| VercelRequest: { | ||
| execute: vade$tools$VercelRequest$execute | ||
| } | ||
| } | ||
| }); | ||
| registerStepFunction("step//./input//vade/tools/VercelRequest/execute", vade$tools$VercelRequest$execute); |
9 changes: 9 additions & 0 deletions
9
...workflow/transform/tests/fixture/agent-with-tool-step-shorthand-method/output-workflow.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { agent } from "experimental-agent"; | ||
| /**__internal_workflows{"steps":{"input.js":{"vade/tools/VercelRequest/execute":{"stepId":"step//./input//vade/tools/VercelRequest/execute"}}}}*/; | ||
| export const vade = agent({ | ||
| tools: { | ||
| VercelRequest: { | ||
| execute: globalThis[Symbol.for("WORKFLOW_USE_STEP")]("step//./input//vade/tools/VercelRequest/execute") | ||
| } | ||
| } | ||
| }); |
12 changes: 12 additions & 0 deletions
12
packages/swc-plugin-workflow/transform/tests/fixture/agent-with-tool-step/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { agent } from "experimental-agent"; | ||
|
|
||
| export const vade = agent({ | ||
| tools: { | ||
| VercelRequest: { | ||
| execute: async (input, { experimental_context }) => { | ||
| "use step"; | ||
| return 1+1 | ||
| }, | ||
| }, | ||
| }, | ||
| }); |
10 changes: 10 additions & 0 deletions
10
packages/swc-plugin-workflow/transform/tests/fixture/agent-with-tool-step/output-client.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { agent } from "experimental-agent"; | ||
| export const vade = agent({ | ||
| tools: { | ||
| VercelRequest: { | ||
| execute: async (input, { experimental_context })=>{ | ||
| return 1 + 1; | ||
| } | ||
| } | ||
| } | ||
| }); | ||
14 changes: 14 additions & 0 deletions
14
packages/swc-plugin-workflow/transform/tests/fixture/agent-with-tool-step/output-step.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { registerStepFunction } from "workflow/internal/private"; | ||
| import { agent } from "experimental-agent"; | ||
| /**__internal_workflows{"steps":{"input.js":{"vade/tools/VercelRequest/execute":{"stepId":"step//./input//vade/tools/VercelRequest/execute"}}}}*/; | ||
| var vade$tools$VercelRequest$execute = async function(input, { experimental_context }) { | ||
| return 1 + 1; | ||
| }; | ||
| export const vade = agent({ | ||
| tools: { | ||
| VercelRequest: { | ||
| execute: vade$tools$VercelRequest$execute | ||
| } | ||
| } | ||
| }); | ||
| registerStepFunction("step//./input//vade/tools/VercelRequest/execute", vade$tools$VercelRequest$execute); |
9 changes: 9 additions & 0 deletions
9
packages/swc-plugin-workflow/transform/tests/fixture/agent-with-tool-step/output-workflow.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { agent } from "experimental-agent"; | ||
| /**__internal_workflows{"steps":{"input.js":{"vade/tools/VercelRequest/execute":{"stepId":"step//./input//vade/tools/VercelRequest/execute"}}}}*/; | ||
| export const vade = agent({ | ||
| tools: { | ||
| VercelRequest: { | ||
| execute: globalThis[Symbol.for("WORKFLOW_USE_STEP")]("step//./input//vade/tools/VercelRequest/execute") | ||
| } | ||
| } | ||
| }); |
15 changes: 15 additions & 0 deletions
15
packages/swc-plugin-workflow/transform/tests/fixture/deeply-nested-step/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { createConfig } from "some-library"; | ||
|
|
||
| // Test deeply nested step functions (4 levels deep) | ||
| export const config = createConfig({ | ||
| level1: { | ||
| level2: { | ||
| level3: { | ||
| myStep: async (input) => { | ||
| "use step"; | ||
| return input * 2; | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }); |
13 changes: 13 additions & 0 deletions
13
packages/swc-plugin-workflow/transform/tests/fixture/deeply-nested-step/output-client.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { createConfig } from "some-library"; | ||
| // Test deeply nested step functions (4 levels deep) | ||
| export const config = createConfig({ | ||
| level1: { | ||
| level2: { | ||
| level3: { | ||
| myStep: async (input)=>{ | ||
| return input * 2; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }); |
17 changes: 17 additions & 0 deletions
17
packages/swc-plugin-workflow/transform/tests/fixture/deeply-nested-step/output-step.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { registerStepFunction } from "workflow/internal/private"; | ||
| import { createConfig } from "some-library"; | ||
| /**__internal_workflows{"steps":{"input.js":{"config/level1/level2/level3/myStep":{"stepId":"step//./input//config/level1/level2/level3/myStep"}}}}*/; | ||
| var config$level1$level2$level3$myStep = async function(input) { | ||
| return input * 2; | ||
| }; | ||
| // Test deeply nested step functions (4 levels deep) | ||
| export const config = createConfig({ | ||
| level1: { | ||
| level2: { | ||
| level3: { | ||
| myStep: config$level1$level2$level3$myStep | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| registerStepFunction("step//./input//config/level1/level2/level3/myStep", config$level1$level2$level3$myStep); |
12 changes: 12 additions & 0 deletions
12
packages/swc-plugin-workflow/transform/tests/fixture/deeply-nested-step/output-workflow.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { createConfig } from "some-library"; | ||
| /**__internal_workflows{"steps":{"input.js":{"config/level1/level2/level3/myStep":{"stepId":"step//./input//config/level1/level2/level3/myStep"}}}}*/; | ||
| // Test deeply nested step functions (4 levels deep) | ||
| export const config = createConfig({ | ||
| level1: { | ||
| level2: { | ||
| level3: { | ||
| myStep: globalThis[Symbol.for("WORKFLOW_USE_STEP")]("step//./input//config/level1/level2/level3/myStep") | ||
| } | ||
| } | ||
| } | ||
| }); |
2 changes: 1 addition & 1 deletion
2
packages/swc-plugin-workflow/transform/tests/fixture/factory-with-step-method/output-step.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interestingly I guess the function body doesn't actually matter in client mode?
since it won't be called here
but I guess it's okay to just leave it as is?