Implementation
@override
Tool get definition => Tool(
name: 'batch',
description:
'Run several steps in one call: steps:[{tool,args}] over tap, type, key, scroll, scroll_to_find, swipe, long_press, drag, hardware_button, wait_for_settle, wait_for. Step args may name app:"<name>" to run on another attached app, so one batch can drive several devices (A taps call, B wait_for "Incoming call", B taps Answer). Each step settles and reports changed; the batch stops at the first error, or (stopOnNoChange, default true) at the first step that changed nothing. A step whose args carry expectChange:false (a toggle the app does not visibly react to) never stops the batch on changed:false. Targeted steps default to awaitReady:true. budgetMs (default 120000, max 300000) bounds all steps: when it runs out the batch stops before the next step (errorKind budgetExceeded) and says which steps ran. For known sequences (a form, a wizard); use single calls when the next move depends on what you see.',
inputSchema: ObjectSchema(
properties: {
'steps': batchStepsSchema(
_maxSteps,
description: 'Ordered steps, each {tool: "<name>", args: {…}} with the '
'same args the tool takes on its own, plus app:"<name>" to run that step on another attached app, and expectChange:false to let it change nothing without stopping the batch. Max $_maxSteps.',
),
'stopOnNoChange': Schema.bool(
description:
'Stop when a step reports changed:false, unless that step has expectChange:false. Default true.',
),
'returnScene': Schema.bool(
description: 'Append the final scene text. Default true.',
),
'budgetMs': Schema.int(
description:
'Total time for all steps, $_minBudgetMs-$_maxBudgetMs. Default $_defaultBudgetMs. When it runs out the batch stops before the next step and says which steps ran.',
),
},
required: ['steps'],
),
);