Patch Changes
-
e139a20: Share one browser session id across the agent run and the actions a page calls. Only the chat adapter sent
X-Agent-Native-Session-Id, and only the agent-run path read it, soRequestContext.browserSessionIdwas always undefined inside an action — a UI action call and the agent's own call during the same visit could not be joined to one$session_id. The action client now sends the header and the action route reads it into request context.Let
track()take an action'sctxas its third argument —track("project_created", { template }, ctx)— instead of restating{ userId: ctx?.userEmail }at every call site, and resolve the browser session from the ambient request context so no caller has to thread it.TrackingEventcarries it as a typedsessionIdthat each provider maps to its own field ($session_idfor PostHog, asession_idproperty for Mixpanel and Amplitude, a top-levelsessionIdfor webhooks and Agent Native Analytics), rather than leaking one backend's reserved key into every other backend. The browsertrack()helper sends the session header too, so a client event and the server events from the same visit no longer land in different sessions.Let an app pin that id with
setAnalyticsSessionId()(and drop it withclearAnalyticsSessionId()) from@agent-native/core/client/analytics. A pinned id opts out of the 30-minute idle rotation, so a workflow that spans a quiet stretch stays one correlated session instead of silently splitting in two. Ids the transport cannot carry — empty, over 127 characters, whitespace, or non-ASCII — throw at the call site rather than unlinking every later request.