@1presence/bridge 0.74.0 → 0.75.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/dist/claude.js CHANGED
@@ -258,15 +258,20 @@ export function spawnClaude(params) {
258
258
  extractedModel = model;
259
259
  if (ccv)
260
260
  cliVersion = ccv;
261
+ const pinnedAtStartup = getBridgeModel();
262
+ const pinHonoured = !!pinnedAtStartup && !!model && model === pinnedAtStartup;
261
263
  if (!modelAnnounced) {
262
264
  const source = keySource === 'none' || !keySource ? 'claude.ai subscription' : keySource;
263
- const pin = getBridgeModel() ? ' (selected at startup)' : '';
265
+ const pin = pinHonoured ? ' (selected at startup)' : '';
264
266
  process.stdout.write(`\n model: ${model ?? 'unknown'}${pin}\n auth: ${source}\n\n`);
265
267
  modelAnnounced = true;
266
268
  }
267
269
  else {
268
270
  process.stderr.write(`[bridge] model: ${model ?? 'unknown'} apiKeySource: ${keySource ?? 'none'}\n`);
269
271
  }
272
+ if (pinnedAtStartup && model && model !== pinnedAtStartup) {
273
+ process.stderr.write(`[bridge] WARNING: ${pinnedAtStartup} was selected at startup, but this turn ran on ${model}.\n`);
274
+ }
270
275
  sessionIdExtracted = true;
271
276
  }
272
277
  if (type === 'assistant') {
package/dist/index.js CHANGED
@@ -383,7 +383,8 @@ async function handleMessage(conversationId, text, sessionId, history, auth, vau
383
383
  const costSeg = sessionCostUsd > 0 ? `$${sessionCostUsd.toFixed(2)} session` : 'plan usage';
384
384
  const ver = getCliVersion();
385
385
  const verSeg = ver ? ` v${ver}` : '';
386
- console.log(paint('90', ` 🤖 ${friendlyModelName(model)}${verSeg} | 🧠 ${ctxPct}% | 💰 ${costSeg}`));
386
+ const whoSeg = currentAuth?.email ? ` | 👤 ${currentAuth.email}` : '';
387
+ console.log(paint('90', ` 🤖 ${friendlyModelName(model)}${verSeg} | 🧠 ${ctxPct}% | 💰 ${costSeg}${whoSeg}`));
387
388
  const windows = [
388
389
  formatWindow('5h', getRateLimitWindow('five_hour')),
389
390
  formatWindow('7d', sevenDayWindow()),
@@ -450,7 +451,11 @@ const PING_INTERVAL_MS = 30_000;
450
451
  const PONG_TIMEOUT_MS = 10_000;
451
452
  function connect(auth, retryDelay = 1000) {
452
453
  const ws = new WebSocket(GATEWAY_WS, {
453
- headers: { Authorization: `Bearer ${auth.token}` },
454
+ headers: {
455
+ Authorization: `Bearer ${auth.token}`,
456
+ 'X-Bridge-Capabilities': 'displace-4004',
457
+ 'X-Bridge-Version': version,
458
+ },
454
459
  });
455
460
  let pingTimer = null;
456
461
  let pongTimer = null;
@@ -546,6 +551,16 @@ function connect(auth, retryDelay = 1000) {
546
551
  console.error('Local Claude Code is not enabled for your account. To request access, email hello@1presence.com.');
547
552
  process.exit(1);
548
553
  }
554
+ if (code === 4004) {
555
+ if (ws !== currentWs) {
556
+ console.log('[bridge] ignoring a "replaced" close for a socket we already reconnected past.');
557
+ return;
558
+ }
559
+ console.log('\nAnother 1Presence bridge connected for this account — this one has exited.');
560
+ console.log('Local Mode runs one bridge per account: the newest connection serves your turns.');
561
+ killAll();
562
+ process.exit(0);
563
+ }
549
564
  scheduleReconnect(code, retryDelay);
550
565
  });
551
566
  ws.on('error', (err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1presence/bridge",
3
- "version": "0.74.0",
3
+ "version": "0.75.0",
4
4
  "description": "Run 1Presence on your Mac and use your Claude.ai Pro subscription from any device",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",