Expand description
ScriptSpec v1 — unified AST for declarative crawl scripts.
Playwright/Puppeteer-inspired contract that lets a single file describe everything a render job should do end-to-end: selectors, steps, captures, assertions, exports. JSON, YAML and Lua all parse to this same AST so the executor is backend-agnostic.
§Example (JSON)
{
"version": 1,
"defaults": { "timeout_ms": 10000 },
"selectors": {
"email": "role=textbox[name=\"Email\"]",
"login": "role=button[name=\"Sign in\"]"
},
"steps": [
{ "goto": "https://example.com/login" },
{ "type": { "locator": "@email", "text": "a@b.c" } },
{ "click": { "locator": "@login" } },
{ "wait_for": { "locator": "role=heading[name=\"Dashboard\"]" } }
],
"captures": [
{ "screenshot": { "mode": "full_page", "name": "dashboard" } },
{ "snapshot": { "kind": "post_js_html" } }
],
"assertions": [
{ "contains": { "locator": "body", "text": "Welcome" } }
],
"exports": {
"title": "text=h1",
"items": { "locator": "@cards", "as": "list" }
}
}Selector names prefixed with @ reference the selectors map; bare
selectors use the full selector DSL (see render::selector).
Design notes:
defaults.timeout_mssets the fallback actionability timeout per step; individual steps can override.capturesalways emitartifact.savedNDJSON events with astagematching the capture kind.assertionsare checked in order; a failure emitsjob.failedwithwhy=assertion:<name>and halts the script.exportspopulate theExtractCompletedevent payload.
Re-exports§
pub use executor::plan;pub use executor::Plan;pub use executor::PlanError;pub use executor::ResolvedExport;pub use executor::ResolvedStep;pub use legacy::actions_to_script_spec;pub use runner::ArtifactRef;pub use runner::RunOutcome;pub use runner::ScriptRunner;pub use runner::StepOutcome;pub use spec::*;
Modules§
- executor
- ScriptSpec → backend translation.
- legacy
- Adapters from legacy interaction inputs to
ScriptSpec. - runner
- ScriptSpec runner — executes a resolved
Planagainst a livechromiumoxide::Page(our in-tree CDP client fork atrender::chrome::page::Page). - spec
ScriptSpecAST — the common target of JSON/YAML/Lua script inputs.