import { ApiRequest, ApiResponse, IApiRequestProvider } from "@codingame/monaco-vscode-github-service-override/vscode/vs/platform/github/common/client/request"; import { PaginatedApiRequest } from "../client/pagination.js"; import { parse } from "../client/schema.js"; import { GitHubRequestError } from "../githubTypes.js"; import { RequestErrorKind } from "../types.js"; import { ActivationContext, ApiError, ApiErrorResponse, CodedApiErrorResponse, PaginatedResponse, User } from "./missionControl.js"; import { MissionControlErrorMetadata } from "./missionControlError.js"; /** An approved Mission Control API endpoint and its request-header configuration. */ export interface ApiEndpoint { /** The complete HTTPS base, including the Mission Control route prefix. */ readonly apiBaseUri: string; /** Approved feed gateway; the Copilot-hosted task proxy does not serve feed negotiation. */ readonly feedApiBaseUri?: string; /** Approved credential gateway; the task proxy does not serve identity-token exchanges. */ readonly identityApiBaseUri?: string; /** The integration identity supplied by the hosting application. */ readonly integrationId: string; /** The optional GitHub API version; omitted unless explicitly configured. */ readonly apiVersion?: string; } /** Endpoint configuration for Mission Control operations. */ export interface MissionControlClientOptions { /** The approved Mission Control endpoint, which may use a Copilot-hosted /agents proxy. */ readonly endpoint: ApiEndpoint; } /** An HTTP failure with structured diagnostics but no retained raw response body. */ export declare class ApiRequestError extends GitHubRequestError implements ApiError { /** HTTP status reported by the service. */ readonly statusCode: number; /** Parsed API diagnostics retained with the failure. */ readonly response?: ApiErrorResponse | CodedApiErrorResponse | undefined; /** Server request identifier for diagnostics, when supplied. */ readonly requestId?: string | undefined; /** Server-directed retry delay, in seconds. */ readonly retryAfterSeconds?: number | undefined; /** Set when the dispatched mutation may already have been accepted. */ readonly outcome?: "indeterminate" | undefined; readonly code: string | undefined; readonly limitedResource: string | undefined; constructor( /** HTTP status reported by the service. */ statusCode: number, kind: RequestErrorKind, /** Parsed API diagnostics retained with the failure. */ response?: ApiErrorResponse | CodedApiErrorResponse | undefined, /** Server request identifier for diagnostics, when supplied. */ requestId?: string | undefined, /** Server-directed retry delay, in seconds. */ retryAfterSeconds?: number | undefined, /** Set when the dispatched mutation may already have been accepted. */ outcome?: "indeterminate" | undefined, metadata?: MissionControlErrorMetadata); } /** The service may have accepted a mutation whose result is unknown. Check its state before retrying. */ export declare class MutationUncertainError extends GitHubRequestError { /** Indicates that the dispatched mutation may already have taken effect. */ readonly outcome = "indeterminate"; constructor(kind: RequestErrorKind, statusCode?: number); } export declare class MissionControlClient { private readonly _provider?; /** Validates and normalizes the approved endpoint and integration headers. */ static normalizeOptions(options: MissionControlClientOptions | undefined): MissionControlClientOptions | undefined; constructor(_provider?: IApiRequestProvider | undefined); requestPages(request: PaginatedApiRequest, signal: AbortSignal, parser: (response: ApiResponse) => T, merge: (pages: readonly T[]) => T): Promise; /** Executes a Mission Control request and returns the result of the response parser. */ request(request: ApiRequest, signal: AbortSignal, parser: (response: ApiResponse) => T): Promise; } export declare const parseMissionControlOptions: parse.Parser; /** Returns the mutation, sensitivity, and retry rules for a Mission Control request. */ export declare function missionControlRequestPolicy(request: Pick): { mutation: boolean; sensitive: boolean; retry: false | undefined; }; /** Validates an advertised Mission Control environment kind. */ export declare const parseEnvironmentKind: parse.Parser<"managed-actions" | "managed-cca" | "managed-sandbox" | "user-codespace" | "user-local">; /** Parses a Mission Control user reference. */ export declare const parseUser: parse.Parser; /** Parses activation trace metadata and validates the version and canonical positive uint64 sequence. */ export declare const parseActivationContext: parse.Parser; /** Retains only documented diagnostics from the API's structured error response. */ export declare const parseApiError: parse.Parser; /** Combines page data with pagination and server-time metadata. */ export declare function paginated(response: ApiResponse, data: T): PaginatedResponse;