@meshagent/meshagent 0.36.3 → 0.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/browser/agent-client.d.ts +2 -10
- package/dist/browser/agent-client.js +2 -30
- package/dist/browser/agent.d.ts +22 -22
- package/dist/browser/agent.js +36 -16
- package/dist/browser/containers-client.d.ts +7 -19
- package/dist/browser/containers-client.js +27 -21
- package/dist/browser/data-types.d.ts +12 -0
- package/dist/browser/data-types.js +39 -1
- package/dist/browser/database-client.d.ts +134 -47
- package/dist/browser/database-client.js +359 -133
- package/dist/browser/index.d.ts +1 -0
- package/dist/browser/index.js +1 -0
- package/dist/browser/meshagent-client.js +12 -1
- package/dist/browser/participant-token.d.ts +189 -22
- package/dist/browser/participant-token.js +1001 -189
- package/dist/browser/room-client.d.ts +1 -1
- package/dist/browser/services-client.d.ts +1 -1
- package/dist/browser/version.d.ts +1 -0
- package/dist/browser/version.js +4 -0
- package/dist/esm/agent-client.d.ts +2 -10
- package/dist/esm/agent-client.js +1 -28
- package/dist/esm/agent.d.ts +22 -22
- package/dist/esm/agent.js +33 -14
- package/dist/esm/containers-client.d.ts +7 -19
- package/dist/esm/containers-client.js +27 -21
- package/dist/esm/data-types.d.ts +12 -0
- package/dist/esm/data-types.js +36 -0
- package/dist/esm/database-client.d.ts +134 -47
- package/dist/esm/database-client.js +352 -132
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/meshagent-client.js +12 -1
- package/dist/esm/participant-token.d.ts +189 -22
- package/dist/esm/participant-token.js +992 -188
- package/dist/esm/room-client.d.ts +1 -1
- package/dist/esm/services-client.d.ts +1 -1
- package/dist/esm/version.d.ts +1 -0
- package/dist/esm/version.js +1 -0
- package/dist/node/agent-client.d.ts +2 -10
- package/dist/node/agent-client.js +2 -30
- package/dist/node/agent.d.ts +22 -22
- package/dist/node/agent.js +36 -16
- package/dist/node/containers-client.d.ts +7 -19
- package/dist/node/containers-client.js +27 -21
- package/dist/node/data-types.d.ts +12 -0
- package/dist/node/data-types.js +39 -1
- package/dist/node/database-client.d.ts +134 -47
- package/dist/node/database-client.js +359 -133
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +1 -0
- package/dist/node/meshagent-client.js +12 -1
- package/dist/node/participant-token.d.ts +189 -22
- package/dist/node/participant-token.js +1001 -189
- package/dist/node/room-client.d.ts +1 -1
- package/dist/node/services-client.d.ts +1 -1
- package/dist/node/version.d.ts +1 -0
- package/dist/node/version.js +4 -0
- package/package.json +1 -1
package/dist/browser/index.d.ts
CHANGED
package/dist/browser/index.js
CHANGED
|
@@ -73,6 +73,17 @@ function base64ToBytes(base64) {
|
|
|
73
73
|
}
|
|
74
74
|
return bytes;
|
|
75
75
|
}
|
|
76
|
+
function toFetchBody(body) {
|
|
77
|
+
if (body == null) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
if (typeof body === "string" || body instanceof ArrayBuffer) {
|
|
81
|
+
return body;
|
|
82
|
+
}
|
|
83
|
+
const copy = new Uint8Array(body.byteLength);
|
|
84
|
+
copy.set(body);
|
|
85
|
+
return copy.buffer;
|
|
86
|
+
}
|
|
76
87
|
function normalizeBinary(data) {
|
|
77
88
|
if (data instanceof Uint8Array) {
|
|
78
89
|
return data;
|
|
@@ -126,7 +137,7 @@ class Meshagent {
|
|
|
126
137
|
const response = await fetch(url, {
|
|
127
138
|
method,
|
|
128
139
|
headers: finalHeaders,
|
|
129
|
-
body: requestBody
|
|
140
|
+
body: toFetchBody(requestBody),
|
|
130
141
|
});
|
|
131
142
|
if (!response.ok) {
|
|
132
143
|
let message;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ConnectorRef, OAuthClientConfig } from "./meshagent-client";
|
|
1
2
|
export type StringList = string[];
|
|
2
3
|
export declare class AgentsGrant {
|
|
3
4
|
registerAgent: boolean;
|
|
@@ -6,14 +7,18 @@ export declare class AgentsGrant {
|
|
|
6
7
|
call: boolean;
|
|
7
8
|
useAgents: boolean;
|
|
8
9
|
useTools: boolean;
|
|
9
|
-
|
|
10
|
+
allowedToolkits?: StringList;
|
|
11
|
+
constructor({ registerAgent, registerPublicToolkit, registerPrivateToolkit, call, useAgents, useTools, allowedToolkits, }?: {
|
|
10
12
|
registerAgent?: boolean;
|
|
11
13
|
registerPublicToolkit?: boolean;
|
|
12
14
|
registerPrivateToolkit?: boolean;
|
|
13
15
|
call?: boolean;
|
|
14
16
|
useAgents?: boolean;
|
|
15
17
|
useTools?: boolean;
|
|
18
|
+
allowedToolkits?: StringList;
|
|
16
19
|
});
|
|
20
|
+
toJSON(): Record<string, any>;
|
|
21
|
+
static fromJSON(obj: unknown): AgentsGrant;
|
|
17
22
|
}
|
|
18
23
|
export declare class LivekitGrant {
|
|
19
24
|
breakoutRooms?: StringList;
|
|
@@ -21,52 +26,120 @@ export declare class LivekitGrant {
|
|
|
21
26
|
breakoutRooms?: StringList;
|
|
22
27
|
});
|
|
23
28
|
canJoinBreakoutRoom(name: string): boolean;
|
|
29
|
+
toJSON(): Record<string, any>;
|
|
30
|
+
static fromJSON(obj: unknown): LivekitGrant;
|
|
24
31
|
}
|
|
25
32
|
export declare class QueuesGrant {
|
|
26
33
|
send?: StringList;
|
|
27
34
|
receive?: StringList;
|
|
28
35
|
list: boolean;
|
|
29
|
-
constructor({ send, receive, list }?: {
|
|
36
|
+
constructor({ send, receive, list, }?: {
|
|
30
37
|
send?: StringList;
|
|
31
38
|
receive?: StringList;
|
|
32
39
|
list?: boolean;
|
|
33
40
|
});
|
|
34
|
-
canSend(
|
|
35
|
-
canReceive(
|
|
41
|
+
canSend(queue: string): boolean;
|
|
42
|
+
canReceive(queue: string): boolean;
|
|
43
|
+
toJSON(): Record<string, any>;
|
|
44
|
+
static fromJSON(obj: unknown): QueuesGrant;
|
|
36
45
|
}
|
|
37
46
|
export declare class MessagingGrant {
|
|
38
47
|
broadcast: boolean;
|
|
39
48
|
list: boolean;
|
|
40
49
|
send: boolean;
|
|
41
|
-
constructor({ broadcast, list, send }?: {
|
|
50
|
+
constructor({ broadcast, list, send, }?: {
|
|
42
51
|
broadcast?: boolean;
|
|
43
52
|
list?: boolean;
|
|
44
53
|
send?: boolean;
|
|
45
54
|
});
|
|
55
|
+
toJSON(): Record<string, any>;
|
|
56
|
+
static fromJSON(obj: unknown): MessagingGrant;
|
|
46
57
|
}
|
|
47
58
|
export declare class TableGrant {
|
|
48
59
|
name: string;
|
|
60
|
+
namespace?: StringList;
|
|
49
61
|
write: boolean;
|
|
50
62
|
read: boolean;
|
|
51
63
|
alter: boolean;
|
|
52
|
-
constructor({ name, write, read, alter }: {
|
|
64
|
+
constructor({ name, namespace, write, read, alter, }: {
|
|
53
65
|
name: string;
|
|
66
|
+
namespace?: StringList;
|
|
54
67
|
write?: boolean;
|
|
55
68
|
read?: boolean;
|
|
56
69
|
alter?: boolean;
|
|
57
70
|
});
|
|
71
|
+
toJSON(): Record<string, any>;
|
|
72
|
+
static fromJSON(obj: unknown): TableGrant;
|
|
58
73
|
}
|
|
59
74
|
export declare class DatabaseGrant {
|
|
60
75
|
tables?: TableGrant[];
|
|
61
76
|
listTables: boolean;
|
|
62
|
-
constructor({ tables, listTables }?: {
|
|
77
|
+
constructor({ tables, listTables, }?: {
|
|
63
78
|
tables?: TableGrant[];
|
|
64
79
|
listTables?: boolean;
|
|
65
80
|
});
|
|
66
|
-
private
|
|
67
|
-
canWrite(table: string): boolean;
|
|
68
|
-
canRead(table: string): boolean;
|
|
69
|
-
canAlter(table: string): boolean;
|
|
81
|
+
private matchingTables;
|
|
82
|
+
canWrite(table: string, namespace?: StringList): boolean;
|
|
83
|
+
canRead(table: string, namespace?: StringList): boolean;
|
|
84
|
+
canAlter(table: string, namespace?: StringList): boolean;
|
|
85
|
+
canAccess(table: string, namespace?: StringList): boolean;
|
|
86
|
+
toJSON(): Record<string, any>;
|
|
87
|
+
static fromJSON(obj: unknown): DatabaseGrant;
|
|
88
|
+
}
|
|
89
|
+
export declare class MemoryPermissions {
|
|
90
|
+
create: boolean;
|
|
91
|
+
drop: boolean;
|
|
92
|
+
inspect: boolean;
|
|
93
|
+
query: boolean;
|
|
94
|
+
upsert: boolean;
|
|
95
|
+
ingest: boolean;
|
|
96
|
+
recall: boolean;
|
|
97
|
+
optimize: boolean;
|
|
98
|
+
constructor({ create, drop, inspect, query, upsert, ingest, recall, optimize, }?: {
|
|
99
|
+
create?: boolean;
|
|
100
|
+
drop?: boolean;
|
|
101
|
+
inspect?: boolean;
|
|
102
|
+
query?: boolean;
|
|
103
|
+
upsert?: boolean;
|
|
104
|
+
ingest?: boolean;
|
|
105
|
+
recall?: boolean;
|
|
106
|
+
optimize?: boolean;
|
|
107
|
+
});
|
|
108
|
+
toJSON(): Record<string, any>;
|
|
109
|
+
static fromJSON(obj: unknown): MemoryPermissions;
|
|
110
|
+
}
|
|
111
|
+
export declare class MemoryEntryGrant {
|
|
112
|
+
name: string;
|
|
113
|
+
namespace?: StringList;
|
|
114
|
+
permissions: MemoryPermissions;
|
|
115
|
+
constructor({ name, namespace, permissions, }: {
|
|
116
|
+
name: string;
|
|
117
|
+
namespace?: StringList;
|
|
118
|
+
permissions?: MemoryPermissions;
|
|
119
|
+
});
|
|
120
|
+
toJSON(): Record<string, any>;
|
|
121
|
+
static fromJSON(obj: unknown): MemoryEntryGrant;
|
|
122
|
+
}
|
|
123
|
+
export declare class MemoryGrant {
|
|
124
|
+
list: boolean;
|
|
125
|
+
memories?: MemoryEntryGrant[];
|
|
126
|
+
constructor({ list, memories, }?: {
|
|
127
|
+
list?: boolean;
|
|
128
|
+
memories?: MemoryEntryGrant[];
|
|
129
|
+
});
|
|
130
|
+
private matchingMemories;
|
|
131
|
+
private can;
|
|
132
|
+
canCreate(name: string, namespace?: StringList): boolean;
|
|
133
|
+
canDrop(name: string, namespace?: StringList): boolean;
|
|
134
|
+
canInspect(name: string, namespace?: StringList): boolean;
|
|
135
|
+
canQuery(name: string, namespace?: StringList): boolean;
|
|
136
|
+
canUpsert(name: string, namespace?: StringList): boolean;
|
|
137
|
+
canIngest(name: string, namespace?: StringList): boolean;
|
|
138
|
+
canRecall(name: string, namespace?: StringList): boolean;
|
|
139
|
+
canOptimize(name: string, namespace?: StringList): boolean;
|
|
140
|
+
canAccessExisting(name: string, namespace?: StringList): boolean;
|
|
141
|
+
toJSON(): Record<string, any>;
|
|
142
|
+
static fromJSON(obj: unknown): MemoryGrant;
|
|
70
143
|
}
|
|
71
144
|
export declare class SyncPathGrant {
|
|
72
145
|
path: string;
|
|
@@ -75,6 +148,8 @@ export declare class SyncPathGrant {
|
|
|
75
148
|
path: string;
|
|
76
149
|
readOnly?: boolean;
|
|
77
150
|
});
|
|
151
|
+
toJSON(): Record<string, any>;
|
|
152
|
+
static fromJSON(obj: unknown): SyncPathGrant;
|
|
78
153
|
}
|
|
79
154
|
export declare class SyncGrant {
|
|
80
155
|
paths?: SyncPathGrant[];
|
|
@@ -84,6 +159,8 @@ export declare class SyncGrant {
|
|
|
84
159
|
private matches;
|
|
85
160
|
canRead(path: string): boolean;
|
|
86
161
|
canWrite(path: string): boolean;
|
|
162
|
+
toJSON(): Record<string, any>;
|
|
163
|
+
static fromJSON(obj: unknown): SyncGrant;
|
|
87
164
|
}
|
|
88
165
|
export declare class StoragePathGrant {
|
|
89
166
|
path: string;
|
|
@@ -92,73 +169,163 @@ export declare class StoragePathGrant {
|
|
|
92
169
|
path: string;
|
|
93
170
|
readOnly?: boolean;
|
|
94
171
|
});
|
|
172
|
+
toJSON(): Record<string, any>;
|
|
173
|
+
static fromJSON(obj: unknown): StoragePathGrant;
|
|
95
174
|
}
|
|
96
175
|
export declare class StorageGrant {
|
|
97
176
|
paths?: StoragePathGrant[];
|
|
98
177
|
constructor({ paths }?: {
|
|
99
178
|
paths?: StoragePathGrant[];
|
|
100
179
|
});
|
|
101
|
-
private matches;
|
|
102
180
|
canRead(path: string): boolean;
|
|
103
181
|
canWrite(path: string): boolean;
|
|
182
|
+
toJSON(): Record<string, any>;
|
|
183
|
+
static fromJSON(obj: unknown): StorageGrant;
|
|
184
|
+
}
|
|
185
|
+
export declare class ContainerRegistryGrant {
|
|
186
|
+
list?: StringList;
|
|
187
|
+
pull?: StringList;
|
|
188
|
+
run?: StringList;
|
|
189
|
+
write?: StringList;
|
|
190
|
+
constructor({ list, pull, run, write, }?: {
|
|
191
|
+
list?: StringList;
|
|
192
|
+
pull?: StringList;
|
|
193
|
+
run?: StringList;
|
|
194
|
+
write?: StringList;
|
|
195
|
+
});
|
|
196
|
+
canList(repository: string): boolean;
|
|
197
|
+
canPull(repository: string): boolean;
|
|
198
|
+
canRun(repository: string): boolean;
|
|
199
|
+
canWrite(repository: string): boolean;
|
|
200
|
+
toJSON(): Record<string, any>;
|
|
201
|
+
static fromJSON(obj: unknown): ContainerRegistryGrant;
|
|
104
202
|
}
|
|
105
203
|
export declare class ContainersGrant {
|
|
106
204
|
logs: boolean;
|
|
107
205
|
pull?: StringList;
|
|
108
206
|
run?: StringList;
|
|
207
|
+
registry?: ContainerRegistryGrant;
|
|
109
208
|
useContainers: boolean;
|
|
110
|
-
constructor({ logs, pull, run, useContainers }?: {
|
|
209
|
+
constructor({ logs, pull, run, registry, useContainers, }?: {
|
|
111
210
|
logs?: boolean;
|
|
112
211
|
pull?: StringList;
|
|
113
212
|
run?: StringList;
|
|
213
|
+
registry?: ContainerRegistryGrant;
|
|
114
214
|
useContainers?: boolean;
|
|
115
215
|
});
|
|
116
|
-
private match;
|
|
117
216
|
canPull(tag: string): boolean;
|
|
118
217
|
canRun(tag: string): boolean;
|
|
218
|
+
canRegistryList(repository: string): boolean;
|
|
219
|
+
canRegistryPull(repository: string): boolean;
|
|
220
|
+
canRegistryRun(repository: string): boolean;
|
|
221
|
+
canRegistryWrite(repository: string): boolean;
|
|
222
|
+
toJSON(): Record<string, any>;
|
|
223
|
+
static fromJSON(obj: unknown): ContainersGrant;
|
|
119
224
|
}
|
|
120
225
|
export declare class DeveloperGrant {
|
|
121
226
|
logs: boolean;
|
|
122
227
|
constructor({ logs }?: {
|
|
123
228
|
logs?: boolean;
|
|
124
229
|
});
|
|
230
|
+
toJSON(): Record<string, any>;
|
|
231
|
+
static fromJSON(obj: unknown): DeveloperGrant;
|
|
125
232
|
}
|
|
126
233
|
export declare class AdminGrant {
|
|
234
|
+
config: boolean;
|
|
235
|
+
constructor({ config }?: {
|
|
236
|
+
config?: boolean;
|
|
237
|
+
});
|
|
238
|
+
toJSON(): Record<string, any>;
|
|
239
|
+
static fromJSON(obj: unknown): AdminGrant;
|
|
240
|
+
}
|
|
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;
|
|
127
250
|
}
|
|
128
251
|
export declare class SecretsGrant {
|
|
129
|
-
requestOauthToken?:
|
|
130
|
-
|
|
252
|
+
requestOauthToken?: OAuthEndpoint[];
|
|
253
|
+
constructor({ requestOauthToken }?: {
|
|
254
|
+
requestOauthToken?: OAuthEndpoint[];
|
|
255
|
+
});
|
|
256
|
+
canRequestOauthToken({ connector, oauth, }?: {
|
|
257
|
+
connector?: ConnectorRef | null;
|
|
258
|
+
oauth?: OAuthClientConfig | null;
|
|
259
|
+
}): boolean;
|
|
260
|
+
toJSON(): Record<string, any>;
|
|
261
|
+
static fromJSON(obj: unknown): SecretsGrant;
|
|
262
|
+
}
|
|
263
|
+
export declare class TunnelsGrant {
|
|
264
|
+
ports?: StringList;
|
|
265
|
+
constructor({ ports }?: {
|
|
266
|
+
ports?: StringList;
|
|
267
|
+
});
|
|
268
|
+
toJSON(): Record<string, any>;
|
|
269
|
+
static fromJSON(obj: unknown): TunnelsGrant;
|
|
270
|
+
}
|
|
271
|
+
export declare class ServicesGrant {
|
|
272
|
+
list: boolean;
|
|
273
|
+
constructor({ list }?: {
|
|
274
|
+
list?: boolean;
|
|
275
|
+
});
|
|
276
|
+
toJSON(): Record<string, any>;
|
|
277
|
+
static fromJSON(obj: unknown): ServicesGrant;
|
|
278
|
+
}
|
|
279
|
+
export declare class LLMGrant {
|
|
280
|
+
models?: StringList;
|
|
281
|
+
constructor({ models }?: {
|
|
282
|
+
models?: StringList;
|
|
283
|
+
});
|
|
284
|
+
canUseProvider(provider: string): boolean;
|
|
285
|
+
canUseModel(provider: string, model: string): boolean;
|
|
286
|
+
toJSON(): Record<string, any>;
|
|
287
|
+
static fromJSON(obj: unknown): LLMGrant;
|
|
131
288
|
}
|
|
132
289
|
export declare class ApiScope {
|
|
133
290
|
livekit?: LivekitGrant;
|
|
134
291
|
queues?: QueuesGrant;
|
|
135
292
|
messaging?: MessagingGrant;
|
|
136
293
|
database?: DatabaseGrant;
|
|
294
|
+
memory?: MemoryGrant;
|
|
137
295
|
sync?: SyncGrant;
|
|
138
296
|
storage?: StorageGrant;
|
|
139
297
|
containers?: ContainersGrant;
|
|
140
298
|
developer?: DeveloperGrant;
|
|
141
299
|
agents?: AgentsGrant;
|
|
300
|
+
llm?: LLMGrant;
|
|
142
301
|
admin?: AdminGrant;
|
|
143
302
|
secrets?: SecretsGrant;
|
|
144
|
-
|
|
303
|
+
tunnels?: TunnelsGrant;
|
|
304
|
+
services?: ServicesGrant;
|
|
305
|
+
constructor({ livekit, queues, messaging, database, memory, sync, storage, containers, developer, agents, llm, admin, secrets, tunnels, services, }?: {
|
|
145
306
|
livekit?: LivekitGrant;
|
|
146
307
|
queues?: QueuesGrant;
|
|
147
308
|
messaging?: MessagingGrant;
|
|
148
309
|
database?: DatabaseGrant;
|
|
310
|
+
memory?: MemoryGrant;
|
|
149
311
|
sync?: SyncGrant;
|
|
150
312
|
storage?: StorageGrant;
|
|
151
313
|
containers?: ContainersGrant;
|
|
152
314
|
developer?: DeveloperGrant;
|
|
153
315
|
agents?: AgentsGrant;
|
|
316
|
+
llm?: LLMGrant;
|
|
154
317
|
admin?: AdminGrant;
|
|
155
318
|
secrets?: SecretsGrant;
|
|
319
|
+
tunnels?: TunnelsGrant;
|
|
320
|
+
services?: ServicesGrant;
|
|
156
321
|
});
|
|
157
|
-
static agentDefault(
|
|
322
|
+
static agentDefault({ tunnels }?: {
|
|
323
|
+
tunnels?: boolean;
|
|
324
|
+
}): ApiScope;
|
|
158
325
|
static userDefault(): ApiScope;
|
|
159
326
|
static full(): ApiScope;
|
|
160
327
|
toJSON(): Record<string, any>;
|
|
161
|
-
static fromJSON(obj:
|
|
328
|
+
static fromJSON(obj: unknown): ApiScope;
|
|
162
329
|
}
|
|
163
330
|
export declare class ParticipantGrant {
|
|
164
331
|
name: string;
|
|
@@ -174,7 +341,7 @@ export declare class ParticipantToken {
|
|
|
174
341
|
name: string;
|
|
175
342
|
projectId?: string;
|
|
176
343
|
apiKeyId?: string;
|
|
177
|
-
version
|
|
344
|
+
version: string;
|
|
178
345
|
grants: ParticipantGrant[];
|
|
179
346
|
extra?: Record<string, any>;
|
|
180
347
|
constructor({ name, projectId, apiKeyId, version, extra, grants, }: {
|
|
@@ -193,9 +360,9 @@ export declare class ParticipantToken {
|
|
|
193
360
|
addRoomGrant(roomName: string): void;
|
|
194
361
|
addApiGrant(grant: ApiScope): void;
|
|
195
362
|
grantScope(name: string): string | ApiScope | undefined;
|
|
196
|
-
getApiGrant():
|
|
363
|
+
getApiGrant(): ApiScope | undefined;
|
|
197
364
|
toJson(): Record<string, any>;
|
|
198
|
-
toJwt({ token, expiration, apiKey }?: {
|
|
365
|
+
toJwt({ token, expiration, apiKey, }?: {
|
|
199
366
|
token?: string;
|
|
200
367
|
expiration?: Date;
|
|
201
368
|
apiKey?: string;
|