@personaai/react 0.7.9 → 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
@@ -112,6 +112,25 @@ interface PersonaPresentedFile {
112
112
  title: string;
113
113
  description: string;
114
114
  }
115
+ /**
116
+ * One `execute` tool call against an Agent's sandbox (real shell execution
117
+ * in an isolated CodeSandbox VM — requires the Agent's `sandboxEnabled` and
118
+ * a `CSB_API_KEY` Project Secret; see the Agent's `sandboxEnabled` field).
119
+ * Derived from `PersonaToolCall`s named `execute` across every message in
120
+ * the conversation, in stream order — not a separate live/history-tracked
121
+ * state, so it's always consistent with `messages`.
122
+ */
123
+ interface PersonaSandboxCommand {
124
+ toolCallId: string;
125
+ /** The shell command, parsed from the tool call's `args`. Falls back to the raw args string while still streaming/incomplete. */
126
+ command: string;
127
+ /** stdout/stderr, once the call finishes. */
128
+ output?: string;
129
+ /** `null` when the result parsed but didn't carry an exit code; `undefined` while still running. */
130
+ exitCode?: number | null;
131
+ status: "running" | "done" | "error";
132
+ seq?: number;
133
+ }
115
134
  interface PersonaProviderProps {
116
135
  /** Base URL where the Persona runtime / adapter is mounted, e.g. "http://localhost:4000/api/persona" */
117
136
  baseUrl: string;
@@ -263,6 +282,8 @@ interface UseChatOptions {
263
282
  onError?: (error: Error) => void;
264
283
  /** Hook for receiving every low-level AG-UI streaming event (tool calls, steps, subagents) */
265
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;
266
287
  /**
267
288
  * Pass the object returned by `useVoice()` (sharing the same `threadId`) to have `useChat`
268
289
  * merge live voice turns into `messages` automatically — one bubble per utterance, deduped
@@ -417,21 +438,25 @@ declare function useChat(options?: UseChatOptions): {
417
438
  setInput: react.Dispatch<react.SetStateAction<string>>;
418
439
  handleInputChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
419
440
  handleSubmit: (e?: React.FormEvent) => void;
420
- sendMessage: (contentToSend?: string, overrideOptions?: SendMessageOverride) => Promise<void>;
441
+ sendMessage: (contentToSend?: string, overrideOptions?: SendMessageOverride) => Promise<boolean>;
421
442
  isStreaming: boolean;
422
443
  isLoading: boolean;
423
444
  isLoadingHistory: boolean;
424
445
  error: Error | null;
425
446
  interrupt: PersonaInterrupt | null;
426
- resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<void>;
447
+ resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<boolean>;
427
448
  files: Record<string, PersonaWorkspaceFile>;
428
449
  todos: PersonaTodo[];
429
450
  presentedFile: PersonaPresentedFile | null;
430
451
  dismissPresentedFile: () => void;
431
452
  openWorkspaceFile: (path: string) => void;
453
+ sandboxCommands: PersonaSandboxCommand[];
432
454
  stop: () => void;
433
- reload: () => void;
455
+ reload: () => Promise<boolean>;
434
456
  clear: () => void;
457
+ startNewChat: () => void;
458
+ currentThreadId: string | undefined;
459
+ isEphemeral: boolean;
435
460
  setMessages: react.Dispatch<react.SetStateAction<PersonaMessage[]>>;
436
461
  loadThreadMessages: (id: string) => Promise<PersonaMessage[]>;
437
462
  };
@@ -659,6 +684,6 @@ declare function supportsStreamingFetch(): boolean;
659
684
  */
660
685
  declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
661
686
 
662
- declare const VERSION = "0.7.9";
687
+ declare const VERSION = "0.8.0";
663
688
 
664
- 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 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 };
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
@@ -112,6 +112,25 @@ interface PersonaPresentedFile {
112
112
  title: string;
113
113
  description: string;
114
114
  }
115
+ /**
116
+ * One `execute` tool call against an Agent's sandbox (real shell execution
117
+ * in an isolated CodeSandbox VM — requires the Agent's `sandboxEnabled` and
118
+ * a `CSB_API_KEY` Project Secret; see the Agent's `sandboxEnabled` field).
119
+ * Derived from `PersonaToolCall`s named `execute` across every message in
120
+ * the conversation, in stream order — not a separate live/history-tracked
121
+ * state, so it's always consistent with `messages`.
122
+ */
123
+ interface PersonaSandboxCommand {
124
+ toolCallId: string;
125
+ /** The shell command, parsed from the tool call's `args`. Falls back to the raw args string while still streaming/incomplete. */
126
+ command: string;
127
+ /** stdout/stderr, once the call finishes. */
128
+ output?: string;
129
+ /** `null` when the result parsed but didn't carry an exit code; `undefined` while still running. */
130
+ exitCode?: number | null;
131
+ status: "running" | "done" | "error";
132
+ seq?: number;
133
+ }
115
134
  interface PersonaProviderProps {
116
135
  /** Base URL where the Persona runtime / adapter is mounted, e.g. "http://localhost:4000/api/persona" */
117
136
  baseUrl: string;
@@ -263,6 +282,8 @@ interface UseChatOptions {
263
282
  onError?: (error: Error) => void;
264
283
  /** Hook for receiving every low-level AG-UI streaming event (tool calls, steps, subagents) */
265
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;
266
287
  /**
267
288
  * Pass the object returned by `useVoice()` (sharing the same `threadId`) to have `useChat`
268
289
  * merge live voice turns into `messages` automatically — one bubble per utterance, deduped
@@ -417,21 +438,25 @@ declare function useChat(options?: UseChatOptions): {
417
438
  setInput: react.Dispatch<react.SetStateAction<string>>;
418
439
  handleInputChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
419
440
  handleSubmit: (e?: React.FormEvent) => void;
420
- sendMessage: (contentToSend?: string, overrideOptions?: SendMessageOverride) => Promise<void>;
441
+ sendMessage: (contentToSend?: string, overrideOptions?: SendMessageOverride) => Promise<boolean>;
421
442
  isStreaming: boolean;
422
443
  isLoading: boolean;
423
444
  isLoadingHistory: boolean;
424
445
  error: Error | null;
425
446
  interrupt: PersonaInterrupt | null;
426
- resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<void>;
447
+ resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<boolean>;
427
448
  files: Record<string, PersonaWorkspaceFile>;
428
449
  todos: PersonaTodo[];
429
450
  presentedFile: PersonaPresentedFile | null;
430
451
  dismissPresentedFile: () => void;
431
452
  openWorkspaceFile: (path: string) => void;
453
+ sandboxCommands: PersonaSandboxCommand[];
432
454
  stop: () => void;
433
- reload: () => void;
455
+ reload: () => Promise<boolean>;
434
456
  clear: () => void;
457
+ startNewChat: () => void;
458
+ currentThreadId: string | undefined;
459
+ isEphemeral: boolean;
435
460
  setMessages: react.Dispatch<react.SetStateAction<PersonaMessage[]>>;
436
461
  loadThreadMessages: (id: string) => Promise<PersonaMessage[]>;
437
462
  };
@@ -659,6 +684,6 @@ declare function supportsStreamingFetch(): boolean;
659
684
  */
660
685
  declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
661
686
 
662
- declare const VERSION = "0.7.9";
687
+ declare const VERSION = "0.8.0";
663
688
 
664
- 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 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 };
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 };