/** * GitHub App identity for slowcook agents (ledger O2 → feature). * * Agents that post through an operator's `gh` token show the OPERATOR as * the author of every comment and PR — wrong attribution on any consumer * repo, not just rewo. A GitHub App gives agents their own visible * identity (`[bot]`) that scales per-consumer: each org * registers (or installs) a "slowcook-agent" App ONCE, and slowcook mints * short-lived installation tokens from the App credentials at run time. * * The rest of the toolchain is already installation-token-ready — the * adapter's `botUsername()` handles the App-token 403 on /user — so this * module is deliberately the ONLY new moving part: env → token. * * Configuration (operator env, e.g. /root/.slowcook-worker.env): * SLOWCOOK_GITHUB_APP_ID the App's numeric id * SLOWCOOK_GITHUB_APP_PRIVATE_KEY_PATH path to the App's PEM file * (or SLOWCOOK_GITHUB_APP_PRIVATE_KEY the PEM itself, if a file is * impractical — path wins when both are set) * * Installation tokens live ~60 minutes; mint per pass/job, never cache to * disk. When the App is not configured, `appAuthConfigured` returns false * and callers fall back to whatever token identity they already had. */ export interface AppAuthEnv { SLOWCOOK_GITHUB_APP_ID?: string; SLOWCOOK_GITHUB_APP_PRIVATE_KEY_PATH?: string; SLOWCOOK_GITHUB_APP_PRIVATE_KEY?: string; } export declare function appAuthConfigured(env?: AppAuthEnv): boolean; /** Exported for tests; callers use `mintInstallationToken`. */ export declare function privateKeyFrom(env: AppAuthEnv): string; /** * Mint an installation token for one repository. Fails with NAMED causes — * an App that is configured but not installed on the target repo is the * predictable first-run mistake, and the error must say exactly that. */ export declare function mintInstallationToken(owner: string, repo: string, env?: AppAuthEnv): Promise<{ token: string; appSlug: string; }>; //# sourceMappingURL=app-auth.d.ts.map