feat(maestro): support evalScript inline JavaScript expressions - #2158
feat(maestro): support evalScript inline JavaScript expressions#2158Rohit3523 wants to merge 1 commit into
Conversation
Add evalScript as a supported Maestro command: a single-line JavaScript
expression evaluated against flow env and prior output leaves, with the
assigned output object folded back into the flat string-key variable
model so ${output.x} and ${output.list.length} resolve in later steps.
The command is handled host-side by the compute engine (node:vm) and
never dispatched to the device port.
Update the support matrix, ADR 0015, the conformance expected-divergence
(upstream/053_repeat_times is now identical), and add parser, engine, and
eval-module unit tests.
|
Reviewed exact head P0 — remote caller-supplied YAML gains daemon-host code execution. Maestro source bundles are sent to the daemon; P2 — resume safety is untested. After redesigning the trust boundary, add planted-red remote adversarial tests for process/filesystem/child-process/private-network access and execution-budget escape, then run exact-head CI/Size and repeat device evidence against the shipped path. Reference: https://nodejs.org/api/vm.html |
Summary
Adds
evalScriptto the supported Maestro YAML subset. The command evaluates asingle-line JavaScript expression with flow env values and prior
outputleaves in scope, then folds the assigned
outputobject back into the flatstring-key variable model so later steps resolve
${output.x}and${output.list.length}.Evaluation is host-side in the compute engine (
node:vm, matchingrunScripttrust semantics); the command is never dispatched to the device port. Without a
device round trip, the engine merges output leaves directly into flow scope and
marks the step executed.
repeat.times: ${output.list.length}works becauseassigned arrays fold to index and
lengthleaves.--fromresume refuses toskip evalScript steps, since they produce output.
Validation
pnpm test:maestro-compat: 335 unit tests pass (new parser, engine, andengine-eval-scripteval tests).pnpm maestro:conformance: 57 pass.upstream/053_repeat_timesreclassifiesfrom
we-reject(evalScript unsupported) toidentical; the declareddivergence is removed.
emulator-5554, ran an eval-script flow;output.sum = 1 + 2theninputText: ${output.sum}landed the computed3in the focused field(field value
Ada Lovelace3), proving arbitrary-expression evaluation and${output.x}consumption end-to-end on a device.Tradeoffs and follow-ups
object/array identity is not preserved, so
${output.list.length}andindexed leaves resolve but in-flow mutation like
output.list.push()doesnot.
fields stay literal/
${VAR}-lookup-only (assertTruescoped to lookups,repeat.whileunsupported).help maestrosupport matrix updatedto document the evalScript boundary.
13 files touched, +298/−15, within the Maestro compatibility engine and its
conformance/docs. No scope growth outside that family.