codexui-android 0.1.96 → 0.1.97
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-cli/index.js +26 -1
- package/dist-cli/index.js.map +1 -1
- package/package.json +1 -1
package/dist-cli/index.js
CHANGED
|
@@ -4607,12 +4607,17 @@ function loadOptionalTerminalSpawn(spawn6) {
|
|
|
4607
4607
|
return { spawn: loadTerminalSpawn(), reason: null };
|
|
4608
4608
|
} catch (error) {
|
|
4609
4609
|
const message = error instanceof Error ? error.message : String(error);
|
|
4610
|
+
const suffix = message.includes("Cannot find module") ? "Native PTY support is not installed." : sanitizeUnavailableReason(message);
|
|
4610
4611
|
return {
|
|
4611
4612
|
spawn: null,
|
|
4612
|
-
reason: `Integrated terminal is unavailable on this host
|
|
4613
|
+
reason: `Integrated terminal is unavailable on this host. ${suffix}`
|
|
4613
4614
|
};
|
|
4614
4615
|
}
|
|
4615
4616
|
}
|
|
4617
|
+
function sanitizeUnavailableReason(message) {
|
|
4618
|
+
const firstLine = message.split("\n")[0]?.trim() || "";
|
|
4619
|
+
return firstLine ? firstLine : "Native PTY support could not be loaded.";
|
|
4620
|
+
}
|
|
4616
4621
|
function normalizeDimension(value, fallback) {
|
|
4617
4622
|
const parsed = typeof value === "number" ? value : Number(value);
|
|
4618
4623
|
if (!Number.isFinite(parsed)) return fallback;
|
|
@@ -7539,6 +7544,11 @@ function createCodexBridgeMiddleware() {
|
|
|
7539
7544
|
return;
|
|
7540
7545
|
}
|
|
7541
7546
|
if (req.method === "POST" && url.pathname === "/codex-api/thread-terminal/attach") {
|
|
7547
|
+
const availability = terminalManager.getAvailability();
|
|
7548
|
+
if (!availability.available) {
|
|
7549
|
+
setJson4(res, 503, { error: availability.reason || "Integrated terminal is unavailable on this host" });
|
|
7550
|
+
return;
|
|
7551
|
+
}
|
|
7542
7552
|
const body = asRecord5(await readJsonBody(req));
|
|
7543
7553
|
const threadId = readNonEmptyString(body?.threadId);
|
|
7544
7554
|
const cwd = readNonEmptyString(body?.cwd);
|
|
@@ -7558,6 +7568,11 @@ function createCodexBridgeMiddleware() {
|
|
|
7558
7568
|
return;
|
|
7559
7569
|
}
|
|
7560
7570
|
if (req.method === "POST" && url.pathname === "/codex-api/thread-terminal/input") {
|
|
7571
|
+
const availability = terminalManager.getAvailability();
|
|
7572
|
+
if (!availability.available) {
|
|
7573
|
+
setJson4(res, 503, { error: availability.reason || "Integrated terminal is unavailable on this host" });
|
|
7574
|
+
return;
|
|
7575
|
+
}
|
|
7561
7576
|
const body = asRecord5(await readJsonBody(req));
|
|
7562
7577
|
const sessionId = readNonEmptyString(body?.sessionId);
|
|
7563
7578
|
const data = typeof body?.data === "string" ? body.data : "";
|
|
@@ -7570,6 +7585,11 @@ function createCodexBridgeMiddleware() {
|
|
|
7570
7585
|
return;
|
|
7571
7586
|
}
|
|
7572
7587
|
if (req.method === "POST" && url.pathname === "/codex-api/thread-terminal/resize") {
|
|
7588
|
+
const availability = terminalManager.getAvailability();
|
|
7589
|
+
if (!availability.available) {
|
|
7590
|
+
setJson4(res, 503, { error: availability.reason || "Integrated terminal is unavailable on this host" });
|
|
7591
|
+
return;
|
|
7592
|
+
}
|
|
7573
7593
|
const body = asRecord5(await readJsonBody(req));
|
|
7574
7594
|
const sessionId = readNonEmptyString(body?.sessionId);
|
|
7575
7595
|
if (!sessionId) {
|
|
@@ -7581,6 +7601,11 @@ function createCodexBridgeMiddleware() {
|
|
|
7581
7601
|
return;
|
|
7582
7602
|
}
|
|
7583
7603
|
if (req.method === "POST" && url.pathname === "/codex-api/thread-terminal/close") {
|
|
7604
|
+
const availability = terminalManager.getAvailability();
|
|
7605
|
+
if (!availability.available) {
|
|
7606
|
+
setJson4(res, 503, { error: availability.reason || "Integrated terminal is unavailable on this host" });
|
|
7607
|
+
return;
|
|
7608
|
+
}
|
|
7584
7609
|
const body = asRecord5(await readJsonBody(req));
|
|
7585
7610
|
const sessionId = readNonEmptyString(body?.sessionId);
|
|
7586
7611
|
if (!sessionId) {
|