@meshagent/meshagent 0.42.0 → 0.42.2

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 CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.42.2]
2
+ - Added `ContainerExitStatus`, `RoomContainerStats`, and published build image metadata to the TypeScript container client models.
3
+ - Added `waitForExitStatus` while keeping `waitForExit` as the exit-code convenience wrapper.
4
+ - Container list parsing now preserves image IDs, runtime stats, and exit-status metadata from API responses.
5
+
6
+ ## [0.42.1]
7
+ - Stability
8
+
1
9
  ## [0.42.0]
2
10
  - Added project lookup by key.
3
11
  - Container and room APIs now return structured `containerPort`/`hostPort` entries instead of integer port lists, which is a breaking response-shape change.
@@ -56,15 +56,30 @@ export interface RoomContainerPort {
56
56
  containerPort: number;
57
57
  hostPort: number;
58
58
  }
59
+ export interface RoomContainerStats {
60
+ cpuUsageNanoCores?: number;
61
+ memoryUsageBytes?: number;
62
+ memoryWorkingSetBytes?: number;
63
+ timestampNs?: number;
64
+ }
59
65
  export interface RoomContainer {
60
66
  id: string;
61
67
  image: string;
68
+ imageId?: string;
62
69
  name?: string;
63
70
  ports: RoomContainerPort[];
64
71
  startedBy: ContainerParticipantInfo;
65
72
  state: string;
66
73
  private: boolean;
67
74
  serviceId?: string;
75
+ stats?: RoomContainerStats;
76
+ exitStatus?: ContainerExitStatus;
77
+ }
78
+ export interface ContainerExitStatus {
79
+ exitCode: number;
80
+ reason?: string;
81
+ message?: string;
82
+ oomKilled?: boolean;
68
83
  }
69
84
  export interface LogProgress {
70
85
  layer?: string | null;
@@ -211,6 +226,9 @@ export declare class ContainersClient {
211
226
  containerId: string;
212
227
  force?: boolean;
213
228
  }): Promise<void>;
229
+ waitForExitStatus(params: {
230
+ containerId: string;
231
+ }): Promise<ContainerExitStatus>;
214
232
  waitForExit(params: {
215
233
  containerId: string;
216
234
  }): Promise<number>;
@@ -618,14 +618,27 @@ class ContainersClient {
618
618
  force: params.force ?? false,
619
619
  });
620
620
  }
621
- async waitForExit(params) {
621
+ async waitForExitStatus(params) {
622
622
  const output = await this.invoke("wait_for_exit", {
623
623
  container_id: params.containerId,
624
624
  });
625
625
  if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
626
626
  throw this.unexpectedResponseError("wait_for_exit");
627
627
  }
628
- return readIntegerField(output.json, "exit_code", "wait_for_exit");
628
+ const exitCode = readIntegerField(output.json, "exit_code", "wait_for_exit");
629
+ const reason = output.json["reason"];
630
+ const message = output.json["message"];
631
+ const oomKilled = output.json["oom_killed"];
632
+ return {
633
+ exitCode,
634
+ reason: typeof reason === "string" ? reason : undefined,
635
+ message: typeof message === "string" ? message : undefined,
636
+ oomKilled: typeof oomKilled === "boolean" ? oomKilled : undefined,
637
+ };
638
+ }
639
+ async waitForExit(params) {
640
+ const status = await this.waitForExitStatus(params);
641
+ return status.exitCode;
629
642
  }
630
643
  async deleteContainer(params) {
631
644
  await this.invoke("delete_container", {
@@ -888,8 +901,11 @@ class ContainersClient {
888
901
  throw this.unexpectedResponseError("list");
889
902
  }
890
903
  const nameRaw = entry["name"];
904
+ const imageIdRaw = entry["image_id"];
891
905
  const portsRaw = entry["ports"];
892
906
  const serviceIdRaw = entry["service_id"];
907
+ const statsRaw = entry["stats"];
908
+ const exitStatusRaw = entry["exit_status"];
893
909
  if (!Array.isArray(portsRaw) ||
894
910
  !portsRaw.every((port) => {
895
911
  if (!isRecord(port)) {
@@ -906,9 +922,39 @@ class ContainersClient {
906
922
  containerPort: port["container_port"],
907
923
  hostPort: port["host_port"],
908
924
  }));
925
+ let stats;
926
+ if (isRecord(statsRaw)) {
927
+ const cpuUsageNanoCores = statsRaw["cpu_usage_nano_cores"];
928
+ const memoryUsageBytes = statsRaw["memory_usage_bytes"];
929
+ const memoryWorkingSetBytes = statsRaw["memory_working_set_bytes"];
930
+ const timestampNs = statsRaw["timestamp_ns"];
931
+ stats = {
932
+ cpuUsageNanoCores: typeof cpuUsageNanoCores === "number" ? cpuUsageNanoCores : undefined,
933
+ memoryUsageBytes: typeof memoryUsageBytes === "number" ? memoryUsageBytes : undefined,
934
+ memoryWorkingSetBytes: typeof memoryWorkingSetBytes === "number" ? memoryWorkingSetBytes : undefined,
935
+ timestampNs: typeof timestampNs === "number" ? timestampNs : undefined,
936
+ };
937
+ }
938
+ let exitStatus;
939
+ if (isRecord(exitStatusRaw)) {
940
+ const exitCode = exitStatusRaw["exit_code"];
941
+ if (typeof exitCode === "number" &&
942
+ Number.isInteger(exitCode)) {
943
+ const reason = exitStatusRaw["reason"];
944
+ const message = exitStatusRaw["message"];
945
+ const oomKilled = exitStatusRaw["oom_killed"];
946
+ exitStatus = {
947
+ exitCode,
948
+ reason: typeof reason === "string" ? reason : undefined,
949
+ message: typeof message === "string" ? message : undefined,
950
+ oomKilled: typeof oomKilled === "boolean" ? oomKilled : undefined,
951
+ };
952
+ }
953
+ }
909
954
  items.push({
910
955
  id,
911
956
  image,
957
+ imageId: typeof imageIdRaw === "string" ? imageIdRaw : undefined,
912
958
  name: typeof nameRaw === "string" ? nameRaw : undefined,
913
959
  ports,
914
960
  startedBy: {
@@ -918,6 +964,8 @@ class ContainersClient {
918
964
  state,
919
965
  private: privateFlag,
920
966
  serviceId: typeof serviceIdRaw === "string" ? serviceIdRaw : undefined,
967
+ stats,
968
+ exitStatus,
921
969
  });
922
970
  }
923
971
  return items;
@@ -56,15 +56,30 @@ export interface RoomContainerPort {
56
56
  containerPort: number;
57
57
  hostPort: number;
58
58
  }
59
+ export interface RoomContainerStats {
60
+ cpuUsageNanoCores?: number;
61
+ memoryUsageBytes?: number;
62
+ memoryWorkingSetBytes?: number;
63
+ timestampNs?: number;
64
+ }
59
65
  export interface RoomContainer {
60
66
  id: string;
61
67
  image: string;
68
+ imageId?: string;
62
69
  name?: string;
63
70
  ports: RoomContainerPort[];
64
71
  startedBy: ContainerParticipantInfo;
65
72
  state: string;
66
73
  private: boolean;
67
74
  serviceId?: string;
75
+ stats?: RoomContainerStats;
76
+ exitStatus?: ContainerExitStatus;
77
+ }
78
+ export interface ContainerExitStatus {
79
+ exitCode: number;
80
+ reason?: string;
81
+ message?: string;
82
+ oomKilled?: boolean;
68
83
  }
69
84
  export interface LogProgress {
70
85
  layer?: string | null;
@@ -211,6 +226,9 @@ export declare class ContainersClient {
211
226
  containerId: string;
212
227
  force?: boolean;
213
228
  }): Promise<void>;
229
+ waitForExitStatus(params: {
230
+ containerId: string;
231
+ }): Promise<ContainerExitStatus>;
214
232
  waitForExit(params: {
215
233
  containerId: string;
216
234
  }): Promise<number>;
@@ -618,14 +618,27 @@ class ContainersClient {
618
618
  force: params.force ?? false,
619
619
  });
620
620
  }
621
- async waitForExit(params) {
621
+ async waitForExitStatus(params) {
622
622
  const output = await this.invoke("wait_for_exit", {
623
623
  container_id: params.containerId,
624
624
  });
625
625
  if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
626
626
  throw this.unexpectedResponseError("wait_for_exit");
627
627
  }
628
- return readIntegerField(output.json, "exit_code", "wait_for_exit");
628
+ const exitCode = readIntegerField(output.json, "exit_code", "wait_for_exit");
629
+ const reason = output.json["reason"];
630
+ const message = output.json["message"];
631
+ const oomKilled = output.json["oom_killed"];
632
+ return {
633
+ exitCode,
634
+ reason: typeof reason === "string" ? reason : undefined,
635
+ message: typeof message === "string" ? message : undefined,
636
+ oomKilled: typeof oomKilled === "boolean" ? oomKilled : undefined,
637
+ };
638
+ }
639
+ async waitForExit(params) {
640
+ const status = await this.waitForExitStatus(params);
641
+ return status.exitCode;
629
642
  }
630
643
  async deleteContainer(params) {
631
644
  await this.invoke("delete_container", {
@@ -888,8 +901,11 @@ class ContainersClient {
888
901
  throw this.unexpectedResponseError("list");
889
902
  }
890
903
  const nameRaw = entry["name"];
904
+ const imageIdRaw = entry["image_id"];
891
905
  const portsRaw = entry["ports"];
892
906
  const serviceIdRaw = entry["service_id"];
907
+ const statsRaw = entry["stats"];
908
+ const exitStatusRaw = entry["exit_status"];
893
909
  if (!Array.isArray(portsRaw) ||
894
910
  !portsRaw.every((port) => {
895
911
  if (!isRecord(port)) {
@@ -906,9 +922,39 @@ class ContainersClient {
906
922
  containerPort: port["container_port"],
907
923
  hostPort: port["host_port"],
908
924
  }));
925
+ let stats;
926
+ if (isRecord(statsRaw)) {
927
+ const cpuUsageNanoCores = statsRaw["cpu_usage_nano_cores"];
928
+ const memoryUsageBytes = statsRaw["memory_usage_bytes"];
929
+ const memoryWorkingSetBytes = statsRaw["memory_working_set_bytes"];
930
+ const timestampNs = statsRaw["timestamp_ns"];
931
+ stats = {
932
+ cpuUsageNanoCores: typeof cpuUsageNanoCores === "number" ? cpuUsageNanoCores : undefined,
933
+ memoryUsageBytes: typeof memoryUsageBytes === "number" ? memoryUsageBytes : undefined,
934
+ memoryWorkingSetBytes: typeof memoryWorkingSetBytes === "number" ? memoryWorkingSetBytes : undefined,
935
+ timestampNs: typeof timestampNs === "number" ? timestampNs : undefined,
936
+ };
937
+ }
938
+ let exitStatus;
939
+ if (isRecord(exitStatusRaw)) {
940
+ const exitCode = exitStatusRaw["exit_code"];
941
+ if (typeof exitCode === "number" &&
942
+ Number.isInteger(exitCode)) {
943
+ const reason = exitStatusRaw["reason"];
944
+ const message = exitStatusRaw["message"];
945
+ const oomKilled = exitStatusRaw["oom_killed"];
946
+ exitStatus = {
947
+ exitCode,
948
+ reason: typeof reason === "string" ? reason : undefined,
949
+ message: typeof message === "string" ? message : undefined,
950
+ oomKilled: typeof oomKilled === "boolean" ? oomKilled : undefined,
951
+ };
952
+ }
953
+ }
909
954
  items.push({
910
955
  id,
911
956
  image,
957
+ imageId: typeof imageIdRaw === "string" ? imageIdRaw : undefined,
912
958
  name: typeof nameRaw === "string" ? nameRaw : undefined,
913
959
  ports,
914
960
  startedBy: {
@@ -918,6 +964,8 @@ class ContainersClient {
918
964
  state,
919
965
  private: privateFlag,
920
966
  serviceId: typeof serviceIdRaw === "string" ? serviceIdRaw : undefined,
967
+ stats,
968
+ exitStatus,
921
969
  });
922
970
  }
923
971
  return items;
@@ -56,15 +56,30 @@ export interface RoomContainerPort {
56
56
  containerPort: number;
57
57
  hostPort: number;
58
58
  }
59
+ export interface RoomContainerStats {
60
+ cpuUsageNanoCores?: number;
61
+ memoryUsageBytes?: number;
62
+ memoryWorkingSetBytes?: number;
63
+ timestampNs?: number;
64
+ }
59
65
  export interface RoomContainer {
60
66
  id: string;
61
67
  image: string;
68
+ imageId?: string;
62
69
  name?: string;
63
70
  ports: RoomContainerPort[];
64
71
  startedBy: ContainerParticipantInfo;
65
72
  state: string;
66
73
  private: boolean;
67
74
  serviceId?: string;
75
+ stats?: RoomContainerStats;
76
+ exitStatus?: ContainerExitStatus;
77
+ }
78
+ export interface ContainerExitStatus {
79
+ exitCode: number;
80
+ reason?: string;
81
+ message?: string;
82
+ oomKilled?: boolean;
68
83
  }
69
84
  export interface LogProgress {
70
85
  layer?: string | null;
@@ -211,6 +226,9 @@ export declare class ContainersClient {
211
226
  containerId: string;
212
227
  force?: boolean;
213
228
  }): Promise<void>;
229
+ waitForExitStatus(params: {
230
+ containerId: string;
231
+ }): Promise<ContainerExitStatus>;
214
232
  waitForExit(params: {
215
233
  containerId: string;
216
234
  }): Promise<number>;
@@ -618,14 +618,27 @@ class ContainersClient {
618
618
  force: params.force ?? false,
619
619
  });
620
620
  }
621
- async waitForExit(params) {
621
+ async waitForExitStatus(params) {
622
622
  const output = await this.invoke("wait_for_exit", {
623
623
  container_id: params.containerId,
624
624
  });
625
625
  if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
626
626
  throw this.unexpectedResponseError("wait_for_exit");
627
627
  }
628
- return readIntegerField(output.json, "exit_code", "wait_for_exit");
628
+ const exitCode = readIntegerField(output.json, "exit_code", "wait_for_exit");
629
+ const reason = output.json["reason"];
630
+ const message = output.json["message"];
631
+ const oomKilled = output.json["oom_killed"];
632
+ return {
633
+ exitCode,
634
+ reason: typeof reason === "string" ? reason : undefined,
635
+ message: typeof message === "string" ? message : undefined,
636
+ oomKilled: typeof oomKilled === "boolean" ? oomKilled : undefined,
637
+ };
638
+ }
639
+ async waitForExit(params) {
640
+ const status = await this.waitForExitStatus(params);
641
+ return status.exitCode;
629
642
  }
630
643
  async deleteContainer(params) {
631
644
  await this.invoke("delete_container", {
@@ -888,8 +901,11 @@ class ContainersClient {
888
901
  throw this.unexpectedResponseError("list");
889
902
  }
890
903
  const nameRaw = entry["name"];
904
+ const imageIdRaw = entry["image_id"];
891
905
  const portsRaw = entry["ports"];
892
906
  const serviceIdRaw = entry["service_id"];
907
+ const statsRaw = entry["stats"];
908
+ const exitStatusRaw = entry["exit_status"];
893
909
  if (!Array.isArray(portsRaw) ||
894
910
  !portsRaw.every((port) => {
895
911
  if (!isRecord(port)) {
@@ -906,9 +922,39 @@ class ContainersClient {
906
922
  containerPort: port["container_port"],
907
923
  hostPort: port["host_port"],
908
924
  }));
925
+ let stats;
926
+ if (isRecord(statsRaw)) {
927
+ const cpuUsageNanoCores = statsRaw["cpu_usage_nano_cores"];
928
+ const memoryUsageBytes = statsRaw["memory_usage_bytes"];
929
+ const memoryWorkingSetBytes = statsRaw["memory_working_set_bytes"];
930
+ const timestampNs = statsRaw["timestamp_ns"];
931
+ stats = {
932
+ cpuUsageNanoCores: typeof cpuUsageNanoCores === "number" ? cpuUsageNanoCores : undefined,
933
+ memoryUsageBytes: typeof memoryUsageBytes === "number" ? memoryUsageBytes : undefined,
934
+ memoryWorkingSetBytes: typeof memoryWorkingSetBytes === "number" ? memoryWorkingSetBytes : undefined,
935
+ timestampNs: typeof timestampNs === "number" ? timestampNs : undefined,
936
+ };
937
+ }
938
+ let exitStatus;
939
+ if (isRecord(exitStatusRaw)) {
940
+ const exitCode = exitStatusRaw["exit_code"];
941
+ if (typeof exitCode === "number" &&
942
+ Number.isInteger(exitCode)) {
943
+ const reason = exitStatusRaw["reason"];
944
+ const message = exitStatusRaw["message"];
945
+ const oomKilled = exitStatusRaw["oom_killed"];
946
+ exitStatus = {
947
+ exitCode,
948
+ reason: typeof reason === "string" ? reason : undefined,
949
+ message: typeof message === "string" ? message : undefined,
950
+ oomKilled: typeof oomKilled === "boolean" ? oomKilled : undefined,
951
+ };
952
+ }
953
+ }
909
954
  items.push({
910
955
  id,
911
956
  image,
957
+ imageId: typeof imageIdRaw === "string" ? imageIdRaw : undefined,
912
958
  name: typeof nameRaw === "string" ? nameRaw : undefined,
913
959
  ports,
914
960
  startedBy: {
@@ -918,6 +964,8 @@ class ContainersClient {
918
964
  state,
919
965
  private: privateFlag,
920
966
  serviceId: typeof serviceIdRaw === "string" ? serviceIdRaw : undefined,
967
+ stats,
968
+ exitStatus,
921
969
  });
922
970
  }
923
971
  return items;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent",
3
- "version": "0.42.0",
3
+ "version": "0.42.2",
4
4
  "description": "Meshagent Client",
5
5
  "homepage": "https://github.com/meshagent/meshagent-ts",
6
6
  "scripts": {