@meshagent/meshagent 0.38.4 → 0.39.1
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/CHANGELOG.md +14 -2
- package/dist/browser/datasets-client.d.ts +415 -0
- package/dist/{node/database-client.js → browser/datasets-client.js} +480 -234
- package/dist/browser/entrypoint.js +9 -17
- package/dist/browser/index.d.ts +1 -2
- package/dist/browser/index.js +1 -2
- package/dist/browser/meshagent-client.d.ts +179 -3
- package/dist/browser/meshagent-client.js +333 -25
- package/dist/browser/participant-token.d.ts +5 -5
- package/dist/browser/participant-token.js +14 -13
- package/dist/browser/room-client.d.ts +5 -3
- package/dist/browser/room-client.js +70 -4
- package/dist/esm/datasets-client.d.ts +415 -0
- package/dist/esm/{database-client.js → datasets-client.js} +473 -227
- package/dist/esm/entrypoint.js +6 -12
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.js +1 -2
- package/dist/esm/meshagent-client.d.ts +179 -3
- package/dist/esm/meshagent-client.js +333 -25
- package/dist/esm/participant-token.d.ts +5 -5
- package/dist/esm/participant-token.js +12 -11
- package/dist/esm/room-client.d.ts +5 -3
- package/dist/esm/room-client.js +70 -4
- package/dist/node/datasets-client.d.ts +415 -0
- package/dist/{browser/database-client.js → node/datasets-client.js} +480 -234
- package/dist/node/entrypoint.js +6 -12
- package/dist/node/index.d.ts +1 -2
- package/dist/node/index.js +1 -2
- package/dist/node/meshagent-client.d.ts +179 -3
- package/dist/node/meshagent-client.js +333 -25
- package/dist/node/participant-token.d.ts +5 -5
- package/dist/node/participant-token.js +14 -13
- package/dist/node/room-client.d.ts +5 -3
- package/dist/node/room-client.js +70 -4
- package/package.json +3 -2
- package/dist/browser/data-types.d.ts +0 -67
- package/dist/browser/data-types.js +0 -192
- package/dist/browser/database-client.d.ts +0 -281
- package/dist/esm/data-types.d.ts +0 -67
- package/dist/esm/data-types.js +0 -179
- package/dist/esm/database-client.d.ts +0 -281
- package/dist/node/data-types.d.ts +0 -67
- package/dist/node/data-types.js +0 -192
- package/dist/node/database-client.d.ts +0 -281
|
@@ -223,6 +223,102 @@ export class Meshagent {
|
|
|
223
223
|
annotations: annotations && typeof annotations === "object" ? annotations : {},
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
+
parseFeed(data) {
|
|
227
|
+
if (!data || typeof data !== "object") {
|
|
228
|
+
throw new RoomException("Invalid feed payload");
|
|
229
|
+
}
|
|
230
|
+
const { id, project_id: projectIdRaw, projectId, created_at: createdAtRaw, createdAt, name, description, visibility, paused, annotations, message_schema: messageSchemaRaw, messageSchema, } = data;
|
|
231
|
+
const projectIdValue = typeof projectId === "string"
|
|
232
|
+
? projectId
|
|
233
|
+
: typeof projectIdRaw === "string"
|
|
234
|
+
? projectIdRaw
|
|
235
|
+
: undefined;
|
|
236
|
+
const createdAtValue = typeof createdAt === "string"
|
|
237
|
+
? createdAt
|
|
238
|
+
: typeof createdAtRaw === "string"
|
|
239
|
+
? createdAtRaw
|
|
240
|
+
: undefined;
|
|
241
|
+
const visibilityValue = visibility === "public" || visibility === "project" || visibility === "private"
|
|
242
|
+
? visibility
|
|
243
|
+
: undefined;
|
|
244
|
+
const messageSchemaValue = typeof messageSchema === "boolean" || (messageSchema && typeof messageSchema === "object")
|
|
245
|
+
? messageSchema
|
|
246
|
+
: typeof messageSchemaRaw === "boolean" || (messageSchemaRaw && typeof messageSchemaRaw === "object")
|
|
247
|
+
? messageSchemaRaw
|
|
248
|
+
: null;
|
|
249
|
+
if (typeof id !== "string" ||
|
|
250
|
+
typeof projectIdValue !== "string" ||
|
|
251
|
+
typeof createdAtValue !== "string" ||
|
|
252
|
+
typeof name !== "string" ||
|
|
253
|
+
visibilityValue === undefined) {
|
|
254
|
+
throw new RoomException("Invalid feed payload: missing required fields");
|
|
255
|
+
}
|
|
256
|
+
return {
|
|
257
|
+
id,
|
|
258
|
+
projectId: projectIdValue,
|
|
259
|
+
createdAt: new Date(createdAtValue),
|
|
260
|
+
name,
|
|
261
|
+
description: typeof description === "string" ? description : "",
|
|
262
|
+
visibility: visibilityValue,
|
|
263
|
+
paused: paused === true,
|
|
264
|
+
annotations: annotations && typeof annotations === "object" ? annotations : {},
|
|
265
|
+
messageSchema: messageSchemaValue,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
parseFeedSubscription(data) {
|
|
269
|
+
if (!data || typeof data !== "object") {
|
|
270
|
+
throw new RoomException("Invalid feed subscription payload");
|
|
271
|
+
}
|
|
272
|
+
const { id, feed_id: feedIdRaw, feedId, project_id: projectIdRaw, projectId, room, room_id: roomIdRaw, roomId, path, created_at: createdAtRaw, createdAt, annotations, } = data;
|
|
273
|
+
const feedIdValue = typeof feedId === "string" ? feedId : feedIdRaw;
|
|
274
|
+
const projectIdValue = typeof projectId === "string" ? projectId : projectIdRaw;
|
|
275
|
+
const createdAtValue = typeof createdAt === "string" ? createdAt : createdAtRaw;
|
|
276
|
+
const roomIdValue = typeof roomId === "string" ? roomId : roomIdRaw;
|
|
277
|
+
if (typeof id !== "string" ||
|
|
278
|
+
typeof feedIdValue !== "string" ||
|
|
279
|
+
typeof projectIdValue !== "string" ||
|
|
280
|
+
typeof room !== "string" ||
|
|
281
|
+
typeof path !== "string" ||
|
|
282
|
+
typeof createdAtValue !== "string") {
|
|
283
|
+
throw new RoomException("Invalid feed subscription payload: missing required fields");
|
|
284
|
+
}
|
|
285
|
+
return {
|
|
286
|
+
id,
|
|
287
|
+
feedId: feedIdValue,
|
|
288
|
+
projectId: projectIdValue,
|
|
289
|
+
room,
|
|
290
|
+
roomId: typeof roomIdValue === "string" ? roomIdValue : undefined,
|
|
291
|
+
path,
|
|
292
|
+
createdAt: new Date(createdAtValue),
|
|
293
|
+
annotations: annotations && typeof annotations === "object" ? annotations : {},
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
parseLLMLogger(data) {
|
|
297
|
+
if (!data || typeof data !== "object") {
|
|
298
|
+
throw new RoomException("Invalid LLM logger payload");
|
|
299
|
+
}
|
|
300
|
+
const { id, project_id: projectIdRaw, projectId, destination_feed_id: destinationFeedIdRaw, destinationFeedId, filter_expression: filterExpressionRaw, filterExpression, paused, created_at: createdAtRaw, createdAt, annotations, } = data;
|
|
301
|
+
const projectIdValue = typeof projectId === "string" ? projectId : projectIdRaw;
|
|
302
|
+
const destinationFeedIdValue = typeof destinationFeedId === "string" ? destinationFeedId : destinationFeedIdRaw;
|
|
303
|
+
const filterExpressionValue = typeof filterExpression === "string" ? filterExpression : filterExpressionRaw;
|
|
304
|
+
const createdAtValue = typeof createdAt === "string" ? createdAt : createdAtRaw;
|
|
305
|
+
if (typeof id !== "string" ||
|
|
306
|
+
typeof projectIdValue !== "string" ||
|
|
307
|
+
typeof destinationFeedIdValue !== "string" ||
|
|
308
|
+
typeof filterExpressionValue !== "string" ||
|
|
309
|
+
typeof createdAtValue !== "string") {
|
|
310
|
+
throw new RoomException("Invalid LLM logger payload: missing required fields");
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
id,
|
|
314
|
+
projectId: projectIdValue,
|
|
315
|
+
destinationFeedId: destinationFeedIdValue,
|
|
316
|
+
filterExpression: filterExpressionValue,
|
|
317
|
+
paused: paused === true,
|
|
318
|
+
createdAt: new Date(createdAtValue),
|
|
319
|
+
annotations: annotations && typeof annotations === "object" ? annotations : {},
|
|
320
|
+
};
|
|
321
|
+
}
|
|
226
322
|
parseProjectRepository(data) {
|
|
227
323
|
if (!data || typeof data !== "object") {
|
|
228
324
|
throw new RoomException("Invalid repository payload");
|
|
@@ -310,11 +406,17 @@ export class Meshagent {
|
|
|
310
406
|
const threshold = data.auto_recharge_threshold ?? data.autoRechargeThreshold;
|
|
311
407
|
const amount = data.auto_recharge_amount ?? data.autoRechargeAmount;
|
|
312
408
|
const lastRechargeRaw = data.last_recharge ?? data.lastRecharge;
|
|
409
|
+
const monthlyBudget = data.monthly_budget ?? data.monthlyBudget;
|
|
410
|
+
const autoRechargePaused = data.auto_recharge_paused ?? data.autoRechargePaused;
|
|
411
|
+
const autoRechargedThisMonth = data.auto_recharged_this_month ?? data.autoRechargedThisMonth;
|
|
313
412
|
return {
|
|
314
413
|
balance: balanceValue,
|
|
315
414
|
autoRechargeThreshold: typeof threshold === "number" ? threshold : null,
|
|
316
415
|
autoRechargeAmount: typeof amount === "number" ? amount : null,
|
|
317
416
|
lastRecharge: typeof lastRechargeRaw === "string" ? new Date(lastRechargeRaw) : null,
|
|
417
|
+
monthlyBudget: typeof monthlyBudget === "number" ? monthlyBudget : null,
|
|
418
|
+
autoRechargePaused: autoRechargePaused === true,
|
|
419
|
+
autoRechargedThisMonth: typeof autoRechargedThisMonth === "number" ? autoRechargedThisMonth : null,
|
|
318
420
|
};
|
|
319
421
|
}
|
|
320
422
|
parseTransaction(data) {
|
|
@@ -669,10 +771,18 @@ export class Meshagent {
|
|
|
669
771
|
action: "update project settings",
|
|
670
772
|
});
|
|
671
773
|
}
|
|
672
|
-
async
|
|
673
|
-
|
|
774
|
+
async getUsersInProjectPage(projectId, options = {}) {
|
|
775
|
+
const { count = 100, offset = 0, filter } = options;
|
|
776
|
+
const data = await this.request(`/accounts/projects/${projectId}/users`, {
|
|
777
|
+
query: { count, offset, filter },
|
|
674
778
|
action: "fetch project users",
|
|
675
779
|
});
|
|
780
|
+
const users = Array.isArray(data?.users) ? data.users : [];
|
|
781
|
+
return { users, total: typeof data?.total === "number" ? data.total : users.length };
|
|
782
|
+
}
|
|
783
|
+
async getUsersInProject(projectId) {
|
|
784
|
+
const page = await this.getUsersInProjectPage(projectId);
|
|
785
|
+
return { users: page.users, total: page.total };
|
|
676
786
|
}
|
|
677
787
|
async getUserProfile(userId) {
|
|
678
788
|
return await this.request(`/accounts/profiles/${userId}`, {
|
|
@@ -743,10 +853,10 @@ export class Meshagent {
|
|
|
743
853
|
const list = Array.isArray(data?.transactions) ? data.transactions : [];
|
|
744
854
|
return list.map((item) => this.parseTransaction(item));
|
|
745
855
|
}
|
|
746
|
-
async setAutoRecharge({ projectId, enabled, amount, threshold }) {
|
|
856
|
+
async setAutoRecharge({ projectId, enabled, amount, threshold, monthlyBudget = null, }) {
|
|
747
857
|
await this.request(`/accounts/projects/${projectId}/recharge`, {
|
|
748
858
|
method: "POST",
|
|
749
|
-
json: { enabled, amount, threshold },
|
|
859
|
+
json: { enabled, amount, threshold, monthly_budget: monthlyBudget },
|
|
750
860
|
action: "update auto recharge settings",
|
|
751
861
|
responseType: "void",
|
|
752
862
|
});
|
|
@@ -781,7 +891,7 @@ export class Meshagent {
|
|
|
781
891
|
});
|
|
782
892
|
}
|
|
783
893
|
async getUsage(projectId, options = {}) {
|
|
784
|
-
const { start, end, interval, report, users, room, provider, model, usageType } = options;
|
|
894
|
+
const { start, end, interval, report, users, room, provider, model, usageType, client, annotations } = options;
|
|
785
895
|
const data = await this.request(`/accounts/projects/${projectId}/usage`, {
|
|
786
896
|
query: {
|
|
787
897
|
start: start ? start.toISOString() : undefined,
|
|
@@ -793,6 +903,8 @@ export class Meshagent {
|
|
|
793
903
|
provider: provider && provider.trim().length > 0 ? provider.trim() : undefined,
|
|
794
904
|
model: model && model.trim().length > 0 ? model.trim() : undefined,
|
|
795
905
|
usage_type: usageType && usageType.trim().length > 0 ? usageType.trim() : undefined,
|
|
906
|
+
client: client && client.trim().length > 0 ? client.trim() : undefined,
|
|
907
|
+
annotations: annotations && Object.keys(annotations).length > 0 ? JSON.stringify(annotations) : undefined,
|
|
796
908
|
},
|
|
797
909
|
action: "retrieve usage",
|
|
798
910
|
});
|
|
@@ -895,24 +1007,32 @@ export class Meshagent {
|
|
|
895
1007
|
responseType: "void",
|
|
896
1008
|
});
|
|
897
1009
|
}
|
|
898
|
-
|
|
1010
|
+
parseMailbox(item) {
|
|
1011
|
+
if (!item || typeof item !== "object") {
|
|
1012
|
+
throw new RoomException("Invalid mailbox payload");
|
|
1013
|
+
}
|
|
1014
|
+
const { address, room, room_id, queue } = item;
|
|
1015
|
+
if (typeof address !== "string" || typeof room !== "string" || typeof queue !== "string") {
|
|
1016
|
+
throw new RoomException("Invalid mailbox payload: missing fields");
|
|
1017
|
+
}
|
|
1018
|
+
if (room_id !== undefined && typeof room_id !== "string") {
|
|
1019
|
+
throw new RoomException("Invalid mailbox payload: invalid room_id");
|
|
1020
|
+
}
|
|
1021
|
+
return { address, room, roomId: room_id, queue };
|
|
1022
|
+
}
|
|
1023
|
+
async listMailboxesPage(projectId, options = {}) {
|
|
1024
|
+
const { count = 100, offset = 0, filter } = options;
|
|
899
1025
|
const data = await this.request(`/accounts/projects/${projectId}/mailboxes`, {
|
|
1026
|
+
query: { count, offset, filter },
|
|
900
1027
|
action: "list mailboxes",
|
|
901
1028
|
});
|
|
902
1029
|
const mailboxes = Array.isArray(data?.mailboxes) ? data.mailboxes : [];
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
throw new RoomException("Invalid mailbox payload: missing fields");
|
|
910
|
-
}
|
|
911
|
-
if (room_id !== undefined && typeof room_id !== "string") {
|
|
912
|
-
throw new RoomException("Invalid mailbox payload: invalid room_id");
|
|
913
|
-
}
|
|
914
|
-
return { address, room, roomId: room_id, queue };
|
|
915
|
-
});
|
|
1030
|
+
const parsed = mailboxes.map((item) => this.parseMailbox(item));
|
|
1031
|
+
return { mailboxes: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
|
|
1032
|
+
}
|
|
1033
|
+
async listMailboxes(projectId, options = {}) {
|
|
1034
|
+
const page = await this.listMailboxesPage(projectId, options);
|
|
1035
|
+
return page.mailboxes;
|
|
916
1036
|
}
|
|
917
1037
|
async deleteMailbox(projectId, address) {
|
|
918
1038
|
await this.request(`/accounts/projects/${projectId}/mailboxes/${address}`, {
|
|
@@ -921,6 +1041,182 @@ export class Meshagent {
|
|
|
921
1041
|
responseType: "void",
|
|
922
1042
|
});
|
|
923
1043
|
}
|
|
1044
|
+
async createFeed(params) {
|
|
1045
|
+
const { projectId, name, description = "", visibility = "private", paused = false, annotations = {}, messageSchema = null, } = params;
|
|
1046
|
+
const data = await this.request(`/accounts/projects/${projectId}/feeds`, {
|
|
1047
|
+
method: "POST",
|
|
1048
|
+
json: {
|
|
1049
|
+
name,
|
|
1050
|
+
description,
|
|
1051
|
+
visibility,
|
|
1052
|
+
paused,
|
|
1053
|
+
annotations,
|
|
1054
|
+
message_schema: messageSchema,
|
|
1055
|
+
},
|
|
1056
|
+
action: "create feed",
|
|
1057
|
+
});
|
|
1058
|
+
return this.parseFeed(data.feed);
|
|
1059
|
+
}
|
|
1060
|
+
async updateFeed(params) {
|
|
1061
|
+
const { projectId, feedId, name, description = "", paused = false, annotations = {}, messageSchema = null, } = params;
|
|
1062
|
+
await this.request(`/accounts/projects/${projectId}/feeds/${feedId}`, {
|
|
1063
|
+
method: "PUT",
|
|
1064
|
+
json: {
|
|
1065
|
+
name,
|
|
1066
|
+
description,
|
|
1067
|
+
paused,
|
|
1068
|
+
annotations,
|
|
1069
|
+
message_schema: messageSchema,
|
|
1070
|
+
},
|
|
1071
|
+
action: "update feed",
|
|
1072
|
+
responseType: "void",
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
async getFeed(projectId, feedId) {
|
|
1076
|
+
const data = await this.request(`/accounts/projects/${projectId}/feeds/${feedId}`, {
|
|
1077
|
+
action: "get feed",
|
|
1078
|
+
});
|
|
1079
|
+
return this.parseFeed(data.feed);
|
|
1080
|
+
}
|
|
1081
|
+
async listFeedsPage(projectId, options = {}) {
|
|
1082
|
+
const { count = 100, offset = 0, filter } = options;
|
|
1083
|
+
const data = await this.request(`/accounts/projects/${projectId}/feeds`, {
|
|
1084
|
+
query: { count, offset, filter },
|
|
1085
|
+
action: "list feeds",
|
|
1086
|
+
});
|
|
1087
|
+
const feeds = Array.isArray(data?.feeds) ? data.feeds : [];
|
|
1088
|
+
const parsed = feeds.map((item) => this.parseFeed(item));
|
|
1089
|
+
return { feeds: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
|
|
1090
|
+
}
|
|
1091
|
+
async listFeeds(projectId, options = {}) {
|
|
1092
|
+
const page = await this.listFeedsPage(projectId, options);
|
|
1093
|
+
return page.feeds;
|
|
1094
|
+
}
|
|
1095
|
+
async listRoomFeedsPage(projectId, roomName, options = {}) {
|
|
1096
|
+
const { count = 100, offset = 0, filter } = options;
|
|
1097
|
+
const data = await this.request(`/accounts/projects/${projectId}/rooms/${roomName}/feeds`, {
|
|
1098
|
+
query: { count, offset, filter },
|
|
1099
|
+
action: "list room feeds",
|
|
1100
|
+
});
|
|
1101
|
+
const feeds = Array.isArray(data?.feeds) ? data.feeds : [];
|
|
1102
|
+
const parsed = feeds.map((item) => this.parseFeed(item));
|
|
1103
|
+
return { feeds: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
|
|
1104
|
+
}
|
|
1105
|
+
async listRoomFeeds(projectId, roomName, options = {}) {
|
|
1106
|
+
const page = await this.listRoomFeedsPage(projectId, roomName, options);
|
|
1107
|
+
return page.feeds;
|
|
1108
|
+
}
|
|
1109
|
+
async deleteFeed(projectId, feedId) {
|
|
1110
|
+
await this.request(`/accounts/projects/${projectId}/feeds/${feedId}`, {
|
|
1111
|
+
method: "DELETE",
|
|
1112
|
+
action: "delete feed",
|
|
1113
|
+
responseType: "void",
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
async publishFeedMessage(params) {
|
|
1117
|
+
const { projectId, feedId, message } = params;
|
|
1118
|
+
await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/messages`, {
|
|
1119
|
+
method: "POST",
|
|
1120
|
+
json: message,
|
|
1121
|
+
action: "publish feed message",
|
|
1122
|
+
responseType: "void",
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
async publishFeedBatch(params) {
|
|
1126
|
+
const { projectId, feedId, messages } = params;
|
|
1127
|
+
await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/messages/batch`, {
|
|
1128
|
+
method: "POST",
|
|
1129
|
+
json: messages,
|
|
1130
|
+
action: "publish feed messages",
|
|
1131
|
+
responseType: "void",
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
async createFeedSubscription(params) {
|
|
1135
|
+
const { projectId, feedId, room, path, annotations = {} } = params;
|
|
1136
|
+
const data = await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/subscriptions`, {
|
|
1137
|
+
method: "POST",
|
|
1138
|
+
json: { room, path, annotations },
|
|
1139
|
+
action: "create feed subscription",
|
|
1140
|
+
});
|
|
1141
|
+
return this.parseFeedSubscription(data.subscription);
|
|
1142
|
+
}
|
|
1143
|
+
async updateFeedSubscription(params) {
|
|
1144
|
+
const { projectId, feedId, subscriptionId, annotations = {} } = params;
|
|
1145
|
+
await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/subscriptions/${subscriptionId}`, {
|
|
1146
|
+
method: "PUT",
|
|
1147
|
+
json: { annotations },
|
|
1148
|
+
action: "update feed subscription",
|
|
1149
|
+
responseType: "void",
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
async getFeedSubscription(projectId, feedId, subscriptionId) {
|
|
1153
|
+
const data = await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/subscriptions/${subscriptionId}`, {
|
|
1154
|
+
action: "get feed subscription",
|
|
1155
|
+
});
|
|
1156
|
+
return this.parseFeedSubscription(data.subscription);
|
|
1157
|
+
}
|
|
1158
|
+
async listFeedSubscriptions(projectId, feedId) {
|
|
1159
|
+
const data = await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/subscriptions`, {
|
|
1160
|
+
action: "list feed subscriptions",
|
|
1161
|
+
});
|
|
1162
|
+
const subscriptions = Array.isArray(data?.subscriptions) ? data.subscriptions : [];
|
|
1163
|
+
return subscriptions.map((item) => this.parseFeedSubscription(item));
|
|
1164
|
+
}
|
|
1165
|
+
async deleteFeedSubscription(projectId, feedId, subscriptionId) {
|
|
1166
|
+
await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/subscriptions/${subscriptionId}`, {
|
|
1167
|
+
method: "DELETE",
|
|
1168
|
+
action: "delete feed subscription",
|
|
1169
|
+
responseType: "void",
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
async createLLMLogger(params) {
|
|
1173
|
+
const { projectId, destinationFeedId, filterExpression, paused = false, annotations = {} } = params;
|
|
1174
|
+
const data = await this.request(`/accounts/projects/${projectId}/llm-loggers`, {
|
|
1175
|
+
method: "POST",
|
|
1176
|
+
json: {
|
|
1177
|
+
destination_feed_id: destinationFeedId,
|
|
1178
|
+
filter_expression: filterExpression,
|
|
1179
|
+
paused,
|
|
1180
|
+
annotations,
|
|
1181
|
+
},
|
|
1182
|
+
action: "create LLM logger",
|
|
1183
|
+
});
|
|
1184
|
+
return this.parseLLMLogger(data.logger);
|
|
1185
|
+
}
|
|
1186
|
+
async updateLLMLogger(params) {
|
|
1187
|
+
const { projectId, loggerId, destinationFeedId, filterExpression, paused = false, annotations = {} } = params;
|
|
1188
|
+
await this.request(`/accounts/projects/${projectId}/llm-loggers/${loggerId}`, {
|
|
1189
|
+
method: "PUT",
|
|
1190
|
+
json: {
|
|
1191
|
+
destination_feed_id: destinationFeedId,
|
|
1192
|
+
filter_expression: filterExpression,
|
|
1193
|
+
paused,
|
|
1194
|
+
annotations,
|
|
1195
|
+
},
|
|
1196
|
+
action: "update LLM logger",
|
|
1197
|
+
responseType: "void",
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
async getLLMLogger(projectId, loggerId) {
|
|
1201
|
+
const data = await this.request(`/accounts/projects/${projectId}/llm-loggers/${loggerId}`, {
|
|
1202
|
+
action: "get LLM logger",
|
|
1203
|
+
});
|
|
1204
|
+
return this.parseLLMLogger(data.logger);
|
|
1205
|
+
}
|
|
1206
|
+
async listLLMLoggers(projectId) {
|
|
1207
|
+
const data = await this.request(`/accounts/projects/${projectId}/llm-loggers`, {
|
|
1208
|
+
action: "list LLM loggers",
|
|
1209
|
+
});
|
|
1210
|
+
const loggers = Array.isArray(data?.loggers) ? data.loggers : [];
|
|
1211
|
+
return loggers.map((item) => this.parseLLMLogger(item));
|
|
1212
|
+
}
|
|
1213
|
+
async deleteLLMLogger(projectId, loggerId) {
|
|
1214
|
+
await this.request(`/accounts/projects/${projectId}/llm-loggers/${loggerId}`, {
|
|
1215
|
+
method: "DELETE",
|
|
1216
|
+
action: "delete LLM logger",
|
|
1217
|
+
responseType: "void",
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
924
1220
|
async createRepository(params) {
|
|
925
1221
|
const { projectId, name, description = "", annotations = {} } = params;
|
|
926
1222
|
const data = await this.request(`/accounts/projects/${projectId}/repositories`, {
|
|
@@ -1460,14 +1756,19 @@ export class Meshagent {
|
|
|
1460
1756
|
const rooms = Array.isArray(data?.rooms) ? data.rooms : [];
|
|
1461
1757
|
return rooms.map((item) => this.parseProjectRoomGrantCount(item));
|
|
1462
1758
|
}
|
|
1463
|
-
async
|
|
1464
|
-
const { limit =
|
|
1759
|
+
async listUniqueUsersWithGrantsPage(projectId, options = {}) {
|
|
1760
|
+
const { limit = 100, offset = 0, filter } = options;
|
|
1465
1761
|
const data = await this.request(`/accounts/projects/${projectId}/room-grants/by-user`, {
|
|
1466
|
-
query: { limit, offset },
|
|
1762
|
+
query: { limit, offset, filter },
|
|
1467
1763
|
action: "list unique users with grants",
|
|
1468
1764
|
});
|
|
1469
1765
|
const users = Array.isArray(data?.users) ? data.users : [];
|
|
1470
|
-
|
|
1766
|
+
const parsed = users.map((item) => this.parseProjectUserGrantCount(item));
|
|
1767
|
+
return { users: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
|
|
1768
|
+
}
|
|
1769
|
+
async listUniqueUsersWithGrants(projectId, options = {}) {
|
|
1770
|
+
const page = await this.listUniqueUsersWithGrantsPage(projectId, options);
|
|
1771
|
+
return page.users;
|
|
1471
1772
|
}
|
|
1472
1773
|
async createOAuthClient(projectId, params) {
|
|
1473
1774
|
const { grantTypes, responseTypes, redirectUris, scope, metadata = {} } = params;
|
|
@@ -1496,12 +1797,19 @@ export class Meshagent {
|
|
|
1496
1797
|
action: "update oauth client",
|
|
1497
1798
|
});
|
|
1498
1799
|
}
|
|
1499
|
-
async
|
|
1800
|
+
async listOAuthClientsPage(projectId, options = {}) {
|
|
1801
|
+
const { count = 100, offset = 0, filter } = options;
|
|
1500
1802
|
const data = await this.request(`/accounts/projects/${projectId}/oauth/clients`, {
|
|
1803
|
+
query: { count, offset, filter },
|
|
1501
1804
|
action: "list oauth clients",
|
|
1502
1805
|
});
|
|
1503
1806
|
const clients = Array.isArray(data?.clients) ? data.clients : [];
|
|
1504
|
-
|
|
1807
|
+
const parsed = clients.map((item) => this.parseOAuthClient(item));
|
|
1808
|
+
return { clients: parsed, total: typeof data?.total === "number" ? data.total : parsed.length };
|
|
1809
|
+
}
|
|
1810
|
+
async listOAuthClients(projectId, options = {}) {
|
|
1811
|
+
const page = await this.listOAuthClientsPage(projectId, options);
|
|
1812
|
+
return page.clients;
|
|
1505
1813
|
}
|
|
1506
1814
|
async getOAuthClient(projectId, clientId) {
|
|
1507
1815
|
const data = await this.request(`/accounts/projects/${projectId}/oauth/clients/${clientId}`, {
|
|
@@ -71,7 +71,7 @@ export declare class TableGrant {
|
|
|
71
71
|
toJSON(): Record<string, any>;
|
|
72
72
|
static fromJSON(obj: unknown): TableGrant;
|
|
73
73
|
}
|
|
74
|
-
export declare class
|
|
74
|
+
export declare class DatasetGrant {
|
|
75
75
|
tables?: TableGrant[];
|
|
76
76
|
listTables: boolean;
|
|
77
77
|
constructor({ tables, listTables, }?: {
|
|
@@ -84,7 +84,7 @@ export declare class DatabaseGrant {
|
|
|
84
84
|
canAlter(table: string, namespace?: StringList): boolean;
|
|
85
85
|
canAccess(table: string, namespace?: StringList): boolean;
|
|
86
86
|
toJSON(): Record<string, any>;
|
|
87
|
-
static fromJSON(obj: unknown):
|
|
87
|
+
static fromJSON(obj: unknown): DatasetGrant;
|
|
88
88
|
}
|
|
89
89
|
export declare class MemoryPermissions {
|
|
90
90
|
create: boolean;
|
|
@@ -290,7 +290,7 @@ export declare class ApiScope {
|
|
|
290
290
|
livekit?: LivekitGrant;
|
|
291
291
|
queues?: QueuesGrant;
|
|
292
292
|
messaging?: MessagingGrant;
|
|
293
|
-
|
|
293
|
+
dataset?: DatasetGrant;
|
|
294
294
|
memory?: MemoryGrant;
|
|
295
295
|
sync?: SyncGrant;
|
|
296
296
|
storage?: StorageGrant;
|
|
@@ -302,11 +302,11 @@ export declare class ApiScope {
|
|
|
302
302
|
secrets?: SecretsGrant;
|
|
303
303
|
tunnels?: TunnelsGrant;
|
|
304
304
|
services?: ServicesGrant;
|
|
305
|
-
constructor({ livekit, queues, messaging,
|
|
305
|
+
constructor({ livekit, queues, messaging, dataset, memory, sync, storage, containers, developer, agents, llm, admin, secrets, tunnels, services, }?: {
|
|
306
306
|
livekit?: LivekitGrant;
|
|
307
307
|
queues?: QueuesGrant;
|
|
308
308
|
messaging?: MessagingGrant;
|
|
309
|
-
|
|
309
|
+
dataset?: DatasetGrant;
|
|
310
310
|
memory?: MemoryGrant;
|
|
311
311
|
sync?: SyncGrant;
|
|
312
312
|
storage?: StorageGrant;
|
|
@@ -212,7 +212,7 @@ export class TableGrant {
|
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
export class
|
|
215
|
+
export class DatasetGrant {
|
|
216
216
|
constructor({ tables, listTables, } = {}) {
|
|
217
217
|
this.tables = tables;
|
|
218
218
|
this.listTables = listTables ?? true;
|
|
@@ -278,9 +278,9 @@ export class DatabaseGrant {
|
|
|
278
278
|
}
|
|
279
279
|
static fromJSON(obj) {
|
|
280
280
|
if (!isRecord(obj)) {
|
|
281
|
-
return new
|
|
281
|
+
return new DatasetGrant();
|
|
282
282
|
}
|
|
283
|
-
return new
|
|
283
|
+
return new DatasetGrant({
|
|
284
284
|
tables: Array.isArray(obj.tables)
|
|
285
285
|
? obj.tables.map((tableGrant) => TableGrant.fromJSON(tableGrant))
|
|
286
286
|
: undefined,
|
|
@@ -897,11 +897,11 @@ export class LLMGrant {
|
|
|
897
897
|
}
|
|
898
898
|
}
|
|
899
899
|
export class ApiScope {
|
|
900
|
-
constructor({ livekit, queues, messaging,
|
|
900
|
+
constructor({ livekit, queues, messaging, dataset, memory, sync, storage, containers, developer, agents, llm, admin, secrets, tunnels, services, } = {}) {
|
|
901
901
|
this.livekit = livekit;
|
|
902
902
|
this.queues = queues;
|
|
903
903
|
this.messaging = messaging;
|
|
904
|
-
this.
|
|
904
|
+
this.dataset = dataset;
|
|
905
905
|
this.memory = memory;
|
|
906
906
|
this.sync = sync;
|
|
907
907
|
this.storage = storage;
|
|
@@ -919,7 +919,7 @@ export class ApiScope {
|
|
|
919
919
|
livekit: new LivekitGrant(),
|
|
920
920
|
queues: new QueuesGrant(),
|
|
921
921
|
messaging: new MessagingGrant(),
|
|
922
|
-
|
|
922
|
+
dataset: new DatasetGrant(),
|
|
923
923
|
memory: new MemoryGrant(),
|
|
924
924
|
sync: new SyncGrant(),
|
|
925
925
|
storage: new StorageGrant(),
|
|
@@ -937,7 +937,7 @@ export class ApiScope {
|
|
|
937
937
|
livekit: new LivekitGrant(),
|
|
938
938
|
queues: new QueuesGrant(),
|
|
939
939
|
messaging: new MessagingGrant(),
|
|
940
|
-
|
|
940
|
+
dataset: new DatasetGrant(),
|
|
941
941
|
memory: new MemoryGrant(),
|
|
942
942
|
sync: new SyncGrant(),
|
|
943
943
|
storage: new StorageGrant(),
|
|
@@ -953,7 +953,7 @@ export class ApiScope {
|
|
|
953
953
|
livekit: new LivekitGrant(),
|
|
954
954
|
queues: new QueuesGrant(),
|
|
955
955
|
messaging: new MessagingGrant(),
|
|
956
|
-
|
|
956
|
+
dataset: new DatasetGrant(),
|
|
957
957
|
memory: new MemoryGrant(),
|
|
958
958
|
sync: new SyncGrant(),
|
|
959
959
|
storage: new StorageGrant(),
|
|
@@ -978,8 +978,8 @@ export class ApiScope {
|
|
|
978
978
|
if (this.messaging !== undefined) {
|
|
979
979
|
json["messaging"] = this.messaging.toJSON();
|
|
980
980
|
}
|
|
981
|
-
if (this.
|
|
982
|
-
json["
|
|
981
|
+
if (this.dataset !== undefined) {
|
|
982
|
+
json["dataset"] = this.dataset.toJSON();
|
|
983
983
|
}
|
|
984
984
|
if (this.memory !== undefined) {
|
|
985
985
|
json["memory"] = this.memory.toJSON();
|
|
@@ -1020,11 +1020,12 @@ export class ApiScope {
|
|
|
1020
1020
|
if (!isRecord(obj)) {
|
|
1021
1021
|
return new ApiScope();
|
|
1022
1022
|
}
|
|
1023
|
+
const rawDataset = obj.dataset ?? obj.database ?? obj.datasets;
|
|
1023
1024
|
return new ApiScope({
|
|
1024
1025
|
livekit: obj.livekit ? LivekitGrant.fromJSON(obj.livekit) : undefined,
|
|
1025
1026
|
queues: obj.queues ? QueuesGrant.fromJSON(obj.queues) : undefined,
|
|
1026
1027
|
messaging: obj.messaging ? MessagingGrant.fromJSON(obj.messaging) : undefined,
|
|
1027
|
-
|
|
1028
|
+
dataset: rawDataset ? DatasetGrant.fromJSON(rawDataset) : undefined,
|
|
1028
1029
|
memory: obj.memory ? MemoryGrant.fromJSON(obj.memory) : undefined,
|
|
1029
1030
|
sync: obj.sync ? SyncGrant.fromJSON(obj.sync) : undefined,
|
|
1030
1031
|
storage: obj.storage ? StorageGrant.fromJSON(obj.storage) : undefined,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DatasetsClient } from "./datasets-client";
|
|
2
2
|
import { DeveloperClient } from "./developer-client";
|
|
3
3
|
import { type EventHandler, type EventName } from "./event-emitter";
|
|
4
4
|
import { MessagingClient } from "./messaging-client";
|
|
@@ -52,7 +52,7 @@ export declare class RoomClient {
|
|
|
52
52
|
readonly developer: DeveloperClient;
|
|
53
53
|
readonly messaging: MessagingClient;
|
|
54
54
|
readonly queues: QueuesClient;
|
|
55
|
-
readonly
|
|
55
|
+
readonly datasets: DatasetsClient;
|
|
56
56
|
readonly agents: AgentsClient;
|
|
57
57
|
readonly secrets: SecretsClient;
|
|
58
58
|
readonly containers: ContainersClient;
|
|
@@ -111,7 +111,9 @@ export declare class RoomClient {
|
|
|
111
111
|
on(eventName: EventName, callback: EventHandler<RoomEvent>): void;
|
|
112
112
|
off(eventName: EventName, callback: EventHandler<RoomEvent>): void;
|
|
113
113
|
emit(event: RoomEvent): void;
|
|
114
|
-
listen(
|
|
114
|
+
listen({ abortSignal }?: {
|
|
115
|
+
abortSignal?: AbortSignal;
|
|
116
|
+
}): AsyncIterable<RoomEvent>;
|
|
115
117
|
waitForClose(): Promise<void>;
|
|
116
118
|
waitUntilConnected(): Promise<void>;
|
|
117
119
|
_waitUntilConnectedForMessages(): Promise<void>;
|