feat(plugins): add builder action nodes for common script patterns - #2364
Draft
joelorzet wants to merge 2 commits into
Draft
feat(plugins): add builder action nodes for common script patterns#2364joelorzet wants to merge 2 commits into
joelorzet wants to merge 2 commits into
Conversation
Adds a Data plugin and two Math actions covering data-shaping work that previously had to be copy-pasted into Code nodes across workflows. Data plugin: - Encode / Decode: text to padded hex (bytes8/16/32), raw hex or base64, and back. Takes a single value or a JSON array, returns a lookup map keyed by the original value. Format-agnostic rather than bytes32-only. - Extract Fields: pick named values out of upstream output by dotted path, returning null on a missing path instead of aborting the run. Supports combining several upstream nodes through one JSON source and mapping the same paths over an array. - Flatten Findings: merge several monitoring results into one labelled findings list with per-source severity, plus count, first hash and an alert-ready summary. - Static Config: hold static JSON on the canvas without a script wrapper. Math plugin: - Compare With Tolerance: actual against expected with a percentage or absolute tolerance. Fixed-point BigInt arithmetic throughout, so RAD and WAD magnitude values compare without float precision loss. - Format Number: scale token decimals and render compact K/M/B/T or grouped plain notation with an optional unit. HTTP Request node gains retryAttempts and retryDelay. Retries connection errors, timeouts and 408/425/429/5xx with linear backoff; a blocked URL, a malformed URL and other 4xx are never retried. perform.ts is restructured around an attempt-outcome union so the loop separates transient from fatal failures without re-parsing error strings.
| export async function extractFieldsStep( | ||
| input: ExtractFieldsInput | ||
| ): Promise<ExtractFieldsResult> { | ||
| "use step"; |
| export async function staticConfigStep( | ||
| input: StaticConfigInput | ||
| ): Promise<StaticConfigResult> { | ||
| "use step"; |
| } | ||
|
|
||
| export async function encodeStep(input: EncodeInput): Promise<EncodeResult> { | ||
| "use step"; |
| export async function flattenFindingsStep( | ||
| input: FlattenFindingsInput | ||
| ): Promise<FlattenFindingsResult> { | ||
| "use step"; |
| export async function compareToleranceStep( | ||
| input: CompareToleranceInput | ||
| ): Promise<CompareToleranceResult> { | ||
| "use step"; |
| export async function formatNumberStep( | ||
| input: FormatNumberInput | ||
| ): Promise<FormatNumberResult> { | ||
| "use step"; |
itemsFromObject had two branches returning the same value; collapse to one with a comment on why an unrecognised object is itself the finding. The fatal attempt outcome declared an optional status that was never set, so toResult passed status: undefined where the pre-retry code passed no status key at all. Remove the field.
Contributor
PR Environment DeployedYour PR environment has been deployed! Environment Details:
Components:
The environment will be automatically cleaned up when this PR is closed or merged. |
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.
Adds a
dataplugin and twomathactions covering data-shaping work that today gets copy-pasted into Code nodes, plus retry support on the HTTP Request node.Data plugin (new)
Category "Data", no credentials,
egress: "none".data/encode"Encode / Decode"Text to padded hex or base64 and back. Kept format-agnostic rather than bytes32-only.
operationencode(default) /decodevalueformatbytes32/bytes16/bytes8/hex(unpadded) /base64paddingright(default, Solidity string) /left; fixed sizes onlyOutputs
result(string for one input, array for an array),mapkeyed by the original value,count,operation,format,error. Overflow fails the step rather than truncating, and decode strips padding from the named side so bytes32 round-trips.data/extract-fields"Extract Fields"sourcepathsname = pathor a bare pathmodeobject(default) /arrayonMissingnull(default) /empty/failOutputs
fields,items,missing,foundCount,itemCount,error. Numeric segments index arrays (rows.1.amount). This removes the need to reach into a nested path inside a template ref on an opaque node output, which cannot be validated before the run.data/flatten-findings"Flatten Findings"sources{label, value, severity?, itemsPath?}defaultSeveritywarninghashFieldtransactionHashmaxFindingsvalueaccepts an object carryingevents/transactions/logs/rows/items/results, a bare array, a boolean, or any other object. OutputsanyFound,count(true total, even when the list is capped),findings[],labels,firstHash,summary,truncated,error.data/static-config"Static Config"Single
valuefield on the Monaco JSON editor. Outputsresult,keys,count,valueType,error.Math plugin (two new actions)
math/compare-tolerance"Compare With Tolerance"Config:
actual,expected,mode(percentdefault /absolute),tolerance,precision(default 6).All arithmetic is BigInt fixed-point via a new
plugins/math/steps/decimal-core.ts. The percent check is|diff| * 100 * 10^td <= tol * |expected|, so nothing divides first and RAD or WAD magnitude values compare exactly. OutputswithinTolerance,breached,direction,difference,absoluteDifference,percentDifference(null when expected is zero), and the normalisedactual/expected/tolerance/mode.math/format-number"Format Number"Config:
value,decimals(0 default, 18 for wei),notation(compact/plain),precision(2),unit. Outputsformatted,value(full unrounded decimal string),magnitude,notation,error.HTTP Request retry
Added to the existing system node rather than shipping a second HTTP node, which would have duplicated the SSRF guard, timeout and
failOnErrorsemantics.retryAttemptsretryDelayRetries connection errors, timeouts and 408/425/429/500/502/503/504. A blocked URL, a malformed URL and other 4xx are never retried.
perform.tsis restructured around anAttemptOutcomeunion so the loop separates transient from fatal without re-parsing error strings;failOnErrorstill applies to the final outcome. Documented in the MCP schema so the agent path sees it.Registration
Plugin registration is fully generated.
pnpm discover-pluginsupdatedplugins/index.ts,lib/types/integration.ts,plugins/plugin-allowlist.jsonand the gitignored registries. Both plugins appear in the action palette, canvas, config panel, template autocomplete and MCP schemas with no hand-edited registry.Docs
New
docs/plugins/data.md, two new sections indocs/plugins/math.md, plus the overview row and the_meta.tsnav entry.Verification
pnpm type-checkcleanpnpm checkcleannode scripts/token-audit.jsreports no new errors from these files