Skip to content

feat: stagecraft --http mode and native download in .js skills#908

Merged
stevez merged 3 commits into
mainfrom
feat/stagecraft-http-download-829
May 20, 2026
Merged

feat: stagecraft --http mode and native download in .js skills#908
stevez merged 3 commits into
mainfrom
feat/stagecraft-http-download-829

Conversation

@stevez

@stevez stevez commented May 19, 2026

Copy link
Copy Markdown
Owner

Closes #829 (partial — known issues #1 and #2)

Summary

  • stagecraft run --http connects to a running playwright-repl --http server instead of launching a fresh Playwright browser, so skills run against the user's real Chrome session (cookies, auth, Rogers login intact)
  • In --http mode, if the skill has a .js file it is sent via POST /run-script as a single round-trip; .pw fallback sends commands one-by-one via POST /run
  • download-bill.js rewritten as a top-level awaitable script using page.waitForEvent('download') + download.saveAs(path) — no extension plumbing needed, agent gets back the saved file path
  • {{variable}} substitution works in .js scripts the same as .pw templates

Usage

# Terminal 1 — running server with your Rogers session
playwright-repl --http

# Terminal 2 — run the skill
stagecraft run download-rogers-bill --http \
  --variable periods='["January 24, 2026"]' \
  --variable savePath="/home/user/tax/rogers-2026-01.pdf"

Test plan

  • stagecraft run download-rogers-bill --http errors clearly when server is not running
  • stagecraft run download-rogers-bill --http --variable periods='[...]' --variable savePath=... navigates to Rogers, checks periods, downloads PDF to the specified path
  • stagecraft run download-rogers-bill (no --http) still works with fresh browser via direct mode
  • stagecraft list still shows the skill

🤖 Generated with Claude Code

stevez and others added 3 commits May 18, 2026 21:11
- stagecraft run --http connects to a running playwright-repl --http
  server instead of launching a fresh browser; supports existing user
  sessions with cookies/auth intact
- In --http mode, prefers .js skill over .pw if both exist, sending
  the script via POST /run-script (single round-trip, full Playwright API)
- download-bill.js rewritten as a top-level script using
  page.waitForEvent('download') + download.saveAs(path); agent gets
  back the saved file path in the response
- {{variable}} substitution applied to .js scripts before sending,
  same pattern as .pw template variables

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- start-recording / stop-recording / pause-recording / discard-recording
  now work when the agent sends them via POST /run to playwright-repl --http
- Commands are recorded with ref-to-locator resolution (SessionManager
  feeds snapshot YAML from each `snapshot` result for stable locators)
- relay interactive loop (playwright-repl --relay) gets the same recording
  support, with a red ⏺ indicator in the prompt while recording

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- discoverSkills() now merges builtin skills (packages/stagecraft/skills/)
  with user skills (~/.stagecraft/skills/ or --skills-dir override);
  user skills with the same name override builtins
- SkillInfo gains a `source` field ('builtin' | 'user')
- stagecraft list shows [user] tag next to user-owned skills
- AGENT.md: Phase 2 recording guide for AI agents — setup, snapshot
  discipline for ref-to-locator resolution, .pw vs .js skill choice,
  directory layout, and command reference table

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stevez stevez merged commit aa23e33 into main May 20, 2026
8 checks passed
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.

Stagecraft: Node.js skill library and agent runtime

1 participant