@personaai/react 0.10.0 → 0.14.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 +210 -210
- package/dist/docs/.nojekyll +1 -0
- package/dist/index.cjs +1176 -183
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +801 -57
- package/dist/index.d.ts +801 -57
- package/dist/index.js +1169 -180
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -477,15 +477,31 @@ interface UseVoiceResult {
|
|
|
477
477
|
*/
|
|
478
478
|
updateContext: (context: Record<string, unknown>) => void;
|
|
479
479
|
}
|
|
480
|
-
type PersonaWorkflowNodeType = "trigger" | "
|
|
480
|
+
type PersonaWorkflowNodeType = "trigger" | "agentStep" | "knowledgeStep" | "toolStep" | "condition" | "approval" | "parallel" | "join" | "output";
|
|
481
|
+
type PersonaWorkflowTriggerType = "manual" | "api" | "webhook" | "schedule" | "chat";
|
|
482
|
+
type PersonaWorkflowVisibility = "private" | "unlisted" | "public";
|
|
483
|
+
type PersonaWorkflowOwnerType = "Project" | "ExternalUser";
|
|
484
|
+
type PersonaNodeOnErrorAction = "fail" | "continue" | "routeError";
|
|
485
|
+
interface PersonaNodeRetryPolicy {
|
|
486
|
+
maxRetries?: number;
|
|
487
|
+
backoffMs?: number;
|
|
488
|
+
exponential?: boolean;
|
|
489
|
+
}
|
|
490
|
+
interface PersonaWorkflowNodeData {
|
|
491
|
+
label: string;
|
|
492
|
+
description?: string;
|
|
493
|
+
config?: Record<string, unknown>;
|
|
494
|
+
retryPolicy?: PersonaNodeRetryPolicy;
|
|
495
|
+
onError?: PersonaNodeOnErrorAction;
|
|
496
|
+
}
|
|
481
497
|
interface PersonaWorkflowNode {
|
|
482
498
|
id: string;
|
|
483
499
|
type: PersonaWorkflowNodeType;
|
|
484
|
-
position
|
|
500
|
+
position?: {
|
|
485
501
|
x: number;
|
|
486
502
|
y: number;
|
|
487
503
|
};
|
|
488
|
-
data:
|
|
504
|
+
data: PersonaWorkflowNodeData;
|
|
489
505
|
}
|
|
490
506
|
interface PersonaWorkflowEdge {
|
|
491
507
|
id: string;
|
|
@@ -493,55 +509,110 @@ interface PersonaWorkflowEdge {
|
|
|
493
509
|
target: string;
|
|
494
510
|
sourceHandle?: string;
|
|
495
511
|
targetHandle?: string;
|
|
496
|
-
|
|
512
|
+
condition?: unknown;
|
|
513
|
+
conditionValue?: string;
|
|
497
514
|
}
|
|
498
515
|
interface PersonaWorkflowTrigger {
|
|
499
|
-
type:
|
|
516
|
+
type: PersonaWorkflowTriggerType;
|
|
500
517
|
config?: Record<string, unknown>;
|
|
501
518
|
}
|
|
502
519
|
interface PersonaWorkflowDraft {
|
|
503
520
|
nodes: PersonaWorkflowNode[];
|
|
504
521
|
edges: PersonaWorkflowEdge[];
|
|
505
|
-
|
|
506
|
-
|
|
522
|
+
/** Singular — a draft has at most one trigger, not an array of them. */
|
|
523
|
+
trigger?: PersonaWorkflowTrigger;
|
|
507
524
|
}
|
|
508
|
-
interface
|
|
525
|
+
interface PersonaWorkflow {
|
|
509
526
|
_id: string;
|
|
527
|
+
domain?: string;
|
|
528
|
+
projectId?: string;
|
|
510
529
|
name: string;
|
|
511
|
-
slug?: string;
|
|
512
530
|
description?: string;
|
|
513
|
-
|
|
514
|
-
visibility
|
|
515
|
-
|
|
516
|
-
|
|
531
|
+
isEnabled: boolean;
|
|
532
|
+
visibility: PersonaWorkflowVisibility;
|
|
533
|
+
ownerType: PersonaWorkflowOwnerType;
|
|
534
|
+
externalOwnerId?: string | null;
|
|
535
|
+
draft: PersonaWorkflowDraft;
|
|
536
|
+
/** `0` until `publish()` has been called at least once. */
|
|
537
|
+
publishedVersion: number;
|
|
538
|
+
activeRuns: number;
|
|
517
539
|
createdAt: string;
|
|
518
540
|
updatedAt: string;
|
|
519
541
|
}
|
|
520
|
-
interface
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
projectId?: string;
|
|
542
|
+
interface PersonaAgentSnapshot {
|
|
543
|
+
modelName: string;
|
|
544
|
+
systemPrompt: string;
|
|
545
|
+
tools?: string[];
|
|
525
546
|
}
|
|
526
|
-
|
|
547
|
+
/** A published, immutable snapshot of a workflow's draft — what `stream()` actually executes. */
|
|
548
|
+
interface PersonaWorkflowVersion {
|
|
527
549
|
_id: string;
|
|
528
550
|
workflowId: string;
|
|
551
|
+
projectId: string;
|
|
529
552
|
version: number;
|
|
530
|
-
|
|
553
|
+
definition: PersonaWorkflowDraft;
|
|
554
|
+
agentSnapshots?: Record<string, PersonaAgentSnapshot>;
|
|
555
|
+
publishedBy?: string;
|
|
556
|
+
publishedAt: string;
|
|
531
557
|
createdAt: string;
|
|
558
|
+
updatedAt: string;
|
|
532
559
|
}
|
|
533
|
-
|
|
560
|
+
type PersonaWorkflowRunStatus = "queued" | "running" | "paused" | "completed" | "failed" | "cancelled";
|
|
561
|
+
type PersonaNodeRunStatus = "running" | "completed" | "failed" | "skipped" | "paused";
|
|
562
|
+
/** One node's persisted run record, as returned by the REST API after the fact — distinct from `PersonaNodeRunState` below, which is the *live*, client-derived state `useWorkflowStream` builds up from AG-UI events while a run is still in progress. */
|
|
563
|
+
interface PersonaNodeRun {
|
|
564
|
+
nodeId: string;
|
|
565
|
+
nodeType: string;
|
|
566
|
+
status: PersonaNodeRunStatus;
|
|
567
|
+
input?: unknown;
|
|
568
|
+
output?: unknown;
|
|
569
|
+
error?: string;
|
|
570
|
+
retriesTaken: number;
|
|
571
|
+
durationMs: number;
|
|
572
|
+
tokens: number;
|
|
573
|
+
startedAt: string;
|
|
574
|
+
endedAt?: string;
|
|
575
|
+
}
|
|
576
|
+
interface PersonaWorkflowUsage {
|
|
577
|
+
totalTokens: number;
|
|
578
|
+
agentTurns: number;
|
|
579
|
+
toolCalls: number;
|
|
580
|
+
creditsDeducted: number;
|
|
581
|
+
}
|
|
582
|
+
interface PersonaWorkflowRun {
|
|
534
583
|
_id: string;
|
|
535
584
|
workflowId: string;
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
585
|
+
workflowVersion: number;
|
|
586
|
+
projectId: string;
|
|
587
|
+
triggeredBy: {
|
|
588
|
+
type: PersonaWorkflowTriggerType;
|
|
589
|
+
userId?: string;
|
|
590
|
+
details?: unknown;
|
|
591
|
+
};
|
|
592
|
+
status: PersonaWorkflowRunStatus;
|
|
593
|
+
isDryRun: boolean;
|
|
594
|
+
nodeRuns: PersonaNodeRun[];
|
|
595
|
+
pendingApproval?: {
|
|
596
|
+
nodeId?: string;
|
|
597
|
+
prompt?: string;
|
|
598
|
+
options?: string[];
|
|
599
|
+
requestedAt?: string;
|
|
600
|
+
};
|
|
601
|
+
output?: unknown;
|
|
602
|
+
usage?: PersonaWorkflowUsage;
|
|
603
|
+
threadId: string;
|
|
604
|
+
startedAt: string;
|
|
605
|
+
endedAt?: string;
|
|
543
606
|
createdAt: string;
|
|
607
|
+
updatedAt: string;
|
|
544
608
|
}
|
|
609
|
+
/**
|
|
610
|
+
* Live, client-derived state for one node during an in-progress
|
|
611
|
+
* `useWorkflowStream` run — built up from `workflow_node_started`/
|
|
612
|
+
* `_completed`/`_failed` AG-UI events, not fetched from the REST API. See
|
|
613
|
+
* `PersonaNodeRun` for the persisted record `useWorkflowRuns`/`getRun`
|
|
614
|
+
* return once a run has actually finished.
|
|
615
|
+
*/
|
|
545
616
|
interface PersonaNodeRunState {
|
|
546
617
|
nodeId: string;
|
|
547
618
|
nodeType: string;
|
|
@@ -553,22 +624,31 @@ interface PersonaNodeRunState {
|
|
|
553
624
|
output?: unknown;
|
|
554
625
|
error?: string;
|
|
555
626
|
}
|
|
556
|
-
interface
|
|
627
|
+
interface CreatePersonaWorkflowInput {
|
|
557
628
|
name: string;
|
|
558
629
|
description?: string;
|
|
559
|
-
|
|
630
|
+
visibility?: PersonaWorkflowVisibility;
|
|
631
|
+
isEnabled?: boolean;
|
|
632
|
+
draft?: PersonaWorkflowDraft;
|
|
633
|
+
}
|
|
634
|
+
/** All fields optional — only what you pass is changed. */
|
|
635
|
+
interface UpdatePersonaWorkflowInput {
|
|
636
|
+
name?: string;
|
|
637
|
+
description?: string;
|
|
638
|
+
visibility?: PersonaWorkflowVisibility;
|
|
639
|
+
isEnabled?: boolean;
|
|
560
640
|
draft?: PersonaWorkflowDraft;
|
|
561
|
-
triggers?: PersonaWorkflowTrigger[];
|
|
562
|
-
visibility?: "private" | "public";
|
|
563
|
-
tags?: string[];
|
|
564
641
|
}
|
|
565
|
-
type UpdateWorkflowInput = Partial<CreateWorkflowInput>;
|
|
566
642
|
interface UseWorkflowsOptions {
|
|
567
643
|
autoFetch?: boolean;
|
|
568
|
-
search?: string;
|
|
569
|
-
status?: string;
|
|
570
644
|
page?: number;
|
|
571
645
|
limit?: number;
|
|
646
|
+
/** Free-text match against name/description. */
|
|
647
|
+
search?: string;
|
|
648
|
+
/** @default 'all' for a ProjectMachine/Admin caller; 'public' for a ProjectRuntime caller without this set. */
|
|
649
|
+
scope?: "mine" | "public" | "all";
|
|
650
|
+
visibility?: PersonaWorkflowVisibility;
|
|
651
|
+
isEnabled?: boolean;
|
|
572
652
|
}
|
|
573
653
|
interface UseWorkflowOptions {
|
|
574
654
|
autoFetch?: boolean;
|
|
@@ -620,6 +700,500 @@ interface UseWorkflowRunsOptions {
|
|
|
620
700
|
page?: number;
|
|
621
701
|
limit?: number;
|
|
622
702
|
}
|
|
703
|
+
/** Shared list envelope every Developer Platform discovery endpoint uses (Agents/Skills/Knowledge/MCP/Threads/Files). */
|
|
704
|
+
interface PersonaPagination {
|
|
705
|
+
total: number;
|
|
706
|
+
page: number;
|
|
707
|
+
limit: number;
|
|
708
|
+
pages: number;
|
|
709
|
+
}
|
|
710
|
+
/** `{ deleted, failed }` from a `POST .../bulk-delete` — a best-effort batch, not all-or-nothing; check `failed` for per-id reasons. */
|
|
711
|
+
interface PersonaBulkDeleteResult {
|
|
712
|
+
deleted: string[];
|
|
713
|
+
failed: Array<{
|
|
714
|
+
id: string;
|
|
715
|
+
reason: string;
|
|
716
|
+
}>;
|
|
717
|
+
}
|
|
718
|
+
/** A file bundled with a Skill (e.g. a reference doc or script an Agent can read). */
|
|
719
|
+
interface PersonaSkillFile {
|
|
720
|
+
path: string;
|
|
721
|
+
content: string;
|
|
722
|
+
mimeType?: string;
|
|
723
|
+
createdAt?: string;
|
|
724
|
+
updatedAt?: string;
|
|
725
|
+
}
|
|
726
|
+
interface PersonaSkill {
|
|
727
|
+
_id: string;
|
|
728
|
+
domain: string;
|
|
729
|
+
ownerType: "PersonaUser" | "Project" | "ExternalUser";
|
|
730
|
+
ownerId?: string;
|
|
731
|
+
externalOwnerId?: string;
|
|
732
|
+
name: string;
|
|
733
|
+
description: string;
|
|
734
|
+
instructions: string;
|
|
735
|
+
files: PersonaSkillFile[];
|
|
736
|
+
/** Visible to every credential in the platform when `true`, not just this Domain. */
|
|
737
|
+
isPublic: boolean;
|
|
738
|
+
createdAt: string;
|
|
739
|
+
updatedAt: string;
|
|
740
|
+
/** Present only on a single `getSkill()` read — whether the calling identity owns this Skill. */
|
|
741
|
+
isOwner?: boolean;
|
|
742
|
+
}
|
|
743
|
+
interface CreatePersonaSkillInput {
|
|
744
|
+
name: string;
|
|
745
|
+
description: string;
|
|
746
|
+
/** The actual prompt text given to an Agent that has this Skill attached. */
|
|
747
|
+
instructions: string;
|
|
748
|
+
/** @default false */
|
|
749
|
+
isPublic?: boolean;
|
|
750
|
+
files?: Array<{
|
|
751
|
+
path: string;
|
|
752
|
+
content: string;
|
|
753
|
+
mimeType?: string;
|
|
754
|
+
}>;
|
|
755
|
+
}
|
|
756
|
+
/** All fields optional — only what you pass is changed. */
|
|
757
|
+
interface UpdatePersonaSkillInput {
|
|
758
|
+
name?: string;
|
|
759
|
+
description?: string;
|
|
760
|
+
instructions?: string;
|
|
761
|
+
isPublic?: boolean;
|
|
762
|
+
/** Replaces the entire `files` array — not a merge/append. */
|
|
763
|
+
files?: Array<{
|
|
764
|
+
path: string;
|
|
765
|
+
content: string;
|
|
766
|
+
mimeType?: string;
|
|
767
|
+
}>;
|
|
768
|
+
}
|
|
769
|
+
/** Agents referencing a Skill — check before deleting it to avoid a blocked-delete error. */
|
|
770
|
+
interface PersonaSkillUsage {
|
|
771
|
+
/** The real total — `agents` below is a preview capped at 20. */
|
|
772
|
+
agentCount: number;
|
|
773
|
+
agents: Array<{
|
|
774
|
+
_id: string;
|
|
775
|
+
name: string;
|
|
776
|
+
}>;
|
|
777
|
+
}
|
|
778
|
+
interface UseSkillsOptions {
|
|
779
|
+
/** @default true */
|
|
780
|
+
autoFetch?: boolean;
|
|
781
|
+
page?: number;
|
|
782
|
+
limit?: number;
|
|
783
|
+
/** Free-text match against name/description. */
|
|
784
|
+
search?: string;
|
|
785
|
+
/** Restricts to the asserted external user's own Skills. Requires a `ProjectRuntimeContext` (i.e. `PersonaProvider` talking through an adapter with `resolveUserFrom`/`resolveUser`) — a no-op otherwise. */
|
|
786
|
+
scope?: "mine";
|
|
787
|
+
}
|
|
788
|
+
interface PersonaAgentSocialLinks {
|
|
789
|
+
website?: string;
|
|
790
|
+
twitter?: string;
|
|
791
|
+
github?: string;
|
|
792
|
+
linkedin?: string;
|
|
793
|
+
}
|
|
794
|
+
/** `unlisted` is reachable by direct link/id but excluded from public discovery listings. */
|
|
795
|
+
type PersonaAgentVisibility = "private" | "unlisted" | "public";
|
|
796
|
+
type PersonaAgentCategory = "productivity" | "coding" | "creative" | "research" | "roleplay" | "other";
|
|
797
|
+
/**
|
|
798
|
+
* Mirrors the real wire shape (`_id`, raw domain/ownerType fields) —
|
|
799
|
+
* `getAgent()` returns `skills`/`mcps`/`knowledgeBases` populated as
|
|
800
|
+
* objects, while `createAgent()`/`updateAgent()`/`agents` (from the list)
|
|
801
|
+
* return them as bare id strings; typed loosely (`unknown[]`) to reflect
|
|
802
|
+
* that real difference rather than picking one shape and being wrong for
|
|
803
|
+
* the other calls.
|
|
804
|
+
*/
|
|
805
|
+
interface PersonaAgent {
|
|
806
|
+
_id: string;
|
|
807
|
+
domain: string;
|
|
808
|
+
ownerType: "PersonaUser" | "Project" | "ExternalUser";
|
|
809
|
+
ownerId?: string;
|
|
810
|
+
externalOwnerId?: string;
|
|
811
|
+
name: string;
|
|
812
|
+
/** URL-safe, unique within the Domain; used in some public-facing routes. */
|
|
813
|
+
slug: string;
|
|
814
|
+
description?: string;
|
|
815
|
+
avatar?: string;
|
|
816
|
+
tags?: string[];
|
|
817
|
+
/** Short one-liner shown in list/card views. */
|
|
818
|
+
tagline?: string;
|
|
819
|
+
/** Longer free-text bio shown on the Agent's own profile view. */
|
|
820
|
+
bio?: string;
|
|
821
|
+
personalityTraits?: string[];
|
|
822
|
+
socialLinks?: PersonaAgentSocialLinks;
|
|
823
|
+
/** Stripped from the response when the calling identity doesn't own this Agent. */
|
|
824
|
+
systemPrompt?: string;
|
|
825
|
+
/** Stripped from the response when the calling identity doesn't own this Agent. */
|
|
826
|
+
providerId?: string;
|
|
827
|
+
/** Overrides the referenced Provider's `defaultModel` when set. */
|
|
828
|
+
modelName?: string;
|
|
829
|
+
webSearchEnabled: boolean;
|
|
830
|
+
/** Real shell execution in an isolated CodeSandbox VM — requires a `CSB_API_KEY` Project Secret to already exist. */
|
|
831
|
+
sandboxEnabled: boolean;
|
|
832
|
+
visibility: PersonaAgentVisibility;
|
|
833
|
+
category: PersonaAgentCategory;
|
|
834
|
+
skills?: unknown[];
|
|
835
|
+
mcps?: unknown[];
|
|
836
|
+
knowledgeBases?: unknown[];
|
|
837
|
+
storeMounts?: unknown[];
|
|
838
|
+
/** Maps a tool name to whether calling it pauses the run for human approval. */
|
|
839
|
+
interruptOn?: Record<string, boolean>;
|
|
840
|
+
isActive: boolean;
|
|
841
|
+
/** Whether this is the Project's designated default/primary Agent. */
|
|
842
|
+
isMainAgent: boolean;
|
|
843
|
+
createdAt: string;
|
|
844
|
+
updatedAt: string;
|
|
845
|
+
}
|
|
846
|
+
interface CreatePersonaAgentInput {
|
|
847
|
+
name: string;
|
|
848
|
+
/** The instructions that define this Agent's behavior/persona. */
|
|
849
|
+
systemPrompt: string;
|
|
850
|
+
/** Must reference a Provider the host Project already created. */
|
|
851
|
+
providerId: string;
|
|
852
|
+
description?: string;
|
|
853
|
+
avatar?: string;
|
|
854
|
+
tags?: string[];
|
|
855
|
+
tagline?: string;
|
|
856
|
+
bio?: string;
|
|
857
|
+
personalityTraits?: string[];
|
|
858
|
+
socialLinks?: PersonaAgentSocialLinks;
|
|
859
|
+
modelName?: string;
|
|
860
|
+
/** @default false */
|
|
861
|
+
webSearchEnabled?: boolean;
|
|
862
|
+
/** @default false */
|
|
863
|
+
sandboxEnabled?: boolean;
|
|
864
|
+
/** @default 'private' */
|
|
865
|
+
visibility?: PersonaAgentVisibility;
|
|
866
|
+
/** @default 'other' */
|
|
867
|
+
category?: PersonaAgentCategory;
|
|
868
|
+
/** Skill ids to attach at creation time. */
|
|
869
|
+
skills?: string[];
|
|
870
|
+
/** MCP server ids to attach at creation time. */
|
|
871
|
+
mcps?: string[];
|
|
872
|
+
/** Knowledge base ids to attach at creation time. */
|
|
873
|
+
knowledgeBases?: string[];
|
|
874
|
+
/** Store ids to mount at creation time. */
|
|
875
|
+
storeMounts?: string[];
|
|
876
|
+
interruptOn?: Record<string, boolean>;
|
|
877
|
+
/** @default true */
|
|
878
|
+
isActive?: boolean;
|
|
879
|
+
}
|
|
880
|
+
/** All fields optional — only what you pass is changed; array/map fields replace the whole value, not a merge/append. */
|
|
881
|
+
interface UpdatePersonaAgentInput {
|
|
882
|
+
name?: string;
|
|
883
|
+
description?: string;
|
|
884
|
+
avatar?: string;
|
|
885
|
+
tags?: string[];
|
|
886
|
+
tagline?: string;
|
|
887
|
+
bio?: string;
|
|
888
|
+
personalityTraits?: string[];
|
|
889
|
+
socialLinks?: PersonaAgentSocialLinks;
|
|
890
|
+
systemPrompt?: string;
|
|
891
|
+
providerId?: string;
|
|
892
|
+
modelName?: string;
|
|
893
|
+
webSearchEnabled?: boolean;
|
|
894
|
+
sandboxEnabled?: boolean;
|
|
895
|
+
skills?: string[];
|
|
896
|
+
mcps?: string[];
|
|
897
|
+
knowledgeBases?: string[];
|
|
898
|
+
storeMounts?: string[];
|
|
899
|
+
interruptOn?: Record<string, boolean>;
|
|
900
|
+
visibility?: PersonaAgentVisibility;
|
|
901
|
+
category?: PersonaAgentCategory;
|
|
902
|
+
isActive?: boolean;
|
|
903
|
+
}
|
|
904
|
+
interface UseAgentsOptions {
|
|
905
|
+
/** @default true */
|
|
906
|
+
autoFetch?: boolean;
|
|
907
|
+
page?: number;
|
|
908
|
+
limit?: number;
|
|
909
|
+
/** Free-text match against name/description/tagline. */
|
|
910
|
+
search?: string;
|
|
911
|
+
category?: PersonaAgentCategory;
|
|
912
|
+
/** Restricts to the asserted external user's own Agents. Requires a `ProjectRuntimeContext` — a no-op otherwise. */
|
|
913
|
+
scope?: "mine";
|
|
914
|
+
}
|
|
915
|
+
interface PersonaRcpSourceToolParamSummary {
|
|
916
|
+
name: string;
|
|
917
|
+
type: string;
|
|
918
|
+
description: string;
|
|
919
|
+
required: boolean;
|
|
920
|
+
}
|
|
921
|
+
/** A display cache only, written by `testRcpSourceConnection` — Agent execution discovers tools live via `rcp-sdk`, never reads this. */
|
|
922
|
+
interface PersonaRcpSourceToolSummary {
|
|
923
|
+
name: string;
|
|
924
|
+
description: string;
|
|
925
|
+
method: string;
|
|
926
|
+
url: string;
|
|
927
|
+
/** Every param this tool exposes (never resolver-filtered) — needed client-side to build `paramContextMap`. */
|
|
928
|
+
params: PersonaRcpSourceToolParamSummary[];
|
|
929
|
+
}
|
|
930
|
+
/** Maps one of this source's tool param names to a key sent in a message's per-turn `context` — see `SendMessageOverride.context`. Shared across every Agent this source is attached to, not per-attachment. */
|
|
931
|
+
interface PersonaRcpParamContextMapEntry {
|
|
932
|
+
param: string;
|
|
933
|
+
contextKey: string;
|
|
934
|
+
}
|
|
935
|
+
/** A hosted RCP (REST Connector Protocol, npm `rcp-sdk`) manifest URL Persona discovers tools from live on every Agent run. */
|
|
936
|
+
interface PersonaRcpSource {
|
|
937
|
+
_id: string;
|
|
938
|
+
domain: string;
|
|
939
|
+
ownerType: "PersonaUser" | "Project" | "ExternalUser";
|
|
940
|
+
ownerId?: string;
|
|
941
|
+
externalOwnerId?: string;
|
|
942
|
+
name: string;
|
|
943
|
+
description: string;
|
|
944
|
+
/** `GET url` must return a conformant `{ rcpVersion, auth, tools[] }` manifest. */
|
|
945
|
+
url: string;
|
|
946
|
+
authType: "none" | "header";
|
|
947
|
+
/** A Project Secret id — present only when `authType` is `'header'`. Never returns the secret's plaintext value. */
|
|
948
|
+
secretRef?: string | null;
|
|
949
|
+
isEnabled: boolean;
|
|
950
|
+
lastTestedAt?: string | null;
|
|
951
|
+
tools: PersonaRcpSourceToolSummary[];
|
|
952
|
+
paramContextMap: PersonaRcpParamContextMapEntry[];
|
|
953
|
+
createdAt: string;
|
|
954
|
+
updatedAt: string;
|
|
955
|
+
}
|
|
956
|
+
interface CreatePersonaRcpSourceInput {
|
|
957
|
+
name: string;
|
|
958
|
+
description?: string;
|
|
959
|
+
url: string;
|
|
960
|
+
/** @default 'none' */
|
|
961
|
+
authType?: "none" | "header";
|
|
962
|
+
/** A Project Secret id. Required when `authType` is `'header'`. */
|
|
963
|
+
secretRef?: string;
|
|
964
|
+
/** @default true */
|
|
965
|
+
isEnabled?: boolean;
|
|
966
|
+
paramContextMap?: PersonaRcpParamContextMapEntry[];
|
|
967
|
+
}
|
|
968
|
+
/** All fields optional — only what you pass is changed. */
|
|
969
|
+
interface UpdatePersonaRcpSourceInput {
|
|
970
|
+
name?: string;
|
|
971
|
+
description?: string;
|
|
972
|
+
url?: string;
|
|
973
|
+
authType?: "none" | "header";
|
|
974
|
+
secretRef?: string | null;
|
|
975
|
+
isEnabled?: boolean;
|
|
976
|
+
paramContextMap?: PersonaRcpParamContextMapEntry[];
|
|
977
|
+
}
|
|
978
|
+
/** From `testConnection()` — discovers the source's manifest live and persists it as the new display cache. */
|
|
979
|
+
interface PersonaRcpSourceTestResult {
|
|
980
|
+
tools: PersonaRcpSourceToolSummary[];
|
|
981
|
+
}
|
|
982
|
+
interface UseRcpSourcesOptions {
|
|
983
|
+
/** @default true */
|
|
984
|
+
autoFetch?: boolean;
|
|
985
|
+
page?: number;
|
|
986
|
+
limit?: number;
|
|
987
|
+
/** Free-text match against name. */
|
|
988
|
+
search?: string;
|
|
989
|
+
}
|
|
990
|
+
/** One uploaded source document's chunking summary (not the chunks themselves). */
|
|
991
|
+
interface PersonaKnowledgeDocument {
|
|
992
|
+
fileName: string;
|
|
993
|
+
fileSize: number;
|
|
994
|
+
mimeType: string;
|
|
995
|
+
chunkCount: number;
|
|
996
|
+
uploadedAt: string;
|
|
997
|
+
}
|
|
998
|
+
interface PersonaKnowledgeBase {
|
|
999
|
+
_id: string;
|
|
1000
|
+
domain: string;
|
|
1001
|
+
ownerType: "PersonaUser" | "Project" | "ExternalUser";
|
|
1002
|
+
ownerId?: string;
|
|
1003
|
+
externalOwnerId?: string;
|
|
1004
|
+
name: string;
|
|
1005
|
+
description?: string;
|
|
1006
|
+
isPublic: boolean;
|
|
1007
|
+
documentCount: number;
|
|
1008
|
+
chunkCount: number;
|
|
1009
|
+
/** Internal vector-store collection name backing this Knowledge Base — informational only. */
|
|
1010
|
+
qdrantCollectionName: string;
|
|
1011
|
+
documents: PersonaKnowledgeDocument[];
|
|
1012
|
+
embeddingModel: string;
|
|
1013
|
+
providerId?: string;
|
|
1014
|
+
/** Characters per chunk, used when splitting uploaded documents. */
|
|
1015
|
+
chunkSize: number;
|
|
1016
|
+
/** Character overlap between adjacent chunks. */
|
|
1017
|
+
chunkOverlap: number;
|
|
1018
|
+
/** Default number of chunks returned per `search()` call when the caller doesn't override `topK`. */
|
|
1019
|
+
topK: number;
|
|
1020
|
+
createdAt: string;
|
|
1021
|
+
updatedAt: string;
|
|
1022
|
+
}
|
|
1023
|
+
interface CreatePersonaKnowledgeBaseInput {
|
|
1024
|
+
name: string;
|
|
1025
|
+
description?: string;
|
|
1026
|
+
/** @default false */
|
|
1027
|
+
isPublic?: boolean;
|
|
1028
|
+
/** @default 'text-embedding-3-small' */
|
|
1029
|
+
embeddingModel?: string;
|
|
1030
|
+
/** Must reference a Provider the host Project already created. */
|
|
1031
|
+
providerId: string;
|
|
1032
|
+
/** @default 800 */
|
|
1033
|
+
chunkSize?: number;
|
|
1034
|
+
/** @default 100 */
|
|
1035
|
+
chunkOverlap?: number;
|
|
1036
|
+
/** @default 5 */
|
|
1037
|
+
topK?: number;
|
|
1038
|
+
}
|
|
1039
|
+
/** All fields optional — only what you pass is changed. Does not retroactively re-embed existing documents. */
|
|
1040
|
+
interface UpdatePersonaKnowledgeBaseInput {
|
|
1041
|
+
name?: string;
|
|
1042
|
+
description?: string;
|
|
1043
|
+
isPublic?: boolean;
|
|
1044
|
+
embeddingModel?: string;
|
|
1045
|
+
providerId?: string;
|
|
1046
|
+
chunkSize?: number;
|
|
1047
|
+
chunkOverlap?: number;
|
|
1048
|
+
topK?: number;
|
|
1049
|
+
}
|
|
1050
|
+
interface PersonaUploadDocumentsResult {
|
|
1051
|
+
/** Total document count for the Knowledge Base after this upload (not just this call's files). */
|
|
1052
|
+
documentCount: number;
|
|
1053
|
+
/** Total chunk count for the Knowledge Base after this upload. */
|
|
1054
|
+
chunkCount: number;
|
|
1055
|
+
files: Array<{
|
|
1056
|
+
fileName: string;
|
|
1057
|
+
fileSize: number;
|
|
1058
|
+
mimeType: string;
|
|
1059
|
+
chunkCount: number;
|
|
1060
|
+
}>;
|
|
1061
|
+
}
|
|
1062
|
+
interface PersonaDeleteDocumentResult {
|
|
1063
|
+
removedChunks: number;
|
|
1064
|
+
remainingDocuments: number;
|
|
1065
|
+
remainingChunks: number;
|
|
1066
|
+
}
|
|
1067
|
+
interface PersonaKnowledgeSearchResult {
|
|
1068
|
+
text: string;
|
|
1069
|
+
/** The `fileName` of the source document this chunk came from. */
|
|
1070
|
+
source: string;
|
|
1071
|
+
/** Similarity score (higher is more relevant); `null` if the underlying store didn't return one. */
|
|
1072
|
+
score: number | null;
|
|
1073
|
+
}
|
|
1074
|
+
/** Agents referencing a Knowledge Base — check before deleting it to avoid a blocked-delete error. */
|
|
1075
|
+
interface PersonaKnowledgeBaseUsage {
|
|
1076
|
+
agentCount: number;
|
|
1077
|
+
agents: Array<{
|
|
1078
|
+
_id: string;
|
|
1079
|
+
name: string;
|
|
1080
|
+
}>;
|
|
1081
|
+
}
|
|
1082
|
+
interface UseKnowledgeBasesOptions {
|
|
1083
|
+
/** @default true */
|
|
1084
|
+
autoFetch?: boolean;
|
|
1085
|
+
page?: number;
|
|
1086
|
+
limit?: number;
|
|
1087
|
+
/** Free-text match against name/description. */
|
|
1088
|
+
search?: string;
|
|
1089
|
+
/** Restricts to the asserted external user's own Knowledge Bases. Requires a `ProjectRuntimeContext` — a no-op otherwise. */
|
|
1090
|
+
scope?: "mine";
|
|
1091
|
+
}
|
|
1092
|
+
type PersonaMcpTransport = "http" | "sse";
|
|
1093
|
+
type PersonaMcpAuthType = "none" | "oauth" | "apiKey";
|
|
1094
|
+
/** `owner`: one shared connection for the whole MCP. `user`: each external user connects their own. */
|
|
1095
|
+
type PersonaMcpAuthMode = "owner" | "user";
|
|
1096
|
+
interface PersonaMcpTool {
|
|
1097
|
+
name: string;
|
|
1098
|
+
description: string;
|
|
1099
|
+
}
|
|
1100
|
+
interface PersonaMcpResourceSummary {
|
|
1101
|
+
uri: string;
|
|
1102
|
+
name: string;
|
|
1103
|
+
description: string;
|
|
1104
|
+
mimeType: string;
|
|
1105
|
+
}
|
|
1106
|
+
/** A resource whose `uri` has placeholder params to fill before calling `readResource()`. */
|
|
1107
|
+
interface PersonaMcpResourceTemplate {
|
|
1108
|
+
uriTemplate: string;
|
|
1109
|
+
name: string;
|
|
1110
|
+
description: string;
|
|
1111
|
+
mimeType: string;
|
|
1112
|
+
toolName: string;
|
|
1113
|
+
}
|
|
1114
|
+
interface PersonaMcpOAuthConfig {
|
|
1115
|
+
clientId: string | null;
|
|
1116
|
+
hasClientSecret: boolean;
|
|
1117
|
+
authorizationEndpoint: string | null;
|
|
1118
|
+
tokenEndpoint: string | null;
|
|
1119
|
+
scopes: string[];
|
|
1120
|
+
dynamicallyRegistered: boolean;
|
|
1121
|
+
/** Whether this MCP's owner has completed the owner-mode OAuth flow. */
|
|
1122
|
+
ownerConnected: boolean;
|
|
1123
|
+
}
|
|
1124
|
+
/** Your own MCP server connection — a self-serve tool endpoint you registered, not one of the Project's shared ones (see `useMcp`/`useMcpConnections` for those). */
|
|
1125
|
+
interface PersonaMcp {
|
|
1126
|
+
_id: string;
|
|
1127
|
+
domain: string;
|
|
1128
|
+
ownerType: "PersonaUser" | "Project" | "ExternalUser";
|
|
1129
|
+
ownerId?: string;
|
|
1130
|
+
externalOwnerId?: string;
|
|
1131
|
+
name: string;
|
|
1132
|
+
description?: string;
|
|
1133
|
+
transport: PersonaMcpTransport;
|
|
1134
|
+
url: string;
|
|
1135
|
+
authType: PersonaMcpAuthType;
|
|
1136
|
+
authMode: PersonaMcpAuthMode;
|
|
1137
|
+
hasApiKey: boolean;
|
|
1138
|
+
oauth?: PersonaMcpOAuthConfig;
|
|
1139
|
+
isEnabled: boolean;
|
|
1140
|
+
/** Populated by `testConnection()`; empty until it's been called at least once. */
|
|
1141
|
+
tools: PersonaMcpTool[];
|
|
1142
|
+
resources: PersonaMcpResourceSummary[];
|
|
1143
|
+
resourceTemplates: PersonaMcpResourceTemplate[];
|
|
1144
|
+
createdAt: string;
|
|
1145
|
+
updatedAt: string;
|
|
1146
|
+
}
|
|
1147
|
+
interface PersonaMcpOAuthInput {
|
|
1148
|
+
clientId: string;
|
|
1149
|
+
clientSecret: string;
|
|
1150
|
+
scopes?: string[];
|
|
1151
|
+
}
|
|
1152
|
+
interface CreatePersonaMcpInput {
|
|
1153
|
+
name: string;
|
|
1154
|
+
transport: PersonaMcpTransport;
|
|
1155
|
+
url: string;
|
|
1156
|
+
description?: string;
|
|
1157
|
+
/** @default 'none' */
|
|
1158
|
+
authType?: PersonaMcpAuthType;
|
|
1159
|
+
/** @default 'owner' */
|
|
1160
|
+
authMode?: PersonaMcpAuthMode;
|
|
1161
|
+
/** Required when `authType: 'oauth'` and `useDynamicRegistration` isn't set. */
|
|
1162
|
+
oauth?: PersonaMcpOAuthInput;
|
|
1163
|
+
/** Required when `authType: 'apiKey'`. */
|
|
1164
|
+
apiKey?: string;
|
|
1165
|
+
/** Use RFC 7591 Dynamic Client Registration instead of a manually-configured `oauth` block. @default false */
|
|
1166
|
+
useDynamicRegistration?: boolean;
|
|
1167
|
+
/** @default true */
|
|
1168
|
+
isEnabled?: boolean;
|
|
1169
|
+
}
|
|
1170
|
+
/** All fields optional — only what you pass is changed. */
|
|
1171
|
+
interface UpdatePersonaMcpInput {
|
|
1172
|
+
name?: string;
|
|
1173
|
+
description?: string;
|
|
1174
|
+
transport?: PersonaMcpTransport;
|
|
1175
|
+
url?: string;
|
|
1176
|
+
authType?: PersonaMcpAuthType;
|
|
1177
|
+
authMode?: PersonaMcpAuthMode;
|
|
1178
|
+
isEnabled?: boolean;
|
|
1179
|
+
useDynamicRegistration?: boolean;
|
|
1180
|
+
oauth?: Partial<PersonaMcpOAuthInput>;
|
|
1181
|
+
/** Replaces the stored key entirely; omit to leave the existing key untouched. */
|
|
1182
|
+
apiKey?: string;
|
|
1183
|
+
}
|
|
1184
|
+
interface PersonaMcpTestConnectionResult {
|
|
1185
|
+
tools: PersonaMcpTool[];
|
|
1186
|
+
resources: PersonaMcpResourceSummary[];
|
|
1187
|
+
resourceTemplates: PersonaMcpResourceTemplate[];
|
|
1188
|
+
}
|
|
1189
|
+
interface UseMcpAdminOptions {
|
|
1190
|
+
/** @default true */
|
|
1191
|
+
autoFetch?: boolean;
|
|
1192
|
+
page?: number;
|
|
1193
|
+
limit?: number;
|
|
1194
|
+
/** Free-text match against name/description. */
|
|
1195
|
+
search?: string;
|
|
1196
|
+
}
|
|
623
1197
|
|
|
624
1198
|
interface PersonaContextValue {
|
|
625
1199
|
baseUrl: string;
|
|
@@ -803,19 +1377,31 @@ declare function useFiles(autoFetch?: boolean): {
|
|
|
803
1377
|
getDownloadUrl: (fileId: string) => string;
|
|
804
1378
|
};
|
|
805
1379
|
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
1380
|
+
/**
|
|
1381
|
+
* Read-only discovery (`agents`) is always on. Create/update/delete/
|
|
1382
|
+
* bulk-delete/getAgent require the host's `createPersonaHandler`/
|
|
1383
|
+
* `createRuntime` to opt in with `capabilities: { agentsWrite: true }` —
|
|
1384
|
+
* every write route this hook calls 404s/is unreachable otherwise
|
|
1385
|
+
* (provisioning Agents is Project-level work the host must deliberately
|
|
1386
|
+
* turn on, not something a chat session gets by default).
|
|
1387
|
+
*
|
|
1388
|
+
* Ownership follows the same self-serve model as `useSkills`/`useWorkflows`:
|
|
1389
|
+
* pass `scope: 'mine'` to restrict `agents` to the asserted external user's
|
|
1390
|
+
* own Agents (only meaningful when `PersonaProvider` is wired through an
|
|
1391
|
+
* adapter that resolves a real end-user identity) — omit it to see every
|
|
1392
|
+
* Agent visible to this Project.
|
|
1393
|
+
*/
|
|
1394
|
+
declare function useAgents(options?: UseAgentsOptions | boolean): {
|
|
1395
|
+
agents: PersonaAgent[];
|
|
1396
|
+
pagination: PersonaPagination;
|
|
816
1397
|
isLoading: boolean;
|
|
817
1398
|
error: Error | null;
|
|
818
|
-
refetch: () => Promise<
|
|
1399
|
+
refetch: () => Promise<PersonaAgent[]>;
|
|
1400
|
+
getAgent: (agentId: string) => Promise<PersonaAgent>;
|
|
1401
|
+
createAgent: (input: CreatePersonaAgentInput) => Promise<PersonaAgent>;
|
|
1402
|
+
updateAgent: (agentId: string, input: UpdatePersonaAgentInput) => Promise<PersonaAgent>;
|
|
1403
|
+
deleteAgent: (agentId: string) => Promise<void>;
|
|
1404
|
+
bulkDeleteAgents: (ids: string[]) => Promise<PersonaBulkDeleteResult>;
|
|
819
1405
|
};
|
|
820
1406
|
|
|
821
1407
|
interface PersonaHealthInfo {
|
|
@@ -867,6 +1453,8 @@ declare function useMcpConnections(options?: UseMcpConnectionsOptions): {
|
|
|
867
1453
|
isLoading: boolean;
|
|
868
1454
|
error: Error | null;
|
|
869
1455
|
refetch: () => Promise<PersonaMcpConnection[]>;
|
|
1456
|
+
disconnect: (mcpId: string) => Promise<void>;
|
|
1457
|
+
isDisconnecting: boolean;
|
|
870
1458
|
};
|
|
871
1459
|
|
|
872
1460
|
interface UseMcpOptions {
|
|
@@ -882,39 +1470,195 @@ declare function useMcp(options?: UseMcpOptions): {
|
|
|
882
1470
|
callTool: (name: string, args?: Record<string, unknown>, mcpId?: string) => Promise<any>;
|
|
883
1471
|
};
|
|
884
1472
|
|
|
1473
|
+
/**
|
|
1474
|
+
* CRUD for Skills — a reusable instruction + optional file bundle an Agent
|
|
1475
|
+
* can be given. Requires the host's `createPersonaHandler`/`createRuntime`
|
|
1476
|
+
* to opt in with `capabilities: { skills: true }`; every route this hook
|
|
1477
|
+
* calls 404s/is unreachable otherwise (skill authoring is Project-level
|
|
1478
|
+
* content management the host must deliberately turn on, not something a
|
|
1479
|
+
* chat session gets by default).
|
|
1480
|
+
*
|
|
1481
|
+
* Ownership follows the same self-serve model as `useAgents`/`useWorkflows`:
|
|
1482
|
+
* pass `scope: 'mine'` to restrict `skills` to the asserted external user's
|
|
1483
|
+
* own Skills (only meaningful when `PersonaProvider` is wired through an
|
|
1484
|
+
* adapter that resolves a real end-user identity) — omit it to see every
|
|
1485
|
+
* Skill visible to this Project (its own, plus public ones).
|
|
1486
|
+
*/
|
|
1487
|
+
declare function useSkills(options?: UseSkillsOptions): {
|
|
1488
|
+
skills: PersonaSkill[];
|
|
1489
|
+
pagination: PersonaPagination;
|
|
1490
|
+
isLoading: boolean;
|
|
1491
|
+
error: Error | null;
|
|
1492
|
+
refetch: () => Promise<PersonaSkill[]>;
|
|
1493
|
+
getSkill: (skillId: string) => Promise<PersonaSkill>;
|
|
1494
|
+
createSkill: (input: CreatePersonaSkillInput) => Promise<PersonaSkill>;
|
|
1495
|
+
updateSkill: (skillId: string, input: UpdatePersonaSkillInput) => Promise<PersonaSkill>;
|
|
1496
|
+
deleteSkill: (skillId: string) => Promise<void>;
|
|
1497
|
+
bulkDeleteSkills: (ids: string[]) => Promise<PersonaBulkDeleteResult>;
|
|
1498
|
+
getSkillUsage: (skillId: string) => Promise<PersonaSkillUsage>;
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1501
|
+
interface PersonaResourceUsage {
|
|
1502
|
+
/** The real total — `agents` below is a preview capped at 20. */
|
|
1503
|
+
agentCount: number;
|
|
1504
|
+
agents: Array<{
|
|
1505
|
+
_id: string;
|
|
1506
|
+
name: string;
|
|
1507
|
+
}>;
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* CRUD for RCP (REST Connector Protocol, npm `rcp-sdk`) sources — a hosted
|
|
1511
|
+
* manifest URL Persona discovers tools from live on every Agent run.
|
|
1512
|
+
* Requires the host's `createPersonaHandler`/`createRuntime` to opt in with
|
|
1513
|
+
* `capabilities: { rcpSources: true }`; every route this hook calls
|
|
1514
|
+
* 404s/is unreachable otherwise.
|
|
1515
|
+
*
|
|
1516
|
+
* Ownership follows the same self-serve model as `useSkills`/`useAgents`:
|
|
1517
|
+
* an RCP source can be owned by the Project or by the asserted external
|
|
1518
|
+
* user — but unlike Skills there's no `isPublic` concept here, so
|
|
1519
|
+
* `getRcpSource`/list only ever return sources the calling identity
|
|
1520
|
+
* actually owns (no server-side `scope: 'mine'` filter needed or
|
|
1521
|
+
* supported — every visible source already is "mine").
|
|
1522
|
+
*/
|
|
1523
|
+
declare function useRcpSources(options?: UseRcpSourcesOptions): {
|
|
1524
|
+
rcpSources: PersonaRcpSource[];
|
|
1525
|
+
pagination: PersonaPagination;
|
|
1526
|
+
isLoading: boolean;
|
|
1527
|
+
error: Error | null;
|
|
1528
|
+
refetch: () => Promise<PersonaRcpSource[]>;
|
|
1529
|
+
getRcpSource: (sourceId: string) => Promise<PersonaRcpSource>;
|
|
1530
|
+
createRcpSource: (input: CreatePersonaRcpSourceInput) => Promise<PersonaRcpSource>;
|
|
1531
|
+
updateRcpSource: (sourceId: string, input: UpdatePersonaRcpSourceInput) => Promise<PersonaRcpSource>;
|
|
1532
|
+
deleteRcpSource: (sourceId: string) => Promise<void>;
|
|
1533
|
+
bulkDeleteRcpSources: (ids: string[]) => Promise<PersonaBulkDeleteResult>;
|
|
1534
|
+
getRcpSourceUsage: (sourceId: string) => Promise<PersonaResourceUsage>;
|
|
1535
|
+
testRcpSourceConnection: (sourceId: string) => Promise<PersonaRcpSourceTestResult>;
|
|
1536
|
+
};
|
|
1537
|
+
|
|
1538
|
+
interface UploadKnowledgeDocumentInput {
|
|
1539
|
+
filename: string;
|
|
1540
|
+
/** Browser `File`/`Blob`, or a React Native `{ uri, name, type }`-style asset. */
|
|
1541
|
+
content: Blob | {
|
|
1542
|
+
uri: string;
|
|
1543
|
+
name?: string;
|
|
1544
|
+
type?: string;
|
|
1545
|
+
};
|
|
1546
|
+
contentType?: string;
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* CRUD for Knowledge Bases — vector-search-backed document collections an
|
|
1550
|
+
* Agent can be given. Requires the host's `createPersonaHandler`/
|
|
1551
|
+
* `createRuntime` to opt in with `capabilities: { knowledge: true }`;
|
|
1552
|
+
* every route this hook calls 404s/is unreachable otherwise.
|
|
1553
|
+
*
|
|
1554
|
+
* Ownership follows the same self-serve model as `useSkills`/`useAgents`:
|
|
1555
|
+
* pass `scope: 'mine'` to restrict `knowledgeBases` to the asserted
|
|
1556
|
+
* external user's own Knowledge Bases — omit it to see every one visible
|
|
1557
|
+
* to this Project (its own, plus public ones).
|
|
1558
|
+
*/
|
|
1559
|
+
declare function useKnowledgeBases(options?: UseKnowledgeBasesOptions): {
|
|
1560
|
+
knowledgeBases: PersonaKnowledgeBase[];
|
|
1561
|
+
pagination: PersonaPagination;
|
|
1562
|
+
isLoading: boolean;
|
|
1563
|
+
isUploading: boolean;
|
|
1564
|
+
error: Error | null;
|
|
1565
|
+
refetch: () => Promise<PersonaKnowledgeBase[]>;
|
|
1566
|
+
getKnowledgeBase: (kbId: string) => Promise<PersonaKnowledgeBase>;
|
|
1567
|
+
createKnowledgeBase: (input: CreatePersonaKnowledgeBaseInput) => Promise<PersonaKnowledgeBase>;
|
|
1568
|
+
updateKnowledgeBase: (kbId: string, input: UpdatePersonaKnowledgeBaseInput) => Promise<PersonaKnowledgeBase>;
|
|
1569
|
+
deleteKnowledgeBase: (kbId: string) => Promise<void>;
|
|
1570
|
+
bulkDeleteKnowledgeBases: (ids: string[]) => Promise<PersonaBulkDeleteResult>;
|
|
1571
|
+
getKnowledgeBaseUsage: (kbId: string) => Promise<PersonaKnowledgeBaseUsage>;
|
|
1572
|
+
uploadDocuments: (kbId: string, files: UploadKnowledgeDocumentInput[]) => Promise<PersonaUploadDocumentsResult>;
|
|
1573
|
+
listDocuments: (kbId: string) => Promise<PersonaKnowledgeDocument[]>;
|
|
1574
|
+
deleteDocument: (kbId: string, sourceName: string) => Promise<PersonaDeleteDocumentResult>;
|
|
1575
|
+
search: (kbId: string, query: string, opts?: {
|
|
1576
|
+
topK?: number;
|
|
1577
|
+
}) => Promise<PersonaKnowledgeSearchResult[]>;
|
|
1578
|
+
};
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* Self-serve CRUD for the calling end user's OWN MCP server connections —
|
|
1582
|
+
* "connect your own tool server to your agent", not the Project's shared
|
|
1583
|
+
* ones (see `useMcp` for calling tools/reading resources on an already-
|
|
1584
|
+
* attached MCP, and `useMcpConnections` for the per-user OAuth connect/
|
|
1585
|
+
* disconnect flow on a Project-configured `authMode: 'user'` MCP).
|
|
1586
|
+
*
|
|
1587
|
+
* Requires the host's `createPersonaHandler`/`createRuntime` to opt in
|
|
1588
|
+
* with `capabilities: { mcps: true }`; every route this hook calls
|
|
1589
|
+
* 404s/is unreachable otherwise.
|
|
1590
|
+
*
|
|
1591
|
+
* Deliberately narrower than `useSkills`/`useAgents`/`useKnowledgeBases`:
|
|
1592
|
+
* always operates in "mine" mode — `list()` only ever returns MCPs the
|
|
1593
|
+
* calling external user themselves registered (there's no `scope` option
|
|
1594
|
+
* to browse the Project's shared MCPs; an end user managing their own tool
|
|
1595
|
+
* connections has no reason to browse someone else's). `createMcp` always
|
|
1596
|
+
* creates as their own — ownership is resolved server-side from the
|
|
1597
|
+
* asserted external user, never something you pass in. No `getUsage` —
|
|
1598
|
+
* unlike a Skill/Agent, other people's Agents can't reference a personal
|
|
1599
|
+
* MCP only its owner can see.
|
|
1600
|
+
*/
|
|
1601
|
+
declare function useMcpAdmin(options?: UseMcpAdminOptions): {
|
|
1602
|
+
mcps: PersonaMcp[];
|
|
1603
|
+
pagination: PersonaPagination;
|
|
1604
|
+
isLoading: boolean;
|
|
1605
|
+
error: Error | null;
|
|
1606
|
+
refetch: () => Promise<PersonaMcp[]>;
|
|
1607
|
+
getMcp: (mcpId: string) => Promise<PersonaMcp>;
|
|
1608
|
+
createMcp: (input: CreatePersonaMcpInput) => Promise<PersonaMcp>;
|
|
1609
|
+
updateMcp: (mcpId: string, input: UpdatePersonaMcpInput) => Promise<PersonaMcp>;
|
|
1610
|
+
deleteMcp: (mcpId: string) => Promise<void>;
|
|
1611
|
+
bulkDeleteMcps: (ids: string[]) => Promise<PersonaBulkDeleteResult>;
|
|
1612
|
+
testConnection: (mcpId: string) => Promise<PersonaMcpTestConnectionResult>;
|
|
1613
|
+
};
|
|
1614
|
+
|
|
885
1615
|
interface WorkflowsPagination {
|
|
886
1616
|
page: number;
|
|
887
1617
|
limit: number;
|
|
888
1618
|
total: number;
|
|
889
1619
|
totalPages: number;
|
|
890
1620
|
}
|
|
1621
|
+
/**
|
|
1622
|
+
* Read-only discovery (`workflows`) is always on. `createWorkflow` requires
|
|
1623
|
+
* the host's `createPersonaHandler`/`createRuntime` to opt in with
|
|
1624
|
+
* `capabilities: { workflowsWrite: true }` — otherwise that one route
|
|
1625
|
+
* 404s/is unreachable (authoring workflows is Project-admin/builder work,
|
|
1626
|
+
* not something an ordinary end-user session does by default).
|
|
1627
|
+
*/
|
|
891
1628
|
declare function useWorkflows(options?: UseWorkflowsOptions | boolean): {
|
|
892
|
-
workflows:
|
|
1629
|
+
workflows: PersonaWorkflow[];
|
|
893
1630
|
pagination: WorkflowsPagination;
|
|
894
1631
|
isLoading: boolean;
|
|
895
1632
|
error: Error | null;
|
|
896
|
-
refetch: () => Promise<
|
|
897
|
-
createWorkflow: (input:
|
|
1633
|
+
refetch: () => Promise<PersonaWorkflow[]>;
|
|
1634
|
+
createWorkflow: (input: CreatePersonaWorkflowInput) => Promise<PersonaWorkflow>;
|
|
898
1635
|
};
|
|
899
1636
|
|
|
1637
|
+
/**
|
|
1638
|
+
* Single-workflow read + the full `capabilities.workflowsWrite`-gated
|
|
1639
|
+
* authoring surface: metadata update, draft autosave, publish, version
|
|
1640
|
+
* history, and Mermaid export.
|
|
1641
|
+
*/
|
|
900
1642
|
declare function useWorkflow(workflowId: string, options?: UseWorkflowOptions | boolean): {
|
|
901
1643
|
workflow: PersonaWorkflow | null;
|
|
902
|
-
versions:
|
|
1644
|
+
versions: PersonaWorkflowVersion[];
|
|
903
1645
|
mermaid: string | null;
|
|
904
1646
|
isLoading: boolean;
|
|
905
1647
|
error: Error | null;
|
|
906
1648
|
refetch: () => Promise<PersonaWorkflow | null>;
|
|
907
|
-
fetchVersions: () => Promise<
|
|
1649
|
+
fetchVersions: () => Promise<PersonaWorkflowVersion[]>;
|
|
1650
|
+
getVersion: (version: number) => Promise<PersonaWorkflowVersion>;
|
|
908
1651
|
fetchMermaid: () => Promise<any>;
|
|
1652
|
+
updateWorkflow: (input: UpdatePersonaWorkflowInput) => Promise<PersonaWorkflow>;
|
|
909
1653
|
saveDraft: (draft: PersonaWorkflowDraft) => Promise<PersonaWorkflow>;
|
|
910
|
-
publish: (
|
|
1654
|
+
publish: () => Promise<PersonaWorkflowVersion>;
|
|
911
1655
|
deleteWorkflow: () => Promise<void>;
|
|
912
1656
|
};
|
|
913
1657
|
|
|
914
1658
|
declare function useWorkflowStream(workflowId?: string, options?: UseWorkflowStreamOptions): UseWorkflowStreamResult;
|
|
915
1659
|
|
|
916
1660
|
declare function useWorkflowRuns(workflowId?: string, options?: UseWorkflowRunsOptions | boolean): {
|
|
917
|
-
runs:
|
|
1661
|
+
runs: PersonaWorkflowRun[];
|
|
918
1662
|
pagination: {
|
|
919
1663
|
page: number;
|
|
920
1664
|
limit: number;
|
|
@@ -923,8 +1667,8 @@ declare function useWorkflowRuns(workflowId?: string, options?: UseWorkflowRunsO
|
|
|
923
1667
|
};
|
|
924
1668
|
isLoading: boolean;
|
|
925
1669
|
error: Error | null;
|
|
926
|
-
refetch: () => Promise<
|
|
927
|
-
getRun: (runId: string) => Promise<
|
|
1670
|
+
refetch: () => Promise<PersonaWorkflowRun[]>;
|
|
1671
|
+
getRun: (runId: string) => Promise<PersonaWorkflowRun>;
|
|
928
1672
|
cancelRun: (runId: string) => Promise<void>;
|
|
929
1673
|
};
|
|
930
1674
|
|
|
@@ -987,4 +1731,4 @@ declare function openSSEStream(opts: OpenSSEOptions): Promise<SSEStream>;
|
|
|
987
1731
|
|
|
988
1732
|
declare const VERSION = "0.10.0";
|
|
989
1733
|
|
|
990
|
-
export { ARCHITECT_AGENT_ID, type
|
|
1734
|
+
export { ARCHITECT_AGENT_ID, type CreatePersonaAgentInput, type CreatePersonaKnowledgeBaseInput, type CreatePersonaMcpInput, type CreatePersonaRcpSourceInput, type CreatePersonaSkillInput, type CreatePersonaWorkflowInput, type OpenSSEOptions, type PersonaAgent, type PersonaAgentCategory, type PersonaAgentSnapshot, type PersonaAgentSocialLinks, type PersonaAgentVisibility, type PersonaBulkDeleteResult, type PersonaClarificationQuestion, type PersonaDeleteDocumentResult, type PersonaFileItem, type PersonaHealthInfo, type PersonaHitlActionRequest, type PersonaInterrupt, type PersonaKnowledgeBase, type PersonaKnowledgeBaseUsage, type PersonaKnowledgeDocument, type PersonaKnowledgeSearchResult, type PersonaMcp, type PersonaMcpAuthMode, type PersonaMcpAuthType, type PersonaMcpConnection, type PersonaMcpOAuthConfig, type PersonaMcpOAuthInput, type PersonaMcpResourceSummary, type PersonaMcpResourceTemplate, type PersonaMcpTestConnectionResult, type PersonaMcpTool, type PersonaMcpTransport, type PersonaMemoryAgentGroup, type PersonaMemoryFile, type PersonaMemoryList, type PersonaMessage, type PersonaNodeOnErrorAction, type PersonaNodeRetryPolicy, type PersonaNodeRun, type PersonaNodeRunState, type PersonaNodeRunStatus, type PersonaPagination, type PersonaPresentedFile, PersonaProvider, type PersonaProviderProps, type PersonaRcpParamContextMapEntry, type PersonaRcpSource, type PersonaRcpSourceTestResult, type PersonaRcpSourceToolParamSummary, type PersonaRcpSourceToolSummary, type PersonaResourceUsage, type PersonaResumeValue, type PersonaRole, type PersonaSandboxCommand, type PersonaSkill, type PersonaSkillFile, type PersonaSkillUsage, type PersonaStreamingEvent, type PersonaSubagentActivityEntry, type PersonaThread, type PersonaTodo, type PersonaToolCall, type PersonaUploadDocumentsResult, type PersonaVoiceEndReason, type PersonaVoiceState, type PersonaVoiceToolCall, type PersonaVoiceTranscriptLine, type PersonaWorkflow, type PersonaWorkflowDraft, type PersonaWorkflowEdge, type PersonaWorkflowNode, type PersonaWorkflowNodeData, type PersonaWorkflowNodeType, type PersonaWorkflowOwnerType, type PersonaWorkflowRun, type PersonaWorkflowRunStatus, type PersonaWorkflowTrigger, type PersonaWorkflowTriggerType, type PersonaWorkflowUsage, type PersonaWorkflowVersion, type PersonaWorkflowVisibility, type PersonaWorkspaceFile, type SSEReader, type SSEStream, type SendArchitectMessageOverride, type SendMessageOverride, type UpdatePersonaAgentInput, type UpdatePersonaKnowledgeBaseInput, type UpdatePersonaMcpInput, type UpdatePersonaRcpSourceInput, type UpdatePersonaSkillInput, type UpdatePersonaWorkflowInput, type UploadKnowledgeDocumentInput, type UseAgentsOptions, type UseArchitectChatOptions, type UseChatOptions, type UseKnowledgeBasesOptions, type UseMcpAdminOptions, type UseMcpConnectionsOptions, type UseMcpOptions, type UseRcpSourcesOptions, type UseSkillsOptions, type UseVoiceOptions, type UseVoiceResult, type UseWorkflowOptions, type UseWorkflowRunsOptions, type UseWorkflowStreamOptions, type UseWorkflowStreamResult, type UseWorkflowsOptions, VERSION, type WorkflowsPagination, openSSEStream, supportsStreamingFetch, useAgents, useArchitectChat, useChat, useConnection, useFiles, useKnowledgeBases, useMcp, useMcpAdmin, useMcpConnections, useMemory, usePersonaContext, useRcpSources, useSkills, useThreads, useVoice, useWorkflow, useWorkflowRuns, useWorkflowStream, useWorkflows };
|