INNER CODE UNIT · TypeScript

authHeaders

AmrDab/clawdcursor · src/surface/cli.ts:86

function authHeaders(): Record<string, string> {
  const token = loadAuthToken();
  return token ? { 'Authorization': `Bearer ${token}` } : {};
}

// ── Emoji gate (shared utility) ──────────────────────────────────────────────
import { e } from './format';

// ── Single-instance pidfile lock ─────────────────────────────────────────────
// Implementation lives in ./pidfile so it can be unit-tested independently.
// The richer JSON lockfile records process start time, which lets the
// liveness check distinguish a real live duplicate from a recycled PID
// (the bug behind "Failed to reconnect to clawdcursor: -32000" on Windows).
import { claimPidFile, releasePidFile, isProcessAlive, pidFilePath, readPidLoose } from './pidfile';

/**
 * Graceful exit on a startup-time init failure (bad API key, no providers,
 * etc.). Synchronous `process.exit(N)` while async handles are mid-close

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…