@reactor-team/js-sdk 2.1.0 → 2.2.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/dist/index.js +15 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -60,16 +60,20 @@ var ConflictError = class extends Error {
|
|
|
60
60
|
// src/core/types.ts
|
|
61
61
|
import { z } from "zod";
|
|
62
62
|
var SessionState = /* @__PURE__ */ ((SessionState2) => {
|
|
63
|
-
SessionState2[SessionState2["
|
|
64
|
-
SessionState2[SessionState2["
|
|
65
|
-
SessionState2[SessionState2["
|
|
66
|
-
SessionState2[SessionState2["
|
|
67
|
-
SessionState2[SessionState2["
|
|
68
|
-
SessionState2[SessionState2["
|
|
63
|
+
SessionState2[SessionState2["CREATED"] = 0] = "CREATED";
|
|
64
|
+
SessionState2[SessionState2["PENDING"] = 1] = "PENDING";
|
|
65
|
+
SessionState2[SessionState2["SUSPENDED"] = 2] = "SUSPENDED";
|
|
66
|
+
SessionState2[SessionState2["WAITING"] = 3] = "WAITING";
|
|
67
|
+
SessionState2[SessionState2["ACTIVE"] = 4] = "ACTIVE";
|
|
68
|
+
SessionState2[SessionState2["INACTIVE"] = 5] = "INACTIVE";
|
|
69
|
+
SessionState2[SessionState2["CLOSED"] = 6] = "CLOSED";
|
|
69
70
|
return SessionState2;
|
|
70
71
|
})(SessionState || {});
|
|
72
|
+
var ModelSchema = z.object({
|
|
73
|
+
name: z.string()
|
|
74
|
+
});
|
|
71
75
|
var CreateSessionRequestSchema = z.object({
|
|
72
|
-
model:
|
|
76
|
+
model: ModelSchema,
|
|
73
77
|
sdp_offer: z.string(),
|
|
74
78
|
extra_args: z.record(z.string(), z.any())
|
|
75
79
|
// Dictionary
|
|
@@ -256,7 +260,7 @@ var CoordinatorClient = class {
|
|
|
256
260
|
return __async(this, null, function* () {
|
|
257
261
|
console.debug("[CoordinatorClient] Creating session...");
|
|
258
262
|
const requestBody = {
|
|
259
|
-
model: this.model,
|
|
263
|
+
model: { name: this.model },
|
|
260
264
|
sdp_offer,
|
|
261
265
|
extra_args: {}
|
|
262
266
|
};
|
|
@@ -1054,7 +1058,9 @@ var Reactor = class {
|
|
|
1054
1058
|
setupMachineClientHandlers() {
|
|
1055
1059
|
if (!this.machineClient) return;
|
|
1056
1060
|
this.machineClient.on("application", (message) => {
|
|
1057
|
-
|
|
1061
|
+
if ((message == null ? void 0 : message.type) === "application" && (message == null ? void 0 : message.data) !== void 0) {
|
|
1062
|
+
this.emit("newMessage", message.data);
|
|
1063
|
+
}
|
|
1058
1064
|
});
|
|
1059
1065
|
this.machineClient.on("statusChanged", (status) => {
|
|
1060
1066
|
switch (status) {
|