import { type ReactNode } from "react"; import { type ManualRepositoryAttachResult } from "./manual-repository-editor.js"; import { type RepoDraft, type RepositoryGroup } from "../lib/session-tools.js"; import type { GitHubAppSetupMode, GitHubBindingStatus, GitHubInstallationBinding, GitHubRepository, PersonalGitHubConnectionStatusResponse, PersonalGitHubRepositoryCatalogItem, ResourceRef } from "../types.js"; export declare function repositoryBindingPresentation(status: GitHubBindingStatus, installUrl: string | null, setupMode?: GitHubAppSetupMode): { setupDescription: string; emptyDescription: string; connectUrl: string | null; connectLabel: string; healthy: boolean; canRefresh: boolean; }; export type RepositoryContextPickerProps = { setupMode: GitHubAppSetupMode; configured: boolean; status: GitHubBindingStatus; installUrl: string | null; linkUrl: string | null; installations: GitHubInstallationBinding[]; repositories: GitHubRepository[]; personalGitHubStatus?: PersonalGitHubConnectionStatusResponse | null | undefined; personalGitHubRepositories?: PersonalGitHubRepositoryCatalogItem[] | undefined; selectedPersonalGitHubRepoIds?: Set | undefined; selectedPersonalGitHubRepoRefs?: Record | undefined; personalGitHubBusy?: boolean | undefined; onConnectPersonalGitHub?: (() => void) | undefined; onTogglePersonalGitHubRepo?: ((repo: PersonalGitHubRepositoryCatalogItem) => void) | undefined; onPersonalGitHubRefChange?: ((repositoryId: string, ref: string) => void) | undefined; groups: RepositoryGroup[]; selectedRepoIds: Set; selectedRepoRefs: Record; manualRepos: RepoDraft[]; manualOpen: boolean; org: string; pending: boolean; repoBusy: boolean; /** * The workspace's GitHub status or repository list failed to load and no * earlier list is shown. The menu says so instead of offering setup. */ githubLoadFailed?: boolean | undefined; /** * A later refresh failed while the earlier list is still shown. The menu * keeps the list and says it couldn't update it, with "Try again". */ githubUpdateFailed?: boolean | undefined; githubAppBusy: boolean; /** * Reloads both catalogs now (a manager's reload also syncs from GitHub). The * list refreshes itself on open and after GitHub flows; this backs the * "Try again" shown after a failed load. */ onRefresh: () => Promise; /** Passive open refresh. Caller owns provider-sync permissions and throttling. */ onOpenRefresh?: (() => Promise) | undefined; /** * The person is leaving to change GitHub access (on GitHub or the GitHub * settings page). The caller refreshes both catalogs, unthrottled, once they * are back. */ onLeaveForGitHub?: (() => void) | undefined; /** False when the current principal cannot read either repository catalog. */ refreshAllowed?: boolean | undefined; onToggleRepo: (repo: GitHubRepository) => void; onRefChange: (repoId: number, ref: string) => void; onManualOpenChange: (open: boolean) => void; onManualAdd: () => void; onManualUpdate: (id: number, patch: Partial) => void; onManualRemove: (id: number) => void; onManualAttach?: ((repository: RepoDraft) => Promise) | undefined; onLoadGitHubBranches?: ((repository: GitHubRepository) => Promise) | undefined; onLoadPersonalGitHubBranches?: ((repository: PersonalGitHubRepositoryCatalogItem) => Promise) | undefined; onOrgChange: (value: string) => void; onStartGitHubApp: () => void; /** * Starts workspace App setup. The link is minted on click: `installUrl` only * gates whether this principal may connect, because a page-load link expires. */ onConnectWorkspaceApp: () => void; /** Repositories already mounted on an additive surface cannot be removed or retargeted. */ lockedRepoIds?: ReadonlySet | undefined; /** Opens the chooser for which personal repositories Opengeni may use. */ personalGitHubManageUrl?: string | undefined; /** * The workspace's GitHub settings, where people manage both ways of * connecting (their own GitHub and the Opengeni app): repositories, * installations and unlinking. The picker links here once anything is connected. */ githubSettingsUrl?: string | undefined; /** Personal repositories already mounted on an additive surface cannot be removed or retargeted. */ lockedPersonalGitHubRepoIds?: ReadonlySet | undefined; /** Manual rows already mounted on an additive surface are rendered read-only. */ lockedManualRepoIds?: ReadonlySet | undefined; /** Mounted personal sources may outlive their currently authorized catalog entry. */ unavailableMountedRepositories?: ReadonlyArray<{ uri: string; ref: string; }> | undefined; /** * Switching a mounted repository off asks to remove it from the chat. Without * it, mounted repositories stay locked. */ onRemoveMountedRepository?: ((target: MountedRepositoryTarget) => void) | undefined; /** Inline validation for pending manual repository additions. */ validationError?: string | null | undefined; /** New-chat route used to explain immutable mounted follow-up resources. */ newChatUrl?: string | undefined; /** Optional back control when embedded in the mobile “+” drill-in. */ leading?: ReactNode | undefined; /** Extra classes on the bar trigger (e.g. `max-sm:hidden` when opened from +). */ triggerClassName?: string | undefined; }; /** A mounted repository row the person switched off. */ export type MountedRepositoryTarget = { kind: "app"; repository: GitHubRepository; } | { kind: "personal"; repository: PersonalGitHubRepositoryCatalogItem; } | { kind: "uri"; uri: string; }; /** Shared picker body — desktop dropdown and mobile “+” drill-in. */ export declare function RepositoryContextMenuBody(props: RepositoryContextPickerProps): import("react").JSX.Element; /** One repository the picker can select, through the workspace App, your GitHub, or both. */ export type RepositoryPickerRow = { key: string; fullName: string; name: string; private: boolean; app: GitHubRepository | null; personal: PersonalGitHubRepositoryCatalogItem | null; }; export type RepositoryPickerRowGroup = { key: string; label: string; rows: RepositoryPickerRow[]; }; /** * Merges App and personal catalogs into one row per repository, grouped by * owner. App installations keep their order; a repository reachable both ways * is one row with both authorities. */ export declare function repositoryPickerRowGroups(groups: readonly RepositoryGroup[], personalRepositories: readonly PersonalGitHubRepositoryCatalogItem[]): RepositoryPickerRowGroup[]; /** * Which identity a new selection acts as: you when your GitHub can write to * the repository (or is the only way to reach it), otherwise the workspace App. */ export declare function defaultRepositoryIdentity(row: RepositoryPickerRow): "personal" | "app"; export declare function RepositoryContextPicker(props: RepositoryContextPickerProps): import("react").JSX.Element; export declare function ScheduledTaskRepositoryPicker(props: { status: GitHubBindingStatus; repositories: GitHubRepository[]; groups: RepositoryGroup[]; resources: ResourceRef[]; busy: boolean; repoBusy: boolean; onRefresh: () => Promise; onResourcesChange: (resources: ResourceRef[]) => void; }): import("react").JSX.Element;