@livelayer/react 0.24.0 → 0.25.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.
package/dist/index.d.ts CHANGED
@@ -89,6 +89,8 @@ export declare interface AgentInfo {
89
89
  * `branding.hideBranding`.
90
90
  */
91
91
  hideBranding?: boolean;
92
+ /** Page-vision capture config served by the agent-info endpoint (0.25.0+). */
93
+ pageVision?: PageVisionClientConfig | null;
92
94
  }
93
95
 
94
96
  export declare interface AgentInfoHandle {
@@ -400,6 +402,15 @@ export declare interface AvatarWidgetProps {
400
402
  * "read_page" — request_page_context + request_routes
401
403
  */
402
404
  capabilities?: AgentCapability[];
405
+ /**
406
+ * Page vision: capture page screenshots for the agent at flow start /
407
+ * route change / step change. Defaults to the server-side config from
408
+ * the agent-info endpoint; pass null to force-disable on this host.
409
+ * NOTE: must be referentially stable across renders — an inline object
410
+ * literal rebuilds the capture controller every render and silently
411
+ * disables dedup/republish. Prefer the server config or a useMemo/const.
412
+ */
413
+ pageVision?: PageVisionClientConfig | null;
403
414
  onConnect?: () => void;
404
415
  onDisconnect?: () => void;
405
416
  onTranscript?: (entries: TranscriptEntry[]) => void;
@@ -492,6 +503,8 @@ export declare interface CameraStateHandle {
492
503
  clearError: () => void;
493
504
  }
494
505
 
506
+ export declare type CaptureReason = "flow_start" | "route_change" | "step_change";
507
+
495
508
  export { clearFieldRegistry }
496
509
 
497
510
  export declare function clearPageContextCache(): void;
@@ -932,6 +945,26 @@ export declare interface PageContext {
932
945
  flow?: FlowContext;
933
946
  }
934
947
 
948
+ export declare interface PageVisionClientConfig {
949
+ enabled: boolean;
950
+ captureOn: CaptureReason[];
951
+ maxWidth: number;
952
+ jpegQuality: number;
953
+ upload: PageVisionUploadConfig;
954
+ }
955
+
956
+ /**
957
+ * Direct-to-Supabase Storage upload over plain fetch — no supabase-js in
958
+ * the widget bundle. Keys are random UUIDs (unguessable; spec §5) and the
959
+ * bucket has an hourly server-side purge, so the public URL is a
960
+ * short-lived, signed-ish link.
961
+ */
962
+ declare interface PageVisionUploadConfig {
963
+ supabaseUrl: string;
964
+ anonKey: string;
965
+ bucket: string;
966
+ }
967
+
935
968
  declare interface Props {
936
969
  children: ReactNode;
937
970
  /** Callback fired when an error is caught. Useful for telemetry. */
@@ -1120,6 +1153,37 @@ export declare function useMediaDevices(): MediaDevicesHandle;
1120
1153
 
1121
1154
  export declare function useMicrophoneState(opts?: MicrophoneStateOptions): MicrophoneStateHandle;
1122
1155
 
1156
+ /**
1157
+ * Fires page captures on session connect (flow_start), route change, and
1158
+ * flow step change. Captures wait one animation frame (so the new view
1159
+ * has painted) plus an idle slot (so the html-to-image clone pass doesn't
1160
+ * jank the transition). All real logic lives in PageVisionController.
1161
+ */
1162
+ export declare function usePageVision(args: UsePageVisionArgs): void;
1163
+
1164
+ declare interface UsePageVisionArgs {
1165
+ /**
1166
+ * Page-vision config from agent info (null/undefined until fetched).
1167
+ * Must be referentially stable across renders — an inline literal
1168
+ * rebuilds the controller every render and silently kills dedup and
1169
+ * republishLast.
1170
+ */
1171
+ config: PageVisionClientConfig | null | undefined;
1172
+ connected: boolean;
1173
+ pathname: string;
1174
+ /** Latest flow.currentStep the widget observed (multi-step forms). */
1175
+ currentStep: number | undefined;
1176
+ publishData: (payload: Record<string, unknown>) => void;
1177
+ /**
1178
+ * Carry-forward 1: becomes true once the agent is ready to receive
1179
+ * messages (first listening/speaking state). On the first false→true
1180
+ * transition of each connect cycle, republishLast() is called so the
1181
+ * worker receives the flow_start envelope even if its listener
1182
+ * registered after the original publish.
1183
+ */
1184
+ agentReady: boolean;
1185
+ }
1186
+
1123
1187
  /**
1124
1188
  * Returns the current pathname, reactive to SPA navigation.
1125
1189
  * Pass `controlledPathname` to skip internal detection (recommended for