import type { DocdexCapabilitySnapshot } from "../cognitive/Types.js"; export interface DocdexClientOptions { baseUrl: string; repoRoot?: string; repoId?: string; authToken?: string; apiKey?: string; clientIdentity?: string; clientProduct?: string; credentialSource?: "attached_mswarm_api_key" | string; required?: boolean; allowedOperations?: readonly string[]; capabilities?: Record; immutableRuntimeContext?: boolean; dagSessionId?: string; } export type DocdexRuntimeErrorCode = "missing_credentials" | "repo_access_denied" | "scope_denied" | "encrypted_operation_disabled" | "docdex_context_missing" | "docdex_api_key_missing" | "docdex_operation_not_allowed" | "docdex_auth_failed" | "docdex_repo_access_denied" | "docdex_unavailable"; export type DocdexRuntimeOperation = "health" | "initialize" | "search" | "snippet" | "open" | "symbols" | "ast" | "impact_graph" | "impact_diagnostics" | "dag_export" | "tree" | "memory_save" | "memory_recall" | "profile_read" | "profile_write" | "web_research" | "chat_context" | "rerank" | "batch_search" | "capabilities" | "stats" | "files" | "repo_inspect" | "index_rebuild" | "index_ingest" | "delegate" | "hooks_validate"; export interface DocdexRuntimeErrorOptions { status?: number; retryable?: boolean; details?: Record; } export declare class DocdexRuntimeError extends Error { readonly code: DocdexRuntimeErrorCode; readonly status?: number; readonly retryable: boolean; readonly details?: Record; constructor(code: DocdexRuntimeErrorCode, message: string, options?: DocdexRuntimeErrorOptions); } export interface DocdexSearchOptions { limit?: number; dagSessionId?: string; /** Skip the local index and go straight to web discovery. */ forceWeb?: boolean; } export interface DocdexSnippetOptions { window?: number; textOnly?: boolean; /** * Centres the returned window on the part of the file that matches this text. * Without it the snippet starts at line one, which for a code file is the * import block — rarely the part that answers anything. */ query?: string; } export interface DocdexImpactOptions { maxDepth?: number; maxEdges?: number; edgeTypes?: string[]; } export interface DocdexDagOptions { format?: "json" | "text" | "dot"; maxNodes?: number; } export interface DocdexImpactDiagnosticsOptions { limit?: number; offset?: number; file?: string; } export interface DocdexTreeOptions { path?: string; maxDepth?: number; dirsOnly?: boolean; includeHidden?: boolean; extraExcludes?: string[]; } export interface DocdexOpenFileOptions { startLine?: number; endLine?: number; head?: number; clamp?: boolean; } export interface DocdexChatMessage { role: string; content: string | Array>; name?: string; tool_call_id?: string; tool_calls?: unknown; } export interface DocdexChatContextOptions { model?: string; maxTokens?: number; temperature?: number; docdex?: Record; } export interface DocdexWebResearchOptions { forceWeb?: boolean; skipLocalSearch?: boolean; webLimit?: number; noCache?: boolean; } export interface DocdexWriteMetadata { [key: string]: unknown; } export declare const isDocdexRuntimeErrorCode: (value: unknown) => value is DocdexRuntimeErrorCode; export declare const normalizeDocdexRuntimeOperation: (value: string) => DocdexRuntimeOperation | undefined; /** * The repository root to disclose to docdex, if any. * * A remote, tenant-scoped repository is addressed by `repoId`; there is no * local checkout behind it. Defaulting the root to the process working * directory sent the *server's* filesystem path to docdex as * `x-docdex-repo-root` on every tenant request — a path that belongs to the * host, describes no repository the tenant owns, and has no business leaving * the machine. A host that does mean a local checkout says so with * `repo.root`. */ export declare const docdexRepoRootFor: (contextRepoRoot: string | undefined, repoId: string | undefined, workspaceRoot: string) => string | undefined; export declare class DocdexClient { private options; private repoId?; private dagSessionId?; private healthChecked; private repoInitializeAttempted; private capabilitySnapshot?; constructor(options: DocdexClientOptions); setRepoId(repoId: string): void; getRepoId(): string | undefined; getRepoRoot(): string | undefined; setDagSessionId(sessionId: string): void; getDagSessionId(): string | undefined; clearCapabilityCache(): void; private runtimeAllowedOperations; private runtimeCapability; private isImmutableRuntimeContext; private missingCredentialCode; private missingScopeCode; private operationDisabledCode; private redactSensitiveText; private runtimeError; private assertRuntimeContext; private assertOperationAllowed; private resolveBaseUrl; private isEncryptedSearchGateway; private encryptedEnvelopeMeta; private normalizeEncryptedSearchPayload; private normalizeEncryptedWebPayload; private buildHeaders; private ensureHealth; healthCheck(): Promise; initialize(rootUri: string): Promise<{ repoId?: string; repoRoot?: string; }>; private initializeRepo; private ensureRepoInitialized; private withRepoId; private extractErrorCode; private mapResponseErrorCode; private responseRequestId; private attachResponseMetadata; private throwResponseError; private throwResponseBodyError; search(query: string, options?: DocdexSearchOptions): Promise; openSnippet(docId: string, options?: DocdexSnippetOptions): Promise; impactGraph(file: string, options?: DocdexImpactOptions): Promise; impactDiagnostics(options?: DocdexImpactDiagnosticsOptions): Promise; indexRebuild(libsSources?: string): Promise; indexIngest(file: string): Promise; hooksValidate(files: string[]): Promise; delegate(payload: Record): Promise; chatContext(messages: DocdexChatMessage[], options?: DocdexChatContextOptions): Promise; dagExport(sessionId: string, options?: DocdexDagOptions): Promise; callMcp(method: string, params: Record): Promise; private normalizeMcpResult; private tryParseJson; private buildProjectParams; private defaultCapabilityMap; private toCapabilityStatus; private normalizeCapabilityPayload; symbols(pathValue: string): Promise; ast(pathValue: string, maxNodes?: number): Promise; stats(): Promise; files(limit?: number, offset?: number): Promise; repoInspect(): Promise; memorySave(text: string, metadata?: DocdexWriteMetadata): Promise; memoryRecall(query: string, topK?: number): Promise; tree(options?: DocdexTreeOptions): Promise; openFile(pathValue: string, options?: DocdexOpenFileOptions): Promise; getProfile(agentId?: string): Promise; savePreference(agentId: string, category: string, content: string, metadata?: DocdexWriteMetadata): Promise; webResearch(query: string, options?: DocdexWebResearchOptions): Promise; private webResearchHttp; rerank(query: string, candidates: unknown[], limit?: number): Promise; batchSearch(queries: string[], options?: { limit?: number; includeLibs?: boolean; }): Promise; getCapabilities(forceRefresh?: boolean): Promise; } //# sourceMappingURL=DocdexClient.d.ts.map