@meshagent/meshagent 0.44.11 → 0.44.13

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/browser/agent-client.js +1 -1
  3. package/dist/browser/containers-client.js +1 -1
  4. package/dist/browser/datasets-client.d.ts +1 -1
  5. package/dist/browser/datasets-client.js +15 -15
  6. package/dist/browser/developer-client.js +1 -1
  7. package/dist/browser/entrypoint.js +5 -1
  8. package/dist/browser/memory-client.js +1 -1
  9. package/dist/browser/meshagent-client.d.ts +123 -7
  10. package/dist/browser/meshagent-client.js +357 -10
  11. package/dist/browser/messaging-client.js +1 -1
  12. package/dist/browser/queues-client.js +1 -1
  13. package/dist/browser/requirement.d.ts +21 -0
  14. package/dist/browser/requirement.js +87 -1
  15. package/dist/browser/room-client.d.ts +12 -1
  16. package/dist/browser/room-client.js +91 -31
  17. package/dist/browser/secrets-client.js +1 -1
  18. package/dist/browser/services-client.js +2 -2
  19. package/dist/browser/storage-client.d.ts +1 -1
  20. package/dist/browser/storage-client.js +1 -1
  21. package/dist/browser/stream-controller.d.ts +1 -0
  22. package/dist/browser/stream-controller.js +27 -7
  23. package/dist/browser/sync-client.js +1 -1
  24. package/dist/esm/agent-client.js +1 -1
  25. package/dist/esm/containers-client.js +1 -1
  26. package/dist/esm/datasets-client.d.ts +1 -1
  27. package/dist/esm/datasets-client.js +15 -15
  28. package/dist/esm/developer-client.js +1 -1
  29. package/dist/esm/entrypoint.js +6 -1
  30. package/dist/esm/memory-client.js +1 -1
  31. package/dist/esm/meshagent-client.d.ts +123 -7
  32. package/dist/esm/meshagent-client.js +353 -10
  33. package/dist/esm/messaging-client.js +1 -1
  34. package/dist/esm/queues-client.js +1 -1
  35. package/dist/esm/requirement.d.ts +21 -0
  36. package/dist/esm/requirement.js +84 -0
  37. package/dist/esm/room-client.d.ts +12 -1
  38. package/dist/esm/room-client.js +92 -32
  39. package/dist/esm/secrets-client.js +1 -1
  40. package/dist/esm/services-client.js +2 -2
  41. package/dist/esm/storage-client.d.ts +1 -1
  42. package/dist/esm/storage-client.js +1 -1
  43. package/dist/esm/stream-controller.d.ts +1 -0
  44. package/dist/esm/stream-controller.js +27 -7
  45. package/dist/esm/sync-client.js +1 -1
  46. package/dist/node/agent-client.js +1 -1
  47. package/dist/node/containers-client.js +1 -1
  48. package/dist/node/datasets-client.d.ts +1 -1
  49. package/dist/node/datasets-client.js +15 -15
  50. package/dist/node/developer-client.js +1 -1
  51. package/dist/node/entrypoint.js +6 -1
  52. package/dist/node/memory-client.js +1 -1
  53. package/dist/node/meshagent-client.d.ts +123 -7
  54. package/dist/node/meshagent-client.js +357 -10
  55. package/dist/node/messaging-client.js +1 -1
  56. package/dist/node/queues-client.js +1 -1
  57. package/dist/node/requirement.d.ts +21 -0
  58. package/dist/node/requirement.js +87 -1
  59. package/dist/node/room-client.d.ts +12 -1
  60. package/dist/node/room-client.js +91 -31
  61. package/dist/node/secrets-client.js +1 -1
  62. package/dist/node/services-client.js +2 -2
  63. package/dist/node/storage-client.d.ts +1 -1
  64. package/dist/node/storage-client.js +1 -1
  65. package/dist/node/stream-controller.d.ts +1 -0
  66. package/dist/node/stream-controller.js +27 -7
  67. package/dist/node/sync-client.js +1 -1
  68. package/package.json +1 -1
@@ -724,7 +724,7 @@ class DatasetsClient {
724
724
  return new room_server_client_js_1.RoomServerException(`unexpected return type from datasets.${operation}`);
725
725
  }
726
726
  async invoke(operation, input) {
727
- const response = await this.room.invoke({ toolkit: "dataset", tool: operation, input });
727
+ const response = await this.room.invokeContent({ toolkit: "dataset", tool: operation, input });
728
728
  if (response instanceof response_js_1.JsonContent) {
729
729
  return response;
730
730
  }
@@ -734,7 +734,7 @@ class DatasetsClient {
734
734
  return null;
735
735
  }
736
736
  async invokeContent(operation, input) {
737
- return await this.room.invoke({ toolkit: "dataset", tool: operation, input });
737
+ return await this.room.invokeContent({ toolkit: "dataset", tool: operation, input });
738
738
  }
739
739
  async invokeStream(operation, input) {
740
740
  return await this.room.invokeStream({ toolkit: "dataset", tool: operation, input });
@@ -910,7 +910,7 @@ class DatasetsClient {
910
910
  await this.drainWriteStream("create_table", input);
911
911
  }
912
912
  async dropTable({ name, ignoreMissing = false, namespace, branch }) {
913
- await this.room.invoke({
913
+ await this.room.invokeContent({
914
914
  toolkit: "dataset",
915
915
  tool: "drop_table",
916
916
  input: {
@@ -965,7 +965,7 @@ class DatasetsClient {
965
965
  });
966
966
  }
967
967
  async dropIndex({ table, name, namespace, branch }) {
968
- await this.room.invoke({
968
+ await this.room.invokeContent({
969
969
  toolkit: "dataset",
970
970
  tool: "drop_index",
971
971
  input: { table, name, namespace: namespace ?? null, branch: branch ?? null },
@@ -984,7 +984,7 @@ class DatasetsClient {
984
984
  }));
985
985
  return;
986
986
  }
987
- await this.room.invoke({
987
+ await this.room.invokeContent({
988
988
  toolkit: "dataset",
989
989
  tool: "add_columns",
990
990
  input: {
@@ -996,7 +996,7 @@ class DatasetsClient {
996
996
  });
997
997
  }
998
998
  async dropColumns({ table, columns, namespace, branch }) {
999
- await this.room.invoke({
999
+ await this.room.invokeContent({
1000
1000
  toolkit: "dataset",
1001
1001
  tool: "drop_columns",
1002
1002
  input: { table, columns, namespace: namespace ?? null, branch: branch ?? null },
@@ -1018,7 +1018,7 @@ class DatasetsClient {
1018
1018
  await this.drainWriteStream("insert", input);
1019
1019
  }
1020
1020
  async update({ table, where, values, namespace, branch }) {
1021
- await this.room.invoke({
1021
+ await this.room.invokeContent({
1022
1022
  toolkit: "dataset",
1023
1023
  tool: "update",
1024
1024
  input: {
@@ -1031,7 +1031,7 @@ class DatasetsClient {
1031
1031
  });
1032
1032
  }
1033
1033
  async delete({ table, where, namespace, branch }) {
1034
- await this.room.invoke({
1034
+ await this.room.invokeContent({
1035
1035
  toolkit: "dataset",
1036
1036
  tool: "delete",
1037
1037
  input: { table, where, namespace: namespace ?? null, branch: branch ?? null },
@@ -1143,13 +1143,13 @@ class DatasetsClient {
1143
1143
  });
1144
1144
  }
1145
1145
  async closeSqlQuery({ queryId }) {
1146
- const response = await this.room.invoke({ toolkit: "dataset", tool: "close_sql_query", input: { query_id: queryId } });
1146
+ const response = await this.room.invokeContent({ toolkit: "dataset", tool: "close_sql_query", input: { query_id: queryId } });
1147
1147
  if (!(response instanceof response_js_1.EmptyContent)) {
1148
1148
  throw this._unexpectedResponseError("close_sql_query");
1149
1149
  }
1150
1150
  }
1151
1151
  async cancelSqlQuery({ queryId }) {
1152
- const response = await this.room.invoke({ toolkit: "dataset", tool: "cancel_sql_query", input: { query_id: queryId } });
1152
+ const response = await this.room.invokeContent({ toolkit: "dataset", tool: "cancel_sql_query", input: { query_id: queryId } });
1153
1153
  if (!(response instanceof response_js_1.JsonContent)
1154
1154
  || !["cancelled", "cancelling", "not_cancellable"].includes(response.json.status)) {
1155
1155
  throw this._unexpectedResponseError("cancel_sql_query");
@@ -1305,7 +1305,7 @@ class DatasetsClient {
1305
1305
  return response.json.count;
1306
1306
  }
1307
1307
  async inspect({ table, namespace, branch, version }) {
1308
- const response = await this.room.invoke({
1308
+ const response = await this.room.invokeContent({
1309
1309
  toolkit: "dataset",
1310
1310
  tool: "inspect",
1311
1311
  input: {
@@ -1350,7 +1350,7 @@ class DatasetsClient {
1350
1350
  return tableStatsFromJson(response.json);
1351
1351
  }
1352
1352
  async restore({ table, version, namespace, branch }) {
1353
- await this.room.invoke({
1353
+ await this.room.invokeContent({
1354
1354
  toolkit: "dataset",
1355
1355
  tool: "restore",
1356
1356
  input: { table, version, namespace: namespace ?? null, branch: branch ?? null },
@@ -1368,7 +1368,7 @@ class DatasetsClient {
1368
1368
  return response.json.versions.map((version) => tableVersionFromJson(version));
1369
1369
  }
1370
1370
  async createIndex({ table, config, namespace, branch }) {
1371
- await this.room.invoke({
1371
+ await this.room.invokeContent({
1372
1372
  toolkit: "dataset",
1373
1373
  tool: "create_index",
1374
1374
  input: { table, config, namespace: namespace ?? null, branch: branch ?? null },
@@ -1396,7 +1396,7 @@ class DatasetsClient {
1396
1396
  return response.json.branches.map((branch) => tableBranchFromJson(branch));
1397
1397
  }
1398
1398
  async createBranch({ branch, fromBranch, namespace }) {
1399
- await this.room.invoke({
1399
+ await this.room.invokeContent({
1400
1400
  toolkit: "dataset",
1401
1401
  tool: "create_branch",
1402
1402
  input: {
@@ -1407,7 +1407,7 @@ class DatasetsClient {
1407
1407
  });
1408
1408
  }
1409
1409
  async deleteBranch({ branch, namespace }) {
1410
- await this.room.invoke({
1410
+ await this.room.invokeContent({
1411
1411
  toolkit: "dataset",
1412
1412
  tool: "delete_branch",
1413
1413
  input: { branch, namespace: namespace ?? null },
@@ -24,7 +24,7 @@ class DeveloperClient extends event_emitter_js_1.EventEmitter {
24
24
  this._emitDeveloperLog(rawJson["type"], rawJson["data"]);
25
25
  }
26
26
  async log(type, data) {
27
- await this.client.invoke({
27
+ await this.client.invokeContent({
28
28
  toolkit: "developer",
29
29
  tool: "log",
30
30
  input: { type, data },
@@ -21,7 +21,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
21
21
  var __getProtoOf = Object.getPrototypeOf;
22
22
  var __hasOwnProp = Object.prototype.hasOwnProperty;
23
23
  var __commonJS = (cb, mod) => function __require() {
24
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24
+ try {
25
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
26
+ }
27
+ catch (e) {
28
+ throw mod = 0, e;
29
+ }
25
30
  };
26
31
  var __copyProps = (to, from2, except, desc) => {
27
32
  if (from2 && typeof from2 === "object" || typeof from2 === "function") {
@@ -386,7 +386,7 @@ class MemoryClient {
386
386
  return unexpectedResponse(operation);
387
387
  }
388
388
  async invoke(operation, input) {
389
- const response = await this.room.invoke({
389
+ const response = await this.room.invokeContent({
390
390
  toolkit: "memory",
391
391
  tool: operation,
392
392
  input,
@@ -11,13 +11,28 @@ export interface RoomConnectionInfo {
11
11
  projectId: string;
12
12
  roomUrl: string;
13
13
  }
14
- export interface RoomSession {
15
- id: string;
16
- roomId?: string | null;
17
- roomName: string;
18
- createdAt: Date;
19
- isActive: boolean;
20
- participants?: Record<string, number>;
14
+ export declare class RoomSession {
15
+ readonly id: string;
16
+ readonly roomId?: string | null;
17
+ readonly roomName: string;
18
+ readonly createdAt: Date;
19
+ readonly isActive: boolean;
20
+ readonly participants?: Record<string, number> | null;
21
+ readonly kind: string;
22
+ readonly agentId?: string | null;
23
+ readonly agentName?: string | null;
24
+ constructor({ id, roomId, roomName, createdAt, isActive, participants, kind, agentId, agentName, }: {
25
+ id: string;
26
+ roomId?: string | null;
27
+ roomName: string;
28
+ createdAt: Date;
29
+ isActive: boolean;
30
+ participants?: Record<string, number> | null;
31
+ kind?: string;
32
+ agentId?: string | null;
33
+ agentName?: string | null;
34
+ });
35
+ toJson(): Record<string, unknown>;
21
36
  }
22
37
  export interface RoomInfo {
23
38
  id: string;
@@ -63,6 +78,18 @@ export interface ProjectStorageMountSpec {
63
78
  subpath?: string | null;
64
79
  read_only?: boolean;
65
80
  }
81
+ export interface ImageStorageMountSpec {
82
+ path: string;
83
+ subpath?: string | null;
84
+ read_only?: boolean;
85
+ image: string;
86
+ }
87
+ export interface FileStorageMountSpec {
88
+ path: string;
89
+ subpath?: string | null;
90
+ read_only?: boolean;
91
+ text: string;
92
+ }
66
93
  export interface EmptyDirMountSpec {
67
94
  path: string;
68
95
  read_only?: boolean;
@@ -73,6 +100,8 @@ export interface ConfigMountSpec {
73
100
  export interface ContainerMountSpec {
74
101
  room?: RoomStorageMountSpec[];
75
102
  project?: ProjectStorageMountSpec[];
103
+ images?: ImageStorageMountSpec[];
104
+ files?: FileStorageMountSpec[];
76
105
  empty_dirs?: EmptyDirMountSpec[];
77
106
  configs?: ConfigMountSpec[];
78
107
  }
@@ -212,6 +241,65 @@ export interface ServiceSpec {
212
241
  container?: ContainerSpec | null;
213
242
  external?: ExternalServiceSpec | null;
214
243
  }
244
+ export interface TemplateEnvironmentVariable {
245
+ name: string;
246
+ value?: string | null;
247
+ token?: Record<string, unknown> | null;
248
+ }
249
+ export interface ServiceTemplateContainerMountSpec {
250
+ room?: RoomStorageMountSpec[] | null;
251
+ project?: ProjectStorageMountSpec[] | null;
252
+ images?: ImageStorageMountSpec[] | null;
253
+ files?: FileStorageMountSpec[] | null;
254
+ empty_dirs?: EmptyDirMountSpec[] | null;
255
+ configs?: ConfigMountSpec[] | null;
256
+ }
257
+ export interface ContainerTemplateSpec {
258
+ private?: boolean | null;
259
+ command?: string | null;
260
+ working_dir?: string | null;
261
+ image?: string | null;
262
+ environment?: TemplateEnvironmentVariable[] | null;
263
+ storage?: ServiceTemplateContainerMountSpec | null;
264
+ on_demand?: boolean | null;
265
+ writable_root_fs?: boolean | null;
266
+ }
267
+ export interface ExternalServiceTemplateSpec {
268
+ url: string;
269
+ }
270
+ export interface ServiceTemplateVariable {
271
+ name: string;
272
+ label?: string | null;
273
+ description?: string | null;
274
+ default?: string | null;
275
+ required?: boolean | null;
276
+ }
277
+ export declare function normalizeServiceSpec(service: ServiceSpec | Record<string, unknown>): ServiceSpec;
278
+ export declare class ServiceTemplateSpec {
279
+ readonly version: string;
280
+ readonly kind: string;
281
+ readonly variables?: ServiceTemplateVariable[] | null;
282
+ readonly metadata: ServiceMetadata;
283
+ readonly ports: PortSpec[];
284
+ readonly container?: ContainerTemplateSpec | null;
285
+ readonly external?: ExternalServiceTemplateSpec | null;
286
+ readonly agents: Record<string, unknown>[];
287
+ constructor({ version, kind, variables, metadata, ports, container, external, agents, }: {
288
+ version?: string;
289
+ kind?: string;
290
+ variables?: ServiceTemplateVariable[] | null;
291
+ metadata: ServiceMetadata;
292
+ ports?: PortSpec[];
293
+ container?: ContainerTemplateSpec | null;
294
+ external?: ExternalServiceTemplateSpec | null;
295
+ agents?: Record<string, unknown>[];
296
+ });
297
+ static fromJson(json: Record<string, unknown>): ServiceTemplateSpec;
298
+ toJson(): Record<string, unknown>;
299
+ toServiceSpec({ values }?: {
300
+ values?: Record<string, string>;
301
+ }): ServiceSpec;
302
+ }
215
303
  export interface RouteMetadata {
216
304
  name: string;
217
305
  annotations?: Record<string, string>;
@@ -370,6 +458,19 @@ export interface ExternalOAuthClientRegistration {
370
458
  clientId: string;
371
459
  clientSecret?: string | null;
372
460
  }
461
+ export interface ManagedAgent {
462
+ id: string;
463
+ name: string;
464
+ configuration: Record<string, unknown>;
465
+ }
466
+ export declare class ManagedAgentGrant {
467
+ readonly admin: boolean;
468
+ constructor({ admin }?: {
469
+ admin?: boolean;
470
+ });
471
+ static fromJson(json: Record<string, unknown>): ManagedAgentGrant;
472
+ toJson(): Record<string, unknown>;
473
+ }
373
474
  type JsonRequest = Record<string, unknown> | Array<unknown> | string | number | boolean | null;
374
475
  export declare class Meshagent {
375
476
  private readonly baseUrl;
@@ -382,6 +483,7 @@ export declare class Meshagent {
382
483
  private request;
383
484
  private parseRoomShare;
384
485
  private parseRoomSession;
486
+ private parseManagedAgent;
385
487
  private parseRoom;
386
488
  private parseRoute;
387
489
  private parseFeed;
@@ -425,6 +527,13 @@ export declare class Meshagent {
425
527
  isAdmin?: boolean;
426
528
  isDeveloper?: boolean;
427
529
  canCreateRooms?: boolean;
530
+ inviteRedirectUrl?: string;
531
+ }): Promise<Record<string, unknown>>;
532
+ addUserToProjectByEmail(projectId: string, email: string, options?: {
533
+ isAdmin?: boolean;
534
+ isDeveloper?: boolean;
535
+ canCreateRooms?: boolean;
536
+ inviteRedirectUrl?: string;
428
537
  }): Promise<Record<string, unknown>>;
429
538
  removeUserFromProject(projectId: string, userId: string): Promise<Record<string, unknown>>;
430
539
  updateProjectSettings(projectId: string, settings: Record<string, unknown>): Promise<Record<string, unknown>>;
@@ -439,6 +548,12 @@ export declare class Meshagent {
439
548
  listProjects(): Promise<Record<string, unknown>>;
440
549
  getProject(projectId: string): Promise<Record<string, unknown>>;
441
550
  getProjectByKey(projectKey: string): Promise<Record<string, unknown>>;
551
+ createAgent(params: {
552
+ projectId: string;
553
+ configuration: Record<string, unknown>;
554
+ ifNotExists?: boolean;
555
+ permissions?: Record<string, ManagedAgentGrant> | null;
556
+ }): Promise<ManagedAgent>;
442
557
  createApiKey(projectId: string, name: string, description: string): Promise<Record<string, unknown>>;
443
558
  deleteApiKey(projectId: string, id: string): Promise<void>;
444
559
  listApiKeys(projectId: string): Promise<Record<string, unknown>>;
@@ -780,6 +895,7 @@ export declare class Meshagent {
780
895
  roomId: string;
781
896
  email: string;
782
897
  permissions: ApiScope;
898
+ inviteRedirectUrl?: string;
783
899
  }): Promise<void>;
784
900
  updateRoomGrant(params: {
785
901
  projectId: string;