/** * Pull-request creation over the GitHub/Gitea REST APIs (no gh CLI). * Shared by the orchestrator WS receiver and the task-run git pipeline. */ export interface CreatePullRequestInput { /** https clone URL, e.g. https://github.com/owner/repo.git */ repoUrl: string; headBranch: string; baseBranch: string; title: string; body?: string; /** PAT with repo scope (GitHub) / token with write scope (Gitea). */ token: string; } export interface CreatedPullRequest { url: string; number: number; /** * True when a PR for this head branch was ALREADY open and we reused it. * * A retry of the same task lands on the same branch (that is the point of the * task-keyed branch), so the second run's POST answered * `422 Validation Failed - A pull request already exists for …` and the run * reported "PR: could not be opened" for a PR that was open all along. PR * creation is now idempotent per head branch. */ reused: boolean; } /** True when the URL points at github.com (else treated as Gitea-compatible). */ export declare function isGitHubUrl(repoUrl: string): boolean; /** owner/repo parsed from an https clone URL (null when unparseable). */ export declare function parseRepoSlug(repoUrl: string): { owner: string; repo: string; } | null; /** * The OPEN pull request whose head is `headBranch`, or null. * * Best-effort by design: this is only called after a create failed, so a lookup * failure must fall through to the original error rather than mask it. */ export declare function findOpenPullRequest(input: Omit): Promise; /** * POST the pull request, or RETURN the one already open for this head branch. * * Idempotent on purpose (2026-11): a retry of the same task pushes to the SAME * task branch, so the duplicate is the normal case, not an error. The old code * threw `422 Validation Failed - A pull request already exists for …`, the * caller retried the other candidate base branches (422 again), and the run * reported "PR: could not be opened" while GitHub had it open the whole time - * which reads to a human as "the work was not delivered". * * Throws only when no PR exists and none could be created (auth, base branch * missing, network). */ export declare function createPullRequest(input: CreatePullRequestInput): Promise;