import type { PersonalResourceAttachmentIntent, SendMessageInput } from "@opengeni/sdk"; import type { GitHubRepository, ResourceRef } from "../../types.js"; type RepositoryResource = Extract; /** * What an ordinary composer Send would carry right now, read at click time, so * a card's human attach follows the composer's own Send rules. */ export type ChatSendContext = { /** Why the chat cannot take a Send now, in words; null when it can. */ blocked: string | null; /** The chat waits on a human answer; a Send replaces that request. */ awaitingHuman: boolean; /** * The owner's consent to use their own Connected Machine in this chat, sent * with the message that moves the chat onto it. Undefined when the chat's * authority is unknown. */ personalMachineIntent?: PersonalResourceAttachmentIntent | undefined; extras: Partial<{ model: string; reasoningEffort: SendMessageInput["reasoningEffort"]; latencyMode: SendMessageInput["latencyMode"]; controlEtag: string; connectionAccounts: NonNullable; personalResourceAttachment: PersonalResourceAttachmentIntent; }>; }; /** Rows shown before "Show more". */ export declare const GITHUB_CARD_PAGE_SIZE = 5; /** Rows each "Show more" click reveals. */ export declare const GITHUB_CARD_MORE_SIZE = 20; /** The list offers search once scanning it by eye stops being quick. */ export declare const GITHUB_CARD_SEARCH_THRESHOLD = 6; export type GitHubRepositoryChatState = { kind: "available"; resource: RepositoryResource; } | { kind: "attached"; } | { kind: "blocked"; cause: "other_account" | "mount_conflict"; reason: string; /** The account whose App token this chat already uses. */ usingAccount?: string | undefined; }; /** * What "Use in this chat" may do for one workspace App repository. It applies * the composer picker's own rules to the chat's mounted resources: a repository * already mounted (by App identity, or as the member's personal identity) is * already usable, one GitHub App token per chat, and resources are additive, so * a mount-path collision is refused here instead of by the server. */ export declare function gitHubRepositoryChatState(repository: GitHubRepository, mounted: readonly ResourceRef[], accountLabel: (installationId: number) => string, catalog: readonly GitHubRepository[]): GitHubRepositoryChatState; /** * App repositories this chat mounted that the workspace catalog no longer * lists: GitHub access was removed after the chat started. Only a loaded * catalog can prove absence; an unloaded or failed one is unknown. */ export declare function revokedGitHubRepositoryResources(mounted: readonly ResourceRef[], catalog: readonly GitHubRepository[], catalogReady: boolean): RepositoryResource[]; /** The ordinary human message that carries the repository. Short and natural. */ export declare function repositoryUseMessage(repository: Pick): string; /** Mounted repositories first (what the chat already uses), then by name. */ export declare function orderRepositoriesForChat(repositories: readonly GitHubRepository[], isAttached: (repository: GitHubRepository) => boolean): GitHubRepository[]; export declare function matchesRepositorySearch(repository: GitHubRepository, query: string): boolean; /** "Using acme/api in this chat", naming at most one repository. */ export declare function usingRepositoriesLabel(fullNames: readonly string[]): string | null; export {};