@@ -5,7 +5,7 @@ checkpoints around meaningful interactions, compact structural anchors, route
55transitions, scrolling evidence, and optional viewport semantic maps. Capture
66can be sent to the local exploration WebSocket, the HTTP collector, or both.
77
8- The current package version is ` 0.5.0 ` . Session JSON writers emit schema
8+ The current package version is ` 0.5.3 ` . Session JSON writers emit schema
99version ` 9 ` ; compatibility readers should accept versions ` 6 ` through
1010` 9 ` . Structural fingerprints use fingerprint schema version ` 6 ` .
1111
@@ -153,11 +153,37 @@ Identity contract:
153153- ` captureSessionId ` (` session.id ` ) — SDK-generated emitted evidence session
154154- ` collectorSessionId ` — stamped after HTTP ` session_start ` acceptance
155155- ` explorationRunId ` — exploration control-plane ID from config
156+ - ` traitsId ` — collector-issued traits dictionary id after ` setTraits ` / session responses
156157
157158` TugboatReplay.activeSessionId ` remains as a deprecated alias for
158159` activationRequestId ` . Inspect ` TugboatReplay.health ` for sink/outbox/screenshot
159160budget pressure without reading protected content.
160161
162+ ### User traits and user id
163+
164+ When an HTTP collector is configured, register a full traits snapshot (not a
165+ partial merge) via ` POST /v1/sessions ` :
166+
167+ ``` dart
168+ await TugboatReplay.setTraits({
169+ 'plan': 'pro',
170+ 'seatCount': 3,
171+ });
172+
173+ await TugboatReplay.setUserId(currentUserId);
174+ ```
175+
176+ - ` setTraits ` debounces ` traits_updated ` (3s) after start acceptance, or
177+ ` session_identify ` when combined with a pending user change. Caches
178+ ` traitsId ` and stamps it on event batches. While ` session_start ` is pending,
179+ updates memory only (folded into start at send time).
180+ - ` setUserId ` debounces ` user_changed ` (3s) after start acceptance, or
181+ ` session_identify ` when combined with a pending traits change. Unchanged ids
182+ are ignored. While ` session_start ` is pending, updates memory only.
183+ - Pre-activate calls are retained in memory and included on the next
184+ ` session_start ` when present. Pending debounced updates flush on ` session_end ` .
185+ There is no ` /v1/identify ` route.
186+
161187Optional durable HTTP delivery (Collector only, default off):
162188
163189``` dart
@@ -263,7 +289,7 @@ Emitted event types currently include:
263289 immutable ` origin ` , ` result ` , ` attribution ` , and ` evidenceEventIds ` ;
264290- legacy gesture peers (` stream: legacy_projection ` when canonical is on):
265291 ` tap ` , ` tap_settled ` , ` swipe ` , ` tap_outside_tree ` , ` tap_gesture_resolved ` ;
266- - lifecycle: ` session_start ` , ` session_end ` ;
292+ - lifecycle: ` session_start ` , ` session_identify ` , ` session_end ` ;
267293- input: ` pointer_cancel ` (` stream: evidence ` );
268294- state/navigation evidence (` stream: evidence ` ): ` state_change ` , ` route_change `
269295 (claimed routes also carry ` causedByInteractionId ` );
@@ -380,11 +406,12 @@ so it is suitable for health polling and cannot grow with session duration.
380406
381407## Public surface
382408
383- The supported import exports ` TugboatReplay ` , ` TugboatNavigatorObserver ` ,
384- ` TugboatReplayConfig ` , capture/semantic/masking enums and policies, collector
385- configuration and host helpers, markers (` TugboatSensitive ` , ` TugboatTag ` ,
386- ` TugboatSubView ` , ` TugboatInternal ` ), anchor and session models, the controller,
387- and ` TugboatExplorationTransport ` .
409+ The supported import exports ` TugboatReplay ` (including ` setTraits ` /
410+ ` setUserId ` ), ` TugboatNavigatorObserver ` , ` TugboatReplayConfig ` ,
411+ capture/semantic/masking enums and policies, collector configuration and host
412+ helpers, markers (` TugboatSensitive ` , ` TugboatTag ` , ` TugboatSubView ` ,
413+ ` TugboatInternal ` ), anchor and session models, the controller, and
414+ ` TugboatExplorationTransport ` .
388415
389416` TugboatCaptureSink ` and the built-in sink implementations are internal today;
390417config supports only the WebSocket and HTTP destinations above. A stable custom
0 commit comments