codex-devtools 0.1.3 → 0.1.5

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.md CHANGED
@@ -38,7 +38,17 @@ npx codex-devtools
38
38
  bunx codex-devtools
39
39
  ```
40
40
 
41
- This starts a standalone HTTP server at `http://localhost:3456`.
41
+ This launches the native Electron app window.
42
+
43
+ To run web/HTTP mode explicitly:
44
+
45
+ ```bash
46
+ npx codex-devtools --web
47
+ # or
48
+ bunx codex-devtools --web
49
+ ```
50
+
51
+ Standalone mode serves at `http://localhost:3456`.
42
52
 
43
53
  ## Standalone mode
44
54
 
@@ -3,21 +3,83 @@
3
3
 
4
4
  const { existsSync } = require('node:fs');
5
5
  const { join } = require('node:path');
6
+ const { spawn } = require('node:child_process');
6
7
 
7
- const standaloneEntrypoint = join(__dirname, '..', 'dist-electron', 'main', 'standalone.cjs');
8
+ const APP_ROOT = join(__dirname, '..');
9
+ const ELECTRON_ENTRY = join(APP_ROOT, 'dist-electron', 'main', 'index.cjs');
10
+ const STANDALONE_ENTRY = join(APP_ROOT, 'dist-electron', 'main', 'standalone.cjs');
8
11
 
9
- if (!existsSync(standaloneEntrypoint)) {
10
- console.error(
11
- '[codex-devtools] Missing standalone bundle. Reinstall package or run a version that includes dist-electron output.',
12
- );
13
- process.exit(1);
12
+ function hasArg(flag) {
13
+ return process.argv.includes(flag);
14
14
  }
15
15
 
16
- const standaloneModule = require(standaloneEntrypoint);
16
+ function runStandalone() {
17
+ if (!existsSync(STANDALONE_ENTRY)) {
18
+ console.error('[codex-devtools] Missing standalone bundle. Reinstall package and try again.');
19
+ process.exit(1);
20
+ }
17
21
 
18
- if (typeof standaloneModule.startStandaloneCli !== 'function') {
19
- console.error('[codex-devtools] Invalid standalone entrypoint: startStandaloneCli export not found.');
20
- process.exit(1);
22
+ const standaloneModule = require(STANDALONE_ENTRY);
23
+ if (typeof standaloneModule.startStandaloneCli !== 'function') {
24
+ console.error('[codex-devtools] Invalid standalone entrypoint: startStandaloneCli export not found.');
25
+ process.exit(1);
26
+ }
27
+
28
+ standaloneModule.startStandaloneCli();
21
29
  }
22
30
 
23
- standaloneModule.startStandaloneCli();
31
+ function runDesktop() {
32
+ if (!existsSync(ELECTRON_ENTRY)) {
33
+ console.error('[codex-devtools] Missing Electron bundle. Reinstall package and try again.');
34
+ process.exit(1);
35
+ }
36
+
37
+ let electronBinary;
38
+ try {
39
+ electronBinary = require('electron');
40
+ } catch (error) {
41
+ console.error(
42
+ '[codex-devtools] Electron runtime is not available. Reinstall package and ensure install scripts are enabled.',
43
+ );
44
+ if (error && error.message) {
45
+ console.error(`[codex-devtools] ${error.message}`);
46
+ }
47
+ process.exit(1);
48
+ }
49
+
50
+ const forwardedArgs = process.argv.slice(2).filter((arg) => arg !== '--desktop');
51
+ const child = spawn(electronBinary, [APP_ROOT, ...forwardedArgs], {
52
+ stdio: 'inherit',
53
+ env: process.env,
54
+ });
55
+
56
+ child.on('error', (error) => {
57
+ console.error('[codex-devtools] Failed to launch Electron.', error);
58
+ process.exit(1);
59
+ });
60
+
61
+ child.on('exit', (code, signal) => {
62
+ if (signal) {
63
+ process.kill(process.pid, signal);
64
+ return;
65
+ }
66
+
67
+ process.exit(code ?? 0);
68
+ });
69
+ }
70
+
71
+ if (hasArg('--help') || hasArg('-h')) {
72
+ console.log('codex-devtools');
73
+ console.log('');
74
+ console.log('Usage:');
75
+ console.log(' codex-devtools Launch Electron desktop app (default)');
76
+ console.log(' codex-devtools --web Run standalone HTTP mode');
77
+ console.log(' codex-devtools --desktop Force desktop mode');
78
+ process.exit(0);
79
+ }
80
+
81
+ if (hasArg('--web') || hasArg('--standalone')) {
82
+ runStandalone();
83
+ } else {
84
+ runDesktop();
85
+ }
@@ -164,9 +164,21 @@ const removeIpcHandlers = (targetIpcMain) => {
164
164
  logger$1.info("All handlers removed");
165
165
  };
166
166
  const logger = CodexServiceContext.createLogger("Main");
167
+ const APP_DISPLAY_NAME = "codex-devtools";
167
168
  let mainWindow = null;
168
169
  let serviceContext = null;
169
170
  let removeFileChangeListener = null;
171
+ function resolveAppIconPath() {
172
+ const candidates = [
173
+ path.join(process.cwd(), "resources/logo.png"),
174
+ path.join(process.cwd(), "resources/icon.png"),
175
+ path.join(__dirname, "../../resources/logo.png"),
176
+ path.join(__dirname, "../../resources/icon.png"),
177
+ path.join(process.resourcesPath, "resources/logo.png"),
178
+ path.join(process.resourcesPath, "resources/icon.png")
179
+ ];
180
+ return candidates.find((candidate) => fs.existsSync(candidate));
181
+ }
170
182
  function getRendererIndexPath() {
171
183
  const candidates = [
172
184
  path.join(__dirname, "../../out/renderer/index.html"),
@@ -175,9 +187,12 @@ function getRendererIndexPath() {
175
187
  return candidates.find((candidate) => fs.existsSync(candidate)) ?? candidates[0];
176
188
  }
177
189
  const createWindow = () => {
190
+ const iconPath = resolveAppIconPath();
178
191
  const window = new electron.BrowserWindow({
192
+ title: APP_DISPLAY_NAME,
179
193
  width: 1200,
180
194
  height: 800,
195
+ ...iconPath ? { icon: iconPath } : {},
181
196
  webPreferences: {
182
197
  preload: path.join(__dirname, "../preload/index.cjs"),
183
198
  contextIsolation: true,
@@ -224,7 +239,12 @@ function disposeServices() {
224
239
  serviceContext = null;
225
240
  }
226
241
  }
242
+ electron.app.setName(APP_DISPLAY_NAME);
227
243
  void electron.app.whenReady().then(() => {
244
+ const iconPath = resolveAppIconPath();
245
+ if (iconPath && process.platform === "darwin" && electron.app.dock) {
246
+ electron.app.dock.setIcon(iconPath);
247
+ }
228
248
  initializeServices();
229
249
  mainWindow = createWindow();
230
250
  electron.app.on("activate", () => {
@@ -576,14 +576,6 @@ video {
576
576
  .transform {
577
577
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
578
578
  }
579
- .bg-slate-950 {
580
- --tw-bg-opacity: 1;
581
- background-color: rgb(2 6 23 / var(--tw-bg-opacity, 1));
582
- }
583
- .text-slate-100 {
584
- --tw-text-opacity: 1;
585
- color: rgb(241 245 249 / var(--tw-text-opacity, 1));
586
- }
587
579
  .filter {
588
580
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
589
581
  }
@@ -1233,6 +1225,11 @@ select {
1233
1225
  padding: 10px 12px;
1234
1226
  }
1235
1227
 
1228
+ :root.light .chat-user-bubble {
1229
+ border-color: rgba(37, 99, 235, 0.24);
1230
+ background: rgba(37, 99, 235, 0.1);
1231
+ }
1232
+
1236
1233
  .chat-attachments {
1237
1234
  display: grid;
1238
1235
  gap: 8px;
@@ -7,10 +7,10 @@
7
7
  <link rel="icon" type="image/png" sizes="32x32" href="./assets/32x32-DQgygEFU.png" />
8
8
  <link rel="icon" type="image/png" sizes="16x16" href="./assets/16x16-B2_QkmoB.png" />
9
9
  <title>codex-devtools</title>
10
- <script type="module" crossorigin src="./assets/index-NyaijTgK.js"></script>
11
- <link rel="stylesheet" crossorigin href="./assets/index-z5pXbBkY.css">
10
+ <script type="module" crossorigin src="./assets/index-C1DUQHyp.js"></script>
11
+ <link rel="stylesheet" crossorigin href="./assets/index-BTmVA30y.css">
12
12
  </head>
13
- <body class="bg-slate-950 text-slate-100">
13
+ <body>
14
14
  <div id="root">
15
15
  <div style="padding: 16px; font: 500 14px/1.4 system-ui, -apple-system, Segoe UI, sans-serif;">
16
16
  Loading codex-devtools...
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "codex-devtools",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "description": "Desktop app for inspecting Codex session data",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -27,7 +27,8 @@
27
27
  "README.md"
28
28
  ],
29
29
  "scripts": {
30
- "dev": "electron-vite dev",
30
+ "dev": "node scripts/dev.mjs",
31
+ "dev:raw": "electron-vite dev",
31
32
  "build": "electron-vite build",
32
33
  "dist": "electron-builder --mac --win --linux --publish never",
33
34
  "dist:mac": "electron-builder --mac --publish never",
@@ -46,6 +47,7 @@
46
47
  "@fastify/static": "^9.0.0",
47
48
  "@tanstack/react-virtual": "^3.10.8",
48
49
  "date-fns": "^3.6.0",
50
+ "electron": "~40.3.0",
49
51
  "fastify": "^5.7.4",
50
52
  "lucide-react": "^0.562.0",
51
53
  "react": "^18.3.1",
@@ -59,7 +61,6 @@
59
61
  "@types/react-dom": "^18.3.0",
60
62
  "@vitejs/plugin-react": "^4.3.1",
61
63
  "autoprefixer": "^10.4.17",
62
- "electron": "~40.3.0",
63
64
  "electron-builder": "^25.1.8",
64
65
  "electron-vite": "^2.3.0",
65
66
  "eslint": "^9.39.2",