bloby-bot 0.35.0 → 0.36.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bloby-bot",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "releaseNotes": [
5
5
  "1. # voice note (PTT bubble)",
6
6
  "2. # audio file + caption",
@@ -54,6 +54,7 @@
54
54
  "dependencies": {
55
55
  "@anthropic-ai/claude-agent-sdk": "^0.2.112",
56
56
  "@clack/prompts": "^1.1.0",
57
+ "@openai/codex": "^0.128.0",
57
58
  "@streamdown/code": "^1.1.1",
58
59
  "@tailwindcss/vite": "^4.2.0",
59
60
  "@vitejs/plugin-react": "^6.0.1",
@@ -26,6 +26,7 @@
26
26
  */
27
27
 
28
28
  import { spawn, type ChildProcessWithoutNullStreams } from 'child_process';
29
+ import { createRequire } from 'module';
29
30
  import readline from 'readline';
30
31
  import fs from 'fs';
31
32
  import path from 'path';
@@ -43,6 +44,45 @@ const CLIENT_INFO = { name: 'bloby', title: 'Bloby', version: '1' };
43
44
  const REQUEST_TIMEOUT_MS = 60_000;
44
45
  const VALID_EFFORTS = new Set(['low', 'medium', 'high', 'xhigh']);
45
46
 
47
+ /**
48
+ * Resolve the `codex` binary. We don't trust $PATH because Bloby may be
49
+ * installed globally without `@openai/codex` also globally available. Order:
50
+ * 1. BLOBY_CODEX_BIN env override (advanced users / dev)
51
+ * 2. The `bin` entry from the bundled `@openai/codex` npm package
52
+ * (this is what `npm install bloby-bot` will pull in)
53
+ * 3. Fall back to `codex` on PATH (works when the user installed codex CLI
54
+ * separately, e.g. via apt/brew).
55
+ */
56
+ let cachedCodexBin: string | null = null;
57
+ function resolveCodexBin(): string {
58
+ if (cachedCodexBin) return cachedCodexBin;
59
+
60
+ if (process.env.BLOBY_CODEX_BIN) {
61
+ cachedCodexBin = process.env.BLOBY_CODEX_BIN;
62
+ return cachedCodexBin;
63
+ }
64
+
65
+ try {
66
+ const requireFromHere = createRequire(import.meta.url);
67
+ const pkgPath = requireFromHere.resolve('@openai/codex/package.json');
68
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
69
+ const binEntry = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin?.codex;
70
+ if (binEntry) {
71
+ const resolved = path.join(path.dirname(pkgPath), binEntry);
72
+ if (fs.existsSync(resolved)) {
73
+ cachedCodexBin = resolved;
74
+ log.info(`[codex] using bundled binary: ${resolved}`);
75
+ return cachedCodexBin;
76
+ }
77
+ }
78
+ } catch {
79
+ // @openai/codex not installed as a dep — fall through.
80
+ }
81
+
82
+ cachedCodexBin = 'codex';
83
+ return cachedCodexBin;
84
+ }
85
+
46
86
  /* ── Prompt-assembly helpers (duplicated from claude.ts to keep that file
47
87
  * untouched per the project rule) ───────────────────────────────────── */
48
88
 
@@ -125,7 +165,7 @@ class CodexRpc {
125
165
  private stderrBuf = '';
126
166
 
127
167
  start(): void {
128
- this.proc = spawn('codex', ['app-server'], { stdio: ['pipe', 'pipe', 'pipe'] });
168
+ this.proc = spawn(resolveCodexBin(), ['app-server'], { stdio: ['pipe', 'pipe', 'pipe'] });
129
169
  const rl = readline.createInterface({ input: this.proc.stdout });
130
170
  rl.on('line', (line) => this.onLine(line));
131
171