UNPKG

framework

Version:

The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.

66 lines 3.01 kB
import { ClaudeCodeDriver, CodexDriver } from './driver/index.js'; import { DRIVER_LABELS } from './driver-names.js'; /** * Which agent drives an agent (#542). Each is a whole coding-agent CLI the user * already pays for, driven on their own subscription with no API key (#495). * * The names live in the node-free `agent-names.ts` so the dashboard and the registry read * the same list without touching the driver layer; this module adds what only the node side * needs (binaries, drivers). Historical import sites keep working via these re-exports. */ export { DRIVERS, isDriverName, driverFromImpl, DRIVER_LABELS } from './driver-names.js'; /** The agents we can drive, and what each can tell us about itself. */ export const DRIVER_SPECS = { claude: { label: DRIVER_LABELS.claude, bin: 'claude', installHint: 'install Claude Code and make sure `claude` is on your PATH: https://claude.com/claude-code', auth: { args: ['auth', 'status'], // Prints JSON (`{"loggedIn": true, "authMethod": ...}`) and exits 0 either way, so the // flag is the answer and the exit code is not. A version too old to know the subcommand // prints usage instead, which parses as nothing and correctly reads as "could not say". loggedIn: ({ output }) => { try { const parsed = JSON.parse(output); const value = parsed?.loggedIn; return typeof value === 'boolean' ? value : undefined; } catch { return undefined; } }, fix: 'claude auth login', }, }, codex: { label: DRIVER_LABELS.codex, bin: 'codex', installHint: 'install the Codex CLI and make sure `codex` is on your PATH: https://developers.openai.com/codex/cli', auth: { args: ['login', 'status'], // Answers in a sentence rather than JSON: "Logged in using ChatGPT", or a "Not logged in". // The negative is tested first, since it contains the positive as a substring. loggedIn: ({ output }) => (/not logged in/i.test(output) ? false : /logged in/i.test(output) ? true : undefined), fix: 'codex login', }, }, }; /** * Build the {@link Driver} for the picked driver name — the one place a session turns * the choice into a live implementation. * * Codex takes none of the Claude options: its sandbox is its own flag rather * than a permission mode, and it has no MCP config for `--browser`. Those are * dropped here and reported at the call site, so a flag that cannot apply says * so rather than looking honored. */ export function createDriver(opts) { switch (opts.driver) { case 'codex': return new CodexDriver(); case 'claude': return new ClaudeCodeDriver(opts.claudeOpts ?? {}); } } //# sourceMappingURL=driver-cli.js.map