@jsm-mit/chat-motoko-package 0.1.0 → 0.3.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,35 @@ 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>,
29
+ 'accountsCanister' : Principal,
34
30
  'admins' : Array<Principal>,
35
- 'agentsMayInvite' : boolean,
36
- 'defaultPolicy' : Policy,
31
+ }
32
+ export interface CreateRoomArgs {
33
+ 'id' : RoomId,
34
+ 'name' : string,
35
+ 'recipients' : Array<Recipient>,
36
+ 'projectId' : ProjectId,
37
37
  }
38
38
  export interface Error { 'details' : ErrorDetails, 'logsJson' : string }
39
39
  export type ErrorDetails = { 'InterCanisterConnectionError' : null } |
@@ -50,29 +50,26 @@ export interface GetMessagesArgs {
50
50
  'sinceSeq' : bigint,
51
51
  }
52
52
  export interface GetMyChatsArgs {
53
- 'subject' : [] | [string],
54
- 'includeClosed' : boolean,
55
53
  'limit' : [] | [bigint],
56
54
  'projectId' : ProjectId,
55
+ 'roomId' : [] | [RoomId],
57
56
  }
58
57
  export interface GetProjectArgs { 'projectId' : ProjectId }
59
- export interface InviteMemberArgs {
60
- 'principal' : Principal,
61
- 'role' : Role,
62
- 'chatId' : ChatId,
58
+ export interface GetRoomArgs { 'projectId' : ProjectId, 'roomId' : RoomId }
59
+ export interface ListProjectChatsArgs {
60
+ 'limit' : [] | [bigint],
61
+ 'projectId' : ProjectId,
62
+ 'roomId' : [] | [RoomId],
63
63
  }
64
- export interface LeaveChatArgs { 'chatId' : ChatId }
65
64
  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,
65
+ export interface ListRoomsArgs {
66
+ 'limit' : [] | [bigint],
67
+ 'projectId' : ProjectId,
72
68
  }
73
- export interface MemberInput { 'principal' : Principal, 'role' : Role }
69
+ export interface MarkReadArgs { 'seq' : bigint, 'chatId' : ChatId }
74
70
  export interface Message {
75
71
  'seq' : bigint,
72
+ 'customer' : Principal,
76
73
  'kind' : MessageKind,
77
74
  'createdAt' : bigint,
78
75
  'text' : string,
@@ -80,6 +77,7 @@ export interface Message {
80
77
  'author' : Principal,
81
78
  'projectId' : ProjectId,
82
79
  'chatId' : ChatId,
80
+ 'roomId' : RoomId,
83
81
  }
84
82
  export type MessageKind = { 'toolTrace' : null } |
85
83
  { 'text' : null } |
@@ -88,7 +86,19 @@ export interface MessagesPage {
88
86
  'messages' : Array<Message>,
89
87
  'lastSeq' : bigint,
90
88
  }
91
- export interface Policy { 'agentsReply' : boolean }
89
+ export interface OpenChatArgs {
90
+ 'customerName' : [] | [string],
91
+ 'projectId' : ProjectId,
92
+ 'roomId' : RoomId,
93
+ }
94
+ export interface Participant {
95
+ 'principal' : Principal,
96
+ 'displayName' : string,
97
+ 'firstPostSeq' : [] | [bigint],
98
+ 'joinedAt' : bigint,
99
+ 'role' : Role,
100
+ 'lastReadSeq' : bigint,
101
+ }
92
102
  export interface PollNewMessagesArgs {
93
103
  'limit' : [] | [bigint],
94
104
  'sinceGlobalSeq' : bigint,
@@ -109,88 +119,101 @@ export interface Project {
109
119
  'id' : ProjectId,
110
120
  'createdAt' : bigint,
111
121
  'createdBy' : Principal,
112
- 'agents' : Array<Principal>,
122
+ 'accountsCanister' : Principal,
113
123
  'admins' : Array<Principal>,
114
- 'agentsMayInvite' : boolean,
115
- 'defaultPolicy' : Policy,
116
124
  }
117
125
  export type ProjectId = string;
118
126
  export interface PurgeChatArgs { 'chatId' : ChatId }
127
+ export interface QuotaLimits { 'chats' : bigint, 'posts' : bigint }
128
+ export interface Recipient {
129
+ 'principal' : Principal,
130
+ 'displayName' : string,
131
+ 'role' : RecipientRole,
132
+ }
133
+ export type RecipientRole = { 'agent' : null } |
134
+ { 'worker' : null };
119
135
  export interface RemoveAdminArgs { 'principal' : Principal }
120
- export interface RemoveMemberArgs { 'principal' : Principal, 'chatId' : ChatId }
121
- export type Result = { 'ok' : Project } |
136
+ export type Result = { 'ok' : Room } |
137
+ { 'err' : Error };
138
+ export type Result_1 = { 'ok' : Project } |
122
139
  { 'err' : Error };
123
- export type Result_1 = { 'ok' : Chat } |
140
+ export type Result_10 = { 'ok' : Array<ChatSummary> } |
124
141
  { 'err' : Error };
125
- export type Result_2 = { 'ok' : boolean } |
142
+ export type Result_11 = { 'ok' : Array<Chat> } |
126
143
  { 'err' : Error };
127
- export type Result_3 = { 'ok' : Principal } |
144
+ export type Result_12 = { 'ok' : MessagesPage } |
128
145
  { 'err' : Error };
129
- export type Result_4 = { 'ok' : Message } |
146
+ export type Result_13 = { 'ok' : Array<Principal> } |
130
147
  { 'err' : Error };
131
- export type Result_5 = { 'ok' : PollResult } |
148
+ export type Result_2 = { 'ok' : QuotaLimits } |
132
149
  { 'err' : Error };
133
- export type Result_6 = { 'ok' : Array<Project> } |
150
+ export type Result_3 = { 'ok' : boolean } |
134
151
  { 'err' : Error };
135
- export type Result_7 = { 'ok' : Array<Chat> } |
152
+ export type Result_4 = { 'ok' : Principal } |
136
153
  { 'err' : Error };
137
- export type Result_8 = { 'ok' : MessagesPage } |
154
+ export type Result_5 = { 'ok' : Message } |
138
155
  { 'err' : Error };
139
- export type Result_9 = { 'ok' : Array<Principal> } |
156
+ export type Result_6 = { 'ok' : PollResult } |
140
157
  { 'err' : Error };
141
- export type Role = { 'member' : null } |
142
- { 'admin' : null } |
143
- { 'agent' : null } |
144
- { 'owner' : null };
158
+ export type Result_7 = { 'ok' : Chat } |
159
+ { 'err' : Error };
160
+ export type Result_8 = { 'ok' : Array<Room> } |
161
+ { 'err' : Error };
162
+ export type Result_9 = { 'ok' : Array<Project> } |
163
+ { 'err' : Error };
164
+ export type Role = { 'agent' : null } |
165
+ { 'customer' : null } |
166
+ { 'worker' : null };
167
+ export interface Room {
168
+ 'id' : RoomId,
169
+ 'name' : string,
170
+ 'createdAt' : bigint,
171
+ 'createdBy' : Principal,
172
+ 'recipients' : Array<Recipient>,
173
+ 'projectId' : ProjectId,
174
+ }
175
+ export type RoomId = string;
145
176
  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
- };
177
+ export interface SetQuotaLimitsArgs { 'limits' : QuotaLimits }
178
+ export type SystemEvent = { 'chatCreated' : null };
162
179
  export interface UpdateProjectArgs {
163
- 'agents' : [] | [Array<Principal>],
180
+ 'accountsCanister' : [] | [Principal],
164
181
  'projectId' : ProjectId,
165
182
  'admins' : [] | [Array<Principal>],
166
- 'agentsMayInvite' : [] | [boolean],
167
- 'defaultPolicy' : [] | [Policy],
183
+ }
184
+ export interface UpdateRoomArgs {
185
+ 'name' : [] | [string],
186
+ 'recipients' : [] | [Array<Recipient>],
187
+ 'projectId' : ProjectId,
188
+ 'roomId' : RoomId,
168
189
  }
169
190
  export interface _SERVICE {
170
- 'addAdmin' : ActorMethod<[AddAdminArgs], Result_2>,
191
+ 'addAdmin' : ActorMethod<[AddAdminArgs], Result_3>,
171
192
  '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>,
193
+ 'createProject' : ActorMethod<[CreateProjectArgs], Result_1>,
194
+ 'createRoom' : ActorMethod<[CreateRoomArgs], Result>,
195
+ 'getAdmins' : ActorMethod<[], Result_13>,
196
+ 'getChat' : ActorMethod<[GetChatArgs], Result_7>,
177
197
  '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>,
198
+ 'getMessages' : ActorMethod<[GetMessagesArgs], Result_12>,
199
+ 'getMyChats' : ActorMethod<[GetMyChatsArgs], Result_11>,
200
+ 'getProject' : ActorMethod<[GetProjectArgs], Result_1>,
201
+ 'getQuotaLimits' : ActorMethod<[], Result_2>,
202
+ 'getRoom' : ActorMethod<[GetRoomArgs], Result>,
203
+ 'listProjectChats' : ActorMethod<[ListProjectChatsArgs], Result_10>,
204
+ 'listProjects' : ActorMethod<[ListProjectsArgs], Result_9>,
205
+ 'listRooms' : ActorMethod<[ListRoomsArgs], Result_8>,
206
+ 'markRead' : ActorMethod<[MarkReadArgs], Result_3>,
207
+ 'openChat' : ActorMethod<[OpenChatArgs], Result_7>,
208
+ 'pollNewMessages' : ActorMethod<[PollNewMessagesArgs], Result_6>,
209
+ 'post' : ActorMethod<[PostArgs], Result_5>,
210
+ 'purgeChat' : ActorMethod<[PurgeChatArgs], Result_3>,
211
+ 'registerAsAdmin' : ActorMethod<[], Result_4>,
212
+ 'removeAdmin' : ActorMethod<[RemoveAdminArgs], Result_3>,
213
+ 'setLoggingEnabled' : ActorMethod<[SetLoggingEnabledArgs], Result_3>,
214
+ 'setQuotaLimits' : ActorMethod<[SetQuotaLimitsArgs], Result_2>,
215
+ 'updateProject' : ActorMethod<[UpdateProjectArgs], Result_1>,
216
+ 'updateRoom' : ActorMethod<[UpdateRoomArgs], Result>,
194
217
  'whoAmI' : ActorMethod<[], Principal>,
195
218
  }
196
219
  export declare const idlFactory: IDL.InterfaceFactory;
@@ -10,93 +10,82 @@ 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
+ 'accountsCanister' : IDL.Principal,
18
+ 'admins' : IDL.Vec(IDL.Principal),
19
+ });
20
+ const Project = IDL.Record({
21
+ 'id' : ProjectId,
22
+ 'createdAt' : IDL.Int,
23
+ 'createdBy' : IDL.Principal,
24
+ 'accountsCanister' : IDL.Principal,
25
+ 'admins' : IDL.Vec(IDL.Principal),
26
+ });
27
+ const Result_1 = IDL.Variant({ 'ok' : Project, 'err' : Error });
28
+ const RoomId = IDL.Text;
29
+ const RecipientRole = IDL.Variant({
30
+ 'agent' : IDL.Null,
31
+ 'worker' : IDL.Null,
32
+ });
33
+ const Recipient = IDL.Record({
34
+ 'principal' : IDL.Principal,
35
+ 'displayName' : IDL.Text,
36
+ 'role' : RecipientRole,
37
+ });
38
+ const CreateRoomArgs = IDL.Record({
39
+ 'id' : RoomId,
40
+ 'name' : IDL.Text,
41
+ 'recipients' : IDL.Vec(Recipient),
42
+ 'projectId' : ProjectId,
43
+ });
44
+ const Room = IDL.Record({
45
+ 'id' : RoomId,
46
+ 'name' : IDL.Text,
47
+ 'createdAt' : IDL.Int,
48
+ 'createdBy' : IDL.Principal,
49
+ 'recipients' : IDL.Vec(Recipient),
50
+ 'projectId' : ProjectId,
51
+ });
52
+ const Result = IDL.Variant({ 'ok' : Room, 'err' : Error });
53
+ const Result_13 = IDL.Variant({
54
+ 'ok' : IDL.Vec(IDL.Principal),
55
+ 'err' : Error,
56
+ });
14
57
  const ChatId = IDL.Text;
15
- const CloseChatArgs = IDL.Record({ 'chatId' : ChatId });
16
- const ChatStatus = IDL.Variant({ 'closed' : IDL.Null, 'open' : IDL.Null });
58
+ const GetChatArgs = IDL.Record({ 'chatId' : ChatId });
17
59
  const Role = IDL.Variant({
18
- 'member' : IDL.Null,
19
- 'admin' : IDL.Null,
20
60
  'agent' : IDL.Null,
21
- 'owner' : IDL.Null,
61
+ 'customer' : IDL.Null,
62
+ 'worker' : IDL.Null,
22
63
  });
23
- const Member = IDL.Record({
64
+ const Participant = IDL.Record({
24
65
  'principal' : IDL.Principal,
66
+ 'displayName' : IDL.Text,
67
+ 'firstPostSeq' : IDL.Opt(IDL.Nat),
25
68
  'joinedAt' : IDL.Int,
26
69
  'role' : Role,
27
70
  'lastReadSeq' : IDL.Nat,
28
71
  });
29
- const ProjectId = IDL.Text;
30
- const Policy = IDL.Record({ 'agentsReply' : IDL.Bool });
31
72
  const Chat = IDL.Record({
32
73
  'id' : ChatId,
33
- 'status' : ChatStatus,
34
- 'title' : IDL.Opt(IDL.Text),
35
- 'members' : IDL.Vec(Member),
74
+ 'participants' : IDL.Vec(Participant),
36
75
  'lastMessageAt' : IDL.Int,
37
- 'subject' : IDL.Opt(IDL.Text),
76
+ 'customer' : IDL.Principal,
38
77
  'createdAt' : IDL.Int,
39
- 'createdBy' : IDL.Principal,
40
78
  'projectId' : ProjectId,
79
+ 'roomId' : RoomId,
41
80
  'lastSeq' : IDL.Nat,
42
- 'policy' : Policy,
43
81
  });
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 });
82
+ const Result_7 = IDL.Variant({ 'ok' : Chat, 'err' : Error });
79
83
  const GetMessagesArgs = IDL.Record({
80
84
  'limit' : IDL.Opt(IDL.Nat),
81
85
  'chatId' : ChatId,
82
86
  'sinceSeq' : IDL.Nat,
83
87
  });
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
- });
88
+ const SystemEvent = IDL.Variant({ 'chatCreated' : IDL.Null });
100
89
  const MessageKind = IDL.Variant({
101
90
  'toolTrace' : IDL.Null,
102
91
  'text' : IDL.Null,
@@ -104,6 +93,7 @@ export const idlFactory = ({ IDL }) => {
104
93
  });
105
94
  const Message = IDL.Record({
106
95
  'seq' : IDL.Nat,
96
+ 'customer' : IDL.Principal,
107
97
  'kind' : MessageKind,
108
98
  'createdAt' : IDL.Int,
109
99
  'text' : IDL.Text,
@@ -111,29 +101,55 @@ export const idlFactory = ({ IDL }) => {
111
101
  'author' : IDL.Principal,
112
102
  'projectId' : ProjectId,
113
103
  'chatId' : ChatId,
104
+ 'roomId' : RoomId,
114
105
  });
115
106
  const MessagesPage = IDL.Record({
116
107
  'messages' : IDL.Vec(Message),
117
108
  'lastSeq' : IDL.Nat,
118
109
  });
119
- const Result_8 = IDL.Variant({ 'ok' : MessagesPage, 'err' : Error });
110
+ const Result_12 = IDL.Variant({ 'ok' : MessagesPage, 'err' : Error });
120
111
  const GetMyChatsArgs = IDL.Record({
121
- 'subject' : IDL.Opt(IDL.Text),
122
- 'includeClosed' : IDL.Bool,
123
112
  'limit' : IDL.Opt(IDL.Nat),
124
113
  'projectId' : ProjectId,
114
+ 'roomId' : IDL.Opt(RoomId),
125
115
  });
126
- const Result_7 = IDL.Variant({ 'ok' : IDL.Vec(Chat), 'err' : Error });
116
+ const Result_11 = IDL.Variant({ 'ok' : IDL.Vec(Chat), 'err' : Error });
127
117
  const GetProjectArgs = IDL.Record({ 'projectId' : ProjectId });
128
- const InviteMemberArgs = IDL.Record({
129
- 'principal' : IDL.Principal,
130
- 'role' : Role,
131
- 'chatId' : ChatId,
118
+ const QuotaLimits = IDL.Record({ 'chats' : IDL.Nat, 'posts' : IDL.Nat });
119
+ const Result_2 = IDL.Variant({ 'ok' : QuotaLimits, 'err' : Error });
120
+ const GetRoomArgs = IDL.Record({
121
+ 'projectId' : ProjectId,
122
+ 'roomId' : RoomId,
123
+ });
124
+ const ListProjectChatsArgs = IDL.Record({
125
+ 'limit' : IDL.Opt(IDL.Nat),
126
+ 'projectId' : ProjectId,
127
+ 'roomId' : IDL.Opt(RoomId),
132
128
  });
133
- const LeaveChatArgs = IDL.Record({ 'chatId' : ChatId });
129
+ const ChatSummary = IDL.Record({
130
+ 'id' : ChatId,
131
+ 'lastMessageAt' : IDL.Int,
132
+ 'customer' : IDL.Principal,
133
+ 'createdAt' : IDL.Int,
134
+ 'projectId' : ProjectId,
135
+ 'messageCount' : IDL.Nat,
136
+ 'participantCount' : IDL.Nat,
137
+ 'roomId' : RoomId,
138
+ });
139
+ const Result_10 = IDL.Variant({ 'ok' : IDL.Vec(ChatSummary), 'err' : Error });
134
140
  const ListProjectsArgs = IDL.Record({ 'limit' : IDL.Opt(IDL.Nat) });
135
- const Result_6 = IDL.Variant({ 'ok' : IDL.Vec(Project), 'err' : Error });
141
+ const Result_9 = IDL.Variant({ 'ok' : IDL.Vec(Project), 'err' : Error });
142
+ const ListRoomsArgs = IDL.Record({
143
+ 'limit' : IDL.Opt(IDL.Nat),
144
+ 'projectId' : ProjectId,
145
+ });
146
+ const Result_8 = IDL.Variant({ 'ok' : IDL.Vec(Room), 'err' : Error });
136
147
  const MarkReadArgs = IDL.Record({ 'seq' : IDL.Nat, 'chatId' : ChatId });
148
+ const OpenChatArgs = IDL.Record({
149
+ 'customerName' : IDL.Opt(IDL.Text),
150
+ 'projectId' : ProjectId,
151
+ 'roomId' : RoomId,
152
+ });
137
153
  const PollNewMessagesArgs = IDL.Record({
138
154
  'limit' : IDL.Opt(IDL.Nat),
139
155
  'sinceGlobalSeq' : IDL.Nat,
@@ -143,55 +159,61 @@ export const idlFactory = ({ IDL }) => {
143
159
  'headGlobalSeq' : IDL.Nat,
144
160
  'messages' : IDL.Vec(Message),
145
161
  });
146
- const Result_5 = IDL.Variant({ 'ok' : PollResult, 'err' : Error });
162
+ const Result_6 = IDL.Variant({ 'ok' : PollResult, 'err' : Error });
147
163
  const PostKind = IDL.Variant({ 'toolTrace' : IDL.Null, 'text' : IDL.Null });
148
164
  const PostArgs = IDL.Record({
149
165
  'kind' : PostKind,
150
166
  'text' : IDL.Text,
151
167
  'chatId' : ChatId,
152
168
  });
153
- const Result_4 = IDL.Variant({ 'ok' : Message, 'err' : Error });
169
+ const Result_5 = IDL.Variant({ 'ok' : Message, 'err' : Error });
154
170
  const PurgeChatArgs = IDL.Record({ 'chatId' : ChatId });
155
- const Result_3 = IDL.Variant({ 'ok' : IDL.Principal, 'err' : Error });
171
+ const Result_4 = IDL.Variant({ 'ok' : IDL.Principal, 'err' : Error });
156
172
  const RemoveAdminArgs = IDL.Record({ 'principal' : IDL.Principal });
157
- const RemoveMemberArgs = IDL.Record({
158
- 'principal' : IDL.Principal,
159
- 'chatId' : ChatId,
160
- });
161
173
  const SetLoggingEnabledArgs = IDL.Record({ 'enabled' : IDL.Bool });
162
- const SetPolicyArgs = IDL.Record({ 'chatId' : ChatId, 'policy' : Policy });
174
+ const SetQuotaLimitsArgs = IDL.Record({ 'limits' : QuotaLimits });
163
175
  const UpdateProjectArgs = IDL.Record({
164
- 'agents' : IDL.Opt(IDL.Vec(IDL.Principal)),
176
+ 'accountsCanister' : IDL.Opt(IDL.Principal),
165
177
  'projectId' : ProjectId,
166
178
  'admins' : IDL.Opt(IDL.Vec(IDL.Principal)),
167
- 'agentsMayInvite' : IDL.Opt(IDL.Bool),
168
- 'defaultPolicy' : IDL.Opt(Policy),
179
+ });
180
+ const UpdateRoomArgs = IDL.Record({
181
+ 'name' : IDL.Opt(IDL.Text),
182
+ 'recipients' : IDL.Opt(IDL.Vec(Recipient)),
183
+ 'projectId' : ProjectId,
184
+ 'roomId' : RoomId,
169
185
  });
170
186
  return IDL.Service({
171
- 'addAdmin' : IDL.Func([AddAdminArgs], [Result_2], []),
187
+ 'addAdmin' : IDL.Func([AddAdminArgs], [Result_3], []),
172
188
  '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']),
189
+ 'createProject' : IDL.Func([CreateProjectArgs], [Result_1], []),
190
+ 'createRoom' : IDL.Func([CreateRoomArgs], [Result], []),
191
+ 'getAdmins' : IDL.Func([], [Result_13], ['query']),
192
+ 'getChat' : IDL.Func([GetChatArgs], [Result_7], ['query']),
178
193
  '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], []),
194
+ 'getMessages' : IDL.Func([GetMessagesArgs], [Result_12], ['query']),
195
+ 'getMyChats' : IDL.Func([GetMyChatsArgs], [Result_11], ['query']),
196
+ 'getProject' : IDL.Func([GetProjectArgs], [Result_1], ['query']),
197
+ 'getQuotaLimits' : IDL.Func([], [Result_2], ['query']),
198
+ 'getRoom' : IDL.Func([GetRoomArgs], [Result], ['query']),
199
+ 'listProjectChats' : IDL.Func(
200
+ [ListProjectChatsArgs],
201
+ [Result_10],
202
+ ['query'],
203
+ ),
204
+ 'listProjects' : IDL.Func([ListProjectsArgs], [Result_9], ['query']),
205
+ 'listRooms' : IDL.Func([ListRoomsArgs], [Result_8], ['query']),
206
+ 'markRead' : IDL.Func([MarkReadArgs], [Result_3], []),
207
+ 'openChat' : IDL.Func([OpenChatArgs], [Result_7], []),
208
+ 'pollNewMessages' : IDL.Func([PollNewMessagesArgs], [Result_6], ['query']),
209
+ 'post' : IDL.Func([PostArgs], [Result_5], []),
210
+ 'purgeChat' : IDL.Func([PurgeChatArgs], [Result_3], []),
211
+ 'registerAsAdmin' : IDL.Func([], [Result_4], []),
212
+ 'removeAdmin' : IDL.Func([RemoveAdminArgs], [Result_3], []),
213
+ 'setLoggingEnabled' : IDL.Func([SetLoggingEnabledArgs], [Result_3], []),
214
+ 'setQuotaLimits' : IDL.Func([SetQuotaLimitsArgs], [Result_2], []),
215
+ 'updateProject' : IDL.Func([UpdateProjectArgs], [Result_1], []),
216
+ 'updateRoom' : IDL.Func([UpdateRoomArgs], [Result], []),
195
217
  'whoAmI' : IDL.Func([], [IDL.Principal], ['query']),
196
218
  });
197
219
  };
@@ -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"}