@runalabs/rill-cli 0.1.12 → 0.1.14

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 (3) hide show
  1. package/README.md +61 -10
  2. package/dist/cli.js +994 -346
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -19,13 +19,13 @@ rill run cancel <run-id>
19
19
 
20
20
  The first run opens Rill authorization if needed. Save optional website test accounts in Rill Settings using an account name, exact HTTPS origin, username, password, and optional login URL. Login appears in the private video, with masked password inputs; login diagnostics are omitted. MFA, CAPTCHA, external SSO, and unsupported login forms return a blocker.
21
21
 
22
- Cloud recordings are private by default. Closing the terminal disconnects without cancelling. Use `--no-wait` to return after submission, and `--id <same-run-id>` with identical arguments to retry an uncertain submission. Cloud runs use run credits: Free includes 3 per calendar month and Pro includes 20. Buy additional credits from Billing.
22
+ Cloud recordings are private by default. Closing the terminal disconnects without cancelling. Use `--no-wait` to return after submission, and `--id <same-run-id>` with identical arguments to retry an uncertain submission. Cloud runs use run credits: Check your current monthly allowance and balance in Billing; allowances depend on the account entitlement and service configuration. Buy additional credits there.
23
23
 
24
24
  The following local-recording instructions remain available through `record start` and `record stop`.
25
25
 
26
26
  ## Install and verify
27
27
 
28
- Browser recording runs on macOS and Linux. Install Node.js 22+ and Google Chrome or Chromium. Rill encodes recordings remotely by default; local FFmpeg is optional. Chrome stays on your machine and can access localhost. Raw frames upload after recording stops.
28
+ Browser recording runs on macOS, Linux, and Windows. Install Node.js 22+ and Google Chrome or Chromium. Rill encodes recordings remotely by default; local FFmpeg is optional. Chrome stays on your machine and can access localhost. Raw frames upload after recording stops.
29
29
 
30
30
  Then install the scoped package:
31
31
 
@@ -40,9 +40,20 @@ Do not use `npx rill`: the unscoped package belongs to a different product. Doct
40
40
 
41
41
  ## Authenticate
42
42
 
43
+ ### Connect with pollable approval
44
+
45
+ `rill whoami` verifies the current account without starting sign-in. `rill connect --email you@example.com` waits for human approval by default. For agents that cannot hold a foreground command open:
46
+
47
+ ```sh
48
+ rill connect --email you@example.com --no-wait
49
+ rill connect status <authorization-id>
50
+ ```
51
+
52
+ The first response contains `authorizationId`, `verificationUri`, `userCode`, `expiresAt`, `retryAfterSeconds`, and the exact `nextCommand`. The human opens the URL and approves their own request. Poll no faster than `retryAfterSeconds`; each status command returns once. States are `pending`, `authenticated` (approved and credentials saved), `expired`, or `denied` (including revoked claims). Expired and denied status commands exit 1. Pending state and polling backoff survive process exit in the OS credential store; claim/access tokens are never returned. Repeating connect with the same email resumes an unexpired pending request. Only the latest authorization ID for that API URL can be polled.
53
+
43
54
  ### Interactive login
44
55
 
45
- `rill login` prints a verification URL and device code. Open the URL, sign in, and approve the request. The CLI waits for approval and stores the credential in macOS Keychain or Linux Secret Service using `secret-tool`. Linux needs an available Secret Service keyring; use token authentication on headless machines without one.
56
+ `rill login` prints a verification URL and device code. Open the URL, sign in, and approve the request. The CLI waits for approval and stores the credential in macOS Keychain, Linux Secret Service, or Windows current-user DPAPI using `secret-tool`. Linux needs an available Secret Service keyring; use token authentication on headless machines without one.
46
57
 
47
58
  ### CI and unattended agents
48
59
 
@@ -66,6 +77,8 @@ New browser recordings include a visible cursor and click pulses by default. In
66
77
 
67
78
  ### Connect Playwright
68
79
 
80
+ Start also returns `browserAttachment` with the CDP endpoint, protocol, Playwright method, and attachment instructions. Browser tools must explicitly support attaching to that endpoint; Rill does not automatically expose its browser to every tool.
81
+
69
82
  In a project with `playwright-core` installed, save this as `rill-run.mjs`:
70
83
 
71
84
  ```js
@@ -86,6 +99,31 @@ try {
86
99
 
87
100
  Run `node rill-run.mjs "<cdpUrl>"` with the exact endpoint from start. Then run `rill record stop <recording-id>`, including when your verification fails. A page title alone does not verify your app's behavior.
88
101
 
102
+ For a shell-only macOS/Linux agent with no project Playwright dependency, use a temporary directory. This installs the automation client without changing the project's manifest or launching another browser:
103
+
104
+ ```sh
105
+ rill_automation_dir=$(mktemp -d)
106
+ npm install --prefix "$rill_automation_dir" --no-save --package-lock=false playwright-core
107
+ cat > "$rill_automation_dir/run.mjs" <<'JS'
108
+ import { chromium } from 'playwright-core';
109
+ const browser = await chromium.connectOverCDP(process.argv[2]);
110
+ try {
111
+ const page = browser.contexts()[0]?.pages()[0];
112
+ if (!page) throw new Error('The recorded page is unavailable.');
113
+ await page.waitForLoadState('domcontentloaded');
114
+ // Add the agreed interactions and assertions on this page.
115
+ console.log(await page.title());
116
+ } finally {
117
+ await browser.close(); // Disconnect this CDP client; preserve the recorded browser.
118
+ }
119
+ JS
120
+ node "$rill_automation_dir/run.mjs" "<cdpUrl>"
121
+ rill record stop <recording-id> --no-wait
122
+ rill record status <recording-id>
123
+ ```
124
+
125
+ Replace the placeholders with start's actual values. This snippet verifies attachment only until you add your flow assertions. Keep the directory for retries and remove it when finished. Playwright documents the [connected-browser disconnect behavior](https://playwright.dev/docs/api/class-browser#browser-close).
126
+
89
127
  Capture follows the first page selected at recording start. Keep the flow in that page: new tabs and popups do not receive complete video and diagnostic coverage. Keep the recorded page open until Rill stops.
90
128
 
91
129
  ### Recording options
@@ -145,10 +183,13 @@ Use `rill --help` or `<command> --help` for supported flags.
145
183
  | Command | Behavior |
146
184
  | --- | --- |
147
185
  | `rill login` | Authorize a device code and store a credential. |
186
+ | `rill whoami` | Verify the saved identity and account email. |
187
+ | `rill connect --email <email> [--no-wait]` | Start or resume account approval. |
188
+ | `rill connect status <authorization-id>` | Poll a saved approval once; obey `retryAfterSeconds`. |
148
189
  | `rill doctor` | Check prerequisites, API compatibility, and authentication. |
149
190
  | `rill record start [options]` | Start a managed or attached browser recording. |
150
191
  | `rill record stop <recording-id>` | Finalize and upload; supports `--no-wait` and `--no-feedback`. |
151
- | `rill record status <recording-id>` | Read the remote encoding job first; otherwise check local capture state with a remote fallback. |
192
+ | `rill record status <recording-id>` | Read remote state first, then local capture for unsubmitted recordings; local completion is `captured`. |
152
193
  | `rill record retry <recording-id>` | Resume a retained remote capture or retry a failed encode; supports `--no-wait`. |
153
194
  | `rill record cancel <recording-id>` | Abandon a run created by this credential and release its remote quota reservation. |
154
195
  | `rill upload <video-file>` | Upload video-only evidence; supports `--title` and `--no-wait`. |
@@ -182,14 +223,18 @@ Success exits 0; command failures exit 1. Runtime failures emit an `error` objec
182
223
 
183
224
  Check the exit status first, then structured fields. Known codes include `authentication_required`, `scope_denied`, `quota_exceeded`, `browser_unavailable`, `recording_not_found`, `upload_interrupted`, `processing_failed`, `share_revoked`, `validation_failed`, and the fallback `internal_error`. Not every failure has a specific code; avoid branching on message text.
184
225
 
226
+ Lifecycle recovery also distinguishes `unsupported_platform`, `processing_pending`, `authorization_not_found`, `expired_token`, and `access_denied`. An elapsed playback wait is pending, while a confirmed remote failure remains `processing_failed`.
227
+
185
228
  ## Recovery and troubleshooting
186
229
 
187
230
  - **Doctor fails:** read the failed check's recovery field. Correct the credential, API connectivity, or executable path before recording.
188
- - **Quota exceeded:** inspect `error.details.quota.type` and `blockingRecordingId` when present. Check the blocking recording; cancel only an abandoned run. Review storage and daily allowance in Billing.
231
+ - **Quota exceeded:** inspect `error.details.quota.type` and `blockingRecordingId` when present. Uploading and processing recordings still hold the concurrency slot. Run the returned status command and wait for `ready`; if it reports `captured`, run its stop command to upload. Cancel only an abandoned run. Review storage and daily allowance in Billing.
189
232
  - **Remote upload interrupted or encoding failed:** keep the recording ID and local capture files. Run `rill record status <recording-id>`, then `rill record retry <recording-id>` with the original credential before capture expiry. Retry resumes accepted chunks or requeues the encode without repeating browser actions. A `ready` result needs a share URL before you return it as evidence.
190
- - **Duration limit reached:** local capture finalizes automatically, but `record stop` is still needed to upload.
233
+ - **Duration limit reached:** local capture finalizes automatically. Status reports `captured`, `source: "local"`, and the exact `nextCommand` to upload. It is not a playable share. Run `record stop <recording-id> --no-wait`, then poll status.
234
+ - **Upload reached 100%:** transfer has finished; encoding/playback processing may continue. `--no-wait` returns after submission with a status command. A polling timeout reports `processing_pending`, not a confirmed processing failure.
235
+ - **Windows:** Chrome discovery, current-user DPAPI credential storage, and authenticated named-pipe recording are available in CLI 0.1.14. Use remote encoding by default; local encoding requires FFmpeg on PATH. Unset `RILL_SOCKET`; use `RILL_HOME` to isolate recorder identity and credentials. Returned commands use Windows PowerShell quoting.
191
236
  - **Terminal closed:** after upload acceptance, the server finishes independently; retrieve the result with `record status`. Before acceptance, retry from the original machine while its captured frames remain available.
192
- - **Local session missing:** `record status` checks for a remote encoding job before falling back to local or remote recording state. `drafts list` locates local directories, which may be incomplete. There is no `drafts resume` command.
237
+ - **Local session missing:** `record status` checks remote encoding and recording state. Remote processing/completion takes precedence over retained local artifacts. For captures not submitted, it checks the local recorder. Remote authorization/network errors are surfaced rather than being masked by local readiness. `drafts list` locates local directories, which may be incomplete. There is no `drafts resume` command.
193
238
  - **Share cannot be inspected:** open the complete URL in a browser; ask the owner for a current link if needed.
194
239
 
195
240
  A failed local startup automatically attempts to cancel the remote reservation it just created. `record cancel` changes remote state and does not stop the local browser; finish local capture before abandoning the remote reservation.
@@ -214,7 +259,7 @@ Set recorder variables before starting the background recorder; an existing reco
214
259
 
215
260
  ## Sharing and privacy
216
261
 
217
- Ready recordings get an unlisted share link that expires after seven days. In the recording page, copy it, replace it with a fresh link, or stop sharing. Finished recordings can be deleted after a five-second undo window.
262
+ Anonymous and connected-local CLI recordings receive an unlisted link when ready. Anonymous recordings and their links expire seven days after creation; connected-local share links normally expire after seven days. Connecting an account does not make these links private. Signed-in cloud runs and saved screen recordings start private to the workspace; create a share link separately. Guest cloud results are available in the originating browser and through a secure emailed link for seven days. Existing private recordings retain their visibility. In the recording page, create or copy a share link, replace it with a fresh link, or stop sharing. Finished recordings can be deleted after a five-second undo window.
218
263
 
219
264
  Diagnostic redaction targets cookies, credential headers, URL query values, fragments, embedded credentials, and secret-shaped values. Network-body capture defaults off and is controlled by the human-issued credential; the agent cannot enable it for itself. Redaction is best-effort and does not mask the video. Avoid displaying secrets, review evidence before sharing, and treat share URLs as sensitive.
220
265
 
@@ -285,10 +330,16 @@ Progress runs through `uploading` → `queued` → `encoding` → `processing`
285
330
 
286
331
  `rill record start` can begin without sign-in when the server supports anonymous access. The CLI stores the identity in the OS credential store and uses local encoding. Anonymous access includes three successful recordings, at most five minutes and 250 MB each; each recording and its unlisted share link expires seven days after creation. Failed uploads do not consume the successful-recording allowance. Source and service rate limits also apply.
287
332
 
288
- Run `rill connect --email you@example.com` to authorize account access or keep your anonymous recordings. Open the displayed link, sign in, and enter the code yourself. Approval allows creation and reading of your existing and new recordings for 90 days, with automatic renewal of one-hour access tokens. Revoke the connection in Rill's Credentials page to stop access and renewal. Deletion and changes to existing sharing settings are not included.
333
+ Run `rill connect --email you@example.com` to authorize account access or keep your anonymous recordings. Open the displayed link, sign in, and enter the code yourself. Approval allows creation and reading of your existing and new recordings for 90 days, with automatic renewal of one-hour access tokens. Revoke the connection in Settings → Agent access to stop access and renewal. Deletion and changes to existing sharing settings are not included.
289
334
 
290
- Use `rill record list` to list accessible recordings and `rill inspect <recording-id>` for private recording details. `rill inspect <share-url>` continues to work without account access. The existing `rill login` and `RILL_TOKEN` flows remain supported. Local credential storage requires macOS Keychain or Linux Secret Service.
335
+ Use `rill record list` to list accessible recordings and `rill inspect <recording-id>` for private recording details. `rill inspect <share-url>` continues to work without account access. The existing `rill login` and `RILL_TOKEN` flows remain supported. Local credential storage requires macOS Keychain, Linux Secret Service, or Windows current-user DPAPI.
291
336
 
292
337
  ### Check the connected account
293
338
 
294
339
  Run `rill whoami` (or `rill --pretty whoami`) to verify your current identity. JSON output includes status, account email when available, workspace, scopes, and access expiry. It uses RILL_TOKEN when set, otherwise the saved OS credential. Existing access can renew automatically; it never creates an identity or opens an approval flow. Missing credentials return `not_connected` and exit 1. Invalid or revoked credentials return an error.
340
+
341
+ ### Capture time and upload progress (0.1.14)
342
+
343
+ `record start` and active local `record status` return `startedAt`, `stopsAt`, `maxDurationSeconds`, `elapsedSeconds`, and `remainingSeconds`. Use the remaining time to budget retries. After automatic capture stop, status reports `captured` with the stop/upload command; zero remaining time does not mean playback is ready. Fields may be absent for recovered drafts or an older daemon.
344
+
345
+ Remote frame uploads write accepted/total MiB, transfer speed and an approximate remaining transfer time to stderr. Estimates use this attempt's observed transfers, including retry delays, and exclude previously uploaded bytes. They do not estimate queue or encoding time. JSON stdout stays machine readable. Failed local captures offer an explicit cancellation command for their remote slot; local drafts are retained.