@pnds/sdk 1.0.0 → 1.1.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/client.d.ts +49 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +136 -6
- package/dist/constants.d.ts +28 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +32 -1
- package/dist/types.d.ts +284 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +189 -6
- package/src/constants.ts +43 -1
- package/src/types.ts +337 -11
package/src/types.ts
CHANGED
|
@@ -143,18 +143,18 @@ export interface StateDeltaContent {
|
|
|
143
143
|
|
|
144
144
|
export type SystemEvent =
|
|
145
145
|
| 'chat_created'
|
|
146
|
-
| '
|
|
147
|
-
| '
|
|
146
|
+
| 'member_added'
|
|
147
|
+
| 'member_removed'
|
|
148
148
|
| 'member_role_changed'
|
|
149
149
|
| 'chat_renamed'
|
|
150
|
-
| 'chat_avatar_changed'
|
|
151
|
-
| 'agent_added'
|
|
152
|
-
| 'agent_removed';
|
|
150
|
+
| 'chat_avatar_changed';
|
|
153
151
|
|
|
154
152
|
export interface SystemContent {
|
|
155
153
|
event: SystemEvent;
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
actor_id: string;
|
|
155
|
+
actor_name: string;
|
|
156
|
+
target_id?: string;
|
|
157
|
+
target_name?: string;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
export type MessageContent =
|
|
@@ -183,6 +183,7 @@ export interface Message {
|
|
|
183
183
|
created_at: string;
|
|
184
184
|
idempotency_key: string | null;
|
|
185
185
|
agent_run_id?: string | null;
|
|
186
|
+
hints?: MessageHints | null;
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
export interface Attachment {
|
|
@@ -352,12 +353,32 @@ export interface CreateChatRequest {
|
|
|
352
353
|
member_ids: string[];
|
|
353
354
|
}
|
|
354
355
|
|
|
356
|
+
export interface MessageHints {
|
|
357
|
+
no_reply?: boolean;
|
|
358
|
+
}
|
|
359
|
+
|
|
355
360
|
export interface SendMessageRequest {
|
|
356
361
|
message_type: MessageType;
|
|
357
362
|
content: MessageContent;
|
|
358
363
|
thread_root_id?: string;
|
|
359
364
|
idempotency_key?: string;
|
|
360
365
|
agent_run_id?: string;
|
|
366
|
+
hints?: MessageHints;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export interface SendDirectMessageRequest {
|
|
370
|
+
user_id: string;
|
|
371
|
+
message_type: MessageType;
|
|
372
|
+
content: MessageContent;
|
|
373
|
+
thread_root_id?: string;
|
|
374
|
+
idempotency_key?: string;
|
|
375
|
+
agent_run_id?: string;
|
|
376
|
+
hints?: MessageHints;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export interface DirectMessageResponse {
|
|
380
|
+
chat: Chat;
|
|
381
|
+
message: Message;
|
|
361
382
|
}
|
|
362
383
|
|
|
363
384
|
export interface PatchMessageRequest {
|
|
@@ -406,6 +427,10 @@ export interface Machine {
|
|
|
406
427
|
|
|
407
428
|
// ---- Agent enriched types ----
|
|
408
429
|
|
|
430
|
+
export interface RunConfig {
|
|
431
|
+
intermediate_text?: 'step_only' | 'chat';
|
|
432
|
+
}
|
|
433
|
+
|
|
409
434
|
export interface AgentProfile {
|
|
410
435
|
user_id: string;
|
|
411
436
|
provider: string | null;
|
|
@@ -413,12 +438,13 @@ export interface AgentProfile {
|
|
|
413
438
|
model: string | null;
|
|
414
439
|
permissions: string[];
|
|
415
440
|
machine_id: string | null;
|
|
441
|
+
run_config?: RunConfig;
|
|
416
442
|
created_by: string;
|
|
417
443
|
created_at: string;
|
|
418
444
|
}
|
|
419
445
|
|
|
420
446
|
export interface AgentRun {
|
|
421
|
-
|
|
447
|
+
target_id: string;
|
|
422
448
|
status: string;
|
|
423
449
|
started_at: string;
|
|
424
450
|
}
|
|
@@ -571,6 +597,223 @@ export interface UpdateProjectRequest {
|
|
|
571
597
|
sort_order?: number;
|
|
572
598
|
}
|
|
573
599
|
|
|
600
|
+
// ============================================================
|
|
601
|
+
// Wiki Types
|
|
602
|
+
// ============================================================
|
|
603
|
+
|
|
604
|
+
export type WikiMountMode = 'read_only' | 'read_write';
|
|
605
|
+
export type WikiChangesetStatus =
|
|
606
|
+
| 'draft'
|
|
607
|
+
| 'proposed'
|
|
608
|
+
| 'approval_pending'
|
|
609
|
+
| 'approved'
|
|
610
|
+
| 'rejected'
|
|
611
|
+
| 'merged'
|
|
612
|
+
| 'closed'
|
|
613
|
+
| 'superseded';
|
|
614
|
+
|
|
615
|
+
export type WikiRepoProvider = 'gitea';
|
|
616
|
+
export type WikiPullRequestState = 'draft' | 'open' | 'merged' | 'closed';
|
|
617
|
+
export type WikiRepoTokenScope = 'read' | 'write';
|
|
618
|
+
|
|
619
|
+
export interface Wiki {
|
|
620
|
+
id: string;
|
|
621
|
+
org_id: string;
|
|
622
|
+
slug: string;
|
|
623
|
+
name: string;
|
|
624
|
+
repo_id: string;
|
|
625
|
+
repo_owner: string;
|
|
626
|
+
repo_name: string;
|
|
627
|
+
default_branch: string;
|
|
628
|
+
created_by: string;
|
|
629
|
+
created_at: string;
|
|
630
|
+
updated_at: string;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
export interface WikiMount {
|
|
634
|
+
id: string;
|
|
635
|
+
wiki_id: string;
|
|
636
|
+
agent_id: string;
|
|
637
|
+
mount_path: string;
|
|
638
|
+
mode: WikiMountMode;
|
|
639
|
+
default_ref: string;
|
|
640
|
+
allowed_prefixes: string[];
|
|
641
|
+
created_by: string;
|
|
642
|
+
created_at: string;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export interface WikiChangeset {
|
|
646
|
+
id: string;
|
|
647
|
+
wiki_id: string;
|
|
648
|
+
base_ref: string | null;
|
|
649
|
+
base_commit: string | null;
|
|
650
|
+
head_branch: string | null;
|
|
651
|
+
head_commit: string | null;
|
|
652
|
+
title: string;
|
|
653
|
+
summary: string | null;
|
|
654
|
+
status: WikiChangesetStatus;
|
|
655
|
+
pr_number: number | null;
|
|
656
|
+
pr_url: string | null;
|
|
657
|
+
pr_state: WikiPullRequestState | null;
|
|
658
|
+
merge_commit: string | null;
|
|
659
|
+
approval_id: string | null;
|
|
660
|
+
source_chat_id: string | null;
|
|
661
|
+
source_message_id: string | null;
|
|
662
|
+
source_run_id: string | null;
|
|
663
|
+
changed_paths: string[];
|
|
664
|
+
diff_files: WikiDiffFile[];
|
|
665
|
+
patch: string | null;
|
|
666
|
+
last_error: string | null;
|
|
667
|
+
created_by: string;
|
|
668
|
+
created_at: string;
|
|
669
|
+
updated_at: string;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
export interface WikiTreeEntry {
|
|
673
|
+
name: string;
|
|
674
|
+
path: string;
|
|
675
|
+
type: 'tree' | 'blob';
|
|
676
|
+
size?: number;
|
|
677
|
+
mode: string;
|
|
678
|
+
sha: string;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
export interface WikiTreeResponse {
|
|
682
|
+
data: WikiTreeEntry[];
|
|
683
|
+
ref: string;
|
|
684
|
+
path: string;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
export interface WikiBlob {
|
|
688
|
+
path: string;
|
|
689
|
+
ref: string;
|
|
690
|
+
size: number;
|
|
691
|
+
mime_type: string;
|
|
692
|
+
is_binary: boolean;
|
|
693
|
+
encoding: string;
|
|
694
|
+
content: string;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
export interface WikiDiffFile {
|
|
698
|
+
path: string;
|
|
699
|
+
additions: number;
|
|
700
|
+
deletions: number;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export interface WikiDiff {
|
|
704
|
+
base: string;
|
|
705
|
+
head: string;
|
|
706
|
+
patch: string;
|
|
707
|
+
files: WikiDiffFile[];
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
export interface WikiRepoToken {
|
|
711
|
+
repo_id: string;
|
|
712
|
+
scope: WikiRepoTokenScope;
|
|
713
|
+
username: string;
|
|
714
|
+
token: string;
|
|
715
|
+
refresh_token?: string | null;
|
|
716
|
+
expires_at: string;
|
|
717
|
+
refresh_after?: string | null;
|
|
718
|
+
refresh_url?: string | null;
|
|
719
|
+
remote_url?: string | null;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
export interface WikiMountGitAuth {
|
|
723
|
+
username: string;
|
|
724
|
+
token: string;
|
|
725
|
+
expires_at: string;
|
|
726
|
+
refresh_url?: string | null;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export interface WikiMountManifestV2Entry {
|
|
730
|
+
wiki_id: string;
|
|
731
|
+
slug: string;
|
|
732
|
+
name: string;
|
|
733
|
+
repo_id: string;
|
|
734
|
+
repo_owner: string;
|
|
735
|
+
repo_name: string;
|
|
736
|
+
mount_path: string;
|
|
737
|
+
mode: WikiMountMode;
|
|
738
|
+
default_ref: string;
|
|
739
|
+
default_branch: string;
|
|
740
|
+
allowed_prefixes: string[];
|
|
741
|
+
clone_url: string;
|
|
742
|
+
web_url: string;
|
|
743
|
+
git_remote_url: string;
|
|
744
|
+
git_auth?: WikiMountGitAuth | null;
|
|
745
|
+
refresh_before_seconds?: number;
|
|
746
|
+
max_file_size_bytes?: number;
|
|
747
|
+
repo_token_url?: string;
|
|
748
|
+
repo_token_refresh_url?: string;
|
|
749
|
+
tree_url?: string;
|
|
750
|
+
blob_url?: string;
|
|
751
|
+
changesets_url?: string;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
export interface WikiMountManifestV2 {
|
|
755
|
+
version: number;
|
|
756
|
+
generated_at: string;
|
|
757
|
+
mounts: WikiMountManifestV2Entry[];
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
export interface CreateWikiRequest {
|
|
761
|
+
slug: string;
|
|
762
|
+
name: string;
|
|
763
|
+
default_branch?: string;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
export interface CreateWikiMountRequest {
|
|
767
|
+
agent_id: string;
|
|
768
|
+
mount_path: string;
|
|
769
|
+
mode: WikiMountMode;
|
|
770
|
+
default_ref?: string;
|
|
771
|
+
allowed_prefixes?: string[];
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
export interface CreateWikiChangesetRequest {
|
|
775
|
+
base_ref?: string;
|
|
776
|
+
base_commit?: string;
|
|
777
|
+
head_branch?: string;
|
|
778
|
+
head_commit?: string;
|
|
779
|
+
title: string;
|
|
780
|
+
summary?: string;
|
|
781
|
+
source_chat_id?: string;
|
|
782
|
+
source_message_id?: string;
|
|
783
|
+
source_run_id?: string;
|
|
784
|
+
changed_paths?: string[];
|
|
785
|
+
diff_files?: WikiDiffFile[];
|
|
786
|
+
patch?: string;
|
|
787
|
+
status?: WikiChangesetStatus;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
export interface UpdateWikiChangesetRequest {
|
|
791
|
+
base_ref?: string;
|
|
792
|
+
base_commit?: string;
|
|
793
|
+
head_branch?: string;
|
|
794
|
+
head_commit?: string;
|
|
795
|
+
title: string;
|
|
796
|
+
summary?: string;
|
|
797
|
+
source_chat_id?: string;
|
|
798
|
+
source_message_id?: string;
|
|
799
|
+
source_run_id?: string;
|
|
800
|
+
changed_paths?: string[];
|
|
801
|
+
diff_files?: WikiDiffFile[];
|
|
802
|
+
patch?: string;
|
|
803
|
+
status?: WikiChangesetStatus;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
export interface MintWikiRepoTokenRequest {
|
|
807
|
+
wiki_id: string;
|
|
808
|
+
scope: WikiRepoTokenScope;
|
|
809
|
+
expires_in_seconds?: number;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
export interface RefreshWikiRepoTokenRequest {
|
|
813
|
+
wiki_id: string;
|
|
814
|
+
refresh_token: string;
|
|
815
|
+
}
|
|
816
|
+
|
|
574
817
|
// ============================================================
|
|
575
818
|
// WebSocket Event Types
|
|
576
819
|
// ============================================================
|
|
@@ -604,6 +847,7 @@ export interface MessageNewData {
|
|
|
604
847
|
deleted_at?: string | null;
|
|
605
848
|
idempotency_key?: string | null;
|
|
606
849
|
agent_run_id?: string | null;
|
|
850
|
+
hints?: MessageHints | null;
|
|
607
851
|
}
|
|
608
852
|
|
|
609
853
|
export interface MessagePatchData {
|
|
@@ -632,6 +876,8 @@ export interface TypingUpdateData {
|
|
|
632
876
|
action: 'start' | 'stop';
|
|
633
877
|
}
|
|
634
878
|
|
|
879
|
+
export interface ChatCreatedData extends Chat {}
|
|
880
|
+
|
|
635
881
|
export interface ChatUpdateData {
|
|
636
882
|
chat_id: string;
|
|
637
883
|
changes: Partial<Pick<Chat, 'name' | 'avatar_url' | 'description' | 'last_message_at' | 'last_message_preview' | 'last_message_sender'>>;
|
|
@@ -673,6 +919,8 @@ export interface TaskComment {
|
|
|
673
919
|
task_id: string;
|
|
674
920
|
author_id: string;
|
|
675
921
|
body: string;
|
|
922
|
+
mentions?: Mention[];
|
|
923
|
+
agent_run_id?: string | null;
|
|
676
924
|
created_at: string;
|
|
677
925
|
updated_at: string;
|
|
678
926
|
author?: User;
|
|
@@ -728,10 +976,11 @@ export interface AgentRunDB {
|
|
|
728
976
|
id: string;
|
|
729
977
|
agent_id: string;
|
|
730
978
|
org_id: string;
|
|
731
|
-
chat_id: string | null;
|
|
732
979
|
status: string;
|
|
733
980
|
trigger_type: string;
|
|
734
981
|
trigger_ref: Record<string, unknown> | null;
|
|
982
|
+
default_target_type: string;
|
|
983
|
+
default_target_id: string | null;
|
|
735
984
|
started_at: string;
|
|
736
985
|
finished_at: string | null;
|
|
737
986
|
created_at: string;
|
|
@@ -742,22 +991,29 @@ export interface AgentStep {
|
|
|
742
991
|
run_id: string;
|
|
743
992
|
step_type: string;
|
|
744
993
|
content: Record<string, unknown>;
|
|
994
|
+
idempotency_key?: string;
|
|
745
995
|
created_at: string;
|
|
746
996
|
}
|
|
747
997
|
|
|
748
998
|
export interface CreateAgentRunRequest {
|
|
749
999
|
trigger_type: string;
|
|
750
1000
|
trigger_ref?: Record<string, unknown>;
|
|
751
|
-
chat_id?: string;
|
|
1001
|
+
chat_id?: string; // backward compat alias for default_target_type=chat
|
|
1002
|
+
default_target_type?: string;
|
|
1003
|
+
default_target_id?: string;
|
|
752
1004
|
}
|
|
753
1005
|
|
|
754
1006
|
export interface CreateAgentStepRequest {
|
|
755
1007
|
step_type: string;
|
|
756
1008
|
content: Record<string, unknown>;
|
|
1009
|
+
idempotency_key?: string;
|
|
1010
|
+
projection?: boolean;
|
|
1011
|
+
chat_projection?: boolean; // backward compat alias for projection
|
|
757
1012
|
}
|
|
758
1013
|
|
|
759
1014
|
export interface UpdateAgentRunRequest {
|
|
760
1015
|
status: string;
|
|
1016
|
+
emit_fallback_message?: boolean;
|
|
761
1017
|
}
|
|
762
1018
|
|
|
763
1019
|
// Agent run WS event data
|
|
@@ -770,7 +1026,64 @@ export interface AgentRunUpdateData {
|
|
|
770
1026
|
}
|
|
771
1027
|
|
|
772
1028
|
export interface AgentStepNewData extends AgentStep {
|
|
773
|
-
|
|
1029
|
+
target_type?: string;
|
|
1030
|
+
target_id?: string;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
export type WikiChangesetCreatedData = WikiChangeset & { org_id: string };
|
|
1034
|
+
export type WikiChangesetUpdatedData = WikiChangeset & { org_id: string };
|
|
1035
|
+
|
|
1036
|
+
// ============================================================
|
|
1037
|
+
// Inbox Types
|
|
1038
|
+
// ============================================================
|
|
1039
|
+
|
|
1040
|
+
export type InboxItemType =
|
|
1041
|
+
| 'mention' | 'task_assign' | 'task_update'
|
|
1042
|
+
| 'task_comment' | 'approval_request'
|
|
1043
|
+
| 'agent_alert' | 'invitation';
|
|
1044
|
+
|
|
1045
|
+
export type InboxItemReason =
|
|
1046
|
+
| 'assigned' | 'mentioned' | 'authored'
|
|
1047
|
+
| 'subscribed' | 'approval_requested';
|
|
1048
|
+
|
|
1049
|
+
export interface InboxItem {
|
|
1050
|
+
id: string;
|
|
1051
|
+
org_id: string;
|
|
1052
|
+
recipient_id: string;
|
|
1053
|
+
actor_id: string | null;
|
|
1054
|
+
type: InboxItemType;
|
|
1055
|
+
reason: InboxItemReason;
|
|
1056
|
+
entity_type: string;
|
|
1057
|
+
entity_id: string;
|
|
1058
|
+
group_key: string;
|
|
1059
|
+
source_type: string;
|
|
1060
|
+
source_id: string;
|
|
1061
|
+
chat_id: string | null;
|
|
1062
|
+
task_id: string | null;
|
|
1063
|
+
title: string;
|
|
1064
|
+
body: string;
|
|
1065
|
+
read_at: string | null;
|
|
1066
|
+
archived_at: string | null;
|
|
1067
|
+
snoozed_until: string | null;
|
|
1068
|
+
created_at: string;
|
|
1069
|
+
updated_at: string;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
export type NotificationNewData = InboxItem;
|
|
1073
|
+
|
|
1074
|
+
export interface NotificationUpdateData {
|
|
1075
|
+
id: string;
|
|
1076
|
+
read_at?: string | null;
|
|
1077
|
+
archived_at?: string | null;
|
|
1078
|
+
snoozed_until?: string | null;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
export interface NotificationBulkUpdateData {
|
|
1082
|
+
action: 'mark_all_read' | 'archive_all';
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
export interface InboxUnreadCountResponse {
|
|
1086
|
+
count: number;
|
|
774
1087
|
}
|
|
775
1088
|
|
|
776
1089
|
export type WsEventMap = {
|
|
@@ -780,6 +1093,7 @@ export type WsEventMap = {
|
|
|
780
1093
|
'message.edit': MessageEditData;
|
|
781
1094
|
'message.delete': MessageDeleteData;
|
|
782
1095
|
'typing.update': TypingUpdateData;
|
|
1096
|
+
'chat.created': ChatCreatedData;
|
|
783
1097
|
'chat.update': ChatUpdateData;
|
|
784
1098
|
'approval.update': ApprovalUpdateData; // deprecated, kept for backward compat
|
|
785
1099
|
'card.update': CardUpdateData;
|
|
@@ -803,6 +1117,12 @@ export type WsEventMap = {
|
|
|
803
1117
|
'invitation.accepted': InvitationAcceptedEventData;
|
|
804
1118
|
'invitation.declined': InvitationDeclinedEventData;
|
|
805
1119
|
'agent_config.update': AgentConfigUpdateData;
|
|
1120
|
+
'presence.update': PresenceUpdateData;
|
|
1121
|
+
'wiki.changeset.created': WikiChangesetCreatedData;
|
|
1122
|
+
'wiki.changeset.updated': WikiChangesetUpdatedData;
|
|
1123
|
+
'notification.new': NotificationNewData;
|
|
1124
|
+
'notification.update': NotificationUpdateData;
|
|
1125
|
+
'notification.bulk_update': NotificationBulkUpdateData;
|
|
806
1126
|
};
|
|
807
1127
|
|
|
808
1128
|
// Invitation WS event data
|
|
@@ -843,3 +1163,9 @@ export interface PlatformConfigResponse {
|
|
|
843
1163
|
export interface AgentConfigUpdateData {
|
|
844
1164
|
version: string;
|
|
845
1165
|
}
|
|
1166
|
+
|
|
1167
|
+
export interface PresenceUpdateData {
|
|
1168
|
+
org_id: string;
|
|
1169
|
+
user_id: string;
|
|
1170
|
+
status: string; // "online" | "offline" (future: "busy", "error", "away")
|
|
1171
|
+
}
|