import type { CursorPluginConfig } from "./config"; import type { GitRemote, RepositoryIndexMetadata, RepositoryIndexMetadataSource } from "./workspace-context"; export interface CursorCloudRepositoryContext { workspacePath: string; relativeWorkspacePath: string; repoName: string; repoOwner: string; remotes: GitRemote[]; isTracked: boolean; isLocal: boolean; } export interface CursorCloudCodeResult { path: string; contents: string; score: number; startLine?: number; endLine?: number; } export interface CursorCloudUploadFile { relativePath: string; contents: string; hash: string; ancestorPaths: string[]; updateType?: "add" | "modify"; } export interface CursorCloudCodebaseInfo { codebaseId: string; status: number; } export interface CursorCloudHandshakeResult { status: number; codebases: CursorCloudCodebaseInfo[]; } export interface CursorCloudSyncCodebaseStatus { codebaseId: string; success: boolean; totalUploadCount: number; failedUploadCount: number; totalDeleteCount?: number; failedDeleteCount?: number; totalSubtreeCount?: number; failedSubtreeCount?: number; } export interface CursorCloudMerkleChild { relativePath: string; encryptedRelativePath: string; hash: string; } export interface CursorCloudMerkleResult { match: boolean; children: CursorCloudMerkleChild[]; } export interface StoredRepositoryKeys { repoName: string; orthogonalTransformationSeed: number; pathEncryptionKey: string; pathEncryptionScheme: "aes-256-ctr" | "plaintext"; canUpdateKey: boolean; source?: RepositoryIndexMetadataSource; } export declare const CURSOR_CODEBASE_STATUS: { readonly UP_TO_DATE: 1; readonly OUT_OF_SYNC: 2; readonly EMPTY: 3; readonly EMPTY_WITH_COPY_AVAILABLE: 4; readonly COPY_IN_PROGRESS: 5; }; export declare function encryptCursorPath(value: string, pathEncryptionKey: string): string; export declare function decryptCursorPath(value: string, pathEncryptionKey: string): string; export declare function makeLegacyRepoName(workspacePath: string): string; export declare function resolveStoredCursorIndexMetadata(context: CursorCloudRepositoryContext, env?: NodeJS.ProcessEnv, _config?: CursorPluginConfig): Promise; export declare function encodeSearchRepositoryRequest(query: string, context: CursorCloudRepositoryContext, metadata: RepositoryIndexMetadata, topK?: number): Uint8Array; export declare function encodeFastRepoInitHandshakeV2Request(context: CursorCloudRepositoryContext, metadata: RepositoryIndexMetadata, fileCount: number, rootHash: string, similarityMetric?: readonly number[]): Uint8Array; export declare function encodeFastUpdateFileV2Request(codebaseId: string, metadata: RepositoryIndexMetadata, files: CursorCloudUploadFile[]): Uint8Array; export declare function encodeSyncMerkleSubtreeV2Request(codebaseId: string, metadata: RepositoryIndexMetadata, relativePath: string, hash: string): Uint8Array; export declare function encodeFastDeletePathV2Request(codebaseId: string, metadata: RepositoryIndexMetadata, encryptedRelativePath: string, ancestors: string[]): Uint8Array; export declare function encodeEnsureIndexCreatedRequest(context: CursorCloudRepositoryContext, metadata: RepositoryIndexMetadata): Uint8Array; export declare function encodeFastRepoSyncCompleteRequest(codebases: CursorCloudSyncCodebaseStatus[], metadata: RepositoryIndexMetadata, similarityMetric?: readonly number[]): Uint8Array; export declare function decodeSyncMerkleSubtreeV2Response(payload: Uint8Array, pathEncryptionKey: string): CursorCloudMerkleResult; export declare function decodeFastRepoInitHandshakeV2Response(payload: Uint8Array): CursorCloudHandshakeResult; export declare function decodeFastUpdateFileV2ResponseStatus(payload: Uint8Array): number; export declare function isFastUpdateFileV2Success(payload: Uint8Array): boolean; export type CursorSearchResponseDecode = { classification: "valid-results"; results: CursorCloudCodeResult[]; } | { classification: "valid-empty"; results: []; } | { classification: "empty-body"; results: []; } | { classification: "invalid-response"; results: []; }; export declare function decodeSearchRepositoryResponse(payload: Uint8Array, pathEncryptionKey: string): CursorSearchResponseDecode; /** * SemSearchFast: server-streaming Connect search RPC. * * Request: SemSearchRequest{1: SearchRepositoryRequest{1:query, 2:repository, 3:top_k}} * The transport wraps this in a Connect envelope (5-byte prefix) before sending. * * Response: Connect stream frames → SemSearchResponse{1: response: SearchRepositoryResponse{1: code_results[]}} * The client reads only the first data frame, per the decompiled cursor-agent. */ export declare function encodeSemSearchFastRequest(query: string, context: CursorCloudRepositoryContext, metadata: RepositoryIndexMetadata, topK?: number): Uint8Array; export declare function decodeSemSearchFastResponse(payload: Uint8Array, pathEncryptionKey: string): CursorSearchResponseDecode; /** Extract a Connect error from a streaming response's end-stream frame. */ export declare function parseConnectStreamingError(payload: Uint8Array): { code: string; message: string; } | undefined; export declare const __test: { makeLegacyRepoName: typeof makeLegacyRepoName; encodeStringField(field: number, value: string): number[]; resolveStoredCursorIndexMetadataWithImportedKeys(context: CursorCloudRepositoryContext, env: NodeJS.ProcessEnv, imported: StoredRepositoryKeys): Promise; };