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 owner: string repo: string host?: string number: number type: 'issue' | 'pr' }) => Promise | null> workItemDetails: ( args: GitHubRepoSelectorArgs & { number: number type?: 'issue' | 'pr' } ) => 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 } ) => Promise<{ ok: true } | { ok: false; error: string }> addIssueComment: ( args: GitHubRepoSelectorArgs & { number: number body: string /** Why: scopes the cross-window cache invalidation so a PR and issue sharing the same number don't evict each other. */ type?: 'issue' | 'pr' prRepo?: GitHubOwnerRepo | null } ) => Promise listLabels: (args: { repoPath: string repoId?: string sourceContext?: TaskSourceContext | null }) => Promise listAssignableUsers: (args: { repoPath: string repoId?: string sourceContext?: TaskSourceContext | null }) => Promise /** Subscribe to local-mutation broadcasts so the work-item-drawer cache can invalidate across windows. Returns an unsubscribe. */ onWorkItemMutated: ( callback: (payload: { repoPath: string repoId?: string type: 'issue' | 'pr' number: number }) => void ) => () => void // ── ProjectV2 (GitHub Projects) ───────────────────────────────── 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 }