@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
38 lines • 1.94 kB
TypeScript
import { type ClaudeCliRun } from "./claude-cli-process.ts";
/** The method select's two answers: the one-click browser flow, or a URL plus a pasted code. */
export type ClaudeCliLoginMethod = "browser" | "copy-code";
export type ClaudeCliLoginFailure = "org_not_allowed" | "provider_not_allowed" | "oauth_failed" | "unexpected_exit" | "spawn_failed";
export type ClaudeCliLoginResult = {
readonly outcome: "success";
} | {
readonly outcome: "failed";
readonly reason: ClaudeCliLoginFailure;
} | {
readonly outcome: "cancelled";
} | {
readonly outcome: "timeout";
};
export type ClaudeCliLoginOptions = ClaudeCliRun & {
readonly method: ClaudeCliLoginMethod;
readonly signal?: AbortSignal;
/** Resets on every pasted code; matches the desktop's login completion budget. */
readonly idleTimeoutMs?: number;
readonly killGraceMs?: number;
/** The localhost-redirect URL the CLI hands `$BROWSER` (browser method only). */
readonly onAutomaticUrl?: (url: string) => void;
/** The copy-code URL the CLI prints for the paste fallback. */
readonly onManualUrl?: (url: string) => void;
};
export type ClaudeCliLogin = {
/** Writes a pasted code to the CLI's stdin (never argv). False when the text holds no code or the CLI is gone. */
readonly submitCode: (input: string) => boolean;
readonly result: Promise<ClaudeCliLoginResult>;
};
/** Accepts `code#state`, a bare code, a query string, or the full callback URL; returns the line the CLI reads. */
export declare function normalizePastedCode(input: string): string | undefined;
/**
* Runs `<claude> auth login --claudeai` for one account dir. `--console` and `--sso` are never passed, so an
* API-billing login cannot happen here. Output, URLs and pasted codes are never logged.
*/
export declare function startClaudeCliLogin(options: ClaudeCliLoginOptions): ClaudeCliLogin;
//# sourceMappingURL=claude-cli-auth.d.ts.map