nomadexapp 0.2.2 → 0.2.3
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/bin/nomadex.mjs +13 -6
- package/package.json +1 -1
package/bin/nomadex.mjs
CHANGED
|
@@ -427,6 +427,7 @@ const promptForUpdate = async () => {
|
|
|
427
427
|
};
|
|
428
428
|
|
|
429
429
|
const wsUrl = new URL(options.wsUrl);
|
|
430
|
+
const formatWsBaseUrl = () => `${wsUrl.protocol}//${wsUrl.host}`;
|
|
430
431
|
const getWsHost = () => wsUrl.hostname;
|
|
431
432
|
const getWsPort = () =>
|
|
432
433
|
Number(wsUrl.port || (wsUrl.protocol === "wss:" ? 443 : 80));
|
|
@@ -756,7 +757,9 @@ const ensureAppServer = async () => {
|
|
|
756
757
|
|
|
757
758
|
if (await isPortOpen(probeHost, wsPort)) {
|
|
758
759
|
if (await isCodexAppServerReady()) {
|
|
759
|
-
console.log(
|
|
760
|
+
console.log(
|
|
761
|
+
`[nomadexapp] Reusing Codex app-server at ${formatWsBaseUrl()}`,
|
|
762
|
+
);
|
|
760
763
|
return;
|
|
761
764
|
}
|
|
762
765
|
|
|
@@ -783,17 +786,19 @@ const ensureAppServer = async () => {
|
|
|
783
786
|
}
|
|
784
787
|
|
|
785
788
|
wsUrl.port = String(nextPort);
|
|
786
|
-
options.wsUrl =
|
|
789
|
+
options.wsUrl = formatWsBaseUrl();
|
|
787
790
|
console.log(
|
|
788
|
-
`[nomadexapp] App-server port ${wsPort} is busy. Using ${
|
|
791
|
+
`[nomadexapp] App-server port ${wsPort} is busy. Using ${formatWsBaseUrl()} instead.`,
|
|
789
792
|
);
|
|
790
793
|
}
|
|
791
794
|
|
|
792
795
|
const codexLaunch = getCodexLaunch();
|
|
793
|
-
console.log(
|
|
796
|
+
console.log(
|
|
797
|
+
`[nomadexapp] Starting Codex app-server at ${formatWsBaseUrl()}`,
|
|
798
|
+
);
|
|
794
799
|
const appServer = spawn(
|
|
795
800
|
codexLaunch.command,
|
|
796
|
-
[...codexLaunch.args, "app-server", "--listen",
|
|
801
|
+
[...codexLaunch.args, "app-server", "--listen", formatWsBaseUrl()],
|
|
797
802
|
{
|
|
798
803
|
cwd: launchCwd,
|
|
799
804
|
stdio: "inherit",
|
|
@@ -829,7 +834,9 @@ const ensureAppServer = async () => {
|
|
|
829
834
|
await sleep(200);
|
|
830
835
|
}
|
|
831
836
|
|
|
832
|
-
throw new Error(
|
|
837
|
+
throw new Error(
|
|
838
|
+
`Timed out waiting for Codex app-server at ${formatWsBaseUrl()}`,
|
|
839
|
+
);
|
|
833
840
|
};
|
|
834
841
|
|
|
835
842
|
const sendText = (res, statusCode, message) => {
|