[Feature Request / Bug] wait step's seconds param can't take a variable, so var.random → wait doesn't work
Title
wait step's seconds param can't take a variable, so var.random → wait doesn't work
Body
Summary
The wait step's seconds param is defined as kind: "number" and is read at runtime with param_f64, which never resolves {{variable}} references. That makes it impossible to feed a var.random output into wait for a randomized delay — a combination the codebase itself seems to anticipate (see the comment quoted below), but never actually wires up.
Steps to reproduce
- Add a
var.randomstep, e.g.min=1000,max=5000,into=delay. - Add a
waitstep and try to put{{delay}}into "seconds". - The field is a native
<input type="number">, so you can't even type{{delay}}into it. If you hand-edit the saved project file to force"seconds": "{{delay}}", the run doesn't error — it just silently falls back to the 1-second default, because the value is never expanded before being parsed.
Root cause
wait's param is declared askind: "number"(src/entities/automation/model/palette.ts, ~L429-433):
kind: "wait",
params: [{ name: "seconds", label: "palette.wait.seconds.label", kind: "number", default: 2 }],
- It's consumed with
param_f64(src-tauri/src/runner.rs, ~L160-166), which parses a literal number or a numeric string but never callsexpand():
fn param_f64(params: &Value, name: &str) -> Option<f64> {
params.get(name).and_then(|v| match v {
Value::Number(n) => n.as_f64(),
Value::String(s) => s.parse().ok(),
_ => None,
})
}
- Compare that with
var.random'smin/maxandvar.math'sa/b, which arekind: "text"and are resolved withas_number()(~L576-582) — which does runexpand()first:
fn as_number(vars: &HashMap<String, String>, raw: &str) -> Result<f64> {
let expanded = expand(raw, vars);
expanded.trim().parse::<f64>()
.map_err(|_| anyhow!("\"{expanded}\" is not a number"))
}
-
Notably, the comment directly above
var.random's range-picking logic (~L1512) reads:"16 bits of the uuid is plenty for a wait or an index and keeps this free of another dependency."
which implies a random-seconds-into-
waitworkflow was in mind whenvar.randomwas written, butwaitnever got thekind: "text"+as_number()treatment that would actually let it consume that value. -
The same gap applies to every other
kind: "number"param in the palette —waitFor.timeout,waitGone.timeout,waitText.timeout,waitUrl.timeout,readAttribute.timeout— none of them accept a variable either, for the same reason.
Suggested fix
Change seconds/timeout params from kind: "number" to kind: "text" (keeping the existing numeric default), and read them on the Rust side with as_number() instead of param_f64, the same way var.random/var.math already do. That's a small, localized change that would let var.random → wait (and any variable → any timeout) work without any other UI change.
Why it matters
Randomized delays between actions are a pretty basic building block for humanlike automation, which is one of this project's core selling points, so not being able to wire var.random into wait is a real functional gap rather than a nice-to-have.
Environment
- Repo: ProxyShard/ShardBrowser,
mainbranch - Commit at time of writing:
4880c3fd1a6360bc205daa5bc5542b16277201c3 - ⚠️ Fill in your own app version / OS before submitting (Settings → About, or your build output) — the above is just the source commit I read the code at.
in v2.1.1