/** * PlatformIO Target Resolution * * Provides: * - resolveTarget: Resolves one environment, board, and physical device. * - verifyTargetBinding: Rejects expired or substituted target bindings. */ import type { SerialDevice } from "../types.js"; /** Resolved environment metadata from platformio.ini. */ export interface TargetEnvironment { name: string; board?: string; framework?: string; } /** Short-lived proof binding a workflow to one physical target. */ export interface TargetBinding { digest: string; projectDir: string; environment: string; board: string; port: string; deviceFingerprint: string; createdAt: string; expiresAt: string; } /** Target resolution result that reports ambiguity instead of guessing. */ export interface TargetResolutionResult { success: boolean; status: "resolved" | "ambiguous" | "unavailable" | "invalid_config"; confidence: "exact" | "high" | "medium" | "none"; projectDir: string; environment?: string; board?: string; port?: string; device?: SerialDevice; binding?: TargetBinding; candidates: Array<{ environment?: string; board?: string; port?: string; description?: string; deviceFingerprint?: string; }>; summary: string; nextSteps: string[]; } /** Exact target fields safe to pass to a hardware-changing operation. */ export interface VerifiedWriteTarget { environment: string; port: string; binding: TargetBinding; portChanged: boolean; } /** * Parses the environment fields required for safe target selection. * * @param iniText - platformio.ini source text. * @returns Declared environments and configured defaults. */ export declare function parseTargetEnvironments(iniText: string): { environments: TargetEnvironment[]; defaults: string[]; }; /** * Produces a stable, port-independent physical-device fingerprint. * * @param device - PlatformIO serial device metadata. * @returns SHA-256 digest over stable hardware identity fields. */ export declare function fingerprintDevice(device: SerialDevice): string; /** * Resolves exactly one PlatformIO target without choosing between peers. * * @param input - Project, optional selectors, and binding lifetime. * @param discoveredDevices - Optional injected device list for deterministic callers. * @returns Resolution, ambiguity details, and a short-lived binding. */ export declare function resolveTarget(input: { projectDir: string; environment?: string; port?: string; bindingTtlSeconds?: number; }, discoveredDevices?: SerialDevice[]): Promise; /** * Verifies a binding against current project and device identity. * * @param binding - Previously resolved target binding. * @param input - Current operation scope and optional discovered devices. * @returns The current port, including a safe re-enumerated port when found. */ export declare function verifyTargetBinding(binding: TargetBinding, input: { projectDir: string; environment: string; devices?: SerialDevice[]; }): Promise<{ valid: true; port: string; portChanged: boolean; }>; /** * Resolves or revalidates a single physical target immediately before a write. * A write never falls back to PlatformIO's implicit device or environment * selection, so ambiguous, missing, expired, or substituted targets fail * before a hardware lock is acquired. * * @param input - Write scope and optional prior binding. * @returns Verified environment, current port, and binding. */ export declare function resolveWriteTarget(input: { projectDir: string; environment?: string; port?: string; targetBinding?: TargetBinding; }): Promise; //# sourceMappingURL=target-resolution.d.ts.map