open-agents-ai 0.185.38 → 0.185.39
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 +43 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35970,22 +35970,10 @@ let opusEncoder = null, opusDecoder = null;
|
|
|
35970
35970
|
let agentText = '';
|
|
35971
35971
|
|
|
35972
35972
|
function connectPP() {
|
|
35973
|
-
//
|
|
35974
|
-
|
|
35975
|
-
|
|
35976
|
-
|
|
35977
|
-
// Check if we're behind a tunnel \u2014 if window.location.hostname isn't localhost,
|
|
35978
|
-
// we can't reach the PersonaPlex daemon directly. Build URL from current origin.
|
|
35979
|
-
const host = window.location.hostname;
|
|
35980
|
-
if (host !== 'localhost' && host !== '127.0.0.1' && !host.startsWith('192.168.')) {
|
|
35981
|
-
// We're on a tunnel \u2014 PersonaPlex needs to be reachable at the same origin
|
|
35982
|
-
// This requires the PersonaPlex server to be tunneled separately or proxied
|
|
35983
|
-
// For now, try the PP port via same hostname
|
|
35984
|
-
const proto = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
|
35985
|
-
wsBase = proto + '://' + host + ':8998';
|
|
35986
|
-
}
|
|
35987
|
-
}
|
|
35988
|
-
const url = wsBase + '/api/chat?text_prompt=' + encodeURIComponent(TEXT_PROMPT) +
|
|
35973
|
+
// Connect via the /pp proxy on the same origin \u2014 works through tunnels
|
|
35974
|
+
const proto = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
|
35975
|
+
const host = window.location.host; // includes port
|
|
35976
|
+
const url = proto + '://' + host + '/pp/api/chat?text_prompt=' + encodeURIComponent(TEXT_PROMPT) +
|
|
35989
35977
|
'&voice_prompt=' + encodeURIComponent(VOICE_PROMPT) + '&seed=-1';
|
|
35990
35978
|
statusEl.textContent = 'connecting to PersonaPlex...';
|
|
35991
35979
|
ppWs = new WebSocket(url);
|
|
@@ -36268,8 +36256,46 @@ var init_voice_session = __esm({
|
|
|
36268
36256
|
this.server = createServer2((req, res) => this.handleHTTP(req, res));
|
|
36269
36257
|
this.server.timeout = 0;
|
|
36270
36258
|
this.server.keepAliveTimeout = 0;
|
|
36271
|
-
this.wss = new import_websocket_server.default({
|
|
36259
|
+
this.wss = new import_websocket_server.default({ noServer: true });
|
|
36272
36260
|
this.wss.on("connection", (ws, req) => this.handleWSConnection(ws, req));
|
|
36261
|
+
const ppWss = new import_websocket_server.default({ noServer: true });
|
|
36262
|
+
ppWss.on("connection", (clientWs, req) => {
|
|
36263
|
+
const ppPath = (req.url ?? "/").replace(/^\/pp/, "") || "/";
|
|
36264
|
+
const ppUrl = `ws://127.0.0.1:8998${ppPath}`;
|
|
36265
|
+
const ppWs = new import_websocket.default(ppUrl);
|
|
36266
|
+
ppWs.on("open", () => {
|
|
36267
|
+
clientWs.on("message", (data) => {
|
|
36268
|
+
try {
|
|
36269
|
+
ppWs.send(data);
|
|
36270
|
+
} catch {
|
|
36271
|
+
}
|
|
36272
|
+
});
|
|
36273
|
+
ppWs.on("message", (data) => {
|
|
36274
|
+
try {
|
|
36275
|
+
clientWs.send(data);
|
|
36276
|
+
} catch {
|
|
36277
|
+
}
|
|
36278
|
+
});
|
|
36279
|
+
});
|
|
36280
|
+
ppWs.on("error", () => clientWs.close());
|
|
36281
|
+
ppWs.on("close", () => clientWs.close());
|
|
36282
|
+
clientWs.on("close", () => ppWs.close());
|
|
36283
|
+
clientWs.on("error", () => ppWs.close());
|
|
36284
|
+
});
|
|
36285
|
+
this.server.on("upgrade", (req, socket, head) => {
|
|
36286
|
+
const pathname = (req.url ?? "/").split("?")[0];
|
|
36287
|
+
if (pathname === "/ws") {
|
|
36288
|
+
this.wss.handleUpgrade(req, socket, head, (ws) => {
|
|
36289
|
+
this.wss.emit("connection", ws, req);
|
|
36290
|
+
});
|
|
36291
|
+
} else if (pathname.startsWith("/pp")) {
|
|
36292
|
+
ppWss.handleUpgrade(req, socket, head, (ws) => {
|
|
36293
|
+
ppWss.emit("connection", ws, req);
|
|
36294
|
+
});
|
|
36295
|
+
} else {
|
|
36296
|
+
socket.destroy();
|
|
36297
|
+
}
|
|
36298
|
+
});
|
|
36273
36299
|
await new Promise((resolve36, reject) => {
|
|
36274
36300
|
this.server.listen(port, "127.0.0.1", () => resolve36());
|
|
36275
36301
|
this.server.on("error", reject);
|
package/package.json
CHANGED