@chatterfly/widget 0.5.0 → 0.6.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.mts CHANGED
@@ -124,7 +124,7 @@ interface WidgetConfig {
124
124
  */
125
125
  connectionPolicy?: ConnectionPolicy | "always-on";
126
126
  }
127
- type RunStatus = "idle" | "connecting" | "replaying" | "running" | "awaiting_input" | "awaiting_voice" | "awaiting_form" | "awaiting_chat" | "awaiting_editor" | "completed" | "error" | "offline" | "expired";
127
+ type RunStatus = "idle" | "connecting" | "replaying" | "running" | "awaiting_authorization" | "awaiting_input" | "awaiting_voice" | "awaiting_form" | "awaiting_chat" | "awaiting_editor" | "completed" | "error" | "offline" | "expired";
128
128
  /**
129
129
  * Connection lifecycle tuning (Phase 119.4/119.5). Controls when an
130
130
  * idle-at-input widget deliberately drops its socket ("dormant"), lazily
@@ -281,6 +281,9 @@ type RunEvent = {
281
281
  } | {
282
282
  type: "run.cancelled";
283
283
  state?: Record<string, unknown>;
284
+ } | {
285
+ type: "run.authorization_required";
286
+ payload: string;
284
287
  } | {
285
288
  type: "run_error";
286
289
  error?: string;
@@ -296,13 +299,25 @@ type RunEvent = {
296
299
  } | {
297
300
  type: "timeline.entry";
298
301
  payload: TimelineEntry;
302
+ } | {
303
+ type: "provider_operation";
304
+ node_id?: string;
305
+ payload: ProviderOperationSummary;
299
306
  };
307
+ interface ProviderOperationSummary {
308
+ operation: string;
309
+ outcome: "success" | "error";
310
+ replayed?: boolean;
311
+ record_id?: string;
312
+ record_url?: string;
313
+ error_code?: string;
314
+ }
300
315
  interface TimelineEntry {
301
316
  id: string;
302
317
  run_id: string;
303
318
  session_id: string | null;
304
319
  seq: number;
305
- event_type: "prompt" | "response" | "message" | "form_opened" | "form_submitted" | "status_change" | "delay_started" | "delay_resumed";
320
+ event_type: "prompt" | "response" | "message" | "form_opened" | "form_submitted" | "status_change" | "delay_started" | "delay_resumed" | "llm_call" | "tool_call" | "tool_result" | "provider_operation";
306
321
  sender: "bot" | "user" | "system";
307
322
  payload: Record<string, unknown>;
308
323
  created_at: string;
@@ -328,6 +343,8 @@ interface WidgetStrings {
328
343
  statusCompletedTitle: string;
329
344
  statusCompletedBody: string;
330
345
  statusErrorTitle: string;
346
+ statusAuthorizationTitle: string;
347
+ statusAuthorizationBody: string;
331
348
  statusOfflineTitle: string;
332
349
  statusOfflineBody: string;
333
350
  statusExpiredTitle: string;
@@ -336,7 +353,9 @@ interface WidgetStrings {
336
353
  resumingConversation: string;
337
354
  reconnecting: string;
338
355
  conversationCompleted: string;
356
+ conversationTimedOut: string;
339
357
  somethingWentWrong: string;
358
+ tryAgain: string;
340
359
  chatInputPlaceholder: string;
341
360
  sendButton: string;
342
361
  handBackButton: string;
@@ -658,9 +677,14 @@ interface VoiceLiveRendererProps {
658
677
  onValue: (value: unknown) => void;
659
678
  onPlaybackComplete?: () => void;
660
679
  onFieldRevealed?: (sessionId: string) => void;
680
+ timedOut?: boolean;
681
+ timeoutMessage?: string;
682
+ retryLabel?: string;
683
+ userCanEnd?: boolean;
684
+ endLabel?: string;
661
685
  disabled?: boolean;
662
686
  }
663
- declare function VoiceLiveRenderer({ field, apiBase, participantToken, sessionId, fieldSessionId, liveConfig, onValue, onPlaybackComplete, onFieldRevealed, disabled, }: VoiceLiveRendererProps): react_jsx_runtime.JSX.Element;
687
+ declare function VoiceLiveRenderer({ field, apiBase, participantToken, sessionId, fieldSessionId, liveConfig, onValue, onPlaybackComplete, onFieldRevealed, timedOut, timeoutMessage, retryLabel, userCanEnd, endLabel, disabled, }: VoiceLiveRendererProps): react_jsx_runtime.JSX.Element;
664
688
 
665
689
  interface RequiredConnection {
666
690
  slug: string;
@@ -725,13 +749,15 @@ declare function ConnectionOnboarding({ connections, appBase, participantToken,
725
749
  */
726
750
  type LiveVoiceState = "idle" | "connecting" | "listening"
727
751
  /** Transcript arrived; answer/tool/workflow/model turn is advancing. */
728
- | "processing" | "speaking" | "muted" | "completed" | "error";
752
+ | "processing" | "finalizing" | "speaking" | "muted" | "completed" | "error";
729
753
  interface LiveTranscript {
730
754
  /** "user" for input transcription, "assistant" for output transcription. */
731
755
  who: "user" | "assistant";
732
756
  text: string;
733
757
  /** Final transcripts arrive once per utterance; partials may stream. */
734
758
  final: boolean;
759
+ /** Durable timeline sequence for restored transcript entries. */
760
+ sequence?: number;
735
761
  }
736
762
  interface LiveSessionConfig {
737
763
  apiBase: string;
@@ -759,11 +785,25 @@ interface LiveSessionResult {
759
785
  playbackComplete: boolean;
760
786
  /** The committed value, set when the proxy emits a value envelope. */
761
787
  lastValue: unknown;
788
+ /** Latest durable checkpoint metadata; checkpoint contents remain server-only. */
789
+ checkpoint: {
790
+ sequence: number;
791
+ turn: number;
792
+ reconstructed: boolean;
793
+ } | null;
794
+ /** Server-owned completion progress; final output arrives through the run stream. */
795
+ completion: {
796
+ status: "finalizing" | "completed";
797
+ reason: string | null;
798
+ } | null;
762
799
  /** Smoothed microphone energy in the range 0..1; visual feedback only. */
763
800
  inputLevel: number;
764
801
  isMuted: boolean;
765
802
  toggleMute: () => void;
766
803
  error: string | null;
804
+ errorRecoverable: boolean;
805
+ retryError: () => void;
806
+ requestEnd: () => void;
767
807
  }
768
808
  declare function useGeminiLiveSession(cfg: LiveSessionConfig, onValue: (value: unknown) => void): LiveSessionResult;
769
809
 
@@ -859,6 +899,10 @@ interface ValidationError {
859
899
  }
860
900
  interface UseRunStreamResult {
861
901
  status: RunStatus;
902
+ /** Sanitized terminal classification used for participant-facing presentation. */
903
+ failureKind: "timeout" | null;
904
+ /** Current token, including a successful public-run re-mint. */
905
+ currentParticipantToken: string;
862
906
  activeSession: HITLSession | null;
863
907
  messages: ChatMessage[];
864
908
  timeline: TimelineEntry[];
package/dist/index.d.ts CHANGED
@@ -124,7 +124,7 @@ interface WidgetConfig {
124
124
  */
125
125
  connectionPolicy?: ConnectionPolicy | "always-on";
126
126
  }
127
- type RunStatus = "idle" | "connecting" | "replaying" | "running" | "awaiting_input" | "awaiting_voice" | "awaiting_form" | "awaiting_chat" | "awaiting_editor" | "completed" | "error" | "offline" | "expired";
127
+ type RunStatus = "idle" | "connecting" | "replaying" | "running" | "awaiting_authorization" | "awaiting_input" | "awaiting_voice" | "awaiting_form" | "awaiting_chat" | "awaiting_editor" | "completed" | "error" | "offline" | "expired";
128
128
  /**
129
129
  * Connection lifecycle tuning (Phase 119.4/119.5). Controls when an
130
130
  * idle-at-input widget deliberately drops its socket ("dormant"), lazily
@@ -281,6 +281,9 @@ type RunEvent = {
281
281
  } | {
282
282
  type: "run.cancelled";
283
283
  state?: Record<string, unknown>;
284
+ } | {
285
+ type: "run.authorization_required";
286
+ payload: string;
284
287
  } | {
285
288
  type: "run_error";
286
289
  error?: string;
@@ -296,13 +299,25 @@ type RunEvent = {
296
299
  } | {
297
300
  type: "timeline.entry";
298
301
  payload: TimelineEntry;
302
+ } | {
303
+ type: "provider_operation";
304
+ node_id?: string;
305
+ payload: ProviderOperationSummary;
299
306
  };
307
+ interface ProviderOperationSummary {
308
+ operation: string;
309
+ outcome: "success" | "error";
310
+ replayed?: boolean;
311
+ record_id?: string;
312
+ record_url?: string;
313
+ error_code?: string;
314
+ }
300
315
  interface TimelineEntry {
301
316
  id: string;
302
317
  run_id: string;
303
318
  session_id: string | null;
304
319
  seq: number;
305
- event_type: "prompt" | "response" | "message" | "form_opened" | "form_submitted" | "status_change" | "delay_started" | "delay_resumed";
320
+ event_type: "prompt" | "response" | "message" | "form_opened" | "form_submitted" | "status_change" | "delay_started" | "delay_resumed" | "llm_call" | "tool_call" | "tool_result" | "provider_operation";
306
321
  sender: "bot" | "user" | "system";
307
322
  payload: Record<string, unknown>;
308
323
  created_at: string;
@@ -328,6 +343,8 @@ interface WidgetStrings {
328
343
  statusCompletedTitle: string;
329
344
  statusCompletedBody: string;
330
345
  statusErrorTitle: string;
346
+ statusAuthorizationTitle: string;
347
+ statusAuthorizationBody: string;
331
348
  statusOfflineTitle: string;
332
349
  statusOfflineBody: string;
333
350
  statusExpiredTitle: string;
@@ -336,7 +353,9 @@ interface WidgetStrings {
336
353
  resumingConversation: string;
337
354
  reconnecting: string;
338
355
  conversationCompleted: string;
356
+ conversationTimedOut: string;
339
357
  somethingWentWrong: string;
358
+ tryAgain: string;
340
359
  chatInputPlaceholder: string;
341
360
  sendButton: string;
342
361
  handBackButton: string;
@@ -658,9 +677,14 @@ interface VoiceLiveRendererProps {
658
677
  onValue: (value: unknown) => void;
659
678
  onPlaybackComplete?: () => void;
660
679
  onFieldRevealed?: (sessionId: string) => void;
680
+ timedOut?: boolean;
681
+ timeoutMessage?: string;
682
+ retryLabel?: string;
683
+ userCanEnd?: boolean;
684
+ endLabel?: string;
661
685
  disabled?: boolean;
662
686
  }
663
- declare function VoiceLiveRenderer({ field, apiBase, participantToken, sessionId, fieldSessionId, liveConfig, onValue, onPlaybackComplete, onFieldRevealed, disabled, }: VoiceLiveRendererProps): react_jsx_runtime.JSX.Element;
687
+ declare function VoiceLiveRenderer({ field, apiBase, participantToken, sessionId, fieldSessionId, liveConfig, onValue, onPlaybackComplete, onFieldRevealed, timedOut, timeoutMessage, retryLabel, userCanEnd, endLabel, disabled, }: VoiceLiveRendererProps): react_jsx_runtime.JSX.Element;
664
688
 
665
689
  interface RequiredConnection {
666
690
  slug: string;
@@ -725,13 +749,15 @@ declare function ConnectionOnboarding({ connections, appBase, participantToken,
725
749
  */
726
750
  type LiveVoiceState = "idle" | "connecting" | "listening"
727
751
  /** Transcript arrived; answer/tool/workflow/model turn is advancing. */
728
- | "processing" | "speaking" | "muted" | "completed" | "error";
752
+ | "processing" | "finalizing" | "speaking" | "muted" | "completed" | "error";
729
753
  interface LiveTranscript {
730
754
  /** "user" for input transcription, "assistant" for output transcription. */
731
755
  who: "user" | "assistant";
732
756
  text: string;
733
757
  /** Final transcripts arrive once per utterance; partials may stream. */
734
758
  final: boolean;
759
+ /** Durable timeline sequence for restored transcript entries. */
760
+ sequence?: number;
735
761
  }
736
762
  interface LiveSessionConfig {
737
763
  apiBase: string;
@@ -759,11 +785,25 @@ interface LiveSessionResult {
759
785
  playbackComplete: boolean;
760
786
  /** The committed value, set when the proxy emits a value envelope. */
761
787
  lastValue: unknown;
788
+ /** Latest durable checkpoint metadata; checkpoint contents remain server-only. */
789
+ checkpoint: {
790
+ sequence: number;
791
+ turn: number;
792
+ reconstructed: boolean;
793
+ } | null;
794
+ /** Server-owned completion progress; final output arrives through the run stream. */
795
+ completion: {
796
+ status: "finalizing" | "completed";
797
+ reason: string | null;
798
+ } | null;
762
799
  /** Smoothed microphone energy in the range 0..1; visual feedback only. */
763
800
  inputLevel: number;
764
801
  isMuted: boolean;
765
802
  toggleMute: () => void;
766
803
  error: string | null;
804
+ errorRecoverable: boolean;
805
+ retryError: () => void;
806
+ requestEnd: () => void;
767
807
  }
768
808
  declare function useGeminiLiveSession(cfg: LiveSessionConfig, onValue: (value: unknown) => void): LiveSessionResult;
769
809
 
@@ -859,6 +899,10 @@ interface ValidationError {
859
899
  }
860
900
  interface UseRunStreamResult {
861
901
  status: RunStatus;
902
+ /** Sanitized terminal classification used for participant-facing presentation. */
903
+ failureKind: "timeout" | null;
904
+ /** Current token, including a successful public-run re-mint. */
905
+ currentParticipantToken: string;
862
906
  activeSession: HITLSession | null;
863
907
  messages: ChatMessage[];
864
908
  timeline: TimelineEntry[];