import { DocumentNode } from 'graphql'; type TokenResolution = { token: string; source: "env" | "cache" | "gh-cli"; }; declare function resolveGithubToken(): Promise; declare function invalidateTokenCache(): Promise; /** * All possible error codes returned in {@link ResultError.code}. * * Retryable codes: `RATE_LIMIT`, `NETWORK`, `SERVER`, `NOT_READY`. */ declare const errorCodes: { readonly Auth: "AUTH"; readonly NotFound: "NOT_FOUND"; readonly Validation: "VALIDATION"; readonly RateLimit: "RATE_LIMIT"; readonly Network: "NETWORK"; readonly Server: "SERVER"; readonly AdapterUnsupported: "ADAPTER_UNSUPPORTED"; readonly NotReady: "NOT_READY"; readonly TooLarge: "TOO_LARGE"; readonly Unknown: "UNKNOWN"; }; /** Union of all error code string literals. */ type ErrorCode = (typeof errorCodes)[keyof typeof errorCodes]; /** * All possible reason codes explaining why a particular route was selected. * * Included in {@link ResultMeta.reason}. */ declare const routeReasonCodes: readonly ["INPUT_VALIDATION", "OUTPUT_VALIDATION", "CARD_PREFERRED", "CARD_FALLBACK", "PREFLIGHT_FAILED", "ENV_CONSTRAINT", "CAPABILITY_LIMIT", "DEFAULT_POLICY"]; /** Reason code explaining why a particular route was selected. */ type RouteReasonCode = (typeof routeReasonCodes)[number]; /** The transport route used to execute a capability. */ type RouteSource = "cli" | "rest" | "graphql"; /** * Structured error returned inside a {@link ResultEnvelope} when `ok` is `false`. * * @see {@link ErrorCode} for the full list of error codes. */ interface ResultError { code: ErrorCode; message: string; retryable: boolean; details?: Record; } /** * Records a single route attempt during execution. * * The routing engine may try multiple routes (preferred → fallback). * Each attempt is logged here regardless of outcome. */ interface AttemptMeta { route: RouteSource; status: "success" | "error" | "skipped"; error_code?: ErrorCode; duration_ms?: number; } /** * Metadata attached to every {@link ResultEnvelope}. * * Provides observability into which route was used, why, how long it took, * and the full list of route attempts. */ interface ResultMeta { capability_id: string; route_used?: RouteSource; reason?: RouteReasonCode; attempts?: AttemptMeta[]; pagination?: { has_next_page?: boolean; end_cursor?: string; next?: unknown; }; timings?: { total_ms?: number; adapter_ms?: number; }; cost?: { tokens_in?: number; tokens_out?: number; }; } /** * The universal response contract for all ghx operations. * * Every call to {@link executeTask} returns a `ResultEnvelope` — it never throws. * Check `ok` to distinguish success from failure; `data` and `error` are exclusive. * * @typeParam TData - The shape of the success payload, varies per capability. */ interface ResultEnvelope { ok: boolean; data?: TData; error?: ResultError; meta: ResultMeta; } /** Aggregate outcome of a batch execution via {@link executeTasks}. */ type ChainStatus = "success" | "partial" | "failed"; /** Result of a single step within a chain execution. */ interface ChainStepResult { task: string; ok: boolean; data?: unknown; error?: ResultError; } /** * Response envelope for batch operations via {@link executeTasks}. * * Contains per-step results and aggregate metadata * (total, succeeded, failed counts). */ interface ChainResultEnvelope { status: ChainStatus; results: ChainStepResult[]; meta: { route_used: RouteSource; total: number; succeeded: number; failed: number; }; } /** A dotted capability identifier (e.g. `"pr.view"`, `"issue.labels.add"`). */ type TaskId = string; /** * A request to execute a single ghx capability. * * @typeParam TInput - The shape of the input payload, varies per capability. */ interface TaskRequest> { task: TaskId; input: TInput; } type ExecuteTaskFn = (request: { task: string; input: Record; options?: Record; }) => Promise; /** * Creates an execute tool suitable for wiring into an AI agent's tool loop. * * Wraps the execution engine into a simple `{ execute(capabilityId, params) }` shape. * * @example * ```ts * const tool = createExecuteTool({ * executeTask: (req) => executeTask(req, deps), * }) * const result = await tool.execute("repo.view", { owner: "aryeko", name: "ghx" }) * ``` */ declare function createExecuteTool(deps: { executeTask: ExecuteTaskFn; }): { execute(capabilityId: string, params: Record, options?: Record): Promise; }; /** Represents a JSON Schema definition for card inputs/outputs. */ type JsonSchema = Record; /** Defines when a fallback route should override the preferred route. */ interface SuitabilityRule { when: "always" | "env" | "params"; predicate: string; reason: string; } /** * Extracts a single value from a Phase 1 lookup result using a dot-notation path. * * Use when the mutation needs one node ID that can be resolved via a lookup query. * * @example * ```yaml * inject: * - target: pullRequestId * source: scalar * path: repository.pullRequest.id * ``` */ interface ScalarInject { target: string; source: "scalar"; from_lookup?: string; path: string; } /** * Resolves a list of human-readable names to node IDs using a Phase 1 lookup result. * * Matching is case-insensitive. Use when the mutation needs an array of IDs * (e.g. label IDs, assignee IDs) that must be looked up by name. * * @example * ```yaml * inject: * - target: labelIds * source: map_array * from_input: labels # input field containing list of names * nodes_path: repository.labels.nodes * match_field: name # field on each node to match against input names * extract_field: id # field on each node to extract as the resolved value * ``` */ interface MapArrayInject { target: string; source: "map_array"; from_lookup?: string; from_input: string; nodes_path: string; match_field: string; extract_field: string; } /** Uses the first non-empty scalar found across multiple lookup results. */ interface FirstScalarInject { target: string; source: "first_scalar"; paths: Array<{ from_lookup?: string; path: string; }>; } /** * Passes a value directly from the step's `input` into a mutation variable. * * No Phase 1 lookup is required. Use when the caller already has the required node ID * (e.g. the agent passes `issueId` directly), avoiding an unnecessary resolution round-trip. * * @example * ```yaml * inject: * - target: labelableId * source: input * from_input: issueId # the input field whose value is passed through * ``` */ interface InputPassthroughInject { target: string; source: "input"; from_input: string; } /** * Injects an explicit `null` value into a mutation variable. * * Use when a mutation variable must be explicitly set to `null` to clear a field * (e.g. clearing a milestone from an issue by passing `milestoneId: null`). * * @example * ```yaml * inject: * - target: milestoneId * source: "null_literal" * ``` */ interface NullLiteralInject { target: string; source: "null_literal"; } /** * Passes a value directly from the step's `input` into a mutation variable, * normalized to upper case. * * Use when a user-facing input field accepts lower or mixed case (e.g. `method: "squash"`) * but the GraphQL variable expects an uppercase enum value (e.g. `mergeMethod: "SQUASH"`). * * When the input field is missing or `null`, this inject returns `{}` (no key set) so the * optional GraphQL variable falls through to its server-side default. * * @example * ```yaml * inject: * - target: mergeMethod * source: input_upper * from_input: method * ``` */ interface InputUpperInject { target: string; source: "input_upper"; from_input: string; } /** Injects whether an input field is present and non-null. */ interface InputPresentInject { target: string; source: "input_present"; from_input: string; } /** Injects an input field value, or a static default when the field is absent or null. */ interface InputDefaultInject { target: string; source: "input_default"; from_input: string; default: string | number | boolean | null; } /** Builds a GitHub DraftPullRequestReviewThread array from card comments input. */ interface DraftReviewThreadsInject { target: string; source: "draft_review_threads"; from_input: string; } /** Builds a GitHub ProjectV2FieldValue object from the project item field inputs. */ interface ProjectV2FieldValueInject { target: string; source: "project_v2_field_value"; } /** A specification for how to inject a resolved Phase 1 value into Phase 2. */ type InjectSpec = ScalarInject | MapArrayInject | FirstScalarInject | InputPassthroughInject | NullLiteralInject | InputUpperInject | InputPresentInject | InputDefaultInject | DraftReviewThreadsInject | ProjectV2FieldValueInject; /** Defines the GraphQL query to run during the Phase 1 lookup. */ interface LookupSpec { id?: string; operationName: string; documentPath: string; vars: Record; } /** Configuration for a Phase 1 node ID lookup prior to mutation execution. */ interface ResolutionConfig { lookup?: LookupSpec; lookups?: LookupSpec[]; inject: InjectSpec[]; } /** * Declarative configuration for a single ghx capability. * * Defines the capability's identity, input/output schemas, routing preferences, * and adapter-specific execution details (GraphQL, CLI, REST). */ interface OperationCard> { capability_id: string; version: string; description: string; input_schema: JsonSchema; output_schema: JsonSchema; routing: { preferred: RouteSource; fallbacks: RouteSource[]; suitability?: SuitabilityRule[]; notes?: string[]; }; graphql?: { operationName: string; operationType: "query" | "mutation"; documentPath: string; variables?: Record; limits?: { maxPageSize?: number; }; resolution?: ResolutionConfig; }; cli?: { command: string; jsonFields?: string[]; jq?: string; limits?: { maxItemsPerCall?: number; }; }; rest?: { endpoints: Array<{ method: string; path: string; }>; }; examples?: Array<{ title: string; input: Input; }>; } type CliRunResult = { stdout: string; stderr: string; exitCode: number; }; type CliCommandRunner = { run(command: string, args: string[], timeoutMs: number): Promise; }; type SafeRunnerOptions = { maxOutputBytes?: number; }; declare function createSafeCliCommandRunner(options?: SafeRunnerOptions): CliCommandRunner; /** Structured explanation of a capability, returned by {@link explainCapability}. */ type CapabilityExplanation = { capability_id: string; purpose: string; required_inputs: string[]; optional_inputs: Record; preferred_route: "cli" | "graphql" | "rest"; fallback_routes: Array<"cli" | "graphql" | "rest">; output_fields: string[]; }; /** * Return a structured explanation of a capability by its ID. * * @throws If the capability ID is unknown. */ declare function explainCapability(capabilityId: string): CapabilityExplanation; /** Return a copy of all registered operation cards, in canonical order. */ declare function listOperationCards(): OperationCard[]; /** Look up a single operation card by its dotted capability ID (e.g. `"pr.view"`). */ declare function getOperationCard(capabilityId: string): OperationCard | undefined; /** Summary of a capability, returned by {@link listCapabilities}. */ type CapabilityListItem = { capability_id: string; description: string; required_inputs: string[]; optional_inputs: string[]; optional_inputs_detail: Record; }; /** * List all available capabilities, optionally filtered by domain. * * @param domain - Filter by top-level domain (e.g. `"pr"`, `"issue"`, `"workflow"`). */ declare function listCapabilities(domain?: string): CapabilityListItem[]; type GraphqlVariables = Record; /** A single error from a GraphQL response. */ type GraphqlError = { message: string; path?: ReadonlyArray; extensions?: Record; }; /** Raw GraphQL response containing both `data` and `errors` fields. */ type GraphqlRawResult = { data: TData | undefined; errors: GraphqlError[] | undefined; }; type GraphqlDocument = string | DocumentNode; /** * Low-level transport interface for sending GraphQL queries. * * Implement this to use a custom HTTP client, proxy, or mock. * Pass to {@link createGithubClient} or {@link createGraphqlClient}. */ interface GraphqlTransport { execute(query: string, variables?: GraphqlVariables): Promise; executeRaw?(query: string, variables?: GraphqlVariables): Promise>; } /** * Higher-level GraphQL client with `query` and `queryRaw` methods. * * Created by {@link createGraphqlClient} from a {@link GraphqlTransport}. */ interface GraphqlClient { query(query: GraphqlDocument, variables?: TVariables): Promise; queryRaw(query: GraphqlDocument, variables?: TVariables): Promise>; } /** Options for creating a token-based GraphQL transport. */ type TokenClientOptions = { token: string; graphqlUrl?: string; }; /** * Create a {@link GraphqlClient} from a {@link GraphqlTransport}. * * Wraps the raw transport `execute` method with query string normalization * and a `queryRaw` method that returns settled results. */ declare function createGraphqlClient(transport: GraphqlTransport): GraphqlClient; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$g = { [K in keyof T]: T[K]; }; type IssueCommentsListQueryVariables = Exact$g<{ owner: string; name: string; issueNumber: number; first: number; after?: string | null | undefined; }>; type Maybe = T | null; type InputMaybe = Maybe; type Scalars = { String: { input: string; output: string; }; Int: { input: number; output: number; }; Boolean: { input: boolean; output: boolean; }; ID: { input: string; output: string; }; URI: { input: unknown; output: unknown; }; }; type IssueState = string; type PullRequestState = string; type DiffSide = string; type PullRequestReviewEvent = string; type DraftPullRequestReviewThread = { body: Scalars["String"]["input"]; line?: InputMaybe; path?: InputMaybe; side?: InputMaybe; startLine?: InputMaybe; startSide?: InputMaybe; }; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$f = { [K in keyof T]: T[K]; }; type IssueListQueryVariables = Exact$f<{ owner: string; name: string; first: number; after?: string | null | undefined; states?: Array | IssueState | null | undefined; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$e = { [K in keyof T]: T[K]; }; type IssueViewQueryVariables = Exact$e<{ owner: string; name: string; issueNumber: number; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$d = { [K in keyof T]: T[K]; }; type PrDiffListFilesQueryVariables = Exact$d<{ owner: string; name: string; prNumber: number; first: number; after?: string | null | undefined; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$c = { [K in keyof T]: T[K]; }; type PrListQueryVariables = Exact$c<{ owner: string; name: string; first: number; after?: string | null | undefined; states?: Array | PullRequestState | null | undefined; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$b = { [K in keyof T]: T[K]; }; type PrReviewSubmitMutationVariables = Exact$b<{ pullRequestId: string | number; event: PullRequestReviewEvent; body?: string | null | undefined; threads?: Array | DraftPullRequestReviewThread | null | undefined; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$a = { [K in keyof T]: T[K]; }; type PrReviewsListQueryVariables = Exact$a<{ owner: string; name: string; prNumber: number; first: number; after?: string | null | undefined; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$9 = { [K in keyof T]: T[K]; }; type PrViewQueryVariables = Exact$9<{ owner: string; name: string; prNumber: number; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$8 = { [K in keyof T]: T[K]; }; type ProjectV2FieldsListQueryVariables = Exact$8<{ owner: string; projectNumber: number; first: number; after?: string | null | undefined; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$7 = { [K in keyof T]: T[K]; }; type ProjectV2ItemsListQueryVariables = Exact$7<{ owner: string; projectNumber: number; first: number; after?: string | null | undefined; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$6 = { [K in keyof T]: T[K]; }; type ProjectV2OrgViewQueryVariables = Exact$6<{ org: string; projectNumber: number; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$5 = { [K in keyof T]: T[K]; }; type ProjectV2UserViewQueryVariables = Exact$5<{ user: string; projectNumber: number; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$4 = { [K in keyof T]: T[K]; }; type ReleaseListQueryVariables = Exact$4<{ owner: string; name: string; first: number; after?: string | null | undefined; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$3 = { [K in keyof T]: T[K]; }; type ReleaseViewQueryVariables = Exact$3<{ owner: string; name: string; tagName: string; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$2 = { [K in keyof T]: T[K]; }; type RepoIssueTypesListQueryVariables = Exact$2<{ owner: string; name: string; first: number; after?: string | null | undefined; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact$1 = { [K in keyof T]: T[K]; }; type RepoLabelsListQueryVariables = Exact$1<{ owner: string; name: string; first: number; after?: string | null | undefined; }>; /** Internal type. DO NOT USE DIRECTLY. */ type Exact = { [K in keyof T]: T[K]; }; type RepoViewQueryVariables = Exact<{ owner: string; name: string; }>; type RepoViewInput = RepoViewQueryVariables; type IssueCommentsListInput = IssueCommentsListQueryVariables; type IssueListInput = Omit & { state?: string | null; }; type IssueViewInput = IssueViewQueryVariables; type PrListInput = Omit & { state?: string | null; }; type PrViewExcludeField = "body"; type PrViewInput = PrViewQueryVariables & { exclude?: ReadonlyArray; }; type PrReviewsListInput = PrReviewsListQueryVariables; type PrDiffListFilesInput = PrDiffListFilesQueryVariables; type PrCommentsListInput = { owner: string; name: string; prNumber: number; first: number; after?: string | null; unresolvedOnly?: boolean; includeOutdated?: boolean; }; type IssueCreateInput = { owner: string; name: string; title: string; body?: string; }; type IssueUpdateInput = { owner: string; name: string; issueNumber: number; title?: string; body?: string; }; type IssueMutationInput = { owner: string; name: string; issueNumber: number; }; type IssueLabelsUpdateInput = { owner: string; name: string; issueNumber: number; labels: string[]; }; type IssueLabelsAddInput = { owner: string; name: string; issueNumber: number; labels: string[]; }; type IssueAssigneesUpdateInput = { owner: string; name: string; issueNumber: number; assignees: string[]; }; type IssueAssigneesAddInput = { owner: string; name: string; issueNumber: number; assignees: string[]; }; type IssueAssigneesRemoveInput = { owner: string; name: string; issueNumber: number; assignees: string[]; }; type IssueMilestoneSetInput = { owner: string; name: string; issueNumber: number; milestoneNumber: number; }; type IssueCommentCreateInput = { owner: string; name: string; issueNumber: number; body: string; }; type PrCommentCreateInput = { owner: string; name: string; prNumber: number; body: string; }; type PrCommentCreateData = { id: string; body: string; url: string; }; type IssueLinkedPrsListInput = { owner: string; name: string; issueNumber: number; }; type IssueRelationsGetInput = IssueLinkedPrsListInput; type IssueParentSetInput = { issueId: string; parentIssueId: string; }; type IssueParentRemoveInput = { issueId: string; }; type IssueBlockedByInput = { issueId: string; blockedByIssueId: string; }; type RepoViewData = { id: string; name: string; nameWithOwner: string; isPrivate: boolean; stargazerCount: number; forkCount: number; url: string; defaultBranch: string | null; }; type IssueViewData = { id: string; number: number; title: string; state: string; url: string; body: string; labels: string[]; }; type IssueListItemData = { id: string; number: number; title: string; state: string; url: string; }; type IssueListData = { items: Array; pageInfo: { endCursor: string | null; hasNextPage: boolean; }; }; type IssueCommentData = { id: string; body: string; authorLogin: string | null; createdAt: string; url: string; }; type IssueCommentsListData = { items: Array; pageInfo: { endCursor: string | null; hasNextPage: boolean; }; }; type IssueMutationData = { id: string; number: number; title?: string; state?: string; url?: string; closed?: boolean; reopened?: boolean; deleted?: boolean; }; type IssueLabelsUpdateData = { id: string; labels: string[]; }; type IssueLabelsAddData = { id: string; labels: string[]; }; type IssueLabelsRemoveInput = { owner: string; name: string; issueNumber: number; labels: string[]; }; type IssueLabelsRemoveData = { issueNumber: number; removed: string[]; }; type IssueAssigneesUpdateData = { id: string; assignees: string[]; }; type IssueAssigneesAddData = { id: string; assignees: string[]; }; type IssueAssigneesRemoveData = { id: string; assignees: string[]; }; type IssueMilestoneSetData = { id: string; milestoneNumber: number | null; }; type IssueMilestoneClearInput = { owner: string; name: string; issueNumber: number; }; type IssueMilestoneClearData = { issueNumber: number; cleared: boolean; }; type IssueCommentCreateData = { id: string; body: string; url: string; }; type IssueLinkedPrData = { id: string; number: number; title: string; state: string; url: string; }; type IssueLinkedPrsListData = { items: Array; }; type IssueRelationNodeData = { id: string; number: number; }; type IssueRelationsGetData = { issue: IssueRelationNodeData; parent: IssueRelationNodeData | null; children: Array; blockedBy: Array; }; type IssueParentSetData = { issueId: string; parentIssueId: string; updated: boolean; }; type IssueParentRemoveData = { issueId: string; parentRemoved: boolean; }; type IssueBlockedByData = { issueId: string; blockedByIssueId: string; added?: boolean; removed?: boolean; }; type PrViewData = { id: string; number: number; title: string; state: string; url: string; body?: string; labels: string[]; }; type PrListItemData = { id: string; number: number; title: string; state: string; url: string; }; type PrListData = { items: Array; pageInfo: { endCursor: string | null; hasNextPage: boolean; }; }; type PrReviewThreadCommentData = { id: string; authorLogin: string | null; body: string; createdAt: string; url: string; }; type PrReviewThreadData = { id: string; path: string | null; line: number | null; startLine: number | null; diffSide: string | null; subjectType: string | null; isResolved: boolean; isOutdated: boolean; viewerCanReply: boolean; viewerCanResolve: boolean; viewerCanUnresolve: boolean; resolvedByLogin: string | null; comments: Array; }; type PrCommentsListData = { items: Array; pageInfo: { endCursor: string | null; hasNextPage: boolean; }; filterApplied: { unresolvedOnly: boolean; includeOutdated: boolean; }; scan: { pagesScanned: number; sourceItemsScanned: number; scanTruncated: boolean; }; }; type PrReviewData = { id: string; authorLogin: string | null; body: string; state: string; submittedAt: string | null; url: string; commitOid: string | null; }; type PrReviewsListData = { items: Array; pageInfo: { endCursor: string | null; hasNextPage: boolean; }; }; type ReactionContentInput = "THUMBS_UP" | "THUMBS_DOWN" | "LAUGH" | "HOORAY" | "CONFUSED" | "HEART" | "EYES" | "ROCKET"; type PrReactionGroupData = { content: string; reactorCount: number; reactorLogins: string[]; viewerHasReacted: boolean; reactorsTruncated: boolean; }; type PrReactionsListInput = { owner: string; name: string; prNumber: number; reactorLogin?: string; content?: ReactionContentInput; }; type PrReactionsListData = { subject: { type: string; id: string; url: string; }; items: PrReactionGroupData[]; filterApplied: { reactorLogin: string | null; content: string | null; }; }; type PrCommentReactionSubjectData = { subjectType: string; subjectId: string; subjectUrl: string; authorLogin: string | null; groups: PrReactionGroupData[]; }; type PrCommentsReactionsListInput = { owner: string; name: string; prNumber: number; first?: number; after?: string | null; reactorLogin?: string; content?: ReactionContentInput; }; type PrCommentsReactionsListData = { items: PrCommentReactionSubjectData[]; filterApplied: { reactorLogin: string | null; content: string | null; }; pageInfo: { endCursor: string | null; hasNextPage: boolean; }; scan: { pagesScanned: number; sourceItemsScanned: number; scanTruncated: boolean; }; }; type PrDiffFileData = { path: string; additions: number; deletions: number; }; type PrDiffListFilesData = { items: Array; pageInfo: { endCursor: string | null; hasNextPage: boolean; }; }; type PrMergeStatusInput = { owner: string; name: string; prNumber: number; }; type PrMergeStatusData = { mergeable: string | null; mergeStateStatus: string | null; reviewDecision: string | null; isDraft: boolean; state: string; }; type ReviewThreadMutationInput = { threadId: string; }; type ReplyToReviewThreadInput = ReviewThreadMutationInput & { body: string; }; type ReviewThreadMutationData = { id: string; isResolved: boolean; }; type DraftComment = { path: string; body: string; line: number; side?: "LEFT" | "RIGHT"; startLine?: number; startSide?: "LEFT" | "RIGHT"; }; type PrReviewSubmitInput = { owner: string; name: string; prNumber: number; event: PrReviewSubmitMutationVariables["event"]; body?: string; comments?: DraftComment[]; }; type PrReviewSubmitData = { id: string; state: string; url: string; body: string | null; }; type RepoLabelsListInput = RepoLabelsListQueryVariables; type RepoLabelItemData = { id: string | null; name: string | null; description: string | null; color: string | null; isDefault: boolean | null; }; type RepoLabelsListData = { items: RepoLabelItemData[]; pageInfo: { hasNextPage: boolean; endCursor: string | null; }; }; type RepoIssueTypesListInput = RepoIssueTypesListQueryVariables; type RepoIssueTypeItemData = { id: string | null; name: string | null; color: string | null; isEnabled: boolean | null; }; type RepoIssueTypesListData = { items: RepoIssueTypeItemData[]; pageInfo: { hasNextPage: boolean; endCursor: string | null; }; }; type ReleaseViewInput = ReleaseViewQueryVariables; type ReleaseViewData = { id: number | null; tagName: string; name: string | null; isDraft: boolean; isPrerelease: boolean; url: string | null; targetCommitish: string | null; createdAt: string | null; publishedAt: string | null; }; type ReleaseListInput = ReleaseListQueryVariables; type ReleaseItemData = ReleaseViewData; type ReleaseListData = { items: ReleaseItemData[]; pageInfo: { hasNextPage: boolean; endCursor: string | null; }; }; type ProjectV2OrgViewInput = ProjectV2OrgViewQueryVariables; type ProjectV2OrgViewData = { id: string | null; title: string | null; shortDescription: string | null; public: boolean | null; closed: boolean | null; url: string | null; }; type ProjectV2UserViewInput = ProjectV2UserViewQueryVariables; type ProjectV2UserViewData = ProjectV2OrgViewData; type ProjectV2FieldsListInput = ProjectV2FieldsListQueryVariables; type ProjectV2FieldItemData = { id: string | null; name: string | null; dataType: string | null; options?: Array<{ id: string; name: string; }> | null; }; type ProjectV2FieldsListData = { items: ProjectV2FieldItemData[]; pageInfo: { hasNextPage: boolean; endCursor: string | null; }; }; type ProjectV2ItemsListInput = ProjectV2ItemsListQueryVariables; type ProjectV2ItemData = { id: string | null; contentType: string | null; contentNumber: number | null; contentTitle: string | null; }; type ProjectV2ItemsListData = { items: ProjectV2ItemData[]; pageInfo: { hasNextPage: boolean; endCursor: string | null; }; }; type PrCreateInput = { owner: string; name: string; baseRefName: string; headRefName: string; title: string; body?: string; draft?: boolean; }; type PrCreateData = { number: number; url: string; title: string; state: string; draft: boolean; }; type PrUpdateInput = { owner: string; name: string; prNumber: number; title?: string; body?: string; draft?: boolean; }; type PrUpdateData = { number: number; url: string; title: string; state: string; draft: boolean; }; type PrMergeInput = { owner: string; name: string; prNumber: number; mergeMethod?: string; deleteBranch?: boolean; }; type PrMergeData = { prNumber: number; method: string; isMethodAssumed: boolean; queued: boolean; deleteBranch: boolean; }; type PrCloseInput = { owner: string; name: string; prNumber: number; deleteBranch?: boolean; comment?: string; }; type PrCloseData = { prNumber: number; state: string; closed: boolean; deleteBranch: boolean; }; type PrBranchUpdateInput = { owner: string; name: string; prNumber: number; updateMethod?: string; }; type PrBranchUpdateData = { prNumber: number; updated: boolean; }; type PrAssigneesInput = { owner: string; name: string; prNumber: number; assignees: string[]; }; type PrAssigneesAddInput = PrAssigneesInput; type PrAssigneesRemoveInput = PrAssigneesInput; type PrAssigneesAddData = { prNumber: number; added: string[]; }; type PrAssigneesRemoveData = { prNumber: number; removed: string[]; }; type PrReviewsRequestInput = { owner: string; name: string; prNumber: number; reviewers: string[]; }; type PrReviewsRequestData = { prNumber: number; reviewers: string[]; updated: boolean; }; type ProjectV2ItemAddInput = { owner: string; projectNumber: number; issueUrl: string; }; type ProjectV2ItemAddData = { itemId: string; itemType: string | null; }; type ProjectV2ItemRemoveInput = { owner: string; projectNumber: number; itemId: string; }; type ProjectV2ItemRemoveData = { deletedItemId: string; }; type ProjectV2ItemFieldUpdateInput = { projectId: string; itemId: string; fieldId: string; valueText?: string; valueNumber?: number; valueDate?: string; valueSingleSelectOptionId?: string; valueIterationId?: string; clear?: boolean; }; type ProjectV2ItemFieldUpdateData = { itemId: string; }; /** * High-level GitHub API client with 50+ typed methods. * * Extends {@link GraphqlClient} with domain-specific helpers for issues, PRs, * releases, projects, and repos. Domain modules are lazy-loaded on first use. * * Create via {@link createGithubClientFromToken} or {@link createGithubClient}. */ interface GithubClient extends GraphqlClient { fetchRepoView(input: RepoViewInput): Promise; fetchIssueCommentsList(input: IssueCommentsListInput): Promise; createIssue(input: IssueCreateInput): Promise; updateIssue(input: IssueUpdateInput): Promise; closeIssue(input: IssueMutationInput): Promise; reopenIssue(input: IssueMutationInput): Promise; deleteIssue(input: IssueMutationInput): Promise; updateIssueLabels(input: IssueLabelsUpdateInput): Promise; addIssueLabels(input: IssueLabelsAddInput): Promise; removeIssueLabels(input: IssueLabelsRemoveInput): Promise; updateIssueAssignees(input: IssueAssigneesUpdateInput): Promise; addIssueAssignees(input: IssueAssigneesAddInput): Promise; removeIssueAssignees(input: IssueAssigneesRemoveInput): Promise; setIssueMilestone(input: IssueMilestoneSetInput): Promise; clearIssueMilestone(input: IssueMilestoneClearInput): Promise; createIssueComment(input: IssueCommentCreateInput): Promise; fetchIssueLinkedPrs(input: IssueLinkedPrsListInput): Promise; fetchIssueRelations(input: IssueRelationsGetInput): Promise; setIssueParent(input: IssueParentSetInput): Promise; removeIssueParent(input: IssueParentRemoveInput): Promise; addIssueBlockedBy(input: IssueBlockedByInput): Promise; removeIssueBlockedBy(input: IssueBlockedByInput): Promise; fetchIssueList(input: IssueListInput): Promise; fetchIssueView(input: IssueViewInput): Promise; fetchPrList(input: PrListInput): Promise; fetchPrView(input: PrViewInput): Promise; createPrComment(input: PrCommentCreateInput): Promise; fetchPrCommentsList(input: PrCommentsListInput): Promise; fetchPrReviewsList(input: PrReviewsListInput): Promise; fetchPrReactionsList(input: PrReactionsListInput): Promise; fetchPrCommentsReactionsList(input: PrCommentsReactionsListInput): Promise; fetchPrDiffListFiles(input: PrDiffListFilesInput): Promise; fetchPrMergeStatus(input: PrMergeStatusInput): Promise; replyToReviewThread(input: ReplyToReviewThreadInput): Promise; resolveReviewThread(input: ReviewThreadMutationInput): Promise; unresolveReviewThread(input: ReviewThreadMutationInput): Promise; submitPrReview(input: PrReviewSubmitInput): Promise; fetchRepoLabelsList(input: RepoLabelsListInput): Promise; fetchRepoIssueTypesList(input: RepoIssueTypesListInput): Promise; fetchReleaseView(input: ReleaseViewInput): Promise; fetchReleaseList(input: ReleaseListInput): Promise; fetchProjectV2OrgView(input: ProjectV2OrgViewInput): Promise; fetchProjectV2UserView(input: ProjectV2UserViewInput): Promise; fetchProjectV2FieldsList(input: ProjectV2FieldsListInput): Promise; fetchProjectV2ItemsList(input: ProjectV2ItemsListInput): Promise; createPr(input: PrCreateInput): Promise; updatePr(input: PrUpdateInput): Promise; mergePr(input: PrMergeInput): Promise; closePr(input: PrCloseInput): Promise; updatePrBranch(input: PrBranchUpdateInput): Promise; addPrAssignees(input: PrAssigneesAddInput): Promise; removePrAssignees(input: PrAssigneesRemoveInput): Promise; requestPrReviews(input: PrReviewsRequestInput): Promise; addProjectV2Item(input: ProjectV2ItemAddInput): Promise; removeProjectV2Item(input: ProjectV2ItemRemoveInput): Promise; updateProjectV2ItemField(input: ProjectV2ItemFieldUpdateInput): Promise; } /** * Create a {@link GithubClient} from a token (string or options object). * * Uses the default `fetch`-based transport. For custom transports, use * {@link createGithubClient} instead. * * @throws If the token is empty. */ declare function createGithubClientFromToken(tokenOrOptions: string | TokenClientOptions): GithubClient; /** * Create a {@link GithubClient} from a custom {@link GraphqlTransport}. * * Use this for enterprise endpoints, proxies, or test mocking. */ declare function createGithubClient(transport: GraphqlTransport): GithubClient; /** * Cache for Phase 1 resolution lookups in batch execution. * * Avoids redundant GraphQL lookups when the same entity is referenced * by multiple steps in a chain. */ interface ResolutionCache { get(key: string): unknown | undefined; set(key: string, value: unknown): void; clear(): void; /** Current store size; may include expired entries due to lazy eviction. */ readonly size: number; } interface ResolutionCacheOptions { /** Time-to-live in milliseconds. Default: 60 000 (1 min). */ ttlMs?: number; /** Maximum number of cached entries. Default: 200. */ maxEntries?: number; } /** * Create an in-memory resolution cache with TTL and FIFO eviction. * * Pass to `ExecutionDeps.resolutionCache` for batch operations. */ declare function createResolutionCache(opts?: ResolutionCacheOptions): ResolutionCache; /** Build a deterministic cache key from an operation name and variables. */ declare function buildCacheKey(operationName: string, variables: Record): string; /** * Dependencies required by the execution engine. * * Pass to {@link executeTask} or {@link executeTasks}. */ type ExecutionDeps = { githubClient: GithubClient; githubToken?: string | null; cliRunner?: CliCommandRunner; ghCliAvailable?: boolean; ghAuthenticated?: boolean; skipGhPreflight?: boolean; reason?: RouteReasonCode; resolutionCache?: ResolutionCache; }; /** * Execute a single GitHub operation. * * Looks up the operation card, validates input, selects a route, and returns * a {@link ResultEnvelope}. Never throws. */ declare function executeTask(request: TaskRequest, deps: ExecutionDeps): Promise; /** * Execute multiple operations as a batch. * * Classifies steps, resolves node IDs via Phase 1 lookups, batches GraphQL * operations, and returns a {@link ChainResultEnvelope}. */ declare function executeTasks(requests: Array<{ task: string; input: Record; }>, deps: ExecutionDeps): Promise; export { type AttemptMeta, type CapabilityExplanation, type CapabilityListItem, type ChainResultEnvelope, type ChainStatus, type ChainStepResult, type CliCommandRunner, type GithubClient, type GraphqlClient, type GraphqlError, type GraphqlRawResult, type GraphqlTransport, type OperationCard, type ResolutionCache, type ResolutionCacheOptions, type ResultEnvelope, type ResultError, type ResultMeta, type RouteReasonCode, type RouteSource, type TaskRequest, type TokenClientOptions, type TokenResolution, buildCacheKey, createExecuteTool, createGithubClient, createGithubClientFromToken, createGraphqlClient, createResolutionCache, createSafeCliCommandRunner, executeTask, executeTasks, explainCapability, getOperationCard, invalidateTokenCache, listCapabilities, listOperationCards, resolveGithubToken };