@vitrinka/web 0.5.2 → 0.6.0

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 (43) hide show
  1. package/CHANGELOG.md +73 -3
  2. package/README.md +70 -18
  3. package/build/hud.iife.js +150 -28
  4. package/build/protocol/index.d.ts +10 -0
  5. package/build/recorder/capture/click.js +2 -2
  6. package/build/recorder/capture/nav.js +1 -1
  7. package/build/recorder/capture/redact.d.ts +10 -2
  8. package/build/recorder/capture/redact.js +53 -3
  9. package/build/recorder/config.d.ts +10 -0
  10. package/build/recorder/config.js +1 -0
  11. package/build/recorder/flight.d.ts +5 -0
  12. package/build/recorder/flight.js +5 -2
  13. package/build/recorder/hud/Hud.js +206 -31
  14. package/build/recorder/hud/NotesSheet.d.ts +24 -0
  15. package/build/recorder/hud/NotesSheet.js +147 -0
  16. package/build/recorder/hud/RecorderPill.d.ts +34 -12
  17. package/build/recorder/hud/RecorderPill.js +52 -14
  18. package/build/recorder/hud/Sheet.d.ts +18 -15
  19. package/build/recorder/hud/Sheet.js +13 -13
  20. package/build/recorder/hud/controller.d.ts +81 -4
  21. package/build/recorder/hud/drop.d.ts +26 -0
  22. package/build/recorder/hud/drop.js +35 -0
  23. package/build/recorder/hud/icons.d.ts +6 -0
  24. package/build/recorder/hud/icons.js +12 -0
  25. package/build/recorder/hud/notes-rows.d.ts +39 -0
  26. package/build/recorder/hud/notes-rows.js +49 -0
  27. package/build/recorder/hud/resize.d.ts +6 -3
  28. package/build/recorder/hud/resize.js +8 -4
  29. package/build/recorder/hud/styles.d.ts +1 -19
  30. package/build/recorder/hud/styles.js +62 -19
  31. package/build/recorder/index.d.ts +8 -0
  32. package/build/recorder/index.js +1 -0
  33. package/build/recorder/page-controller.js +13 -7
  34. package/build/recorder/queue.d.ts +22 -1
  35. package/build/recorder/queue.js +84 -5
  36. package/build/recorder/recents.d.ts +20 -4
  37. package/build/recorder/recents.js +41 -6
  38. package/build/recorder/report.js +3 -11
  39. package/build/recorder/session.d.ts +25 -6
  40. package/build/recorder/session.js +53 -11
  41. package/build/recorder/version.d.ts +2 -2
  42. package/build/recorder/version.js +1 -1
  43. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,71 @@
1
1
  # @vitrinka/web
2
2
 
3
+ ## 0.6.0
4
+
5
+ The pill now says what it is doing at every step, and keeps what you write.
6
+
7
+ - **After Stop: Saving… → Building board · k/n → Board ready.** "Saved"
8
+ used to mean only that the server accepted the Stop, and the board link
9
+ appeared later without a word. The pill now shows the server's build
10
+ (`projection` step and progress) and then **Board ready · Open board**. A
11
+ failed build says so, with **Retry** when another pass can fix it (the
12
+ Retry closes the session again, a door a recorder token already has). The
13
+ ✕ became **Done**: it only ever dismissed the face.
14
+ - **Start reads as an action.** The idle dot is red, **Starting…** shows
15
+ while a session boots, the ⋯ keeps the tray's inset from the pill's edge,
16
+ and a one-time hint per site says what Start does.
17
+ - **The sync chip left the tray.** The rec dot carries the sync state as a
18
+ ring (green, amber backlog, warn offline, red ended); while the tools are
19
+ out, a float above the pill counts what the server acknowledged — actions,
20
+ frames, notes, pages (`HudSync.acked`).
21
+ - **History.** A tray button lists the recording's notes and annotations in
22
+ the board annotation island's layout. **Save edit** sends a NEW note with
23
+ `replaces: <cid>` (the stream stays append-only; the board keeps the
24
+ versions in the thread); **reference** starts a note carrying `refs:
25
+ [<cid>]`, which the board turns into an annotation ref. Every note now
26
+ carries a client id, `cid` (`docs/PROTOCOL.md`). The list is kept on the
27
+ device for the recording's life (a recorder token reads nothing back).
28
+ - **The composer.** The `board | task` toggle is gone: everything lands on
29
+ the board. The sheet names what an annotation points at — its crop where
30
+ the host can read pixels (`HudController.captureRegion`, the extension),
31
+ else its size and route — with **Reselect**. A dragged height is now a
32
+ minimum: releasing the grip never snaps the box back. A draft left by a
33
+ click on the page parks as a small drop on the pill; hover previews it, a
34
+ click resumes it.
35
+ - **Honest flashes.** The clock says **queued** until the server
36
+ acknowledged a note, then **Saved** (`HudSync.pendingNotes`). A note
37
+ written while paused is queued and sent instead of dropped.
38
+ - **A recording in another tab** shows a quiet "Recording in another tab"
39
+ pill instead of no recorder at all (`HudSnapshot.followingElsewhere`).
40
+ - **Controller contract.** `HudAnnotation.task` is removed; `note` and
41
+ `annotate` take a `HudNoteLink`; `listNotes`, `captureRegion` and
42
+ `retryBuild` are optional. A host that omits them gets today's behaviour
43
+ for that part.
44
+
45
+ ## 0.5.3
46
+
47
+ - **Credentials in URL paths no longer reach vitrinka (`sanitizeUrl`).**
48
+ The recorder scrubbed secrets only in query strings and fragments, and
49
+ recorded `route` fields with no redaction at all. An app whose routes
50
+ carry tokens in the path (`/reset-password/:token`, `/cart/:id/:token`,
51
+ `/invite/:token`) uploaded them with every session and bug report.
52
+ `VitrinkaRecorderRoot` and `RecorderConfig` now take an optional
53
+ `sanitizeUrl: (url: string) => string`. It rewrites every URL and route
54
+ the recorder captures before the redaction engine scrubs it:
55
+ - navigation `url` and `route`, including the page a session starts on;
56
+ - the `route` of clicks, notes and annotations;
57
+ - network request URLs;
58
+ - the page URL on each rrweb full snapshot;
59
+ - a bug report's navigation and note.
60
+
61
+ It applies under `fullFidelity` too. A sanitizer that throws or returns a
62
+ non-string fails closed: the recorder keeps only the URL's origin, or
63
+ `[redacted]` when there is none, and logs one warning. See
64
+ [Credentials in URL paths](README.md#credentials-in-url-paths-sanitizeurl).
65
+ - **Routes are redacted.** Every `route` field now passes the same scrub as
66
+ a URL, so a workspace's value patterns reach routes too. Without a
67
+ `sanitizeUrl`, a route that matches no pattern is recorded as before.
68
+
3
69
  ## 0.5.2
4
70
 
5
71
  - **A page that leads keeps the recording against an extension that is only
@@ -7,9 +73,13 @@
7
73
  extension records in another tab) also fired on the `starting` the
8
74
  extension's Start probe announces before it reads the page's claim. The
9
75
  page stepped aside and the extension's Start went through instead of being
10
- refused (extension 0.11.0 against web 0.5.1). The page now yields only to
11
- an extension recording or paused elsewhere; a probe meets the claim and is
12
- refused, as first-to-start-leads demands.
76
+ refused. The page now yields only to an extension recording or paused
77
+ elsewhere, so a `starting` probe meets the claim and is refused. This does
78
+ not cover extension 0.11.0. Its `one.js` announces `recording` as soon as
79
+ the Start probe installs it, before the probe reads the claim, and a page
80
+ cannot tell that apart from a real recording in another tab. Use extension
81
+ 0.11.1 or later, which installs `one.js` only where no recorder already
82
+ leads.
13
83
 
14
84
  ## 0.5.1
15
85
 
package/README.md CHANGED
@@ -88,6 +88,50 @@ can file each app's sessions into its own project: pass `project` per app.
88
88
  Without it, the host's project rule decides; a recorder key's project pin
89
89
  always wins, and a different `project` is refused.
90
90
 
91
+ ### Credentials in URL paths (`sanitizeUrl`)
92
+
93
+ The redaction engine scrubs secrets in query strings and fragments
94
+ (`?token=…`, `#access_token=…`), but it cannot know which path segments of
95
+ your routes are credentials. A reset link at `/reset-password/<token>` or a
96
+ guest cart at `/cart/<id>/<token>` would otherwise reach vitrinka in every
97
+ navigation, click, note and bug report. Name them with `sanitizeUrl`:
98
+
99
+ ```tsx
100
+ // Each rule rewrites a path segment that IS a credential into a placeholder.
101
+ const SECRET_PATHS: [RegExp, string][] = [
102
+ [/\/(reset-password|set-password|invite|activation)\/[^/?#]+/g, '/$1/:token'],
103
+ [/\/cart\/([^/?#]+)\/[^/?#]+/g, '/cart/$1/:cartToken'],
104
+ [/\/verify-email\/[^/?#]+\/[^/?#]+/g, '/verify-email/:id/:hash'],
105
+ ];
106
+ const sanitizeUrl = (url: string) => SECRET_PATHS.reduce((u, [rx, to]) => u.replace(rx, to), url);
107
+
108
+ <VitrinkaRecorderRoot url={…} sanitizeUrl={sanitizeUrl}>
109
+ ```
110
+
111
+ - **Coverage:** it runs on every URL and route the recorder captures:
112
+ - navigation `url` and `route`, including the page a session starts on;
113
+ - the `route` of clicks, notes and annotations;
114
+ - network request URLs;
115
+ - the page URL on each rrweb full snapshot;
116
+ - a bug report's navigation and note.
117
+ - **Input:** it receives each string as captured: an absolute page URL, a
118
+ request URL as your code passed it (often relative), or a bare path. Match
119
+ on path segments, not on a URL you parse.
120
+ - **Order:** it runs first. The query/fragment scrub and your workspace's
121
+ patterns still apply to what it returns, and routes now pass them too.
122
+ - **`fullFidelity`:** it applies even under a `fullFidelity` policy. It is
123
+ your statement about your own URLs, not a workspace redaction rule.
124
+ - **Failure:** it fails closed. If it throws or returns a non-string, the
125
+ recorder keeps only the URL's origin (or `[redacted]` when there is none),
126
+ never the raw value. It logs one `vitrinka:` warning per sanitizer, saying
127
+ whether it threw or returned a non-string, and nothing of the thrown value
128
+ (its message or name may quote the URL).
129
+ - **Not covered:** free text and the DOM stay under the workspace policy:
130
+ request and response headers and bodies, console lines (a router error
131
+ that quotes the path, say), and the page's own text and links. Add a policy
132
+ pattern for a token shape that shows up in text. If a page renders a
133
+ credential as visible text or in a link, mark that element `.rr-block`.
134
+
91
135
  ### Env vars
92
136
 
93
137
  | Var | What |
@@ -118,19 +162,23 @@ returned unchanged otherwise.
118
162
  ## Using the pill
119
163
 
120
164
  Idle, the HUD is a 28px glass puck: a hollow ring until the device is linked
121
- (**Link recorder**), a muted dot once it is (**Start recording** — the session
122
- title is `document.title`, or the `title` prop); the label and a ⋯ slide out
123
- on hover or focus. Recording, it rests as a dot + timer capsule (**Recorder
124
- controls**) that unfolds into the tools on hover, focus or tap and folds back
125
- 2.5s after you leave (a tooltip names each tool and its shortcut):
165
+ (**Link recorder**), a red record dot once it is (**Start recording** — the
166
+ session title is `document.title`, or the `title` prop; **Starting…** while it
167
+ boots); the label and a ⋯ slide out on hover or focus. The first time on a
168
+ site a small hint says what Start does (**Start** · **Got it**). Recording, it
169
+ rests as a dot + timer capsule (**Recorder controls**) that unfolds into the
170
+ tools on hover, focus or tap and folds back 2.5s after you leave (a tooltip
171
+ names each tool and its shortcut). The dot's ring is the sync state; while the
172
+ tools are out, a float above the pill says what reached vitrinka — `on
173
+ vitrinka` (or `sending N`) · actions · frames · notes · pages:
126
174
 
127
175
  | Control | Shortcut | What |
128
176
  |---|---|---|
129
- | sync chip | | `synced` · `sending N` · `offline · N` · `ended` — readable without hovering |
130
- | ⏸ Pause / ▶ Resume | ⌥⇧P (Alt⇧P) | freezes the clock and capture |
131
- | ✎ Note | ⌥⇧N | the note sheet — Enter sends, ⇧Enter newline, Esc / ✕ / click-outside cancel (the draft and its images survive a cancel); the pill says **Saved**. Images: see [Attach images](#attach-images) |
132
- | ⌖ Annotate | ⌥⇧A | click or tap an element, or drag a region (a finger too). While annotating, the page gets no press, move or hover, does not scroll, and selects no text. Then describe it: `board` (an annotation on the board) or `task` (also filed as an intake draft) |
133
- | ■ Stop | ⌥⇧S | the pill asks **Stop & save?** (Esc / **Keep recording** cancels), shows **Saving…** with progress while the tail drains, then **Saved · Open board** until you dismiss it |
177
+ | ≣ History | | this recording's notes and annotations, newest first, in the board's annotation-island layout: open one to see its versions, **Save edit** (sent as a new note that `replaces` it), or **reference** it from a new note |
178
+ | ⏸ Pause / ▶ Resume | ⌥⇧P (Alt⇧P) | freezes the clock and capture (a note written while paused is still sent) |
179
+ | ✎ Note | ⌥⇧N | the note sheet — Enter sends, ⇧Enter newline, Esc / ✕ / click-outside cancel. A cancelled draft (and its images) parks as a small drop on the pill: hover shows its first line, a click resumes it. The clock says **queued**, then **Saved** once the server has the note. Images: see [Attach images](#attach-images) |
180
+ | ⌖ Annotate | ⌥⇧A | click or tap an element, or drag a region (a finger too). While annotating, the page gets no press, move or hover, does not scroll, and selects no text. Then describe it; the sheet names what you picked (its crop where the host can read pixels — the extension — else its size and route) with **Reselect**. Everything lands on the board |
181
+ | ■ Stop | ⌥⇧S | the pill asks **Stop & save?** (Esc / **Keep recording** cancels), shows **Saving…** with progress while the tail drains, then **Building board · k/n** while the server builds it, then **Board ready · Open board** until **Done** (a failed build says so, with **Retry**) |
134
182
  | ⋯ | | the linked account · **Report a bug** (below) · **Open this board** · **Recent** (this device's last five recordings, each linked to its board) · **Go to vitrinka** · **Size** S/M/L · **Technical details** · **Position** · **Unlink this device** (asks first) |
135
183
 
136
184
  Move it anywhere: drag the puck or capsule and it lands on one of eight
@@ -144,11 +192,11 @@ wherever the HUD sits: sideways from a vertical one. They flip and shift so
144
192
  they never leave the viewport. On a phone, sheets are a bottom sheet above
145
193
  the keyboard and the link sheet drops the QR.
146
194
 
147
- The sync chip is honest: `synced` means the server confirmed it holds
148
- everything captured. A backlog reads `sending N`. An outage reads
149
- `offline · N` (nothing is dropped; the tail is kept in `localStorage`). A
150
- session the server closed reads `ended`. A one-line detail also unfolds for
151
- an outage or an ended session. Stop drains first and refuses while the server
195
+ The sync state is honest: `on vitrinka` means the server confirmed it holds
196
+ everything captured. A backlog reads `sending N` (an amber ring). An outage
197
+ reads `offline · N` (nothing is dropped; the tail is kept in `localStorage`).
198
+ A session the server closed reads `ended` (a red ring). A one-line detail
199
+ also unfolds for an outage or an ended session. Stop drains first and refuses while the server
152
200
  is unreachable: the pill says so and offers **Retry**.
153
201
 
154
202
  **Size** and **Technical details** are user preferences. For a linked device
@@ -162,8 +210,9 @@ the recorder version.
162
210
  The note, annotate and bug-report sheet is 440 px wide at every HUD size,
163
211
  and its text box grows with what you type up to 20 rows, then scrolls. Drag
164
212
  the grip on the sheet's free corner (the one away from the pill) to change
165
- the width and that cap; on a phone the sheet spans the screen, so its grip
166
- changes the cap alone. With the grip focused, the arrow keys move it 16 px
213
+ the width and the height: a dragged height is kept as the box's minimum, and
214
+ a longer draft still grows past it up to the room it has. On a phone the
215
+ sheet spans the screen, so its grip changes the height alone. With the grip focused, the arrow keys move it 16 px
167
216
  (Shift: 64 px), and Enter or a double-click restores the default. The size is a
168
217
  preference too (`sheetW`, `sheetH` in CSS px, 0 = the default). It is sent
169
218
  in a PATCH of its own when you let go. A server that predates it answers 422,
@@ -330,12 +379,15 @@ same mount as one self-contained script with React bundled in:
330
379
  |---|---|---|
331
380
  | rrweb | `rrweb` | `{count}` + `blobKey` — the batch itself is uploaded as a chunk; inputs always masked, all text under a `maskAllText` policy; the page URL each full snapshot carries is scrubbed of query/fragment secrets; images recorded by URL, never inlined (inlining would alter the page's own `<img>`) |
332
381
  | clicks | `click` | `{selector, text, rect, route}` — `text` is never a form field's value, and empty at, inside or around `.rr-mask` / `.rr-block` and under `maskAllText` |
333
- | navigation | `nav` | `{url, route, spa}` — `url` scrubbed of query/fragment secrets, the start URL included |
382
+ | navigation | `nav` | `{url, route, spa}` — `url` scrubbed of query/fragment secrets, the start URL included; `route` passes the value patterns |
334
383
  | network | `net` | `{method, url, status, ms, reqHeaders, resHeaders, reqBody, resBody, via}` — redacted, capped at 64 KiB per body; the recorder's own uploads are never recorded |
335
384
  | console | `console` | `{level: 'error', text}` |
336
385
  | notes | `note` | `{text, route}`; annotations add `{rect, selector, annotate: true, task?}`; a note with images adds `attachments: [seq…]` |
337
386
  | images | `attachment` | `{name, mime, bytes, w, h}` + `blobKey` — the image itself is uploaded to `/shot?seq=N` first; its seq sits just below its note's |
338
387
 
388
+ Every `url` and `route` above, and the rrweb page URL, passes your
389
+ [`sanitizeUrl`](#credentials-in-url-paths-sanitizeurl) first when you pass one.
390
+
339
391
  Data goes to your vitrinka server only. Details, the redaction rules and the
340
392
  policy fetch: [`docs/PROTOCOL.md`](../../docs/PROTOCOL.md).
341
393