open-agents-ai 0.185.38 → 0.185.40
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 +78 -20
- 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);
|
|
@@ -36229,8 +36217,8 @@ var init_voice_session = __esm({
|
|
|
36229
36217
|
ttsSpeaking = false;
|
|
36230
36218
|
/** When set, serve PersonaPlex frontend that connects directly to this moshi.server WS URL */
|
|
36231
36219
|
personaPlexWsUrl = null;
|
|
36232
|
-
personaPlexTextPrompt = "You
|
|
36233
|
-
personaPlexVoicePrompt = "
|
|
36220
|
+
personaPlexTextPrompt = "You are having a natural conversation. Do not introduce yourself by name. Do not ask how you can help. Respond directly and naturally.";
|
|
36221
|
+
personaPlexVoicePrompt = "OverBarn.pt";
|
|
36234
36222
|
/** Idle timeout before auto-closing (ms). Default 60s — no users connected → session ends. */
|
|
36235
36223
|
idleTimeoutMs = 6e4;
|
|
36236
36224
|
/** Callback invoked when user audio chunk arrives (PCM 16kHz 16-bit mono) */
|
|
@@ -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);
|
|
@@ -41692,6 +41718,38 @@ $2if filename.endswith(".safetensors"):`);
|
|
|
41692
41718
|
}
|
|
41693
41719
|
} catch {
|
|
41694
41720
|
}
|
|
41721
|
+
try {
|
|
41722
|
+
const sitePackages2 = execSync27(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
|
|
41723
|
+
encoding: "utf8",
|
|
41724
|
+
timeout: 5e3,
|
|
41725
|
+
stdio: "pipe"
|
|
41726
|
+
}).trim();
|
|
41727
|
+
const hybridDest = join54(sitePackages2, "hybrid_agent.py");
|
|
41728
|
+
const serverDest = join54(sitePackages2, "server.py");
|
|
41729
|
+
if (!existsSync37(hybridDest) || !readFileSync28(hybridDest, "utf8").includes("OA_API_BASE")) {
|
|
41730
|
+
log("Deploying hybrid_agent.py (OA API integration)...");
|
|
41731
|
+
try {
|
|
41732
|
+
await execAsync(`curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/hybrid_agent.py" -o "${hybridDest}"`, { timeout: 3e4 });
|
|
41733
|
+
if (existsSync37(hybridDest) && readFileSync28(hybridDest, "utf8").includes("OA_API_BASE")) {
|
|
41734
|
+
log("hybrid_agent.py deployed (OA API + Ollama fallback).");
|
|
41735
|
+
}
|
|
41736
|
+
} catch {
|
|
41737
|
+
log("hybrid_agent.py download failed \u2014 hybrid mode will be disabled.");
|
|
41738
|
+
}
|
|
41739
|
+
}
|
|
41740
|
+
if (!readFileSync28(serverDest, "utf8").includes("hybrid_agent")) {
|
|
41741
|
+
log("Deploying patched server.py (hybrid mode + API endpoints)...");
|
|
41742
|
+
try {
|
|
41743
|
+
await execAsync(`curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/server.py" -o "${serverDest}"`, { timeout: 3e4 });
|
|
41744
|
+
if (readFileSync28(serverDest, "utf8").includes("hybrid_agent")) {
|
|
41745
|
+
log("server.py patched with hybrid intercept + REST APIs.");
|
|
41746
|
+
}
|
|
41747
|
+
} catch {
|
|
41748
|
+
log("server.py download failed \u2014 will use upstream version.");
|
|
41749
|
+
}
|
|
41750
|
+
}
|
|
41751
|
+
} catch {
|
|
41752
|
+
}
|
|
41695
41753
|
if (isAarch64) {
|
|
41696
41754
|
log("ARM64: Installing bitsandbytes for INT4 inference...");
|
|
41697
41755
|
try {
|
|
@@ -41700,7 +41758,7 @@ $2if filename.endswith(".safetensors"):`);
|
|
|
41700
41758
|
}
|
|
41701
41759
|
}
|
|
41702
41760
|
try {
|
|
41703
|
-
await execAsync(`"${pip}" install --quiet accelerate`, { timeout: 12e4, stdio: "pipe" });
|
|
41761
|
+
await execAsync(`"${pip}" install --quiet accelerate aiohttp`, { timeout: 12e4, stdio: "pipe" });
|
|
41704
41762
|
} catch {
|
|
41705
41763
|
}
|
|
41706
41764
|
try {
|
package/package.json
CHANGED