agent-screenplay 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +141 -2
  3. package/assets/editor/index.html +650 -0
  4. package/assets/fonts/Inter-Bold.ttf +0 -0
  5. package/assets/fonts/Inter-LICENSE.txt +92 -0
  6. package/assets/fonts/Inter-Medium.ttf +0 -0
  7. package/assets/fonts/Inter-Regular.ttf +0 -0
  8. package/assets/fonts/Inter-SemiBold.ttf +0 -0
  9. package/dist/cli.d.ts +2 -0
  10. package/dist/cli.js +163 -0
  11. package/dist/cli.js.map +1 -0
  12. package/dist/core.d.ts +18 -0
  13. package/dist/core.js +73 -0
  14. package/dist/core.js.map +1 -0
  15. package/dist/direct/plan.d.ts +100 -0
  16. package/dist/direct/plan.js +274 -0
  17. package/dist/direct/plan.js.map +1 -0
  18. package/dist/drivers/browser.d.ts +9 -0
  19. package/dist/drivers/browser.js +44 -0
  20. package/dist/drivers/browser.js.map +1 -0
  21. package/dist/drivers/desktop.d.ts +53 -0
  22. package/dist/drivers/desktop.js +650 -0
  23. package/dist/drivers/desktop.js.map +1 -0
  24. package/dist/drivers/pace.d.ts +11 -0
  25. package/dist/drivers/pace.js +44 -0
  26. package/dist/drivers/pace.js.map +1 -0
  27. package/dist/drivers/web.d.ts +49 -0
  28. package/dist/drivers/web.js +580 -0
  29. package/dist/drivers/web.js.map +1 -0
  30. package/dist/editor/server.d.ts +111 -0
  31. package/dist/editor/server.js +312 -0
  32. package/dist/editor/server.js.map +1 -0
  33. package/dist/ffmpeg.d.ts +5 -0
  34. package/dist/ffmpeg.js +44 -0
  35. package/dist/ffmpeg.js.map +1 -0
  36. package/dist/guide.d.ts +6 -0
  37. package/dist/guide.js +25 -0
  38. package/dist/guide.js.map +1 -0
  39. package/dist/init.d.ts +19 -0
  40. package/dist/init.js +147 -0
  41. package/dist/init.js.map +1 -0
  42. package/dist/login.d.ts +2 -0
  43. package/dist/login.js +50 -0
  44. package/dist/login.js.map +1 -0
  45. package/dist/mcp/server.d.ts +1 -0
  46. package/dist/mcp/server.js +132 -0
  47. package/dist/mcp/server.js.map +1 -0
  48. package/dist/render/compose.d.ts +68 -0
  49. package/dist/render/compose.js +361 -0
  50. package/dist/render/compose.js.map +1 -0
  51. package/dist/render/presets.d.ts +42 -0
  52. package/dist/render/presets.js +111 -0
  53. package/dist/render/presets.js.map +1 -0
  54. package/dist/render/render.d.ts +27 -0
  55. package/dist/render/render.js +259 -0
  56. package/dist/render/render.js.map +1 -0
  57. package/dist/render/sources.d.ts +15 -0
  58. package/dist/render/sources.js +146 -0
  59. package/dist/render/sources.js.map +1 -0
  60. package/dist/render/style.d.ts +41 -0
  61. package/dist/render/style.js +151 -0
  62. package/dist/render/style.js.map +1 -0
  63. package/dist/scenario/config.d.ts +43 -0
  64. package/dist/scenario/config.js +69 -0
  65. package/dist/scenario/config.js.map +1 -0
  66. package/dist/scenario/fingerprint.d.ts +10 -0
  67. package/dist/scenario/fingerprint.js +58 -0
  68. package/dist/scenario/fingerprint.js.map +1 -0
  69. package/dist/scenario/load.d.ts +36 -0
  70. package/dist/scenario/load.js +101 -0
  71. package/dist/scenario/load.js.map +1 -0
  72. package/dist/scenario/schema.d.ts +555 -0
  73. package/dist/scenario/schema.js +264 -0
  74. package/dist/scenario/schema.js.map +1 -0
  75. package/dist/scenario/target.d.ts +26 -0
  76. package/dist/scenario/target.js +40 -0
  77. package/dist/scenario/target.js.map +1 -0
  78. package/dist/take.d.ts +100 -0
  79. package/dist/take.js +15 -0
  80. package/dist/take.js.map +1 -0
  81. package/dist/version.d.ts +1 -0
  82. package/dist/version.js +2 -0
  83. package/dist/version.js.map +1 -0
  84. package/dist/voice/cartesia.d.ts +12 -0
  85. package/dist/voice/cartesia.js +103 -0
  86. package/dist/voice/cartesia.js.map +1 -0
  87. package/package.json +69 -4
  88. package/schema/scenario.schema.json +1098 -0
  89. package/skills/screenplay/SKILL.md +126 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Screenplay contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,142 @@
1
- # Temporary Holding Version
1
+ # Screenplay
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Screen Studio-quality screen recordings, made by your AI agent.**
4
+
5
+ Ask Claude Code, Codex, Cursor or any agent: *"Make a video that shows how human handoff works"*. The agent explores your app and writes a short **scenario**; Screenplay plays it in a browser (or a desktop app), films it, and edits the video like Screen Studio would: smooth cursor, automatic zooms that follow the action, click effects, callouts, spotlight, captions, title cards, and an optional voice-over.
6
+
7
+ ![Storyboard of an example video](docs/handoff-storyboard.png)
8
+
9
+ Screenplay contains no AI and needs no model key: your agent does the thinking, Screenplay does the filming and editing.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npx agent-screenplay init
15
+ ```
16
+
17
+ The npm package is `agent-screenplay`; installed globally (`npm i -g agent-screenplay`), its command is `screenplay`.
18
+
19
+ `init` downloads Chromium (once), adds the Screenplay MCP server to the agents it finds (Claude Code, Codex, Cursor), and installs the guide that teaches them to make good videos. Then ask your agent for a recording.
20
+
21
+ Without MCP, any agent that can run commands can use the CLI directly:
22
+
23
+ ```bash
24
+ npx agent-screenplay guide # how to write a good scenario
25
+ npx agent-screenplay check demo.json # plays the steps fast, without filming
26
+ npx agent-screenplay record demo.json # films and edits → demo.mp4 + demo.storyboard.png
27
+ npx agent-screenplay render demo.json # re-edits the last take (style, zoom, text, voice) without filming
28
+ ```
29
+
30
+ Requirements: Node 20+. ffmpeg and the drawing library ship with the package.
31
+
32
+ ## A scenario
33
+
34
+ ```json
35
+ {
36
+ "url": "https://app.example.com/inbox",
37
+ "style": { "background": "aurora" },
38
+ "steps": [
39
+ { "title": "Human handoff, in one click", "subtitle": "New in 2.4" },
40
+ { "click": "text=Camille Laurent", "say": "When the AI agent gets stuck, the conversation lands in your inbox." },
41
+ { "callout": "role=button[name='Take over']", "text": "Take over from the AI agent" },
42
+ { "click": "role=button[name='Take over']", "say": "One click, and the conversation is yours." },
43
+ { "type": "Hi Camille, I'm on it.", "into": "placeholder=Write a reply…" },
44
+ { "click": "role=button[name='Send']" },
45
+ { "highlight": "text=Assigned to you", "text": "Your teammates see it's yours" },
46
+ { "end": "Available today on every plan" }
47
+ ]
48
+ }
49
+ ```
50
+
51
+ - **Targets** name elements the way people see them: `text=…`, `role=button[name='…']`, `label=…`, `placeholder=…`, `testid=…`, `css=…` (web only), `at=x,y` (desktop apps without accessible elements only).
52
+ - **Actions**: `goto`, `click`, `type`, `press`, `hover`, `scroll`, `select`, `wait`, `pause`.
53
+ - **Direction**: `title` and `end` cards, `callout` (a bubble pointing at an element), `highlight` (spotlight), `zoomTo`, and on any step `say` (caption and voice), `zoom`, `hold`.
54
+ - **Style**: background preset (mesh gradients: `aurora`, `sky`, `dusk`, `ember`, `graphite`, `lagoon`, `lilac`, `peach`, `linen`), your own gradient, a color or an image; padding, corner radius, shadow, cursor style, maximum zoom, browser frame, accent color. See [Style](#style).
55
+ - **Output**: 1920×1080 at 30 fps by default; any size up to 4K, 24 to 60 fps, optional GIF.
56
+
57
+ The full format is the JSON schema in [`schema/scenario.schema.json`](schema/scenario.schema.json) (`npx agent-screenplay schema`), and the agent guide in [`skills/screenplay/SKILL.md`](skills/screenplay/SKILL.md). Examples are in [`examples/`](examples).
58
+
59
+ `check` and `record` really perform the steps (a "Send" click sends): point scenarios at a demo account or a staging environment.
60
+
61
+ ## Style
62
+
63
+ Set the look by eye: `npx agent-screenplay style demo.json` opens an editor in your browser, on a frame of the last recording. Pick a gradient (or make your own), a color or an image (drop it on the page), set the padding, corners and shadow, then save to **this video** or to **all videos**, and render without filming again.
64
+
65
+ ![The style editor](docs/style-editor.png)
66
+
67
+ "All videos" writes `screenplay.config.json`, which applies to every scenario in its folder and below; a scenario's own `style` wins, setting by setting. The same settings by hand:
68
+
69
+ ```json
70
+ {
71
+ "style": {
72
+ "background": { "gradient": ["#0ea5e9", "#6366f1"], "angle": 135 },
73
+ "padding": 96,
74
+ "radius": 20,
75
+ "shadow": true
76
+ }
77
+ }
78
+ ```
79
+
80
+ `background` is a preset name (`aurora` by default; the first presets, `ocean`, `sunset` and so on, still work), a color (`"#0f172a"`), an image path (relative to the file that sets it), or `{ "gradient": [2 to 4 colors], "angle": degrees }`.
81
+
82
+ ## Signing in
83
+
84
+ - `npx agent-screenplay login https://app.example.com` opens a browser; sign in, press Enter, and the session is saved to `.screenplay/auth.json`. Use it with `"auth": { "storageState": ".screenplay/auth.json" }`. Keep that file out of git.
85
+ - Agents without a screen can sign in with steps: `{ "type": "${EMAIL}", "into": "label=Email" }`, `{ "type": "${PASSWORD}", "into": "label=Password", "secret": true }`. `${VAR}` is read from the environment; `secret` masks the text in captions and logs.
86
+
87
+ ## Voice-over
88
+
89
+ Off by default. Turn it on per scenario:
90
+
91
+ ```json
92
+ "voice": { "enabled": true, "language": "fr" }
93
+ ```
94
+
95
+ Each step's `say` is spoken with [Cartesia](https://cartesia.ai) (set `CARTESIA_API_KEY`), and the video waits for each sentence to finish, so the voice sets the pace. Narration is cached: re-rendering with unchanged text costs nothing. `voice.id` picks another voice, `voice.speed` its pace. Without voice, `say` still shows as a caption.
96
+
97
+ ## Desktop apps
98
+
99
+ Use `"app": "<name>"` instead of `"url"`. The steps are played through the operating system's accessibility APIs by [agent-desktop](https://github.com/vercel-labs/agent-desktop) (installed with Screenplay), and the window is filmed with ffmpeg without the system cursor; the editing is the same as for websites.
100
+
101
+ | | Needs |
102
+ |---|---|
103
+ | macOS | Allow your terminal or agent app in System Settings → Privacy & Security → **Screen Recording** and **Accessibility** |
104
+ | Windows | Nothing |
105
+ | Linux | An **X11** session with the AT-SPI accessibility bus (standard on GNOME). Wayland is not supported: it blocks screen capture and synthetic input by design |
106
+
107
+ Desktop recordings need a real screen: they cannot run in a headless container. Websites can.
108
+
109
+ ### The whole screen
110
+
111
+ `"screen": true` films the whole main screen instead of one window, for videos that go from one app to another or use the menu bar. `{ "open": "<app>" }` launches an app or brings it to the front, a step's `"app"` acts in another app, and `"surface": "menubar"` (or `menu`, `sheet`, `popover`, `alert`) finds elements outside the app's window. Everything on screen is filmed, desktop icons and notifications included: tidy the screen first; on macOS `"hideOthers": true` hides the other apps.
112
+
113
+ ## How it works
114
+
115
+ ```
116
+ scenario.json ──▶ play + film ──────────────────▶ take (frames + timeline of actions)
117
+ web: Playwright, headless Chromium │
118
+ desktop: agent-desktop + ffmpeg ▼
119
+ edit: time remap (long waits sped up),
120
+ camera (spring zooms), cursor path,
121
+ overlays, captions, voice track
122
+ │
123
+ ▼
124
+ draw each frame (Skia) → ffmpeg → MP4
125
+ ```
126
+
127
+ Screenplay knows exactly where and when each click happens, and the box of every element it acts on, so zooms are framed on the element instead of guessed from mouse movement. The cursor is drawn during editing, along a smooth human-like path.
128
+
129
+ ## Development
130
+
131
+ ```bash
132
+ npm install
133
+ npm run build
134
+ npm test # unit tests
135
+ npm run test:e2e # records a real scenario in headless Chromium and talks to the MCP server
136
+ ```
137
+
138
+ `examples/demo-app` is a small web app for trying scenarios; `examples/desktop-app/notes.py` is a GTK app for desktop recording on Linux.
139
+
140
+ ## License
141
+
142
+ MIT. Bundled: [Inter](https://rsms.me/inter/) (SIL Open Font License), ffmpeg through `ffmpeg-static` (GPL), agent-desktop (Apache-2.0).