@chatpanel/bridge 0.3.2 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/bridge",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "description": "Local bridge that exposes the AI coding agents installed on your machine — Claude Code (CLI), Codex (CLI), and Gemini CLI — to the ChatPanel Chrome extension over a localhost SSE endpoint. Bring your own agent.",
6
6
  "keywords": [
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { spawn, spawnSync } from 'node:child_process';
18
18
  import { readFile, unlink } from 'node:fs/promises';
19
- import { existsSync, mkdirSync, symlinkSync } from 'node:fs';
19
+ import { existsSync, mkdirSync, symlinkSync, readFileSync } from 'node:fs';
20
20
  import os from 'node:os';
21
21
  import path from 'node:path';
22
22
  import { findAgentBin } from '../env.js';
@@ -28,6 +28,22 @@ const IDLE_MS = Number(process.env.CHATPANEL_CODEX_TIMEOUT_MS) || 180_000;
28
28
  const REASONING = process.env.CHATPANEL_CODEX_EFFORT ?? 'low'; // '' → respect config
29
29
 
30
30
  const SCRATCH = path.join(os.tmpdir(), 'chatpanel-codex-scratch');
31
+
32
+ // Codex has no "list models" command — its model lives in CODEX_HOME/config.toml
33
+ // (e.g. `model = "gpt-5.5"`). Surface the user's REAL configured model(s), read
34
+ // straight from that file, plus a few common ids. The picker still accepts any
35
+ // free-text value, so an out-of-date curated entry is harmless.
36
+ const CODEX_KNOWN = ['gpt-5-codex', 'gpt-5', 'o3', 'o4-mini'];
37
+ export async function listModels() {
38
+ const set = new Set();
39
+ try {
40
+ const home = process.env.CODEX_HOME || path.join(os.homedir(), '.codex');
41
+ const cfg = readFileSync(path.join(home, 'config.toml'), 'utf8');
42
+ for (const m of cfg.matchAll(/(?:^|\n)\s*model\s*=\s*["']([^"'\n]+)["']/g)) set.add(m[1].trim());
43
+ } catch { /* no config — fall back to the curated set */ }
44
+ for (const m of CODEX_KNOWN) set.add(m);
45
+ return [...set];
46
+ }
31
47
  const ISO_HOME = path.join(os.homedir(), '.chatpanel', 'codex-home');
32
48
 
33
49
  function ensureScratch() {
@@ -20,6 +20,13 @@ import { findAgentBin } from '../env.js';
20
20
  const IDLE_MS = Number(process.env.CHATPANEL_GEMINI_TIMEOUT_MS) || 180_000;
21
21
  const SCRATCH = path.join(os.tmpdir(), 'chatpanel-gemini-scratch');
22
22
 
23
+ // Gemini CLI has no "list models" command (--help only lists extensions/sessions)
24
+ // and stores no model in settings.json, so offer the common current ids. Free
25
+ // text still accepted.
26
+ export async function listModels() {
27
+ return ['gemini-2.5-pro', 'gemini-2.5-flash', 'gemini-2.5-flash-lite'];
28
+ }
29
+
23
30
  let installed = false;
24
31
  let lastProbe = 0;
25
32
  export async function available() {
package/src/server.js CHANGED
@@ -27,7 +27,7 @@ import { checkForUpdate, selfUpdate } from './update.js';
27
27
  // Hardcoded (not read from package.json) so it survives Bun's single-file
28
28
  // --compile, where package.json isn't on a readable FS. CI fails the publish if
29
29
  // this drifts from package.json, so the two can't silently diverge.
30
- const VERSION = '0.3.2';
30
+ const VERSION = '0.3.3';
31
31
  const HOST = process.env.CHATPANEL_BRIDGE_HOST || '127.0.0.1';
32
32
  const PORT = Number(process.env.CHATPANEL_BRIDGE_PORT) || 4319;
33
33