There are two migration paths, depending on where your project is today:
  1. Vendored src/lib/scenaro-sdk/ folder → published @scenaro/sdk package
  2. Pre-0.3 API (useScenarioSession + AgentListener) → useScenaroSession
Both end at the same place: one provider, one hook, no transport wiring.

Before and after

Vendored@scenaro/sdk 0.1–0.2@scenaro/sdk 0.3
ScenarioPlayer monolithuseScenarioSession + AgentListener + RoomContextuseScenaroSession (all-in-one)
generateToken() one-shotidentifyUser() + startSession()Handled by start()
window.__ event bususeScenaroEvents() scoped bususeScenaroEvents() (unchanged)
Copied protocol files@scenaro/sdk/protocol@scenaro/sdk/protocol (unchanged)
8 divergent copiesOne npm packageOne npm package

Migration steps

1

Install the package

2

Replace API client

3

Replace provider

4

Replace the session hook

5

Remove AgentListener and RoomContext wiring

useScenaroSession handles the data channel, config handshake, tool RPC, and RoomContext injection internally. Delete these from your components:
6

Update auth calls

Remove any generateToken usage. The hook runs identify + session start automatically on start().
7

Update event listeners

8

Remove vendored copies

Delete duplicated AgentListener, protocol/, and auth/ files. Keep only feature components and your registry.

Pre-0.3 API mapping (historical)

These exports were removed in 0.3.0. If you still import them, upgrade to 0.3.
Removed (useScenarioSession)Replacement (useScenaroSession)
connect({ language })start() — pass language as a hook option
disconnect()end()
isConnected / isConnectingstatus ('connected', 'connecting', …)
error (string)error (ScenaroError with code)
<AgentListener />Built in — remove it
RoomContext.ProviderBuilt in — remove it
useConversationMessages()messages from the hook
roomroom (advanced only — see Transport extensions)
runtimeConfigrawConfig from the hook

What to keep locally

Keep in your appProvided by @scenaro/sdk
Feature componentsScenaroProvider
Feature registry / local FeatureManageruseScenaroSession
Brand CSSData channel + session tool RPC
Collection API clientsProtocol types
Product templatesSession storage

Storage migration

Since @scenaro/sdk@0.1.1, legacy storage keys are migrated automatically on read. No manual migration needed for users with existing sessions.

Verify

Need help?