@chatpanel/bridge 0.10.37 → 0.10.38

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.37",
3
+ "version": "0.10.38",
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": [
@@ -351,6 +351,20 @@ async function runStableMcpSetup(plan, cwd) {
351
351
  });
352
352
  }
353
353
 
354
+ // Turn a browser-tool setup failure into something the user can act on. The CLI's own words
355
+ // are the most accurate signal available, so we forward them — but when they name a missing
356
+ // SDK we say the fix, rather than repeating an `mcp add` that will fail identically.
357
+ export function mcpSetupHint(label, err) {
358
+ const msg = String(err?.message || err || '');
359
+ if (/mcp['" ]* Python SDK|No module named ['"]?mcp|MCP support/i.test(msg)) {
360
+ return `${label} has no MCP support installed. Run \`hermes setup\` (or install the \`mcp\` package in its environment), then retry.`;
361
+ }
362
+ if (/streamable_http|HTTP transport/i.test(msg)) {
363
+ return `${label}'s MCP client has no HTTP transport; ChatPanel registers a stdio server instead. Upgrade its \`mcp\` package if this persists.`;
364
+ }
365
+ return msg.slice(0, 200) || 'the CLI could not register the tools';
366
+ }
367
+
354
368
  export async function ensureStableMcpConfig(spec, cwd, label, emit, deps = {}) {
355
369
  if (!spec.requiresStableMcp) return true;
356
370
  const hasConfig = deps.hasConfig || hasStableMcpConfig;
@@ -474,10 +488,25 @@ export async function runSpec(spec, { messages, system, options = {}, images },
474
488
  : [...tmpl.split(/\s+/).filter(Boolean), cfgFile];
475
489
  args = [...tokens, ...args];
476
490
  }
477
- if (options.mcp?.url) args.push(...mcpTrustArgs(spec, options.mcp));
478
491
  // Some CLIs only load MCP from their persistent config, so ensure that stable
479
492
  // /mcp endpoint is present before letting the agent answer with no tools.
480
- if (options.mcp?.url) await ensureStableMcpConfig(spec, cwd, label, emit);
493
+ //
494
+ // DEGRADE, DON'T FAIL. Browser tools are an ENHANCEMENT on top of a CLI that already has
495
+ // its own; a turn that could have been answered should not die because they couldn't be
496
+ // registered. (Hermes ships without the `mcp` Python SDK unless `hermes setup` installed
497
+ // it, so every tool-armed turn failed — and the error told the user to run a command that
498
+ // fails the same way.) We now say what happened, drop the browser tools, and answer.
499
+ if (options.mcp?.url) {
500
+ try {
501
+ await ensureStableMcpConfig(spec, cwd, label, emit);
502
+ } catch (e) {
503
+ emit({ type: 'status', text: `${label}: continuing without ChatPanel's browser tools — ${mcpSetupHint(label, e)}` });
504
+ options = { ...options, mcp: null };
505
+ }
506
+ }
507
+ // Trust flags only make sense once the server is actually registered — pushing them for
508
+ // tools we then dropped would widen the CLI's permissions for nothing.
509
+ if (options.mcp?.url) args.push(...mcpTrustArgs(spec, options.mcp));
481
510
 
482
511
  // Model via a CONFIG-PATCH FILE, for agents with no --model flag (dsh takes the
483
512
  // model as a Cordis config overlay: `--patch <file>` replacing one row by id).
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.37';
70
+ const VERSION = '0.10.38';
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