@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
53 lines • 3.22 kB
TypeScript
export type ExecutableDeps = {
platform: string;
arch: string;
env: (name: string) => string | undefined;
resolve: (spec: string) => string;
/** True when `path` names an existing regular file in THIS process - what the SDK's spawn will see. */
isFile: (path: string) => boolean;
/** Text of a win32 batch file found on PATH, so an npm `claude.cmd` shim resolves to its native binary. */
readText?: (path: string) => string | undefined;
isMusl?: () => boolean;
isCompiledBun?: () => boolean;
extractFromBunfs?: (embeddedPath: string) => string;
/** The Claude Code version the SDK bundles; `undefined` makes the resolver ask the bundled binary. */
bundledVersion?: () => string | undefined;
/** Reported version of a Claude Code binary. Without it the bundled binary is never compared against PATH. */
versionOf?: (executable: string) => string | undefined;
/**
* The directory of a compiled build's executable. A compiled build bundles the SDK, so the SDK cannot
* resolve its platform package; a distribution that ships one puts it in `node_modules` here (desktop#3145).
*/
executableDir?: () => string | undefined;
};
/** Where the spawned Claude Code came from; decides which remedy a version-floor error can offer. */
export type ClaudeCodeExecutableSource = "override" | "bundled" | "path";
export type ClaudeCodeRun = {
executable: string;
source: ClaudeCodeExecutableSource;
};
export type ExecutableResolution = {
/** The spawnable spelling, or `undefined` when every candidate was rejected. */
executable: string | undefined;
source: ClaudeCodeExecutableSource | undefined;
/** Every spelling checked, in order; the last entry is the winner when `executable` is set. */
tried: string[];
};
export declare function claudeCodeExecutableCandidates(platform: string, arch: string, preferMusl?: boolean): string[];
/**
* Walks every source of a Claude Code binary and records each spelling it checked. Nothing is
* accepted on resolution alone: `require.resolve` can name a file this process cannot stat (#1541),
* so a candidate counts only once `isFile` agrees. Order: `CLAUDE_CODE_EXECUTABLE`, the embedded
* binary of a compiled Bun build, the platform sidecar package(s), then `claude` on PATH. A bundled
* binary still yields to `claude` on PATH when that one reports a strictly newer version (#2033): a
* user who updated Claude Code must not keep getting the older copy the SDK happens to ship.
*/
export declare function describeClaudeCodeExecutable(deps: ExecutableDeps): ExecutableResolution;
/** The validated executable, or senpi's own error naming every candidate - the SDK never sees a miss. */
export declare function resolveClaudeCodeExecutable(deps: ExecutableDeps): string;
/** {@link resolveClaudeCodeExecutable} plus where the binary came from. */
export declare function resolveClaudeCodeRun(deps: ExecutableDeps): ClaudeCodeRun;
export declare function defaultExecutableDeps(): ExecutableDeps;
export declare function overrideExecutableDeps(override: Partial<ExecutableDeps>): void;
export declare function resetExecutableDeps(): void;
//# sourceMappingURL=executable.d.ts.map