import { APIResource } from "../../core/resource.mjs"; import * as RepoAPI from "./repo.mjs"; import * as FileAPI from "./file.mjs"; import { FileDeleteParams, FileDownloadParams, FileDownloadResponse, FileUploadParams } from "./file.mjs"; import { APIPromise } from "../../core/api-promise.mjs"; import { Stream } from "../../core/streaming.mjs"; import { RequestOptions } from "../../internal/request-options.mjs"; export declare class Repo extends APIResource { file: FileAPI.File; /** * Create a new repository from the provided template. * * @example * ```ts * const repoInfo = await client.repo.create(); * ``` */ create(body: RepoCreateParams, options?: RequestOptions): APIPromise; /** * Retrieve relevant content from a repository based on a query. * * @example * ```ts * const repo = await client.repo.retrieve( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { query: 'x' }, * ); * ``` */ retrieve(repoID: string, body: RepoRetrieveParams, options?: RequestOptions): APIPromise; /** * Apply repository changes. * * See the model docs for details of each update variant: * * - RepoUpdateFiles - snapshot replacement of tracked files * - RepoUpdateDiff - explicit write/delete/rename operations * - RepoUpdateGit - pull & merge from a remote Git repository * * Returns: RepoInfo: Includes the new repo head and, when determinable, a list of * changed files for convenience. * * Error codes: 400: Invalid request type / diff operation / failed remote merge. * 404: Referenced file for delete/rename does not exist. 423: Repository lock * contention. * * @example * ```ts * const repoInfo = await client.repo.update( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * ); * ``` */ update(repoID: string, body: RepoUpdateParams, options?: RequestOptions): APIPromise; /** * Get metadata for all repositories owned by the user. * * @example * ```ts * const repos = await client.repo.list(); * ``` */ list(query?: RepoListParams | null | undefined, options?: RequestOptions): APIPromise; /** * Delete a repository and its associated data. * * @example * ```ts * await client.repo.delete( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * ); * ``` */ delete(repoID: string, options?: RequestOptions): APIPromise; /** * Run a user-defined agent from the template repo configuration. Returns real-time * updates as Server-Sent Events (SSE). * * @example * ```ts * const response = await client.repo.agent( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { * agent_inputs: { * prompt: 'Review this code for security issues', * file_path: 'src/main.py', * }, * agent_name: 'code_review', * }, * ); * ``` */ agent(repoID: string, body: RepoAgentParams, options?: RequestOptions): APIPromise>; /** * Return all readable tracked files in a repository. * * If a `commit` is provided, read file contents from that commit; otherwise read * from the working directory. * * @example * ```ts * const response = await client.repo.clone( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * ); * ``` */ clone(repoID: string, query?: RepoCloneParams | null | undefined, options?: RequestOptions): APIPromise; /** * Get the embedding status for a repository. */ embeddingStatus(repoID: string, query?: RepoEmbeddingStatusParams | null | undefined, options?: RequestOptions): APIPromise; /** * Get metadata for a single repository. * * @example * ```ts * const repoMetadata = await client.repo.get( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * ); * ``` */ get(repoID: string, options?: RequestOptions): APIPromise; /** * Run a user-defined agent from the template repo configuration. Returns real-time * updates as Server-Sent Events (SSE). * * @example * ```ts * const response = await client.repo.search( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { query: 'Find all instances of TODO comments' }, * ); * ``` */ search(repoID: string, body: RepoSearchParams, options?: RequestOptions): APIPromise>; } /** * Text file payload used in create/update requests. * * Attributes: filename: Repository-relative path (POSIX). Directories are created * as needed. Treated as UTF-8 text; binary content should be avoided. content: * Full in-memory textual content to write. */ export interface File { content: string; filename: string; } export interface RepoInfo { repo_head: string; repo_id: string; changed_files?: Array | null; } export interface RepoMetadata { auto_index: boolean; created_at: string; metadata: { [key: string]: string; } | null; repo_id: string; updated_at: string | null; } export interface RepoRetrieveResponse { hash: string; pending_embeddings: number; results: Array; } export declare namespace RepoRetrieveResponse { interface Result { filename: string; score: number; content?: string | null; } } export interface RepoListResponse { items: Array; total_items: number; next_page?: number | null; } /** * Server-Sent Events stream */ export type RepoAgentResponse = { event?: string | null; data: any; }; /** * Response containing all readable files in a repository. */ export interface RepoCloneResponse { files: Array; } export interface RepoEmbeddingStatusResponse { completed_embeddings: number; hash: string; pending_embeddings: number; } export interface RepoCreateParams { auto_index?: boolean; metadata?: { [key: string]: string; } | null; source?: RepoCreateParams.RepoCreateGitSource | RepoCreateParams.RepoCreateFilesSource | RepoCreateParams.RepoCreateRelaceSource | null; } export declare namespace RepoCreateParams { interface RepoCreateGitSource { type: 'git'; url: string; branch?: string | null; hash?: string | null; } interface RepoCreateFilesSource { files: Array; type: 'files'; } interface RepoCreateRelaceSource { repo_id: string; type: 'relace'; copy_metadata?: boolean; copy_remote?: boolean; } } export interface RepoRetrieveParams { query: string; branch?: string | null; hash?: string | null; include_content?: boolean; rerank?: boolean; score_threshold?: number; token_limit?: number; } export interface RepoUpdateParams { metadata?: { [key: string]: string; } | null; /** * Snapshot-style repository update. * * Treat the provided `files` list as the complete authoritative set of tracked * text files. Any previously tracked file that is not present in the list will be * deleted. Each listed file is created or overwritten. * * This mirrors the semantics of replacing the working tree with exactly the * supplied set (excluding ignored/untracked items). Binary files are skipped * downstream during embedding. * * Attributes: type: Discriminator literal `"files"`. files: List of files that * should exist after the operation. */ source?: RepoUpdateParams.RepoUpdateFiles | RepoUpdateParams.RepoUpdateDiff | RepoUpdateParams.RepoUpdateGit | null; } export declare namespace RepoUpdateParams { /** * Snapshot-style repository update. * * Treat the provided `files` list as the complete authoritative set of tracked * text files. Any previously tracked file that is not present in the list will be * deleted. Each listed file is created or overwritten. * * This mirrors the semantics of replacing the working tree with exactly the * supplied set (excluding ignored/untracked items). Binary files are skipped * downstream during embedding. * * Attributes: type: Discriminator literal `"files"`. files: List of files that * should exist after the operation. */ interface RepoUpdateFiles { files: Array; type: 'files'; } /** * Explicit patch consisting of write/delete/rename operations. * * Operations are collected and then applied in three phases: deletes, writes, * renames. Within a single request duplicate operations targeting the same path * are not currently validated; the _last_ write wins for a file, and the final * mapping for each rename source path is used. Future improvements may add * canonicalisation/validation. * * Attributes: type: Discriminator literal `"diff"`. operations: Heterogeneous list * of file operations (see individual operation model docstrings for semantics). */ interface RepoUpdateDiff { operations: Array; type: 'diff'; } namespace RepoUpdateDiff { /** * Create or overwrite a file with textual content. * * Used inside a :class:`RepoUpdateDiff`. The final content for a path is the value * from the last write operation targeting that path within the request (operations * are aggregated; order is not otherwise significant). * * Attributes: type: Discriminator literal `"write"`. filename: Target file path * (created if missing; parent dirs auto-created). content: UTF-8 text content. */ interface FileWriteOperation { content: string; filename: string; type: 'write'; } /** * Delete a file or (recursively) a directory. * * If the referenced path does not exist the update request fails with 404. * * Attributes: type: Discriminator literal `"delete"`. filename: File or directory * path to remove. */ interface FileDeleteOperation { filename: string; type: 'delete'; } /** * Rename (move) a file. * * Renames are applied after all writes and deletes have been processed to avoid * transient conflicts. The source path must exist at execution time or the request * fails with 404. Directory renames are not currently supported explicitly (only * existing paths that resolve to files are expected). * * Attributes: type: Discriminator literal `"rename"`. old_filename: Existing file * path. new_filename: Destination file path (created parent dirs as needed). */ interface FileRenameOperation { new_filename: string; old_filename: string; type: 'rename'; } } interface RepoUpdateGit { type: 'git'; url: string; branch?: string | null; } } export interface RepoListParams { created_after?: string | null; created_before?: string | null; filter_metadata?: string | null; order_by?: 'created_at' | 'updated_at'; order_descending?: boolean; page_size?: number; page_start?: number; } export interface RepoAgentParams { /** * Input parameters for the agent */ agent_inputs: { [key: string]: string; }; /** * Name of the agent to run */ agent_name: string; /** * Whether to continue from previous chat history */ continue?: boolean; /** * Optional configuration overrides for agent execution */ overrides?: RepoAgentParams.Overrides | null; } export declare namespace RepoAgentParams { /** * Optional configuration overrides for agent execution */ interface Overrides { /** * Maximum tokens for model output */ max_tokens?: number | null; /** * Maximum number of turns in the conversation */ max_turns?: number | null; /** * Model name to use for agent execution */ model_name?: string | null; /** * Number of retries for failed prompts */ prompt_retries?: number | null; /** * Timeout in seconds for prompt execution */ prompt_timeout?: number | null; /** * System prompt override */ system?: string | null; /** * List of tools to enable */ tools?: Array | null; /** * User prompt override */ user?: string | null; } } export interface RepoCloneParams { commit?: string | null; } export interface RepoEmbeddingStatusParams { branch?: string | null; hash?: string | null; } export interface RepoSearchParams { /** * Search query string */ query: string; } export declare namespace Repo { export { type File as File, type RepoInfo as RepoInfo, type RepoMetadata as RepoMetadata, type RepoRetrieveResponse as RepoRetrieveResponse, type RepoListResponse as RepoListResponse, type RepoAgentResponse as RepoAgentResponse, type RepoCloneResponse as RepoCloneResponse, type RepoEmbeddingStatusResponse as RepoEmbeddingStatusResponse, type RepoCreateParams as RepoCreateParams, type RepoRetrieveParams as RepoRetrieveParams, type RepoUpdateParams as RepoUpdateParams, type RepoListParams as RepoListParams, type RepoAgentParams as RepoAgentParams, type RepoCloneParams as RepoCloneParams, type RepoEmbeddingStatusParams as RepoEmbeddingStatusParams, type RepoSearchParams as RepoSearchParams, }; export { type FileDownloadResponse as FileDownloadResponse, type FileDeleteParams as FileDeleteParams, type FileDownloadParams as FileDownloadParams, type FileUploadParams as FileUploadParams, }; } //# sourceMappingURL=repo.d.mts.map