@jsm-mit/chat-motoko-package 0.1.0 → 0.2.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.
@@ -5,35 +5,34 @@ import type { IDL } from '@icp-sdk/core/candid';
5
5
  export interface AddAdminArgs { 'principal' : Principal }
6
6
  export interface Chat {
7
7
  'id' : ChatId,
8
- 'status' : ChatStatus,
9
- 'title' : [] | [string],
10
- 'members' : Array<Member>,
8
+ 'participants' : Array<Participant>,
11
9
  'lastMessageAt' : bigint,
12
- 'subject' : [] | [string],
10
+ 'customer' : Principal,
13
11
  'createdAt' : bigint,
14
- 'createdBy' : Principal,
15
12
  'projectId' : ProjectId,
13
+ 'roomId' : RoomId,
16
14
  'lastSeq' : bigint,
17
- 'policy' : Policy,
18
15
  }
19
16
  export type ChatId = string;
20
- export type ChatStatus = { 'closed' : null } |
21
- { 'open' : null };
22
- export interface CloseChatArgs { 'chatId' : ChatId }
23
- export interface CreateChatArgs {
24
- 'title' : [] | [string],
25
- 'members' : Array<MemberInput>,
26
- 'subject' : [] | [string],
17
+ export interface ChatSummary {
18
+ 'id' : ChatId,
19
+ 'lastMessageAt' : bigint,
20
+ 'customer' : Principal,
21
+ 'createdAt' : bigint,
27
22
  'projectId' : ProjectId,
28
- 'firstMessage' : [] | [string],
29
- 'policy' : [] | [Policy],
23
+ 'messageCount' : bigint,
24
+ 'participantCount' : bigint,
25
+ 'roomId' : RoomId,
30
26
  }
31
27
  export interface CreateProjectArgs {
32
28
  'id' : ProjectId,
33
- 'agents' : Array<Principal>,
34
29
  'admins' : Array<Principal>,
35
- 'agentsMayInvite' : boolean,
36
- 'defaultPolicy' : Policy,
30
+ }
31
+ export interface CreateRoomArgs {
32
+ 'id' : RoomId,
33
+ 'name' : string,
34
+ 'recipients' : Array<Recipient>,
35
+ 'projectId' : ProjectId,
37
36
  }
38
37
  export interface Error { 'details' : ErrorDetails, 'logsJson' : string }
39
38
  export type ErrorDetails = { 'InterCanisterConnectionError' : null } |
@@ -50,29 +49,26 @@ export interface GetMessagesArgs {
50
49
  'sinceSeq' : bigint,
51
50
  }
52
51
  export interface GetMyChatsArgs {
53
- 'subject' : [] | [string],
54
- 'includeClosed' : boolean,
55
52
  'limit' : [] | [bigint],
56
53
  'projectId' : ProjectId,
54
+ 'roomId' : [] | [RoomId],
57
55
  }
58
56
  export interface GetProjectArgs { 'projectId' : ProjectId }
59
- export interface InviteMemberArgs {
60
- 'principal' : Principal,
61
- 'role' : Role,
62
- 'chatId' : ChatId,
57
+ export interface GetRoomArgs { 'projectId' : ProjectId, 'roomId' : RoomId }
58
+ export interface ListProjectChatsArgs {
59
+ 'limit' : [] | [bigint],
60
+ 'projectId' : ProjectId,
61
+ 'roomId' : [] | [RoomId],
63
62
  }
64
- export interface LeaveChatArgs { 'chatId' : ChatId }
65
63
  export interface ListProjectsArgs { 'limit' : [] | [bigint] }
66
- export interface MarkReadArgs { 'seq' : bigint, 'chatId' : ChatId }
67
- export interface Member {
68
- 'principal' : Principal,
69
- 'joinedAt' : bigint,
70
- 'role' : Role,
71
- 'lastReadSeq' : bigint,
64
+ export interface ListRoomsArgs {
65
+ 'limit' : [] | [bigint],
66
+ 'projectId' : ProjectId,
72
67
  }
73
- export interface MemberInput { 'principal' : Principal, 'role' : Role }
68
+ export interface MarkReadArgs { 'seq' : bigint, 'chatId' : ChatId }
74
69
  export interface Message {
75
70
  'seq' : bigint,
71
+ 'customer' : Principal,
76
72
  'kind' : MessageKind,
77
73
  'createdAt' : bigint,
78
74
  'text' : string,
@@ -80,6 +76,7 @@ export interface Message {
80
76
  'author' : Principal,
81
77
  'projectId' : ProjectId,
82
78
  'chatId' : ChatId,
79
+ 'roomId' : RoomId,
83
80
  }
84
81
  export type MessageKind = { 'toolTrace' : null } |
85
82
  { 'text' : null } |
@@ -88,7 +85,19 @@ export interface MessagesPage {
88
85
  'messages' : Array<Message>,
89
86
  'lastSeq' : bigint,
90
87
  }
91
- export interface Policy { 'agentsReply' : boolean }
88
+ export interface OpenChatArgs {
89
+ 'customerName' : [] | [string],
90
+ 'projectId' : ProjectId,
91
+ 'roomId' : RoomId,
92
+ }
93
+ export interface Participant {
94
+ 'principal' : Principal,
95
+ 'displayName' : string,
96
+ 'firstPostSeq' : [] | [bigint],
97
+ 'joinedAt' : bigint,
98
+ 'role' : Role,
99
+ 'lastReadSeq' : bigint,
100
+ }
92
101
  export interface PollNewMessagesArgs {
93
102
  'limit' : [] | [bigint],
94
103
  'sinceGlobalSeq' : bigint,
@@ -109,88 +118,99 @@ export interface Project {
109
118
  'id' : ProjectId,
110
119
  'createdAt' : bigint,
111
120
  'createdBy' : Principal,
112
- 'agents' : Array<Principal>,
113
121
  'admins' : Array<Principal>,
114
- 'agentsMayInvite' : boolean,
115
- 'defaultPolicy' : Policy,
116
122
  }
117
123
  export type ProjectId = string;
118
124
  export interface PurgeChatArgs { 'chatId' : ChatId }
125
+ export interface QuotaLimits { 'chats' : bigint, 'posts' : bigint }
126
+ export interface Recipient {
127
+ 'principal' : Principal,
128
+ 'displayName' : string,
129
+ 'role' : RecipientRole,
130
+ }
131
+ export type RecipientRole = { 'agent' : null } |
132
+ { 'worker' : null };
119
133
  export interface RemoveAdminArgs { 'principal' : Principal }
120
- export interface RemoveMemberArgs { 'principal' : Principal, 'chatId' : ChatId }
121
- export type Result = { 'ok' : Project } |
134
+ export type Result = { 'ok' : Room } |
135
+ { 'err' : Error };
136
+ export type Result_1 = { 'ok' : Project } |
122
137
  { 'err' : Error };
123
- export type Result_1 = { 'ok' : Chat } |
138
+ export type Result_10 = { 'ok' : Array<ChatSummary> } |
124
139
  { 'err' : Error };
125
- export type Result_2 = { 'ok' : boolean } |
140
+ export type Result_11 = { 'ok' : Array<Chat> } |
126
141
  { 'err' : Error };
127
- export type Result_3 = { 'ok' : Principal } |
142
+ export type Result_12 = { 'ok' : MessagesPage } |
128
143
  { 'err' : Error };
129
- export type Result_4 = { 'ok' : Message } |
144
+ export type Result_13 = { 'ok' : Array<Principal> } |
130
145
  { 'err' : Error };
131
- export type Result_5 = { 'ok' : PollResult } |
146
+ export type Result_2 = { 'ok' : QuotaLimits } |
132
147
  { 'err' : Error };
133
- export type Result_6 = { 'ok' : Array<Project> } |
148
+ export type Result_3 = { 'ok' : boolean } |
134
149
  { 'err' : Error };
135
- export type Result_7 = { 'ok' : Array<Chat> } |
150
+ export type Result_4 = { 'ok' : Principal } |
136
151
  { 'err' : Error };
137
- export type Result_8 = { 'ok' : MessagesPage } |
152
+ export type Result_5 = { 'ok' : Message } |
138
153
  { 'err' : Error };
139
- export type Result_9 = { 'ok' : Array<Principal> } |
154
+ export type Result_6 = { 'ok' : PollResult } |
140
155
  { 'err' : Error };
141
- export type Role = { 'member' : null } |
142
- { 'admin' : null } |
143
- { 'agent' : null } |
144
- { 'owner' : null };
156
+ export type Result_7 = { 'ok' : Chat } |
157
+ { 'err' : Error };
158
+ export type Result_8 = { 'ok' : Array<Room> } |
159
+ { 'err' : Error };
160
+ export type Result_9 = { 'ok' : Array<Project> } |
161
+ { 'err' : Error };
162
+ export type Role = { 'agent' : null } |
163
+ { 'customer' : null } |
164
+ { 'worker' : null };
165
+ export interface Room {
166
+ 'id' : RoomId,
167
+ 'name' : string,
168
+ 'createdAt' : bigint,
169
+ 'createdBy' : Principal,
170
+ 'recipients' : Array<Recipient>,
171
+ 'projectId' : ProjectId,
172
+ }
173
+ export type RoomId = string;
145
174
  export interface SetLoggingEnabledArgs { 'enabled' : boolean }
146
- export interface SetPolicyArgs { 'chatId' : ChatId, 'policy' : Policy }
147
- export type SystemEvent = {
148
- 'memberJoined' : { 'principal' : Principal, 'role' : Role }
149
- } |
150
- { 'policyChanged' : Policy } |
151
- { 'memberRemoved' : { 'by' : Principal, 'principal' : Principal } } |
152
- { 'memberLeft' : { 'principal' : Principal } } |
153
- { 'chatCreated' : null } |
154
- { 'chatClosed' : null } |
155
- {
156
- 'memberInvited' : {
157
- 'by' : Principal,
158
- 'principal' : Principal,
159
- 'role' : Role,
160
- }
161
- };
175
+ export interface SetQuotaLimitsArgs { 'limits' : QuotaLimits }
176
+ export type SystemEvent = { 'chatCreated' : null };
162
177
  export interface UpdateProjectArgs {
163
- 'agents' : [] | [Array<Principal>],
164
178
  'projectId' : ProjectId,
165
179
  'admins' : [] | [Array<Principal>],
166
- 'agentsMayInvite' : [] | [boolean],
167
- 'defaultPolicy' : [] | [Policy],
180
+ }
181
+ export interface UpdateRoomArgs {
182
+ 'name' : [] | [string],
183
+ 'recipients' : [] | [Array<Recipient>],
184
+ 'projectId' : ProjectId,
185
+ 'roomId' : RoomId,
168
186
  }
169
187
  export interface _SERVICE {
170
- 'addAdmin' : ActorMethod<[AddAdminArgs], Result_2>,
188
+ 'addAdmin' : ActorMethod<[AddAdminArgs], Result_3>,
171
189
  'clearLogs' : ActorMethod<[], undefined>,
172
- 'closeChat' : ActorMethod<[CloseChatArgs], Result_1>,
173
- 'createChat' : ActorMethod<[CreateChatArgs], Result_1>,
174
- 'createProject' : ActorMethod<[CreateProjectArgs], Result>,
175
- 'getAdmins' : ActorMethod<[], Result_9>,
176
- 'getChat' : ActorMethod<[GetChatArgs], Result_1>,
190
+ 'createProject' : ActorMethod<[CreateProjectArgs], Result_1>,
191
+ 'createRoom' : ActorMethod<[CreateRoomArgs], Result>,
192
+ 'getAdmins' : ActorMethod<[], Result_13>,
193
+ 'getChat' : ActorMethod<[GetChatArgs], Result_7>,
177
194
  'getLogs' : ActorMethod<[], string>,
178
- 'getMessages' : ActorMethod<[GetMessagesArgs], Result_8>,
179
- 'getMyChats' : ActorMethod<[GetMyChatsArgs], Result_7>,
180
- 'getProject' : ActorMethod<[GetProjectArgs], Result>,
181
- 'inviteMember' : ActorMethod<[InviteMemberArgs], Result_1>,
182
- 'leaveChat' : ActorMethod<[LeaveChatArgs], Result_2>,
183
- 'listProjects' : ActorMethod<[ListProjectsArgs], Result_6>,
184
- 'markRead' : ActorMethod<[MarkReadArgs], Result_2>,
185
- 'pollNewMessages' : ActorMethod<[PollNewMessagesArgs], Result_5>,
186
- 'post' : ActorMethod<[PostArgs], Result_4>,
187
- 'purgeChat' : ActorMethod<[PurgeChatArgs], Result_2>,
188
- 'registerAsAdmin' : ActorMethod<[], Result_3>,
189
- 'removeAdmin' : ActorMethod<[RemoveAdminArgs], Result_2>,
190
- 'removeMember' : ActorMethod<[RemoveMemberArgs], Result_1>,
191
- 'setLoggingEnabled' : ActorMethod<[SetLoggingEnabledArgs], Result_2>,
192
- 'setPolicy' : ActorMethod<[SetPolicyArgs], Result_1>,
193
- 'updateProject' : ActorMethod<[UpdateProjectArgs], Result>,
195
+ 'getMessages' : ActorMethod<[GetMessagesArgs], Result_12>,
196
+ 'getMyChats' : ActorMethod<[GetMyChatsArgs], Result_11>,
197
+ 'getProject' : ActorMethod<[GetProjectArgs], Result_1>,
198
+ 'getQuotaLimits' : ActorMethod<[], Result_2>,
199
+ 'getRoom' : ActorMethod<[GetRoomArgs], Result>,
200
+ 'listProjectChats' : ActorMethod<[ListProjectChatsArgs], Result_10>,
201
+ 'listProjects' : ActorMethod<[ListProjectsArgs], Result_9>,
202
+ 'listRooms' : ActorMethod<[ListRoomsArgs], Result_8>,
203
+ 'markRead' : ActorMethod<[MarkReadArgs], Result_3>,
204
+ 'openChat' : ActorMethod<[OpenChatArgs], Result_7>,
205
+ 'pollNewMessages' : ActorMethod<[PollNewMessagesArgs], Result_6>,
206
+ 'post' : ActorMethod<[PostArgs], Result_5>,
207
+ 'purgeChat' : ActorMethod<[PurgeChatArgs], Result_3>,
208
+ 'registerAsAdmin' : ActorMethod<[], Result_4>,
209
+ 'removeAdmin' : ActorMethod<[RemoveAdminArgs], Result_3>,
210
+ 'setLoggingEnabled' : ActorMethod<[SetLoggingEnabledArgs], Result_3>,
211
+ 'setQuotaLimits' : ActorMethod<[SetQuotaLimitsArgs], Result_2>,
212
+ 'updateProject' : ActorMethod<[UpdateProjectArgs], Result_1>,
213
+ 'updateRoom' : ActorMethod<[UpdateRoomArgs], Result>,
194
214
  'whoAmI' : ActorMethod<[], Principal>,
195
215
  }
196
216
  export declare const idlFactory: IDL.InterfaceFactory;
@@ -10,93 +10,80 @@ export const idlFactory = ({ IDL }) => {
10
10
  'ReturnsNull' : IDL.Null,
11
11
  });
12
12
  const Error = IDL.Record({ 'details' : ErrorDetails, 'logsJson' : IDL.Text });
13
- const Result_2 = IDL.Variant({ 'ok' : IDL.Bool, 'err' : Error });
13
+ const Result_3 = IDL.Variant({ 'ok' : IDL.Bool, 'err' : Error });
14
+ const ProjectId = IDL.Text;
15
+ const CreateProjectArgs = IDL.Record({
16
+ 'id' : ProjectId,
17
+ 'admins' : IDL.Vec(IDL.Principal),
18
+ });
19
+ const Project = IDL.Record({
20
+ 'id' : ProjectId,
21
+ 'createdAt' : IDL.Int,
22
+ 'createdBy' : IDL.Principal,
23
+ 'admins' : IDL.Vec(IDL.Principal),
24
+ });
25
+ const Result_1 = IDL.Variant({ 'ok' : Project, 'err' : Error });
26
+ const RoomId = IDL.Text;
27
+ const RecipientRole = IDL.Variant({
28
+ 'agent' : IDL.Null,
29
+ 'worker' : IDL.Null,
30
+ });
31
+ const Recipient = IDL.Record({
32
+ 'principal' : IDL.Principal,
33
+ 'displayName' : IDL.Text,
34
+ 'role' : RecipientRole,
35
+ });
36
+ const CreateRoomArgs = IDL.Record({
37
+ 'id' : RoomId,
38
+ 'name' : IDL.Text,
39
+ 'recipients' : IDL.Vec(Recipient),
40
+ 'projectId' : ProjectId,
41
+ });
42
+ const Room = IDL.Record({
43
+ 'id' : RoomId,
44
+ 'name' : IDL.Text,
45
+ 'createdAt' : IDL.Int,
46
+ 'createdBy' : IDL.Principal,
47
+ 'recipients' : IDL.Vec(Recipient),
48
+ 'projectId' : ProjectId,
49
+ });
50
+ const Result = IDL.Variant({ 'ok' : Room, 'err' : Error });
51
+ const Result_13 = IDL.Variant({
52
+ 'ok' : IDL.Vec(IDL.Principal),
53
+ 'err' : Error,
54
+ });
14
55
  const ChatId = IDL.Text;
15
- const CloseChatArgs = IDL.Record({ 'chatId' : ChatId });
16
- const ChatStatus = IDL.Variant({ 'closed' : IDL.Null, 'open' : IDL.Null });
56
+ const GetChatArgs = IDL.Record({ 'chatId' : ChatId });
17
57
  const Role = IDL.Variant({
18
- 'member' : IDL.Null,
19
- 'admin' : IDL.Null,
20
58
  'agent' : IDL.Null,
21
- 'owner' : IDL.Null,
59
+ 'customer' : IDL.Null,
60
+ 'worker' : IDL.Null,
22
61
  });
23
- const Member = IDL.Record({
62
+ const Participant = IDL.Record({
24
63
  'principal' : IDL.Principal,
64
+ 'displayName' : IDL.Text,
65
+ 'firstPostSeq' : IDL.Opt(IDL.Nat),
25
66
  'joinedAt' : IDL.Int,
26
67
  'role' : Role,
27
68
  'lastReadSeq' : IDL.Nat,
28
69
  });
29
- const ProjectId = IDL.Text;
30
- const Policy = IDL.Record({ 'agentsReply' : IDL.Bool });
31
70
  const Chat = IDL.Record({
32
71
  'id' : ChatId,
33
- 'status' : ChatStatus,
34
- 'title' : IDL.Opt(IDL.Text),
35
- 'members' : IDL.Vec(Member),
72
+ 'participants' : IDL.Vec(Participant),
36
73
  'lastMessageAt' : IDL.Int,
37
- 'subject' : IDL.Opt(IDL.Text),
74
+ 'customer' : IDL.Principal,
38
75
  'createdAt' : IDL.Int,
39
- 'createdBy' : IDL.Principal,
40
76
  'projectId' : ProjectId,
77
+ 'roomId' : RoomId,
41
78
  'lastSeq' : IDL.Nat,
42
- 'policy' : Policy,
43
79
  });
44
- const Result_1 = IDL.Variant({ 'ok' : Chat, 'err' : Error });
45
- const MemberInput = IDL.Record({
46
- 'principal' : IDL.Principal,
47
- 'role' : Role,
48
- });
49
- const CreateChatArgs = IDL.Record({
50
- 'title' : IDL.Opt(IDL.Text),
51
- 'members' : IDL.Vec(MemberInput),
52
- 'subject' : IDL.Opt(IDL.Text),
53
- 'projectId' : ProjectId,
54
- 'firstMessage' : IDL.Opt(IDL.Text),
55
- 'policy' : IDL.Opt(Policy),
56
- });
57
- const CreateProjectArgs = IDL.Record({
58
- 'id' : ProjectId,
59
- 'agents' : IDL.Vec(IDL.Principal),
60
- 'admins' : IDL.Vec(IDL.Principal),
61
- 'agentsMayInvite' : IDL.Bool,
62
- 'defaultPolicy' : Policy,
63
- });
64
- const Project = IDL.Record({
65
- 'id' : ProjectId,
66
- 'createdAt' : IDL.Int,
67
- 'createdBy' : IDL.Principal,
68
- 'agents' : IDL.Vec(IDL.Principal),
69
- 'admins' : IDL.Vec(IDL.Principal),
70
- 'agentsMayInvite' : IDL.Bool,
71
- 'defaultPolicy' : Policy,
72
- });
73
- const Result = IDL.Variant({ 'ok' : Project, 'err' : Error });
74
- const Result_9 = IDL.Variant({
75
- 'ok' : IDL.Vec(IDL.Principal),
76
- 'err' : Error,
77
- });
78
- const GetChatArgs = IDL.Record({ 'chatId' : ChatId });
80
+ const Result_7 = IDL.Variant({ 'ok' : Chat, 'err' : Error });
79
81
  const GetMessagesArgs = IDL.Record({
80
82
  'limit' : IDL.Opt(IDL.Nat),
81
83
  'chatId' : ChatId,
82
84
  'sinceSeq' : IDL.Nat,
83
85
  });
84
- const SystemEvent = IDL.Variant({
85
- 'memberJoined' : IDL.Record({ 'principal' : IDL.Principal, 'role' : Role }),
86
- 'policyChanged' : Policy,
87
- 'memberRemoved' : IDL.Record({
88
- 'by' : IDL.Principal,
89
- 'principal' : IDL.Principal,
90
- }),
91
- 'memberLeft' : IDL.Record({ 'principal' : IDL.Principal }),
92
- 'chatCreated' : IDL.Null,
93
- 'chatClosed' : IDL.Null,
94
- 'memberInvited' : IDL.Record({
95
- 'by' : IDL.Principal,
96
- 'principal' : IDL.Principal,
97
- 'role' : Role,
98
- }),
99
- });
86
+ const SystemEvent = IDL.Variant({ 'chatCreated' : IDL.Null });
100
87
  const MessageKind = IDL.Variant({
101
88
  'toolTrace' : IDL.Null,
102
89
  'text' : IDL.Null,
@@ -104,6 +91,7 @@ export const idlFactory = ({ IDL }) => {
104
91
  });
105
92
  const Message = IDL.Record({
106
93
  'seq' : IDL.Nat,
94
+ 'customer' : IDL.Principal,
107
95
  'kind' : MessageKind,
108
96
  'createdAt' : IDL.Int,
109
97
  'text' : IDL.Text,
@@ -111,29 +99,55 @@ export const idlFactory = ({ IDL }) => {
111
99
  'author' : IDL.Principal,
112
100
  'projectId' : ProjectId,
113
101
  'chatId' : ChatId,
102
+ 'roomId' : RoomId,
114
103
  });
115
104
  const MessagesPage = IDL.Record({
116
105
  'messages' : IDL.Vec(Message),
117
106
  'lastSeq' : IDL.Nat,
118
107
  });
119
- const Result_8 = IDL.Variant({ 'ok' : MessagesPage, 'err' : Error });
108
+ const Result_12 = IDL.Variant({ 'ok' : MessagesPage, 'err' : Error });
120
109
  const GetMyChatsArgs = IDL.Record({
121
- 'subject' : IDL.Opt(IDL.Text),
122
- 'includeClosed' : IDL.Bool,
123
110
  'limit' : IDL.Opt(IDL.Nat),
124
111
  'projectId' : ProjectId,
112
+ 'roomId' : IDL.Opt(RoomId),
125
113
  });
126
- const Result_7 = IDL.Variant({ 'ok' : IDL.Vec(Chat), 'err' : Error });
114
+ const Result_11 = IDL.Variant({ 'ok' : IDL.Vec(Chat), 'err' : Error });
127
115
  const GetProjectArgs = IDL.Record({ 'projectId' : ProjectId });
128
- const InviteMemberArgs = IDL.Record({
129
- 'principal' : IDL.Principal,
130
- 'role' : Role,
131
- 'chatId' : ChatId,
116
+ const QuotaLimits = IDL.Record({ 'chats' : IDL.Nat, 'posts' : IDL.Nat });
117
+ const Result_2 = IDL.Variant({ 'ok' : QuotaLimits, 'err' : Error });
118
+ const GetRoomArgs = IDL.Record({
119
+ 'projectId' : ProjectId,
120
+ 'roomId' : RoomId,
121
+ });
122
+ const ListProjectChatsArgs = IDL.Record({
123
+ 'limit' : IDL.Opt(IDL.Nat),
124
+ 'projectId' : ProjectId,
125
+ 'roomId' : IDL.Opt(RoomId),
132
126
  });
133
- const LeaveChatArgs = IDL.Record({ 'chatId' : ChatId });
127
+ const ChatSummary = IDL.Record({
128
+ 'id' : ChatId,
129
+ 'lastMessageAt' : IDL.Int,
130
+ 'customer' : IDL.Principal,
131
+ 'createdAt' : IDL.Int,
132
+ 'projectId' : ProjectId,
133
+ 'messageCount' : IDL.Nat,
134
+ 'participantCount' : IDL.Nat,
135
+ 'roomId' : RoomId,
136
+ });
137
+ const Result_10 = IDL.Variant({ 'ok' : IDL.Vec(ChatSummary), 'err' : Error });
134
138
  const ListProjectsArgs = IDL.Record({ 'limit' : IDL.Opt(IDL.Nat) });
135
- const Result_6 = IDL.Variant({ 'ok' : IDL.Vec(Project), 'err' : Error });
139
+ const Result_9 = IDL.Variant({ 'ok' : IDL.Vec(Project), 'err' : Error });
140
+ const ListRoomsArgs = IDL.Record({
141
+ 'limit' : IDL.Opt(IDL.Nat),
142
+ 'projectId' : ProjectId,
143
+ });
144
+ const Result_8 = IDL.Variant({ 'ok' : IDL.Vec(Room), 'err' : Error });
136
145
  const MarkReadArgs = IDL.Record({ 'seq' : IDL.Nat, 'chatId' : ChatId });
146
+ const OpenChatArgs = IDL.Record({
147
+ 'customerName' : IDL.Opt(IDL.Text),
148
+ 'projectId' : ProjectId,
149
+ 'roomId' : RoomId,
150
+ });
137
151
  const PollNewMessagesArgs = IDL.Record({
138
152
  'limit' : IDL.Opt(IDL.Nat),
139
153
  'sinceGlobalSeq' : IDL.Nat,
@@ -143,55 +157,60 @@ export const idlFactory = ({ IDL }) => {
143
157
  'headGlobalSeq' : IDL.Nat,
144
158
  'messages' : IDL.Vec(Message),
145
159
  });
146
- const Result_5 = IDL.Variant({ 'ok' : PollResult, 'err' : Error });
160
+ const Result_6 = IDL.Variant({ 'ok' : PollResult, 'err' : Error });
147
161
  const PostKind = IDL.Variant({ 'toolTrace' : IDL.Null, 'text' : IDL.Null });
148
162
  const PostArgs = IDL.Record({
149
163
  'kind' : PostKind,
150
164
  'text' : IDL.Text,
151
165
  'chatId' : ChatId,
152
166
  });
153
- const Result_4 = IDL.Variant({ 'ok' : Message, 'err' : Error });
167
+ const Result_5 = IDL.Variant({ 'ok' : Message, 'err' : Error });
154
168
  const PurgeChatArgs = IDL.Record({ 'chatId' : ChatId });
155
- const Result_3 = IDL.Variant({ 'ok' : IDL.Principal, 'err' : Error });
169
+ const Result_4 = IDL.Variant({ 'ok' : IDL.Principal, 'err' : Error });
156
170
  const RemoveAdminArgs = IDL.Record({ 'principal' : IDL.Principal });
157
- const RemoveMemberArgs = IDL.Record({
158
- 'principal' : IDL.Principal,
159
- 'chatId' : ChatId,
160
- });
161
171
  const SetLoggingEnabledArgs = IDL.Record({ 'enabled' : IDL.Bool });
162
- const SetPolicyArgs = IDL.Record({ 'chatId' : ChatId, 'policy' : Policy });
172
+ const SetQuotaLimitsArgs = IDL.Record({ 'limits' : QuotaLimits });
163
173
  const UpdateProjectArgs = IDL.Record({
164
- 'agents' : IDL.Opt(IDL.Vec(IDL.Principal)),
165
174
  'projectId' : ProjectId,
166
175
  'admins' : IDL.Opt(IDL.Vec(IDL.Principal)),
167
- 'agentsMayInvite' : IDL.Opt(IDL.Bool),
168
- 'defaultPolicy' : IDL.Opt(Policy),
176
+ });
177
+ const UpdateRoomArgs = IDL.Record({
178
+ 'name' : IDL.Opt(IDL.Text),
179
+ 'recipients' : IDL.Opt(IDL.Vec(Recipient)),
180
+ 'projectId' : ProjectId,
181
+ 'roomId' : RoomId,
169
182
  });
170
183
  return IDL.Service({
171
- 'addAdmin' : IDL.Func([AddAdminArgs], [Result_2], []),
184
+ 'addAdmin' : IDL.Func([AddAdminArgs], [Result_3], []),
172
185
  'clearLogs' : IDL.Func([], [], []),
173
- 'closeChat' : IDL.Func([CloseChatArgs], [Result_1], []),
174
- 'createChat' : IDL.Func([CreateChatArgs], [Result_1], []),
175
- 'createProject' : IDL.Func([CreateProjectArgs], [Result], []),
176
- 'getAdmins' : IDL.Func([], [Result_9], ['query']),
177
- 'getChat' : IDL.Func([GetChatArgs], [Result_1], ['query']),
186
+ 'createProject' : IDL.Func([CreateProjectArgs], [Result_1], []),
187
+ 'createRoom' : IDL.Func([CreateRoomArgs], [Result], []),
188
+ 'getAdmins' : IDL.Func([], [Result_13], ['query']),
189
+ 'getChat' : IDL.Func([GetChatArgs], [Result_7], ['query']),
178
190
  'getLogs' : IDL.Func([], [IDL.Text], ['query']),
179
- 'getMessages' : IDL.Func([GetMessagesArgs], [Result_8], ['query']),
180
- 'getMyChats' : IDL.Func([GetMyChatsArgs], [Result_7], ['query']),
181
- 'getProject' : IDL.Func([GetProjectArgs], [Result], ['query']),
182
- 'inviteMember' : IDL.Func([InviteMemberArgs], [Result_1], []),
183
- 'leaveChat' : IDL.Func([LeaveChatArgs], [Result_2], []),
184
- 'listProjects' : IDL.Func([ListProjectsArgs], [Result_6], ['query']),
185
- 'markRead' : IDL.Func([MarkReadArgs], [Result_2], []),
186
- 'pollNewMessages' : IDL.Func([PollNewMessagesArgs], [Result_5], ['query']),
187
- 'post' : IDL.Func([PostArgs], [Result_4], []),
188
- 'purgeChat' : IDL.Func([PurgeChatArgs], [Result_2], []),
189
- 'registerAsAdmin' : IDL.Func([], [Result_3], []),
190
- 'removeAdmin' : IDL.Func([RemoveAdminArgs], [Result_2], []),
191
- 'removeMember' : IDL.Func([RemoveMemberArgs], [Result_1], []),
192
- 'setLoggingEnabled' : IDL.Func([SetLoggingEnabledArgs], [Result_2], []),
193
- 'setPolicy' : IDL.Func([SetPolicyArgs], [Result_1], []),
194
- 'updateProject' : IDL.Func([UpdateProjectArgs], [Result], []),
191
+ 'getMessages' : IDL.Func([GetMessagesArgs], [Result_12], ['query']),
192
+ 'getMyChats' : IDL.Func([GetMyChatsArgs], [Result_11], ['query']),
193
+ 'getProject' : IDL.Func([GetProjectArgs], [Result_1], ['query']),
194
+ 'getQuotaLimits' : IDL.Func([], [Result_2], ['query']),
195
+ 'getRoom' : IDL.Func([GetRoomArgs], [Result], ['query']),
196
+ 'listProjectChats' : IDL.Func(
197
+ [ListProjectChatsArgs],
198
+ [Result_10],
199
+ ['query'],
200
+ ),
201
+ 'listProjects' : IDL.Func([ListProjectsArgs], [Result_9], ['query']),
202
+ 'listRooms' : IDL.Func([ListRoomsArgs], [Result_8], ['query']),
203
+ 'markRead' : IDL.Func([MarkReadArgs], [Result_3], []),
204
+ 'openChat' : IDL.Func([OpenChatArgs], [Result_7], []),
205
+ 'pollNewMessages' : IDL.Func([PollNewMessagesArgs], [Result_6], ['query']),
206
+ 'post' : IDL.Func([PostArgs], [Result_5], []),
207
+ 'purgeChat' : IDL.Func([PurgeChatArgs], [Result_3], []),
208
+ 'registerAsAdmin' : IDL.Func([], [Result_4], []),
209
+ 'removeAdmin' : IDL.Func([RemoveAdminArgs], [Result_3], []),
210
+ 'setLoggingEnabled' : IDL.Func([SetLoggingEnabledArgs], [Result_3], []),
211
+ 'setQuotaLimits' : IDL.Func([SetQuotaLimitsArgs], [Result_2], []),
212
+ 'updateProject' : IDL.Func([UpdateProjectArgs], [Result_1], []),
213
+ 'updateRoom' : IDL.Func([UpdateRoomArgs], [Result], []),
195
214
  'whoAmI' : IDL.Func([], [IDL.Principal], ['query']),
196
215
  });
197
216
  };
@@ -1,5 +1,6 @@
1
1
  import { type Identity } from "@icp-sdk/core/agent";
2
2
  import { ActorBase } from "../actor-base.js";
3
+ import type { QuotaLimitsView } from "../interfaces.js";
3
4
  /** 1:1 wrapper for the canister's AdminController plus the three diagnostics. */
4
5
  export declare class AdminActor extends ActorBase {
5
6
  constructor(canisterId: string, identity?: Identity);
@@ -39,6 +40,20 @@ export declare class AdminActor extends ActorBase {
39
40
  * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
40
41
  * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
41
42
  */
43
+ /**
44
+ * Sets the daily caps per principal (posts and new chats), both positive. Admin only.
45
+ * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, `InvalidData` for a zero). Examine "cause" for {errorKey, errorMessage, logs}.
46
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
47
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
48
+ */
49
+ setQuotaLimitsAsyncUnsafe(limits: QuotaLimitsView): Promise<QuotaLimitsView>;
50
+ /**
51
+ * The daily caps in force. Any signed-in caller.
52
+ * @throws Error with message `CanisterError` when the canister returns a business error (not authorized for anonymous). Examine "cause" for {errorKey, errorMessage, logs}.
53
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
54
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
55
+ */
56
+ getQuotaLimitsAsyncUnsafe(): Promise<QuotaLimitsView>;
42
57
  setLoggingEnabledAsyncUnsafe(enabled: boolean): Promise<boolean>;
43
58
  /**
44
59
  * The caller's principal as the canister sees it (text).
@@ -1 +1 @@
1
- {"version":3,"file":"admin-actor.d.ts","sourceRoot":"","sources":["../../src/actors/admin-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,iFAAiF;AACjF,qBAAa,UAAW,SAAQ,SAAS;gBAEzB,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;;OAOG;IACU,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC;IAK1D;;;;;OAKG;IACU,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIrE;;;;;OAKG;IACU,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxE;;;;;OAKG;IACU,oBAAoB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKtD;;;;;OAKG;IACU,4BAA4B,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAI7E;;;;OAIG;IACU,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IAKjD;;;OAGG;IACU,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIlD;;;;OAIG;IACU,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;CAGrD"}
1
+ {"version":3,"file":"admin-actor.d.ts","sourceRoot":"","sources":["../../src/actors/admin-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,iFAAiF;AACjF,qBAAa,UAAW,SAAQ,SAAS;gBAEzB,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;;OAOG;IACU,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC;IAK1D;;;;;OAKG;IACU,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIrE;;;;;OAKG;IACU,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxE;;;;;OAKG;IACU,oBAAoB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKtD;;;;;OAKG;IACH;;;;;OAKG;IACU,yBAAyB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAKzF;;;;;OAKG;IACU,yBAAyB,IAAI,OAAO,CAAC,eAAe,CAAC;IAKrD,4BAA4B,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAI7E;;;;OAIG;IACU,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IAKjD;;;OAGG;IACU,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIlD;;;;OAIG;IACU,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;CAGrD"}