import type { MeticulousClient } from "../types/client.types"; import type { ContainerEnvVariable, ProjectIdentifier } from "./project-deployments.api"; export interface RequestAgenticInstructionsUploadParams extends ProjectIdentifier { size: number; } export interface RequestAgenticInstructionsUploadResponse { uploadUrl: string; /** Server-minted id that ties the uploaded instructions to a later trigger. */ instructionsId: string; } export interface AgenticContainerAppTarget { type: "container"; uploadId: string; containerPort?: number | undefined; containerEnv?: ContainerEnvVariable[] | undefined; containerHealthCheckEndpoint?: string | undefined; } export interface AgenticAssetsBackend { url: string; username?: string | undefined; password?: string | undefined; proxyPaths?: string[] | undefined; } export interface AgenticAssetsAppTarget { type: "assets"; assetsUploadId: string; backend?: AgenticAssetsBackend | undefined; } export type AgenticAppTarget = AgenticContainerAppTarget | AgenticAssetsAppTarget; export interface CompleteAgenticSessionGenerationParams extends ProjectIdentifier { commitSha: string; /** Server-minted id of instructions uploaded for this trigger, if any. */ instructionsId?: string; appTarget?: AgenticAppTarget | undefined; /** @deprecated Use appTarget.type = "container". */ uploadId?: string | undefined; /** @deprecated Use appTarget.type = "container". */ containerPort?: number | undefined; /** @deprecated Use appTarget.type = "container". */ containerEnv?: ContainerEnvVariable[] | undefined; /** @deprecated Use appTarget.type = "container". */ containerHealthCheckEndpoint?: string | undefined; } export interface CompleteAgenticSessionGenerationResponse { /** The id of the launched agentic session generation workflow run. */ workflowRunId?: string; message?: string; } export declare const requestAgenticInstructionsUpload: ({ client, projectId, ...body }: RequestAgenticInstructionsUploadParams & { client: MeticulousClient; }) => Promise; export declare const completeAgenticSessionGeneration: ({ client, projectId, ...body }: CompleteAgenticSessionGenerationParams & { client: MeticulousClient; }) => Promise; export type AgenticRunResultCaseOutcome = "pass" | "fail" | "blocked"; /** * A single user flow the agent exercised, with its outcome and the sessions it * recorded while running it. One agentic run produces many of these. */ export interface AgenticRunResultCase { /** Short human-readable name of the flow, e.g. "Sign up with email". */ title: string; /** The steps the agent took, in order. */ steps: string[]; outcome: AgenticRunResultCaseOutcome; /** Sessions recorded while running this case. */ sessionIds: string[]; /** Free-form notes, e.g. what failed or why the case was blocked. */ notes?: string; } export interface AgenticRunCoverageFile { /** Repo-relative post-edit path. */ path: string; /** Edited lines the coverage tool could observe (the per-file denominator). */ executableEditedLines: number; /** Observable edited lines that the run covered. */ coveredLines: number; /** Observable edited lines still uncovered, as inclusive [start, end] ranges. */ residualUncoveredRanges: Array<[number, number]>; } /** * Edit-coverage for the run: how much of the PR's changed code the produced * sessions exercised. Omitted entirely when coverage could not be measured * (e.g. the app under test served no source maps). */ export interface AgenticRunCoverage { /** coveredLines / executableEditedLines, in [0, 1]. */ fraction: number; coveredLines: number; executableEditedLines: number; files: AgenticRunCoverageFile[]; /** Edited files with no coverage data at all (unmappable / not loaded). */ unobservedFiles: string[]; } export interface ReportAgenticRunResultParams extends ProjectIdentifier { /** Every session produced across the run (the union of all cases' sessions). */ sessionIds: string[]; cases: AgenticRunResultCase[]; appUrl: string; commitSha: string; /** Edit-coverage for the run; omitted when coverage could not be measured. */ coverage?: AgenticRunCoverage; } export interface ReportAgenticRunResultResponse { message?: string; } export declare const reportAgenticRunResult: ({ client, projectId, ...body }: ReportAgenticRunResultParams & { client: MeticulousClient; }) => Promise; export interface GetAgenticChangedFilesParams extends ProjectIdentifier, AgenticRepoLeaseRef { commitSha: string; } export interface AgenticChangedFile { filename: string; status?: string; } export interface GetAgenticChangedFilesResponse { /** `null` when no PR/diff is available or source access is disabled. */ files: AgenticChangedFile[] | null; /** * The resolved PR base sha, or `null` under the same conditions `files` is * `null`. Lets a caller that only has the head commit sha (e.g. the agentic * session generation worker) call `getRelevantSessions`, which requires a * `baseCommitSha`. */ baseSha: string | null; } /** * Lists the files the PR under test touched. Served cap-free off the project's * repo-server mirror where possible, falling back to the hosting provider. When * `runId` is supplied the mirror read borrows the worker's durable run lease (a * warm pod) instead of acquiring a fresh short-lived one; a missing/stale lease * falls back to the leaseless path server-side. */ export declare const getAgenticChangedFiles: ({ client, projectId, commitSha, runId, }: GetAgenticChangedFilesParams & { client: MeticulousClient; }) => Promise; /** * The agentic run id (workflow run id) a read carries so the backend borrows the * worker's durable repo-server lease — discovered by this id — instead of * acquiring a fresh short-lived lease per read. Optional: absent (or a lease * that's since gone) falls back to the leaseless per-read path server-side. */ export interface AgenticRepoLeaseRef { runId?: string; } export interface GetAgenticRepoFileParams extends ProjectIdentifier, AgenticRepoLeaseRef { commitSha: string; path: string; /** Hard cap on the returned file size in bytes. */ maxBytes?: number; } export interface GetAgenticRepoFileResponse { kind: "found" | "missing"; /** UTF-8 decoded file contents; present only when `kind === "found"`. */ content?: string; /** `true` when the file exceeded `maxBytes` and `content` is partial. */ truncated?: boolean; /** Total file size in bytes before any truncation. */ sizeBytes?: number; } /** Reads a single source file from the project's repo at `commitSha`. */ export declare const getAgenticRepoFile: ({ client, projectId, ...body }: GetAgenticRepoFileParams & { client: MeticulousClient; }) => Promise; export interface SearchAgenticRepoCodeParams extends ProjectIdentifier, AgenticRepoLeaseRef { commitSha: string; pattern: string; /** Restrict the search to these path prefixes. */ paths?: string[]; caseInsensitive?: boolean; /** Lines of context to return around each match. */ contextLines?: number; /** Hard cap on the number of matches returned. */ maxMatches?: number; } export interface AgenticRepoSearchMatch { path: string; lineNumber: number; line: string; before: string[]; after: string[]; } export interface SearchAgenticRepoCodeResponse { matches: AgenticRepoSearchMatch[]; /** `true` when `maxMatches` was reached and trailing matches were dropped. */ truncated: boolean; } /** Searches the project's repo (ripgrep) at `commitSha`. */ export declare const searchAgenticRepoCode: ({ client, projectId, ...body }: SearchAgenticRepoCodeParams & { client: MeticulousClient; }) => Promise; export interface GetAgenticFileChangesParams extends ProjectIdentifier, AgenticRepoLeaseRef { commitSha: string; /** Repo-relative path of the file whose changes to return. */ path: string; } export interface GetAgenticFileChangesResponse { /** * The file's unified diff (base..head) as raw patch text, or `null` when no * PR/diff is available or source access is disabled. Empty string when the * file is unchanged. */ diff: string | null; } /** * Returns how a single file changed in the PR under test (unified-diff hunks). * The worker uses this to compute edit-coverage; the agent uses it to see what * changed in a file it is about to exercise. */ export declare const getAgenticFileChanges: ({ client, projectId, ...body }: GetAgenticFileChangesParams & { client: MeticulousClient; }) => Promise; export interface ListAgenticRepoTreeParams extends ProjectIdentifier, AgenticRepoLeaseRef { commitSha: string; /** Tree path inside the commit. Defaults to the repo root. */ path?: string; /** When true, walks descendants recursively. */ recursive?: boolean; /** Hard cap on the number of entries returned. */ maxEntries?: number; } export interface AgenticRepoTreeEntry { type: "blob" | "tree" | "commit"; path: string; /** Blob size in bytes; `null` for trees/submodules and blobless-mirror blobs. */ sizeBytes: number | null; } export interface ListAgenticRepoTreeResponse { entries: AgenticRepoTreeEntry[]; /** `true` when `maxEntries` was reached and trailing entries were dropped. */ truncated: boolean; } /** Lists a tree in the project's repo at `commitSha`. */ export declare const listAgenticRepoTree: ({ client, projectId, ...body }: ListAgenticRepoTreeParams & { client: MeticulousClient; }) => Promise; export interface AcquireAgenticRepoLeaseParams extends ProjectIdentifier { /** The agentic run id (workflow run id) the lease is keyed on. */ runId: string; } export interface AcquireAgenticRepoLeaseResponse { leaseId: string; podInstanceId?: string; recommendedHeartbeatIntervalMs: number; heartbeatTtlMs: number; } /** * Acquires a durable repo-server lease for the whole agentic run and kicks off * the mirror clone. Blocks only on the bounded pod-boot step; poll * {@link getAgenticRepoLeaseStatus} for the clone. The caller must heartbeat * (see {@link heartbeatAgenticRepoLease}) and release it * ({@link releaseAgenticRepoLease}). Source access is a hard requirement, so this * rejects (403) rather than returning an "unavailable" result when the * `ALLOW_CODE_ACCESS` kill switch is off, the project disables source access, or * the project isn't enrolled. */ export declare const acquireAgenticRepoLease: ({ client, projectId, ...body }: AcquireAgenticRepoLeaseParams & { client: MeticulousClient; }) => Promise; export interface GetAgenticRepoLeaseStatusParams extends ProjectIdentifier { /** Instance id of the lease-holding pod (from acquire), if any. */ podInstanceId?: string; } export interface AgenticRepoLeaseStatusResponse { /** `true` when the pod is up and its git mirror has finished cloning. */ ready: boolean; } /** * Returns whether the held lease's pod + git mirror are ready right now — a * single point-in-time status query, not a wait. The caller drives its own poll * loop (source reads simply retry a mirror that's still cloning). */ export declare const getAgenticRepoLeaseStatus: ({ client, projectId, podInstanceId, }: GetAgenticRepoLeaseStatusParams & { client: MeticulousClient; }) => Promise; export interface HeartbeatAgenticRepoLeaseParams extends ProjectIdentifier { leaseId: string; podInstanceId?: string; } export interface HeartbeatAgenticRepoLeaseResponse { ok: boolean; expiresAt?: string; } /** Heartbeats the held lease to keep it alive for the run's lifetime. */ export declare const heartbeatAgenticRepoLease: ({ client, projectId, ...body }: HeartbeatAgenticRepoLeaseParams & { client: MeticulousClient; }) => Promise; export interface ReleaseAgenticRepoLeaseParams extends ProjectIdentifier { leaseId: string; podInstanceId?: string; } export interface ReleaseAgenticRepoLeaseResponse { released: boolean; } /** Releases the held lease at the end of the run (best-effort). */ export declare const releaseAgenticRepoLease: ({ client, projectId, ...body }: ReleaseAgenticRepoLeaseParams & { client: MeticulousClient; }) => Promise; //# sourceMappingURL=agentic-session-generation.api.d.ts.map