Skip to content

feat(m3.8): browser workflow nodes#35

Merged
ralyodio merged 1 commit into
mainfrom
worktree-m3.8-workflow
Jul 4, 2026
Merged

feat(m3.8): browser workflow nodes#35
ralyodio merged 1 commit into
mainfrom
worktree-m3.8-workflow

Conversation

@ralyodio

@ralyodio ralyodio commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Implements M3.8 — workflow-engine integration (PRD §21.1), the final M3 milestone. Base main.

import { runWorkflow, browserHandlers, sdkBrowser, exportWorkflowJson } from '@tronbrowser/workflow-engine';

const workflow = { id:'leads', name:'Scrape', entry:'open', nodes: {
  open:  { id:'open',  type:'browser', next:['links'], config:{ action:'open', url:'https://example.com' } },
  links: { id:'links', type:'browser', next:[],        config:{ action:'extract', mode:'links' } },
}};
const result = await runWorkflow(workflow, { variables: {} }, browserHandlers(sdkBrowser({ headless: true })));
console.log(exportWorkflowJson(result));

What's here

  • nodes/browser.ts — one BrowserNode handler dispatching config.actionopen/snapshot/click/fill/type/extract/screenshot/analyze/runTask on a shared SDK page (same primitives as CLI/MCP). Mutating actions output a fresh snapshot; screenshot writes the file and outputs its path. Missing config throws a BrowserNodeError with recovery guidance. sdkBrowser() is the default managed-session backing.
  • runner.tsrunWorkflow walks the graph from entry, threads each output into ctx.variables[nodeId], and closes the browser on completion. exportWorkflowJson serializes results; a failed node reports { nodeId, error, recovery: { recoverable, suggestion } } (e.g. a stale ref → "insert a snapshot node").
  • index.ts — richer BrowserNodeConfig.

Acceptance criteria (PRD §22)

  • ✅ Workflow nodes use the same SDK primitives as CLI and MCP.
  • ✅ Workflow outputs export as JSON.
  • ✅ Failed browser nodes include recovery details (and trace links where a trace is active).

Verification — +10 tests

  • Every browser action against a fake page (open/click/fill/extract/screenshot/analyze, missing-field error).
  • The runner: graph execution + output threading + browser close, JSON export, failure with recovery (STALE_REF → snapshot suggestion), missing-handler.
  • Full workspace suite green in CI order (build → typecheck → test) from clean.

Scope

Library milestone — no CLI/dispatcher wiring. Runner is linear-first (next[0]); branching builds on the same NodeHandler contract. See docs/workflow-nodes.md.

This completes M3.1–M3.8. 🎉

🤖 Generated with Claude Code

Adds browser nodes to @tronbrowser/workflow-engine (PRD §21.1), driving
automation from a workflow graph with the same SDK primitives as the CLI/MCP.

- nodes/browser.ts: one BrowserNode handler dispatching config.action ->
  open/snapshot/click/fill/type/extract/screenshot/analyze/runTask on a shared
  SDK page. Mutating actions output a fresh snapshot; screenshot writes the file
  and outputs its path. Missing required config throws a BrowserNodeError with
  recovery guidance. sdkBrowser() is the default managed-session backing.
- runner.ts: runWorkflow walks the graph from entry, threads each output into
  ctx.variables[nodeId], and closes the browser on completion. exportWorkflowJson
  serializes results; a failed node reports { nodeId, error, recovery } (e.g. a
  stale ref suggests inserting a snapshot node).
- index.ts: richer BrowserNodeConfig (action + url/ref/value/mode/path/goal/data).

Tests (+10): every browser action against a fake page, and the runner
(graph execution + output threading + browser close, JSON export, failure with
recovery, missing-handler). Full workspace suite green in CI order.

Completes the M3 milestones (M3.1–M3.8).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio ralyodio marked this pull request as ready for review July 4, 2026 19:05
@ralyodio ralyodio merged commit a269fcd into main Jul 4, 2026
6 checks passed
@ralyodio ralyodio deleted the worktree-m3.8-workflow branch July 4, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant