@sentientui/react 0.39.1 → 0.40.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
@@ -227,6 +227,7 @@ Imported from `@sentientui/react/next`.
227
227
  | `components` | `Array<{ id: string; variantIds: string[] }>` *(optional, default `[]`)* | Code-variant components to preload server-side. `id` must match `<Adaptive id="…" variants={…}>`; generated-version `<Adaptive>` regions need no entry. Omit when the tree uses only slots/sections or assigns client-side. |
228
228
  | `sections` | `string[]` *(optional)* | Page section IDs in default order. When provided, a single `POST /v1/decide` returns both layout order and assignments; `useLayoutOrder()` becomes available. Give each section's element `data-sentient-id="<sectionId>"` — the only attribute a section needs — so the graph scanner can register it; without it the server types the section `generic` and every persona gets the same order. The provider warns about unresolvable ids in development. |
229
229
  | `registrySlotIds` | `string[]` *(optional)* | The generated-mode `<Adaptive id>`s this page renders. Decides their published versions in the same SSR round trip and serializes the served content into the HTML, so first paint shows the version instead of the original children. Scoped to exactly these ids — an unscoped registry decide would record a trial for every published slot on every page. Omit and the regions decide client-side after mount. |
230
+ | `registrySlots` | `{ id: string; authored?: string[]; forms?: boolean }[]` *(optional)* | Like `registrySlotIds`, with what each region can render. For a hybrid `<Adaptive id variants={…}>{original}</Adaptive>`, list its `variants` keys as `authored` so the SSR decide can serve a hand-written version on first paint. Without them, only the original or a generated version can be served on first paint. Set `forms: false` when the `<Adaptive>` has no `onFormSubmit` (default `true`). An id may appear in both props; it is decided once. |
230
231
  | `sectionTypes` | `Partial<Record<string, SemanticType>>` *(optional)* | What each section is, keyed by `data-sentient-id`: `{ about: 'trust', contact: 'cta' }`. Sections are classified from their content, so declare only the ones it gets wrong — a band with little signal-bearing copy (an "About us" block, a contact form) reads `generic` and is ordered the same for every persona. Any section with a `data-sentient-id` can appear, reorderable or not. Also accepted by `AdaptiveProvider`. |
231
232
  | `apiKey` | `string` | `pk_…` key — used by both the browser SDK and server-side SSR requests. |
232
233
  | `slots` | `Array<{ id, dims? \| arms?, baseline? }>` *(optional)* | The `useAdaptiveTokens` / `<AdaptiveGroup>` slots this tree renders. Declaring them decides them in the same SSR round trip, so their values serialize into the server HTML; undeclared ones decide after mount. |
@@ -270,6 +271,7 @@ Accepts the same `apiKey`, `persona`, `consent`, `debug` props as `<AdaptiveRoot
270
271
  | `ssrSessionId` | `string` | The `sessionId` field of `loadAdaptiveAssignments`' return value. Required with `initialAssignments` so the browser adopts the same session the server assigned — otherwise exposures and goals attach to a different session than the SSR assignment. |
271
272
  | `sessionSegment` | `string` | Segment from SSR (`device:source`). Must match the value used in `loadAdaptiveAssignments`. |
272
273
  | `initialLayoutOrder` | `string[] \| null` | Preloaded section order from `loadAdaptiveDecision` (for Pages-Router-style SSR with sections). |
274
+ | `initialUnified` | `string[]` | The `unified` field of `loadAdaptiveAssignments` / `loadAdaptiveDecision`: components you moved onto the shared track, which `<Adaptive>` then renders as slots from the first paint. `<AdaptiveRoot>` passes it for you. |
273
275
 
274
276
  ### `<Adaptive>`
275
277
 
@@ -297,7 +299,7 @@ never both. `AdaptiveProps` is the union of the two exported prop types below.
297
299
  | `goal` | `string \| GoalConfig` | Conversion goal (required). A string is a click-goal label; an object is an explicit `GoalConfig`. |
298
300
  | `funnel` | `string` *(optional)* | Funnel this component serves — see [Funnels](#funnels--funnel-prop). |
299
301
  | `microSignalGoals` | `MicroSignalGoals` *(optional)* | When a passive micro-signal fires on this component, also record a named goal: micro-signal type → goal name (or `{ name, weight?, stepIndex? }`), e.g. `{ rage_click: 'confused_by_hero' }`. |
300
- | `agentDataByVariant` | `Record<string, unknown>` *(optional)* | Structured data keyed by variant ID that AI agents can consume via `GET /v1/agent/layout`. Only the assigned variant's entry is sent to the server. Preferred over `agentData`. |
302
+ | `agentDataByVariant` | `Record<string, unknown>` *(optional)* | Structured data keyed by variant ID that AI agents can consume via `GET /v1/agent/layout`. Only the assigned variant's entry is sent to the server. Preferred over `agentData`. A new or changed value is served to agents once visitors on a few different networks have reported it, so one forged request cannot rewrite it. |
301
303
  | `agentData` | `unknown` *(optional, deprecated)* | Deprecated in favour of `agentDataByVariant`. Single value stored once regardless of which variant is shown; kept for backward compatibility. |
302
304
  | `as`, `className` | *(optional)* | Wrapper element and its class, as for generated versions. |
303
305
  | `clientOnly` | `boolean` | Render nothing on the server; resolve on the client only. Use for cookie-dependent components. Without it, a component with no preloaded assignment server-renders its first variant. (This replaces the deprecated provider-level `ssrFallback="none"`, which is still accepted.) |
@@ -593,6 +595,8 @@ export async function getServerSideProps({ req }) {
593
595
 
594
596
  Pass `assignments` as `initialAssignments` **and `sessionId` as `ssrSessionId`** on `<AdaptiveProvider>` in `_app.tsx` — the return value is `{ assignments, sessionId }`, and without `ssrSessionId` the browser starts a different session than the one the server assigned, so the preload silently does nothing and events attach to the wrong session. For pages with a `sections` layout, use `loadAdaptiveDecision` (same options shape, plus `sections: string[]`) — its return value carries both `assignments` and `layoutOrder`.
595
597
 
598
+ Both also return `unified` (on `loadAdaptiveDecision` it can be absent, meaning none): the components you moved onto the shared track, which are not in `assignments`. Pass it as `initialUnified`. In the browser, `client.isUnified(id)` answers the same question for ids learned after load.
599
+
596
600
  ### Forwarding to your own analytics
597
601
 
598
602
  ```tsx
@@ -623,6 +627,34 @@ window.__sentient_overrides = { hero_cta: 'variant_a' };
623
627
 
624
628
  Overrides bypass the bandit entirely — no events recorded, weights unchanged.
625
629
 
630
+ ## Record a conversion from your server
631
+
632
+ Some conversions happen where the browser can't see them: a payment confirmed by a webhook, an order saved by a server action. `trackServerGoal` records one with your secret key (`sk_…`, server-only).
633
+
634
+ **Same request** (the visitor's browser made the request, so their cookie is there):
635
+
636
+ ```ts
637
+ import { cookies } from 'next/headers';
638
+ import { readSessionCookie, trackServerGoal } from '@sentientui/react/server';
639
+
640
+ const sessionId = readSessionCookie(await cookies(), process.env.NEXT_PUBLIC_SENTIENT_API_KEY!);
641
+ await trackServerGoal({
642
+ serverKey: process.env.SENTIENT_SECRET_KEY!,
643
+ sessionId,
644
+ name: 'purchase',
645
+ dedupeKey: order.id, // your own id for this conversion
646
+ value: order.total,
647
+ currency: 'USD',
648
+ });
649
+ ```
650
+
651
+ **Later, from a webhook** (Stripe, Clerk, a queue: no cookie in sight). Save the visitor id when the visitor acts, then use it when the confirmation arrives:
652
+
653
+ 1. In the browser, read `client.getVisitorId()` and send it along with the checkout or sign-up (for example in its metadata). It is `null` until the visitor has agreed to tracking, so nothing is saved for people who haven't.
654
+ 2. In your webhook handler, read that id back from the event and pass it as `sessionId`.
655
+
656
+ `trackServerGoal` resolves `'recorded'`, `'skipped_no_visitor'` (no id, so nothing is sent) or `'failed'`. It never throws. Sending the same `name` and `dedupeKey` for the same visitor again, for example when a webhook is redelivered, counts once. The id is scoped to the visitor's session, so another site using the same order number never collides with yours. It refuses to run in a browser and never sends the secret key there.
657
+
626
658
  ## Graph scanning & engagement capture (on by default)
627
659
 
628
660
  DOM graph scanning and behavioral engagement capture are **on by default** — no props needed. The SDK:
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/devtools/index.tsx","../src/devtools-registry.ts","../src/devtools-overrides.ts","../src/devtools-slot-overrides.ts","../src/preview-mode.ts","../src/override-events.ts","../src/devtools-config.ts"],"sourcesContent":["'use client';\n// `type JSX` from react, not the global namespace removed in @types/react@19\n// (peers allow react >=18) — see adaptive-text.tsx.\nimport { useEffect, useReducer, useState, useSyncExternalStore, type CSSProperties, type JSX } from 'react';\nimport { UNKNOWN_PERSONA, UNKNOWN_PERSONA_DISPLAY, confidenceBand, normalizeDeclaredPersona } from '@sentientui/policy';\nimport { LEGACY_SESSION_COOKIE_NAME, SNAPSHOT_STORAGE_KEY_PREFIX, sessionCookieName } from '@sentientui/core';\nimport {\n getRegistered,\n getRegisteredSlots,\n getRegisteredSections,\n subscribeRegistry,\n getRegistryVersion,\n type RegisteredSlot,\n} from '../devtools-registry.js';\nimport { setVariantOverride, clearVariantOverride, getOverrides } from '../devtools-overrides.js';\nimport { setSlotOverride, clearSlotOverride, getSlotOverrides } from '../devtools-slot-overrides.js';\nimport { setPreviewMode, getPreviewMode } from '../preview-mode.js';\nimport { notifyOverridesChanged } from '../override-events.js';\nimport { readDevtoolsConfig, type DevtoolsConfig } from '../devtools-config.js';\n\ndeclare const process: { env?: { NODE_ENV?: string } } | undefined;\nconst IS_PROD = typeof process !== 'undefined' && process.env?.NODE_ENV === 'production';\nconst DEFAULT_API_BASE_URL = 'https://api.sentient-ui.com/v1';\n\nexport const LOCAL_MODE_DEVTOOLS_BANNER =\n 'Local mode — decisions are simulated; add a key to learn from real traffic';\n\ntype OutcomeToApply = {\n assignments?: Record<string, string>;\n layoutOrder?: string[] | null;\n slots?: Record<string, string | Record<string, string>>;\n personaAttributes?: { persona: string; confidence: 'low' | 'medium' | 'high' };\n};\n\ntype OverrideWindow = Window & {\n __sentient_layout_override?: string[];\n __sentient_slot_overrides?: Record<string, string | Record<string, string>>;\n};\n\n/** The order the page is rendering: a previewed override, else what was registered. */\nfunction currentLayout(): string[] {\n const forced = (window as unknown as OverrideWindow).__sentient_layout_override;\n const registered = getRegisteredSections();\n if (!forced || forced.length === 0) return registered;\n // Registered ids the override omits still render (useLayoutOrder returns the\n // override verbatim, and the app maps whatever ids it is given), so show them\n // trailing rather than dropping them from the list you are dragging.\n return [...forced, ...registered.filter((id) => !forced.includes(id))];\n}\n\n/**\n * Move `from` to `to` within the current order and preview it.\n *\n * Writes the whole order rather than swapping neighbours: the point is to try an\n * arrangement, not to walk one block up a list one press at a time.\n */\nfunction reorderLayout(from: number, to: number): void {\n const order = currentLayout();\n if (from === to || from < 0 || to < 0 || from >= order.length || to >= order.length) return;\n const next = [...order];\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved!);\n (window as unknown as OverrideWindow).__sentient_layout_override = next;\n setPreviewMode(true); // an arrangement you are trying must not train the bandit\n notifyOverridesChanged();\n}\n\nfunction resetLayout(): void {\n delete (window as unknown as OverrideWindow).__sentient_layout_override;\n notifyOverridesChanged();\n}\n\n/** Apply a simulated outcome across every surface: variants, layout, slots/tokens, persona attrs. */\nfunction applyOutcome(result: OutcomeToApply): void {\n for (const [id, variantId] of Object.entries(result.assignments ?? {})) {\n setVariantOverride(id, variantId);\n }\n const w = window as unknown as OverrideWindow;\n if (result.layoutOrder && result.layoutOrder.length > 0) {\n w.__sentient_layout_override = result.layoutOrder;\n }\n if (result.slots) {\n w.__sentient_slot_overrides = { ...(w.__sentient_slot_overrides ?? {}), ...result.slots };\n }\n if (result.personaAttributes) {\n document.documentElement.dataset.sentientPersona = result.personaAttributes.persona;\n document.documentElement.dataset.sentientConfidence = result.personaAttributes.confidence;\n }\n setPreviewMode(true); // suppress events while previewing\n notifyOverridesChanged(); // re-render layout/slot consumers\n}\n\n// Reads the SDK's own session cookie — the per-project SUFFIXED name first\n// (that is what the client writes since namespacing; the bare `_snt_uid` this\n// used to read is only written in keyless/local mode), then the bare name as\n// the legacy/local fallback.\nfunction readSessionId(apiKey?: string): string {\n const read = (name: string): string | null => {\n try {\n const match = document.cookie.match(new RegExp(`(?:^|; )${name}=([^;]*)`));\n return match ? decodeURIComponent(match[1]!) : null;\n } catch {\n return null;\n }\n };\n return (apiKey ? read(sessionCookieName(apiKey)) : null) ?? read(LEGACY_SESSION_COOKIE_NAME) ?? 'devtools-preview';\n}\n\nfunction slotDecls(): Array<{ id: string; arms?: string[]; dims?: RegisteredSlot['dims'] }> {\n return getRegisteredSlots().map((s) => ({\n id: s.id,\n ...(s.arms ? { arms: s.arms } : {}),\n ...(s.dims ? { dims: s.dims } : {}),\n }));\n}\n\n/** One member of the project's persona vocabulary, as /v1/personas serves it. */\ntype VocabMember = { key: string; displayName: string };\n\n/** Always offered: previewing the unidentified visitor is meaningful on every\n * project, and it is the only persona the product itself defines. */\nconst UNKNOWN_CHOICE: VocabMember = { key: UNKNOWN_PERSONA, displayName: UNKNOWN_PERSONA_DISPLAY };\n\n/**\n * Keyed mode: the project's ACTIVE vocabulary from /v1/personas. Personas are\n * per-project (persona_sets, migration 113) — declared by the app or promoted\n * by discovery. This used to fall back to a hardcoded list of four seeded\n * personas, which offered buttons that silently simulated the default\n * experience on any project whose vocabulary differs, and named audiences\n * nobody had declared. null on any failure → the panel offers only `unknown`\n * and a free-text key.\n */\nasync function fetchPersonaVocabulary(\n apiKey: string,\n apiBaseUrl: string,\n): Promise<{ personas: VocabMember[]; discovered: VocabMember[] } | null> {\n try {\n const res = await fetch(`${apiBaseUrl}/personas`, {\n headers: { authorization: `Bearer ${apiKey}` },\n });\n if (!res.ok) return null;\n const data = (await res.json()) as { personas?: VocabMember[]; discovered?: VocabMember[] };\n const valid = (list: VocabMember[] | undefined): VocabMember[] =>\n Array.isArray(list)\n ? list.filter((p) => p && typeof p.key === 'string' && typeof p.displayName === 'string')\n : [];\n const personas = valid(data.personas);\n return personas.length > 0 ? { personas, discovered: valid(data.discovered) } : null;\n } catch {\n return null;\n }\n}\n\n/**\n * `?sentient_context=<context>` on the page URL: the on-site context preview\n * (a stage such as `carted`, or an arrival class such as `cart_recovery`).\n * Forwarded to /v1/explain so a persona simulated from this panel is also\n * simulated in that context — the API validates the value (400 on anything\n * else) and applies it to the project's published (registry) versions:\n * those restricted to the context become eligible and its pins win. Lives\n * here, not in the provider: devtools is the React SDK's only explain-backed\n * preview, and the main bundle pays for nothing it does not use.\n * @internal Exported for tests.\n */\nexport function previewContextParam(): string | null {\n try {\n const v = new URLSearchParams(window.location.search).get('sentient_context');\n return v && /^[a-z_]{1,40}$/.test(v) ? v : null;\n } catch {\n return null;\n }\n}\n\n/** Keyed mode: simulate via /v1/explain (read-only, event-free). Returns how\n * the persona RESOLVED so the panel can say when the project didn't\n * recognize it — the page then shows the default experience, and a silently\n * highlighted button claiming otherwise was the old lie. */\nasync function forcePersonaKeyed(\n apiKey: string,\n apiBaseUrl: string,\n persona: string,\n): Promise<{ recognized: boolean; resolvedDisplay: string } | null> {\n const res = await fetch(`${apiBaseUrl}/explain`, {\n method: 'POST',\n headers: { 'content-type': 'application/json', authorization: `Bearer ${apiKey}` },\n body: JSON.stringify({\n persona,\n sections: getRegisteredSections().map((id) => ({ id })),\n components: getRegistered().map((c) => ({ id: c.id, variantIds: c.variantIds })),\n slots: slotDecls(),\n ...(previewContextParam() ? { context: previewContextParam() } : {}),\n }),\n });\n if (!res.ok) return null;\n const data = (await res.json()) as OutcomeToApply & {\n recognized?: boolean;\n persona?: string;\n personaDisplay?: string;\n };\n applyOutcome({\n ...data,\n personaAttributes: data.personaAttributes ?? { persona, confidence: 'high' },\n });\n return {\n // An older API omits the field — treat as recognized (no basis to warn).\n recognized: data.recognized !== false,\n resolvedDisplay: data.personaDisplay ?? data.persona ?? persona,\n };\n}\n\n/** Local mode: simulate via the deterministic local engine — zero network. */\nasync function forcePersonaLocal(persona: string, apiKey?: string): Promise<void> {\n const mod = await import('@sentientui/core/local');\n if (!mod.LOCAL_ENGINE_AVAILABLE) return;\n const outcome = mod\n .createLocalEngine({ sessionId: readSessionId(apiKey), forcedPersona: persona })\n .decide({\n sections: getRegisteredSections(),\n components: getRegistered().map((c) => ({ id: c.id, variantIds: c.variantIds })),\n slots: slotDecls(),\n });\n applyOutcome({\n assignments: outcome.assignments,\n layoutOrder: outcome.layoutOrder,\n slots: outcome.slots,\n personaAttributes: {\n persona: outcome.persona,\n confidence: confidenceBand(outcome.confidence),\n },\n });\n}\n\n/** Reset: clear the decision snapshot + every override, then reload to re-decide. */\nfunction resetAll(): void {\n for (const id of Object.keys(getOverrides())) clearVariantOverride(id);\n const w = window as unknown as OverrideWindow;\n delete w.__sentient_layout_override;\n delete w.__sentient_slot_overrides;\n delete document.documentElement.dataset.sentientPersona;\n delete document.documentElement.dataset.sentientConfidence;\n try {\n const stale: string[] = [];\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key && key.startsWith(SNAPSHOT_STORAGE_KEY_PREFIX)) stale.push(key);\n }\n for (const key of stale) localStorage.removeItem(key);\n } catch {\n /* ignore */\n }\n setPreviewMode(false);\n notifyOverridesChanged();\n try {\n window.location.reload();\n } catch {\n /* jsdom */\n }\n}\n\nconst btn = (active: boolean): CSSProperties => ({\n padding: '2px 8px',\n borderRadius: 4,\n border: '1px solid #444',\n background: active ? '#3b82f6' : '#222',\n color: '#eee',\n cursor: 'pointer',\n});\n\n/** Sentient \"S.\" wordmark, monoline — white strokes for the black launcher button. */\nfunction SentientMark({ size = 26 }: { size?: number } = {}): JSX.Element {\n return (\n <svg width={size} height={size} viewBox=\"0 0 32 32\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M21 9H14C11.2 9 9.8 10.8 9.8 13C9.8 15.4 11.6 16.6 14.5 16.6H18.5C20.5 16.6 20.7 18.2 20.4 19.6\"\n stroke=\"#fff\"\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path d=\"M10 22H17\" stroke=\"#fff\" strokeWidth=\"2.2\" strokeLinecap=\"round\" />\n <circle cx=\"20.6\" cy=\"22\" r=\"2.1\" fill=\"#fff\" />\n </svg>\n );\n}\n\nexport function AdaptiveDevtools({ apiKey }: { apiKey?: string } = {}): JSX.Element | null {\n const [open, setOpen] = useState(false);\n const [activePersona, setActivePersona] = useState<string | null>(null);\n // The project's vocabulary (keyed mode); null = not loaded → no persona\n // buttons beyond `unknown`. Local mode never fetches: there is no project,\n // and the local engine previews ANY key typed into the free-text field.\n const [vocab, setVocab] = useState<VocabMember[] | null>(null);\n const [customKey, setCustomKey] = useState('');\n // Discovered SHADOW personas — display-only. They never serve until\n // promotion, so there is no button: forcing one would simulate a persona\n // that cannot occur on this project.\n const [discovered, setDiscovered] = useState<VocabMember[]>([]);\n // Set when a forced persona did NOT resolve against the project's\n // vocabulary — the page is showing the default experience and the panel\n // must say so instead of highlighting the button as if the preview worked.\n const [personaNote, setPersonaNote] = useState<string | null>(null);\n const [dragFrom, setDragFrom] = useState<number | null>(null);\n const [mounted, setMounted] = useState(false);\n const [, force] = useReducer((n: number) => n + 1, 0);\n // Re-render when the component/slot registry changes. useSyncExternalStore\n // (not a manual useEffect subscription) so the subscription can't go stale\n // across Next Fast Refresh — a stale listener was why the panel needed a hard\n // refresh to pick up a renamed id.\n useSyncExternalStore(subscribeRegistry, getRegistryVersion, () => 0);\n // Client-mount gate: render nothing during SSR / the first paint so the widget\n // never reads `window` on the server. Lets consumers drop `<AdaptiveDevtools/>`\n // straight into a tree without a `dynamic(..., { ssr: false })` wrapper.\n useEffect(() => setMounted(true), []);\n // Load the project's persona vocabulary once (keyed mode only).\n useEffect(() => {\n if (IS_PROD) return;\n const cfg = readDevtoolsConfig() ?? { apiKey: apiKey ?? '', apiBaseUrl: DEFAULT_API_BASE_URL, isLocal: false };\n if (cfg.isLocal || !cfg.apiKey) return;\n let cancelled = false;\n void fetchPersonaVocabulary(cfg.apiKey, cfg.apiBaseUrl).then((v) => {\n if (cancelled || !v) return;\n setVocab(v.personas);\n setDiscovered(v.discovered);\n });\n return () => { cancelled = true; };\n }, [apiKey]);\n\n // Never render in production, even if imported by mistake. (Hooks run first\n // so the rules of hooks hold regardless of these early returns.)\n if (IS_PROD) return null;\n if (!mounted) return null;\n\n const config: DevtoolsConfig = readDevtoolsConfig() ?? {\n apiKey: apiKey ?? '',\n apiBaseUrl: DEFAULT_API_BASE_URL,\n isLocal: false,\n };\n const useLocalEngine = config.isLocal || !config.apiKey;\n const components = getRegistered();\n const slots = getRegisteredSlots();\n const overrides = getOverrides();\n const slotOverrides = getSlotOverrides();\n const sections = currentLayout();\n const layoutForced = (window as unknown as OverrideWindow).__sentient_layout_override !== undefined;\n\n function onReorder(from: number, to: number): void {\n reorderLayout(from, to);\n force();\n }\n function onResetLayout(): void {\n resetLayout();\n maybeExitPreview();\n force();\n }\n\n // Preview mode stays on while ANY override (variant, slot or layout) is\n // active. Omitting layout here let clearing the last variant re-enable event\n // recording while a previewed section order was still on screen.\n function maybeExitPreview(): void {\n if (\n Object.keys(getOverrides()).length === 0 &&\n Object.keys(getSlotOverrides()).length === 0 &&\n (window as unknown as OverrideWindow).__sentient_layout_override === undefined\n ) {\n setPreviewMode(false);\n }\n }\n\n function choose(id: string, variantId: string): void {\n setVariantOverride(id, variantId);\n setPreviewMode(true);\n notifyOverridesChanged();\n force();\n }\n function resetVariant(id: string): void {\n clearVariantOverride(id);\n maybeExitPreview();\n notifyOverridesChanged();\n force();\n }\n function chooseSlotArm(id: string, arm: string): void {\n setSlotOverride(id, arm);\n setPreviewMode(true);\n notifyOverridesChanged();\n force();\n }\n function chooseSlotDim(id: string, dim: string, value: string, dims: RegisteredSlot['dims']): void {\n const current = getSlotOverrides()[id];\n // Merge onto the existing forced object, or seed from each dim's baseline\n // (first value) so unset dims stay at baseline instead of vanishing.\n const next: Record<string, string> =\n current && typeof current === 'object'\n ? { ...current }\n : Object.fromEntries(Object.entries(dims ?? {}).map(([d, values]) => [d, values[0]!]));\n next[dim] = value;\n setSlotOverride(id, next);\n setPreviewMode(true);\n notifyOverridesChanged();\n force();\n }\n function resetSlot(id: string): void {\n clearSlotOverride(id);\n maybeExitPreview();\n notifyOverridesChanged();\n force();\n }\n function choosePersona(member: VocabMember): void {\n setActivePersona(member.key);\n setPersonaNote(null);\n // .catch: a failed simulate (offline /v1/explain, bad key, failed local\n // dynamic import) is a preview no-op — without the handler it surfaced as\n // an unhandled promise rejection in the console.\n if (useLocalEngine) {\n forcePersonaLocal(member.key, config.apiKey).then(force).catch(() => {});\n return;\n }\n forcePersonaKeyed(config.apiKey, config.apiBaseUrl, member.key)\n .then((r) => {\n if (r && !r.recognized) {\n setPersonaNote(\n `“${member.displayName}” isn’t in this project’s personas — the page is showing the default experience.`,\n );\n }\n force();\n })\n .catch(() => {});\n }\n\n return (\n <div style={{ position: 'fixed', bottom: 16, right: 16, zIndex: 2147483647, fontFamily: 'system-ui' }}>\n {/* Panel stays mounted and animates in/out from the button's corner, so the\n launcher below never shifts. transform-origin is the button (bottom-right). */}\n <div\n aria-hidden={!open}\n style={{\n position: 'absolute',\n bottom: 52,\n right: 0,\n transformOrigin: 'bottom right',\n transition: 'opacity .18s ease, transform .2s cubic-bezier(.16,1,.3,1)',\n opacity: open ? 1 : 0,\n transform: open ? 'translateY(0) scale(1)' : 'translateY(6px) scale(.96)',\n pointerEvents: open ? 'auto' : 'none',\n }}\n >\n <div style={{ width: 300, maxHeight: 460, overflowY: 'auto', background: '#111', color: '#eee',\n borderRadius: 8, padding: 12, boxShadow: '0 8px 30px rgba(0,0,0,.4)', fontSize: 12 }}>\n {config.isLocal && (\n <div style={{ background: '#1e293b', border: '1px solid #334155', borderRadius: 4,\n padding: '6px 8px', marginBottom: 8 }}>\n {LOCAL_MODE_DEVTOOLS_BANNER}\n </div>\n )}\n <div style={{ opacity: .7, marginBottom: 8 }}>\n {components.length} component{components.length === 1 ? '' : 's'} · {getPreviewMode() ? 'preview — writing nothing' : 'live'}\n </div>\n <div style={{ borderBottom: '1px solid #333', paddingBottom: 8, marginBottom: 8 }}>\n <div style={{ opacity: .7, marginBottom: 4 }}>Preview persona</div>\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 4 }}>\n {/* Keyed mode renders the project's OWN vocabulary once\n /v1/personas answers; nothing is invented while it hasn't. */}\n {[...(useLocalEngine ? [] : vocab ?? []), UNKNOWN_CHOICE].map((p) => (\n <button key={p.key} onClick={() => choosePersona(p)} style={btn(activePersona === p.key)}>\n {p.displayName}\n </button>\n ))}\n {(activePersona !== null || Object.keys(overrides).length > 0 || Object.keys(slotOverrides).length > 0) && (\n <button onClick={resetAll} style={{ ...btn(false), color: '#aaa' }}>\n Reset\n </button>\n )}\n </div>\n <form\n onSubmit={(e) => {\n e.preventDefault();\n const key = normalizeDeclaredPersona(customKey);\n if (key) choosePersona({ key, displayName: key });\n }}\n style={{ display: 'flex', gap: 4, marginTop: 6 }}\n >\n <input\n aria-label=\"Persona key\"\n placeholder=\"any persona key, e.g. admin\"\n value={customKey}\n onChange={(e) => setCustomKey(e.target.value)}\n style={{ flex: 1, minWidth: 0, background: '#111', color: '#fff', border: '1px solid #333',\n borderRadius: 4, padding: '4px 6px', fontSize: 12 }}\n />\n <button type=\"submit\" style={btn(false)}>Preview</button>\n </form>\n {personaNote && (\n <div style={{ marginTop: 6, fontSize: 11, color: '#fbbf24' }}>{personaNote}</div>\n )}\n {!useLocalEngine && discovered.length > 0 && (\n <div style={{ marginTop: 8 }}>\n <div style={{ opacity: .5, fontSize: 11, marginBottom: 4 }}>\n Discovered — not serving yet (promote from the dashboard)\n </div>\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 4 }}>\n {discovered.map((p) => (\n <span\n key={p.key}\n title=\"Found by clustering your traffic; it starts serving only after promotion.\"\n style={{ ...btn(false), opacity: .45, cursor: 'default', display: 'inline-block' }}\n >\n {p.displayName}\n </span>\n ))}\n </div>\n </div>\n )}\n </div>\n {sections.length > 0 && (\n <div style={{ borderBottom: '1px solid #333', paddingBottom: 8, marginBottom: 8 }}>\n <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 4 }}>\n <span style={{ opacity: .7 }}>Layout — drag to reorder</span>\n {layoutForced && (\n // Distinct accessible name: the per-variant and per-slot resets\n // below are also labelled \"reset\", and three identical buttons\n // in one panel is ambiguous to a screen reader and to tests.\n <button\n aria-label=\"Reset section order\"\n onClick={onResetLayout}\n style={{ ...btn(false), color: '#aaa' }}\n >\n reset\n </button>\n )}\n </div>\n {/* Drop-on-row inserts at that row's position, so any block can go\n anywhere in one gesture. The whole order is written on each\n drop — see reorderLayout. */}\n <ul aria-label=\"Section order\" style={{ listStyle: 'none', margin: 0, padding: 0 }}>\n {sections.map((id, i) => (\n <li\n key={id}\n draggable\n onDragStart={() => setDragFrom(i)}\n onDragOver={(e) => e.preventDefault()}\n onDrop={(e) => {\n e.preventDefault();\n if (dragFrom !== null) onReorder(dragFrom, i);\n setDragFrom(null);\n }}\n onDragEnd={() => setDragFrom(null)}\n style={{\n display: 'flex', alignItems: 'center', gap: 6, padding: '4px 6px', marginBottom: 2,\n borderRadius: 4, border: '1px solid #262626', cursor: 'grab',\n background: dragFrom === i ? '#1e293b' : '#181818',\n opacity: dragFrom !== null && dragFrom !== i ? .6 : 1,\n }}\n >\n <span style={{ opacity: .4, minWidth: 10, fontVariantNumeric: 'tabular-nums' }}>{i + 1}</span>\n <span aria-hidden=\"true\" style={{ opacity: .35 }}>⠿</span>\n <span style={{ flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>\n {id}\n </span>\n </li>\n ))}\n </ul>\n </div>\n )}\n {components.length === 0 && slots.length === 0 && sections.length === 0 && (\n <div style={{ opacity: .6 }}>No components, sections or slots on this page yet.</div>\n )}\n {components.map((c) => (\n <div key={c.id} style={{ borderTop: '1px solid #333', padding: '8px 0' }}>\n <div style={{ fontWeight: 600 }}>{c.id}{c.goal ? ` · goal: ${c.goal}` : ''}</div>\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 4, marginTop: 4 }}>\n {c.variantIds.map((v) => (\n <button key={v} onClick={() => choose(c.id, v)} style={btn(overrides[c.id] === v)}>\n {v}\n </button>\n ))}\n {overrides[c.id] && (\n <button onClick={() => resetVariant(c.id)} style={{ ...btn(false), color: '#aaa' }}>\n reset\n </button>\n )}\n </div>\n </div>\n ))}\n {slots.length > 0 && (\n <div style={{ borderTop: '1px solid #333', paddingTop: 8, marginTop: 4 }}>\n <div style={{ opacity: .7, marginBottom: 4 }}>Slots</div>\n {slots.map((s) => {\n const ov = slotOverrides[s.id];\n return (\n <div key={s.id} style={{ padding: '6px 0' }}>\n <div style={{ fontWeight: 600 }}>{s.id}</div>\n {s.arms && (\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 4, marginTop: 4 }}>\n {s.arms.map((arm) => (\n <button key={arm} onClick={() => chooseSlotArm(s.id, arm)} style={btn(ov === arm)}>\n {arm}\n </button>\n ))}\n </div>\n )}\n {s.dims && Object.entries(s.dims).map(([dim, values]) => (\n <div key={dim} style={{ marginTop: 4 }}>\n <div style={{ opacity: .6, fontSize: 11 }}>{dim}</div>\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 4 }}>\n {values.map((v) => (\n <button\n key={v}\n onClick={() => chooseSlotDim(s.id, dim, v, s.dims)}\n style={btn(!!ov && typeof ov === 'object' && ov[dim] === v)}\n >\n {v}\n </button>\n ))}\n </div>\n </div>\n ))}\n {ov !== undefined && (\n <button onClick={() => resetSlot(s.id)} style={{ ...btn(false), color: '#aaa', marginTop: 4 }}>\n reset\n </button>\n )}\n </div>\n );\n })}\n </div>\n )}\n </div>\n </div>\n <button\n aria-label=\"Sentient DevTools\"\n aria-expanded={open}\n onClick={() => setOpen((o) => !o)}\n style={{ width: 44, height: 44, borderRadius: 12, border: '1px solid #2a2a2a', background: '#000',\n display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 0,\n cursor: 'pointer', boxShadow: '0 6px 18px rgba(0,0,0,.4)' }}\n >\n <SentientMark />\n </button>\n </div>\n );\n}\n","import { isDevBuild } from './adaptive-shared.js';\n\nexport type RegisteredComponent = { id: string; variantIds: string[]; goal?: string };\nexport type RegisteredSlot = {\n id: string;\n arms?: string[];\n dims?: Record<string, readonly string[]>;\n};\n\ntype RegistryState = {\n components: Map<string, RegisteredComponent>;\n slots: Map<string, RegisteredSlot>;\n sections: string[];\n listeners: Set<() => void>;\n /** Bumped on every mutation so `useSyncExternalStore` can read a stable, comparable snapshot. */\n version: number;\n};\n\n// Shared through a window global: the main entry and the /devtools entry are\n// separate bundles, each with its own copy of this module — module-local\n// state would give the devtools an always-empty registry in published apps.\nconst ssrFallback: RegistryState = {\n components: new Map(),\n slots: new Map(),\n sections: [],\n listeners: new Set(),\n version: 0,\n};\n\nfunction state(): RegistryState {\n if (typeof window === 'undefined') return ssrFallback;\n const w = window as unknown as { __sentient_registry?: RegistryState };\n if (!w.__sentient_registry) {\n w.__sentient_registry = {\n components: new Map(),\n slots: new Map(),\n sections: [],\n listeners: new Set(),\n version: 0,\n };\n }\n return w.__sentient_registry;\n}\n\nfunction emit(): void {\n // Bump BEFORE notifying so a useSyncExternalStore consumer re-reading its\n // snapshot inside the notification sees the new value and re-renders.\n state().version += 1;\n for (const fn of state().listeners) fn();\n}\n\n// The registry exists solely to feed the opt-in devtools panel, which is a\n// dev-only surface. In a production build there is no panel reading it, so\n// every register call is dead work plus a `window.__sentient_registry`\n// footprint on the customer's page. Short-circuit to a noop in production —\n// every <Adaptive>/useAdaptive/slot mount calls one of these.\nconst NOOP_UNREGISTER = (): void => undefined;\n\n/** Register (or re-register) a component. Returns an unregister function. */\nexport function registerComponent(c: RegisteredComponent): () => void {\n if (!isDevBuild()) return NOOP_UNREGISTER;\n state().components.set(c.id, c);\n emit();\n return () => {\n state().components.delete(c.id);\n emit();\n };\n}\n\n/** Register (or re-register) a slot declaration. Returns an unregister function. */\nexport function registerSlot(s: RegisteredSlot): () => void {\n if (!isDevBuild()) return NOOP_UNREGISTER;\n state().slots.set(s.id, s);\n emit();\n return () => {\n state().slots.delete(s.id);\n emit();\n };\n}\n\n/** Register the page's declared section ids (from AdaptiveRoot/provider). */\nexport function registerSections(sections: string[]): void {\n if (!isDevBuild()) return;\n state().sections = [...sections];\n emit();\n}\n\nexport function getRegistered(): RegisteredComponent[] {\n return [...state().components.values()];\n}\n\nexport function getRegisteredSlots(): RegisteredSlot[] {\n return [...state().slots.values()];\n}\n\nexport function getRegisteredSections(): string[] {\n return [...state().sections];\n}\n\nexport function subscribeRegistry(fn: () => void): () => void {\n const listeners = state().listeners;\n listeners.add(fn);\n return () => {\n listeners.delete(fn);\n };\n}\n\n/** Monotonic snapshot for `useSyncExternalStore` — changes on every registry mutation. */\nexport function getRegistryVersion(): number {\n return state().version;\n}\n","function store(): Record<string, string> {\n const w = window as unknown as { __sentient_overrides?: Record<string, string> };\n if (!w.__sentient_overrides) w.__sentient_overrides = {};\n return w.__sentient_overrides;\n}\n\n/** Force `componentId` to render `variantId` — read by `useAssignment`. */\nexport function setVariantOverride(componentId: string, variantId: string): void {\n store()[componentId] = variantId;\n}\n\nexport function clearVariantOverride(componentId: string): void {\n delete store()[componentId];\n}\n\nexport function getOverrides(): Record<string, string> {\n return { ...store() };\n}\n","import type { SlotResult } from '@sentientui/core';\n\n/**\n * Slot-override store — the channel `useSlotResult` reads (`useAdaptiveTokens` /\n * `AdaptiveGroup`). Separate from `__sentient_overrides` (variant components):\n * a slot result is a token object (`{ tone: 'urgent' }`) or an arm string\n * (`'social_first'`), never a bare variant id. Window-backed so the /devtools\n * bundle and the main bundle share one store.\n */\nfunction store(): Record<string, SlotResult> {\n const w = window as unknown as { __sentient_slot_overrides?: Record<string, SlotResult> };\n if (!w.__sentient_slot_overrides) w.__sentient_slot_overrides = {};\n return w.__sentient_slot_overrides;\n}\n\n/** Force `slotId` to resolve to `result` — read by `useSlotResult`. */\nexport function setSlotOverride(slotId: string, result: SlotResult): void {\n store()[slotId] = result;\n}\n\nexport function clearSlotOverride(slotId: string): void {\n delete store()[slotId];\n}\n\nexport function getSlotOverrides(): Record<string, SlotResult> {\n return { ...store() };\n}\n","import type { SentientClient } from '@sentientui/core';\n\ntype PreviewState = { on: boolean; listeners: Set<() => void> };\nconst ssrFallback: PreviewState = { on: false, listeners: new Set() };\n\n// Window-backed: the /devtools entry (a separate bundle) toggles preview mode\n// and the provider (main bundle) must observe it.\nfunction state(): PreviewState {\n if (typeof window === 'undefined') return ssrFallback;\n const w = window as unknown as { __sentient_preview?: PreviewState };\n if (!w.__sentient_preview) w.__sentient_preview = { on: false, listeners: new Set() };\n return w.__sentient_preview;\n}\n\nexport function setPreviewMode(on: boolean): void {\n const s = state();\n if (s.on === on) return;\n s.on = on;\n for (const fn of s.listeners) fn();\n}\n\nexport function getPreviewMode(): boolean {\n return state().on;\n}\n\nexport function subscribePreview(fn: () => void): () => void {\n const listeners = state().listeners;\n listeners.add(fn);\n return () => {\n listeners.delete(fn);\n };\n}\n\n/**\n * Wraps a client so it writes nothing: reads pass through, all emitters no-op.\n * Used while previewing variants/personas so no `variant_assigned`, goal, or\n * session events are sent.\n */\nexport function createPreviewClient(inner: SentientClient): SentientClient {\n return {\n isLocal: inner.isLocal,\n track: () => undefined,\n goal: () => undefined,\n componentGoal: () => undefined,\n identify: () => undefined,\n fetchWeights: () => Promise.resolve([]),\n getAssignment: (componentId, segment) => inner.getAssignment(componentId, segment),\n assign: (componentId, variantIds, agentData, agentDataByVariant) =>\n inner.assign(componentId, variantIds, agentData, agentDataByVariant),\n // Reads pass through; decide is a write (slot decisions persist server-side)\n // so preview mode never issues it.\n decide: () => Promise.resolve(null),\n getSlotResult: (slotId) => inner.getSlotResult(slotId),\n getSlotConfig: (slotId) => inner.getSlotConfig(slotId),\n getSitePalette: () => inner.getSitePalette(),\n reportSlots: (ids) => inner.reportSlots(ids),\n getPersona: () => inner.getPersona(),\n getGraph: () => inner.getGraph(),\n flush: () => inner.flush(),\n dispose: () => inner.dispose(),\n destroy: () => inner.destroy(),\n };\n}\n","/**\n * Cross-bundle re-render bus for devtools overrides. The main entry and the\n * /devtools entry are separate bundles, so state and notifications go through\n * window (a version counter + a DOM event) — never module-local state.\n */\nconst EVENT = 'sentient:overrides-changed';\n\ntype VersionWindow = Window & { __sentient_overrides_version?: number };\n\nexport function getOverridesVersion(): number {\n if (typeof window === 'undefined') return 0;\n return (window as VersionWindow).__sentient_overrides_version ?? 0;\n}\n\nexport function notifyOverridesChanged(): void {\n if (typeof window === 'undefined') return;\n const w = window as VersionWindow;\n w.__sentient_overrides_version = (w.__sentient_overrides_version ?? 0) + 1;\n window.dispatchEvent(new Event(EVENT));\n}\n\nexport function subscribeOverridesChanged(fn: () => void): () => void {\n if (typeof window === 'undefined') return () => undefined;\n window.addEventListener(EVENT, fn);\n return () => window.removeEventListener(EVENT, fn);\n}\n","/** Provider → devtools config handoff. Window-backed: the /devtools entry is a\n * separate bundle and cannot share the provider's React context instance. */\nexport type DevtoolsConfig = {\n apiKey: string;\n apiBaseUrl: string;\n isLocal: boolean;\n};\n\ntype ConfigWindow = Window & { __sentient_devtools_config?: DevtoolsConfig };\n\nexport function publishDevtoolsConfig(config: DevtoolsConfig): void {\n if (typeof window === 'undefined') return;\n (window as ConfigWindow).__sentient_devtools_config = config;\n}\n\nexport function readDevtoolsConfig(): DevtoolsConfig | null {\n if (typeof window === 'undefined') return null;\n return (window as ConfigWindow).__sentient_devtools_config ?? null;\n}\n"],"mappings":";27BAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,sBAAAE,GAAA,+BAAAC,GAAA,wBAAAC,IAAA,eAAAC,GAAAL,IAGA,IAAAM,EAAoG,iBACpGC,EAAmG,8BACnGC,EAA2F,4BCgB3F,IAAMC,GAA6B,CACjC,WAAY,IAAI,IAChB,MAAO,IAAI,IACX,SAAU,CAAC,EACX,UAAW,IAAI,IACf,QAAS,CACX,EAEA,SAASC,GAAuB,CAC9B,GAAI,OAAO,QAAW,YAAa,OAAOD,GAC1C,IAAME,EAAI,OACV,OAAKA,EAAE,sBACLA,EAAE,oBAAsB,CACtB,WAAY,IAAI,IAChB,MAAO,IAAI,IACX,SAAU,CAAC,EACX,UAAW,IAAI,IACf,QAAS,CACX,GAEKA,EAAE,mBACX,CA6CO,SAASC,GAAuC,CACrD,MAAO,CAAC,GAAGC,EAAM,EAAE,WAAW,OAAO,CAAC,CACxC,CAEO,SAASC,GAAuC,CACrD,MAAO,CAAC,GAAGD,EAAM,EAAE,MAAM,OAAO,CAAC,CACnC,CAEO,SAASE,GAAkC,CAChD,MAAO,CAAC,GAAGF,EAAM,EAAE,QAAQ,CAC7B,CAEO,SAASG,GAAkBC,EAA4B,CAC5D,IAAMC,EAAYL,EAAM,EAAE,UAC1B,OAAAK,EAAU,IAAID,CAAE,EACT,IAAM,CACXC,EAAU,OAAOD,CAAE,CACrB,CACF,CAGO,SAASE,IAA6B,CAC3C,OAAON,EAAM,EAAE,OACjB,CC9GA,SAASO,GAAgC,CACvC,IAAMC,EAAI,OACV,OAAKA,EAAE,uBAAsBA,EAAE,qBAAuB,CAAC,GAChDA,EAAE,oBACX,CAGO,SAASC,EAAmBC,EAAqBC,EAAyB,CAC/EJ,EAAM,EAAEG,CAAW,EAAI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AA,GAJIA,CAKP,CACD,EACH,IAZQ6D,CAaV,CACD,EACAW,IAAO,WACN,OAAC,UAAO,QAAS,IAAML,GAAU9E,EAAE,EAAE,EAAG,MAAOiB,EAAA1B,EAAA,GAAKoC,EAAI,EAAK,GAAd,CAAiB,MAAO,OAAQ,UAAW,CAAE,GAAG,iBAE/F,IA9BM3B,EAAE,EAgCZ,CAEJ,CAAC,GACH,GAEJ,EACF,KACA,OAAC,UACC,aAAW,oBACX,gBAAegC,EACf,QAAS,IAAMC,EAASmD,GAAM,CAACA,CAAC,EAChC,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,aAAc,GAAI,OAAQ,oBAAqB,WAAY,OAClF,QAAS,OAAQ,WAAY,SAAU,eAAgB,SAAU,QAAS,EAC1E,OAAQ,UAAW,UAAW,2BAA4B,EAEnE,mBAACvD,GAAA,EAAa,EAChB,GACF,CAEJ","names":["devtools_exports","__export","AdaptiveDevtools","LOCAL_MODE_DEVTOOLS_BANNER","previewContextParam","__toCommonJS","import_react","import_policy","import_core","ssrFallback","state","w","getRegistered","state","getRegisteredSlots","getRegisteredSections","subscribeRegistry","fn","listeners","getRegistryVersion","store","w","setVariantOverride","componentId","variantId","clearVariantOverride","getOverrides","__spreadValues","store","w","setSlotOverride","slotId","result","clearSlotOverride","getSlotOverrides","__spreadValues","ssrFallback","state","w","setPreviewMode","on","s","fn","getPreviewMode","EVENT","notifyOverridesChanged","_a","w","EVENT","readDevtoolsConfig","_a","import_jsx_runtime","_a","IS_PROD","DEFAULT_API_BASE_URL","LOCAL_MODE_DEVTOOLS_BANNER","currentLayout","forced","registered","getRegisteredSections","id","reorderLayout","from","to","order","next","moved","setPreviewMode","notifyOverridesChanged","resetLayout","applyOutcome","result","_b","variantId","setVariantOverride","w","__spreadValues","readSessionId","apiKey","read","name","match","e","slotDecls","getRegisteredSlots","s","UNKNOWN_CHOICE","fetchPersonaVocabulary","apiBaseUrl","res","data","valid","list","p","personas","previewContextParam","v","forcePersonaKeyed","persona","_c","getRegistered","c","__spreadProps","forcePersonaLocal","mod","outcome","resetAll","getOverrides","clearVariantOverride","stale","i","key","btn","active","SentientMark","size","AdaptiveDevtools","open","setOpen","activePersona","setActivePersona","vocab","setVocab","customKey","setCustomKey","discovered","setDiscovered","personaNote","setPersonaNote","dragFrom","setDragFrom","mounted","setMounted","force","subscribeRegistry","getRegistryVersion","cfg","readDevtoolsConfig","cancelled","config","useLocalEngine","components","slots","overrides","slotOverrides","getSlotOverrides","sections","layoutForced","onReorder","onResetLayout","maybeExitPreview","choose","resetVariant","chooseSlotArm","arm","setSlotOverride","chooseSlotDim","dim","value","dims","current","d","values","resetSlot","clearSlotOverride","choosePersona","member","getPreviewMode","ov","o"]}
1
+ {"version":3,"sources":["../src/devtools/index.tsx","../src/devtools-registry.ts","../src/devtools-overrides.ts","../src/devtools-slot-overrides.ts","../src/preview-mode.ts","../src/override-events.ts","../src/devtools-config.ts"],"sourcesContent":["'use client';\n// `type JSX` from react, not the global namespace removed in @types/react@19\n// (peers allow react >=18) — see adaptive-text.tsx.\nimport { useEffect, useReducer, useState, useSyncExternalStore, type CSSProperties, type JSX } from 'react';\nimport { UNKNOWN_PERSONA, UNKNOWN_PERSONA_DISPLAY, confidenceBand, normalizeDeclaredPersona } from '@sentientui/policy';\nimport { LEGACY_SESSION_COOKIE_NAME, SNAPSHOT_STORAGE_KEY_PREFIX, sessionCookieName } from '@sentientui/core';\nimport {\n getRegistered,\n getRegisteredSlots,\n getRegisteredSections,\n subscribeRegistry,\n getRegistryVersion,\n type RegisteredSlot,\n} from '../devtools-registry.js';\nimport { setVariantOverride, clearVariantOverride, getOverrides } from '../devtools-overrides.js';\nimport { setSlotOverride, clearSlotOverride, getSlotOverrides } from '../devtools-slot-overrides.js';\nimport { setPreviewMode, getPreviewMode } from '../preview-mode.js';\nimport { notifyOverridesChanged } from '../override-events.js';\nimport { readDevtoolsConfig, type DevtoolsConfig } from '../devtools-config.js';\n\ndeclare const process: { env?: { NODE_ENV?: string } } | undefined;\nconst IS_PROD = typeof process !== 'undefined' && process.env?.NODE_ENV === 'production';\nconst DEFAULT_API_BASE_URL = 'https://api.sentient-ui.com/v1';\n\nexport const LOCAL_MODE_DEVTOOLS_BANNER =\n 'Local mode — decisions are simulated; add a key to learn from real traffic';\n\ntype OutcomeToApply = {\n assignments?: Record<string, string>;\n layoutOrder?: string[] | null;\n slots?: Record<string, string | Record<string, string>>;\n personaAttributes?: { persona: string; confidence: 'low' | 'medium' | 'high' };\n};\n\ntype OverrideWindow = Window & {\n __sentient_layout_override?: string[];\n __sentient_slot_overrides?: Record<string, string | Record<string, string>>;\n};\n\n/** The order the page is rendering: a previewed override, else what was registered. */\nfunction currentLayout(): string[] {\n const forced = (window as unknown as OverrideWindow).__sentient_layout_override;\n const registered = getRegisteredSections();\n if (!forced || forced.length === 0) return registered;\n // Registered ids the override omits still render (useLayoutOrder returns the\n // override verbatim, and the app maps whatever ids it is given), so show them\n // trailing rather than dropping them from the list you are dragging.\n return [...forced, ...registered.filter((id) => !forced.includes(id))];\n}\n\n/**\n * Move `from` to `to` within the current order and preview it.\n *\n * Writes the whole order rather than swapping neighbours: the point is to try an\n * arrangement, not to walk one block up a list one press at a time.\n */\nfunction reorderLayout(from: number, to: number): void {\n const order = currentLayout();\n if (from === to || from < 0 || to < 0 || from >= order.length || to >= order.length) return;\n const next = [...order];\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved!);\n (window as unknown as OverrideWindow).__sentient_layout_override = next;\n setPreviewMode(true); // an arrangement you are trying must not train the bandit\n notifyOverridesChanged();\n}\n\nfunction resetLayout(): void {\n delete (window as unknown as OverrideWindow).__sentient_layout_override;\n notifyOverridesChanged();\n}\n\n/** Apply a simulated outcome across every surface: variants, layout, slots/tokens, persona attrs. */\nfunction applyOutcome(result: OutcomeToApply): void {\n for (const [id, variantId] of Object.entries(result.assignments ?? {})) {\n setVariantOverride(id, variantId);\n }\n const w = window as unknown as OverrideWindow;\n if (result.layoutOrder && result.layoutOrder.length > 0) {\n w.__sentient_layout_override = result.layoutOrder;\n }\n if (result.slots) {\n w.__sentient_slot_overrides = { ...(w.__sentient_slot_overrides ?? {}), ...result.slots };\n }\n if (result.personaAttributes) {\n document.documentElement.dataset.sentientPersona = result.personaAttributes.persona;\n document.documentElement.dataset.sentientConfidence = result.personaAttributes.confidence;\n }\n setPreviewMode(true); // suppress events while previewing\n notifyOverridesChanged(); // re-render layout/slot consumers\n}\n\n// Reads the SDK's own session cookie — the per-project SUFFIXED name first\n// (that is what the client writes since namespacing; the bare `_snt_uid` this\n// used to read is only written in keyless/local mode), then the bare name as\n// the legacy/local fallback.\nfunction readSessionId(apiKey?: string): string {\n const read = (name: string): string | null => {\n try {\n const match = document.cookie.match(new RegExp(`(?:^|; )${name}=([^;]*)`));\n return match ? decodeURIComponent(match[1]!) : null;\n } catch {\n return null;\n }\n };\n return (apiKey ? read(sessionCookieName(apiKey)) : null) ?? read(LEGACY_SESSION_COOKIE_NAME) ?? 'devtools-preview';\n}\n\nfunction slotDecls(): Array<{ id: string; arms?: string[]; dims?: RegisteredSlot['dims'] }> {\n return getRegisteredSlots().map((s) => ({\n id: s.id,\n ...(s.arms ? { arms: s.arms } : {}),\n ...(s.dims ? { dims: s.dims } : {}),\n }));\n}\n\n/** One member of the project's persona vocabulary, as /v1/personas serves it. */\ntype VocabMember = { key: string; displayName: string };\n\n/** Always offered: previewing the unidentified visitor is meaningful on every\n * project, and it is the only persona the product itself defines. */\nconst UNKNOWN_CHOICE: VocabMember = { key: UNKNOWN_PERSONA, displayName: UNKNOWN_PERSONA_DISPLAY };\n\n/**\n * Keyed mode: the project's ACTIVE vocabulary from /v1/personas. Personas are\n * per-project (persona_sets, migration 113) — declared by the app or promoted\n * by discovery. This used to fall back to a hardcoded list of four seeded\n * personas, which offered buttons that silently simulated the default\n * experience on any project whose vocabulary differs, and named audiences\n * nobody had declared. null on any failure → the panel offers only `unknown`\n * and a free-text key.\n */\nasync function fetchPersonaVocabulary(\n apiKey: string,\n apiBaseUrl: string,\n): Promise<{ personas: VocabMember[]; discovered: VocabMember[] } | null> {\n try {\n const res = await fetch(`${apiBaseUrl}/personas`, {\n headers: { authorization: `Bearer ${apiKey}` },\n });\n if (!res.ok) return null;\n const data = (await res.json()) as { personas?: VocabMember[]; discovered?: VocabMember[] };\n const valid = (list: VocabMember[] | undefined): VocabMember[] =>\n Array.isArray(list)\n ? list.filter((p) => p && typeof p.key === 'string' && typeof p.displayName === 'string')\n : [];\n const personas = valid(data.personas);\n return personas.length > 0 ? { personas, discovered: valid(data.discovered) } : null;\n } catch {\n return null;\n }\n}\n\n/**\n * `?sentient_context=<context>` on the page URL: the on-site context preview\n * (a stage such as `carted`, or an arrival class such as `cart_recovery`).\n * Forwarded to /v1/explain so a persona simulated from this panel is also\n * simulated in that context — the API validates the value (400 on anything\n * else) and applies it to the project's published (registry) versions:\n * those restricted to the context become eligible and its pins win. Lives\n * here, not in the provider: devtools is the React SDK's only explain-backed\n * preview, and the main bundle pays for nothing it does not use.\n * @internal Exported for tests.\n */\nexport function previewContextParam(): string | null {\n try {\n const v = new URLSearchParams(window.location.search).get('sentient_context');\n return v && /^[a-z_]{1,40}$/.test(v) ? v : null;\n } catch {\n return null;\n }\n}\n\n/** Keyed mode: simulate via /v1/explain (read-only, event-free). Returns how\n * the persona RESOLVED so the panel can say when the project didn't\n * recognize it — the page then shows the default experience, and a silently\n * highlighted button claiming otherwise was the old lie. */\nasync function forcePersonaKeyed(\n apiKey: string,\n apiBaseUrl: string,\n persona: string,\n): Promise<{ recognized: boolean; resolvedDisplay: string } | null> {\n const res = await fetch(`${apiBaseUrl}/explain`, {\n method: 'POST',\n headers: { 'content-type': 'application/json', authorization: `Bearer ${apiKey}` },\n body: JSON.stringify({\n persona,\n sections: getRegisteredSections().map((id) => ({ id })),\n components: getRegistered().map((c) => ({ id: c.id, variantIds: c.variantIds })),\n slots: slotDecls(),\n ...(previewContextParam() ? { context: previewContextParam() } : {}),\n }),\n });\n if (!res.ok) return null;\n const data = (await res.json()) as OutcomeToApply & {\n recognized?: boolean;\n persona?: string;\n personaDisplay?: string;\n };\n applyOutcome({\n ...data,\n personaAttributes: data.personaAttributes ?? { persona, confidence: 'high' },\n });\n return {\n // An older API omits the field — treat as recognized (no basis to warn).\n recognized: data.recognized !== false,\n resolvedDisplay: data.personaDisplay ?? data.persona ?? persona,\n };\n}\n\n/** Local mode: simulate via the deterministic local engine — zero network. */\nasync function forcePersonaLocal(persona: string, apiKey?: string): Promise<void> {\n const mod = await import('@sentientui/core/local');\n if (!mod.LOCAL_ENGINE_AVAILABLE) return;\n const outcome = mod\n .createLocalEngine({ sessionId: readSessionId(apiKey), forcedPersona: persona })\n .decide({\n sections: getRegisteredSections(),\n components: getRegistered().map((c) => ({ id: c.id, variantIds: c.variantIds })),\n slots: slotDecls(),\n });\n applyOutcome({\n assignments: outcome.assignments,\n layoutOrder: outcome.layoutOrder,\n slots: outcome.slots,\n personaAttributes: {\n persona: outcome.persona,\n confidence: confidenceBand(outcome.confidence),\n },\n });\n}\n\n/** Reset: clear the decision snapshot + every override, then reload to re-decide. */\nfunction resetAll(): void {\n for (const id of Object.keys(getOverrides())) clearVariantOverride(id);\n const w = window as unknown as OverrideWindow;\n delete w.__sentient_layout_override;\n delete w.__sentient_slot_overrides;\n delete document.documentElement.dataset.sentientPersona;\n delete document.documentElement.dataset.sentientConfidence;\n try {\n const stale: string[] = [];\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key && key.startsWith(SNAPSHOT_STORAGE_KEY_PREFIX)) stale.push(key);\n }\n for (const key of stale) localStorage.removeItem(key);\n } catch {\n /* ignore */\n }\n setPreviewMode(false);\n notifyOverridesChanged();\n try {\n window.location.reload();\n } catch {\n /* jsdom */\n }\n}\n\nconst btn = (active: boolean): CSSProperties => ({\n padding: '2px 8px',\n borderRadius: 4,\n border: '1px solid #444',\n background: active ? '#3b82f6' : '#222',\n color: '#eee',\n cursor: 'pointer',\n});\n\n/** Sentient \"S.\" wordmark, monoline — white strokes for the black launcher button. */\nfunction SentientMark({ size = 26 }: { size?: number } = {}): JSX.Element {\n return (\n <svg width={size} height={size} viewBox=\"0 0 32 32\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M21 9H14C11.2 9 9.8 10.8 9.8 13C9.8 15.4 11.6 16.6 14.5 16.6H18.5C20.5 16.6 20.7 18.2 20.4 19.6\"\n stroke=\"#fff\"\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path d=\"M10 22H17\" stroke=\"#fff\" strokeWidth=\"2.2\" strokeLinecap=\"round\" />\n <circle cx=\"20.6\" cy=\"22\" r=\"2.1\" fill=\"#fff\" />\n </svg>\n );\n}\n\nexport function AdaptiveDevtools({ apiKey }: { apiKey?: string } = {}): JSX.Element | null {\n const [open, setOpen] = useState(false);\n const [activePersona, setActivePersona] = useState<string | null>(null);\n // The project's vocabulary (keyed mode); null = not loaded → no persona\n // buttons beyond `unknown`. Local mode never fetches: there is no project,\n // and the local engine previews ANY key typed into the free-text field.\n const [vocab, setVocab] = useState<VocabMember[] | null>(null);\n const [customKey, setCustomKey] = useState('');\n // Discovered SHADOW personas — display-only. They never serve until\n // promotion, so there is no button: forcing one would simulate a persona\n // that cannot occur on this project.\n const [discovered, setDiscovered] = useState<VocabMember[]>([]);\n // Set when a forced persona did NOT resolve against the project's\n // vocabulary — the page is showing the default experience and the panel\n // must say so instead of highlighting the button as if the preview worked.\n const [personaNote, setPersonaNote] = useState<string | null>(null);\n const [dragFrom, setDragFrom] = useState<number | null>(null);\n const [mounted, setMounted] = useState(false);\n const [, force] = useReducer((n: number) => n + 1, 0);\n // Re-render when the component/slot registry changes. useSyncExternalStore\n // (not a manual useEffect subscription) so the subscription can't go stale\n // across Next Fast Refresh — a stale listener was why the panel needed a hard\n // refresh to pick up a renamed id.\n useSyncExternalStore(subscribeRegistry, getRegistryVersion, () => 0);\n // Client-mount gate: render nothing during SSR / the first paint so the widget\n // never reads `window` on the server. Lets consumers drop `<AdaptiveDevtools/>`\n // straight into a tree without a `dynamic(..., { ssr: false })` wrapper.\n useEffect(() => setMounted(true), []);\n // Load the project's persona vocabulary once (keyed mode only).\n useEffect(() => {\n if (IS_PROD) return;\n const cfg = readDevtoolsConfig() ?? { apiKey: apiKey ?? '', apiBaseUrl: DEFAULT_API_BASE_URL, isLocal: false };\n if (cfg.isLocal || !cfg.apiKey) return;\n let cancelled = false;\n void fetchPersonaVocabulary(cfg.apiKey, cfg.apiBaseUrl).then((v) => {\n if (cancelled || !v) return;\n setVocab(v.personas);\n setDiscovered(v.discovered);\n });\n return () => { cancelled = true; };\n }, [apiKey]);\n\n // Never render in production, even if imported by mistake. (Hooks run first\n // so the rules of hooks hold regardless of these early returns.)\n if (IS_PROD) return null;\n if (!mounted) return null;\n\n const config: DevtoolsConfig = readDevtoolsConfig() ?? {\n apiKey: apiKey ?? '',\n apiBaseUrl: DEFAULT_API_BASE_URL,\n isLocal: false,\n };\n const useLocalEngine = config.isLocal || !config.apiKey;\n const components = getRegistered();\n const slots = getRegisteredSlots();\n const overrides = getOverrides();\n const slotOverrides = getSlotOverrides();\n const sections = currentLayout();\n const layoutForced = (window as unknown as OverrideWindow).__sentient_layout_override !== undefined;\n\n function onReorder(from: number, to: number): void {\n reorderLayout(from, to);\n force();\n }\n function onResetLayout(): void {\n resetLayout();\n maybeExitPreview();\n force();\n }\n\n // Preview mode stays on while ANY override (variant, slot or layout) is\n // active. Omitting layout here let clearing the last variant re-enable event\n // recording while a previewed section order was still on screen.\n function maybeExitPreview(): void {\n if (\n Object.keys(getOverrides()).length === 0 &&\n Object.keys(getSlotOverrides()).length === 0 &&\n (window as unknown as OverrideWindow).__sentient_layout_override === undefined\n ) {\n setPreviewMode(false);\n }\n }\n\n function choose(id: string, variantId: string): void {\n setVariantOverride(id, variantId);\n setPreviewMode(true);\n notifyOverridesChanged();\n force();\n }\n function resetVariant(id: string): void {\n clearVariantOverride(id);\n maybeExitPreview();\n notifyOverridesChanged();\n force();\n }\n function chooseSlotArm(id: string, arm: string): void {\n setSlotOverride(id, arm);\n setPreviewMode(true);\n notifyOverridesChanged();\n force();\n }\n function chooseSlotDim(id: string, dim: string, value: string, dims: RegisteredSlot['dims']): void {\n const current = getSlotOverrides()[id];\n // Merge onto the existing forced object, or seed from each dim's baseline\n // (first value) so unset dims stay at baseline instead of vanishing.\n const next: Record<string, string> =\n current && typeof current === 'object'\n ? { ...current }\n : Object.fromEntries(Object.entries(dims ?? {}).map(([d, values]) => [d, values[0]!]));\n next[dim] = value;\n setSlotOverride(id, next);\n setPreviewMode(true);\n notifyOverridesChanged();\n force();\n }\n function resetSlot(id: string): void {\n clearSlotOverride(id);\n maybeExitPreview();\n notifyOverridesChanged();\n force();\n }\n function choosePersona(member: VocabMember): void {\n setActivePersona(member.key);\n setPersonaNote(null);\n // .catch: a failed simulate (offline /v1/explain, bad key, failed local\n // dynamic import) is a preview no-op — without the handler it surfaced as\n // an unhandled promise rejection in the console.\n if (useLocalEngine) {\n forcePersonaLocal(member.key, config.apiKey).then(force).catch(() => {});\n return;\n }\n forcePersonaKeyed(config.apiKey, config.apiBaseUrl, member.key)\n .then((r) => {\n if (r && !r.recognized) {\n setPersonaNote(\n `“${member.displayName}” isn’t in this project’s personas — the page is showing the default experience.`,\n );\n }\n force();\n })\n .catch(() => {});\n }\n\n return (\n <div style={{ position: 'fixed', bottom: 16, right: 16, zIndex: 2147483647, fontFamily: 'system-ui' }}>\n {/* Panel stays mounted and animates in/out from the button's corner, so the\n launcher below never shifts. transform-origin is the button (bottom-right). */}\n <div\n aria-hidden={!open}\n style={{\n position: 'absolute',\n bottom: 52,\n right: 0,\n transformOrigin: 'bottom right',\n transition: 'opacity .18s ease, transform .2s cubic-bezier(.16,1,.3,1)',\n opacity: open ? 1 : 0,\n transform: open ? 'translateY(0) scale(1)' : 'translateY(6px) scale(.96)',\n pointerEvents: open ? 'auto' : 'none',\n }}\n >\n <div style={{ width: 300, maxHeight: 460, overflowY: 'auto', background: '#111', color: '#eee',\n borderRadius: 8, padding: 12, boxShadow: '0 8px 30px rgba(0,0,0,.4)', fontSize: 12 }}>\n {config.isLocal && (\n <div style={{ background: '#1e293b', border: '1px solid #334155', borderRadius: 4,\n padding: '6px 8px', marginBottom: 8 }}>\n {LOCAL_MODE_DEVTOOLS_BANNER}\n </div>\n )}\n <div style={{ opacity: .7, marginBottom: 8 }}>\n {components.length} component{components.length === 1 ? '' : 's'} · {getPreviewMode() ? 'preview — writing nothing' : 'live'}\n </div>\n <div style={{ borderBottom: '1px solid #333', paddingBottom: 8, marginBottom: 8 }}>\n <div style={{ opacity: .7, marginBottom: 4 }}>Preview persona</div>\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 4 }}>\n {/* Keyed mode renders the project's OWN vocabulary once\n /v1/personas answers; nothing is invented while it hasn't. */}\n {[...(useLocalEngine ? [] : vocab ?? []), UNKNOWN_CHOICE].map((p) => (\n <button key={p.key} onClick={() => choosePersona(p)} style={btn(activePersona === p.key)}>\n {p.displayName}\n </button>\n ))}\n {(activePersona !== null || Object.keys(overrides).length > 0 || Object.keys(slotOverrides).length > 0) && (\n <button onClick={resetAll} style={{ ...btn(false), color: '#aaa' }}>\n Reset\n </button>\n )}\n </div>\n <form\n onSubmit={(e) => {\n e.preventDefault();\n const key = normalizeDeclaredPersona(customKey);\n if (key) choosePersona({ key, displayName: key });\n }}\n style={{ display: 'flex', gap: 4, marginTop: 6 }}\n >\n <input\n aria-label=\"Persona key\"\n placeholder=\"any persona key, e.g. admin\"\n value={customKey}\n onChange={(e) => setCustomKey(e.target.value)}\n style={{ flex: 1, minWidth: 0, background: '#111', color: '#fff', border: '1px solid #333',\n borderRadius: 4, padding: '4px 6px', fontSize: 12 }}\n />\n <button type=\"submit\" style={btn(false)}>Preview</button>\n </form>\n {personaNote && (\n <div style={{ marginTop: 6, fontSize: 11, color: '#fbbf24' }}>{personaNote}</div>\n )}\n {!useLocalEngine && discovered.length > 0 && (\n <div style={{ marginTop: 8 }}>\n <div style={{ opacity: .5, fontSize: 11, marginBottom: 4 }}>\n Discovered — not serving yet (promote from the dashboard)\n </div>\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 4 }}>\n {discovered.map((p) => (\n <span\n key={p.key}\n title=\"Found by clustering your traffic; it starts serving only after promotion.\"\n style={{ ...btn(false), opacity: .45, cursor: 'default', display: 'inline-block' }}\n >\n {p.displayName}\n </span>\n ))}\n </div>\n </div>\n )}\n </div>\n {sections.length > 0 && (\n <div style={{ borderBottom: '1px solid #333', paddingBottom: 8, marginBottom: 8 }}>\n <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 4 }}>\n <span style={{ opacity: .7 }}>Layout — drag to reorder</span>\n {layoutForced && (\n // Distinct accessible name: the per-variant and per-slot resets\n // below are also labelled \"reset\", and three identical buttons\n // in one panel is ambiguous to a screen reader and to tests.\n <button\n aria-label=\"Reset section order\"\n onClick={onResetLayout}\n style={{ ...btn(false), color: '#aaa' }}\n >\n reset\n </button>\n )}\n </div>\n {/* Drop-on-row inserts at that row's position, so any block can go\n anywhere in one gesture. The whole order is written on each\n drop — see reorderLayout. */}\n <ul aria-label=\"Section order\" style={{ listStyle: 'none', margin: 0, padding: 0 }}>\n {sections.map((id, i) => (\n <li\n key={id}\n draggable\n onDragStart={() => setDragFrom(i)}\n onDragOver={(e) => e.preventDefault()}\n onDrop={(e) => {\n e.preventDefault();\n if (dragFrom !== null) onReorder(dragFrom, i);\n setDragFrom(null);\n }}\n onDragEnd={() => setDragFrom(null)}\n style={{\n display: 'flex', alignItems: 'center', gap: 6, padding: '4px 6px', marginBottom: 2,\n borderRadius: 4, border: '1px solid #262626', cursor: 'grab',\n background: dragFrom === i ? '#1e293b' : '#181818',\n opacity: dragFrom !== null && dragFrom !== i ? .6 : 1,\n }}\n >\n <span style={{ opacity: .4, minWidth: 10, fontVariantNumeric: 'tabular-nums' }}>{i + 1}</span>\n <span aria-hidden=\"true\" style={{ opacity: .35 }}>⠿</span>\n <span style={{ flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>\n {id}\n </span>\n </li>\n ))}\n </ul>\n </div>\n )}\n {components.length === 0 && slots.length === 0 && sections.length === 0 && (\n <div style={{ opacity: .6 }}>No components, sections or slots on this page yet.</div>\n )}\n {components.map((c) => (\n <div key={c.id} style={{ borderTop: '1px solid #333', padding: '8px 0' }}>\n <div style={{ fontWeight: 600 }}>{c.id}{c.goal ? ` · goal: ${c.goal}` : ''}</div>\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 4, marginTop: 4 }}>\n {c.variantIds.map((v) => (\n <button key={v} onClick={() => choose(c.id, v)} style={btn(overrides[c.id] === v)}>\n {v}\n </button>\n ))}\n {overrides[c.id] && (\n <button onClick={() => resetVariant(c.id)} style={{ ...btn(false), color: '#aaa' }}>\n reset\n </button>\n )}\n </div>\n </div>\n ))}\n {slots.length > 0 && (\n <div style={{ borderTop: '1px solid #333', paddingTop: 8, marginTop: 4 }}>\n <div style={{ opacity: .7, marginBottom: 4 }}>Slots</div>\n {slots.map((s) => {\n const ov = slotOverrides[s.id];\n return (\n <div key={s.id} style={{ padding: '6px 0' }}>\n <div style={{ fontWeight: 600 }}>{s.id}</div>\n {s.arms && (\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 4, marginTop: 4 }}>\n {s.arms.map((arm) => (\n <button key={arm} onClick={() => chooseSlotArm(s.id, arm)} style={btn(ov === arm)}>\n {arm}\n </button>\n ))}\n </div>\n )}\n {s.dims && Object.entries(s.dims).map(([dim, values]) => (\n <div key={dim} style={{ marginTop: 4 }}>\n <div style={{ opacity: .6, fontSize: 11 }}>{dim}</div>\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 4 }}>\n {values.map((v) => (\n <button\n key={v}\n onClick={() => chooseSlotDim(s.id, dim, v, s.dims)}\n style={btn(!!ov && typeof ov === 'object' && ov[dim] === v)}\n >\n {v}\n </button>\n ))}\n </div>\n </div>\n ))}\n {ov !== undefined && (\n <button onClick={() => resetSlot(s.id)} style={{ ...btn(false), color: '#aaa', marginTop: 4 }}>\n reset\n </button>\n )}\n </div>\n );\n })}\n </div>\n )}\n </div>\n </div>\n <button\n aria-label=\"Sentient DevTools\"\n aria-expanded={open}\n onClick={() => setOpen((o) => !o)}\n style={{ width: 44, height: 44, borderRadius: 12, border: '1px solid #2a2a2a', background: '#000',\n display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 0,\n cursor: 'pointer', boxShadow: '0 6px 18px rgba(0,0,0,.4)' }}\n >\n <SentientMark />\n </button>\n </div>\n );\n}\n","import { isDevBuild } from './adaptive-shared.js';\n\nexport type RegisteredComponent = { id: string; variantIds: string[]; goal?: string };\nexport type RegisteredSlot = {\n id: string;\n arms?: string[];\n dims?: Record<string, readonly string[]>;\n};\n\ntype RegistryState = {\n components: Map<string, RegisteredComponent>;\n slots: Map<string, RegisteredSlot>;\n sections: string[];\n listeners: Set<() => void>;\n /** Bumped on every mutation so `useSyncExternalStore` can read a stable, comparable snapshot. */\n version: number;\n};\n\n// Shared through a window global: the main entry and the /devtools entry are\n// separate bundles, each with its own copy of this module — module-local\n// state would give the devtools an always-empty registry in published apps.\nconst ssrFallback: RegistryState = {\n components: new Map(),\n slots: new Map(),\n sections: [],\n listeners: new Set(),\n version: 0,\n};\n\nfunction state(): RegistryState {\n if (typeof window === 'undefined') return ssrFallback;\n const w = window as unknown as { __sentient_registry?: RegistryState };\n if (!w.__sentient_registry) {\n w.__sentient_registry = {\n components: new Map(),\n slots: new Map(),\n sections: [],\n listeners: new Set(),\n version: 0,\n };\n }\n return w.__sentient_registry;\n}\n\nfunction emit(): void {\n // Bump BEFORE notifying so a useSyncExternalStore consumer re-reading its\n // snapshot inside the notification sees the new value and re-renders.\n state().version += 1;\n for (const fn of state().listeners) fn();\n}\n\n// The registry exists solely to feed the opt-in devtools panel, which is a\n// dev-only surface. In a production build there is no panel reading it, so\n// every register call is dead work plus a `window.__sentient_registry`\n// footprint on the customer's page. Short-circuit to a noop in production —\n// every <Adaptive>/useAdaptive/slot mount calls one of these.\nconst NOOP_UNREGISTER = (): void => undefined;\n\n/** Register (or re-register) a component. Returns an unregister function. */\nexport function registerComponent(c: RegisteredComponent): () => void {\n if (!isDevBuild()) return NOOP_UNREGISTER;\n state().components.set(c.id, c);\n emit();\n return () => {\n state().components.delete(c.id);\n emit();\n };\n}\n\n/** Register (or re-register) a slot declaration. Returns an unregister function. */\nexport function registerSlot(s: RegisteredSlot): () => void {\n if (!isDevBuild()) return NOOP_UNREGISTER;\n state().slots.set(s.id, s);\n emit();\n return () => {\n state().slots.delete(s.id);\n emit();\n };\n}\n\n/** Register the page's declared section ids (from AdaptiveRoot/provider). */\nexport function registerSections(sections: string[]): void {\n if (!isDevBuild()) return;\n state().sections = [...sections];\n emit();\n}\n\nexport function getRegistered(): RegisteredComponent[] {\n return [...state().components.values()];\n}\n\nexport function getRegisteredSlots(): RegisteredSlot[] {\n return [...state().slots.values()];\n}\n\nexport function getRegisteredSections(): string[] {\n return [...state().sections];\n}\n\nexport function subscribeRegistry(fn: () => void): () => void {\n const listeners = state().listeners;\n listeners.add(fn);\n return () => {\n listeners.delete(fn);\n };\n}\n\n/** Monotonic snapshot for `useSyncExternalStore` — changes on every registry mutation. */\nexport function getRegistryVersion(): number {\n return state().version;\n}\n","function store(): Record<string, string> {\n const w = window as unknown as { __sentient_overrides?: Record<string, string> };\n if (!w.__sentient_overrides) w.__sentient_overrides = {};\n return w.__sentient_overrides;\n}\n\n/** Force `componentId` to render `variantId` — read by `useAssignment`. */\nexport function setVariantOverride(componentId: string, variantId: string): void {\n store()[componentId] = variantId;\n}\n\nexport function clearVariantOverride(componentId: string): void {\n delete store()[componentId];\n}\n\nexport function getOverrides(): Record<string, string> {\n return { ...store() };\n}\n","import type { SlotResult } from '@sentientui/core';\n\n/**\n * Slot-override store — the channel `useSlotResult` reads (`useAdaptiveTokens` /\n * `AdaptiveGroup`). Separate from `__sentient_overrides` (variant components):\n * a slot result is a token object (`{ tone: 'urgent' }`) or an arm string\n * (`'social_first'`), never a bare variant id. Window-backed so the /devtools\n * bundle and the main bundle share one store.\n */\nfunction store(): Record<string, SlotResult> {\n const w = window as unknown as { __sentient_slot_overrides?: Record<string, SlotResult> };\n if (!w.__sentient_slot_overrides) w.__sentient_slot_overrides = {};\n return w.__sentient_slot_overrides;\n}\n\n/** Force `slotId` to resolve to `result` — read by `useSlotResult`. */\nexport function setSlotOverride(slotId: string, result: SlotResult): void {\n store()[slotId] = result;\n}\n\nexport function clearSlotOverride(slotId: string): void {\n delete store()[slotId];\n}\n\nexport function getSlotOverrides(): Record<string, SlotResult> {\n return { ...store() };\n}\n","import type { SentientClient } from '@sentientui/core';\n\ntype PreviewState = { on: boolean; listeners: Set<() => void> };\nconst ssrFallback: PreviewState = { on: false, listeners: new Set() };\n\n// Window-backed: the /devtools entry (a separate bundle) toggles preview mode\n// and the provider (main bundle) must observe it.\nfunction state(): PreviewState {\n if (typeof window === 'undefined') return ssrFallback;\n const w = window as unknown as { __sentient_preview?: PreviewState };\n if (!w.__sentient_preview) w.__sentient_preview = { on: false, listeners: new Set() };\n return w.__sentient_preview;\n}\n\nexport function setPreviewMode(on: boolean): void {\n const s = state();\n if (s.on === on) return;\n s.on = on;\n for (const fn of s.listeners) fn();\n}\n\nexport function getPreviewMode(): boolean {\n return state().on;\n}\n\nexport function subscribePreview(fn: () => void): () => void {\n const listeners = state().listeners;\n listeners.add(fn);\n return () => {\n listeners.delete(fn);\n };\n}\n\n/**\n * Wraps a client so it writes nothing: reads pass through, all emitters no-op.\n * Used while previewing variants/personas so no `variant_assigned`, goal, or\n * session events are sent.\n */\nexport function createPreviewClient(inner: SentientClient): SentientClient {\n return {\n isLocal: inner.isLocal,\n track: () => undefined,\n goal: () => undefined,\n componentGoal: () => undefined,\n identify: () => undefined,\n fetchWeights: () => Promise.resolve([]),\n getAssignment: (componentId, segment) => inner.getAssignment(componentId, segment),\n isUnified: (componentId) => inner.isUnified?.(componentId) ?? false,\n assign: (componentId, variantIds, agentData, agentDataByVariant, opts) =>\n inner.assign(componentId, variantIds, agentData, agentDataByVariant, opts),\n // Reads pass through; decide is a write (slot decisions persist server-side)\n // so preview mode never issues it.\n decide: () => Promise.resolve(null),\n getSlotResult: (slotId) => inner.getSlotResult(slotId),\n getSlotConfig: (slotId) => inner.getSlotConfig(slotId),\n getSitePalette: () => inner.getSitePalette(),\n reportSlots: (ids) => inner.reportSlots(ids),\n getPersona: () => inner.getPersona(),\n getGraph: () => inner.getGraph(),\n flush: () => inner.flush(),\n dispose: () => inner.dispose(),\n destroy: () => inner.destroy(),\n };\n}\n","/**\n * Cross-bundle re-render bus for devtools overrides. The main entry and the\n * /devtools entry are separate bundles, so state and notifications go through\n * window (a version counter + a DOM event) — never module-local state.\n */\nconst EVENT = 'sentient:overrides-changed';\n\ntype VersionWindow = Window & { __sentient_overrides_version?: number };\n\nexport function getOverridesVersion(): number {\n if (typeof window === 'undefined') return 0;\n return (window as VersionWindow).__sentient_overrides_version ?? 0;\n}\n\nexport function notifyOverridesChanged(): void {\n if (typeof window === 'undefined') return;\n const w = window as VersionWindow;\n w.__sentient_overrides_version = (w.__sentient_overrides_version ?? 0) + 1;\n window.dispatchEvent(new Event(EVENT));\n}\n\nexport function subscribeOverridesChanged(fn: () => void): () => void {\n if (typeof window === 'undefined') return () => undefined;\n window.addEventListener(EVENT, fn);\n return () => window.removeEventListener(EVENT, fn);\n}\n","/** Provider → devtools config handoff. Window-backed: the /devtools entry is a\n * separate bundle and cannot share the provider's React context instance. */\nexport type DevtoolsConfig = {\n apiKey: string;\n apiBaseUrl: string;\n isLocal: boolean;\n};\n\ntype ConfigWindow = Window & { __sentient_devtools_config?: DevtoolsConfig };\n\nexport function publishDevtoolsConfig(config: DevtoolsConfig): void {\n if (typeof window === 'undefined') return;\n (window as ConfigWindow).__sentient_devtools_config = config;\n}\n\nexport function readDevtoolsConfig(): DevtoolsConfig | null {\n if (typeof window === 'undefined') return null;\n return (window as ConfigWindow).__s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OiB,EAAA1B,EAAA,GAAKoC,EAAI,EAAK,GAAd,CAAiB,MAAO,OAAQ,UAAW,CAAE,GAAG,iBAE/F,IA9BM3B,EAAE,EAgCZ,CAEJ,CAAC,GACH,GAEJ,EACF,KACA,OAAC,UACC,aAAW,oBACX,gBAAegC,EACf,QAAS,IAAMC,EAASmD,GAAM,CAACA,CAAC,EAChC,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,aAAc,GAAI,OAAQ,oBAAqB,WAAY,OAClF,QAAS,OAAQ,WAAY,SAAU,eAAgB,SAAU,QAAS,EAC1E,OAAQ,UAAW,UAAW,2BAA4B,EAEnE,mBAACvD,GAAA,EAAa,EAChB,GACF,CAEJ","names":["devtools_exports","__export","AdaptiveDevtools","LOCAL_MODE_DEVTOOLS_BANNER","previewContextParam","__toCommonJS","import_react","import_policy","import_core","ssrFallback","state","w","getRegistered","state","getRegisteredSlots","getRegisteredSections","subscribeRegistry","fn","listeners","getRegistryVersion","store","w","setVariantOverride","componentId","variantId","clearVariantOverride","getOverrides","__spreadValues","store","w","setSlotOverride","slotId","result","clearSlotOverride","getSlotOverrides","__spreadValues","ssrFallback","state","w","setPreviewMode","on","s","fn","getPreviewMode","EVENT","notifyOverridesChanged","_a","w","EVENT","readDevtoolsConfig","_a","import_jsx_runtime","_a","IS_PROD","DEFAULT_API_BASE_URL","LOCAL_MODE_DEVTOOLS_BANNER","currentLayout","forced","registered","getRegisteredSections","id","reorderLayout","from","to","order","next","moved","setPreviewMode","notifyOverridesChanged","resetLayout","applyOutcome","result","_b","variantId","setVariantOverride","w","__spreadValues","readSessionId","apiKey","read","name","match","e","slotDecls","getRegisteredSlots","s","UNKNOWN_CHOICE","fetchPersonaVocabulary","apiBaseUrl","res","data","valid","list","p","personas","previewContextParam","v","forcePersonaKeyed","persona","_c","getRegistered","c","__spreadProps","forcePersonaLocal","mod","outcome","resetAll","getOverrides","clearVariantOverride","stale","i","key","btn","active","SentientMark","size","AdaptiveDevtools","open","setOpen","activePersona","setActivePersona","vocab","setVocab","customKey","setCustomKey","discovered","setDiscovered","personaNote","setPersonaNote","dragFrom","setDragFrom","mounted","setMounted","force","subscribeRegistry","getRegistryVersion","cfg","readDevtoolsConfig","cancelled","config","useLocalEngine","components","slots","overrides","slotOverrides","getSlotOverrides","sections","layoutForced","onReorder","onResetLayout","maybeExitPreview","choose","resetVariant","chooseSlotArm","arm","setSlotOverride","chooseSlotDim","dim","value","dims","current","d","values","resetSlot","clearSlotOverride","choosePersona","member","getPreviewMode","ov","o"]}