@meshagent/meshagent 0.44.12 → 0.45.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 +8 -0
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/meshagent-client.d.ts +390 -372
- package/dist/browser/meshagent-client.js +841 -1040
- package/dist/browser/oauth-scopes.d.ts +1 -1
- package/dist/browser/oauth-scopes.js +64 -14
- package/dist/browser/participant-token.d.ts +68 -20
- package/dist/browser/participant-token.js +232 -61
- package/dist/browser/room-client.d.ts +4 -8
- package/dist/browser/room-client.js +4 -10
- package/dist/browser/services-client.d.ts +11 -0
- package/dist/browser/services-client.js +17 -0
- package/dist/browser/sqlite-client.d.ts +326 -0
- package/dist/browser/sqlite-client.js +630 -0
- package/dist/browser/toolkit-config.d.ts +7 -1
- package/dist/browser/toolkit-config.js +41 -22
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/meshagent-client.d.ts +390 -372
- package/dist/esm/meshagent-client.js +841 -1038
- package/dist/esm/oauth-scopes.d.ts +1 -1
- package/dist/esm/oauth-scopes.js +64 -14
- package/dist/esm/participant-token.d.ts +68 -20
- package/dist/esm/participant-token.js +228 -59
- package/dist/esm/room-client.d.ts +4 -8
- package/dist/esm/room-client.js +4 -10
- package/dist/esm/services-client.d.ts +11 -0
- package/dist/esm/services-client.js +17 -0
- package/dist/esm/sqlite-client.d.ts +326 -0
- package/dist/esm/sqlite-client.js +625 -0
- package/dist/esm/toolkit-config.d.ts +7 -1
- package/dist/esm/toolkit-config.js +41 -22
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/meshagent-client.d.ts +390 -372
- package/dist/node/meshagent-client.js +841 -1040
- package/dist/node/oauth-scopes.d.ts +1 -1
- package/dist/node/oauth-scopes.js +64 -14
- package/dist/node/participant-token.d.ts +68 -20
- package/dist/node/participant-token.js +232 -61
- package/dist/node/room-client.d.ts +4 -8
- package/dist/node/room-client.js +4 -10
- package/dist/node/services-client.d.ts +11 -0
- package/dist/node/services-client.js +17 -0
- package/dist/node/sqlite-client.d.ts +326 -0
- package/dist/node/sqlite-client.js +630 -0
- package/dist/node/toolkit-config.d.ts +7 -1
- package/dist/node/toolkit-config.js +41 -22
- package/package.json +1 -1
- package/dist/browser/secrets-client.d.ts +0 -112
- package/dist/browser/secrets-client.js +0 -300
- package/dist/esm/secrets-client.d.ts +0 -112
- package/dist/esm/secrets-client.js +0 -296
- package/dist/node/secrets-client.d.ts +0 -112
- package/dist/node/secrets-client.js +0 -300
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const fullOAuthScopes: string[];
|
|
2
|
-
export declare const fullOAuthScope
|
|
2
|
+
export declare const fullOAuthScope: string;
|
|
@@ -2,20 +2,70 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fullOAuthScope = exports.fullOAuthScopes = void 0;
|
|
4
4
|
exports.fullOAuthScopes = [
|
|
5
|
-
'profile',
|
|
5
|
+
'profile:read',
|
|
6
|
+
'profile:write',
|
|
6
7
|
'project/*',
|
|
7
8
|
'room/*',
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
9
|
+
'users:create',
|
|
10
|
+
'users:read',
|
|
11
|
+
'users:update',
|
|
12
|
+
'users:delete',
|
|
13
|
+
'projects:read',
|
|
14
|
+
'projects:update',
|
|
15
|
+
'projects:iam.read',
|
|
16
|
+
'projects:iam.write',
|
|
17
|
+
'projects:billing.read',
|
|
18
|
+
'projects:billing.write',
|
|
19
|
+
'rooms:create',
|
|
20
|
+
'rooms:read',
|
|
21
|
+
'rooms:connect',
|
|
22
|
+
'rooms:update',
|
|
23
|
+
'rooms:delete',
|
|
24
|
+
'agents:create',
|
|
25
|
+
'agents:read',
|
|
26
|
+
'agents:update',
|
|
27
|
+
'agents:delete',
|
|
28
|
+
'agents:run',
|
|
29
|
+
'agents:sessions.read',
|
|
30
|
+
'mailboxes:create',
|
|
31
|
+
'mailboxes:read',
|
|
32
|
+
'mailboxes:update',
|
|
33
|
+
'mailboxes:delete',
|
|
34
|
+
'routes:create',
|
|
35
|
+
'routes:read',
|
|
36
|
+
'routes:update',
|
|
37
|
+
'routes:delete',
|
|
38
|
+
'scheduledTasks:create',
|
|
39
|
+
'scheduledTasks:read',
|
|
40
|
+
'scheduledTasks:update',
|
|
41
|
+
'scheduledTasks:delete',
|
|
42
|
+
'services:create',
|
|
43
|
+
'services:read',
|
|
44
|
+
'services:update',
|
|
45
|
+
'services:delete',
|
|
46
|
+
'repositories:create',
|
|
47
|
+
'repositories:read',
|
|
48
|
+
'repositories:update',
|
|
49
|
+
'repositories:delete',
|
|
50
|
+
'apiKeys:create',
|
|
51
|
+
'apiKeys:read',
|
|
52
|
+
'apiKeys:delete',
|
|
53
|
+
'serviceAccounts:create',
|
|
54
|
+
'serviceAccounts:read',
|
|
55
|
+
'serviceAccounts:update',
|
|
56
|
+
'serviceAccounts:delete',
|
|
57
|
+
'oauthClients:create',
|
|
58
|
+
'oauthClients:read',
|
|
59
|
+
'oauthClients:update',
|
|
60
|
+
'oauthClients:delete',
|
|
61
|
+
'llm:invoke',
|
|
62
|
+
'llm:usage.read',
|
|
63
|
+
'llm:logs.read',
|
|
64
|
+
'llm:logs.write',
|
|
65
|
+
'secrets:read',
|
|
66
|
+
'secrets:write',
|
|
67
|
+
'secrets:delete',
|
|
68
|
+
'secrets:grant',
|
|
69
|
+
'secrets:proxy',
|
|
20
70
|
];
|
|
21
|
-
exports.fullOAuthScope = '
|
|
71
|
+
exports.fullOAuthScope = exports.fullOAuthScopes.join(' ');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ConnectorRef, OAuthClientConfig } from "./meshagent-client.js";
|
|
2
1
|
export type StringList = string[];
|
|
3
2
|
export declare class AgentsGrant {
|
|
4
3
|
registerAgent: boolean;
|
|
@@ -86,6 +85,70 @@ export declare class DatasetGrant {
|
|
|
86
85
|
toJSON(): Record<string, any>;
|
|
87
86
|
static fromJSON(obj: unknown): DatasetGrant;
|
|
88
87
|
}
|
|
88
|
+
export declare class SqliteTableGrant {
|
|
89
|
+
database: string;
|
|
90
|
+
table: string;
|
|
91
|
+
namespace?: StringList;
|
|
92
|
+
write: boolean;
|
|
93
|
+
read: boolean;
|
|
94
|
+
alter: boolean;
|
|
95
|
+
constructor({ database, table, namespace, write, read, alter, }: {
|
|
96
|
+
database: string;
|
|
97
|
+
table: string;
|
|
98
|
+
namespace?: StringList;
|
|
99
|
+
write?: boolean;
|
|
100
|
+
read?: boolean;
|
|
101
|
+
alter?: boolean;
|
|
102
|
+
});
|
|
103
|
+
toJSON(): Record<string, any>;
|
|
104
|
+
static fromJSON(obj: unknown): SqliteTableGrant;
|
|
105
|
+
}
|
|
106
|
+
export declare class SqliteDatabaseGrant {
|
|
107
|
+
name: string;
|
|
108
|
+
namespace?: StringList;
|
|
109
|
+
createTable: boolean;
|
|
110
|
+
drop: boolean;
|
|
111
|
+
inspect: boolean;
|
|
112
|
+
listTables: boolean;
|
|
113
|
+
execute: boolean;
|
|
114
|
+
tables?: SqliteTableGrant[];
|
|
115
|
+
constructor({ name, namespace, createTable, drop, inspect, listTables, execute, tables, }: {
|
|
116
|
+
name: string;
|
|
117
|
+
namespace?: StringList;
|
|
118
|
+
createTable?: boolean;
|
|
119
|
+
drop?: boolean;
|
|
120
|
+
inspect?: boolean;
|
|
121
|
+
listTables?: boolean;
|
|
122
|
+
execute?: boolean;
|
|
123
|
+
tables?: SqliteTableGrant[];
|
|
124
|
+
});
|
|
125
|
+
toJSON(): Record<string, any>;
|
|
126
|
+
static fromJSON(obj: unknown): SqliteDatabaseGrant;
|
|
127
|
+
}
|
|
128
|
+
export declare class SqliteGrant {
|
|
129
|
+
databases?: SqliteDatabaseGrant[];
|
|
130
|
+
createDatabase: boolean;
|
|
131
|
+
listDatabases: boolean;
|
|
132
|
+
constructor({ databases, createDatabase, listDatabases, }?: {
|
|
133
|
+
databases?: SqliteDatabaseGrant[];
|
|
134
|
+
createDatabase?: boolean;
|
|
135
|
+
listDatabases?: boolean;
|
|
136
|
+
});
|
|
137
|
+
private matchingDatabases;
|
|
138
|
+
private matchingTables;
|
|
139
|
+
canCreateDatabase(): boolean;
|
|
140
|
+
canListDatabases(): boolean;
|
|
141
|
+
canDropDatabase(database: string, namespace?: StringList): boolean;
|
|
142
|
+
canInspectDatabase(database: string, namespace?: StringList): boolean;
|
|
143
|
+
canListTables(database: string, namespace?: StringList): boolean;
|
|
144
|
+
canCreateTable(database: string, namespace?: StringList): boolean;
|
|
145
|
+
canExecute(database: string, namespace?: StringList): boolean;
|
|
146
|
+
canWrite(database: string, table: string, namespace?: StringList): boolean;
|
|
147
|
+
canRead(database: string, table: string, namespace?: StringList): boolean;
|
|
148
|
+
canAlter(database: string, table: string, namespace?: StringList): boolean;
|
|
149
|
+
toJSON(): Record<string, any>;
|
|
150
|
+
static fromJSON(obj: unknown): SqliteGrant;
|
|
151
|
+
}
|
|
89
152
|
export declare class MemoryPermissions {
|
|
90
153
|
create: boolean;
|
|
91
154
|
drop: boolean;
|
|
@@ -238,25 +301,8 @@ export declare class AdminGrant {
|
|
|
238
301
|
toJSON(): Record<string, any>;
|
|
239
302
|
static fromJSON(obj: unknown): AdminGrant;
|
|
240
303
|
}
|
|
241
|
-
export declare class OAuthEndpoint {
|
|
242
|
-
endpoint: string;
|
|
243
|
-
clientId: string;
|
|
244
|
-
constructor({ endpoint, clientId }: {
|
|
245
|
-
endpoint: string;
|
|
246
|
-
clientId: string;
|
|
247
|
-
});
|
|
248
|
-
toJSON(): Record<string, any>;
|
|
249
|
-
static fromJSON(obj: unknown): OAuthEndpoint;
|
|
250
|
-
}
|
|
251
304
|
export declare class SecretsGrant {
|
|
252
|
-
|
|
253
|
-
constructor({ requestOauthToken }?: {
|
|
254
|
-
requestOauthToken?: OAuthEndpoint[];
|
|
255
|
-
});
|
|
256
|
-
canRequestOauthToken({ connector, oauth, }?: {
|
|
257
|
-
connector?: ConnectorRef | null;
|
|
258
|
-
oauth?: OAuthClientConfig | null;
|
|
259
|
-
}): boolean;
|
|
305
|
+
constructor(options?: Record<string, never>);
|
|
260
306
|
toJSON(): Record<string, any>;
|
|
261
307
|
static fromJSON(obj: unknown): SecretsGrant;
|
|
262
308
|
}
|
|
@@ -291,6 +337,7 @@ export declare class ApiScope {
|
|
|
291
337
|
queues?: QueuesGrant;
|
|
292
338
|
messaging?: MessagingGrant;
|
|
293
339
|
dataset?: DatasetGrant;
|
|
340
|
+
sqlite?: SqliteGrant;
|
|
294
341
|
memory?: MemoryGrant;
|
|
295
342
|
sync?: SyncGrant;
|
|
296
343
|
storage?: StorageGrant;
|
|
@@ -302,11 +349,12 @@ export declare class ApiScope {
|
|
|
302
349
|
secrets?: SecretsGrant;
|
|
303
350
|
tunnels?: TunnelsGrant;
|
|
304
351
|
services?: ServicesGrant;
|
|
305
|
-
constructor({ livekit, queues, messaging, dataset, memory, sync, storage, containers, developer, agents, llm, admin, secrets, tunnels, services, }?: {
|
|
352
|
+
constructor({ livekit, queues, messaging, dataset, sqlite, memory, sync, storage, containers, developer, agents, llm, admin, secrets, tunnels, services, }?: {
|
|
306
353
|
livekit?: LivekitGrant;
|
|
307
354
|
queues?: QueuesGrant;
|
|
308
355
|
messaging?: MessagingGrant;
|
|
309
356
|
dataset?: DatasetGrant;
|
|
357
|
+
sqlite?: SqliteGrant;
|
|
310
358
|
memory?: MemoryGrant;
|
|
311
359
|
sync?: SyncGrant;
|
|
312
360
|
storage?: StorageGrant;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParticipantToken = exports.ParticipantGrant = exports.ApiScope = exports.LLMGrant = exports.ServicesGrant = exports.TunnelsGrant = exports.SecretsGrant = exports.
|
|
3
|
+
exports.ParticipantToken = exports.ParticipantGrant = exports.ApiScope = exports.LLMGrant = exports.ServicesGrant = exports.TunnelsGrant = exports.SecretsGrant = exports.AdminGrant = exports.DeveloperGrant = exports.ContainersGrant = exports.ContainerRegistryGrant = exports.StorageGrant = exports.StoragePathGrant = exports.SyncGrant = exports.SyncPathGrant = exports.MemoryGrant = exports.MemoryEntryGrant = exports.MemoryPermissions = exports.SqliteGrant = exports.SqliteDatabaseGrant = exports.SqliteTableGrant = exports.DatasetGrant = exports.TableGrant = exports.MessagingGrant = exports.QueuesGrant = exports.LivekitGrant = exports.AgentsGrant = void 0;
|
|
4
4
|
const jose_1 = require("jose");
|
|
5
5
|
const api_keys_js_1 = require("./api_keys.js");
|
|
6
6
|
const version_js_1 = require("./version.js");
|
|
@@ -297,6 +297,218 @@ class DatasetGrant {
|
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
exports.DatasetGrant = DatasetGrant;
|
|
300
|
+
class SqliteTableGrant {
|
|
301
|
+
constructor({ database, table, namespace, write, read, alter, }) {
|
|
302
|
+
this.database = database;
|
|
303
|
+
this.table = table;
|
|
304
|
+
this.namespace = namespace;
|
|
305
|
+
this.write = write ?? true;
|
|
306
|
+
this.read = read ?? true;
|
|
307
|
+
this.alter = alter ?? false;
|
|
308
|
+
}
|
|
309
|
+
toJSON() {
|
|
310
|
+
const json = {
|
|
311
|
+
database: this.database,
|
|
312
|
+
table: this.table,
|
|
313
|
+
};
|
|
314
|
+
if (this.namespace !== undefined) {
|
|
315
|
+
json["namespace"] = this.namespace;
|
|
316
|
+
}
|
|
317
|
+
if (this.write !== true) {
|
|
318
|
+
json["write"] = this.write;
|
|
319
|
+
}
|
|
320
|
+
if (this.read !== true) {
|
|
321
|
+
json["read"] = this.read;
|
|
322
|
+
}
|
|
323
|
+
if (this.alter !== false) {
|
|
324
|
+
json["alter"] = this.alter;
|
|
325
|
+
}
|
|
326
|
+
return json;
|
|
327
|
+
}
|
|
328
|
+
static fromJSON(obj) {
|
|
329
|
+
if (!isRecord(obj) || typeof obj.database !== "string" || typeof obj.table !== "string") {
|
|
330
|
+
throw new Error("SqliteTableGrant requires database and table");
|
|
331
|
+
}
|
|
332
|
+
return new SqliteTableGrant({
|
|
333
|
+
database: obj.database,
|
|
334
|
+
table: obj.table,
|
|
335
|
+
namespace: asStringList(obj.namespace),
|
|
336
|
+
write: obj.write,
|
|
337
|
+
read: obj.read,
|
|
338
|
+
alter: obj.alter,
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
exports.SqliteTableGrant = SqliteTableGrant;
|
|
343
|
+
class SqliteDatabaseGrant {
|
|
344
|
+
constructor({ name, namespace, createTable, drop, inspect, listTables, execute, tables, }) {
|
|
345
|
+
this.name = name;
|
|
346
|
+
this.namespace = namespace;
|
|
347
|
+
this.createTable = createTable ?? true;
|
|
348
|
+
this.drop = drop ?? false;
|
|
349
|
+
this.inspect = inspect ?? true;
|
|
350
|
+
this.listTables = listTables ?? true;
|
|
351
|
+
this.execute = execute ?? true;
|
|
352
|
+
this.tables = tables;
|
|
353
|
+
}
|
|
354
|
+
toJSON() {
|
|
355
|
+
const json = { name: this.name };
|
|
356
|
+
if (this.namespace !== undefined) {
|
|
357
|
+
json["namespace"] = this.namespace;
|
|
358
|
+
}
|
|
359
|
+
if (this.createTable !== true) {
|
|
360
|
+
json["create_table"] = this.createTable;
|
|
361
|
+
}
|
|
362
|
+
if (this.drop !== false) {
|
|
363
|
+
json["drop"] = this.drop;
|
|
364
|
+
}
|
|
365
|
+
if (this.inspect !== true) {
|
|
366
|
+
json["inspect"] = this.inspect;
|
|
367
|
+
}
|
|
368
|
+
if (this.listTables !== true) {
|
|
369
|
+
json["list_tables"] = this.listTables;
|
|
370
|
+
}
|
|
371
|
+
if (this.execute !== true) {
|
|
372
|
+
json["execute"] = this.execute;
|
|
373
|
+
}
|
|
374
|
+
if (this.tables !== undefined) {
|
|
375
|
+
json["tables"] = this.tables.map((tableGrant) => tableGrant.toJSON());
|
|
376
|
+
}
|
|
377
|
+
return json;
|
|
378
|
+
}
|
|
379
|
+
static fromJSON(obj) {
|
|
380
|
+
if (!isRecord(obj) || typeof obj.name !== "string") {
|
|
381
|
+
throw new Error("SqliteDatabaseGrant requires a name");
|
|
382
|
+
}
|
|
383
|
+
return new SqliteDatabaseGrant({
|
|
384
|
+
name: obj.name,
|
|
385
|
+
namespace: asStringList(obj.namespace),
|
|
386
|
+
createTable: obj.create_table ?? obj.createTable,
|
|
387
|
+
drop: obj.drop,
|
|
388
|
+
inspect: obj.inspect,
|
|
389
|
+
listTables: obj.list_tables ?? obj.listTables,
|
|
390
|
+
execute: obj.execute,
|
|
391
|
+
tables: Array.isArray(obj.tables)
|
|
392
|
+
? obj.tables.map((tableGrant) => SqliteTableGrant.fromJSON(tableGrant))
|
|
393
|
+
: undefined,
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
exports.SqliteDatabaseGrant = SqliteDatabaseGrant;
|
|
398
|
+
class SqliteGrant {
|
|
399
|
+
constructor({ databases, createDatabase, listDatabases, } = {}) {
|
|
400
|
+
this.databases = databases;
|
|
401
|
+
this.createDatabase = createDatabase ?? true;
|
|
402
|
+
this.listDatabases = listDatabases ?? true;
|
|
403
|
+
}
|
|
404
|
+
matchingDatabases(database, namespace) {
|
|
405
|
+
if (this.databases === undefined) {
|
|
406
|
+
return [];
|
|
407
|
+
}
|
|
408
|
+
return this.databases.filter((databaseGrant) => {
|
|
409
|
+
if (databaseGrant.name !== database) {
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
if (databaseGrant.namespace === undefined) {
|
|
413
|
+
return true;
|
|
414
|
+
}
|
|
415
|
+
return namespacesEqual(databaseGrant.namespace, namespace);
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
matchingTables(database, table, namespace) {
|
|
419
|
+
return this.matchingDatabases(database, namespace)
|
|
420
|
+
.flatMap((databaseGrant) => databaseGrant.tables ?? [])
|
|
421
|
+
.filter((tableGrant) => {
|
|
422
|
+
if (tableGrant.database !== database || tableGrant.table !== table) {
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
if (tableGrant.namespace === undefined) {
|
|
426
|
+
return true;
|
|
427
|
+
}
|
|
428
|
+
return namespacesEqual(tableGrant.namespace, namespace);
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
canCreateDatabase() {
|
|
432
|
+
return this.createDatabase;
|
|
433
|
+
}
|
|
434
|
+
canListDatabases() {
|
|
435
|
+
return this.listDatabases;
|
|
436
|
+
}
|
|
437
|
+
canDropDatabase(database, namespace) {
|
|
438
|
+
if (this.databases === undefined) {
|
|
439
|
+
return true;
|
|
440
|
+
}
|
|
441
|
+
return this.matchingDatabases(database, namespace).some((databaseGrant) => databaseGrant.drop);
|
|
442
|
+
}
|
|
443
|
+
canInspectDatabase(database, namespace) {
|
|
444
|
+
if (this.databases === undefined) {
|
|
445
|
+
return true;
|
|
446
|
+
}
|
|
447
|
+
return this.matchingDatabases(database, namespace).some((databaseGrant) => databaseGrant.inspect);
|
|
448
|
+
}
|
|
449
|
+
canListTables(database, namespace) {
|
|
450
|
+
if (this.databases === undefined) {
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
return this.matchingDatabases(database, namespace).some((databaseGrant) => databaseGrant.listTables);
|
|
454
|
+
}
|
|
455
|
+
canCreateTable(database, namespace) {
|
|
456
|
+
if (this.databases === undefined) {
|
|
457
|
+
return true;
|
|
458
|
+
}
|
|
459
|
+
return this.matchingDatabases(database, namespace).some((databaseGrant) => databaseGrant.createTable);
|
|
460
|
+
}
|
|
461
|
+
canExecute(database, namespace) {
|
|
462
|
+
if (this.databases === undefined) {
|
|
463
|
+
return true;
|
|
464
|
+
}
|
|
465
|
+
return this.matchingDatabases(database, namespace).some((databaseGrant) => databaseGrant.execute);
|
|
466
|
+
}
|
|
467
|
+
canWrite(database, table, namespace) {
|
|
468
|
+
if (this.databases === undefined) {
|
|
469
|
+
return true;
|
|
470
|
+
}
|
|
471
|
+
return this.matchingTables(database, table, namespace).some((tableGrant) => tableGrant.write);
|
|
472
|
+
}
|
|
473
|
+
canRead(database, table, namespace) {
|
|
474
|
+
if (this.databases === undefined) {
|
|
475
|
+
return true;
|
|
476
|
+
}
|
|
477
|
+
return this.matchingTables(database, table, namespace).some((tableGrant) => tableGrant.read);
|
|
478
|
+
}
|
|
479
|
+
canAlter(database, table, namespace) {
|
|
480
|
+
if (this.databases === undefined) {
|
|
481
|
+
return true;
|
|
482
|
+
}
|
|
483
|
+
return this.matchingTables(database, table, namespace).some((tableGrant) => tableGrant.alter);
|
|
484
|
+
}
|
|
485
|
+
toJSON() {
|
|
486
|
+
const json = {};
|
|
487
|
+
if (this.databases !== undefined) {
|
|
488
|
+
json["databases"] = this.databases.map((databaseGrant) => databaseGrant.toJSON());
|
|
489
|
+
}
|
|
490
|
+
if (this.createDatabase !== true) {
|
|
491
|
+
json["create_database"] = this.createDatabase;
|
|
492
|
+
}
|
|
493
|
+
if (this.listDatabases !== true) {
|
|
494
|
+
json["list_databases"] = this.listDatabases;
|
|
495
|
+
}
|
|
496
|
+
return json;
|
|
497
|
+
}
|
|
498
|
+
static fromJSON(obj) {
|
|
499
|
+
if (!isRecord(obj)) {
|
|
500
|
+
return new SqliteGrant();
|
|
501
|
+
}
|
|
502
|
+
return new SqliteGrant({
|
|
503
|
+
databases: Array.isArray(obj.databases)
|
|
504
|
+
? obj.databases.map((databaseGrant) => SqliteDatabaseGrant.fromJSON(databaseGrant))
|
|
505
|
+
: undefined,
|
|
506
|
+
createDatabase: obj.create_database ?? obj.createDatabase,
|
|
507
|
+
listDatabases: obj.list_databases ?? obj.listDatabases,
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
exports.SqliteGrant = SqliteGrant;
|
|
300
512
|
class MemoryPermissions {
|
|
301
513
|
constructor({ create, drop, inspect, query, upsert, ingest, recall, optimize, } = {}) {
|
|
302
514
|
this.create = create ?? true;
|
|
@@ -770,72 +982,25 @@ class AdminGrant {
|
|
|
770
982
|
}
|
|
771
983
|
}
|
|
772
984
|
exports.AdminGrant = AdminGrant;
|
|
773
|
-
class OAuthEndpoint {
|
|
774
|
-
constructor({ endpoint, clientId }) {
|
|
775
|
-
this.endpoint = endpoint;
|
|
776
|
-
this.clientId = clientId;
|
|
777
|
-
}
|
|
778
|
-
toJSON() {
|
|
779
|
-
return {
|
|
780
|
-
endpoint: this.endpoint,
|
|
781
|
-
client_id: this.clientId,
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
|
-
static fromJSON(obj) {
|
|
785
|
-
if (!isRecord(obj) || typeof obj.endpoint !== "string") {
|
|
786
|
-
throw new Error("OAuthEndpoint requires an endpoint");
|
|
787
|
-
}
|
|
788
|
-
const clientId = obj.client_id ?? obj.clientId;
|
|
789
|
-
if (typeof clientId !== "string") {
|
|
790
|
-
throw new Error("OAuthEndpoint requires a client_id");
|
|
791
|
-
}
|
|
792
|
-
return new OAuthEndpoint({
|
|
793
|
-
endpoint: obj.endpoint,
|
|
794
|
-
clientId,
|
|
795
|
-
});
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
exports.OAuthEndpoint = OAuthEndpoint;
|
|
799
985
|
class SecretsGrant {
|
|
800
|
-
constructor(
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
void connector;
|
|
805
|
-
if (this.requestOauthToken === undefined) {
|
|
806
|
-
return true;
|
|
986
|
+
constructor(options = {}) {
|
|
987
|
+
const keys = Object.keys(options);
|
|
988
|
+
if (keys.length > 0) {
|
|
989
|
+
throw new Error(`unsupported SecretsGrant fields: ${keys.join(", ")}`);
|
|
807
990
|
}
|
|
808
|
-
const authorizationEndpoint = typeof oauth?.authorization_endpoint === "string"
|
|
809
|
-
? oauth.authorization_endpoint.trim()
|
|
810
|
-
: "";
|
|
811
|
-
const clientId = typeof oauth?.client_id === "string"
|
|
812
|
-
? oauth.client_id.trim()
|
|
813
|
-
: "";
|
|
814
|
-
if (authorizationEndpoint === "" || clientId === "") {
|
|
815
|
-
return false;
|
|
816
|
-
}
|
|
817
|
-
return this.requestOauthToken.some((endpointGrant) => ((endpointGrant.endpoint === authorizationEndpoint
|
|
818
|
-
|| (endpointGrant.endpoint.endsWith("*")
|
|
819
|
-
&& authorizationEndpoint.startsWith(endpointGrant.endpoint.slice(0, -1))))
|
|
820
|
-
&& endpointGrant.clientId === clientId));
|
|
821
991
|
}
|
|
822
992
|
toJSON() {
|
|
823
|
-
|
|
824
|
-
if (this.requestOauthToken !== undefined) {
|
|
825
|
-
json["request_oauth_token"] = this.requestOauthToken.map((endpointGrant) => endpointGrant.toJSON());
|
|
826
|
-
}
|
|
827
|
-
return json;
|
|
993
|
+
return {};
|
|
828
994
|
}
|
|
829
995
|
static fromJSON(obj) {
|
|
830
996
|
if (!isRecord(obj)) {
|
|
831
997
|
return new SecretsGrant();
|
|
832
998
|
}
|
|
833
|
-
const
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
});
|
|
999
|
+
const keys = Object.keys(obj);
|
|
1000
|
+
if (keys.length > 0) {
|
|
1001
|
+
throw new Error(`unsupported SecretsGrant fields: ${keys.join(", ")}`);
|
|
1002
|
+
}
|
|
1003
|
+
return new SecretsGrant();
|
|
839
1004
|
}
|
|
840
1005
|
}
|
|
841
1006
|
exports.SecretsGrant = SecretsGrant;
|
|
@@ -922,11 +1087,12 @@ class LLMGrant {
|
|
|
922
1087
|
}
|
|
923
1088
|
exports.LLMGrant = LLMGrant;
|
|
924
1089
|
class ApiScope {
|
|
925
|
-
constructor({ livekit, queues, messaging, dataset, memory, sync, storage, containers, developer, agents, llm, admin, secrets, tunnels, services, } = {}) {
|
|
1090
|
+
constructor({ livekit, queues, messaging, dataset, sqlite, memory, sync, storage, containers, developer, agents, llm, admin, secrets, tunnels, services, } = {}) {
|
|
926
1091
|
this.livekit = livekit;
|
|
927
1092
|
this.queues = queues;
|
|
928
1093
|
this.messaging = messaging;
|
|
929
1094
|
this.dataset = dataset;
|
|
1095
|
+
this.sqlite = sqlite;
|
|
930
1096
|
this.memory = memory;
|
|
931
1097
|
this.sync = sync;
|
|
932
1098
|
this.storage = storage;
|
|
@@ -945,6 +1111,7 @@ class ApiScope {
|
|
|
945
1111
|
queues: new QueuesGrant(),
|
|
946
1112
|
messaging: new MessagingGrant(),
|
|
947
1113
|
dataset: new DatasetGrant(),
|
|
1114
|
+
sqlite: new SqliteGrant(),
|
|
948
1115
|
memory: new MemoryGrant(),
|
|
949
1116
|
sync: new SyncGrant(),
|
|
950
1117
|
storage: new StorageGrant(),
|
|
@@ -961,6 +1128,7 @@ class ApiScope {
|
|
|
961
1128
|
queues: new QueuesGrant(),
|
|
962
1129
|
messaging: new MessagingGrant(),
|
|
963
1130
|
dataset: new DatasetGrant(),
|
|
1131
|
+
sqlite: new SqliteGrant(),
|
|
964
1132
|
memory: new MemoryGrant(),
|
|
965
1133
|
sync: new SyncGrant(),
|
|
966
1134
|
storage: new StorageGrant(),
|
|
@@ -968,7 +1136,6 @@ class ApiScope {
|
|
|
968
1136
|
developer: new DeveloperGrant(),
|
|
969
1137
|
agents: new AgentsGrant(),
|
|
970
1138
|
llm: new LLMGrant(),
|
|
971
|
-
secrets: new SecretsGrant(),
|
|
972
1139
|
services: new ServicesGrant(),
|
|
973
1140
|
});
|
|
974
1141
|
}
|
|
@@ -978,6 +1145,7 @@ class ApiScope {
|
|
|
978
1145
|
queues: new QueuesGrant(),
|
|
979
1146
|
messaging: new MessagingGrant(),
|
|
980
1147
|
dataset: new DatasetGrant(),
|
|
1148
|
+
sqlite: new SqliteGrant(),
|
|
981
1149
|
memory: new MemoryGrant(),
|
|
982
1150
|
sync: new SyncGrant(),
|
|
983
1151
|
storage: new StorageGrant(),
|
|
@@ -986,7 +1154,6 @@ class ApiScope {
|
|
|
986
1154
|
agents: new AgentsGrant(),
|
|
987
1155
|
llm: new LLMGrant(),
|
|
988
1156
|
admin: new AdminGrant(),
|
|
989
|
-
secrets: new SecretsGrant(),
|
|
990
1157
|
tunnels: new TunnelsGrant(),
|
|
991
1158
|
services: new ServicesGrant(),
|
|
992
1159
|
});
|
|
@@ -1005,6 +1172,9 @@ class ApiScope {
|
|
|
1005
1172
|
if (this.dataset !== undefined) {
|
|
1006
1173
|
json["dataset"] = this.dataset.toJSON();
|
|
1007
1174
|
}
|
|
1175
|
+
if (this.sqlite !== undefined) {
|
|
1176
|
+
json["sqlite"] = this.sqlite.toJSON();
|
|
1177
|
+
}
|
|
1008
1178
|
if (this.memory !== undefined) {
|
|
1009
1179
|
json["memory"] = this.memory.toJSON();
|
|
1010
1180
|
}
|
|
@@ -1050,6 +1220,7 @@ class ApiScope {
|
|
|
1050
1220
|
queues: obj.queues ? QueuesGrant.fromJSON(obj.queues) : undefined,
|
|
1051
1221
|
messaging: obj.messaging ? MessagingGrant.fromJSON(obj.messaging) : undefined,
|
|
1052
1222
|
dataset: rawDataset ? DatasetGrant.fromJSON(rawDataset) : undefined,
|
|
1223
|
+
sqlite: obj.sqlite ? SqliteGrant.fromJSON(obj.sqlite) : undefined,
|
|
1053
1224
|
memory: obj.memory ? MemoryGrant.fromJSON(obj.memory) : undefined,
|
|
1054
1225
|
sync: obj.sync ? SyncGrant.fromJSON(obj.sync) : undefined,
|
|
1055
1226
|
storage: obj.storage ? StorageGrant.fromJSON(obj.storage) : undefined,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DatasetsClient } from "./datasets-client.js";
|
|
2
|
+
import { SqliteClient } from "./sqlite-client.js";
|
|
2
3
|
import { DeveloperClient } from "./developer-client.js";
|
|
3
4
|
import { type EventHandler, type EventName } from "./event-emitter.js";
|
|
4
5
|
import { MessagingClient } from "./messaging-client.js";
|
|
@@ -9,7 +10,6 @@ import { QueuesClient } from "./queues-client.js";
|
|
|
9
10
|
import type { Content } from "./response.js";
|
|
10
11
|
import { RoomEvent } from "./room-event.js";
|
|
11
12
|
import { RoomServerException } from "./room-server-client.js";
|
|
12
|
-
import { SecretsClient, type OAuthTokenRequestHandler, type SecretRequestHandler } from "./secrets-client.js";
|
|
13
13
|
import { ServicesClient } from "./services-client.js";
|
|
14
14
|
import { StorageClient } from "./storage-client.js";
|
|
15
15
|
import { SyncClient } from "./sync-client.js";
|
|
@@ -54,8 +54,8 @@ export declare class RoomClient {
|
|
|
54
54
|
readonly messaging: MessagingClient;
|
|
55
55
|
readonly queues: QueuesClient;
|
|
56
56
|
readonly datasets: DatasetsClient;
|
|
57
|
+
readonly sqlite: SqliteClient;
|
|
57
58
|
readonly agents: AgentsClient;
|
|
58
|
-
readonly secrets: SecretsClient;
|
|
59
59
|
readonly containers: ContainersClient;
|
|
60
60
|
readonly memory: MemoryClient;
|
|
61
61
|
readonly services: ServicesClient;
|
|
@@ -94,17 +94,13 @@ export declare class RoomClient {
|
|
|
94
94
|
private readonly _handleParticipantBound;
|
|
95
95
|
private readonly _handleResponseBound;
|
|
96
96
|
private readonly _handleToolCallResponseChunkBound;
|
|
97
|
-
constructor({ protocolFactory, reconnectTimeout,
|
|
97
|
+
constructor({ protocolFactory, reconnectTimeout, }?: {
|
|
98
98
|
protocolFactory?: ProtocolFactory | null;
|
|
99
99
|
reconnectTimeout?: number | null;
|
|
100
|
-
oauthTokenRequestHandler?: OAuthTokenRequestHandler;
|
|
101
|
-
secretRequestHandler?: SecretRequestHandler;
|
|
102
100
|
});
|
|
103
|
-
static withIAP({ url, reconnectTimeout,
|
|
101
|
+
static withIAP({ url, reconnectTimeout, }?: {
|
|
104
102
|
url?: string;
|
|
105
103
|
reconnectTimeout?: number | null;
|
|
106
|
-
oauthTokenRequestHandler?: OAuthTokenRequestHandler;
|
|
107
|
-
secretRequestHandler?: SecretRequestHandler;
|
|
108
104
|
}): RoomClient;
|
|
109
105
|
get localParticipant(): LocalParticipant | null;
|
|
110
106
|
get ready(): Promise<void>;
|
package/dist/node/room-client.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RoomClient = exports.RoomProtocolProxy = void 0;
|
|
4
4
|
const completer_js_1 = require("./completer.js");
|
|
5
5
|
const datasets_client_js_1 = require("./datasets-client.js");
|
|
6
|
+
const sqlite_client_js_1 = require("./sqlite-client.js");
|
|
6
7
|
const developer_client_js_1 = require("./developer-client.js");
|
|
7
8
|
const event_emitter_js_1 = require("./event-emitter.js");
|
|
8
9
|
const messaging_client_js_1 = require("./messaging-client.js");
|
|
@@ -13,7 +14,6 @@ const queues_client_js_1 = require("./queues-client.js");
|
|
|
13
14
|
const response_js_1 = require("./response.js");
|
|
14
15
|
const room_event_js_1 = require("./room-event.js");
|
|
15
16
|
const room_server_client_js_1 = require("./room-server-client.js");
|
|
16
|
-
const secrets_client_js_1 = require("./secrets-client.js");
|
|
17
17
|
const services_client_js_1 = require("./services-client.js");
|
|
18
18
|
const storage_client_js_1 = require("./storage-client.js");
|
|
19
19
|
const stream_controller_js_1 = require("./stream-controller.js");
|
|
@@ -209,7 +209,7 @@ class RoomProtocolProxy {
|
|
|
209
209
|
}
|
|
210
210
|
exports.RoomProtocolProxy = RoomProtocolProxy;
|
|
211
211
|
class RoomClient {
|
|
212
|
-
constructor({ protocolFactory = null, reconnectTimeout = null,
|
|
212
|
+
constructor({ protocolFactory = null, reconnectTimeout = null, } = {}) {
|
|
213
213
|
this._entered = false;
|
|
214
214
|
this._allowDisconnectedRequests = false;
|
|
215
215
|
this._eventsController = new stream_controller_js_1.StreamController();
|
|
@@ -256,22 +256,16 @@ class RoomClient {
|
|
|
256
256
|
this.messaging = new messaging_client_js_1.MessagingClient({ room: this });
|
|
257
257
|
this.queues = new queues_client_js_1.QueuesClient({ room: this });
|
|
258
258
|
this.datasets = new datasets_client_js_1.DatasetsClient({ room: this });
|
|
259
|
+
this.sqlite = new sqlite_client_js_1.SqliteClient({ room: this });
|
|
259
260
|
this.agents = new agent_client_js_1.AgentsClient({ room: this });
|
|
260
|
-
this.secrets = new secrets_client_js_1.SecretsClient({
|
|
261
|
-
room: this,
|
|
262
|
-
oauthTokenRequestHandler,
|
|
263
|
-
secretRequestHandler,
|
|
264
|
-
});
|
|
265
261
|
this.containers = new containers_client_js_1.ContainersClient({ room: this });
|
|
266
262
|
this.memory = new memory_client_js_1.MemoryClient({ room: this });
|
|
267
263
|
this.services = new services_client_js_1.ServicesClient({ room: this });
|
|
268
264
|
}
|
|
269
|
-
static withIAP({ url = "./.well-known/meshagent/room/connect", reconnectTimeout = null,
|
|
265
|
+
static withIAP({ url = "./.well-known/meshagent/room/connect", reconnectTimeout = null, } = {}) {
|
|
270
266
|
return new RoomClient({
|
|
271
267
|
protocolFactory: () => protocol_js_1.WebSocketClientProtocol.withIAP({ url }),
|
|
272
268
|
reconnectTimeout,
|
|
273
|
-
oauthTokenRequestHandler,
|
|
274
|
-
secretRequestHandler,
|
|
275
269
|
});
|
|
276
270
|
}
|
|
277
271
|
get localParticipant() {
|