@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
36 lines • 2.56 kB
TypeScript
/**
* Resolve configuration values that may be shell commands, environment variables, or literals.
* Used by auth-storage.ts and model-registry.ts.
*/
import type { ConfigValue } from "@earendil-works/pi-ai/utils/config-reference";
import { type ConfigReferenceContext } from "./config-reference-resolver.ts";
export declare function getConfigValueEnvVarName(config: ConfigValue): string | undefined;
export declare function getConfigValueEnvVarNames(config: ConfigValue): string[];
export declare function getMissingConfigValueEnvVarNames(config: ConfigValue, env?: Record<string, string>): string[];
export declare function isCommandConfigValue(config: ConfigValue): boolean;
export declare function isConfigValueConfigured(config: ConfigValue, env?: Record<string, string>): boolean;
/**
* Resolve a config value (API key, header value, etc.) to an actual value.
* - If starts with "!", executes the rest as a shell command and uses stdout (cached)
* - Interpolates "$ENV_VAR" or "${ENV_VAR}" references with the named environment variable
* - In non-command values, "$$" escapes a literal "$" and "$!" escapes a literal "!"
* - Otherwise treats the value as a literal
*/
export declare function resolveConfigValue(config: ConfigValue, env?: Record<string, string>, context?: ConfigReferenceContext, observation?: ConfigValueObservation): Promise<string | undefined>;
/** Receives each value a credential field resolves to, with the provider, the field and the cwd it resolved in. */
export type ConfigValueObserver = (field: string, providerId: string, value: string, cwd: string) => void;
export interface ConfigValueObservation {
readonly observer: ConfigValueObserver;
readonly providerId: string;
readonly field: string;
readonly cwd: string;
}
/**
* Resolve all header values using the same resolution logic as API keys.
*/
export declare function resolveConfigValueUncached(config: ConfigValue, env?: Record<string, string>, context?: ConfigReferenceContext): Promise<string | undefined>;
export declare function resolveConfigValueOrThrow(config: ConfigValue, description: string, env?: Record<string, string>, context?: ConfigReferenceContext): Promise<string>;
export declare function resolveHeadersOrThrow(headers: Record<string, ConfigValue> | undefined, description: string, env?: Record<string, string>): Promise<Record<string, string> | undefined>;
/** Clear the config value command cache. Exported for testing. */
export declare function clearConfigValueCache(): void;
//# sourceMappingURL=resolve-config-value.d.ts.map