@personaai/react 0.7.10 → 0.8.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/dist/index.d.cts CHANGED
@@ -241,6 +241,9 @@ type PersonaStreamingEvent = {
241
241
  message: string;
242
242
  retryable?: boolean;
243
243
  providerName?: string;
244
+ } | {
245
+ type: "title";
246
+ title: string;
244
247
  } | {
245
248
  type: "CUSTOM";
246
249
  name: "hitl_request";
@@ -282,6 +285,10 @@ interface UseChatOptions {
282
285
  onError?: (error: Error) => void;
283
286
  /** Hook for receiving every low-level AG-UI streaming event (tool calls, steps, subagents) */
284
287
  onEvent?: (event: PersonaStreamingEvent) => void;
288
+ /** Called when a fake/ephemeral chat mints a real thread on first send. Use to sync sidebar state (e.g. setThreadId(id)). */
289
+ onThreadCreated?: (threadId: string) => void;
290
+ /** Called when the backend auto-generates a thread title (3-4 word LLM summary of first user message). */
291
+ onTitle?: (title: string) => void;
285
292
  /**
286
293
  * Pass the object returned by `useVoice()` (sharing the same `threadId`) to have `useChat`
287
294
  * merge live voice turns into `messages` automatically — one bubble per utterance, deduped
@@ -436,13 +443,13 @@ declare function useChat(options?: UseChatOptions): {
436
443
  setInput: react.Dispatch<react.SetStateAction<string>>;
437
444
  handleInputChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
438
445
  handleSubmit: (e?: React.FormEvent) => void;
439
- sendMessage: (contentToSend?: string, overrideOptions?: SendMessageOverride) => Promise<void>;
446
+ sendMessage: (contentToSend?: string, overrideOptions?: SendMessageOverride) => Promise<boolean>;
440
447
  isStreaming: boolean;
441
448
  isLoading: boolean;
442
449
  isLoadingHistory: boolean;
443
450
  error: Error | null;
444
451
  interrupt: PersonaInterrupt | null;
445
- resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<void>;
452
+ resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<boolean>;
446
453
  files: Record<string, PersonaWorkspaceFile>;
447
454
  todos: PersonaTodo[];
448
455
  presentedFile: PersonaPresentedFile | null;
@@ -450,8 +457,11 @@ declare function useChat(options?: UseChatOptions): {
450
457
  openWorkspaceFile: (path: string) => void;
451
458
  sandboxCommands: PersonaSandboxCommand[];
452
459
  stop: () => void;
453
- reload: () => void;
460
+ reload: () => Promise<boolean>;
454
461
  clear: () => void;
462
+ startNewChat: () => void;
463
+ currentThreadId: string | undefined;
464
+ isEphemeral: boolean;
455
465
  setMessages: react.Dispatch<react.SetStateAction<PersonaMessage[]>>;
456
466
  loadThreadMessages: (id: string) => Promise<PersonaMessage[]>;
457
467
  };
@@ -679,6 +689,6 @@ declare function supportsStreamingFetch(): boolean;
679
689
  */
680
690
  declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
681
691
 
682
- declare const VERSION = "0.7.10";
692
+ declare const VERSION = "0.8.1";
683
693
 
684
694
  export { type OpenSSEOptions, type PersonaAgentSummary, type PersonaClarificationQuestion, type PersonaFileItem, type PersonaHealthInfo, type PersonaHitlActionRequest, type PersonaInterrupt, type PersonaMcpConnection, type PersonaMemoryAgentGroup, type PersonaMemoryFile, type PersonaMemoryList, type PersonaMessage, type PersonaPresentedFile, PersonaProvider, type PersonaProviderProps, type PersonaResumeValue, type PersonaRole, type PersonaSandboxCommand, type PersonaStreamingEvent, type PersonaSubagentActivityEntry, type PersonaThread, type PersonaTodo, type PersonaToolCall, type PersonaVoiceEndReason, type PersonaVoiceState, type PersonaVoiceToolCall, type PersonaVoiceTranscriptLine, type PersonaWorkspaceFile, type SSEReader, type SSEStream, type SendMessageOverride, type UseChatOptions, type UseMcpConnectionsOptions, type UseMcpOptions, type UseVoiceOptions, type UseVoiceResult, VERSION, openSSEStream, supportsStreamingFetch, useAgents, useChat, useConnection, useFiles, useMcp, useMcpConnections, useMemory, usePersonaContext, useThreads, useVoice };
package/dist/index.d.ts CHANGED
@@ -241,6 +241,9 @@ type PersonaStreamingEvent = {
241
241
  message: string;
242
242
  retryable?: boolean;
243
243
  providerName?: string;
244
+ } | {
245
+ type: "title";
246
+ title: string;
244
247
  } | {
245
248
  type: "CUSTOM";
246
249
  name: "hitl_request";
@@ -282,6 +285,10 @@ interface UseChatOptions {
282
285
  onError?: (error: Error) => void;
283
286
  /** Hook for receiving every low-level AG-UI streaming event (tool calls, steps, subagents) */
284
287
  onEvent?: (event: PersonaStreamingEvent) => void;
288
+ /** Called when a fake/ephemeral chat mints a real thread on first send. Use to sync sidebar state (e.g. setThreadId(id)). */
289
+ onThreadCreated?: (threadId: string) => void;
290
+ /** Called when the backend auto-generates a thread title (3-4 word LLM summary of first user message). */
291
+ onTitle?: (title: string) => void;
285
292
  /**
286
293
  * Pass the object returned by `useVoice()` (sharing the same `threadId`) to have `useChat`
287
294
  * merge live voice turns into `messages` automatically — one bubble per utterance, deduped
@@ -436,13 +443,13 @@ declare function useChat(options?: UseChatOptions): {
436
443
  setInput: react.Dispatch<react.SetStateAction<string>>;
437
444
  handleInputChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
438
445
  handleSubmit: (e?: React.FormEvent) => void;
439
- sendMessage: (contentToSend?: string, overrideOptions?: SendMessageOverride) => Promise<void>;
446
+ sendMessage: (contentToSend?: string, overrideOptions?: SendMessageOverride) => Promise<boolean>;
440
447
  isStreaming: boolean;
441
448
  isLoading: boolean;
442
449
  isLoadingHistory: boolean;
443
450
  error: Error | null;
444
451
  interrupt: PersonaInterrupt | null;
445
- resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<void>;
452
+ resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<boolean>;
446
453
  files: Record<string, PersonaWorkspaceFile>;
447
454
  todos: PersonaTodo[];
448
455
  presentedFile: PersonaPresentedFile | null;
@@ -450,8 +457,11 @@ declare function useChat(options?: UseChatOptions): {
450
457
  openWorkspaceFile: (path: string) => void;
451
458
  sandboxCommands: PersonaSandboxCommand[];
452
459
  stop: () => void;
453
- reload: () => void;
460
+ reload: () => Promise<boolean>;
454
461
  clear: () => void;
462
+ startNewChat: () => void;
463
+ currentThreadId: string | undefined;
464
+ isEphemeral: boolean;
455
465
  setMessages: react.Dispatch<react.SetStateAction<PersonaMessage[]>>;
456
466
  loadThreadMessages: (id: string) => Promise<PersonaMessage[]>;
457
467
  };
@@ -679,6 +689,6 @@ declare function supportsStreamingFetch(): boolean;
679
689
  */
680
690
  declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
681
691
 
682
- declare const VERSION = "0.7.10";
692
+ declare const VERSION = "0.8.1";
683
693
 
684
694
  export { type OpenSSEOptions, type PersonaAgentSummary, type PersonaClarificationQuestion, type PersonaFileItem, type PersonaHealthInfo, type PersonaHitlActionRequest, type PersonaInterrupt, type PersonaMcpConnection, type PersonaMemoryAgentGroup, type PersonaMemoryFile, type PersonaMemoryList, type PersonaMessage, type PersonaPresentedFile, PersonaProvider, type PersonaProviderProps, type PersonaResumeValue, type PersonaRole, type PersonaSandboxCommand, type PersonaStreamingEvent, type PersonaSubagentActivityEntry, type PersonaThread, type PersonaTodo, type PersonaToolCall, type PersonaVoiceEndReason, type PersonaVoiceState, type PersonaVoiceToolCall, type PersonaVoiceTranscriptLine, type PersonaWorkspaceFile, type SSEReader, type SSEStream, type SendMessageOverride, type UseChatOptions, type UseMcpConnectionsOptions, type UseMcpOptions, type UseVoiceOptions, type UseVoiceResult, VERSION, openSSEStream, supportsStreamingFetch, useAgents, useChat, useConnection, useFiles, useMcp, useMcpConnections, useMemory, usePersonaContext, useThreads, useVoice };