Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/core/src/clients/claude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ import {
type HookCallback,
type HookCallbackMatcher,
} from '@anthropic-ai/claude-agent-sdk';
// The `/embed` entry point uses `import ... with { type: 'file' }` to embed
// the SDK's `cli.js` into the compiled binary's $bunfs virtual filesystem,
// then extracts it to a temp path at runtime so the subprocess can exec it.
// Without this, the SDK falls back to resolving `cli.js` from
// `import.meta.url` of its own module — which bun freezes at build time to
// the build host's absolute node_modules path, producing a "Module not found
// /Users/runner/..." error on any machine other than the CI runner.
// Safe in dev too: resolves to the real on-disk cli.js.
import cliPath from '@anthropic-ai/claude-agent-sdk/embed';
import {
type AssistantRequestOptions,
type IAssistantClient,
Expand Down Expand Up @@ -315,6 +324,7 @@ export class ClaudeClient implements IAssistantClient {

const options: Options = {
cwd,
pathToClaudeCodeExecutable: cliPath,
env: requestOptions?.env
? { ...buildSubprocessEnv(), ...requestOptions.env }
: buildSubprocessEnv(),
Expand Down
Loading