@personaai/react 0.8.0 → 0.9.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/README.md +38 -10
- package/dist/index.cjs +609 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +227 -3
- package/dist/index.d.ts +227 -3
- package/dist/index.js +604 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -197,6 +197,12 @@ interface PersonaMemoryList {
|
|
|
197
197
|
* and `REASONING_END` rather than `REASONING_MESSAGE_END`).
|
|
198
198
|
*/
|
|
199
199
|
type PersonaStreamingEvent = {
|
|
200
|
+
type: "RUN_STARTED";
|
|
201
|
+
threadId?: string;
|
|
202
|
+
runId?: string;
|
|
203
|
+
} | {
|
|
204
|
+
type: "RUN_FINISHED";
|
|
205
|
+
} | {
|
|
200
206
|
type: "TEXT_MESSAGE_CHUNK";
|
|
201
207
|
delta: string;
|
|
202
208
|
messageId?: string;
|
|
@@ -241,6 +247,9 @@ type PersonaStreamingEvent = {
|
|
|
241
247
|
message: string;
|
|
242
248
|
retryable?: boolean;
|
|
243
249
|
providerName?: string;
|
|
250
|
+
} | {
|
|
251
|
+
type: "title";
|
|
252
|
+
title: string;
|
|
244
253
|
} | {
|
|
245
254
|
type: "CUSTOM";
|
|
246
255
|
name: "hitl_request";
|
|
@@ -269,6 +278,29 @@ type PersonaStreamingEvent = {
|
|
|
269
278
|
resourceUri: string;
|
|
270
279
|
mcpId: string;
|
|
271
280
|
};
|
|
281
|
+
} | {
|
|
282
|
+
type: "CUSTOM";
|
|
283
|
+
name: "workflow_node_started";
|
|
284
|
+
value: {
|
|
285
|
+
nodeId: string;
|
|
286
|
+
nodeType: string;
|
|
287
|
+
nodeLabel: string;
|
|
288
|
+
input?: unknown;
|
|
289
|
+
};
|
|
290
|
+
} | {
|
|
291
|
+
type: "CUSTOM";
|
|
292
|
+
name: "workflow_node_completed";
|
|
293
|
+
value: {
|
|
294
|
+
nodeId: string;
|
|
295
|
+
output: unknown;
|
|
296
|
+
};
|
|
297
|
+
} | {
|
|
298
|
+
type: "CUSTOM";
|
|
299
|
+
name: "workflow_node_failed";
|
|
300
|
+
value: {
|
|
301
|
+
nodeId: string;
|
|
302
|
+
error: string;
|
|
303
|
+
};
|
|
272
304
|
} | {
|
|
273
305
|
type: "CUSTOM";
|
|
274
306
|
name: string & {};
|
|
@@ -284,6 +316,8 @@ interface UseChatOptions {
|
|
|
284
316
|
onEvent?: (event: PersonaStreamingEvent) => void;
|
|
285
317
|
/** Called when a fake/ephemeral chat mints a real thread on first send. Use to sync sidebar state (e.g. setThreadId(id)). */
|
|
286
318
|
onThreadCreated?: (threadId: string) => void;
|
|
319
|
+
/** Called when the backend auto-generates a thread title (3-4 word LLM summary of first user message). */
|
|
320
|
+
onTitle?: (title: string) => void;
|
|
287
321
|
/**
|
|
288
322
|
* Pass the object returned by `useVoice()` (sharing the same `threadId`) to have `useChat`
|
|
289
323
|
* merge live voice turns into `messages` automatically — one bubble per utterance, deduped
|
|
@@ -421,6 +455,149 @@ interface UseVoiceResult {
|
|
|
421
455
|
*/
|
|
422
456
|
updateContext: (context: Record<string, unknown>) => void;
|
|
423
457
|
}
|
|
458
|
+
type PersonaWorkflowNodeType = "trigger" | "agent" | "tool" | "condition" | "parallel" | "code" | "human_review" | (string & {});
|
|
459
|
+
interface PersonaWorkflowNode {
|
|
460
|
+
id: string;
|
|
461
|
+
type: PersonaWorkflowNodeType;
|
|
462
|
+
position: {
|
|
463
|
+
x: number;
|
|
464
|
+
y: number;
|
|
465
|
+
};
|
|
466
|
+
data: Record<string, unknown>;
|
|
467
|
+
}
|
|
468
|
+
interface PersonaWorkflowEdge {
|
|
469
|
+
id: string;
|
|
470
|
+
source: string;
|
|
471
|
+
target: string;
|
|
472
|
+
sourceHandle?: string;
|
|
473
|
+
targetHandle?: string;
|
|
474
|
+
label?: string;
|
|
475
|
+
}
|
|
476
|
+
interface PersonaWorkflowTrigger {
|
|
477
|
+
type: "manual" | "webhook" | "schedule" | "event" | (string & {});
|
|
478
|
+
config?: Record<string, unknown>;
|
|
479
|
+
}
|
|
480
|
+
interface PersonaWorkflowDraft {
|
|
481
|
+
nodes: PersonaWorkflowNode[];
|
|
482
|
+
edges: PersonaWorkflowEdge[];
|
|
483
|
+
triggers?: PersonaWorkflowTrigger[];
|
|
484
|
+
settings?: Record<string, unknown>;
|
|
485
|
+
}
|
|
486
|
+
interface PersonaWorkflowSummary {
|
|
487
|
+
_id: string;
|
|
488
|
+
name: string;
|
|
489
|
+
slug?: string;
|
|
490
|
+
description?: string;
|
|
491
|
+
status: "draft" | "published" | "archived";
|
|
492
|
+
visibility?: "private" | "public";
|
|
493
|
+
activeVersion?: number;
|
|
494
|
+
tags?: string[];
|
|
495
|
+
createdAt: string;
|
|
496
|
+
updatedAt: string;
|
|
497
|
+
}
|
|
498
|
+
interface PersonaWorkflow extends PersonaWorkflowSummary {
|
|
499
|
+
draft: PersonaWorkflowDraft;
|
|
500
|
+
triggers?: PersonaWorkflowTrigger[];
|
|
501
|
+
ownerId?: string;
|
|
502
|
+
projectId?: string;
|
|
503
|
+
}
|
|
504
|
+
interface PersonaWorkflowVersionSummary {
|
|
505
|
+
_id: string;
|
|
506
|
+
workflowId: string;
|
|
507
|
+
version: number;
|
|
508
|
+
summary?: string;
|
|
509
|
+
createdAt: string;
|
|
510
|
+
}
|
|
511
|
+
interface PersonaWorkflowRunSummary {
|
|
512
|
+
_id: string;
|
|
513
|
+
workflowId: string;
|
|
514
|
+
version: number;
|
|
515
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
516
|
+
startedAt?: string;
|
|
517
|
+
finishedAt?: string;
|
|
518
|
+
durationMs?: number;
|
|
519
|
+
error?: string;
|
|
520
|
+
isDryRun?: boolean;
|
|
521
|
+
createdAt: string;
|
|
522
|
+
}
|
|
523
|
+
interface PersonaNodeRunState {
|
|
524
|
+
nodeId: string;
|
|
525
|
+
nodeType: string;
|
|
526
|
+
nodeLabel: string;
|
|
527
|
+
status: "idle" | "running" | "completed" | "failed";
|
|
528
|
+
startedAt?: string;
|
|
529
|
+
finishedAt?: string;
|
|
530
|
+
input?: unknown;
|
|
531
|
+
output?: unknown;
|
|
532
|
+
error?: string;
|
|
533
|
+
}
|
|
534
|
+
interface CreateWorkflowInput {
|
|
535
|
+
name: string;
|
|
536
|
+
description?: string;
|
|
537
|
+
slug?: string;
|
|
538
|
+
draft?: PersonaWorkflowDraft;
|
|
539
|
+
triggers?: PersonaWorkflowTrigger[];
|
|
540
|
+
visibility?: "private" | "public";
|
|
541
|
+
tags?: string[];
|
|
542
|
+
}
|
|
543
|
+
type UpdateWorkflowInput = Partial<CreateWorkflowInput>;
|
|
544
|
+
interface UseWorkflowsOptions {
|
|
545
|
+
autoFetch?: boolean;
|
|
546
|
+
search?: string;
|
|
547
|
+
status?: string;
|
|
548
|
+
page?: number;
|
|
549
|
+
limit?: number;
|
|
550
|
+
}
|
|
551
|
+
interface UseWorkflowOptions {
|
|
552
|
+
autoFetch?: boolean;
|
|
553
|
+
}
|
|
554
|
+
interface UseWorkflowStreamOptions {
|
|
555
|
+
workflowId?: string;
|
|
556
|
+
onNodeStarted?: (node: {
|
|
557
|
+
nodeId: string;
|
|
558
|
+
nodeType: string;
|
|
559
|
+
nodeLabel: string;
|
|
560
|
+
input?: unknown;
|
|
561
|
+
}) => void;
|
|
562
|
+
onNodeCompleted?: (node: {
|
|
563
|
+
nodeId: string;
|
|
564
|
+
output: unknown;
|
|
565
|
+
}) => void;
|
|
566
|
+
onNodeFailed?: (node: {
|
|
567
|
+
nodeId: string;
|
|
568
|
+
error: string;
|
|
569
|
+
}) => void;
|
|
570
|
+
onFinish?: (result: {
|
|
571
|
+
runId: string;
|
|
572
|
+
output: unknown;
|
|
573
|
+
text: string;
|
|
574
|
+
}) => void;
|
|
575
|
+
onError?: (error: Error) => void;
|
|
576
|
+
onEvent?: (event: PersonaStreamingEvent) => void;
|
|
577
|
+
}
|
|
578
|
+
interface UseWorkflowStreamResult {
|
|
579
|
+
runId: string | null;
|
|
580
|
+
status: "idle" | "running" | "completed" | "failed" | "cancelled";
|
|
581
|
+
isRunning: boolean;
|
|
582
|
+
activeNodeId: string | null;
|
|
583
|
+
nodeRuns: Record<string, PersonaNodeRunState>;
|
|
584
|
+
text: string;
|
|
585
|
+
output: unknown;
|
|
586
|
+
error: Error | null;
|
|
587
|
+
events: PersonaStreamingEvent[];
|
|
588
|
+
start: (input?: unknown, options?: {
|
|
589
|
+
dryRun?: boolean;
|
|
590
|
+
workflowId?: string;
|
|
591
|
+
}) => Promise<unknown>;
|
|
592
|
+
cancel: () => Promise<void>;
|
|
593
|
+
resume: (runId: string, sinceSeq?: number) => Promise<void>;
|
|
594
|
+
reset: () => void;
|
|
595
|
+
}
|
|
596
|
+
interface UseWorkflowRunsOptions {
|
|
597
|
+
autoFetch?: boolean;
|
|
598
|
+
page?: number;
|
|
599
|
+
limit?: number;
|
|
600
|
+
}
|
|
424
601
|
|
|
425
602
|
interface PersonaContextValue {
|
|
426
603
|
baseUrl: string;
|
|
@@ -628,6 +805,52 @@ declare function useMcp(options?: UseMcpOptions): {
|
|
|
628
805
|
callTool: (name: string, args?: Record<string, unknown>, mcpId?: string) => Promise<any>;
|
|
629
806
|
};
|
|
630
807
|
|
|
808
|
+
interface WorkflowsPagination {
|
|
809
|
+
page: number;
|
|
810
|
+
limit: number;
|
|
811
|
+
total: number;
|
|
812
|
+
totalPages: number;
|
|
813
|
+
}
|
|
814
|
+
declare function useWorkflows(options?: UseWorkflowsOptions | boolean): {
|
|
815
|
+
workflows: PersonaWorkflowSummary[];
|
|
816
|
+
pagination: WorkflowsPagination;
|
|
817
|
+
isLoading: boolean;
|
|
818
|
+
error: Error | null;
|
|
819
|
+
refetch: () => Promise<PersonaWorkflowSummary[]>;
|
|
820
|
+
createWorkflow: (input: CreateWorkflowInput) => Promise<PersonaWorkflow>;
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
declare function useWorkflow(workflowId: string, options?: UseWorkflowOptions | boolean): {
|
|
824
|
+
workflow: PersonaWorkflow | null;
|
|
825
|
+
versions: PersonaWorkflowVersionSummary[];
|
|
826
|
+
mermaid: string | null;
|
|
827
|
+
isLoading: boolean;
|
|
828
|
+
error: Error | null;
|
|
829
|
+
refetch: () => Promise<PersonaWorkflow | null>;
|
|
830
|
+
fetchVersions: () => Promise<PersonaWorkflowVersionSummary[]>;
|
|
831
|
+
fetchMermaid: () => Promise<any>;
|
|
832
|
+
saveDraft: (draft: PersonaWorkflowDraft) => Promise<PersonaWorkflow>;
|
|
833
|
+
publish: (summary?: string) => Promise<PersonaWorkflowVersionSummary>;
|
|
834
|
+
deleteWorkflow: () => Promise<void>;
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
declare function useWorkflowStream(workflowId?: string, options?: UseWorkflowStreamOptions): UseWorkflowStreamResult;
|
|
838
|
+
|
|
839
|
+
declare function useWorkflowRuns(workflowId?: string, options?: UseWorkflowRunsOptions | boolean): {
|
|
840
|
+
runs: PersonaWorkflowRunSummary[];
|
|
841
|
+
pagination: {
|
|
842
|
+
page: number;
|
|
843
|
+
limit: number;
|
|
844
|
+
total: number;
|
|
845
|
+
totalPages: number;
|
|
846
|
+
};
|
|
847
|
+
isLoading: boolean;
|
|
848
|
+
error: Error | null;
|
|
849
|
+
refetch: () => Promise<PersonaWorkflowRunSummary[]>;
|
|
850
|
+
getRun: (runId: string) => Promise<PersonaWorkflowRunSummary>;
|
|
851
|
+
cancelRun: (runId: string) => Promise<void>;
|
|
852
|
+
};
|
|
853
|
+
|
|
631
854
|
/**
|
|
632
855
|
* SSE transport for chat streams, with a React Native fallback.
|
|
633
856
|
*
|
|
@@ -666,7 +889,8 @@ interface SSEStream {
|
|
|
666
889
|
interface OpenSSEOptions {
|
|
667
890
|
url: string;
|
|
668
891
|
headers: Record<string, string>;
|
|
669
|
-
body
|
|
892
|
+
body?: string;
|
|
893
|
+
method?: "GET" | "POST";
|
|
670
894
|
signal?: AbortSignal;
|
|
671
895
|
}
|
|
672
896
|
/**
|
|
@@ -684,6 +908,6 @@ declare function supportsStreamingFetch(): boolean;
|
|
|
684
908
|
*/
|
|
685
909
|
declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
|
|
686
910
|
|
|
687
|
-
declare const VERSION = "0.
|
|
911
|
+
declare const VERSION = "0.9.0";
|
|
688
912
|
|
|
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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -197,6 +197,12 @@ interface PersonaMemoryList {
|
|
|
197
197
|
* and `REASONING_END` rather than `REASONING_MESSAGE_END`).
|
|
198
198
|
*/
|
|
199
199
|
type PersonaStreamingEvent = {
|
|
200
|
+
type: "RUN_STARTED";
|
|
201
|
+
threadId?: string;
|
|
202
|
+
runId?: string;
|
|
203
|
+
} | {
|
|
204
|
+
type: "RUN_FINISHED";
|
|
205
|
+
} | {
|
|
200
206
|
type: "TEXT_MESSAGE_CHUNK";
|
|
201
207
|
delta: string;
|
|
202
208
|
messageId?: string;
|
|
@@ -241,6 +247,9 @@ type PersonaStreamingEvent = {
|
|
|
241
247
|
message: string;
|
|
242
248
|
retryable?: boolean;
|
|
243
249
|
providerName?: string;
|
|
250
|
+
} | {
|
|
251
|
+
type: "title";
|
|
252
|
+
title: string;
|
|
244
253
|
} | {
|
|
245
254
|
type: "CUSTOM";
|
|
246
255
|
name: "hitl_request";
|
|
@@ -269,6 +278,29 @@ type PersonaStreamingEvent = {
|
|
|
269
278
|
resourceUri: string;
|
|
270
279
|
mcpId: string;
|
|
271
280
|
};
|
|
281
|
+
} | {
|
|
282
|
+
type: "CUSTOM";
|
|
283
|
+
name: "workflow_node_started";
|
|
284
|
+
value: {
|
|
285
|
+
nodeId: string;
|
|
286
|
+
nodeType: string;
|
|
287
|
+
nodeLabel: string;
|
|
288
|
+
input?: unknown;
|
|
289
|
+
};
|
|
290
|
+
} | {
|
|
291
|
+
type: "CUSTOM";
|
|
292
|
+
name: "workflow_node_completed";
|
|
293
|
+
value: {
|
|
294
|
+
nodeId: string;
|
|
295
|
+
output: unknown;
|
|
296
|
+
};
|
|
297
|
+
} | {
|
|
298
|
+
type: "CUSTOM";
|
|
299
|
+
name: "workflow_node_failed";
|
|
300
|
+
value: {
|
|
301
|
+
nodeId: string;
|
|
302
|
+
error: string;
|
|
303
|
+
};
|
|
272
304
|
} | {
|
|
273
305
|
type: "CUSTOM";
|
|
274
306
|
name: string & {};
|
|
@@ -284,6 +316,8 @@ interface UseChatOptions {
|
|
|
284
316
|
onEvent?: (event: PersonaStreamingEvent) => void;
|
|
285
317
|
/** Called when a fake/ephemeral chat mints a real thread on first send. Use to sync sidebar state (e.g. setThreadId(id)). */
|
|
286
318
|
onThreadCreated?: (threadId: string) => void;
|
|
319
|
+
/** Called when the backend auto-generates a thread title (3-4 word LLM summary of first user message). */
|
|
320
|
+
onTitle?: (title: string) => void;
|
|
287
321
|
/**
|
|
288
322
|
* Pass the object returned by `useVoice()` (sharing the same `threadId`) to have `useChat`
|
|
289
323
|
* merge live voice turns into `messages` automatically — one bubble per utterance, deduped
|
|
@@ -421,6 +455,149 @@ interface UseVoiceResult {
|
|
|
421
455
|
*/
|
|
422
456
|
updateContext: (context: Record<string, unknown>) => void;
|
|
423
457
|
}
|
|
458
|
+
type PersonaWorkflowNodeType = "trigger" | "agent" | "tool" | "condition" | "parallel" | "code" | "human_review" | (string & {});
|
|
459
|
+
interface PersonaWorkflowNode {
|
|
460
|
+
id: string;
|
|
461
|
+
type: PersonaWorkflowNodeType;
|
|
462
|
+
position: {
|
|
463
|
+
x: number;
|
|
464
|
+
y: number;
|
|
465
|
+
};
|
|
466
|
+
data: Record<string, unknown>;
|
|
467
|
+
}
|
|
468
|
+
interface PersonaWorkflowEdge {
|
|
469
|
+
id: string;
|
|
470
|
+
source: string;
|
|
471
|
+
target: string;
|
|
472
|
+
sourceHandle?: string;
|
|
473
|
+
targetHandle?: string;
|
|
474
|
+
label?: string;
|
|
475
|
+
}
|
|
476
|
+
interface PersonaWorkflowTrigger {
|
|
477
|
+
type: "manual" | "webhook" | "schedule" | "event" | (string & {});
|
|
478
|
+
config?: Record<string, unknown>;
|
|
479
|
+
}
|
|
480
|
+
interface PersonaWorkflowDraft {
|
|
481
|
+
nodes: PersonaWorkflowNode[];
|
|
482
|
+
edges: PersonaWorkflowEdge[];
|
|
483
|
+
triggers?: PersonaWorkflowTrigger[];
|
|
484
|
+
settings?: Record<string, unknown>;
|
|
485
|
+
}
|
|
486
|
+
interface PersonaWorkflowSummary {
|
|
487
|
+
_id: string;
|
|
488
|
+
name: string;
|
|
489
|
+
slug?: string;
|
|
490
|
+
description?: string;
|
|
491
|
+
status: "draft" | "published" | "archived";
|
|
492
|
+
visibility?: "private" | "public";
|
|
493
|
+
activeVersion?: number;
|
|
494
|
+
tags?: string[];
|
|
495
|
+
createdAt: string;
|
|
496
|
+
updatedAt: string;
|
|
497
|
+
}
|
|
498
|
+
interface PersonaWorkflow extends PersonaWorkflowSummary {
|
|
499
|
+
draft: PersonaWorkflowDraft;
|
|
500
|
+
triggers?: PersonaWorkflowTrigger[];
|
|
501
|
+
ownerId?: string;
|
|
502
|
+
projectId?: string;
|
|
503
|
+
}
|
|
504
|
+
interface PersonaWorkflowVersionSummary {
|
|
505
|
+
_id: string;
|
|
506
|
+
workflowId: string;
|
|
507
|
+
version: number;
|
|
508
|
+
summary?: string;
|
|
509
|
+
createdAt: string;
|
|
510
|
+
}
|
|
511
|
+
interface PersonaWorkflowRunSummary {
|
|
512
|
+
_id: string;
|
|
513
|
+
workflowId: string;
|
|
514
|
+
version: number;
|
|
515
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
516
|
+
startedAt?: string;
|
|
517
|
+
finishedAt?: string;
|
|
518
|
+
durationMs?: number;
|
|
519
|
+
error?: string;
|
|
520
|
+
isDryRun?: boolean;
|
|
521
|
+
createdAt: string;
|
|
522
|
+
}
|
|
523
|
+
interface PersonaNodeRunState {
|
|
524
|
+
nodeId: string;
|
|
525
|
+
nodeType: string;
|
|
526
|
+
nodeLabel: string;
|
|
527
|
+
status: "idle" | "running" | "completed" | "failed";
|
|
528
|
+
startedAt?: string;
|
|
529
|
+
finishedAt?: string;
|
|
530
|
+
input?: unknown;
|
|
531
|
+
output?: unknown;
|
|
532
|
+
error?: string;
|
|
533
|
+
}
|
|
534
|
+
interface CreateWorkflowInput {
|
|
535
|
+
name: string;
|
|
536
|
+
description?: string;
|
|
537
|
+
slug?: string;
|
|
538
|
+
draft?: PersonaWorkflowDraft;
|
|
539
|
+
triggers?: PersonaWorkflowTrigger[];
|
|
540
|
+
visibility?: "private" | "public";
|
|
541
|
+
tags?: string[];
|
|
542
|
+
}
|
|
543
|
+
type UpdateWorkflowInput = Partial<CreateWorkflowInput>;
|
|
544
|
+
interface UseWorkflowsOptions {
|
|
545
|
+
autoFetch?: boolean;
|
|
546
|
+
search?: string;
|
|
547
|
+
status?: string;
|
|
548
|
+
page?: number;
|
|
549
|
+
limit?: number;
|
|
550
|
+
}
|
|
551
|
+
interface UseWorkflowOptions {
|
|
552
|
+
autoFetch?: boolean;
|
|
553
|
+
}
|
|
554
|
+
interface UseWorkflowStreamOptions {
|
|
555
|
+
workflowId?: string;
|
|
556
|
+
onNodeStarted?: (node: {
|
|
557
|
+
nodeId: string;
|
|
558
|
+
nodeType: string;
|
|
559
|
+
nodeLabel: string;
|
|
560
|
+
input?: unknown;
|
|
561
|
+
}) => void;
|
|
562
|
+
onNodeCompleted?: (node: {
|
|
563
|
+
nodeId: string;
|
|
564
|
+
output: unknown;
|
|
565
|
+
}) => void;
|
|
566
|
+
onNodeFailed?: (node: {
|
|
567
|
+
nodeId: string;
|
|
568
|
+
error: string;
|
|
569
|
+
}) => void;
|
|
570
|
+
onFinish?: (result: {
|
|
571
|
+
runId: string;
|
|
572
|
+
output: unknown;
|
|
573
|
+
text: string;
|
|
574
|
+
}) => void;
|
|
575
|
+
onError?: (error: Error) => void;
|
|
576
|
+
onEvent?: (event: PersonaStreamingEvent) => void;
|
|
577
|
+
}
|
|
578
|
+
interface UseWorkflowStreamResult {
|
|
579
|
+
runId: string | null;
|
|
580
|
+
status: "idle" | "running" | "completed" | "failed" | "cancelled";
|
|
581
|
+
isRunning: boolean;
|
|
582
|
+
activeNodeId: string | null;
|
|
583
|
+
nodeRuns: Record<string, PersonaNodeRunState>;
|
|
584
|
+
text: string;
|
|
585
|
+
output: unknown;
|
|
586
|
+
error: Error | null;
|
|
587
|
+
events: PersonaStreamingEvent[];
|
|
588
|
+
start: (input?: unknown, options?: {
|
|
589
|
+
dryRun?: boolean;
|
|
590
|
+
workflowId?: string;
|
|
591
|
+
}) => Promise<unknown>;
|
|
592
|
+
cancel: () => Promise<void>;
|
|
593
|
+
resume: (runId: string, sinceSeq?: number) => Promise<void>;
|
|
594
|
+
reset: () => void;
|
|
595
|
+
}
|
|
596
|
+
interface UseWorkflowRunsOptions {
|
|
597
|
+
autoFetch?: boolean;
|
|
598
|
+
page?: number;
|
|
599
|
+
limit?: number;
|
|
600
|
+
}
|
|
424
601
|
|
|
425
602
|
interface PersonaContextValue {
|
|
426
603
|
baseUrl: string;
|
|
@@ -628,6 +805,52 @@ declare function useMcp(options?: UseMcpOptions): {
|
|
|
628
805
|
callTool: (name: string, args?: Record<string, unknown>, mcpId?: string) => Promise<any>;
|
|
629
806
|
};
|
|
630
807
|
|
|
808
|
+
interface WorkflowsPagination {
|
|
809
|
+
page: number;
|
|
810
|
+
limit: number;
|
|
811
|
+
total: number;
|
|
812
|
+
totalPages: number;
|
|
813
|
+
}
|
|
814
|
+
declare function useWorkflows(options?: UseWorkflowsOptions | boolean): {
|
|
815
|
+
workflows: PersonaWorkflowSummary[];
|
|
816
|
+
pagination: WorkflowsPagination;
|
|
817
|
+
isLoading: boolean;
|
|
818
|
+
error: Error | null;
|
|
819
|
+
refetch: () => Promise<PersonaWorkflowSummary[]>;
|
|
820
|
+
createWorkflow: (input: CreateWorkflowInput) => Promise<PersonaWorkflow>;
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
declare function useWorkflow(workflowId: string, options?: UseWorkflowOptions | boolean): {
|
|
824
|
+
workflow: PersonaWorkflow | null;
|
|
825
|
+
versions: PersonaWorkflowVersionSummary[];
|
|
826
|
+
mermaid: string | null;
|
|
827
|
+
isLoading: boolean;
|
|
828
|
+
error: Error | null;
|
|
829
|
+
refetch: () => Promise<PersonaWorkflow | null>;
|
|
830
|
+
fetchVersions: () => Promise<PersonaWorkflowVersionSummary[]>;
|
|
831
|
+
fetchMermaid: () => Promise<any>;
|
|
832
|
+
saveDraft: (draft: PersonaWorkflowDraft) => Promise<PersonaWorkflow>;
|
|
833
|
+
publish: (summary?: string) => Promise<PersonaWorkflowVersionSummary>;
|
|
834
|
+
deleteWorkflow: () => Promise<void>;
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
declare function useWorkflowStream(workflowId?: string, options?: UseWorkflowStreamOptions): UseWorkflowStreamResult;
|
|
838
|
+
|
|
839
|
+
declare function useWorkflowRuns(workflowId?: string, options?: UseWorkflowRunsOptions | boolean): {
|
|
840
|
+
runs: PersonaWorkflowRunSummary[];
|
|
841
|
+
pagination: {
|
|
842
|
+
page: number;
|
|
843
|
+
limit: number;
|
|
844
|
+
total: number;
|
|
845
|
+
totalPages: number;
|
|
846
|
+
};
|
|
847
|
+
isLoading: boolean;
|
|
848
|
+
error: Error | null;
|
|
849
|
+
refetch: () => Promise<PersonaWorkflowRunSummary[]>;
|
|
850
|
+
getRun: (runId: string) => Promise<PersonaWorkflowRunSummary>;
|
|
851
|
+
cancelRun: (runId: string) => Promise<void>;
|
|
852
|
+
};
|
|
853
|
+
|
|
631
854
|
/**
|
|
632
855
|
* SSE transport for chat streams, with a React Native fallback.
|
|
633
856
|
*
|
|
@@ -666,7 +889,8 @@ interface SSEStream {
|
|
|
666
889
|
interface OpenSSEOptions {
|
|
667
890
|
url: string;
|
|
668
891
|
headers: Record<string, string>;
|
|
669
|
-
body
|
|
892
|
+
body?: string;
|
|
893
|
+
method?: "GET" | "POST";
|
|
670
894
|
signal?: AbortSignal;
|
|
671
895
|
}
|
|
672
896
|
/**
|
|
@@ -684,6 +908,6 @@ declare function supportsStreamingFetch(): boolean;
|
|
|
684
908
|
*/
|
|
685
909
|
declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
|
|
686
910
|
|
|
687
|
-
declare const VERSION = "0.
|
|
911
|
+
declare const VERSION = "0.9.0";
|
|
688
912
|
|
|
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 };
|
|
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 };
|