DocsWorkflowsComponentsMachinemachine:extension:emit

machine:extension:emit

Assembles the steps an authoring session accepted into a workflow, pushes it into the extension's library when asked, and saves it as a file when the run set write. It is the end of the loop rather than a part of it, so it needs no bridge unless a sync was asked for. That is what lets a session run against a browser and still hand back its fragment when the browser has gone away.

Options

NameTypeDescription
workflow_idstringThe id the authored workflow is written and synced under
namestringThe human-readable title of the authored workflow, defaulting to its id
start_urlstringThe page the authored workflow opens on
steps[]StepThe accepted steps, in the order the session performed them
  ↳ idstringUniquely names the step within its workflow, echoed on its StepResult.
  ↳ typestringIs the action to perform (click, fill, select, captureUrl, ...).
  ↳ labelstringIs a human-readable description shown in run progress UIs.
  ↳ selectorSelectorPicks the DOM node(s) the step acts on.
    ↳ cssstringIs a CSS selector.
    ↳ pathstringIs an explicit DOM path, used when CSS cannot express the target.
    ↳ indexes[]intNarrows a multi-match selector to these positions.
    ↳ enter[]stringNames the subtrees CSS has to resolve inside, outermost first. Each entry selects a shadow host or an iframe, resolved in the tree the previous entry opened, so a control inside a web component inside a same-origin frame is reachable by one Selector. Empty runs CSS against the top document.
    ↳ indexintNarrows a multi-match selector to a single position.
    ↳ allboolExpands the step to act on every match instead of the first.
  ↳ valuestringIs the input for value-taking steps such as fill and select. It may contain {{ variable }} placeholders.
  ↳ formatstringNames the shape extraction steps return their data in.
  ↳ attributestringNames the DOM attribute an extraction step reads.
  ↳ fieldsExtractFieldAre the named columns an extractList step reads out of each item its selector matched. Key order is the column order, and every returned item carries every key.
  ↳ limitintCaps how many items an extractList step returns. The extension applies its own bound when this is zero, so a listing that lazily grew to ten thousand rows truncates and says so.
  ↳ urlstringIs the address for navigation steps.
  ↳ fnstringNames the page function an eval step invokes.
  ↳ args[]anyAre the arguments passed to Fn.
  ↳ body_paramsmap[string]stringOverrides or adds form fields on the request a captureDownload re-issues, and carries the parameters a captureUrl sends, in the query for a GET and form-encoded otherwise.
  ↳ methodstringIs the HTTP method a captureUrl step fetches its URL with, defaulting to GET.
  ↳ filenamestringRenames a captured file (captureDownload, captureUrl and capturePageFile). It may contain {{ variable }} placeholders.
  ↳ outputstringChooses where a captured file goes, and the controlling client is its only destination.
  ↳ waitWaitConfigBlocks the step until a page condition holds.
    ↳ selectorstringWaits for a matching element to appear (or disappear, see Absent).
    ↳ textstringWaits for this text to be present on the page.
    ↳ url_includesstringWaits for the page URL to contain this substring.
    ↳ absentboolFlips the wait to expect the selector to disappear rather than appear.
    ↳ delay_msintIs a fixed pause in milliseconds, applied on top of any condition.
    ↳ timeout_msintBounds the wait, in milliseconds.
  ↳ promptstringIs the text shown at a user gate asking for manual input.
  ↳ continue_onContinueConditionHolds the step until a user gate is cleared or a page condition is met.
    ↳ manualboolPauses the run for an explicit user continue.
    ↳ selectorstringResumes when a matching element appears.
    ↳ textstringResumes when this text is present on the page.
    ↳ url_includesstringResumes when the page URL contains this substring.
    ↳ timeout_msintBounds the hold, in milliseconds.
  ↳ timeout_msintOverrides the workflow's default step timeout, in milliseconds.
  ↳ optionalboolLets the run continue when this step fails.
  ↳ conditionConditionCondition, when set, gates the step. If it does not hold, the step is skipped rather than failed.
    ↳ selectorstringHolds when a matching element exists on the page.
    ↳ textstringHolds when the page (or the selected element) contains this text.
    ↳ url_includesstringHolds when the page URL contains this substring.
    ↳ matchstringDecides how the set predicates combine, "any" or "all".
    ↳ negateboolInverts the combined result.
  ↳ storestringNames a slot the step's data is saved under, readable by later steps and returned on the WorkflowResult.
  ↳ resumeResumePointResume, when set, marks this step as a point a re-run may start at, and carries the predicate recognizing a browser already standing there.
    ↳ idstringNames this point so a later point's Rewind can reach it. It is unique within one workflow.
    ↳ whenConditionRecognizes the browser standing at this point.
      ↳ selectorstringHolds when a matching element exists on the page.
      ↳ textstringHolds when the page (or the selected element) contains this text.
      ↳ url_includesstringHolds when the page URL contains this substring.
      ↳ matchstringDecides how the set predicates combine, "any" or "all".
      ↳ negateboolInverts the combined result.
    ↳ rewindRewindRewind, when set, is how the browser leaves this point for an earlier one.
      ↳ tostringNames the resume point this reaches, which must sit earlier in the step list than the point declaring it.
      ↳ urlstringNavigates the tab back to the earlier point.
      ↳ selectorstringClicks a control on the current page that leads back, for a flow whose way back is a button rather than an address.
      ↳ waitWaitConfigHolds until the page has settled after the rewind, before the target point's own predicate is checked again.
        ↳ selectorstringWaits for a matching element to appear (or disappear, see Absent).
        ↳ textstringWaits for this text to be present on the page.
        ↳ url_includesstringWaits for the page URL to contain this substring.
        ↳ absentboolFlips the wait to expect the selector to disappear rather than appear.
        ↳ delay_msintIs a fixed pause in milliseconds, applied on top of any condition.
        ↳ timeout_msintBounds the wait, in milliseconds.
  ↳ alwaysboolRuns the step even when re-entry starts the run past it, for work the page cannot report as already done.
writeboolSave the assembled workflow as a JSON file as well as returning it
out_dirstringWhere a written workflow JSON lands, relative to the working directory (default "workflows")
syncboolPush the authored workflow into the extension's library
client_idstringThe extension client to sync into, a hint the host may honour; empty leaves the choice of browser to the host
timeout_msintHow long to wait for the browser before failing the sync

Outputs

NameTypeDescription
workflowWorkflowThe assembled workflow, in the extension's wire schema
  ↳ idstringUniquely names the workflow. Sequences reference library fragments by it.
  ↳ namestringIs the human-readable title shown in the extension UI.
  ↳ targetTargetConfigLocates the page the workflow runs against and controls tab reuse.
    ↳ urlstringIs the address to open when no existing tab matches.
    ↳ match_urlstringIs a substring an existing tab's URL must contain for the run to reuse that tab instead of opening URL.
    ↳ reuse_tabboolReuses a matching open tab instead of opening a new one. Nil means the extension default (true).
    ↳ activateboolBrings the target tab to the foreground. Nil means the extension default (true).
    ↳ reloadboolForces a page reload on a reused tab before the first step runs.
  ↳ steps[]StepAre the actions to perform, in order.
    ↳ idstringUniquely names the step within its workflow, echoed on its StepResult.
    ↳ typestringIs the action to perform (click, fill, select, captureUrl, ...).
    ↳ labelstringIs a human-readable description shown in run progress UIs.
    ↳ selectorSelectorPicks the DOM node(s) the step acts on.
      ↳ cssstringIs a CSS selector.
      ↳ pathstringIs an explicit DOM path, used when CSS cannot express the target.
      ↳ indexes[]intNarrows a multi-match selector to these positions.
      ↳ enter[]stringNames the subtrees CSS has to resolve inside, outermost first. Each entry selects a shadow host or an iframe, resolved in the tree the previous entry opened, so a control inside a web component inside a same-origin frame is reachable by one Selector. Empty runs CSS against the top document.
      ↳ indexintNarrows a multi-match selector to a single position.
      ↳ allboolExpands the step to act on every match instead of the first.
    ↳ valuestringIs the input for value-taking steps such as fill and select. It may contain {{ variable }} placeholders.
    ↳ formatstringNames the shape extraction steps return their data in.
    ↳ attributestringNames the DOM attribute an extraction step reads.
    ↳ fieldsExtractFieldAre the named columns an extractList step reads out of each item its selector matched. Key order is the column order, and every returned item carries every key.
    ↳ limitintCaps how many items an extractList step returns. The extension applies its own bound when this is zero, so a listing that lazily grew to ten thousand rows truncates and says so.
    ↳ urlstringIs the address for navigation steps.
    ↳ fnstringNames the page function an eval step invokes.
    ↳ args[]anyAre the arguments passed to Fn.
    ↳ body_paramsmap[string]stringOverrides or adds form fields on the request a captureDownload re-issues, and carries the parameters a captureUrl sends, in the query for a GET and form-encoded otherwise.
    ↳ methodstringIs the HTTP method a captureUrl step fetches its URL with, defaulting to GET.
    ↳ filenamestringRenames a captured file (captureDownload, captureUrl and capturePageFile). It may contain {{ variable }} placeholders.
    ↳ outputstringChooses where a captured file goes, and the controlling client is its only destination.
    ↳ waitWaitConfigBlocks the step until a page condition holds.
      ↳ selectorstringWaits for a matching element to appear (or disappear, see Absent).
      ↳ textstringWaits for this text to be present on the page.
      ↳ url_includesstringWaits for the page URL to contain this substring.
      ↳ absentboolFlips the wait to expect the selector to disappear rather than appear.
      ↳ delay_msintIs a fixed pause in milliseconds, applied on top of any condition.
      ↳ timeout_msintBounds the wait, in milliseconds.
    ↳ promptstringIs the text shown at a user gate asking for manual input.
    ↳ continue_onContinueConditionHolds the step until a user gate is cleared or a page condition is met.
      ↳ manualboolPauses the run for an explicit user continue.
      ↳ selectorstringResumes when a matching element appears.
      ↳ textstringResumes when this text is present on the page.
      ↳ url_includesstringResumes when the page URL contains this substring.
      ↳ timeout_msintBounds the hold, in milliseconds.
    ↳ timeout_msintOverrides the workflow's default step timeout, in milliseconds.
    ↳ optionalboolLets the run continue when this step fails.
    ↳ conditionConditionCondition, when set, gates the step. If it does not hold, the step is skipped rather than failed.
      ↳ selectorstringHolds when a matching element exists on the page.
      ↳ textstringHolds when the page (or the selected element) contains this text.
      ↳ url_includesstringHolds when the page URL contains this substring.
      ↳ matchstringDecides how the set predicates combine, "any" or "all".
      ↳ negateboolInverts the combined result.
    ↳ storestringNames a slot the step's data is saved under, readable by later steps and returned on the WorkflowResult.
    ↳ resumeResumePointResume, when set, marks this step as a point a re-run may start at, and carries the predicate recognizing a browser already standing there.
      ↳ idstringNames this point so a later point's Rewind can reach it. It is unique within one workflow.
      ↳ whenConditionRecognizes the browser standing at this point.
        ↳ selectorstringHolds when a matching element exists on the page.
        ↳ textstringHolds when the page (or the selected element) contains this text.
        ↳ url_includesstringHolds when the page URL contains this substring.
        ↳ matchstringDecides how the set predicates combine, "any" or "all".
        ↳ negateboolInverts the combined result.
      ↳ rewindRewindRewind, when set, is how the browser leaves this point for an earlier one.
        ↳ tostringNames the resume point this reaches, which must sit earlier in the step list than the point declaring it.
        ↳ urlstringNavigates the tab back to the earlier point.
        ↳ selectorstringClicks a control on the current page that leads back, for a flow whose way back is a button rather than an address.
        ↳ waitWaitConfigHolds until the page has settled after the rewind, before the target point's own predicate is checked again.
          ↳ selectorstringWaits for a matching element to appear (or disappear, see Absent).
          ↳ textstringWaits for this text to be present on the page.
          ↳ url_includesstringWaits for the page URL to contain this substring.
          ↳ absentboolFlips the wait to expect the selector to disappear rather than appear.
          ↳ delay_msintIs a fixed pause in milliseconds, applied on top of any condition.
          ↳ timeout_msintBounds the wait, in milliseconds.
    ↳ alwaysboolRuns the step even when re-entry starts the run past it, for work the page cannot report as already done.
  ↳ optionsWorkflowOptionsCarries run-wide defaults such as the step timeout and the tab contention policy.
    ↳ default_timeout_msintIs the per-step timeout in milliseconds for steps that do not set their own.
    ↳ continue_on_errorboolKeeps the run going past a failed step instead of stopping at the first failure.
    ↳ concurrencystringIs the contention policy when another run already holds the target tab, one of "queue" (default), "parallel", or "reject".
    ↳ reentryboolLets a run start at a resume point the live page matches instead of replaying from the first step. Nil means the extension default (true), and an explicit false forces a clean run of a fragment that declares points.
  ↳ conditionConditionCondition, when set, gates the whole workflow. If it does not hold, the run is skipped rather than failed.
    ↳ selectorstringHolds when a matching element exists on the page.
    ↳ textstringHolds when the page (or the selected element) contains this text.
    ↳ url_includesstringHolds when the page URL contains this substring.
    ↳ matchstringDecides how the set predicates combine, "any" or "all".
    ↳ negateboolInverts the combined result.
pathstringWhere the workflow JSON was written, empty unless the run asked for a file
stepsintHow many steps it holds
syncedboolWhether it was pushed into the extension's library
contractExtContractWhat the assembled fragment promises to return, derived from the step it exists to run, which is either the rows it reads or the file it takes. A replay that honors none of it is a break even when every step reported success
  ↳ storestringNames the slot the rows land in, which is the store of the fragment's own extractList step.
  ↳ fields[]stringAre the columns every healthy row carries. A column no row answers is a selector that stopped matching, whatever the run reported.
  ↳ min_rowsintIs the fewest rows a healthy run returns, one by default. A listing that answers with nothing is the case this is here for.
  ↳ fileboolSays the fragment's read is a captured file rather than a listing, so a healthy run is one that came back with bytes under a name. It is the same silence in a different shape, since a capture whose form moved answers with nothing and reports success.
selectorstringThe css matching one item of the listing the fragment reads
fieldsExtractFieldThe columns the fragment reads out of each item
storestringThe slot the fragment's rows land in

Example

Writes the steps a session accepted as a workflow file and pushes it into the extension's library.

name: Write the authored workflow
actions:
  - name: emit
    component: machine:extension:emit
    vars:
      workflow_id: site-login
      name: Example - Login
      start_url: https://example.com/login
      steps: "{{ session.steps }}"
      write: true
      out_dir: ./authored
      sync: true

outputs:
  path: "{{ emit.path }}"
  steps: "{{ emit.steps }}"