UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

55 lines • 3.58 kB
/** * Entries of a CLI-store account dir that point at the shared Claude root, so every account reads one * transcript tree (`projects`) and the user's own settings, memory, agents, commands, skills and output * styles. The credential store and everything else stay per account. */ export declare const CLAUDE_CLI_SHARED_LINKS: readonly ["projects", "settings.json", "CLAUDE.md", "agents", "commands", "skills", "output-styles"]; export declare function newAccountDirId(): string; export declare function isValidAccountDirId(dirId: string): boolean; /** `<agentDir>/anthropic-subscription-claude/<dirId>`; a stored id of any other shape is refused. */ export declare function accountDirFor(agentDir: string, dirId: string): string; /** * The access token the claude CLI keeps for an account dir, as it stands: read only, never refreshed (senpi#4436). * Undefined when the credential file is missing, unreadable, malformed or already expired; the CLI renews it on * its next turn. Only the file store is read, which the CLI uses on Linux and Windows; on macOS the CLI keeps the * token in the Keychain, so a macOS account offers none. Like `removeAccountDir`, it follows no link: a linked * account dir or credential file (say, to the user's own `~/.claude`) offers none, including one swapped in after * the check. */ export declare function readClaudeCliAccessToken(accountDir: string, now: number): Promise<string | undefined>; /** The root the accounts share: an inherited `CLAUDE_CONFIG_DIR`, else `~/.claude`. */ export declare function claudeCliSharedRoot(env: NodeJS.ProcessEnv): string; export type EnsureAccountDirOptions = { readonly agentDir: string; readonly dirId: string; readonly sharedRoot: string; }; /** * Creates the account dir (0700) and creates or repairs its links to the shared root. A link pointing * elsewhere is replaced; a real file or dir in a link's place is account data and is left alone. */ export declare function ensureAccountDir(options: EnsureAccountDirOptions): string; export type RemoveAccountDirOptions = { readonly agentDir: string; readonly dirId: string; /** The `claude` executable; undefined when it could not be resolved, and the sign-out is then skipped. */ readonly executable: string | undefined; readonly parentEnv?: NodeJS.ProcessEnv; /** Aborting stops the sign-out and throws before anything is deleted; the dir and slot are kept. */ readonly signal?: AbortSignal; }; /** * `removed`: signed out and the dir is gone. `removed_without_sign_out`: `claude auth logout` could not run or * failed, and the dir is gone anyway. `not_an_account_dir`: the path is a link or a file, left untouched. */ export type RemoveAccountDirOutcome = "removed" | "removed_without_sign_out" | "not_an_account_dir"; /** * Signs the account out (`claude auth logout` with `CLAUDE_CONFIG_DIR=<accountDir>`, which deletes that dir's * credential store entry), then unlinks the shared links WITHOUT following them and removes the dir. Removal never * depends on the CLI: with no executable, or a sign-out that fails, the dir is still removed and the outcome says * the sign-out did not run, so the caller can tell the user. A missing dir is * still signed out, because the CLI keys its store entry on the path. A link or file in the dir's place is not * an account dir: it is never signed out against, followed or deleted. */ export declare function removeAccountDir(options: RemoveAccountDirOptions): Promise<RemoveAccountDirOutcome>; //# sourceMappingURL=claude-cli-account-dir.d.ts.map