codexapp 0.1.17 → 0.1.19
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/assets/index-DBCFXazi.css +1 -0
- package/dist/assets/index-Nt6RQJ29.js +48 -0
- package/dist/index.html +2 -2
- package/dist-cli/index.js +27 -6
- package/dist-cli/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/assets/index-BA7XJaRp.js +0 -48
- package/dist/assets/index-DsnkWOke.css +0 -1
package/dist/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Codex Web Local</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-Nt6RQJ29.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DBCFXazi.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body class="bg-slate-950">
|
|
11
11
|
<div id="app"></div>
|
package/dist-cli/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/cli/index.ts
|
|
4
4
|
import { createServer as createServer2 } from "http";
|
|
5
|
-
import { existsSync } from "fs";
|
|
5
|
+
import { existsSync as existsSync2 } from "fs";
|
|
6
6
|
import { readFile as readFile2 } from "fs/promises";
|
|
7
7
|
import { homedir as homedir2 } from "os";
|
|
8
8
|
import { join as join3 } from "path";
|
|
@@ -15,6 +15,7 @@ import qrcode from "qrcode-terminal";
|
|
|
15
15
|
// src/server/httpServer.ts
|
|
16
16
|
import { fileURLToPath } from "url";
|
|
17
17
|
import { dirname, extname, isAbsolute as isAbsolute2, join as join2 } from "path";
|
|
18
|
+
import { existsSync } from "fs";
|
|
18
19
|
import express from "express";
|
|
19
20
|
|
|
20
21
|
// src/server/codexAppServerBridge.ts
|
|
@@ -1330,6 +1331,7 @@ function createAuthSession(password) {
|
|
|
1330
1331
|
import { WebSocketServer } from "ws";
|
|
1331
1332
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1332
1333
|
var distDir = join2(__dirname, "..", "dist");
|
|
1334
|
+
var spaEntryFile = join2(distDir, "index.html");
|
|
1333
1335
|
var IMAGE_CONTENT_TYPES = {
|
|
1334
1336
|
".avif": "image/avif",
|
|
1335
1337
|
".bmp": "image/bmp",
|
|
@@ -1379,9 +1381,28 @@ function createServer(options = {}) {
|
|
|
1379
1381
|
if (!res.headersSent) res.status(404).json({ error: "Image file not found." });
|
|
1380
1382
|
});
|
|
1381
1383
|
});
|
|
1382
|
-
|
|
1384
|
+
const hasFrontendAssets = existsSync(spaEntryFile);
|
|
1385
|
+
if (hasFrontendAssets) {
|
|
1386
|
+
app.use(express.static(distDir));
|
|
1387
|
+
}
|
|
1383
1388
|
app.use((_req, res) => {
|
|
1384
|
-
|
|
1389
|
+
if (!hasFrontendAssets) {
|
|
1390
|
+
res.status(503).type("text/plain").send(
|
|
1391
|
+
[
|
|
1392
|
+
"Codex web UI assets are missing.",
|
|
1393
|
+
`Expected: ${spaEntryFile}`,
|
|
1394
|
+
"If running from source, build frontend assets with: npm run build:frontend",
|
|
1395
|
+
"If running with npx, clear the npx cache and reinstall codexapp."
|
|
1396
|
+
].join("\n")
|
|
1397
|
+
);
|
|
1398
|
+
return;
|
|
1399
|
+
}
|
|
1400
|
+
res.sendFile(spaEntryFile, (error) => {
|
|
1401
|
+
if (!error) return;
|
|
1402
|
+
if (!res.headersSent) {
|
|
1403
|
+
res.status(404).type("text/plain").send("Frontend entry file not found.");
|
|
1404
|
+
}
|
|
1405
|
+
});
|
|
1385
1406
|
});
|
|
1386
1407
|
return {
|
|
1387
1408
|
app,
|
|
@@ -1467,7 +1488,7 @@ function resolveCodexCommand() {
|
|
|
1467
1488
|
return "codex";
|
|
1468
1489
|
}
|
|
1469
1490
|
const userCandidate = join3(getUserNpmPrefix(), "bin", "codex");
|
|
1470
|
-
if (
|
|
1491
|
+
if (existsSync2(userCandidate) && canRun(userCandidate, ["--version"])) {
|
|
1471
1492
|
return userCandidate;
|
|
1472
1493
|
}
|
|
1473
1494
|
const prefix = process.env.PREFIX?.trim();
|
|
@@ -1475,14 +1496,14 @@ function resolveCodexCommand() {
|
|
|
1475
1496
|
return null;
|
|
1476
1497
|
}
|
|
1477
1498
|
const candidate = join3(prefix, "bin", "codex");
|
|
1478
|
-
if (
|
|
1499
|
+
if (existsSync2(candidate) && canRun(candidate, ["--version"])) {
|
|
1479
1500
|
return candidate;
|
|
1480
1501
|
}
|
|
1481
1502
|
return null;
|
|
1482
1503
|
}
|
|
1483
1504
|
function hasCodexAuth() {
|
|
1484
1505
|
const codexHome = process.env.CODEX_HOME?.trim() || join3(homedir2(), ".codex");
|
|
1485
|
-
return
|
|
1506
|
+
return existsSync2(join3(codexHome, "auth.json"));
|
|
1486
1507
|
}
|
|
1487
1508
|
function ensureCodexInstalled() {
|
|
1488
1509
|
let codexCommand = resolveCodexCommand();
|