@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;
|
package/dist/esm/oauth-scopes.js
CHANGED
|
@@ -1,18 +1,68 @@
|
|
|
1
1
|
export const fullOAuthScopes = [
|
|
2
|
-
'profile',
|
|
2
|
+
'profile:read',
|
|
3
|
+
'profile:write',
|
|
3
4
|
'project/*',
|
|
4
5
|
'room/*',
|
|
5
|
-
'
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'
|
|
6
|
+
'users:create',
|
|
7
|
+
'users:read',
|
|
8
|
+
'users:update',
|
|
9
|
+
'users:delete',
|
|
10
|
+
'projects:read',
|
|
11
|
+
'projects:update',
|
|
12
|
+
'projects:iam.read',
|
|
13
|
+
'projects:iam.write',
|
|
14
|
+
'projects:billing.read',
|
|
15
|
+
'projects:billing.write',
|
|
16
|
+
'rooms:create',
|
|
17
|
+
'rooms:read',
|
|
18
|
+
'rooms:connect',
|
|
19
|
+
'rooms:update',
|
|
20
|
+
'rooms:delete',
|
|
21
|
+
'agents:create',
|
|
22
|
+
'agents:read',
|
|
23
|
+
'agents:update',
|
|
24
|
+
'agents:delete',
|
|
25
|
+
'agents:run',
|
|
26
|
+
'agents:sessions.read',
|
|
27
|
+
'mailboxes:create',
|
|
28
|
+
'mailboxes:read',
|
|
29
|
+
'mailboxes:update',
|
|
30
|
+
'mailboxes:delete',
|
|
31
|
+
'routes:create',
|
|
32
|
+
'routes:read',
|
|
33
|
+
'routes:update',
|
|
34
|
+
'routes:delete',
|
|
35
|
+
'scheduledTasks:create',
|
|
36
|
+
'scheduledTasks:read',
|
|
37
|
+
'scheduledTasks:update',
|
|
38
|
+
'scheduledTasks:delete',
|
|
39
|
+
'services:create',
|
|
40
|
+
'services:read',
|
|
41
|
+
'services:update',
|
|
42
|
+
'services:delete',
|
|
43
|
+
'repositories:create',
|
|
44
|
+
'repositories:read',
|
|
45
|
+
'repositories:update',
|
|
46
|
+
'repositories:delete',
|
|
47
|
+
'apiKeys:create',
|
|
48
|
+
'apiKeys:read',
|
|
49
|
+
'apiKeys:delete',
|
|
50
|
+
'serviceAccounts:create',
|
|
51
|
+
'serviceAccounts:read',
|
|
52
|
+
'serviceAccounts:update',
|
|
53
|
+
'serviceAccounts:delete',
|
|
54
|
+
'oauthClients:create',
|
|
55
|
+
'oauthClients:read',
|
|
56
|
+
'oauthClients:update',
|
|
57
|
+
'oauthClients:delete',
|
|
58
|
+
'llm:invoke',
|
|
59
|
+
'llm:usage.read',
|
|
60
|
+
'llm:logs.read',
|
|
61
|
+
'llm:logs.write',
|
|
62
|
+
'secrets:read',
|
|
63
|
+
'secrets:write',
|
|
64
|
+
'secrets:delete',
|
|
65
|
+
'secrets:grant',
|
|
66
|
+
'secrets:proxy',
|
|
17
67
|
];
|
|
18
|
-
export const fullOAuthScope = '
|
|
68
|
+
export const fullOAuthScope = 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;
|
|
@@ -288,6 +288,215 @@ export class DatasetGrant {
|
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
+
export class SqliteTableGrant {
|
|
292
|
+
constructor({ database, table, namespace, write, read, alter, }) {
|
|
293
|
+
this.database = database;
|
|
294
|
+
this.table = table;
|
|
295
|
+
this.namespace = namespace;
|
|
296
|
+
this.write = write ?? true;
|
|
297
|
+
this.read = read ?? true;
|
|
298
|
+
this.alter = alter ?? false;
|
|
299
|
+
}
|
|
300
|
+
toJSON() {
|
|
301
|
+
const json = {
|
|
302
|
+
database: this.database,
|
|
303
|
+
table: this.table,
|
|
304
|
+
};
|
|
305
|
+
if (this.namespace !== undefined) {
|
|
306
|
+
json["namespace"] = this.namespace;
|
|
307
|
+
}
|
|
308
|
+
if (this.write !== true) {
|
|
309
|
+
json["write"] = this.write;
|
|
310
|
+
}
|
|
311
|
+
if (this.read !== true) {
|
|
312
|
+
json["read"] = this.read;
|
|
313
|
+
}
|
|
314
|
+
if (this.alter !== false) {
|
|
315
|
+
json["alter"] = this.alter;
|
|
316
|
+
}
|
|
317
|
+
return json;
|
|
318
|
+
}
|
|
319
|
+
static fromJSON(obj) {
|
|
320
|
+
if (!isRecord(obj) || typeof obj.database !== "string" || typeof obj.table !== "string") {
|
|
321
|
+
throw new Error("SqliteTableGrant requires database and table");
|
|
322
|
+
}
|
|
323
|
+
return new SqliteTableGrant({
|
|
324
|
+
database: obj.database,
|
|
325
|
+
table: obj.table,
|
|
326
|
+
namespace: asStringList(obj.namespace),
|
|
327
|
+
write: obj.write,
|
|
328
|
+
read: obj.read,
|
|
329
|
+
alter: obj.alter,
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
export class SqliteDatabaseGrant {
|
|
334
|
+
constructor({ name, namespace, createTable, drop, inspect, listTables, execute, tables, }) {
|
|
335
|
+
this.name = name;
|
|
336
|
+
this.namespace = namespace;
|
|
337
|
+
this.createTable = createTable ?? true;
|
|
338
|
+
this.drop = drop ?? false;
|
|
339
|
+
this.inspect = inspect ?? true;
|
|
340
|
+
this.listTables = listTables ?? true;
|
|
341
|
+
this.execute = execute ?? true;
|
|
342
|
+
this.tables = tables;
|
|
343
|
+
}
|
|
344
|
+
toJSON() {
|
|
345
|
+
const json = { name: this.name };
|
|
346
|
+
if (this.namespace !== undefined) {
|
|
347
|
+
json["namespace"] = this.namespace;
|
|
348
|
+
}
|
|
349
|
+
if (this.createTable !== true) {
|
|
350
|
+
json["create_table"] = this.createTable;
|
|
351
|
+
}
|
|
352
|
+
if (this.drop !== false) {
|
|
353
|
+
json["drop"] = this.drop;
|
|
354
|
+
}
|
|
355
|
+
if (this.inspect !== true) {
|
|
356
|
+
json["inspect"] = this.inspect;
|
|
357
|
+
}
|
|
358
|
+
if (this.listTables !== true) {
|
|
359
|
+
json["list_tables"] = this.listTables;
|
|
360
|
+
}
|
|
361
|
+
if (this.execute !== true) {
|
|
362
|
+
json["execute"] = this.execute;
|
|
363
|
+
}
|
|
364
|
+
if (this.tables !== undefined) {
|
|
365
|
+
json["tables"] = this.tables.map((tableGrant) => tableGrant.toJSON());
|
|
366
|
+
}
|
|
367
|
+
return json;
|
|
368
|
+
}
|
|
369
|
+
static fromJSON(obj) {
|
|
370
|
+
if (!isRecord(obj) || typeof obj.name !== "string") {
|
|
371
|
+
throw new Error("SqliteDatabaseGrant requires a name");
|
|
372
|
+
}
|
|
373
|
+
return new SqliteDatabaseGrant({
|
|
374
|
+
name: obj.name,
|
|
375
|
+
namespace: asStringList(obj.namespace),
|
|
376
|
+
createTable: obj.create_table ?? obj.createTable,
|
|
377
|
+
drop: obj.drop,
|
|
378
|
+
inspect: obj.inspect,
|
|
379
|
+
listTables: obj.list_tables ?? obj.listTables,
|
|
380
|
+
execute: obj.execute,
|
|
381
|
+
tables: Array.isArray(obj.tables)
|
|
382
|
+
? obj.tables.map((tableGrant) => SqliteTableGrant.fromJSON(tableGrant))
|
|
383
|
+
: undefined,
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
export class SqliteGrant {
|
|
388
|
+
constructor({ databases, createDatabase, listDatabases, } = {}) {
|
|
389
|
+
this.databases = databases;
|
|
390
|
+
this.createDatabase = createDatabase ?? true;
|
|
391
|
+
this.listDatabases = listDatabases ?? true;
|
|
392
|
+
}
|
|
393
|
+
matchingDatabases(database, namespace) {
|
|
394
|
+
if (this.databases === undefined) {
|
|
395
|
+
return [];
|
|
396
|
+
}
|
|
397
|
+
return this.databases.filter((databaseGrant) => {
|
|
398
|
+
if (databaseGrant.name !== database) {
|
|
399
|
+
return false;
|
|
400
|
+
}
|
|
401
|
+
if (databaseGrant.namespace === undefined) {
|
|
402
|
+
return true;
|
|
403
|
+
}
|
|
404
|
+
return namespacesEqual(databaseGrant.namespace, namespace);
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
matchingTables(database, table, namespace) {
|
|
408
|
+
return this.matchingDatabases(database, namespace)
|
|
409
|
+
.flatMap((databaseGrant) => databaseGrant.tables ?? [])
|
|
410
|
+
.filter((tableGrant) => {
|
|
411
|
+
if (tableGrant.database !== database || tableGrant.table !== table) {
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
if (tableGrant.namespace === undefined) {
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
return namespacesEqual(tableGrant.namespace, namespace);
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
canCreateDatabase() {
|
|
421
|
+
return this.createDatabase;
|
|
422
|
+
}
|
|
423
|
+
canListDatabases() {
|
|
424
|
+
return this.listDatabases;
|
|
425
|
+
}
|
|
426
|
+
canDropDatabase(database, namespace) {
|
|
427
|
+
if (this.databases === undefined) {
|
|
428
|
+
return true;
|
|
429
|
+
}
|
|
430
|
+
return this.matchingDatabases(database, namespace).some((databaseGrant) => databaseGrant.drop);
|
|
431
|
+
}
|
|
432
|
+
canInspectDatabase(database, namespace) {
|
|
433
|
+
if (this.databases === undefined) {
|
|
434
|
+
return true;
|
|
435
|
+
}
|
|
436
|
+
return this.matchingDatabases(database, namespace).some((databaseGrant) => databaseGrant.inspect);
|
|
437
|
+
}
|
|
438
|
+
canListTables(database, namespace) {
|
|
439
|
+
if (this.databases === undefined) {
|
|
440
|
+
return true;
|
|
441
|
+
}
|
|
442
|
+
return this.matchingDatabases(database, namespace).some((databaseGrant) => databaseGrant.listTables);
|
|
443
|
+
}
|
|
444
|
+
canCreateTable(database, namespace) {
|
|
445
|
+
if (this.databases === undefined) {
|
|
446
|
+
return true;
|
|
447
|
+
}
|
|
448
|
+
return this.matchingDatabases(database, namespace).some((databaseGrant) => databaseGrant.createTable);
|
|
449
|
+
}
|
|
450
|
+
canExecute(database, namespace) {
|
|
451
|
+
if (this.databases === undefined) {
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
return this.matchingDatabases(database, namespace).some((databaseGrant) => databaseGrant.execute);
|
|
455
|
+
}
|
|
456
|
+
canWrite(database, table, namespace) {
|
|
457
|
+
if (this.databases === undefined) {
|
|
458
|
+
return true;
|
|
459
|
+
}
|
|
460
|
+
return this.matchingTables(database, table, namespace).some((tableGrant) => tableGrant.write);
|
|
461
|
+
}
|
|
462
|
+
canRead(database, table, namespace) {
|
|
463
|
+
if (this.databases === undefined) {
|
|
464
|
+
return true;
|
|
465
|
+
}
|
|
466
|
+
return this.matchingTables(database, table, namespace).some((tableGrant) => tableGrant.read);
|
|
467
|
+
}
|
|
468
|
+
canAlter(database, table, namespace) {
|
|
469
|
+
if (this.databases === undefined) {
|
|
470
|
+
return true;
|
|
471
|
+
}
|
|
472
|
+
return this.matchingTables(database, table, namespace).some((tableGrant) => tableGrant.alter);
|
|
473
|
+
}
|
|
474
|
+
toJSON() {
|
|
475
|
+
const json = {};
|
|
476
|
+
if (this.databases !== undefined) {
|
|
477
|
+
json["databases"] = this.databases.map((databaseGrant) => databaseGrant.toJSON());
|
|
478
|
+
}
|
|
479
|
+
if (this.createDatabase !== true) {
|
|
480
|
+
json["create_database"] = this.createDatabase;
|
|
481
|
+
}
|
|
482
|
+
if (this.listDatabases !== true) {
|
|
483
|
+
json["list_databases"] = this.listDatabases;
|
|
484
|
+
}
|
|
485
|
+
return json;
|
|
486
|
+
}
|
|
487
|
+
static fromJSON(obj) {
|
|
488
|
+
if (!isRecord(obj)) {
|
|
489
|
+
return new SqliteGrant();
|
|
490
|
+
}
|
|
491
|
+
return new SqliteGrant({
|
|
492
|
+
databases: Array.isArray(obj.databases)
|
|
493
|
+
? obj.databases.map((databaseGrant) => SqliteDatabaseGrant.fromJSON(databaseGrant))
|
|
494
|
+
: undefined,
|
|
495
|
+
createDatabase: obj.create_database ?? obj.createDatabase,
|
|
496
|
+
listDatabases: obj.list_databases ?? obj.listDatabases,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
}
|
|
291
500
|
export class MemoryPermissions {
|
|
292
501
|
constructor({ create, drop, inspect, query, upsert, ingest, recall, optimize, } = {}) {
|
|
293
502
|
this.create = create ?? true;
|
|
@@ -750,71 +959,25 @@ export class AdminGrant {
|
|
|
750
959
|
});
|
|
751
960
|
}
|
|
752
961
|
}
|
|
753
|
-
export class OAuthEndpoint {
|
|
754
|
-
constructor({ endpoint, clientId }) {
|
|
755
|
-
this.endpoint = endpoint;
|
|
756
|
-
this.clientId = clientId;
|
|
757
|
-
}
|
|
758
|
-
toJSON() {
|
|
759
|
-
return {
|
|
760
|
-
endpoint: this.endpoint,
|
|
761
|
-
client_id: this.clientId,
|
|
762
|
-
};
|
|
763
|
-
}
|
|
764
|
-
static fromJSON(obj) {
|
|
765
|
-
if (!isRecord(obj) || typeof obj.endpoint !== "string") {
|
|
766
|
-
throw new Error("OAuthEndpoint requires an endpoint");
|
|
767
|
-
}
|
|
768
|
-
const clientId = obj.client_id ?? obj.clientId;
|
|
769
|
-
if (typeof clientId !== "string") {
|
|
770
|
-
throw new Error("OAuthEndpoint requires a client_id");
|
|
771
|
-
}
|
|
772
|
-
return new OAuthEndpoint({
|
|
773
|
-
endpoint: obj.endpoint,
|
|
774
|
-
clientId,
|
|
775
|
-
});
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
962
|
export class SecretsGrant {
|
|
779
|
-
constructor(
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
void connector;
|
|
784
|
-
if (this.requestOauthToken === undefined) {
|
|
785
|
-
return true;
|
|
963
|
+
constructor(options = {}) {
|
|
964
|
+
const keys = Object.keys(options);
|
|
965
|
+
if (keys.length > 0) {
|
|
966
|
+
throw new Error(`unsupported SecretsGrant fields: ${keys.join(", ")}`);
|
|
786
967
|
}
|
|
787
|
-
const authorizationEndpoint = typeof oauth?.authorization_endpoint === "string"
|
|
788
|
-
? oauth.authorization_endpoint.trim()
|
|
789
|
-
: "";
|
|
790
|
-
const clientId = typeof oauth?.client_id === "string"
|
|
791
|
-
? oauth.client_id.trim()
|
|
792
|
-
: "";
|
|
793
|
-
if (authorizationEndpoint === "" || clientId === "") {
|
|
794
|
-
return false;
|
|
795
|
-
}
|
|
796
|
-
return this.requestOauthToken.some((endpointGrant) => ((endpointGrant.endpoint === authorizationEndpoint
|
|
797
|
-
|| (endpointGrant.endpoint.endsWith("*")
|
|
798
|
-
&& authorizationEndpoint.startsWith(endpointGrant.endpoint.slice(0, -1))))
|
|
799
|
-
&& endpointGrant.clientId === clientId));
|
|
800
968
|
}
|
|
801
969
|
toJSON() {
|
|
802
|
-
|
|
803
|
-
if (this.requestOauthToken !== undefined) {
|
|
804
|
-
json["request_oauth_token"] = this.requestOauthToken.map((endpointGrant) => endpointGrant.toJSON());
|
|
805
|
-
}
|
|
806
|
-
return json;
|
|
970
|
+
return {};
|
|
807
971
|
}
|
|
808
972
|
static fromJSON(obj) {
|
|
809
973
|
if (!isRecord(obj)) {
|
|
810
974
|
return new SecretsGrant();
|
|
811
975
|
}
|
|
812
|
-
const
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
});
|
|
976
|
+
const keys = Object.keys(obj);
|
|
977
|
+
if (keys.length > 0) {
|
|
978
|
+
throw new Error(`unsupported SecretsGrant fields: ${keys.join(", ")}`);
|
|
979
|
+
}
|
|
980
|
+
return new SecretsGrant();
|
|
818
981
|
}
|
|
819
982
|
}
|
|
820
983
|
export class TunnelsGrant {
|
|
@@ -897,11 +1060,12 @@ export class LLMGrant {
|
|
|
897
1060
|
}
|
|
898
1061
|
}
|
|
899
1062
|
export class ApiScope {
|
|
900
|
-
constructor({ livekit, queues, messaging, dataset, memory, sync, storage, containers, developer, agents, llm, admin, secrets, tunnels, services, } = {}) {
|
|
1063
|
+
constructor({ livekit, queues, messaging, dataset, sqlite, memory, sync, storage, containers, developer, agents, llm, admin, secrets, tunnels, services, } = {}) {
|
|
901
1064
|
this.livekit = livekit;
|
|
902
1065
|
this.queues = queues;
|
|
903
1066
|
this.messaging = messaging;
|
|
904
1067
|
this.dataset = dataset;
|
|
1068
|
+
this.sqlite = sqlite;
|
|
905
1069
|
this.memory = memory;
|
|
906
1070
|
this.sync = sync;
|
|
907
1071
|
this.storage = storage;
|
|
@@ -920,6 +1084,7 @@ export class ApiScope {
|
|
|
920
1084
|
queues: new QueuesGrant(),
|
|
921
1085
|
messaging: new MessagingGrant(),
|
|
922
1086
|
dataset: new DatasetGrant(),
|
|
1087
|
+
sqlite: new SqliteGrant(),
|
|
923
1088
|
memory: new MemoryGrant(),
|
|
924
1089
|
sync: new SyncGrant(),
|
|
925
1090
|
storage: new StorageGrant(),
|
|
@@ -936,6 +1101,7 @@ export class ApiScope {
|
|
|
936
1101
|
queues: new QueuesGrant(),
|
|
937
1102
|
messaging: new MessagingGrant(),
|
|
938
1103
|
dataset: new DatasetGrant(),
|
|
1104
|
+
sqlite: new SqliteGrant(),
|
|
939
1105
|
memory: new MemoryGrant(),
|
|
940
1106
|
sync: new SyncGrant(),
|
|
941
1107
|
storage: new StorageGrant(),
|
|
@@ -943,7 +1109,6 @@ export class ApiScope {
|
|
|
943
1109
|
developer: new DeveloperGrant(),
|
|
944
1110
|
agents: new AgentsGrant(),
|
|
945
1111
|
llm: new LLMGrant(),
|
|
946
|
-
secrets: new SecretsGrant(),
|
|
947
1112
|
services: new ServicesGrant(),
|
|
948
1113
|
});
|
|
949
1114
|
}
|
|
@@ -953,6 +1118,7 @@ export class ApiScope {
|
|
|
953
1118
|
queues: new QueuesGrant(),
|
|
954
1119
|
messaging: new MessagingGrant(),
|
|
955
1120
|
dataset: new DatasetGrant(),
|
|
1121
|
+
sqlite: new SqliteGrant(),
|
|
956
1122
|
memory: new MemoryGrant(),
|
|
957
1123
|
sync: new SyncGrant(),
|
|
958
1124
|
storage: new StorageGrant(),
|
|
@@ -961,7 +1127,6 @@ export class ApiScope {
|
|
|
961
1127
|
agents: new AgentsGrant(),
|
|
962
1128
|
llm: new LLMGrant(),
|
|
963
1129
|
admin: new AdminGrant(),
|
|
964
|
-
secrets: new SecretsGrant(),
|
|
965
1130
|
tunnels: new TunnelsGrant(),
|
|
966
1131
|
services: new ServicesGrant(),
|
|
967
1132
|
});
|
|
@@ -980,6 +1145,9 @@ export class ApiScope {
|
|
|
980
1145
|
if (this.dataset !== undefined) {
|
|
981
1146
|
json["dataset"] = this.dataset.toJSON();
|
|
982
1147
|
}
|
|
1148
|
+
if (this.sqlite !== undefined) {
|
|
1149
|
+
json["sqlite"] = this.sqlite.toJSON();
|
|
1150
|
+
}
|
|
983
1151
|
if (this.memory !== undefined) {
|
|
984
1152
|
json["memory"] = this.memory.toJSON();
|
|
985
1153
|
}
|
|
@@ -1025,6 +1193,7 @@ export class ApiScope {
|
|
|
1025
1193
|
queues: obj.queues ? QueuesGrant.fromJSON(obj.queues) : undefined,
|
|
1026
1194
|
messaging: obj.messaging ? MessagingGrant.fromJSON(obj.messaging) : undefined,
|
|
1027
1195
|
dataset: rawDataset ? DatasetGrant.fromJSON(rawDataset) : undefined,
|
|
1196
|
+
sqlite: obj.sqlite ? SqliteGrant.fromJSON(obj.sqlite) : undefined,
|
|
1028
1197
|
memory: obj.memory ? MemoryGrant.fromJSON(obj.memory) : undefined,
|
|
1029
1198
|
sync: obj.sync ? SyncGrant.fromJSON(obj.sync) : undefined,
|
|
1030
1199
|
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/esm/room-client.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Completer } from "./completer.js";
|
|
2
2
|
import { DatasetsClient } from "./datasets-client.js";
|
|
3
|
+
import { SqliteClient } from "./sqlite-client.js";
|
|
3
4
|
import { DeveloperClient } from "./developer-client.js";
|
|
4
5
|
import { EventEmitter } from "./event-emitter.js";
|
|
5
6
|
import { MessagingClient } from "./messaging-client.js";
|
|
@@ -10,7 +11,6 @@ import { QueuesClient } from "./queues-client.js";
|
|
|
10
11
|
import { BinaryContent, ControlCloseStatus, ControlContent, EmptyContent, ErrorContent, FileContent, JsonContent, LinkContent, TextContent, unpackContent } from "./response.js";
|
|
11
12
|
import { RoomStatusEvent } from "./room-event.js";
|
|
12
13
|
import { RoomServerException } from "./room-server-client.js";
|
|
13
|
-
import { SecretsClient } from "./secrets-client.js";
|
|
14
14
|
import { ServicesClient } from "./services-client.js";
|
|
15
15
|
import { StorageClient } from "./storage-client.js";
|
|
16
16
|
import { StreamController } from "./stream-controller.js";
|
|
@@ -205,7 +205,7 @@ export class RoomProtocolProxy {
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
export class RoomClient {
|
|
208
|
-
constructor({ protocolFactory = null, reconnectTimeout = null,
|
|
208
|
+
constructor({ protocolFactory = null, reconnectTimeout = null, } = {}) {
|
|
209
209
|
this._entered = false;
|
|
210
210
|
this._allowDisconnectedRequests = false;
|
|
211
211
|
this._eventsController = new StreamController();
|
|
@@ -252,22 +252,16 @@ export class RoomClient {
|
|
|
252
252
|
this.messaging = new MessagingClient({ room: this });
|
|
253
253
|
this.queues = new QueuesClient({ room: this });
|
|
254
254
|
this.datasets = new DatasetsClient({ room: this });
|
|
255
|
+
this.sqlite = new SqliteClient({ room: this });
|
|
255
256
|
this.agents = new AgentsClient({ room: this });
|
|
256
|
-
this.secrets = new SecretsClient({
|
|
257
|
-
room: this,
|
|
258
|
-
oauthTokenRequestHandler,
|
|
259
|
-
secretRequestHandler,
|
|
260
|
-
});
|
|
261
257
|
this.containers = new ContainersClient({ room: this });
|
|
262
258
|
this.memory = new MemoryClient({ room: this });
|
|
263
259
|
this.services = new ServicesClient({ room: this });
|
|
264
260
|
}
|
|
265
|
-
static withIAP({ url = "./.well-known/meshagent/room/connect", reconnectTimeout = null,
|
|
261
|
+
static withIAP({ url = "./.well-known/meshagent/room/connect", reconnectTimeout = null, } = {}) {
|
|
266
262
|
return new RoomClient({
|
|
267
263
|
protocolFactory: () => WebSocketClientProtocol.withIAP({ url }),
|
|
268
264
|
reconnectTimeout,
|
|
269
|
-
oauthTokenRequestHandler,
|
|
270
|
-
secretRequestHandler,
|
|
271
265
|
});
|
|
272
266
|
}
|
|
273
267
|
get localParticipant() {
|
|
@@ -9,6 +9,17 @@ export interface ServiceRuntimeState {
|
|
|
9
9
|
restartCount: number;
|
|
10
10
|
lastExitCode?: number;
|
|
11
11
|
lastExitAt?: number;
|
|
12
|
+
lastStartError?: string;
|
|
13
|
+
lastStartErrorAt?: number;
|
|
14
|
+
events: ServiceRuntimeEvent[];
|
|
15
|
+
}
|
|
16
|
+
export interface ServiceRuntimeEvent {
|
|
17
|
+
type: string;
|
|
18
|
+
reason: string;
|
|
19
|
+
message: string;
|
|
20
|
+
count: number;
|
|
21
|
+
firstTimestamp: number;
|
|
22
|
+
lastTimestamp: number;
|
|
12
23
|
}
|
|
13
24
|
export interface ListServicesResult {
|
|
14
25
|
services: ServiceSpec[];
|