import type { GetProjectViewTableResult, GitHubProjectCommentMutationResult, GitHubProjectMutationResult, ListAccessibleProjectsResult, ListAssignableUsersBySlugResult, ListIssueTypesBySlugResult, ListLabelsBySlugResult, ListProjectViewsResult, ProjectWorkItemDetailsBySlugResult, ResolveProjectRefResult } from '../../shared/github/project-result-types' import type { AddIssueCommentBySlugArgs, ClearProjectItemFieldArgs, DeleteIssueCommentBySlugArgs, GetProjectViewTableArgs, ListAccessibleProjectsArgs, ListAssignableUsersBySlugArgs, ListIssueTypesBySlugArgs, ListLabelsBySlugArgs, ListProjectViewsArgs, ProjectWorkItemDetailsBySlugArgs, ResolveProjectRefArgs, UpdateIssueBySlugArgs, UpdateIssueCommentBySlugArgs, UpdateIssueTypeBySlugArgs, UpdateProjectItemFieldArgs, UpdatePullRequestBySlugArgs } from '../../shared/github/project-request-types' import type { TaskSourceContext } from '../../shared/task-source-context' import type { GitHubCommentResult } from '../../shared/github/comment-types' import type { GitHubAssignableUser, GitHubOwnerRepo, IssueInfo } from '../../shared/github/pull-request-types' import type { GitHubWorkItem, GitHubWorkItemDetails, ListWorkItemsResult } from '../../shared/github/work-item-types' import type { GitHubCreateIssueResult, GitHubIssueUpdate } from '../../shared/issue-mutation-types' export type GitHubRepoSelectorArgs = { repoPath: string repoId?: string | null sourceContext?: TaskSourceContext | null } export type GithubWorkItemApi = { issue: (args: { repoPath: string repoId?: string sourceContext?: TaskSourceContext | null number: number }) => Promise workItem: (args: { repoPath: string repoId?: string sourceContext?: TaskSourceContext | null number: number type?: 'issue' | 'pr' }) => Promise | null> workItemByOwnerRepo: (args: { repoPath: string repoId?: string sourceContext?: TaskSourceContext | null owner: string repo: string host?: string number: number type: 'issue' | 'pr' }) => Promise | null> workItemDetails: ( args: GitHubRepoSelectorArgs & { number: number type?: 'issue' | 'pr' ownerRepo?: GitHubOwnerRepo } ) => Promise notifyWorkItemMutated: (args: { repoPath: string repoId?: string type: 'issue' | 'pr' number: number }) => Promise listIssues: (args: { repoPath: string; repoId?: string; limit?: number }) => Promise createIssue: (args: { repoPath: string repoId?: string sourceContext?: TaskSourceContext | null title: string body: string labels?: string[] assignees?: string[] }) => Promise countWorkItems: (args: { repoPath: string; repoId?: string; query?: string }) => Promise listWorkItems: (args: { repoPath: string repoId?: string limit?: number query?: string page?: number noCache?: boolean }) => Promise>> updateIssue: ( args: GitHubRepoSelectorArgs & { number: number updates: GitHubIssueUpdate ownerRepo?: GitHubOwnerRepo } ) => Promise<{ ok: true } | { ok: false; error: string }> addIssueComment: ( args: GitHubRepoSelectorArgs & { number: number body: string /** Keep PR and issue cache invalidation separate when their numbers match. */ type?: 'issue' | 'pr' prRepo?: GitHubOwnerRepo | null } ) => Promise listLabels: (args: { repoPath: string repoId?: string sourceContext?: TaskSourceContext | null ownerRepo?: GitHubOwnerRepo }) => Promise listAssignableUsers: (args: { repoPath: string repoId?: string sourceContext?: TaskSourceContext | null ownerRepo?: GitHubOwnerRepo }) => Promise /** Invalidate work-item caches across windows after local mutations. */ onWorkItemMutated: ( callback: (payload: { repoPath: string repoId?: string type: 'issue' | 'pr' number: number }) => void ) => () => void listAccessibleProjects: ( args?: ListAccessibleProjectsArgs ) => Promise resolveProjectRef: (args: ResolveProjectRefArgs) => Promise listProjectViews: (args: ListProjectViewsArgs) => Promise getProjectViewTable: (args: GetProjectViewTableArgs) => Promise projectWorkItemDetailsBySlug: ( args: ProjectWorkItemDetailsBySlugArgs ) => Promise updateProjectItemField: (args: UpdateProjectItemFieldArgs) => Promise clearProjectItemField: (args: ClearProjectItemFieldArgs) => Promise updateIssueBySlug: (args: UpdateIssueBySlugArgs) => Promise updatePullRequestBySlug: ( args: UpdatePullRequestBySlugArgs ) => Promise addIssueCommentBySlug: ( args: AddIssueCommentBySlugArgs ) => Promise updateIssueCommentBySlug: ( args: UpdateIssueCommentBySlugArgs ) => Promise deleteIssueCommentBySlug: ( args: DeleteIssueCommentBySlugArgs ) => Promise listLabelsBySlug: (args: ListLabelsBySlugArgs) => Promise listAssignableUsersBySlug: ( args: ListAssignableUsersBySlugArgs ) => Promise listIssueTypesBySlug: (args: ListIssueTypesBySlugArgs) => Promise updateIssueTypeBySlug: (args: UpdateIssueTypeBySlugArgs) => Promise }