@meshagent/meshagent 0.38.3 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -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 +109 -1
- package/dist/browser/meshagent-client.js +269 -3
- 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 +109 -1
- package/dist/esm/meshagent-client.js +269 -3
- 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 +109 -1
- package/dist/node/meshagent-client.js +269 -3
- 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
|
@@ -8978,7 +8978,7 @@ if (glo[importIdentifier] === true) {
|
|
|
8978
8978
|
}
|
|
8979
8979
|
glo[importIdentifier] = true;
|
|
8980
8980
|
|
|
8981
|
-
// ../node_modules/uuid/dist/
|
|
8981
|
+
// ../node_modules/uuid/dist/stringify.js
|
|
8982
8982
|
var byteToHex = [];
|
|
8983
8983
|
for (let i = 0; i < 256; ++i) {
|
|
8984
8984
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -8987,28 +8987,20 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
8987
8987
|
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
8988
8988
|
}
|
|
8989
8989
|
|
|
8990
|
-
// ../node_modules/uuid/dist/
|
|
8991
|
-
var getRandomValues2;
|
|
8990
|
+
// ../node_modules/uuid/dist/rng.js
|
|
8992
8991
|
var rnds8 = new Uint8Array(16);
|
|
8993
8992
|
function rng() {
|
|
8994
|
-
|
|
8995
|
-
if (typeof crypto === "undefined" || !crypto.getRandomValues) {
|
|
8996
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
8997
|
-
}
|
|
8998
|
-
getRandomValues2 = crypto.getRandomValues.bind(crypto);
|
|
8999
|
-
}
|
|
9000
|
-
return getRandomValues2(rnds8);
|
|
8993
|
+
return crypto.getRandomValues(rnds8);
|
|
9001
8994
|
}
|
|
9002
8995
|
|
|
9003
|
-
// ../node_modules/uuid/dist/
|
|
9004
|
-
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
9005
|
-
var native_default = { randomUUID };
|
|
9006
|
-
|
|
9007
|
-
// ../node_modules/uuid/dist/esm-browser/v4.js
|
|
8996
|
+
// ../node_modules/uuid/dist/v4.js
|
|
9008
8997
|
function v4(options, buf, offset) {
|
|
9009
|
-
if (
|
|
9010
|
-
return
|
|
8998
|
+
if (!buf && !options && crypto.randomUUID) {
|
|
8999
|
+
return crypto.randomUUID();
|
|
9011
9000
|
}
|
|
9001
|
+
return _v4(options, buf, offset);
|
|
9002
|
+
}
|
|
9003
|
+
function _v4(options, buf, offset) {
|
|
9012
9004
|
options = options || {};
|
|
9013
9005
|
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
9014
9006
|
if (rnds.length < 16) {
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -4,8 +4,7 @@ export * from './event-emitter';
|
|
|
4
4
|
export * from './client';
|
|
5
5
|
export * from './completer';
|
|
6
6
|
export * from './containers-client';
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './database-client';
|
|
7
|
+
export * from './datasets-client';
|
|
9
8
|
export * from './developer-client';
|
|
10
9
|
export * from './document';
|
|
11
10
|
export * from './meshagent-client';
|
package/dist/browser/index.js
CHANGED
|
@@ -20,8 +20,7 @@ __exportStar(require("./event-emitter"), exports);
|
|
|
20
20
|
__exportStar(require("./client"), exports);
|
|
21
21
|
__exportStar(require("./completer"), exports);
|
|
22
22
|
__exportStar(require("./containers-client"), exports);
|
|
23
|
-
__exportStar(require("./
|
|
24
|
-
__exportStar(require("./database-client"), exports);
|
|
23
|
+
__exportStar(require("./datasets-client"), exports);
|
|
25
24
|
__exportStar(require("./developer-client"), exports);
|
|
26
25
|
__exportStar(require("./document"), exports);
|
|
27
26
|
__exportStar(require("./meshagent-client"), exports);
|
|
@@ -202,6 +202,37 @@ export interface Mailbox {
|
|
|
202
202
|
roomId?: string;
|
|
203
203
|
queue: string;
|
|
204
204
|
}
|
|
205
|
+
export type FeedVisibility = "public" | "project" | "private";
|
|
206
|
+
export interface Feed {
|
|
207
|
+
id: string;
|
|
208
|
+
projectId: string;
|
|
209
|
+
createdAt: Date;
|
|
210
|
+
name: string;
|
|
211
|
+
description: string;
|
|
212
|
+
visibility: FeedVisibility;
|
|
213
|
+
paused: boolean;
|
|
214
|
+
annotations: Record<string, string>;
|
|
215
|
+
messageSchema?: Record<string, unknown> | boolean | null;
|
|
216
|
+
}
|
|
217
|
+
export interface FeedSubscription {
|
|
218
|
+
id: string;
|
|
219
|
+
feedId: string;
|
|
220
|
+
projectId: string;
|
|
221
|
+
room: string;
|
|
222
|
+
roomId?: string | null;
|
|
223
|
+
path: string;
|
|
224
|
+
createdAt: Date;
|
|
225
|
+
annotations: Record<string, string>;
|
|
226
|
+
}
|
|
227
|
+
export interface LLMLogger {
|
|
228
|
+
id: string;
|
|
229
|
+
projectId: string;
|
|
230
|
+
destinationFeedId: string;
|
|
231
|
+
filterExpression: string;
|
|
232
|
+
paused: boolean;
|
|
233
|
+
createdAt: Date;
|
|
234
|
+
annotations: Record<string, string>;
|
|
235
|
+
}
|
|
205
236
|
export interface ProjectRepository {
|
|
206
237
|
id: string;
|
|
207
238
|
projectId: string;
|
|
@@ -215,6 +246,9 @@ export interface Balance {
|
|
|
215
246
|
autoRechargeThreshold?: number | null;
|
|
216
247
|
autoRechargeAmount?: number | null;
|
|
217
248
|
lastRecharge?: Date | null;
|
|
249
|
+
monthlyBudget?: number | null;
|
|
250
|
+
autoRechargePaused?: boolean;
|
|
251
|
+
autoRechargedThisMonth?: number | null;
|
|
218
252
|
}
|
|
219
253
|
export interface Transaction {
|
|
220
254
|
id: string;
|
|
@@ -274,6 +308,7 @@ export interface ExternalOAuthClientRegistration {
|
|
|
274
308
|
clientId: string;
|
|
275
309
|
clientSecret?: string | null;
|
|
276
310
|
}
|
|
311
|
+
type JsonRequest = Record<string, unknown> | Array<unknown> | string | number | boolean | null;
|
|
277
312
|
export declare class Meshagent {
|
|
278
313
|
private readonly baseUrl;
|
|
279
314
|
private readonly token?;
|
|
@@ -286,6 +321,9 @@ export declare class Meshagent {
|
|
|
286
321
|
private parseRoomShare;
|
|
287
322
|
private parseRoomSession;
|
|
288
323
|
private parseRoom;
|
|
324
|
+
private parseFeed;
|
|
325
|
+
private parseFeedSubscription;
|
|
326
|
+
private parseLLMLogger;
|
|
289
327
|
private parseProjectRepository;
|
|
290
328
|
private parseProjectRoomGrant;
|
|
291
329
|
private parseProjectRoomGrantCount;
|
|
@@ -339,11 +377,12 @@ export declare class Meshagent {
|
|
|
339
377
|
getStatus(projectId: string): Promise<boolean>;
|
|
340
378
|
getBalance(projectId: string): Promise<Balance>;
|
|
341
379
|
getRecentTransactions(projectId: string): Promise<Transaction[]>;
|
|
342
|
-
setAutoRecharge({ projectId, enabled, amount, threshold }: {
|
|
380
|
+
setAutoRecharge({ projectId, enabled, amount, threshold, monthlyBudget, }: {
|
|
343
381
|
projectId: string;
|
|
344
382
|
enabled: boolean;
|
|
345
383
|
amount: number;
|
|
346
384
|
threshold: number;
|
|
385
|
+
monthlyBudget?: number | null;
|
|
347
386
|
}): Promise<void>;
|
|
348
387
|
getCheckoutUrl(projectId: string, { successUrl, cancelUrl }: {
|
|
349
388
|
successUrl: string;
|
|
@@ -365,6 +404,8 @@ export declare class Meshagent {
|
|
|
365
404
|
provider?: string;
|
|
366
405
|
model?: string;
|
|
367
406
|
usageType?: string;
|
|
407
|
+
client?: string;
|
|
408
|
+
annotations?: Record<string, string>;
|
|
368
409
|
}): Promise<Record<string, unknown>[]>;
|
|
369
410
|
getSession(projectId: string, sessionId: string): Promise<Record<string, unknown>>;
|
|
370
411
|
listActiveSessions(projectId: string): Promise<RoomSession[]>;
|
|
@@ -407,6 +448,72 @@ export declare class Meshagent {
|
|
|
407
448
|
}): Promise<void>;
|
|
408
449
|
listMailboxes(projectId: string): Promise<Mailbox[]>;
|
|
409
450
|
deleteMailbox(projectId: string, address: string): Promise<void>;
|
|
451
|
+
createFeed(params: {
|
|
452
|
+
projectId: string;
|
|
453
|
+
name: string;
|
|
454
|
+
description?: string;
|
|
455
|
+
visibility?: FeedVisibility;
|
|
456
|
+
paused?: boolean;
|
|
457
|
+
annotations?: Record<string, string>;
|
|
458
|
+
messageSchema?: Record<string, unknown> | boolean | null;
|
|
459
|
+
}): Promise<Feed>;
|
|
460
|
+
updateFeed(params: {
|
|
461
|
+
projectId: string;
|
|
462
|
+
feedId: string;
|
|
463
|
+
name: string;
|
|
464
|
+
description?: string;
|
|
465
|
+
paused?: boolean;
|
|
466
|
+
annotations?: Record<string, string>;
|
|
467
|
+
messageSchema?: Record<string, unknown> | boolean | null;
|
|
468
|
+
}): Promise<void>;
|
|
469
|
+
getFeed(projectId: string, feedId: string): Promise<Feed>;
|
|
470
|
+
listFeeds(projectId: string): Promise<Feed[]>;
|
|
471
|
+
listRoomFeeds(projectId: string, roomName: string): Promise<Feed[]>;
|
|
472
|
+
deleteFeed(projectId: string, feedId: string): Promise<void>;
|
|
473
|
+
publishFeedMessage(params: {
|
|
474
|
+
projectId: string;
|
|
475
|
+
feedId: string;
|
|
476
|
+
message: JsonRequest;
|
|
477
|
+
}): Promise<void>;
|
|
478
|
+
publishFeedBatch(params: {
|
|
479
|
+
projectId: string;
|
|
480
|
+
feedId: string;
|
|
481
|
+
messages: JsonRequest[];
|
|
482
|
+
}): Promise<void>;
|
|
483
|
+
createFeedSubscription(params: {
|
|
484
|
+
projectId: string;
|
|
485
|
+
feedId: string;
|
|
486
|
+
room: string;
|
|
487
|
+
path: string;
|
|
488
|
+
annotations?: Record<string, string>;
|
|
489
|
+
}): Promise<FeedSubscription>;
|
|
490
|
+
updateFeedSubscription(params: {
|
|
491
|
+
projectId: string;
|
|
492
|
+
feedId: string;
|
|
493
|
+
subscriptionId: string;
|
|
494
|
+
annotations?: Record<string, string>;
|
|
495
|
+
}): Promise<void>;
|
|
496
|
+
getFeedSubscription(projectId: string, feedId: string, subscriptionId: string): Promise<FeedSubscription>;
|
|
497
|
+
listFeedSubscriptions(projectId: string, feedId: string): Promise<FeedSubscription[]>;
|
|
498
|
+
deleteFeedSubscription(projectId: string, feedId: string, subscriptionId: string): Promise<void>;
|
|
499
|
+
createLLMLogger(params: {
|
|
500
|
+
projectId: string;
|
|
501
|
+
destinationFeedId: string;
|
|
502
|
+
filterExpression: string;
|
|
503
|
+
paused?: boolean;
|
|
504
|
+
annotations?: Record<string, string>;
|
|
505
|
+
}): Promise<LLMLogger>;
|
|
506
|
+
updateLLMLogger(params: {
|
|
507
|
+
projectId: string;
|
|
508
|
+
loggerId: string;
|
|
509
|
+
destinationFeedId: string;
|
|
510
|
+
filterExpression: string;
|
|
511
|
+
paused?: boolean;
|
|
512
|
+
annotations?: Record<string, string>;
|
|
513
|
+
}): Promise<void>;
|
|
514
|
+
getLLMLogger(projectId: string, loggerId: string): Promise<LLMLogger>;
|
|
515
|
+
listLLMLoggers(projectId: string): Promise<LLMLogger[]>;
|
|
516
|
+
deleteLLMLogger(projectId: string, loggerId: string): Promise<void>;
|
|
410
517
|
createRepository(params: {
|
|
411
518
|
projectId: string;
|
|
412
519
|
name: string;
|
|
@@ -628,3 +735,4 @@ export declare class Meshagent {
|
|
|
628
735
|
getOAuthClient(projectId: string, clientId: string): Promise<OAuthClient>;
|
|
629
736
|
deleteOAuthClient(projectId: string, clientId: string): Promise<void>;
|
|
630
737
|
}
|
|
738
|
+
export {};
|
|
@@ -226,6 +226,102 @@ class Meshagent {
|
|
|
226
226
|
annotations: annotations && typeof annotations === "object" ? annotations : {},
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
|
+
parseFeed(data) {
|
|
230
|
+
if (!data || typeof data !== "object") {
|
|
231
|
+
throw new requirement_1.RoomException("Invalid feed payload");
|
|
232
|
+
}
|
|
233
|
+
const { id, project_id: projectIdRaw, projectId, created_at: createdAtRaw, createdAt, name, description, visibility, paused, annotations, message_schema: messageSchemaRaw, messageSchema, } = data;
|
|
234
|
+
const projectIdValue = typeof projectId === "string"
|
|
235
|
+
? projectId
|
|
236
|
+
: typeof projectIdRaw === "string"
|
|
237
|
+
? projectIdRaw
|
|
238
|
+
: undefined;
|
|
239
|
+
const createdAtValue = typeof createdAt === "string"
|
|
240
|
+
? createdAt
|
|
241
|
+
: typeof createdAtRaw === "string"
|
|
242
|
+
? createdAtRaw
|
|
243
|
+
: undefined;
|
|
244
|
+
const visibilityValue = visibility === "public" || visibility === "project" || visibility === "private"
|
|
245
|
+
? visibility
|
|
246
|
+
: undefined;
|
|
247
|
+
const messageSchemaValue = typeof messageSchema === "boolean" || (messageSchema && typeof messageSchema === "object")
|
|
248
|
+
? messageSchema
|
|
249
|
+
: typeof messageSchemaRaw === "boolean" || (messageSchemaRaw && typeof messageSchemaRaw === "object")
|
|
250
|
+
? messageSchemaRaw
|
|
251
|
+
: null;
|
|
252
|
+
if (typeof id !== "string" ||
|
|
253
|
+
typeof projectIdValue !== "string" ||
|
|
254
|
+
typeof createdAtValue !== "string" ||
|
|
255
|
+
typeof name !== "string" ||
|
|
256
|
+
visibilityValue === undefined) {
|
|
257
|
+
throw new requirement_1.RoomException("Invalid feed payload: missing required fields");
|
|
258
|
+
}
|
|
259
|
+
return {
|
|
260
|
+
id,
|
|
261
|
+
projectId: projectIdValue,
|
|
262
|
+
createdAt: new Date(createdAtValue),
|
|
263
|
+
name,
|
|
264
|
+
description: typeof description === "string" ? description : "",
|
|
265
|
+
visibility: visibilityValue,
|
|
266
|
+
paused: paused === true,
|
|
267
|
+
annotations: annotations && typeof annotations === "object" ? annotations : {},
|
|
268
|
+
messageSchema: messageSchemaValue,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
parseFeedSubscription(data) {
|
|
272
|
+
if (!data || typeof data !== "object") {
|
|
273
|
+
throw new requirement_1.RoomException("Invalid feed subscription payload");
|
|
274
|
+
}
|
|
275
|
+
const { id, feed_id: feedIdRaw, feedId, project_id: projectIdRaw, projectId, room, room_id: roomIdRaw, roomId, path, created_at: createdAtRaw, createdAt, annotations, } = data;
|
|
276
|
+
const feedIdValue = typeof feedId === "string" ? feedId : feedIdRaw;
|
|
277
|
+
const projectIdValue = typeof projectId === "string" ? projectId : projectIdRaw;
|
|
278
|
+
const createdAtValue = typeof createdAt === "string" ? createdAt : createdAtRaw;
|
|
279
|
+
const roomIdValue = typeof roomId === "string" ? roomId : roomIdRaw;
|
|
280
|
+
if (typeof id !== "string" ||
|
|
281
|
+
typeof feedIdValue !== "string" ||
|
|
282
|
+
typeof projectIdValue !== "string" ||
|
|
283
|
+
typeof room !== "string" ||
|
|
284
|
+
typeof path !== "string" ||
|
|
285
|
+
typeof createdAtValue !== "string") {
|
|
286
|
+
throw new requirement_1.RoomException("Invalid feed subscription payload: missing required fields");
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
id,
|
|
290
|
+
feedId: feedIdValue,
|
|
291
|
+
projectId: projectIdValue,
|
|
292
|
+
room,
|
|
293
|
+
roomId: typeof roomIdValue === "string" ? roomIdValue : undefined,
|
|
294
|
+
path,
|
|
295
|
+
createdAt: new Date(createdAtValue),
|
|
296
|
+
annotations: annotations && typeof annotations === "object" ? annotations : {},
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
parseLLMLogger(data) {
|
|
300
|
+
if (!data || typeof data !== "object") {
|
|
301
|
+
throw new requirement_1.RoomException("Invalid LLM logger payload");
|
|
302
|
+
}
|
|
303
|
+
const { id, project_id: projectIdRaw, projectId, destination_feed_id: destinationFeedIdRaw, destinationFeedId, filter_expression: filterExpressionRaw, filterExpression, paused, created_at: createdAtRaw, createdAt, annotations, } = data;
|
|
304
|
+
const projectIdValue = typeof projectId === "string" ? projectId : projectIdRaw;
|
|
305
|
+
const destinationFeedIdValue = typeof destinationFeedId === "string" ? destinationFeedId : destinationFeedIdRaw;
|
|
306
|
+
const filterExpressionValue = typeof filterExpression === "string" ? filterExpression : filterExpressionRaw;
|
|
307
|
+
const createdAtValue = typeof createdAt === "string" ? createdAt : createdAtRaw;
|
|
308
|
+
if (typeof id !== "string" ||
|
|
309
|
+
typeof projectIdValue !== "string" ||
|
|
310
|
+
typeof destinationFeedIdValue !== "string" ||
|
|
311
|
+
typeof filterExpressionValue !== "string" ||
|
|
312
|
+
typeof createdAtValue !== "string") {
|
|
313
|
+
throw new requirement_1.RoomException("Invalid LLM logger payload: missing required fields");
|
|
314
|
+
}
|
|
315
|
+
return {
|
|
316
|
+
id,
|
|
317
|
+
projectId: projectIdValue,
|
|
318
|
+
destinationFeedId: destinationFeedIdValue,
|
|
319
|
+
filterExpression: filterExpressionValue,
|
|
320
|
+
paused: paused === true,
|
|
321
|
+
createdAt: new Date(createdAtValue),
|
|
322
|
+
annotations: annotations && typeof annotations === "object" ? annotations : {},
|
|
323
|
+
};
|
|
324
|
+
}
|
|
229
325
|
parseProjectRepository(data) {
|
|
230
326
|
if (!data || typeof data !== "object") {
|
|
231
327
|
throw new requirement_1.RoomException("Invalid repository payload");
|
|
@@ -313,11 +409,17 @@ class Meshagent {
|
|
|
313
409
|
const threshold = data.auto_recharge_threshold ?? data.autoRechargeThreshold;
|
|
314
410
|
const amount = data.auto_recharge_amount ?? data.autoRechargeAmount;
|
|
315
411
|
const lastRechargeRaw = data.last_recharge ?? data.lastRecharge;
|
|
412
|
+
const monthlyBudget = data.monthly_budget ?? data.monthlyBudget;
|
|
413
|
+
const autoRechargePaused = data.auto_recharge_paused ?? data.autoRechargePaused;
|
|
414
|
+
const autoRechargedThisMonth = data.auto_recharged_this_month ?? data.autoRechargedThisMonth;
|
|
316
415
|
return {
|
|
317
416
|
balance: balanceValue,
|
|
318
417
|
autoRechargeThreshold: typeof threshold === "number" ? threshold : null,
|
|
319
418
|
autoRechargeAmount: typeof amount === "number" ? amount : null,
|
|
320
419
|
lastRecharge: typeof lastRechargeRaw === "string" ? new Date(lastRechargeRaw) : null,
|
|
420
|
+
monthlyBudget: typeof monthlyBudget === "number" ? monthlyBudget : null,
|
|
421
|
+
autoRechargePaused: autoRechargePaused === true,
|
|
422
|
+
autoRechargedThisMonth: typeof autoRechargedThisMonth === "number" ? autoRechargedThisMonth : null,
|
|
321
423
|
};
|
|
322
424
|
}
|
|
323
425
|
parseTransaction(data) {
|
|
@@ -746,10 +848,10 @@ class Meshagent {
|
|
|
746
848
|
const list = Array.isArray(data?.transactions) ? data.transactions : [];
|
|
747
849
|
return list.map((item) => this.parseTransaction(item));
|
|
748
850
|
}
|
|
749
|
-
async setAutoRecharge({ projectId, enabled, amount, threshold }) {
|
|
851
|
+
async setAutoRecharge({ projectId, enabled, amount, threshold, monthlyBudget = null, }) {
|
|
750
852
|
await this.request(`/accounts/projects/${projectId}/recharge`, {
|
|
751
853
|
method: "POST",
|
|
752
|
-
json: { enabled, amount, threshold },
|
|
854
|
+
json: { enabled, amount, threshold, monthly_budget: monthlyBudget },
|
|
753
855
|
action: "update auto recharge settings",
|
|
754
856
|
responseType: "void",
|
|
755
857
|
});
|
|
@@ -784,7 +886,7 @@ class Meshagent {
|
|
|
784
886
|
});
|
|
785
887
|
}
|
|
786
888
|
async getUsage(projectId, options = {}) {
|
|
787
|
-
const { start, end, interval, report, users, room, provider, model, usageType } = options;
|
|
889
|
+
const { start, end, interval, report, users, room, provider, model, usageType, client, annotations } = options;
|
|
788
890
|
const data = await this.request(`/accounts/projects/${projectId}/usage`, {
|
|
789
891
|
query: {
|
|
790
892
|
start: start ? start.toISOString() : undefined,
|
|
@@ -796,6 +898,8 @@ class Meshagent {
|
|
|
796
898
|
provider: provider && provider.trim().length > 0 ? provider.trim() : undefined,
|
|
797
899
|
model: model && model.trim().length > 0 ? model.trim() : undefined,
|
|
798
900
|
usage_type: usageType && usageType.trim().length > 0 ? usageType.trim() : undefined,
|
|
901
|
+
client: client && client.trim().length > 0 ? client.trim() : undefined,
|
|
902
|
+
annotations: annotations && Object.keys(annotations).length > 0 ? JSON.stringify(annotations) : undefined,
|
|
799
903
|
},
|
|
800
904
|
action: "retrieve usage",
|
|
801
905
|
});
|
|
@@ -924,6 +1028,168 @@ class Meshagent {
|
|
|
924
1028
|
responseType: "void",
|
|
925
1029
|
});
|
|
926
1030
|
}
|
|
1031
|
+
async createFeed(params) {
|
|
1032
|
+
const { projectId, name, description = "", visibility = "private", paused = false, annotations = {}, messageSchema = null, } = params;
|
|
1033
|
+
const data = await this.request(`/accounts/projects/${projectId}/feeds`, {
|
|
1034
|
+
method: "POST",
|
|
1035
|
+
json: {
|
|
1036
|
+
name,
|
|
1037
|
+
description,
|
|
1038
|
+
visibility,
|
|
1039
|
+
paused,
|
|
1040
|
+
annotations,
|
|
1041
|
+
message_schema: messageSchema,
|
|
1042
|
+
},
|
|
1043
|
+
action: "create feed",
|
|
1044
|
+
});
|
|
1045
|
+
return this.parseFeed(data.feed);
|
|
1046
|
+
}
|
|
1047
|
+
async updateFeed(params) {
|
|
1048
|
+
const { projectId, feedId, name, description = "", paused = false, annotations = {}, messageSchema = null, } = params;
|
|
1049
|
+
await this.request(`/accounts/projects/${projectId}/feeds/${feedId}`, {
|
|
1050
|
+
method: "PUT",
|
|
1051
|
+
json: {
|
|
1052
|
+
name,
|
|
1053
|
+
description,
|
|
1054
|
+
paused,
|
|
1055
|
+
annotations,
|
|
1056
|
+
message_schema: messageSchema,
|
|
1057
|
+
},
|
|
1058
|
+
action: "update feed",
|
|
1059
|
+
responseType: "void",
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
async getFeed(projectId, feedId) {
|
|
1063
|
+
const data = await this.request(`/accounts/projects/${projectId}/feeds/${feedId}`, {
|
|
1064
|
+
action: "get feed",
|
|
1065
|
+
});
|
|
1066
|
+
return this.parseFeed(data.feed);
|
|
1067
|
+
}
|
|
1068
|
+
async listFeeds(projectId) {
|
|
1069
|
+
const data = await this.request(`/accounts/projects/${projectId}/feeds`, {
|
|
1070
|
+
action: "list feeds",
|
|
1071
|
+
});
|
|
1072
|
+
const feeds = Array.isArray(data?.feeds) ? data.feeds : [];
|
|
1073
|
+
return feeds.map((item) => this.parseFeed(item));
|
|
1074
|
+
}
|
|
1075
|
+
async listRoomFeeds(projectId, roomName) {
|
|
1076
|
+
const data = await this.request(`/accounts/projects/${projectId}/rooms/${roomName}/feeds`, {
|
|
1077
|
+
action: "list room feeds",
|
|
1078
|
+
});
|
|
1079
|
+
const feeds = Array.isArray(data?.feeds) ? data.feeds : [];
|
|
1080
|
+
return feeds.map((item) => this.parseFeed(item));
|
|
1081
|
+
}
|
|
1082
|
+
async deleteFeed(projectId, feedId) {
|
|
1083
|
+
await this.request(`/accounts/projects/${projectId}/feeds/${feedId}`, {
|
|
1084
|
+
method: "DELETE",
|
|
1085
|
+
action: "delete feed",
|
|
1086
|
+
responseType: "void",
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1089
|
+
async publishFeedMessage(params) {
|
|
1090
|
+
const { projectId, feedId, message } = params;
|
|
1091
|
+
await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/messages`, {
|
|
1092
|
+
method: "POST",
|
|
1093
|
+
json: message,
|
|
1094
|
+
action: "publish feed message",
|
|
1095
|
+
responseType: "void",
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
async publishFeedBatch(params) {
|
|
1099
|
+
const { projectId, feedId, messages } = params;
|
|
1100
|
+
await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/messages/batch`, {
|
|
1101
|
+
method: "POST",
|
|
1102
|
+
json: messages,
|
|
1103
|
+
action: "publish feed messages",
|
|
1104
|
+
responseType: "void",
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
async createFeedSubscription(params) {
|
|
1108
|
+
const { projectId, feedId, room, path, annotations = {} } = params;
|
|
1109
|
+
const data = await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/subscriptions`, {
|
|
1110
|
+
method: "POST",
|
|
1111
|
+
json: { room, path, annotations },
|
|
1112
|
+
action: "create feed subscription",
|
|
1113
|
+
});
|
|
1114
|
+
return this.parseFeedSubscription(data.subscription);
|
|
1115
|
+
}
|
|
1116
|
+
async updateFeedSubscription(params) {
|
|
1117
|
+
const { projectId, feedId, subscriptionId, annotations = {} } = params;
|
|
1118
|
+
await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/subscriptions/${subscriptionId}`, {
|
|
1119
|
+
method: "PUT",
|
|
1120
|
+
json: { annotations },
|
|
1121
|
+
action: "update feed subscription",
|
|
1122
|
+
responseType: "void",
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
async getFeedSubscription(projectId, feedId, subscriptionId) {
|
|
1126
|
+
const data = await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/subscriptions/${subscriptionId}`, {
|
|
1127
|
+
action: "get feed subscription",
|
|
1128
|
+
});
|
|
1129
|
+
return this.parseFeedSubscription(data.subscription);
|
|
1130
|
+
}
|
|
1131
|
+
async listFeedSubscriptions(projectId, feedId) {
|
|
1132
|
+
const data = await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/subscriptions`, {
|
|
1133
|
+
action: "list feed subscriptions",
|
|
1134
|
+
});
|
|
1135
|
+
const subscriptions = Array.isArray(data?.subscriptions) ? data.subscriptions : [];
|
|
1136
|
+
return subscriptions.map((item) => this.parseFeedSubscription(item));
|
|
1137
|
+
}
|
|
1138
|
+
async deleteFeedSubscription(projectId, feedId, subscriptionId) {
|
|
1139
|
+
await this.request(`/accounts/projects/${projectId}/feeds/${feedId}/subscriptions/${subscriptionId}`, {
|
|
1140
|
+
method: "DELETE",
|
|
1141
|
+
action: "delete feed subscription",
|
|
1142
|
+
responseType: "void",
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
async createLLMLogger(params) {
|
|
1146
|
+
const { projectId, destinationFeedId, filterExpression, paused = false, annotations = {} } = params;
|
|
1147
|
+
const data = await this.request(`/accounts/projects/${projectId}/llm-loggers`, {
|
|
1148
|
+
method: "POST",
|
|
1149
|
+
json: {
|
|
1150
|
+
destination_feed_id: destinationFeedId,
|
|
1151
|
+
filter_expression: filterExpression,
|
|
1152
|
+
paused,
|
|
1153
|
+
annotations,
|
|
1154
|
+
},
|
|
1155
|
+
action: "create LLM logger",
|
|
1156
|
+
});
|
|
1157
|
+
return this.parseLLMLogger(data.logger);
|
|
1158
|
+
}
|
|
1159
|
+
async updateLLMLogger(params) {
|
|
1160
|
+
const { projectId, loggerId, destinationFeedId, filterExpression, paused = false, annotations = {} } = params;
|
|
1161
|
+
await this.request(`/accounts/projects/${projectId}/llm-loggers/${loggerId}`, {
|
|
1162
|
+
method: "PUT",
|
|
1163
|
+
json: {
|
|
1164
|
+
destination_feed_id: destinationFeedId,
|
|
1165
|
+
filter_expression: filterExpression,
|
|
1166
|
+
paused,
|
|
1167
|
+
annotations,
|
|
1168
|
+
},
|
|
1169
|
+
action: "update LLM logger",
|
|
1170
|
+
responseType: "void",
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
async getLLMLogger(projectId, loggerId) {
|
|
1174
|
+
const data = await this.request(`/accounts/projects/${projectId}/llm-loggers/${loggerId}`, {
|
|
1175
|
+
action: "get LLM logger",
|
|
1176
|
+
});
|
|
1177
|
+
return this.parseLLMLogger(data.logger);
|
|
1178
|
+
}
|
|
1179
|
+
async listLLMLoggers(projectId) {
|
|
1180
|
+
const data = await this.request(`/accounts/projects/${projectId}/llm-loggers`, {
|
|
1181
|
+
action: "list LLM loggers",
|
|
1182
|
+
});
|
|
1183
|
+
const loggers = Array.isArray(data?.loggers) ? data.loggers : [];
|
|
1184
|
+
return loggers.map((item) => this.parseLLMLogger(item));
|
|
1185
|
+
}
|
|
1186
|
+
async deleteLLMLogger(projectId, loggerId) {
|
|
1187
|
+
await this.request(`/accounts/projects/${projectId}/llm-loggers/${loggerId}`, {
|
|
1188
|
+
method: "DELETE",
|
|
1189
|
+
action: "delete LLM logger",
|
|
1190
|
+
responseType: "void",
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
927
1193
|
async createRepository(params) {
|
|
928
1194
|
const { projectId, name, description = "", annotations = {} } = params;
|
|
929
1195
|
const data = await this.request(`/accounts/projects/${projectId}/repositories`, {
|
|
@@ -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;
|