import * as Config from "effect/Config"; import * as Context from "effect/Context"; import * as SecureRandom from "effect/crypto/SecureRandom"; import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; import * as Layer from "effect/Layer"; import * as Path from "effect/Path"; import type { PlatformError } from "effect/PlatformError"; import * as Schema from "effect/Schema"; import { UserFacingError } from "../UserFacingError.ts"; import { AuthError, type AuthProvider } from "./AuthProvider.ts"; export { configFilePath, credentialsDirPath, profileCredentialsDirPath, profileDirPath, profileProviderFilePath, profilesDirPath, rootDir, } from "./Paths.ts"; /** Config key selecting a directory under `~/.alchemy/profiles`. */ export declare const ALCHEMY_PROFILE: Config.Config; /** Version of the synthesized in-memory manifest returned by readManifest. */ export declare const PROFILE_MANIFEST_VERSION = 3; /** Stable format identifier for an individual provider profile document. */ export declare const PROFILE_FORMAT: "alchemy.profile/v1"; export declare const DEFAULT_PROFILE_NAME = "default"; export declare const DEFAULT_PROFILE_ID = "default"; /** * The minimum contract shared by provider-owned values. Providers refine this * with their own Effect Schema codec. The method is deliberately an open * string: adding an auth method never changes Alchemy's storage schema. */ export declare const ProviderConfigSchema: Schema.$Record; export interface ProviderConfig { readonly method?: string; readonly [key: string]: unknown; } /** User-facing, non-secret annotations. Provider schemas may refine it. */ export declare const ProfileMetadataSchema: Schema.$Record; export type ProfileMetadata = typeof ProfileMetadataSchema.Type; /** * Base on-disk schema. Only this envelope is owned by Alchemy core; the * selected AuthProvider decodes `metadata` and `values` with its own schemas. */ export declare const ProviderProfileFileSchema: Schema.StructWithRest; readonly provider: Schema.String; readonly metadata: Schema.$Record; readonly values: Schema.$Record; }>, readonly [Schema.$Record]>; export type ProviderProfileFile = typeof ProviderProfileFileSchema.Type; /** Compose the base envelope with a custom provider's typed schemas. */ export declare const makeProviderProfileSchema: (provider: string, metadata: Schema.Codec, values: Schema.Codec) => Schema.Struct<{ readonly format: Schema.Literal<"alchemy.profile/v1">; readonly provider: Schema.Literal; readonly metadata: Schema.Codec; readonly values: Schema.Codec; }>; /** * Aggregate view used by the profile UI. It is synthesized from provider * files and is never persisted as a central manifest. */ export interface Profile { readonly id: string; readonly providers: Record; } export interface ProfileManifest { readonly version: typeof PROFILE_MANIFEST_VERSION; readonly profiles: Record; } export interface ProfileSelection { readonly name: string; readonly source: "configuration" | "default"; } declare const ProfileError_base: Schema.Class; }>, import("effect/Cause").YieldableError>; export declare class ProfileError extends ProfileError_base { readonly [UserFacingError] = true; } declare const MissingProviderConfig_base: Schema.Class, import("effect/Cause").YieldableError>; export declare class MissingProviderConfig extends MissingProviderConfig_base { } export declare const SuppressMissingProviderConfig: Context.Reference; export declare const createProfileHint: (name?: string) => Effect.Effect; export declare const cannotDeleteDefaultProfile: () => ProfileError; export declare const cannotRenameDefaultProfile: () => ProfileError; export declare const validateProfileName: (name: string) => Effect.Effect; export interface ProfileStoreService { readonly readManifest: Effect.Effect; readonly getProfile: (name: string) => Effect.Effect; readonly ensureProfile: (name: string) => Effect.Effect; readonly createProfile: (name: string) => Effect.Effect; readonly renameProfile: (name: string, newName: string) => Effect.Effect; readonly current: Effect.Effect; readonly setProviderConfig: (profile: string, provider: string, values: ProviderConfig) => Effect.Effect; readonly deleteProviderConfig: (profile: string, provider: string) => Effect.Effect; readonly deleteProfile: (name: string) => Effect.Effect; readonly loadProviderConfig: (auth: AuthProvider, profileName: string) => Effect.Effect; } declare const ProfileStore_base: Context.ServiceClass; export declare class ProfileStore extends ProfileStore_base { } export declare const ProfileStoreLive: Layer.Layer; /** * Re-read a provider's stored configuration, failing only with * {@link AuthError}. Silent refreshes rotate single-use refresh tokens, so * {@link AuthProvider.read}/{@link AuthProvider.details} take this effect and * run it under the profile's credentials lock instead of a config read before * it. */ export declare const reloadProviderConfig: (store: ProfileStoreService, auth: AuthProvider, profileName: string) => Effect.Effect; /** The name of the currently selected profile. */ export declare const currentProfileName: Effect.Effect; //# sourceMappingURL=Profile.d.ts.map