import type { Report } from "@agentlinthq/core"; import type { PrContext } from "./pr-detect.js"; import type { RepoInfo } from "./repo-detect.js"; export type FetchFn = (url: string, init: { method: string; headers: Record; body: string; signal: AbortSignal; }) => Promise; export type GetEnvFn = (name: string) => string | undefined; export type OidcFetcherFn = (opts: { getEnv?: GetEnvFn; }) => Promise; export interface PushRunMetadata { /** Repo owner/name detected from `git config`; null if unavailable. */ repo: RepoInfo | null; /** Current branch — flag → CI env → git → null. */ branch: string | null; /** Current commit sha — flag → CI env → git → null. */ commitSha: string | null; /** Project id from `.agentlint.json` or `--project `; null if neither. */ projectId: string | null; /** Public flag — when true, server exposes the run for the badge. */ isPublic: boolean; /** PR context (auto-detected on GHA or via --pr / AGENTLINT_PR). */ prContext: PrContext | null; } export interface PushReportArgs { /** Endpoint base, e.g. "https://agentlint.sh". Trailing slash optional. */ url: string; token: string; report: Report; metadata: PushRunMetadata; fetchFn?: FetchFn; getEnv?: GetEnvFn; /** Override for testing — fetch the OIDC JWT. Defaults to real fetcher. */ oidcFetcher?: OidcFetcherFn; } /** * Optional org policy evaluation returned by the server when the project * belongs to a Team-plan org with a policy configured. Added in the * `policy-thresholds-team` slice; absent for any other run (additive, * minor-version-safe — see CHARTER §4). */ export interface PolicyEvaluation { minScore: number; enforce: boolean; passed: boolean; } export type PushResult = { ok: true; runUrl: string; policy: PolicyEvaluation | null; } | { ok: false; reason: string; }; /** * Defensive parser — coerces an unknown JSON value into a PolicyEvaluation, * or returns null if the shape doesn't match. Exported for testing. */ export declare function parsePolicy(raw: unknown): PolicyEvaluation | null; /** * Build the JSON payload posted to `/api/runs`. Exported for tests. */ export declare function buildPushBody(report: Report, metadata: PushRunMetadata): string; /** * Post the report to `/api/runs`. Refuses non-https URLs unless the * URL is `http://localhost` / `http://127.0.0.1` or AGENTLINT_INSECURE=1. * * On GitHub Actions with `id-token: write`, attaches the runner's OIDC JWT * in `x-github-oidc`. OIDC fetch failure is non-fatal — the push proceeds * and the server tags it `unverified`. */ export declare function pushReport(args: PushReportArgs): Promise; //# sourceMappingURL=client.d.ts.map