@rtrvr-ai/rover 2.3.0 → 3.0.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.
package/README.md CHANGED
@@ -13,6 +13,8 @@ Embed on websites, browser extensions, Electron apps, or any DOM environment.
13
13
 
14
14
  You need an rtrvr.ai account with available credits. Free accounts get 250 credits/month. [Sign up or manage your plan](https://www.rtrvr.ai/cloud?view=pricing).
15
15
 
16
+ Before you test Rover on arbitrary websites, get your site config from Workspace first. Hosted Preview is the only path that does not require Workspace config.
17
+
16
18
  ## Quick Start (Script Tag)
17
19
 
18
20
  Add this snippet before `</body>` on any page:
@@ -37,6 +39,13 @@ Add this snippet before `</body>` on any page:
37
39
  <script src="https://rover.rtrvr.ai/embed.js" async></script>
38
40
  ```
39
41
 
42
+ If RoverBook is enabled for the site in Rover Workspace, the generated install snippet also includes `https://rover.rtrvr.ai/roverbook.js` plus an inline attach block that calls `window.RoverBook.enableRoverBook(window.rover, ...)`. Copy the Workspace snippet as-is for production installs.
43
+
44
+ Workspace also controls site mode:
45
+
46
+ - `Full Rover agent`: action-capable Rover runtime
47
+ - `RoverBook analytics-only`: embed-oriented RoverBook deployment with action tools disabled
48
+
40
49
  Get `siteId`, `publicKey` (`pk_site_*`), and optional `siteKeyId` from Rover Workspace:
41
50
 
42
51
  - `https://rover.rtrvr.ai/workspace`
@@ -52,6 +61,7 @@ Or use the single-tag shorthand with data attributes:
52
61
  <script src="https://rover.rtrvr.ai/embed.js"
53
62
  data-site-id="YOUR_SITE_ID"
54
63
  data-public-key="pk_site_YOUR_PUBLIC_KEY"
64
+ data-session-token="rvrsess_YOUR_SHORT_LIVED_SESSION_TOKEN"
55
65
  data-allowed-domains="yourdomain.com"
56
66
  data-domain-scope-mode="registrable_domain">
57
67
  </script>
@@ -59,6 +69,8 @@ Or use the single-tag shorthand with data attributes:
59
69
 
60
70
  Use `data-domain-scope-mode="host_only"` to require exact host matches. Plain entries such as `example.com` become exact-host rules in `host_only` mode. In the default `registrable_domain` mode, plain entries match the apex host and its subdomains, while `*.example.com` matches subdomains only.
61
71
 
72
+ For temporary preview sessions, `data-session-token` can bootstrap Rover without a `publicKey`. If you also have a `sessionId`, add `data-session-id` for a stable runtime boundary.
73
+
62
74
  Common patterns:
63
75
 
64
76
  - `allowedDomains: ['example.com']` with `registrable_domain` allows `example.com` and all subdomains.
@@ -66,6 +78,182 @@ Common patterns:
66
78
  - `allowedDomains: ['app.example.com']` with `registrable_domain` allows `app.example.com` and its subdomains, but not sibling hosts.
67
79
  - `allowedDomains: ['example.com']` with `host_only` allows only the exact host `example.com`.
68
80
 
81
+ ## Preview Helpers
82
+
83
+ The SDK also exports generic helper utilities for live demos and previews:
84
+
85
+ ```ts
86
+ import {
87
+ attachLaunch,
88
+ createRoverBookmarklet,
89
+ createRoverConsoleSnippet,
90
+ createRoverScriptTagSnippet,
91
+ } from '@rtrvr-ai/rover';
92
+ ```
93
+
94
+ Use `createRoverConsoleSnippet(...)` and `createRoverBookmarklet(...)` to generate one-click bootstrap payloads, and `attachLaunch(...)` when you want to attach a pre-created launch from code.
95
+
96
+ Before you use any of these helpers on another website:
97
+
98
+ 1. Open Rover Workspace.
99
+ 2. Create or rotate a site key so Workspace reveals the full `pk_site_*` value.
100
+ 3. Copy the **test config JSON** from Workspace.
101
+ 4. Either paste that JSON into the Rover website's "Try on Other Sites" tool, or pass the same values into the SDK helpers below.
102
+
103
+ ### Which helper to use
104
+
105
+ | Path | What you need | Best for | Persistence |
106
+ |---|---|---|---|
107
+ | Hosted Preview | Signed-in URL + prompt | Rover-managed demos | Temporary preview session |
108
+ | Preview Helper | Workspace test config JSON or hosted handoff | Multi-page desktop demos | Re-injects after reload/navigation |
109
+ | Console | Workspace test config JSON + generated snippet | Fast DevTools demos | Current page only |
110
+ | Bookmarklet | Workspace test config JSON + generated bookmarklet | Drag-and-click demos | Current page only |
111
+ | Production install | Workspace install snippet | Real site install | Persistent |
112
+
113
+ - `createRoverConsoleSnippet(...)`
114
+ Best for desktop demos, debugging, and screen-sharing when you can paste into DevTools.
115
+ - `createRoverBookmarklet(...)`
116
+ Best for quick one-click demos across many pages, with the same current-page limitations as manual injection.
117
+ - `createRoverScriptTagSnippet(...)`
118
+ Best for generating an actual snippet from known config values such as Workspace `siteId` and `publicKey`.
119
+ - `attachLaunch(...)`
120
+ Best when you already created a launch elsewhere and want Rover to attach to it after boot.
121
+
122
+ ### Example: console snippet from Workspace config
123
+
124
+ ```ts
125
+ import { createRoverConsoleSnippet } from '@rtrvr-ai/rover';
126
+
127
+ const snippet = createRoverConsoleSnippet({
128
+ siteId: 'site_123',
129
+ publicKey: 'pk_site_123',
130
+ siteKeyId: 'key_123',
131
+ allowedDomains: ['example.com'],
132
+ domainScopeMode: 'registrable_domain',
133
+ apiBase: 'https://agent.rtrvr.ai',
134
+ openOnInit: true,
135
+ mode: 'full',
136
+ allowActions: true,
137
+ });
138
+ ```
139
+
140
+ ### Example: bookmarklet from Workspace config
141
+
142
+ ```ts
143
+ import { createRoverBookmarklet } from '@rtrvr-ai/rover';
144
+
145
+ const bookmarklet = createRoverBookmarklet({
146
+ siteId: 'site_123',
147
+ publicKey: 'pk_site_123',
148
+ siteKeyId: 'key_123',
149
+ allowedDomains: ['example.com'],
150
+ domainScopeMode: 'registrable_domain',
151
+ apiBase: 'https://agent.rtrvr.ai',
152
+ });
153
+ ```
154
+
155
+ ### Example: production script-tag snippet from Workspace config
156
+
157
+ ```ts
158
+ import { createRoverScriptTagSnippet } from '@rtrvr-ai/rover';
159
+
160
+ const snippet = createRoverScriptTagSnippet({
161
+ siteId: 'site_123',
162
+ publicKey: 'pk_site_123',
163
+ siteKeyId: 'key_123',
164
+ allowedDomains: ['example.com'],
165
+ domainScopeMode: 'registrable_domain',
166
+ apiBase: 'https://agent.rtrvr.ai',
167
+ });
168
+ ```
169
+
170
+ ### Example: attach a pre-created launch
171
+
172
+ ```ts
173
+ import { attachLaunch, boot } from '@rtrvr-ai/rover';
174
+
175
+ boot({
176
+ siteId: 'preview_site',
177
+ sessionToken: 'rvrsess_short_lived_token',
178
+ allowedDomains: ['example.com'],
179
+ domainScopeMode: 'host_only',
180
+ });
181
+
182
+ attachLaunch({
183
+ requestId: 'rl_123',
184
+ attachToken: 'attach_123',
185
+ });
186
+ ```
187
+
188
+ ### Two config sources
189
+
190
+ Use one of these sources for the helper functions above:
191
+
192
+ - **Workspace production config**
193
+ Persistent `siteId`, `publicKey`, optional `siteKeyId`, `allowedDomains`, and `domainScopeMode` from Rover Workspace.
194
+ - **Hosted preview config**
195
+ Short-lived preview/runtime values produced by Rover Instant Preview on the website or by your own preview service.
196
+
197
+ Get Workspace config from:
198
+
199
+ - [https://www.rtrvr.ai/rover/workspace](https://www.rtrvr.ai/rover/workspace)
200
+ - [https://rover.rtrvr.ai/workspace](https://rover.rtrvr.ai/workspace)
201
+
202
+ If you want the exact human walkthrough instead of jumping straight into code:
203
+
204
+ - website guide: [https://www.rtrvr.ai/rover/docs/try-on-other-sites](https://www.rtrvr.ai/rover/docs/try-on-other-sites)
205
+ - repo guide: [../../docs/TRY_ON_OTHER_SITES.md](../../docs/TRY_ON_OTHER_SITES.md)
206
+ - one-click helper path: use the website tool's `Open target with helper` action after pasting the Workspace config
207
+
208
+ If you want a public extension that can use either config source, see the Preview Helper app:
209
+
210
+ - [https://github.com/rtrvr-ai/rover/tree/main/apps/preview-helper](https://github.com/rtrvr-ai/rover/tree/main/apps/preview-helper)
211
+ - [https://www.rtrvr.ai/rover/docs/instant-preview-api](https://www.rtrvr.ai/rover/docs/instant-preview-api)
212
+
213
+ ### Hosted preview handoff behavior
214
+
215
+ The open-source helper extension understands hosted preview handoff URLs that include:
216
+
217
+ - `rover_preview_id`
218
+ - `rover_preview_token`
219
+ - `rover_preview_api`
220
+
221
+ When those are present, the helper can fetch the short-lived preview config from the hosted Rover API and reconnect it across navigation.
222
+
223
+ ### Security notes
224
+
225
+ - `pk_site_*` values are Workspace install credentials for a real site.
226
+ - `rvrsess_*` values are short-lived runtime session credentials.
227
+ - Preview tokens are demo credentials and should be treated as ephemeral.
228
+ - Do not treat preview tokens as a replacement for production Workspace site keys.
229
+ - Keep preview or helper injections scoped to the intended host with `allowedDomains` and the right `domainScopeMode`.
230
+ - Generic `publicKey` config is the normal Workspace path. `sessionToken` is the temporary preview/runtime path.
231
+
232
+ ### Troubleshooting
233
+
234
+ - **`This API key is missing capability: roverEmbed`**
235
+ Your Workspace key is not embed-enabled. Rotate or create an embed-ready key, then rebuild the snippet or bookmarklet from the fresh test config JSON.
236
+ - **`React has blocked a javascript: URL`**
237
+ Delete any old Rover bookmarklet and recreate it from the latest Rover Live Test page. The bookmarklet must be dragged from Rover's dedicated drag control, not clicked on the Rover page itself.
238
+ - **Console or Bookmarklet worked once, then stopped**
239
+ Those are current-page-only methods. A full reload drops the injected JavaScript.
240
+ - **A site still blocks Rover after you generated valid output**
241
+ Some sites enforce strict CSP or reload aggressively. Use the Preview Helper or Hosted Preview instead.
242
+ - **`Open hosted shell` does nothing**
243
+ Hosted Preview should open Rover's dedicated hosted viewer route, not the launcher page.
244
+
245
+ ### Hosted playground
246
+
247
+ If you want the full managed preview flow, including preview creation and Workspace handoff, use the hosted website:
248
+
249
+ - [https://www.rtrvr.ai/rover/instant-preview](https://www.rtrvr.ai/rover/instant-preview)
250
+
251
+ More architecture detail:
252
+
253
+ - [Instant Preview architecture](https://github.com/rtrvr-ai/rover/blob/main/docs/INSTANT_PREVIEW.md)
254
+ - [Hosted preview API docs](https://www.rtrvr.ai/rover/docs/instant-preview-api)
255
+ - [Hosted preview OpenAPI spec](https://raw.githubusercontent.com/rtrvr-ai/rtrvr-cloud-backend/main/docs/rover-instant-preview.openapi.yaml)
256
+
69
257
  ## npm Install
70
258
 
71
259
  ```bash
@@ -303,6 +491,26 @@ Content-Type: application/json
303
491
  { "url": "https://www.rtrvr.ai", "prompt": "get me the latest blog post" }
304
492
  ```
305
493
 
494
+ Callers may also provide structured visiting-agent metadata:
495
+
496
+ ```http
497
+ POST https://agent.rtrvr.ai/v1/tasks
498
+ Content-Type: application/json
499
+
500
+ {
501
+ "url": "https://www.rtrvr.ai",
502
+ "prompt": "get me the latest blog post",
503
+ "agent": {
504
+ "key": "gpt-5.4-demo-agent",
505
+ "name": "GPT-5.4 Demo Agent",
506
+ "vendor": "OpenAI",
507
+ "model": "gpt-5.4",
508
+ "version": "2026-03",
509
+ "homepage": "https://openai.com"
510
+ }
511
+ }
512
+ ```
513
+
306
514
  Anonymous AI callers do **not** need `siteId`, `publicKey`, or `siteKeyId`.
307
515
 
308
516
  The returned task URL is the canonical resource:
@@ -327,6 +535,18 @@ The task URL remains canonical; receipt links are only a browser handoff layer o
327
535
 
328
536
  Rover deep links like `?rover=` and `?rover_shortcut=` remain the simple browser-first entrypoints; `/v1/tasks` is the machine-oriented protocol. Cross-site workflows and handoffs extend that same public contract rather than replacing it.
329
537
 
538
+ ### Agent identity attribution
539
+
540
+ Rover normalizes visiting-agent attribution in this order:
541
+
542
+ 1. verified signal
543
+ 2. explicit `agent` object on public task creation or handoffs
544
+ 3. heuristic headers such as `User-Agent`, `Signature-Agent`, `Signature`, `Signature-Input`, and `X-RTRVR-Client-Id`
545
+ 4. advanced local fallbacks such as RoverBook `identityResolver`
546
+ 5. anonymous fallback
547
+
548
+ Current launch behavior emits `self_reported`, `heuristic`, and `anonymous`. `verified` remains reserved for a real verifier and is not inferred from plain headers alone.
549
+
330
550
  ### Cross-site workflows and handoffs
331
551
 
332
552
  Public tasks can delegate to Rover on another Rover-enabled site without leaving the same protocol surface.
@@ -335,6 +555,8 @@ Public tasks can delegate to Rover on another Rover-enabled site without leaving
335
555
  - `GET /v1/workflows/{id}` returns aggregated workflow state or stream
336
556
  - child tasks inherit the same workflow lineage as the parent
337
557
 
558
+ Handoff creation also accepts the optional `agent` object so a child task can inherit or explicitly override visiting-agent attribution.
559
+
338
560
  Receiving sites must explicitly opt in through Workspace/site config:
339
561
 
340
562
  - `aiAccess.enabled = true`
@@ -400,6 +622,8 @@ rover.send('Hello');
400
622
  | `getState()` | Get current runtime state |
401
623
  | `update(config)` | Update configuration without rebooting |
402
624
  | `registerTool(def, handler)` | Register a client-side tool |
625
+ | `requestSigned(url, init?)` | Issue a fetch signed with the current Rover session token and site/session headers |
626
+ | `registerPromptContextProvider(provider)` | Inject bounded prompt context before a fresh Rover task/run |
403
627
  | `identify(visitor)` | Update visitor profile after boot (for async login/user hydration) |
404
628
  | `on(event, handler)` | Subscribe to events (returns unsubscribe fn) |
405
629
 
@@ -423,12 +647,17 @@ rover.on('error', (err) => console.error(err));
423
647
  | `navigation_guardrail` | `{ url, policy }` | Out-of-scope navigation intercepted |
424
648
  | `task_started` | `{ reason }` | New task started |
425
649
  | `task_ended` | `{ reason }` | Task ended |
650
+ | `run_started` | `{ taskId, runId, taskBoundaryId, state, taskComplete, needsUserInput, summary? }` | Public run lifecycle start event |
651
+ | `run_state_transition` | `{ taskId, runId, taskBoundaryId, state, taskComplete, needsUserInput, summary?, error? }` | Public run lifecycle transition |
652
+ | `run_completed` | `{ taskId, runId, taskBoundaryId, state, taskComplete, needsUserInput, summary?, error? }` | Terminal public run lifecycle event |
426
653
  | `checkpoint_state` | `{ state, reason?, action?, code?, message? }` | Checkpoint sync state updates |
427
654
  | `checkpoint_error` | `{ action, code?, message, ... }` | Checkpoint request failure details |
428
655
  | `tab_event_conflict_retry` | `{ runId, conflict?, ... }` | One stale seq/epoch tab-event conflict was recovered by silent retry |
429
656
  | `tab_event_conflict_exhausted` | `{ runId, conflict?, ... }` | Tab-event stale conflict retry exhausted (non-fatal; projection sync follows) |
430
657
  | `checkpoint_token_missing` | `{ action, status }` | Legacy checkpoint browser path blocked |
431
658
 
659
+ `requestSigned(...)` and `registerPromptContextProvider(...)` are the main extension points RoverBook uses for signed analytics writes and memory injection.
660
+
432
661
  ## Content Security Policy (CSP)
433
662
 
434
663
  If your site sets a CSP header, add these directives: