@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
27 lines • 1.37 kB
TypeScript
import type { Credential } from "@earendil-works/pi-ai";
type AuthStorageData = Record<string, Credential>;
/**
* One-shot auth.json provider-key migration for the provider rename (#1989):
* a credential stored under a legacy provider id (`openai-codex`,
* `claude-sdk-oauth`) is rewritten under its canonical id
* (`chatgpt-subscription`, `anthropic-subscription`).
*
* Completion is derived from the data, not a migrations-state marker: once the
* legacy key is absent the function is a no-op, so a busy credential store can
* skip a load and retry later, and an older binary re-introducing a legacy key
* after the fact still gets migrated. The credential object moves VERBATIM —
* pools (`accounts`, `login-N` names, `pinned`, `slotState`) and the
* managed-sentinel values inside the flat fields are preserved under the new
* key, byte for byte.
*
* Conflict rule: when both keys hold an entry, the canonical entry wins and
* the legacy entry is removed from the live file only — the timestamped backup
* taken before the rewrite still holds it. Entries are never merged: one
* single-use OAuth grant must not end up with two refresh owners.
*/
export declare function migrateLegacyProviderKeys(data: AuthStorageData): {
data: AuthStorageData;
migrated: boolean;
};
export {};
//# sourceMappingURL=auth-provider-key-migration.d.ts.map