@personaai/react 0.9.0 → 0.10.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
@@ -343,6 +343,28 @@ interface UseChatOptions {
343
343
  */
344
344
  context?: Record<string, unknown> | (() => Record<string, unknown>);
345
345
  }
346
+ interface UseArchitectChatOptions {
347
+ threadId?: string;
348
+ initialMessages?: PersonaMessage[];
349
+ onFinish?: (message: PersonaMessage) => void;
350
+ onError?: (error: Error) => void;
351
+ /** Hook for receiving every low-level AG-UI streaming event (tool calls, steps, subagents) */
352
+ onEvent?: (event: PersonaStreamingEvent) => void;
353
+ /** Called when a fake/ephemeral chat mints a real thread on first send. Use to sync sidebar state (e.g. setThreadId(id)). */
354
+ onThreadCreated?: (threadId: string) => void;
355
+ /** Called when the backend auto-generates a thread title (3-4 word LLM summary of first user message). */
356
+ onTitle?: (title: string) => void;
357
+ }
358
+ interface SendArchitectMessageOverride {
359
+ /**
360
+ * A plain id, or a promise/thunk for one still in flight (e.g. a thread
361
+ * being lazily created for the first message of a new conversation).
362
+ * Mirrors {@link SendMessageOverride.threadId}.
363
+ */
364
+ threadId?: string | Promise<string | undefined>;
365
+ /** Answers/approves a paused interrupt from a previous turn instead of starting a fresh one. */
366
+ resume?: PersonaResumeValue;
367
+ }
346
368
  interface SendMessageOverride {
347
369
  agentId?: string;
348
370
  /**
@@ -638,6 +660,61 @@ declare function useChat(options?: UseChatOptions): {
638
660
  loadThreadMessages: (id: string) => Promise<PersonaMessage[]>;
639
661
  };
640
662
 
663
+ /**
664
+ * The Developer Platform Architect's own reserved Agent id
665
+ * (`DEVELOPER_ARCHITECT_AGENT_ID` in agent-backend/src/modules/agents/
666
+ * architectConstants.js) — it isn't a row in the Agent collection, but the
667
+ * backend's `POST /api/v1/developer/threads` special-cases exactly this id
668
+ * past its usual Agent-existence check (see developerThread.controller.js's
669
+ * `assertAgentAccessible`), so a named Architect Thread can be created the
670
+ * same way as for a real Agent. Kept in sync with that backend constant —
671
+ * update both together if it ever changes.
672
+ */
673
+ declare const ARCHITECT_AGENT_ID = "000000000000000000000002";
674
+ /**
675
+ * Runs the Agent Architect co-pilot — a conversational tool-calling agent
676
+ * that creates/edits the caller's own Agents (`manage_agent`, `manage_skill`,
677
+ * etc.), reached over the runtime's `POST /architect` route (see
678
+ * `@personaai/runtime`'s `routes/architect.ts`). Structurally a trimmed
679
+ * `useChat`: same streaming/interrupt/reload/thread-resume mechanics, but
680
+ * with no `agentId` to pass (the Architect is a single fixed target) and no
681
+ * `voice`/`sandboxCommands` (the Architect has no voice mode and no
682
+ * `execute` tool).
683
+ *
684
+ * `threadId` resume only has an effect when the underlying credential
685
+ * asserts an external user — a bare Project credential has no Subject for a
686
+ * Thread to belong to, so the backend silently keeps its single
687
+ * deterministic per-Project conversation either way (see
688
+ * `developerArchitect.controller.js`'s doc comment).
689
+ */
690
+ declare function useArchitectChat(options?: UseArchitectChatOptions): {
691
+ messages: PersonaMessage[];
692
+ input: string;
693
+ setInput: react.Dispatch<react.SetStateAction<string>>;
694
+ handleInputChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
695
+ handleSubmit: (e?: React.FormEvent) => void;
696
+ sendMessage: (contentToSend?: string, overrideOptions?: SendArchitectMessageOverride) => Promise<boolean>;
697
+ isStreaming: boolean;
698
+ isLoading: boolean;
699
+ isLoadingHistory: boolean;
700
+ error: Error | null;
701
+ interrupt: PersonaInterrupt | null;
702
+ resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<boolean>;
703
+ files: Record<string, PersonaWorkspaceFile>;
704
+ todos: PersonaTodo[];
705
+ presentedFile: PersonaPresentedFile | null;
706
+ dismissPresentedFile: () => void;
707
+ openWorkspaceFile: (path: string) => void;
708
+ stop: () => void;
709
+ reload: () => Promise<boolean>;
710
+ clear: () => void;
711
+ startNewChat: () => void;
712
+ currentThreadId: string | undefined;
713
+ isEphemeral: boolean;
714
+ setMessages: react.Dispatch<react.SetStateAction<PersonaMessage[]>>;
715
+ loadThreadMessages: (id: string) => Promise<PersonaMessage[]>;
716
+ };
717
+
641
718
  declare function useMemory(autoFetch?: boolean): {
642
719
  memory: PersonaMemoryList;
643
720
  isLoading: boolean;
@@ -908,6 +985,6 @@ declare function supportsStreamingFetch(): boolean;
908
985
  */
909
986
  declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
910
987
 
911
- declare const VERSION = "0.9.0";
988
+ declare const VERSION = "0.10.0";
912
989
 
913
- export { type CreateWorkflowInput, 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 PersonaNodeRunState, 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 PersonaWorkflow, type PersonaWorkflowDraft, type PersonaWorkflowEdge, type PersonaWorkflowNode, type PersonaWorkflowNodeType, type PersonaWorkflowRunSummary, type PersonaWorkflowSummary, type PersonaWorkflowTrigger, type PersonaWorkflowVersionSummary, type PersonaWorkspaceFile, type SSEReader, type SSEStream, type SendMessageOverride, type UpdateWorkflowInput, type UseChatOptions, type UseMcpConnectionsOptions, type UseMcpOptions, type UseVoiceOptions, type UseVoiceResult, type UseWorkflowOptions, type UseWorkflowRunsOptions, type UseWorkflowStreamOptions, type UseWorkflowStreamResult, type UseWorkflowsOptions, VERSION, type WorkflowsPagination, openSSEStream, supportsStreamingFetch, useAgents, useChat, useConnection, useFiles, useMcp, useMcpConnections, useMemory, usePersonaContext, useThreads, useVoice, useWorkflow, useWorkflowRuns, useWorkflowStream, useWorkflows };
990
+ export { ARCHITECT_AGENT_ID, type CreateWorkflowInput, 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 PersonaNodeRunState, 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 PersonaWorkflow, type PersonaWorkflowDraft, type PersonaWorkflowEdge, type PersonaWorkflowNode, type PersonaWorkflowNodeType, type PersonaWorkflowRunSummary, type PersonaWorkflowSummary, type PersonaWorkflowTrigger, type PersonaWorkflowVersionSummary, type PersonaWorkspaceFile, type SSEReader, type SSEStream, type SendArchitectMessageOverride, type SendMessageOverride, type UpdateWorkflowInput, type UseArchitectChatOptions, type UseChatOptions, type UseMcpConnectionsOptions, type UseMcpOptions, type UseVoiceOptions, type UseVoiceResult, type UseWorkflowOptions, type UseWorkflowRunsOptions, type UseWorkflowStreamOptions, type UseWorkflowStreamResult, type UseWorkflowsOptions, VERSION, type WorkflowsPagination, openSSEStream, supportsStreamingFetch, useAgents, useArchitectChat, useChat, useConnection, useFiles, useMcp, useMcpConnections, useMemory, usePersonaContext, useThreads, useVoice, useWorkflow, useWorkflowRuns, useWorkflowStream, useWorkflows };
package/dist/index.d.ts CHANGED
@@ -343,6 +343,28 @@ interface UseChatOptions {
343
343
  */
344
344
  context?: Record<string, unknown> | (() => Record<string, unknown>);
345
345
  }
346
+ interface UseArchitectChatOptions {
347
+ threadId?: string;
348
+ initialMessages?: PersonaMessage[];
349
+ onFinish?: (message: PersonaMessage) => void;
350
+ onError?: (error: Error) => void;
351
+ /** Hook for receiving every low-level AG-UI streaming event (tool calls, steps, subagents) */
352
+ onEvent?: (event: PersonaStreamingEvent) => void;
353
+ /** Called when a fake/ephemeral chat mints a real thread on first send. Use to sync sidebar state (e.g. setThreadId(id)). */
354
+ onThreadCreated?: (threadId: string) => void;
355
+ /** Called when the backend auto-generates a thread title (3-4 word LLM summary of first user message). */
356
+ onTitle?: (title: string) => void;
357
+ }
358
+ interface SendArchitectMessageOverride {
359
+ /**
360
+ * A plain id, or a promise/thunk for one still in flight (e.g. a thread
361
+ * being lazily created for the first message of a new conversation).
362
+ * Mirrors {@link SendMessageOverride.threadId}.
363
+ */
364
+ threadId?: string | Promise<string | undefined>;
365
+ /** Answers/approves a paused interrupt from a previous turn instead of starting a fresh one. */
366
+ resume?: PersonaResumeValue;
367
+ }
346
368
  interface SendMessageOverride {
347
369
  agentId?: string;
348
370
  /**
@@ -638,6 +660,61 @@ declare function useChat(options?: UseChatOptions): {
638
660
  loadThreadMessages: (id: string) => Promise<PersonaMessage[]>;
639
661
  };
640
662
 
663
+ /**
664
+ * The Developer Platform Architect's own reserved Agent id
665
+ * (`DEVELOPER_ARCHITECT_AGENT_ID` in agent-backend/src/modules/agents/
666
+ * architectConstants.js) — it isn't a row in the Agent collection, but the
667
+ * backend's `POST /api/v1/developer/threads` special-cases exactly this id
668
+ * past its usual Agent-existence check (see developerThread.controller.js's
669
+ * `assertAgentAccessible`), so a named Architect Thread can be created the
670
+ * same way as for a real Agent. Kept in sync with that backend constant —
671
+ * update both together if it ever changes.
672
+ */
673
+ declare const ARCHITECT_AGENT_ID = "000000000000000000000002";
674
+ /**
675
+ * Runs the Agent Architect co-pilot — a conversational tool-calling agent
676
+ * that creates/edits the caller's own Agents (`manage_agent`, `manage_skill`,
677
+ * etc.), reached over the runtime's `POST /architect` route (see
678
+ * `@personaai/runtime`'s `routes/architect.ts`). Structurally a trimmed
679
+ * `useChat`: same streaming/interrupt/reload/thread-resume mechanics, but
680
+ * with no `agentId` to pass (the Architect is a single fixed target) and no
681
+ * `voice`/`sandboxCommands` (the Architect has no voice mode and no
682
+ * `execute` tool).
683
+ *
684
+ * `threadId` resume only has an effect when the underlying credential
685
+ * asserts an external user — a bare Project credential has no Subject for a
686
+ * Thread to belong to, so the backend silently keeps its single
687
+ * deterministic per-Project conversation either way (see
688
+ * `developerArchitect.controller.js`'s doc comment).
689
+ */
690
+ declare function useArchitectChat(options?: UseArchitectChatOptions): {
691
+ messages: PersonaMessage[];
692
+ input: string;
693
+ setInput: react.Dispatch<react.SetStateAction<string>>;
694
+ handleInputChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
695
+ handleSubmit: (e?: React.FormEvent) => void;
696
+ sendMessage: (contentToSend?: string, overrideOptions?: SendArchitectMessageOverride) => Promise<boolean>;
697
+ isStreaming: boolean;
698
+ isLoading: boolean;
699
+ isLoadingHistory: boolean;
700
+ error: Error | null;
701
+ interrupt: PersonaInterrupt | null;
702
+ resumeInterrupt: (resume: PersonaResumeValue, displayContent: string) => Promise<boolean>;
703
+ files: Record<string, PersonaWorkspaceFile>;
704
+ todos: PersonaTodo[];
705
+ presentedFile: PersonaPresentedFile | null;
706
+ dismissPresentedFile: () => void;
707
+ openWorkspaceFile: (path: string) => void;
708
+ stop: () => void;
709
+ reload: () => Promise<boolean>;
710
+ clear: () => void;
711
+ startNewChat: () => void;
712
+ currentThreadId: string | undefined;
713
+ isEphemeral: boolean;
714
+ setMessages: react.Dispatch<react.SetStateAction<PersonaMessage[]>>;
715
+ loadThreadMessages: (id: string) => Promise<PersonaMessage[]>;
716
+ };
717
+
641
718
  declare function useMemory(autoFetch?: boolean): {
642
719
  memory: PersonaMemoryList;
643
720
  isLoading: boolean;
@@ -908,6 +985,6 @@ declare function supportsStreamingFetch(): boolean;
908
985
  */
909
986
  declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
910
987
 
911
- declare const VERSION = "0.9.0";
988
+ declare const VERSION = "0.10.0";
912
989
 
913
- export { type CreateWorkflowInput, 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 PersonaNodeRunState, 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 PersonaWorkflow, type PersonaWorkflowDraft, type PersonaWorkflowEdge, type PersonaWorkflowNode, type PersonaWorkflowNodeType, type PersonaWorkflowRunSummary, type PersonaWorkflowSummary, type PersonaWorkflowTrigger, type PersonaWorkflowVersionSummary, type PersonaWorkspaceFile, type SSEReader, type SSEStream, type SendMessageOverride, type UpdateWorkflowInput, type UseChatOptions, type UseMcpConnectionsOptions, type UseMcpOptions, type UseVoiceOptions, type UseVoiceResult, type UseWorkflowOptions, type UseWorkflowRunsOptions, type UseWorkflowStreamOptions, type UseWorkflowStreamResult, type UseWorkflowsOptions, VERSION, type WorkflowsPagination, openSSEStream, supportsStreamingFetch, useAgents, useChat, useConnection, useFiles, useMcp, useMcpConnections, useMemory, usePersonaContext, useThreads, useVoice, useWorkflow, useWorkflowRuns, useWorkflowStream, useWorkflows };
990
+ export { ARCHITECT_AGENT_ID, type CreateWorkflowInput, 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 PersonaNodeRunState, 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 PersonaWorkflow, type PersonaWorkflowDraft, type PersonaWorkflowEdge, type PersonaWorkflowNode, type PersonaWorkflowNodeType, type PersonaWorkflowRunSummary, type PersonaWorkflowSummary, type PersonaWorkflowTrigger, type PersonaWorkflowVersionSummary, type PersonaWorkspaceFile, type SSEReader, type SSEStream, type SendArchitectMessageOverride, type SendMessageOverride, type UpdateWorkflowInput, type UseArchitectChatOptions, type UseChatOptions, type UseMcpConnectionsOptions, type UseMcpOptions, type UseVoiceOptions, type UseVoiceResult, type UseWorkflowOptions, type UseWorkflowRunsOptions, type UseWorkflowStreamOptions, type UseWorkflowStreamResult, type UseWorkflowsOptions, VERSION, type WorkflowsPagination, openSSEStream, supportsStreamingFetch, useAgents, useArchitectChat, useChat, useConnection, useFiles, useMcp, useMcpConnections, useMemory, usePersonaContext, useThreads, useVoice, useWorkflow, useWorkflowRuns, useWorkflowStream, useWorkflows };