@meshagent/meshagent 0.39.3 → 0.39.5

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 (53) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +134 -21
  3. package/dist/browser/entrypoint.d.ts +1426 -1464
  4. package/dist/browser/meshagent-client.js +7 -2
  5. package/dist/browser/package.json +1 -0
  6. package/dist/browser/room-client.d.ts +3 -1
  7. package/dist/browser/room-client.js +23 -7
  8. package/dist/esm/agent-client.js +18 -12
  9. package/dist/esm/agent.js +26 -18
  10. package/dist/esm/api_keys.js +21 -11
  11. package/dist/esm/client.js +13 -7
  12. package/dist/esm/completer.js +5 -1
  13. package/dist/esm/containers-client.js +85 -80
  14. package/dist/esm/datasets-client.js +105 -95
  15. package/dist/esm/developer-client.js +15 -11
  16. package/dist/esm/document.js +20 -11
  17. package/dist/esm/entrypoint.d.ts +1426 -1464
  18. package/dist/esm/entrypoint.js +12 -1
  19. package/dist/esm/event-emitter.js +5 -1
  20. package/dist/esm/helpers.js +23 -15
  21. package/dist/esm/index.js +49 -33
  22. package/dist/esm/lk-client.js +12 -7
  23. package/dist/esm/lk-protocol.js +8 -4
  24. package/dist/esm/memory-client.js +11 -7
  25. package/dist/esm/meshagent-client.js +88 -79
  26. package/dist/esm/messaging-client.js +37 -33
  27. package/dist/esm/package.json +1 -0
  28. package/dist/esm/participant-token.js +62 -34
  29. package/dist/esm/participant.js +9 -3
  30. package/dist/esm/protocol.js +43 -29
  31. package/dist/esm/queues-client.js +17 -12
  32. package/dist/esm/requirement.js +11 -4
  33. package/dist/esm/response.js +34 -22
  34. package/dist/esm/room-client.d.ts +3 -1
  35. package/dist/esm/room-client.js +154 -133
  36. package/dist/esm/room-event.js +21 -9
  37. package/dist/esm/room-server-client.js +18 -13
  38. package/dist/esm/runtime.js +10 -1
  39. package/dist/esm/schema.js +18 -9
  40. package/dist/esm/secrets-client.js +35 -31
  41. package/dist/esm/services-client.js +13 -9
  42. package/dist/esm/storage-client.js +38 -32
  43. package/dist/esm/stream-controller.js +5 -1
  44. package/dist/esm/sync-client.js +42 -38
  45. package/dist/esm/tool-content-type.js +5 -1
  46. package/dist/esm/utils.js +20 -10
  47. package/dist/esm/version.js +4 -1
  48. package/dist/node/entrypoint.d.ts +1426 -1464
  49. package/dist/node/meshagent-client.js +7 -2
  50. package/dist/node/package.json +1 -0
  51. package/dist/node/room-client.d.ts +3 -1
  52. package/dist/node/room-client.js +23 -7
  53. package/package.json +1 -1
@@ -1,8 +1,11 @@
1
- import { v4 as uuidv4 } from "uuid";
2
- import { Completer } from "./completer";
3
- import { BinaryContent, ControlContent, ErrorContent, JsonContent } from "./response";
4
- import { RoomServerException } from "./room-server-client";
5
- import { StreamController } from "./stream-controller";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContainersClient = exports.ExecSession = void 0;
4
+ const uuid_1 = require("uuid");
5
+ const completer_1 = require("./completer");
6
+ const response_1 = require("./response");
7
+ const room_server_client_1 = require("./room-server-client");
8
+ const stream_controller_1 = require("./stream-controller");
6
9
  function isRecord(value) {
7
10
  return typeof value === "object" && value !== null && !Array.isArray(value);
8
11
  }
@@ -28,14 +31,14 @@ function toMountList(values) {
28
31
  function readStringField(data, field, operation) {
29
32
  const value = data[field];
30
33
  if (typeof value !== "string") {
31
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
34
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
32
35
  }
33
36
  return value;
34
37
  }
35
38
  function readIntegerField(data, field, operation) {
36
39
  const value = data[field];
37
40
  if (typeof value !== "number" || !Number.isInteger(value)) {
38
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
41
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
39
42
  }
40
43
  return value;
41
44
  }
@@ -45,7 +48,7 @@ function readOptionalIntegerField(data, field, operation) {
45
48
  return undefined;
46
49
  }
47
50
  if (typeof value !== "number" || !Number.isInteger(value)) {
48
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
51
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
49
52
  }
50
53
  return value;
51
54
  }
@@ -55,7 +58,7 @@ function readOptionalStringField(data, field, operation) {
55
58
  return undefined;
56
59
  }
57
60
  if (typeof value !== "string") {
58
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
61
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
59
62
  }
60
63
  return value;
61
64
  }
@@ -65,11 +68,11 @@ function parseTimestampField(data, field, operation) {
65
68
  return undefined;
66
69
  }
67
70
  if (typeof value !== "string") {
68
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
71
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
69
72
  }
70
73
  const timestamp = new Date(value);
71
74
  if (Number.isNaN(timestamp.getTime())) {
72
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
75
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
73
76
  }
74
77
  return timestamp;
75
78
  }
@@ -78,7 +81,7 @@ function decodeUtf8(data, operation) {
78
81
  return new TextDecoder("utf-8", { fatal: true }).decode(data);
79
82
  }
80
83
  catch {
81
- throw new RoomServerException(`containers.${operation} returned invalid UTF-8 data`);
84
+ throw new room_server_client_1.RoomServerException(`containers.${operation} returned invalid UTF-8 data`);
82
85
  }
83
86
  }
84
87
  function decodeJsonStatus(data, operation) {
@@ -88,14 +91,14 @@ function decodeJsonStatus(data, operation) {
88
91
  parsed = JSON.parse(text);
89
92
  }
90
93
  catch {
91
- throw new RoomServerException(`containers.${operation} returned an invalid status payload`);
94
+ throw new room_server_client_1.RoomServerException(`containers.${operation} returned an invalid status payload`);
92
95
  }
93
96
  if (!isRecord(parsed)) {
94
- throw new RoomServerException(`containers.${operation} returned an invalid status payload`);
97
+ throw new room_server_client_1.RoomServerException(`containers.${operation} returned an invalid status payload`);
95
98
  }
96
99
  const status = parsed["status"];
97
100
  if (typeof status !== "number" || !Number.isInteger(status)) {
98
- throw new RoomServerException(`containers.${operation} returned an invalid status payload`);
101
+ throw new room_server_client_1.RoomServerException(`containers.${operation} returned an invalid status payload`);
99
102
  }
100
103
  return status;
101
104
  }
@@ -104,12 +107,12 @@ function normalizeImageLabels(labelsRaw, operation) {
104
107
  const labels = {};
105
108
  for (const entry of labelsRaw) {
106
109
  if (!isRecord(entry)) {
107
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
110
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
108
111
  }
109
112
  const key = entry["key"];
110
113
  const value = entry["value"];
111
114
  if (typeof key !== "string" || typeof value !== "string") {
112
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
115
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
113
116
  }
114
117
  labels[key] = value;
115
118
  }
@@ -119,7 +122,7 @@ function normalizeImageLabels(labelsRaw, operation) {
119
122
  const labels = {};
120
123
  for (const [key, value] of Object.entries(labelsRaw)) {
121
124
  if (typeof value !== "string") {
122
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
125
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
123
126
  }
124
127
  labels[key] = value;
125
128
  }
@@ -128,14 +131,14 @@ function normalizeImageLabels(labelsRaw, operation) {
128
131
  if (labelsRaw === undefined || labelsRaw === null) {
129
132
  return {};
130
133
  }
131
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
134
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
132
135
  }
133
136
  function normalizeImageReferences(entry, operation) {
134
137
  const referencesRaw = entry["references"];
135
138
  if (Array.isArray(referencesRaw)) {
136
139
  const references = referencesRaw.filter((item) => typeof item === "string");
137
140
  if (references.length !== referencesRaw.length) {
138
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
141
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
139
142
  }
140
143
  return references;
141
144
  }
@@ -143,14 +146,14 @@ function normalizeImageReferences(entry, operation) {
143
146
  if (Array.isArray(tagsRaw)) {
144
147
  const references = tagsRaw.filter((item) => typeof item === "string");
145
148
  if (references.length !== tagsRaw.length) {
146
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
149
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
147
150
  }
148
151
  return references;
149
152
  }
150
153
  if (referencesRaw === undefined || referencesRaw === null) {
151
154
  return [];
152
155
  }
153
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
156
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
154
157
  }
155
158
  function parseContainerImage(entry, operation) {
156
159
  const references = normalizeImageReferences(entry, operation);
@@ -178,14 +181,14 @@ function parseOptionalContainerImageDescriptor(value, operation) {
178
181
  return undefined;
179
182
  }
180
183
  if (!isRecord(value)) {
181
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
184
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
182
185
  }
183
186
  return parseContainerImageDescriptor(value, operation);
184
187
  }
185
188
  function parseContainerImageManifest(entry, operation) {
186
189
  const descriptorRaw = entry["descriptor"];
187
190
  if (!isRecord(descriptorRaw)) {
188
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
191
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
189
192
  }
190
193
  return {
191
194
  descriptor: parseContainerImageDescriptor(descriptorRaw, operation),
@@ -200,7 +203,7 @@ function parseContainerImageInspection(entry, operation) {
200
203
  const manifestsRaw = entry["manifests"];
201
204
  const layersRaw = entry["layers"];
202
205
  if (!isRecord(imageRaw) || !isRecord(targetRaw) || !Array.isArray(manifestsRaw) || !Array.isArray(layersRaw)) {
203
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
206
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
204
207
  }
205
208
  return {
206
209
  image: parseContainerImage(imageRaw, operation),
@@ -208,14 +211,14 @@ function parseContainerImageInspection(entry, operation) {
208
211
  selectedManifest: parseOptionalContainerImageDescriptor(entry["selected_manifest"], operation),
209
212
  manifests: manifestsRaw.map((manifest) => {
210
213
  if (!isRecord(manifest)) {
211
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
214
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
212
215
  }
213
216
  return parseContainerImageManifest(manifest, operation);
214
217
  }),
215
218
  config: parseOptionalContainerImageDescriptor(entry["config"], operation),
216
219
  layers: layersRaw.map((layer) => {
217
220
  if (!isRecord(layer)) {
218
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
221
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
219
222
  }
220
223
  return parseContainerImageDescriptor(layer, operation);
221
224
  }),
@@ -226,7 +229,7 @@ function parseImportedImage(data, operation) {
226
229
  const resolvedRef = data["resolved_ref"];
227
230
  const refsRaw = data["refs"];
228
231
  if (typeof resolvedRef !== "string" || !Array.isArray(refsRaw) || refsRaw.some((entry) => typeof entry !== "string")) {
229
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
232
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
230
233
  }
231
234
  return {
232
235
  resolvedRef,
@@ -238,7 +241,7 @@ function parseBuildJob(data, operation) {
238
241
  const tag = readStringField(data, "tag", operation);
239
242
  const status = readStringField(data, "status", operation);
240
243
  if (!["queued", "running", "failed", "cancelled", "succeeded"].includes(status)) {
241
- throw new RoomServerException(`unexpected return type from containers.${operation}`);
244
+ throw new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
242
245
  }
243
246
  return {
244
247
  id,
@@ -248,7 +251,7 @@ function parseBuildJob(data, operation) {
248
251
  };
249
252
  }
250
253
  async function* buildInputStream(params) {
251
- yield new BinaryContent({
254
+ yield new response_1.BinaryContent({
252
255
  data: new Uint8Array(0),
253
256
  headers: {
254
257
  kind: "start",
@@ -264,19 +267,19 @@ async function* buildInputStream(params) {
264
267
  },
265
268
  });
266
269
  for await (const chunk of params.chunks) {
267
- yield new BinaryContent({
270
+ yield new response_1.BinaryContent({
268
271
  data: new Uint8Array(chunk),
269
272
  headers: { kind: "data" },
270
273
  });
271
274
  }
272
275
  }
273
- export class ExecSession {
276
+ class ExecSession {
274
277
  constructor(params) {
275
278
  this.previousOutput = [];
276
279
  this.previousError = [];
277
- this.resultCompleter = new Completer();
278
- this.outputController = new StreamController();
279
- this.errorController = new StreamController();
280
+ this.resultCompleter = new completer_1.Completer();
281
+ this.outputController = new stream_controller_1.StreamController();
282
+ this.errorController = new stream_controller_1.StreamController();
280
283
  this.queuedInput = [];
281
284
  this.inputClosed = false;
282
285
  this.closed = false;
@@ -290,7 +293,7 @@ export class ExecSession {
290
293
  this.stderr = this.errorController.stream;
291
294
  }
292
295
  async *inputStream() {
293
- yield new BinaryContent({
296
+ yield new response_1.BinaryContent({
294
297
  data: new Uint8Array(0),
295
298
  headers: {
296
299
  kind: "start",
@@ -310,7 +313,7 @@ export class ExecSession {
310
313
  if (this.inputClosed) {
311
314
  return;
312
315
  }
313
- this.inputWaiter = new Completer();
316
+ this.inputWaiter = new completer_1.Completer();
314
317
  await this.inputWaiter.fut;
315
318
  this.inputWaiter = null;
316
319
  }
@@ -366,9 +369,9 @@ export class ExecSession {
366
369
  }
367
370
  queueInput(params) {
368
371
  if (this.inputClosed) {
369
- throw new RoomServerException("container exec session is already closed");
372
+ throw new room_server_client_1.RoomServerException("container exec session is already closed");
370
373
  }
371
- this.queuedInput.push(new BinaryContent({
374
+ this.queuedInput.push(new response_1.BinaryContent({
372
375
  data: params.data ?? new Uint8Array(0),
373
376
  headers: {
374
377
  kind: "input",
@@ -387,12 +390,13 @@ export class ExecSession {
387
390
  this.inputWaiter?.complete();
388
391
  }
389
392
  }
390
- export class ContainersClient {
393
+ exports.ExecSession = ExecSession;
394
+ class ContainersClient {
391
395
  constructor({ room }) {
392
396
  this.room = room;
393
397
  }
394
398
  unexpectedResponseError(operation) {
395
- return new RoomServerException(`unexpected return type from containers.${operation}`);
399
+ return new room_server_client_1.RoomServerException(`unexpected return type from containers.${operation}`);
396
400
  }
397
401
  async invoke(operation, input) {
398
402
  return await this.room.invoke({
@@ -403,7 +407,7 @@ export class ContainersClient {
403
407
  }
404
408
  async listImages() {
405
409
  const output = await this.invoke("list_images", {});
406
- if (!(output instanceof JsonContent) || !isRecord(output.json)) {
410
+ if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
407
411
  throw this.unexpectedResponseError("list_images");
408
412
  }
409
413
  const imagesRaw = output.json["images"];
@@ -423,7 +427,7 @@ export class ContainersClient {
423
427
  const output = await this.invoke("inspect_image", {
424
428
  image_id: params.imageId,
425
429
  });
426
- if (!(output instanceof JsonContent) || !isRecord(output.json)) {
430
+ if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
427
431
  throw this.unexpectedResponseError("inspect_image");
428
432
  }
429
433
  return parseContainerImageInspection(output.json, "inspect_image");
@@ -445,7 +449,7 @@ export class ContainersClient {
445
449
  credentials: toCredentials(params.credentials ?? []),
446
450
  private: params.private ?? false,
447
451
  });
448
- if (!(output instanceof JsonContent) || !isRecord(output.json)) {
452
+ if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
449
453
  throw this.unexpectedResponseError("push_image");
450
454
  }
451
455
  return readStringField(output.json, "container_id", "push_image");
@@ -454,7 +458,7 @@ export class ContainersClient {
454
458
  const output = await this.invoke("load", {
455
459
  archive_path: params.archivePath,
456
460
  });
457
- if (!(output instanceof JsonContent) || !isRecord(output.json)) {
461
+ if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
458
462
  throw this.unexpectedResponseError("load");
459
463
  }
460
464
  return parseImportedImage(output.json, "load");
@@ -465,7 +469,7 @@ export class ContainersClient {
465
469
  archive_path: params.archivePath,
466
470
  private: params.private ?? false,
467
471
  });
468
- if (!(output instanceof JsonContent) || !isRecord(output.json)) {
472
+ if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
469
473
  throw this.unexpectedResponseError("load_image");
470
474
  }
471
475
  return readStringField(output.json, "container_id", "load_image");
@@ -477,7 +481,7 @@ export class ContainersClient {
477
481
  archive_path: params.archivePath,
478
482
  private: params.private ?? false,
479
483
  });
480
- if (!(output instanceof JsonContent) || !isRecord(output.json)) {
484
+ if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
481
485
  throw this.unexpectedResponseError("save_image");
482
486
  }
483
487
  return readStringField(output.json, "container_id", "save_image");
@@ -499,7 +503,7 @@ export class ContainersClient {
499
503
  writable_root_fs: params.writableRootFs,
500
504
  private: params.private,
501
505
  });
502
- if (!(output instanceof JsonContent) || !isRecord(output.json)) {
506
+ if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
503
507
  throw this.unexpectedResponseError("run");
504
508
  }
505
509
  return readStringField(output.json, "container_id", "run");
@@ -510,14 +514,14 @@ export class ContainersClient {
510
514
  tool: "build",
511
515
  input: buildInputStream(params),
512
516
  });
513
- if (!(output instanceof JsonContent) || !isRecord(output.json)) {
517
+ if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
514
518
  throw this.unexpectedResponseError("build");
515
519
  }
516
520
  return readStringField(output.json, "build_id", "build");
517
521
  }
518
522
  async listBuilds() {
519
523
  const output = await this.invoke("list_builds", {});
520
- if (!(output instanceof JsonContent) || !isRecord(output.json)) {
524
+ if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
521
525
  throw this.unexpectedResponseError("list_builds");
522
526
  }
523
527
  const buildsRaw = output.json["builds"];
@@ -546,13 +550,13 @@ export class ContainersClient {
546
550
  service_id: params.serviceId,
547
551
  env: toStringMapList(params.env ?? {}),
548
552
  });
549
- if (!(output instanceof JsonContent) || !isRecord(output.json)) {
553
+ if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
550
554
  throw this.unexpectedResponseError("run_service");
551
555
  }
552
556
  return readStringField(output.json, "container_id", "run_service");
553
557
  }
554
558
  exec(params) {
555
- const requestId = uuidv4();
559
+ const requestId = (0, uuid_1.v4)();
556
560
  const session = new ExecSession({
557
561
  requestId,
558
562
  command: params.command,
@@ -567,21 +571,21 @@ export class ContainersClient {
567
571
  })
568
572
  .then(async (stream) => {
569
573
  for await (const chunk of stream) {
570
- if (chunk instanceof ErrorContent) {
571
- throw new RoomServerException(chunk.text, chunk.code);
574
+ if (chunk instanceof response_1.ErrorContent) {
575
+ throw new room_server_client_1.RoomServerException(chunk.text, chunk.code);
572
576
  }
573
- if (chunk instanceof ControlContent) {
577
+ if (chunk instanceof response_1.ControlContent) {
574
578
  if (chunk.method === "close") {
575
579
  break;
576
580
  }
577
581
  throw this.unexpectedResponseError("exec");
578
582
  }
579
- if (!(chunk instanceof BinaryContent)) {
583
+ if (!(chunk instanceof response_1.BinaryContent)) {
580
584
  throw this.unexpectedResponseError("exec");
581
585
  }
582
586
  const channel = chunk.headers["channel"];
583
587
  if (typeof channel !== "number") {
584
- throw new RoomServerException("containers.exec returned a chunk without a valid channel");
588
+ throw new room_server_client_1.RoomServerException("containers.exec returned a chunk without a valid channel");
585
589
  }
586
590
  if (channel === 1) {
587
591
  session.addOutput(chunk.data);
@@ -596,7 +600,7 @@ export class ContainersClient {
596
600
  return;
597
601
  }
598
602
  }
599
- throw new RoomServerException("containers.exec stream closed before a status was returned");
603
+ throw new room_server_client_1.RoomServerException("containers.exec stream closed before a status was returned");
600
604
  })
601
605
  .catch((error) => {
602
606
  session.closeError(error);
@@ -613,7 +617,7 @@ export class ContainersClient {
613
617
  const output = await this.invoke("wait_for_exit", {
614
618
  container_id: params.containerId,
615
619
  });
616
- if (!(output instanceof JsonContent) || !isRecord(output.json)) {
620
+ if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
617
621
  throw this.unexpectedResponseError("wait_for_exit");
618
622
  }
619
623
  return readIntegerField(output.json, "exit_code", "wait_for_exit");
@@ -624,10 +628,10 @@ export class ContainersClient {
624
628
  });
625
629
  }
626
630
  logs(params) {
627
- const requestId = uuidv4();
628
- const closeInput = new Completer();
629
- const streamController = new StreamController();
630
- const result = new Completer();
631
+ const requestId = (0, uuid_1.v4)();
632
+ const closeInput = new completer_1.Completer();
633
+ const streamController = new stream_controller_1.StreamController();
634
+ const result = new completer_1.Completer();
631
635
  let inputClosed = false;
632
636
  const closeInputStream = () => {
633
637
  if (inputClosed) {
@@ -639,7 +643,7 @@ export class ContainersClient {
639
643
  }
640
644
  };
641
645
  const inputStream = async function* () {
642
- yield new BinaryContent({
646
+ yield new response_1.BinaryContent({
643
647
  data: new Uint8Array(0),
644
648
  headers: {
645
649
  kind: "start",
@@ -658,10 +662,10 @@ export class ContainersClient {
658
662
  })
659
663
  .then(async (stream) => {
660
664
  for await (const chunk of stream) {
661
- if (chunk instanceof ErrorContent) {
662
- throw new RoomServerException(chunk.text, chunk.code);
665
+ if (chunk instanceof response_1.ErrorContent) {
666
+ throw new room_server_client_1.RoomServerException(chunk.text, chunk.code);
663
667
  }
664
- if (chunk instanceof ControlContent) {
668
+ if (chunk instanceof response_1.ControlContent) {
665
669
  if (chunk.method === "close") {
666
670
  closeInputStream();
667
671
  streamController.close();
@@ -672,12 +676,12 @@ export class ContainersClient {
672
676
  }
673
677
  throw this.unexpectedResponseError("logs");
674
678
  }
675
- if (!(chunk instanceof BinaryContent)) {
679
+ if (!(chunk instanceof response_1.BinaryContent)) {
676
680
  throw this.unexpectedResponseError("logs");
677
681
  }
678
682
  const channel = chunk.headers["channel"];
679
683
  if (typeof channel !== "number") {
680
- throw new RoomServerException("containers.logs returned a chunk without a valid channel");
684
+ throw new room_server_client_1.RoomServerException("containers.logs returned a chunk without a valid channel");
681
685
  }
682
686
  if (channel !== 1) {
683
687
  continue;
@@ -728,10 +732,10 @@ export class ContainersClient {
728
732
  };
729
733
  }
730
734
  getBuildLogs(params) {
731
- const requestId = uuidv4();
732
- const closeInput = new Completer();
733
- const streamController = new StreamController();
734
- const result = new Completer();
735
+ const requestId = (0, uuid_1.v4)();
736
+ const closeInput = new completer_1.Completer();
737
+ const streamController = new stream_controller_1.StreamController();
738
+ const result = new completer_1.Completer();
735
739
  let inputClosed = false;
736
740
  const closeInputStream = () => {
737
741
  if (inputClosed) {
@@ -743,7 +747,7 @@ export class ContainersClient {
743
747
  }
744
748
  };
745
749
  const inputStream = async function* () {
746
- yield new BinaryContent({
750
+ yield new response_1.BinaryContent({
747
751
  data: new Uint8Array(0),
748
752
  headers: {
749
753
  kind: "start",
@@ -762,10 +766,10 @@ export class ContainersClient {
762
766
  })
763
767
  .then(async (stream) => {
764
768
  for await (const chunk of stream) {
765
- if (chunk instanceof ErrorContent) {
766
- throw new RoomServerException(chunk.text, chunk.code);
769
+ if (chunk instanceof response_1.ErrorContent) {
770
+ throw new room_server_client_1.RoomServerException(chunk.text, chunk.code);
767
771
  }
768
- if (chunk instanceof ControlContent) {
772
+ if (chunk instanceof response_1.ControlContent) {
769
773
  if (chunk.method === "close") {
770
774
  closeInputStream();
771
775
  streamController.close();
@@ -776,12 +780,12 @@ export class ContainersClient {
776
780
  }
777
781
  throw this.unexpectedResponseError("get_build_logs");
778
782
  }
779
- if (!(chunk instanceof BinaryContent)) {
783
+ if (!(chunk instanceof response_1.BinaryContent)) {
780
784
  throw this.unexpectedResponseError("get_build_logs");
781
785
  }
782
786
  const channel = chunk.headers["channel"];
783
787
  if (typeof channel !== "number") {
784
- throw new RoomServerException("containers.get_build_logs returned a chunk without a valid channel");
788
+ throw new room_server_client_1.RoomServerException("containers.get_build_logs returned a chunk without a valid channel");
785
789
  }
786
790
  if (channel === 1) {
787
791
  streamController.add(decodeUtf8(chunk.data, "get_build_logs"));
@@ -843,7 +847,7 @@ export class ContainersClient {
843
847
  const output = await this.invoke("list_containers", {
844
848
  all: params?.all,
845
849
  });
846
- if (!(output instanceof JsonContent) || !isRecord(output.json)) {
850
+ if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
847
851
  throw this.unexpectedResponseError("list");
848
852
  }
849
853
  const containersRaw = output.json["containers"];
@@ -891,3 +895,4 @@ export class ContainersClient {
891
895
  return items;
892
896
  }
893
897
  }
898
+ exports.ContainersClient = ContainersClient;