-
Notifications
You must be signed in to change notification settings - Fork 8
Description
I'm trying to get started with Flowcraft, but the demo code not working is a big impediment. There are multiple issues.
I dropped the sample code from Getting Started into a completely new TS project, and there are immediately compilation errors:
- The primary function
run()is missing a closing brace, on line 45. This was noticed and a PR raised (Fix Import Path Normalization + Getting Started Examples #3) four months ago, but has not been reviewed or fixed. - The code is missing an import for
NodeContext, which is used on lines 4 & 10. - On line 24, the constructor
new FlowRuntime()doesn't match either of the available constructors. It needs to either provide the default container, by importinggetDefaultContainer(), or pass an empty options object. I decided to use the empty object as it seemed simpler.
With these fixed, the code now runs, but it doesn't work properly. There are multiple issues here too.
-
The workflow execution fails with
Implementation for 'fn_7d287648' not found.This is because the workflow runtime requires a function registry, and we are not providing one.- I found two ways to do this:
- via
options.registryin the FlowRuntime constructor, which requires a Record (not a Map), so we need to pass inObject.entries(flow.getFunctionRegistry()) - via
options.functionRegistryinruntime.run()
- via
- I chose b) because I would rather have the flow-based logic passed when running a workflow, rather than when constructing the runtime.
- I found two ways to do this:
-
Now, the functions are running, but the
doublefunction is not getting executed. I get the following output from the demo code, showing that thepause()function (and the overall workflow) is still in an awaiting state.
Workflow Result: {
context: {
value: 42,
"_outputs.start": 42,
"_inputs.pause": 42,
_awaitingNodeIds: [ "pause" ],
_awaitingDetails: {
pause: { reason: "timer", wakeUpAt: "2026-03-25T05:44:55.194Z" }
},
"_outputs.pause": undefined,
"_inputs.double": undefined,
_executionId: "d68cefef-21ac-41b7-b14b-d87b3f7592a6"
},
serializedContext: '{"value":42,"_outputs.start":42,"_inputs.pause":42,"_awaitingNodeIds":["pause"],"_awaitingDetails":{"pause":{"reason":"timer","wakeUpAt":"2026-03-25T05:44:55.194Z"}},"_executionId":"d68cefef-21ac-41b7-b14b-d87b3f7592a6"}',
status: "awaiting",
errors: undefined
}
I have tried to resume the workflow by checking result.status and calling runtime.resume(), but this fails with FlowcraftError: Cannot resume: The provided context is not in an awaiting state.
Any suggestions on how to get this code working? Is this library still being developed and actively used? Why is the demo code not tested?