@chatpanel/bridge 0.11.19 → 0.11.20
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 +1 -1
- package/src/server.js +6 -3
- package/src/update.js +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/bridge",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.20",
|
|
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 Antigravity CLI (formerly Gemini CLI, which remains available for business/enterprise) — to the ChatPanel Chrome extension over a localhost SSE endpoint. Bring your own agent.",
|
|
6
6
|
"keywords": [
|
package/src/server.js
CHANGED
|
@@ -53,7 +53,7 @@ import { listConnections, putConnection, removeConnection, runEnvFor, testConnec
|
|
|
53
53
|
import { worktreeFor, listWorktrees, removeWorktree, withHook, WORKTREE_ROOT } from './worktree.js';
|
|
54
54
|
import { AGENT_CLIS, enrichPath, enrichAgentEnv, findAgentBin, resolveCommand } from './env.js';
|
|
55
55
|
import { stripHidden } from './sanitize.js';
|
|
56
|
-
import { checkForUpdate, selfUpdate } from './update.js';
|
|
56
|
+
import { checkForUpdate, selfUpdate, isEmbedded } from './update.js';
|
|
57
57
|
import { callLocalMcp } from './mcp-local.js';
|
|
58
58
|
import { assertPublicHttpUrl, assertPublicWebUrl } from './ssrf.js';
|
|
59
59
|
import { startRun, endRun, cancelRun, cancelAll, activeRuns } from './runs.js';
|
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
// Hardcoded (not read from package.json) so it survives Bun's single-file
|
|
79
79
|
// --compile, where package.json isn't on a readable FS. CI fails the publish if
|
|
80
80
|
// this drifts from package.json, so the two can't silently diverge.
|
|
81
|
-
const VERSION = '0.11.
|
|
81
|
+
const VERSION = '0.11.20';
|
|
82
82
|
const HOST = process.env.CHATPANEL_BRIDGE_HOST || '127.0.0.1';
|
|
83
83
|
const PORT = Number(process.env.CHATPANEL_BRIDGE_PORT) || 4319;
|
|
84
84
|
|
|
@@ -450,7 +450,10 @@ async function handleHealth(res) {
|
|
|
450
450
|
return { id, label, available: a.ok, reason: a.reason, connectors };
|
|
451
451
|
}),
|
|
452
452
|
);
|
|
453
|
-
|
|
453
|
+
// A bridge embedded in the gateway is whatever version the gateway shipped: the gateway's
|
|
454
|
+
// update is its update, so the check is not made and no client offers to update it here.
|
|
455
|
+
const update = isEmbedded() ? { current: VERSION, updateAvailable: false, embedded: 'gateway' }
|
|
456
|
+
: await checkForUpdate(VERSION).catch(() => ({ current: VERSION, updateAvailable: false }));
|
|
454
457
|
// ADDITIVE, and the client's only way to know this bridge can host skill packages —
|
|
455
458
|
// an older bridge simply omits it, which is what stops a newer extension assuming the
|
|
456
459
|
// endpoints exist. Never let a scan failure cost the caller its health check.
|
package/src/update.js
CHANGED
|
@@ -19,6 +19,9 @@ import path from 'node:path';
|
|
|
19
19
|
import { chmod, rename, mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
20
20
|
import { isCompiledBinary } from './env.js';
|
|
21
21
|
|
|
22
|
+
/** Started by the gateway from its own binary — never self-updates, never registers a service. */
|
|
23
|
+
export function isEmbedded() { return process.env.CHATPANEL_BRIDGE_EMBEDDED === '1'; }
|
|
24
|
+
|
|
22
25
|
const REPO = 'chatpanel/chatpanel-bridge';
|
|
23
26
|
const LATEST_API = `https://api.github.com/repos/${REPO}/releases/latest`;
|
|
24
27
|
const CHECK_EVERY_MS = 6 * 60 * 60 * 1000; // 6h
|
|
@@ -165,6 +168,12 @@ export async function checkForUpdate(current, { force = false } = {}) {
|
|
|
165
168
|
// its HTTP response first, then triggers restartService(). Throws on any failure,
|
|
166
169
|
// leaving the running binary untouched.
|
|
167
170
|
export async function selfUpdate(current) {
|
|
171
|
+
// A bridge the gateway runs from inside its own binary (CHATPANEL_BRIDGE_EMBEDDED=1) has
|
|
172
|
+
// `process.execPath` = the GATEWAY binary. Swapping "itself" would overwrite the gateway
|
|
173
|
+
// with a bridge — the one update this code must never perform.
|
|
174
|
+
if (isEmbedded()) {
|
|
175
|
+
throw new Error('This bridge runs inside the ChatPanel Gateway. Update the gateway instead (it carries the bridge).');
|
|
176
|
+
}
|
|
168
177
|
if (!isCompiledBinary()) {
|
|
169
178
|
throw new Error('Self-update applies only to the standalone binary. Update the npm/npx version with npm.');
|
|
170
179
|
}
|