import { HARNESS_VALUES } from "../core/config.js";
/** Project-owned extension point for remote-environment requirements. */
export const REMOTE_ENVIRONMENT_MANIFEST = ".lisa/remote-environment.json";
/** Supported concrete agents in canonical order. */
export const REMOTE_AGENTS = HARNESS_VALUES.filter((harness) => harness !== "fleet");
const GENERIC_STARTUP_ARTIFACT = "scripts/remote-agent-setup.sh";
/** Default project artifacts recognized for each remote agent. */
export const DEFAULT_STARTUP_ARTIFACTS = {
    claude: ["scripts/claude-remote-setup.sh", GENERIC_STARTUP_ARTIFACT],
    codex: ["scripts/codex-remote-setup.sh", GENERIC_STARTUP_ARTIFACT],
    cursor: [
        ".cursor/environment.json",
        "scripts/cursor-remote-setup.sh",
        GENERIC_STARTUP_ARTIFACT,
    ],
    agy: ["scripts/agy-remote-setup.sh", GENERIC_STARTUP_ARTIFACT],
    copilot: [
        ".github/workflows/copilot-setup-steps.yml",
        "scripts/copilot-remote-setup.sh",
        GENERIC_STARTUP_ARTIFACT,
    ],
    opencode: ["scripts/opencode-remote-setup.sh", GENERIC_STARTUP_ARTIFACT],
};
/**
 * Validate project-owned manifest variable declarations.
 * @param manifest - Parsed manifest
 * @returns Required variable declarations only
 */
export function manifestRequirements(manifest) {
    return (manifest?.variables ?? []).flatMap(entry => {
        if (entry.required === false ||
            typeof entry.name !== "string" ||
            !/^[A-Z][A-Z0-9_]*$/u.test(entry.name)) {
            return [];
        }
        return [
            {
                name: entry.name,
                reason: typeof entry.reason === "string"
                    ? entry.reason
                    : "Required by the project remote-environment manifest",
                source: typeof entry.source === "string"
                    ? entry.source
                    : REMOTE_ENVIRONMENT_MANIFEST,
                secret: entry.secret !== false,
            },
        ];
    });
}
/**
 * Deduplicate requirements by variable name while preserving first-source order.
 * @param requirements - Requirements from config, detection, and manifest
 * @returns Deduplicated requirements
 */
export function uniqueRequirements(requirements) {
    return requirements.filter((requirement, index) => requirements.findIndex(candidate => candidate.name === requirement.name) === index);
}
//# sourceMappingURL=remote-environment-contract.js.map