@amaster.ai/client 1.1.0-beta.72 → 1.1.0-beta.74
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 +11 -12
- package/dist/index.cjs +23 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -29
- package/dist/index.d.ts +13 -29
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/types/__tests__/type-checks.test-d.ts +26 -8
- package/types/asr.d.ts +1 -1
- package/types/auth/code-auth.d.ts +21 -17
- package/types/auth/index.d.ts +53 -73
- package/types/auth/oauth.d.ts +137 -86
- package/types/auth/password-auth.d.ts +81 -51
- package/types/auth/permissions.d.ts +46 -0
- package/types/auth/profile.d.ts +17 -21
- package/types/auth/sessions.d.ts +83 -0
- package/types/auth/user.d.ts +65 -21
- package/types/bpm.d.ts +365 -2
- package/types/common.d.ts +23 -41
- package/types/copilot.d.ts +122 -2
- package/types/entity.d.ts +7 -7
- package/types/function.d.ts +1 -1
- package/types/http.d.ts +20 -7
- package/types/index.d.ts +72 -27
- package/types/s3.d.ts +3 -3
- package/types/tts.d.ts +150 -1
- package/types/workflow.d.ts +1 -1
package/types/bpm.d.ts
CHANGED
|
@@ -338,7 +338,7 @@ export interface HistoryTask {
|
|
|
338
338
|
* @example
|
|
339
339
|
* Complete BPM flow:
|
|
340
340
|
* ```typescript
|
|
341
|
-
|
|
341
|
+
* const client = createClient();
|
|
342
342
|
*
|
|
343
343
|
* // 1. Start a process
|
|
344
344
|
* const process = await client.bpm.startProcess('approval', {
|
|
@@ -534,7 +534,7 @@ export interface BpmClientAPI {
|
|
|
534
534
|
*
|
|
535
535
|
* @example
|
|
536
536
|
* const result = await client.bpm.getTask('task-123');
|
|
537
|
-
* if (result.
|
|
537
|
+
* if (result.data) {
|
|
538
538
|
* console.log('Task:', result.data.name);
|
|
539
539
|
* }
|
|
540
540
|
*
|
|
@@ -640,12 +640,137 @@ export interface BpmClientAPI {
|
|
|
640
640
|
params?: HistoryProcessInstanceQueryParams
|
|
641
641
|
): Promise<ClientResult<{ count: number }>>;
|
|
642
642
|
|
|
643
|
+
/**
|
|
644
|
+
* Get a single historical process instance by ID
|
|
645
|
+
*/
|
|
646
|
+
getHistoryProcessInstance(
|
|
647
|
+
processInstanceId: string
|
|
648
|
+
): Promise<ClientResult<HistoryProcessInstance>>;
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Query process variables by process instance
|
|
652
|
+
*/
|
|
653
|
+
getProcessVariables(params: {
|
|
654
|
+
processInstanceId: string;
|
|
655
|
+
variableName?: string;
|
|
656
|
+
}): Promise<ClientResult<ProcessVariable[]>>;
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Get process definition list
|
|
660
|
+
*/
|
|
661
|
+
getProcessDefinitions(
|
|
662
|
+
params?: ProcessDefinitionQueryParams
|
|
663
|
+
): Promise<ClientResult<ProcessDefinitionFull[]>>;
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Get BPMN XML for a process definition key
|
|
667
|
+
*/
|
|
668
|
+
getProcessXml(processKey: string): Promise<ClientResult<ProcessXmlResponse>>;
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Get the runtime activity instance tree for a process instance
|
|
672
|
+
*/
|
|
673
|
+
getActivityInstanceTree(
|
|
674
|
+
processInstanceId: string
|
|
675
|
+
): Promise<ClientResult<ActivityInstanceTree>>;
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Get runtime variables for a process instance
|
|
679
|
+
*/
|
|
680
|
+
getRuntimeVariables(
|
|
681
|
+
processInstanceId: string
|
|
682
|
+
): Promise<ClientResult<Record<string, { value: CamundaVariableValue; type: string }>>>;
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Delegate a task to another user
|
|
686
|
+
*/
|
|
687
|
+
delegateTask(taskId: string, userId: string): Promise<ClientResult<null>>;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Get task form metadata
|
|
691
|
+
*/
|
|
692
|
+
getTaskForm(taskId: string): Promise<ClientResult<TaskFormData>>;
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Get rendered task form HTML
|
|
696
|
+
*/
|
|
697
|
+
getTaskRenderedForm(taskId: string): Promise<ClientResult<string>>;
|
|
698
|
+
|
|
643
699
|
/**
|
|
644
700
|
* Get deployed Camunda form definition for a task
|
|
645
701
|
*/
|
|
646
702
|
getTaskDeployedForm(
|
|
647
703
|
taskId: string
|
|
648
704
|
): Promise<ClientResult<CamundaFormDefinition>>;
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Get start form metadata
|
|
708
|
+
*/
|
|
709
|
+
getStartFormInfo(processKey: string): Promise<ClientResult<StartFormInfo>>;
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Get start form variables
|
|
713
|
+
*/
|
|
714
|
+
getStartFormVariables(processKey: string): Promise<ClientResult<TaskFormVariables>>;
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Get deployed start form definition
|
|
718
|
+
*/
|
|
719
|
+
getDeployedStartForm(processKey: string): Promise<ClientResult<CamundaFormDefinition>>;
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Query historical activity instances
|
|
723
|
+
*/
|
|
724
|
+
getHistoryActivityInstances(
|
|
725
|
+
params?: HistoryActivityQueryParams
|
|
726
|
+
): Promise<ClientResult<HistoryActivityInstance[]>>;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Query historical variable instances
|
|
730
|
+
*/
|
|
731
|
+
getHistoryVariableInstances(
|
|
732
|
+
params?: HistoryVariableQueryParams
|
|
733
|
+
): Promise<ClientResult<HistoryVariableInstance[]>>;
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Query user operation logs
|
|
737
|
+
*/
|
|
738
|
+
getUserOperationLogs(
|
|
739
|
+
params?: UserOperationLogQueryParams
|
|
740
|
+
): Promise<ClientResult<UserOperationLog[]>>;
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Delete a historical process instance
|
|
744
|
+
*/
|
|
745
|
+
deleteHistoryProcessInstance(processInstanceId: string): Promise<ClientResult<null>>;
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Suspend a running process instance
|
|
749
|
+
*/
|
|
750
|
+
suspendProcessInstance(processInstanceId: string): Promise<ClientResult<null>>;
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Activate a suspended process instance
|
|
754
|
+
*/
|
|
755
|
+
activateProcessInstance(processInstanceId: string): Promise<ClientResult<null>>;
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* Modify a process instance for jump/cancel/start operations
|
|
759
|
+
*/
|
|
760
|
+
modifyProcessInstance(
|
|
761
|
+
processInstanceId: string,
|
|
762
|
+
modification: ProcessInstanceModification
|
|
763
|
+
): Promise<ClientResult<null>>;
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Get available roles in the current tenant
|
|
767
|
+
*/
|
|
768
|
+
getRoles(): Promise<ClientResult<Role[]>>;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Get roles assigned to a user
|
|
772
|
+
*/
|
|
773
|
+
getUserRoles(userId: string): Promise<ClientResult<Role[]>>;
|
|
649
774
|
}
|
|
650
775
|
|
|
651
776
|
/**
|
|
@@ -682,8 +807,12 @@ export interface HistoryProcessInstanceQueryParams {
|
|
|
682
807
|
startedBy?: string;
|
|
683
808
|
/** Filter finished/unfinished processes */
|
|
684
809
|
finished?: boolean;
|
|
810
|
+
/** Filter unfinished processes */
|
|
811
|
+
unfinished?: boolean;
|
|
685
812
|
/** Filter by process definition key */
|
|
686
813
|
processDefinitionKey?: string;
|
|
814
|
+
/** Access scope: strict "my initiated" view */
|
|
815
|
+
scope?: "initiated";
|
|
687
816
|
/** Sort field */
|
|
688
817
|
sortBy?: string;
|
|
689
818
|
/** Sort order */
|
|
@@ -706,6 +835,8 @@ export interface HistoryTaskQueryParams {
|
|
|
706
835
|
finished?: boolean;
|
|
707
836
|
/** Filter unfinished tasks */
|
|
708
837
|
unfinished?: boolean;
|
|
838
|
+
/** Access scope: strict "my handled" view */
|
|
839
|
+
scope?: "handled";
|
|
709
840
|
/** Pagination: first result index */
|
|
710
841
|
firstResult?: number;
|
|
711
842
|
/** Pagination: max results to return */
|
|
@@ -742,3 +873,235 @@ export interface CamundaFormComponent {
|
|
|
742
873
|
values?: Array<{ label: string; value: string }>;
|
|
743
874
|
properties?: Record<string, unknown>;
|
|
744
875
|
}
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* Full process definition information
|
|
879
|
+
*/
|
|
880
|
+
export interface ProcessDefinitionFull {
|
|
881
|
+
id: string;
|
|
882
|
+
key: string;
|
|
883
|
+
name: string;
|
|
884
|
+
version: number;
|
|
885
|
+
deploymentId: string;
|
|
886
|
+
resourceName: string;
|
|
887
|
+
category?: string;
|
|
888
|
+
description?: string;
|
|
889
|
+
diagram?: string;
|
|
890
|
+
suspended: boolean;
|
|
891
|
+
tenantId?: string;
|
|
892
|
+
versionTag?: string;
|
|
893
|
+
historyTimeToLive?: number;
|
|
894
|
+
startableInTasklist: boolean;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Process definition query parameters
|
|
899
|
+
*/
|
|
900
|
+
export interface ProcessDefinitionQueryParams {
|
|
901
|
+
key?: string;
|
|
902
|
+
name?: string;
|
|
903
|
+
latestVersion?: boolean;
|
|
904
|
+
active?: boolean;
|
|
905
|
+
suspended?: boolean;
|
|
906
|
+
sortBy?: string;
|
|
907
|
+
sortOrder?: 'asc' | 'desc';
|
|
908
|
+
[key: string]: string | number | boolean | undefined;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* BPMN XML response
|
|
913
|
+
*/
|
|
914
|
+
export interface ProcessXmlResponse {
|
|
915
|
+
bpmn20Xml: string;
|
|
916
|
+
processDefinitionId: string;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Runtime activity instance tree
|
|
921
|
+
*/
|
|
922
|
+
export interface ActivityInstanceTree {
|
|
923
|
+
id: string;
|
|
924
|
+
activityId: string;
|
|
925
|
+
activityName: string;
|
|
926
|
+
activityType: string;
|
|
927
|
+
processInstanceId: string;
|
|
928
|
+
processDefinitionId: string;
|
|
929
|
+
childActivityInstances: ActivityInstanceTree[];
|
|
930
|
+
childTransitionInstances: TransitionInstance[];
|
|
931
|
+
executionIds: string[];
|
|
932
|
+
incidentIds: string[];
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* Runtime transition instance
|
|
937
|
+
*/
|
|
938
|
+
export interface TransitionInstance {
|
|
939
|
+
id: string;
|
|
940
|
+
activityId: string;
|
|
941
|
+
activityName: string;
|
|
942
|
+
activityType: string;
|
|
943
|
+
processInstanceId: string;
|
|
944
|
+
processDefinitionId: string;
|
|
945
|
+
executionId: string;
|
|
946
|
+
incidentIds: string[];
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Historical activity instance
|
|
951
|
+
*/
|
|
952
|
+
export interface HistoryActivityInstance {
|
|
953
|
+
id: string;
|
|
954
|
+
activityId: string;
|
|
955
|
+
activityName: string;
|
|
956
|
+
activityType: string;
|
|
957
|
+
processDefinitionId: string;
|
|
958
|
+
processDefinitionKey: string;
|
|
959
|
+
processInstanceId: string;
|
|
960
|
+
executionId: string;
|
|
961
|
+
taskId?: string;
|
|
962
|
+
assignee?: string;
|
|
963
|
+
calledProcessInstanceId?: string;
|
|
964
|
+
calledCaseInstanceId?: string;
|
|
965
|
+
startTime: string;
|
|
966
|
+
endTime?: string;
|
|
967
|
+
durationInMillis?: number;
|
|
968
|
+
canceled: boolean;
|
|
969
|
+
completeScope: boolean;
|
|
970
|
+
tenantId?: string;
|
|
971
|
+
removalTime?: string;
|
|
972
|
+
rootProcessInstanceId: string;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* Historical activity query parameters
|
|
977
|
+
*/
|
|
978
|
+
export interface HistoryActivityQueryParams {
|
|
979
|
+
processInstanceId?: string;
|
|
980
|
+
activityId?: string;
|
|
981
|
+
activityType?: string;
|
|
982
|
+
finished?: boolean;
|
|
983
|
+
sortBy?: string;
|
|
984
|
+
sortOrder?: 'asc' | 'desc';
|
|
985
|
+
[key: string]: string | number | boolean | undefined;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* Historical variable instance
|
|
990
|
+
*/
|
|
991
|
+
export interface HistoryVariableInstance {
|
|
992
|
+
id: string;
|
|
993
|
+
name: string;
|
|
994
|
+
type: string;
|
|
995
|
+
value: CamundaVariableValue;
|
|
996
|
+
valueInfo?: Record<string, unknown>;
|
|
997
|
+
processDefinitionKey: string;
|
|
998
|
+
processDefinitionId: string;
|
|
999
|
+
processInstanceId: string;
|
|
1000
|
+
executionId: string;
|
|
1001
|
+
activityInstanceId?: string;
|
|
1002
|
+
taskId?: string;
|
|
1003
|
+
tenantId?: string;
|
|
1004
|
+
errorMessage?: string;
|
|
1005
|
+
state: string;
|
|
1006
|
+
createTime: string;
|
|
1007
|
+
removalTime?: string;
|
|
1008
|
+
rootProcessInstanceId: string;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Historical variable query parameters
|
|
1013
|
+
*/
|
|
1014
|
+
export interface HistoryVariableQueryParams {
|
|
1015
|
+
processInstanceId?: string;
|
|
1016
|
+
variableName?: string;
|
|
1017
|
+
deserializeValues?: boolean;
|
|
1018
|
+
[key: string]: string | number | boolean | undefined;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* Task form metadata
|
|
1023
|
+
*/
|
|
1024
|
+
export interface TaskFormData {
|
|
1025
|
+
key?: string;
|
|
1026
|
+
contextPath?: string;
|
|
1027
|
+
camundaFormRef?: {
|
|
1028
|
+
key: string;
|
|
1029
|
+
binding: string;
|
|
1030
|
+
version?: number;
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* Start form metadata
|
|
1036
|
+
*/
|
|
1037
|
+
export interface StartFormInfo {
|
|
1038
|
+
key?: string;
|
|
1039
|
+
contextPath?: string;
|
|
1040
|
+
camundaFormRef?: {
|
|
1041
|
+
key: string;
|
|
1042
|
+
binding: string;
|
|
1043
|
+
version?: number;
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* User operation log entry
|
|
1049
|
+
*/
|
|
1050
|
+
export interface UserOperationLog {
|
|
1051
|
+
id: string;
|
|
1052
|
+
processDefinitionId?: string;
|
|
1053
|
+
processDefinitionKey?: string;
|
|
1054
|
+
processInstanceId?: string;
|
|
1055
|
+
executionId?: string;
|
|
1056
|
+
taskId?: string;
|
|
1057
|
+
userId: string;
|
|
1058
|
+
timestamp: string;
|
|
1059
|
+
operationId: string;
|
|
1060
|
+
operationType: string;
|
|
1061
|
+
entityType: string;
|
|
1062
|
+
property?: string;
|
|
1063
|
+
orgValue?: string;
|
|
1064
|
+
newValue?: string;
|
|
1065
|
+
tenantId?: string;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* User operation log query parameters
|
|
1070
|
+
*/
|
|
1071
|
+
export interface UserOperationLogQueryParams {
|
|
1072
|
+
processInstanceId?: string;
|
|
1073
|
+
taskId?: string;
|
|
1074
|
+
userId?: string;
|
|
1075
|
+
operationType?: string;
|
|
1076
|
+
sortBy?: string;
|
|
1077
|
+
sortOrder?: 'asc' | 'desc';
|
|
1078
|
+
firstResult?: number;
|
|
1079
|
+
maxResults?: number;
|
|
1080
|
+
[key: string]: string | number | boolean | undefined;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* Process instance modification request
|
|
1085
|
+
*/
|
|
1086
|
+
export interface ProcessInstanceModification {
|
|
1087
|
+
instructions: Array<{
|
|
1088
|
+
type: 'cancel' | 'startBeforeActivity' | 'startAfterActivity' | 'startTransition';
|
|
1089
|
+
activityId?: string;
|
|
1090
|
+
transitionId?: string;
|
|
1091
|
+
activityInstanceId?: string;
|
|
1092
|
+
transitionInstanceId?: string;
|
|
1093
|
+
ancestorActivityInstanceId?: string;
|
|
1094
|
+
variables?: Record<string, { value: CamundaVariableValue; type?: string }>;
|
|
1095
|
+
}>;
|
|
1096
|
+
skipCustomListeners?: boolean;
|
|
1097
|
+
skipIoMappings?: boolean;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* BPM role information
|
|
1102
|
+
*/
|
|
1103
|
+
export interface Role {
|
|
1104
|
+
code: string;
|
|
1105
|
+
name: string;
|
|
1106
|
+
description?: string;
|
|
1107
|
+
}
|
package/types/common.d.ts
CHANGED
|
@@ -1,62 +1,53 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Error information structure
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* @since 1.1.0
|
|
5
5
|
*/
|
|
6
6
|
export interface ClientError {
|
|
7
|
-
/**
|
|
8
|
-
* HTTP status code
|
|
9
|
-
*/
|
|
10
|
-
status: number;
|
|
11
|
-
|
|
12
7
|
/**
|
|
13
8
|
* Error message
|
|
14
9
|
*/
|
|
15
10
|
message: string;
|
|
16
|
-
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* HTTP status code
|
|
14
|
+
*/
|
|
15
|
+
status?: number;
|
|
16
|
+
|
|
17
17
|
/**
|
|
18
18
|
* Application-specific error code (e.g., 'INVALID_TOKEN', 'PERMISSION_DENIED')
|
|
19
|
-
*
|
|
20
|
-
* @since 1.1.0
|
|
21
19
|
*/
|
|
22
20
|
code?: string;
|
|
23
|
-
|
|
21
|
+
|
|
24
22
|
/**
|
|
25
23
|
* Additional error details (optional)
|
|
26
24
|
*/
|
|
27
25
|
details?: unknown;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Error timestamp (ISO 8601 format)
|
|
31
|
-
*
|
|
32
|
-
* @since 1.1.0
|
|
33
|
-
*/
|
|
34
|
-
timestamp?: string;
|
|
35
26
|
}
|
|
36
27
|
|
|
37
28
|
/**
|
|
38
29
|
* Standard API response wrapper
|
|
39
|
-
*
|
|
30
|
+
*
|
|
40
31
|
* All Amaster API methods return results wrapped in this structure for
|
|
41
32
|
* consistent error handling and type safety.
|
|
42
|
-
*
|
|
33
|
+
*
|
|
43
34
|
* @template T - The type of the successful response data
|
|
44
|
-
*
|
|
35
|
+
*
|
|
45
36
|
* @example
|
|
46
37
|
* // Success case
|
|
47
38
|
* const result = await client.entity.list('default', 'users');
|
|
48
|
-
* if (result.
|
|
39
|
+
* if (result.data) {
|
|
49
40
|
* console.log('Data:', result.data);
|
|
50
41
|
* }
|
|
51
|
-
*
|
|
42
|
+
*
|
|
52
43
|
* @example
|
|
53
44
|
* // Error case
|
|
54
45
|
* const result = await client.auth.login({ email, password });
|
|
55
|
-
* if (
|
|
46
|
+
* if (result.error) {
|
|
56
47
|
* console.error('Error:', result.error.message);
|
|
57
48
|
* console.error('Code:', result.error.code);
|
|
58
49
|
* }
|
|
59
|
-
*
|
|
50
|
+
*
|
|
60
51
|
* @since 1.0.0
|
|
61
52
|
*/
|
|
62
53
|
export interface ClientResult<T> {
|
|
@@ -64,25 +55,16 @@ export interface ClientResult<T> {
|
|
|
64
55
|
* Response data (null if error occurred)
|
|
65
56
|
*/
|
|
66
57
|
data: T | null;
|
|
67
|
-
|
|
58
|
+
|
|
68
59
|
/**
|
|
69
60
|
* Error information (null if successful)
|
|
70
61
|
*/
|
|
71
62
|
error: ClientError | null;
|
|
72
|
-
|
|
63
|
+
|
|
73
64
|
/**
|
|
74
65
|
* HTTP response status code
|
|
75
66
|
*/
|
|
76
67
|
status: number;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Convenience flag for checking if request was successful
|
|
80
|
-
*
|
|
81
|
-
* Equivalent to `error === null`
|
|
82
|
-
*
|
|
83
|
-
* @since 1.1.0
|
|
84
|
-
*/
|
|
85
|
-
success: boolean;
|
|
86
68
|
}
|
|
87
69
|
|
|
88
70
|
/**
|
|
@@ -99,7 +81,7 @@ export interface PaginationParams {
|
|
|
99
81
|
* @default 1
|
|
100
82
|
*/
|
|
101
83
|
page?: number;
|
|
102
|
-
|
|
84
|
+
|
|
103
85
|
/**
|
|
104
86
|
* Number of items per page
|
|
105
87
|
* @default 20
|
|
@@ -109,7 +91,7 @@ export interface PaginationParams {
|
|
|
109
91
|
|
|
110
92
|
/**
|
|
111
93
|
* Paginated response structure
|
|
112
|
-
*
|
|
94
|
+
*
|
|
113
95
|
* @template T - The type of items in the list
|
|
114
96
|
*/
|
|
115
97
|
export interface PaginatedResult<T> {
|
|
@@ -117,22 +99,22 @@ export interface PaginatedResult<T> {
|
|
|
117
99
|
* Array of items for current page
|
|
118
100
|
*/
|
|
119
101
|
items: T[];
|
|
120
|
-
|
|
102
|
+
|
|
121
103
|
/**
|
|
122
104
|
* Total number of items across all pages
|
|
123
105
|
*/
|
|
124
106
|
total: number;
|
|
125
|
-
|
|
107
|
+
|
|
126
108
|
/**
|
|
127
109
|
* Current page number (1-based)
|
|
128
110
|
*/
|
|
129
111
|
page: number;
|
|
130
|
-
|
|
112
|
+
|
|
131
113
|
/**
|
|
132
114
|
* Number of items per page
|
|
133
115
|
*/
|
|
134
116
|
perPage: number;
|
|
135
|
-
|
|
117
|
+
|
|
136
118
|
/**
|
|
137
119
|
* Total number of pages
|
|
138
120
|
*/
|
package/types/copilot.d.ts
CHANGED
|
@@ -80,6 +80,9 @@ interface Conversation {
|
|
|
80
80
|
status: "submitted" | "working" | "completed" | "error";
|
|
81
81
|
messages: MessagesItem[];
|
|
82
82
|
lastUpdated: string;
|
|
83
|
+
requestState?: ConversationRequestState;
|
|
84
|
+
runtimeError?: ConversationRuntimeError | null;
|
|
85
|
+
role?: Role;
|
|
83
86
|
historyId?: string;
|
|
84
87
|
system?: {
|
|
85
88
|
level: "newConversation";
|
|
@@ -92,6 +95,21 @@ interface HistoryState {
|
|
|
92
95
|
hasMore: boolean;
|
|
93
96
|
}
|
|
94
97
|
|
|
98
|
+
type ConversationRequestState =
|
|
99
|
+
| "idle"
|
|
100
|
+
| "submitting"
|
|
101
|
+
| "streaming"
|
|
102
|
+
| "recovering"
|
|
103
|
+
| "error";
|
|
104
|
+
|
|
105
|
+
interface ConversationRuntimeError {
|
|
106
|
+
code: "network" | "unknown";
|
|
107
|
+
message: string;
|
|
108
|
+
retryable: boolean;
|
|
109
|
+
source: "send" | "stream" | "recovery";
|
|
110
|
+
timestamp: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
95
113
|
interface UpdateMessageInput {
|
|
96
114
|
taskId: string;
|
|
97
115
|
messageId: string;
|
|
@@ -120,8 +138,6 @@ interface ConversationControllerOptions {
|
|
|
120
138
|
strings: ConversationStrings;
|
|
121
139
|
mode?: "conversation" | "single-turn";
|
|
122
140
|
getContextId?: () => string;
|
|
123
|
-
loadHistoryOnInit?: boolean;
|
|
124
|
-
resumeOnInit?: boolean;
|
|
125
141
|
}
|
|
126
142
|
|
|
127
143
|
interface ConversationController {
|
|
@@ -142,17 +158,121 @@ interface ConversationController {
|
|
|
142
158
|
updateMessage(input: UpdateMessageInput): void;
|
|
143
159
|
}
|
|
144
160
|
|
|
161
|
+
interface AutoVoiceReplyMessage {
|
|
162
|
+
messageId?: string;
|
|
163
|
+
role?: string;
|
|
164
|
+
kind: string;
|
|
165
|
+
content?: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
interface AutoVoiceReplyConversation {
|
|
169
|
+
taskId: string;
|
|
170
|
+
status: string;
|
|
171
|
+
requestState?: string;
|
|
172
|
+
messages: AutoVoiceReplyMessage[];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
interface AutoVoiceReplySourceSnapshot {
|
|
176
|
+
conversations: AutoVoiceReplyConversation[];
|
|
177
|
+
isLoading: boolean;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
interface AutoVoiceReplySource {
|
|
181
|
+
subscribe(listener: () => void): () => void;
|
|
182
|
+
getSnapshot(): AutoVoiceReplySourceSnapshot;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface AutoVoiceReplySpeechSnapshot {
|
|
186
|
+
status: "idle" | "connecting" | "speaking" | "error";
|
|
187
|
+
error?: string | null;
|
|
188
|
+
voice?: string | null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface AutoVoiceReplySpeechDriver {
|
|
192
|
+
subscribe(listener: () => void): () => void;
|
|
193
|
+
getSnapshot(): AutoVoiceReplySpeechSnapshot;
|
|
194
|
+
startStream(input: {
|
|
195
|
+
id: string;
|
|
196
|
+
voice?: string | null;
|
|
197
|
+
audioFormat?: "pcm" | "mp3" | "wav" | "opus";
|
|
198
|
+
sampleRate?: number;
|
|
199
|
+
}): Promise<void>;
|
|
200
|
+
appendText(input: { id: string; text: string }): Promise<void>;
|
|
201
|
+
commit(): void;
|
|
202
|
+
finish(): void;
|
|
203
|
+
stop(): void;
|
|
204
|
+
setVoice?(voice: string | null): void;
|
|
205
|
+
getVoice?(): string | null;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
interface AutoVoiceReplyStorage {
|
|
209
|
+
getItem(key: string): string | null | undefined;
|
|
210
|
+
setItem(key: string, value: string): void;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
interface AutoVoiceReplySnapshot {
|
|
214
|
+
enabled: boolean;
|
|
215
|
+
status: "idle" | "connecting" | "speaking" | "error";
|
|
216
|
+
connecting: boolean;
|
|
217
|
+
speaking: boolean;
|
|
218
|
+
voice: string | null;
|
|
219
|
+
activeTaskId: string | null;
|
|
220
|
+
suppressedTaskId: string | null;
|
|
221
|
+
error: string | null;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
interface AutoVoiceReplyController {
|
|
225
|
+
subscribe(listener: () => void): () => void;
|
|
226
|
+
getSnapshot(): AutoVoiceReplySnapshot;
|
|
227
|
+
setEnabled(enabled: boolean): void;
|
|
228
|
+
toggleEnabled(): void;
|
|
229
|
+
toggleEnabledOrStop(): void;
|
|
230
|
+
stop(): void;
|
|
231
|
+
setVoice(voice: string | null): void;
|
|
232
|
+
getVoice(): string | null;
|
|
233
|
+
destroy(): void;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
interface CreateAutoVoiceReplyControllerOptions {
|
|
237
|
+
source: AutoVoiceReplySource;
|
|
238
|
+
speech: AutoVoiceReplySpeechDriver;
|
|
239
|
+
storage?: AutoVoiceReplyStorage;
|
|
240
|
+
enabledStorageKey?: string;
|
|
241
|
+
defaultVoice?: string | null;
|
|
242
|
+
id?: string;
|
|
243
|
+
audioFormat?: "pcm" | "mp3" | "wav" | "opus";
|
|
244
|
+
sampleRate?: number;
|
|
245
|
+
preprocessText?: (text: string) => string;
|
|
246
|
+
}
|
|
247
|
+
|
|
145
248
|
type CopilotClientAPI = {
|
|
146
249
|
createConversationController(options: ConversationControllerOptions): ConversationController;
|
|
147
250
|
};
|
|
148
251
|
|
|
252
|
+
declare function createAutoVoiceReplyController(
|
|
253
|
+
options: CreateAutoVoiceReplyControllerOptions
|
|
254
|
+
): AutoVoiceReplyController;
|
|
255
|
+
|
|
149
256
|
export {
|
|
257
|
+
createAutoVoiceReplyController,
|
|
258
|
+
type AutoVoiceReplyController,
|
|
259
|
+
type AutoVoiceReplyConversation,
|
|
260
|
+
type AutoVoiceReplyMessage,
|
|
261
|
+
type AutoVoiceReplySnapshot,
|
|
262
|
+
type AutoVoiceReplySource,
|
|
263
|
+
type AutoVoiceReplySourceSnapshot,
|
|
264
|
+
type AutoVoiceReplySpeechDriver,
|
|
265
|
+
type AutoVoiceReplySpeechSnapshot,
|
|
266
|
+
type AutoVoiceReplyStorage,
|
|
150
267
|
type CopilotClientAPI,
|
|
151
268
|
type ConversationController,
|
|
152
269
|
type ConversationControllerOptions,
|
|
153
270
|
type ConversationControllerSnapshot,
|
|
271
|
+
type ConversationRequestState,
|
|
272
|
+
type ConversationRuntimeError,
|
|
154
273
|
type ConversationStrings,
|
|
155
274
|
type Conversation,
|
|
275
|
+
type CreateAutoVoiceReplyControllerOptions,
|
|
156
276
|
type MessagesItem,
|
|
157
277
|
type TextMessage,
|
|
158
278
|
type ErrorMessage,
|