Add custom step extension API, bump to 1.1.0#34
Merged
Conversation
Public registerStepType() lets host applications add domain-specific step
types alongside built-ins (ai, code, http, …) without forking. Custom
steps participate in the same do: dispatch and validation as native types.
- StepRegistry with register/get/has/names/clear; module-level defaultRegistry
- registerStepType({ name, allowedKeys, validate?, run }) + collision/duplicate guards
- ctx: frozen state, env, prefixed logger, per-flow AbortSignal, nodeName, resolveTemplate
- Pre-resolves {{ template }} fields like do: http
- Validator errors share the native { node, field, message } shape
- PluginConfig.customSteps for test isolation / multi-runner cases
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Public extension API:
registerStepType()lets host applications add domain-specific step types (e.g. signed callouts to internal APIs) alongside built-ins without forking. Custom steps participate in the samedo:dispatch, validation, and trace pipeline as native types.What's new
StepRegistry—register/get/has/names/clear; module-leveldefaultRegistryregisterStepType({ name, allowedKeys, validate?, run })— collision with built-ins and duplicate registration throw at register timeCustomStepContext— frozenstate,env, prefixedlogger, per-flowAbortSignal,nodeName,resolveTemplate(){{ template }}strings in input fields, mirroringdo: http{ node, field, message }shape — indistinguishable from built-in validationPluginConfig.customSteps— pass a private registry for test isolation or multi-runner scenariosDesign notes
(input) => { ok, errors }— plugin authors wrap Zod/Ajv if they want.AbortSignalis wired to a per-flow controller now; flow-level cancel can callabort()later without API change.retryhelper onctx— node-levelretry:already covers this.registerStepType()writes to a singleton; opt out viacfg.customSteps.Public API
Flow JSON unchanged:
{ "do": "clawnify_app", "name": "...", "app_id": "..." }.Test plan
npm run lint— cleannpm test— 128 tests pass (11 new + 117 existing)Release
Merging this PR + cutting a
v1.1.0GitHub release will auto-publish to npm.