Skip to content
1 min read · 202 words

Function: __resolveWrapperPathWithFallback() ​

ts
function __resolveWrapperPathWithFallback(
  seams?: WrapperPathResolutionSeams,
): Promise<string>;

Defined in: src/batteries/llm/claude_code_cli/adapter.ts:328

Internal, non-public resolver used by the executor call site (never resolveDefaultWrapperPath itself, which stays synchronous and unchanged for backwards compatibility with any caller that already imports it directly). Tries the existing relative-to-module resolution FIRST — zero behavior change for the common unbundled case — and only falls back to the self-reference lookup when that candidate does not exist on disk (bundling relocated the adapter). Throws E_CLAUDE_CODE_CLI_WRAPPER_NOT_FOUND naming every path tried — the relative candidate (or its resolution error) AND every self-reference candidate/reason from resolveWrapperPathViaSelfReference — when neither resolves, rather than letting a bundled consumer hit an opaque MODULE_NOT_FOUND/ENOENT deep inside execa, or a truncated error that hides what the self-reference fallback actually attempted.

Parameters ​

ParameterType
seamsWrapperPathResolutionSeams

Returns ​

Promise<string>

Remarks ​

Electron/asar note: an app packaged into an asar archive can still readFileSync/existsSync transparently-unpacked paths through Electron's patched fs, so this existence-check strategy keeps working there without special-casing — but a wrapper asset that ships unpacked (outside asar) is still the consumer's responsibility to arrange, same as any other spawned-executable asset; wrapperPath remains the escape hatch when that layout doesn't line up.