@personaai/react 0.7.10 → 0.8.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.cts CHANGED
@@ -282,6 +282,8 @@ interface UseChatOptions {
282
282
  onError?: (error: Error) => void;
283
283
  /** Hook for receiving every low-level AG-UI streaming event (tool calls, steps, subagents) */
284
284
  onEvent?: (event: PersonaStreamingEvent) => void;
285
+ /** Called when a fake/ephemeral chat mints a real thread on first send. Use to sync sidebar state (e.g. setThreadId(id)). */
286
+ onThreadCreated?: (threadId: string) => void;
285
287
  /**
286
288
  * Pass the object returned by `useVoice()` (sharing the same `threadId`) to have `useChat`
287
289
  * merge live voice turns into `messages` automatically — one bubble per utterance, deduped
@@ -436,13 +438,13 @@ declare function useChat(options?: UseChatOptions): {
436
438
  setInput: react.Dispatch<react.SetStateAction<string>>;
437
439
  handleInputChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
438
440
  handleSubmit: (e?: React.FormEvent) => void;
439
- sendMessage: (contentToSend?: string, overrideOptions?: SendMessageOverride) => Promise<void>;
441
+ sendMessage: (contentToSend?: string, overrideOptions?: SendMessageOverride) => Promise<boolean>;
440
442
  isStreaming: boolean;
441
443
  isLoading: boolean;
442
444
  isLoadingHistory: boolean;
443
445
  error: Error | null;
444
446
  interrupt: PersonaInterrupt | null;
445
- resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<void>;
447
+ resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<boolean>;
446
448
  files: Record<string, PersonaWorkspaceFile>;
447
449
  todos: PersonaTodo[];
448
450
  presentedFile: PersonaPresentedFile | null;
@@ -450,8 +452,11 @@ declare function useChat(options?: UseChatOptions): {
450
452
  openWorkspaceFile: (path: string) => void;
451
453
  sandboxCommands: PersonaSandboxCommand[];
452
454
  stop: () => void;
453
- reload: () => void;
455
+ reload: () => Promise<boolean>;
454
456
  clear: () => void;
457
+ startNewChat: () => void;
458
+ currentThreadId: string | undefined;
459
+ isEphemeral: boolean;
455
460
  setMessages: react.Dispatch<react.SetStateAction<PersonaMessage[]>>;
456
461
  loadThreadMessages: (id: string) => Promise<PersonaMessage[]>;
457
462
  };
@@ -679,6 +684,6 @@ declare function supportsStreamingFetch(): boolean;
679
684
  */
680
685
  declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
681
686
 
682
- declare const VERSION = "0.7.10";
687
+ declare const VERSION = "0.8.0";
683
688
 
684
689
  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
@@ -282,6 +282,8 @@ interface UseChatOptions {
282
282
  onError?: (error: Error) => void;
283
283
  /** Hook for receiving every low-level AG-UI streaming event (tool calls, steps, subagents) */
284
284
  onEvent?: (event: PersonaStreamingEvent) => void;
285
+ /** Called when a fake/ephemeral chat mints a real thread on first send. Use to sync sidebar state (e.g. setThreadId(id)). */
286
+ onThreadCreated?: (threadId: string) => void;
285
287
  /**
286
288
  * Pass the object returned by `useVoice()` (sharing the same `threadId`) to have `useChat`
287
289
  * merge live voice turns into `messages` automatically — one bubble per utterance, deduped
@@ -436,13 +438,13 @@ declare function useChat(options?: UseChatOptions): {
436
438
  setInput: react.Dispatch<react.SetStateAction<string>>;
437
439
  handleInputChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
438
440
  handleSubmit: (e?: React.FormEvent) => void;
439
- sendMessage: (contentToSend?: string, overrideOptions?: SendMessageOverride) => Promise<void>;
441
+ sendMessage: (contentToSend?: string, overrideOptions?: SendMessageOverride) => Promise<boolean>;
440
442
  isStreaming: boolean;
441
443
  isLoading: boolean;
442
444
  isLoadingHistory: boolean;
443
445
  error: Error | null;
444
446
  interrupt: PersonaInterrupt | null;
445
- resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<void>;
447
+ resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<boolean>;
446
448
  files: Record<string, PersonaWorkspaceFile>;
447
449
  todos: PersonaTodo[];
448
450
  presentedFile: PersonaPresentedFile | null;
@@ -450,8 +452,11 @@ declare function useChat(options?: UseChatOptions): {
450
452
  openWorkspaceFile: (path: string) => void;
451
453
  sandboxCommands: PersonaSandboxCommand[];
452
454
  stop: () => void;
453
- reload: () => void;
455
+ reload: () => Promise<boolean>;
454
456
  clear: () => void;
457
+ startNewChat: () => void;
458
+ currentThreadId: string | undefined;
459
+ isEphemeral: boolean;
455
460
  setMessages: react.Dispatch<react.SetStateAction<PersonaMessage[]>>;
456
461
  loadThreadMessages: (id: string) => Promise<PersonaMessage[]>;
457
462
  };
@@ -679,6 +684,6 @@ declare function supportsStreamingFetch(): boolean;
679
684
  */
680
685
  declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
681
686
 
682
- declare const VERSION = "0.7.10";
687
+ declare const VERSION = "0.8.0";
683
688
 
684
689
  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 };