codex-webapp 0.1.2 → 0.1.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/README.ja.md CHANGED
@@ -127,7 +127,7 @@ Codex WebApp は telemetry、analytics、browser extension、project-operated ph
127
127
  | Codex CLI | `codex remote-control` を使うため、`0.130.0` 以上が必要です。 |
128
128
  | Node.js | `20` 以上が必要です。 |
129
129
  | network binding | デフォルトは `127.0.0.1`。非 loopback host は明示的な opt-in が必要です。 |
130
- | package channel | npm の `latest` channel から `codex-webapp` を使ってください。現在の release は `0.1.2` です。 |
130
+ | package channel | npm の `latest` channel から `codex-webapp` を使ってください。現在の release は `0.1.3` です。 |
131
131
 
132
132
  Codex が入っていない、または古い場合は、先に更新してください。
133
133
 
package/README.md CHANGED
@@ -127,7 +127,7 @@ Codex WebApp does not include telemetry, analytics, a browser extension, or a pr
127
127
  | Codex CLI | `0.130.0` or newer, because `codex remote-control` is required. |
128
128
  | Node.js | `20` or newer. |
129
129
  | Network binding | `127.0.0.1` by default. Non-loopback hosts require explicit opt-in. |
130
- | Package channel | `codex-webapp` from the npm `latest` channel. Current release: `0.1.2`. |
130
+ | Package channel | `codex-webapp` from the npm `latest` channel. Current release: `0.1.3`. |
131
131
 
132
132
  If Codex is missing or too old, update it first.
133
133
 
@@ -28,9 +28,9 @@ Constraints:
28
28
  Steps:
29
29
  1. Check whether Codex is available and whether `codex remote-control --help` works.
30
30
  2. If Codex is older than 0.130.0, explain the update that is needed.
31
- 3. Run `npx codex-webapp doctor`.
32
- 4. Run `npx codex-webapp start --dry-run`.
33
- 5. If a UI server is available, run `npx codex-webapp smoke --url http://127.0.0.1:8214/`.
31
+ 3. Run `npx -y codex-webapp doctor`.
32
+ 4. Run `npx -y codex-webapp start --dry-run`.
33
+ 5. If a UI server is available, run `npx -y codex-webapp smoke --url http://127.0.0.1:8214/`.
34
34
  6. Use `--browser --screenshot artifacts/codex-webapp.png` only when browser evidence is needed.
35
35
  7. Summarize pass/fail status and start a small diagnosis if a step fails.
36
36
  ```
@@ -80,7 +80,7 @@ npx -y codex-webapp smoke \
80
80
 
81
81
  이 패키지는 Codex App native marketplace plugin, browser extension, one-click installer, managed hosting service가 아닙니다. Codex App에 프롬프트를 붙여 넣고, Codex가 `npx`로 npm 패키지를 실행하는 방식입니다.
82
82
 
83
- 현재 release는 `0.1.2`이며 early, compatibility-first입니다. 현재 `0xcaff/codex-web` commit `585613f5a3a355af5aefc388ca4e31b07a472cda`를 참조하는 Codex 스타일 browser runtime을 실행하고, 그 주변에 설치, 안전, 문서, 검증 evidence 계층을 더합니다.
83
+ 현재 release는 `0.1.3`이며 early, compatibility-first입니다. 현재 `0xcaff/codex-web` commit `585613f5a3a355af5aefc388ca4e31b07a472cda`를 참조하는 Codex 스타일 browser runtime을 실행하고, 그 주변에 설치, 안전, 문서, 검증 evidence 계층을 더합니다.
84
84
 
85
85
  ## Security And Privacy
86
86
 
@@ -80,7 +80,7 @@ npx -y codex-webapp smoke \
80
80
 
81
81
  这不是 Codex App native marketplace plugin、browser extension、one-click installer 或 managed hosting service。它的使用方式是:把提示词粘贴到 Codex App,让 Codex 通过 `npx` 执行 npm 包。
82
82
 
83
- 当前 release 为 `0.1.2`,仍处于 early 阶段,并采用 compatibility-first 方针。它目前运行一个引用 `0xcaff/codex-web` commit `585613f5a3a355af5aefc388ca4e31b07a472cda` 的 Codex 风格 browser runtime,并在其周围增加安装、安全、文档和验证证据层。
83
+ 当前 release 为 `0.1.3`,仍处于 early 阶段,并采用 compatibility-first 方针。它目前运行一个引用 `0xcaff/codex-web` commit `585613f5a3a355af5aefc388ca4e31b07a472cda` 的 Codex 风格 browser runtime,并在其周围增加安装、安全、文档和验证证据层。
84
84
 
85
85
  ## Security And Privacy
86
86
 
@@ -24,7 +24,7 @@ codex remote-control --help
24
24
  ## 3. friendly doctor を実行
25
25
 
26
26
  ```bash
27
- npx codex-webapp doctor
27
+ npx -y codex-webapp doctor
28
28
  ```
29
29
 
30
30
  Codexが古い、または `remote-control` が見つからない場合は、次に打つべきコマンドを表示します。
@@ -32,13 +32,13 @@ Codexが古い、または `remote-control` が見つからない場合は、次
32
32
  ## 4. Codex-style Web UI を起動
33
33
 
34
34
  ```bash
35
- npx codex-webapp start
35
+ npx -y codex-webapp start
36
36
  ```
37
37
 
38
38
  このコマンドは起動前に確認プロンプトを出します。自動化された信頼済み環境だけで `--yes` を使ってください。
39
39
 
40
40
  ```bash
41
- npx codex-webapp start --yes
41
+ npx -y codex-webapp start --yes
42
42
  ```
43
43
 
44
44
  ## 5. ブラウザで表示できるか確認
@@ -46,7 +46,7 @@ npx codex-webapp start --yes
46
46
  UIサーバーが起動している状態で、実ブラウザ疎通を確認します。
47
47
 
48
48
  ```bash
49
- npx codex-webapp smoke \
49
+ npx -y codex-webapp smoke \
50
50
  --url http://127.0.0.1:8214/
51
51
  ```
52
52
 
@@ -55,7 +55,7 @@ npx codex-webapp smoke \
55
55
  スクリーンショットも残したい場合は、Playwrightを使うdeep smokeを実行します。
56
56
 
57
57
  ```bash
58
- npx codex-webapp smoke \
58
+ npx -y codex-webapp smoke \
59
59
  --browser \
60
60
  --url http://127.0.0.1:8214/ \
61
61
  --screenshot artifacts/codex-webapp.png
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-webapp",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Unofficial. Respectful web app surface, doctor, and safety wrapper for Codex App users.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
package/src/commands.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { spawn, spawnSync } from "node:child_process";
2
+ import { createServer } from "node:net";
2
3
  import { createInterface } from "node:readline/promises";
3
4
  import { stdin as input, stdout as output } from "node:process";
4
5
 
@@ -17,6 +18,17 @@ import {
17
18
  } from "./codexWeb.js";
18
19
 
19
20
  const BANNER = "Codex WebApp — unofficial OpenAI Codex companion; not endorsed by OpenAI.";
21
+ const DEFAULT_WEB_URL = "http://127.0.0.1:8214/";
22
+
23
+ function codexAppFlowLines(url = DEFAULT_WEB_URL) {
24
+ return [
25
+ "Codex App flow:",
26
+ " 1. Paste a setup request into the Codex App prompt.",
27
+ " 2. Codex runs: npx -y codex-webapp start",
28
+ ` 3. When it starts, open: ${url}`,
29
+ " 4. Keep this terminal window open. Closing it will stop the browser UI.",
30
+ ];
31
+ }
20
32
 
21
33
  export function main(argv = process.argv) {
22
34
  const command = argv[2] ?? "help";
@@ -97,7 +109,9 @@ export function doctor() {
97
109
  "`codex remote-control` is available.",
98
110
  `codex-web reference: ${CODEX_WEB_REFERENCE}`,
99
111
  "Next:",
100
- " npx codex-webapp start",
112
+ " npx -y codex-webapp start",
113
+ "",
114
+ ...codexAppFlowLines(),
101
115
  ]);
102
116
  }
103
117
 
@@ -126,12 +140,17 @@ export async function start(args = []) {
126
140
  BANNER,
127
141
  "Dry run passed.",
128
142
  `Would start codex-web: ${plannedWebUrl}`,
143
+ "",
144
+ ...codexAppFlowLines(plannedWebUrl),
145
+ "",
129
146
  "Would start:",
130
147
  ` npx ${npxArgs.join(" ")}`,
131
148
  ]);
132
149
  return;
133
150
  }
134
151
 
152
+ await assertPortAvailable(options.host, options.port);
153
+
135
154
  if (!options.yes) {
136
155
  console.log(BANNER);
137
156
  console.log(`About to start codex-web: ${plannedWebUrl}`);
@@ -148,6 +167,9 @@ export async function start(args = []) {
148
167
 
149
168
  console.log(`Starting codex-web from ${CODEX_WEB_REFERENCE}...`);
150
169
  console.log(`Open: ${plannedWebUrl}`);
170
+ console.log("");
171
+ for (const line of codexAppFlowLines(plannedWebUrl)) console.log(line);
172
+ console.log("");
151
173
  console.log("Keep this terminal open. Expose it only through a trusted local, Tailscale, Cloudflare Access, or equivalent boundary.");
152
174
  const codexPath = resolveCodexPath();
153
175
  const child = spawn("npx", npxArgs, {
@@ -162,6 +184,23 @@ export async function start(args = []) {
162
184
  });
163
185
  }
164
186
 
187
+ async function assertPortAvailable(host, port) {
188
+ await new Promise((resolve, reject) => {
189
+ const server = createServer();
190
+ server.once("error", (error) => {
191
+ if (error?.code === "EADDRINUSE") {
192
+ reject(new Error(`Port ${port} is already in use on ${host}. Codex WebApp may already be running. Close the other terminal window, or start with --port <port>.`));
193
+ return;
194
+ }
195
+ reject(error);
196
+ });
197
+ server.once("listening", () => {
198
+ server.close(resolve);
199
+ });
200
+ server.listen(port, host);
201
+ });
202
+ }
203
+
165
204
  export function help() {
166
205
  console.log(`${BANNER}
167
206
 
@@ -176,8 +215,16 @@ Commands:
176
215
  codex-webapp smoke --url http://127.0.0.1:8214/
177
216
  codex-webapp smoke --browser --screenshot artifacts/codex-webapp.png
178
217
 
179
- Quick start:
180
- npx codex-webapp doctor
218
+ Quick start from Codex App:
219
+ Paste a request that asks Codex to run:
220
+ npx -y codex-webapp doctor
221
+ npx -y codex-webapp start
222
+ Then open:
223
+ ${DEFAULT_WEB_URL}
224
+
225
+ Terminal quick start:
226
+ npx -y codex-webapp doctor
227
+ npx -y codex-webapp start
181
228
  `);
182
229
  }
183
230