@chatpanel/bridge 0.10.35 → 0.10.37

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.10.35",
3
+ "version": "0.10.37",
4
4
  "type": "module",
5
5
  "description": "Local bridge that exposes the AI coding agents installed on your machine \u2014 Claude Code (CLI), Codex (CLI), and Antigravity CLI (formerly Gemini CLI, which remains available for business/enterprise) \u2014 to the ChatPanel Chrome extension over a localhost SSE endpoint. Bring your own agent.",
6
6
  "keywords": [
@@ -8,8 +8,8 @@
8
8
  // kiro — kiro-cli chat --no-interactive "<prompt>" · --model · --list-models
9
9
  // hermes — hermes -z "<prompt>" · -m model · config get model (no list command)
10
10
 
11
- import { runSpec, listSpecModels, runForStdout } from './custom.js';
12
- import { findAgentBin } from '../env.js';
11
+ import { runSpec, listSpecModels, runForStdout, CHATPANEL_STABLE_MCP_URL } from './custom.js';
12
+ import { findAgentBin, selfMcpStdio } from '../env.js';
13
13
 
14
14
  // `listModels` override hook: a CLI whose model listing isn't "one id per line"
15
15
  // (Copilot prints a quoted list inside `help config`) passes its own parser here
@@ -264,14 +264,31 @@ export async function listDshModels(command = 'dsh', workingDir) {
264
264
  export const hermes = makeCliAgent(
265
265
  'hermes',
266
266
  {
267
- args: '-z',
267
+ // `-z {prompt}`, NOT a bare `-z`: Hermes takes the prompt as the VALUE of -z (Python
268
+ // argparse), and the runner appends a trailing prompt only when no {prompt} placeholder
269
+ // exists — after the model flag. That produced `hermes -z -m <model> "<prompt>"`, where
270
+ // argparse saw -z followed by another flag: "expected one argument". The placeholder
271
+ // binds the prompt to the flag, so the model flag can sit anywhere after it.
272
+ args: '-z {prompt}',
268
273
  promptVia: 'arg',
269
274
  modelArg: '-m {model}',
270
275
  requiresStableMcp: true,
271
276
  autoSetupStableMcp: true,
272
277
  stableMcpConfigCheck: 'hermes',
273
- stableMcpSetupArgs: ['mcp', 'add', 'chatpanel_browser', '--url', 'http://127.0.0.1:4319/mcp'],
274
- stableMcpSetupCommand: 'hermes mcp add chatpanel_browser --url http://127.0.0.1:4319/mcp',
278
+ // STDIO, not --url. Hermes's bundled MCP client has no HTTP transport ("requires HTTP
279
+ // transport but mcp.client.streamable_http is not available"), so a URL registration
280
+ // saves a config that can never connect. The bridge also speaks MCP over stdio — the
281
+ // same mode Codex uses — so we register that instead. A function because the executable
282
+ // is only known at runtime (a compiled binary runs itself; under node it re-runs its
283
+ // entry script). `--args` must come last, per `hermes mcp add`.
284
+ stableMcpSetupArgs: () => {
285
+ const { command, args } = selfMcpStdio(CHATPANEL_STABLE_MCP_URL);
286
+ return ['mcp', 'add', 'chatpanel_browser', '--command', command, '--args', ...args];
287
+ },
288
+ stableMcpSetupCommand: (() => {
289
+ const { command, args } = selfMcpStdio(CHATPANEL_STABLE_MCP_URL);
290
+ return `hermes mcp add chatpanel_browser --command ${command} --args ${args.join(' ')}`;
291
+ })(),
275
292
  label: 'Hermes',
276
293
  },
277
294
  'hermes not found on PATH. Install Hermes Agent, then run `hermes setup` to sign in.',
@@ -64,7 +64,7 @@ const IDLE_MS = Number(process.env.CHATPANEL_CUSTOM_TIMEOUT_MS) || 180_000;
64
64
  // ANSI stripping moved to stream-formats.js (imported above), which is where
65
65
  // text output is actually rendered - one implementation for every format.
66
66
  const OPENCODE_STABLE_MCP_URL = 'http://127.0.0.1:4319/mcp';
67
- const CHATPANEL_STABLE_MCP_URL = 'http://127.0.0.1:4319/mcp';
67
+ export const CHATPANEL_STABLE_MCP_URL = 'http://127.0.0.1:4319/mcp';
68
68
 
69
69
  export async function available() {
70
70
  // The engine ships in every bridge; individual custom agents are user-defined
@@ -167,7 +167,10 @@ export function stableMcpSetupCommand(spec = {}) {
167
167
  }
168
168
 
169
169
  export function stableMcpSetupPlan(spec = {}) {
170
- const args = Array.isArray(spec.stableMcpSetupArgs) ? spec.stableMcpSetupArgs.filter((a) => a != null).map(String) : null;
170
+ // A FUNCTION is allowed as well as an array: a stdio registration has to name the bridge's
171
+ // own executable, which is only known at runtime (compiled binary vs. node + entry script).
172
+ const raw = typeof spec.stableMcpSetupArgs === 'function' ? spec.stableMcpSetupArgs() : spec.stableMcpSetupArgs;
173
+ const args = Array.isArray(raw) ? raw.filter((a) => a != null).map(String) : null;
171
174
  if (!args?.length) return null;
172
175
  return { command: spec.stableMcpSetupCommandName || spec.command, args };
173
176
  }
package/src/server.js CHANGED
@@ -67,7 +67,7 @@ import {
67
67
  // Hardcoded (not read from package.json) so it survives Bun's single-file
68
68
  // --compile, where package.json isn't on a readable FS. CI fails the publish if
69
69
  // this drifts from package.json, so the two can't silently diverge.
70
- const VERSION = '0.10.35';
70
+ const VERSION = '0.10.37';
71
71
  const HOST = process.env.CHATPANEL_BRIDGE_HOST || '127.0.0.1';
72
72
  const PORT = Number(process.env.CHATPANEL_BRIDGE_PORT) || 4319;
73
73