export type BearerSource = 'cli' | 'env' | 'credential-store' | 'secrets-env' | 'default' | 'ephemeral'; export interface ResolvedBearer { token: string; source: BearerSource; } export interface ResolveBearerOpts { /** Value of the CLI `--token` flag, if provided. */ cliToken?: string; /** Value of `ASTRA_MEMORY_TOKEN`, if set. */ envToken?: string; /** * Config dirs to probe for secrets.env, in priority order. Defaults to * [defaultConfigDir(), legacyConfigDir()]. Injectable so tests can isolate * the filesystem probe without env-var games — on darwin the real dirs * ignore XDG_CONFIG_HOME entirely, so env stubbing does NOT isolate there. */ secretsDirs?: string[]; /** * Config dir used to scope the OS credential-store identity (FEAT-466). * Defaults to defaultConfigDir(). Injectable for the same isolation * reason as secretsDirs — tests point this at a tmp dir so the stubbed * Entry's scoped key is deterministic and never collides with a real * install's identity. */ configDir?: string; } /** * Read MEMORY_BEARER from secrets.env — canonical config dir first, then the * legacy dir (%APPDATA%\AstraMemory on Windows). Read-only; never mutates * either file. Mirrors the pre-SEC-10 `readBearerFromSecrets` in serve.ts. */ export declare function readBearerFromSecretsFile(secretsDirs?: string[]): string | null; /** * Resolve the daemon's bearer token per the precedence documented above. * * Side effect: when the token is found only in secrets.env, it is * opportunistically written into the OS credential store (best-effort — * failure is silently tolerated since storeBearer already owns its own * WARN-on-fallback logging). This is a one-way promotion; secrets.env is * never rewritten or deleted here. */ export declare function resolveBearerToken(opts?: ResolveBearerOpts): ResolvedBearer;