This package is the contract-testable shell. It does not import the Claude Agent SDK, a fresh
ClaudeCodeDriver is minted per run via the injected driverFactory, and the real SDK-backed driver (createClaudeCodeDriver) lives in apps/web/server/lib/runtimes/. Mirrors the OpenClaw reference adapter pattern, generalized to a one-shot spawned/SDK runtime.
Public API
All exports come fromsrc/index.ts. The package declares a single . export in package.json (no subpath barrels).
Classes
ClaudeCodeAdapter members:
capabilities(): Capabilities, returns{ streaming: true, mcp: true, worktrees: true, resume: true, toolApproval: true, models: ['sonnet','opus','haiku'], contextWindowTokens: 200000, runtimeClass: 'wrapped-oneshot', nativeSkills: 'none', nativeMemory: 'none', nativeChannels: 'none', nativeScheduler: false }.nativeHomeis omitted, the SDK runs against the user’s real HOME/Keychain auth, so nothing native accrues per identity.sessionCodec: SessionCodec, serializes{ sessionKey, sessionId }(the native session id captured during the run, falling back torunId);restorerebuilds aRunHandlefrom the blob. Rotation does not replay the transcript, the codec only carries the session id for lineage + optional resume.health(): Promise<HealthResult>, races the injectedhealthCheckagainst a 2 s timeout; any throw →{ ok: false, message }.start(_task: TaskHandle, opts: StartOpts): Promise<RunHandle>, mints a driver viadriverFactory(opts), stores it byopts.sessionKey, callsdriver.start(), returns{ adapterId: 'claude-code', sessionKey, runId: null }. TherunIdlate-binds inevents()from the first native frame carrying a session id.events(run: RunHandle): AsyncIterable<RuntimeEvent>, subscribes to the run’s driver stream, late-bindsrunId, accumulates non-reasoningtext-deltatext, and yields the mapped normalized stream via a boundedcreateAsyncQueue(max: 1000). Consumer termination (return()) unsubscribes the driver. Returns an empty (closed) queue if no driver is registered for the run.abort(run: RunHandle): Promise<void>, delegates to the run’s driverabort().setModel(run: RunHandle, model: string): Promise<void>, delegates to the run’s driversetModel().writeContext(run: RunHandle, key: string, value: string): Promise<void>, delegates to the run’s driverwriteContext().
Functions
Types & interfaces
The
Capabilities, HealthResult, RunHandle, RuntimeAdapter, RuntimeEvent, SessionCodec, StartOpts, TaskHandle, and Usage types referenced above are owned by @clawboo/executor, not re-exported here.Used by
apps/web/server/lib/runtimes/index.ts, instantiatesClaudeCodeAdapter, injectingcreateClaudeCodeDriver(the real SDK-backed driver) and a CLI health probe.apps/web/server/lib/runtimes/claudeCodeDriver.ts, imports theClaudeCodeDriver+ClaudeNativeEventtypes to implement the server-side driver against the Claude Agent SDK.
Source
packages/adapters/claude-code/src/index.ts (barrel; re-exports ./adapter, ./types, ./mapClaudeEvent).
See also
- @clawboo/executor, the
RuntimeAdaptertrait +RuntimeEventunion this adapter implements. - RuntimeAdapter trait, the cross-runtime contract.
- Claude Code runtime, using the runtime end-to-end.
- Sibling adapters: @clawboo/adapter-codex, @clawboo/adapter-hermes, @clawboo/adapter-native, @clawboo/adapter-openclaw.