import * as Yargs from 'yargs'; import z from 'zod'; declare enum AiBlameInferenceType { Chat = "CHAT", HumanEdit = "HUMAN_EDIT", TabAutocomplete = "TAB_AUTOCOMPLETE" } type SanitizationCounts = { detections: { total: number; high: number; medium: number; low: number; }; }; type Logger = { info: (msg: string, data?: unknown) => void; error: (msg: string, data?: unknown) => void; }; declare const PromptItemZ: z.ZodObject<{ type: z.ZodEnum<{ AI_RESPONSE: "AI_RESPONSE"; AI_THINKING: "AI_THINKING"; MCP_TOOL_CALL: "MCP_TOOL_CALL"; TOOL_EXECUTION: "TOOL_EXECUTION"; USER_PROMPT: "USER_PROMPT"; }>; attachedFiles: z.ZodOptional; }, z.core.$strip>>>; tokens: z.ZodOptional>; text: z.ZodOptional; date: z.ZodOptional; tool: z.ZodOptional; accepted: z.ZodOptional; mcpServer: z.ZodOptional; mcpToolName: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type PromptItem = z.infer; declare const PromptItemArrayZ: z.ZodArray; attachedFiles: z.ZodOptional; }, z.core.$strip>>>; tokens: z.ZodOptional>; text: z.ZodOptional; date: z.ZodOptional; tool: z.ZodOptional; accepted: z.ZodOptional; mcpServer: z.ZodOptional; mcpToolName: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; type PromptItemArray = z.infer; /** * Why `repositoryUrl` came back null. T-538: these failure modes were previously * indistinguishable in the uploaded data, which is why a measured 22.5% of * null-repo events — git worked, only the remote lookup failed — has had no * actionable diagnosis. Each needs a different fix, or none: * * - `dir-missing` the working directory does not exist; nothing to read * - `not-a-repo` the directory exists but is not a git checkout * - `no-remote` a git repo, but no `remote.origin.url` configured * - `remote-error` reading the remote threw (missing git binary, permissions) * - `unparseable` a remote exists but `parseScmURL` could not canonicalise it * * `not-a-repo` has to be derived rather than caught: `git config --get` *resolves* * outside a repository, it does not throw. Without an explicit check every * non-checkout directory reports `no-remote`, which would label the dominant * 77.5% "cwd is not a git repo" population as the 22.5% "repo found, no usable * remote" one — inverting the split this taxonomy exists to measure. */ type RepoUrlCause = 'ok' | 'dir-missing' | 'not-a-repo' | 'no-remote' | 'remote-error' | 'unparseable'; type RepoState = { repositoryUrl: string | null; branch: string | null; commitSha: string | null; /** * Diagnostic only — never uploaded. Callers log it so the null population can * be split by cause; see T-538. */ repoUrlCause: RepoUrlCause; }; /** * Reads git state for tracy event attribution: repo URL, current branch, and * HEAD commit SHA. Each field is read fresh — no caching across calls. Detached * HEAD (rebase, bisect) returns `branch: null` rather than the literal string * "HEAD" that `git rev-parse --abbrev-ref HEAD` would produce. * * Both the CLI daemon and the VS Code extension flow through the shared * `GitService.getCurrentRepoState()` so detached-HEAD handling and SHA * normalization stay in lockstep across the two clients. * * The repository URL is the canonical form (parseScmURL().canonicalUrl) for any * SCM host, including self-hosted / enterprise remotes (scmType "Unknown"); only * an absent or genuinely unparseable remote resolves to `repositoryUrl: null`. * * Never throws — a non-existent dir, missing git binary, or absent/unparseable * remote resolves to null so the daemon hot path can rely on a value. */ declare function readRepoState(workingDir?: string): Promise; /** * Gets the canonical remote repository URL for the working directory's repo, for * any SCM host (GitHub, GitLab, Azure DevOps, Bitbucket, and self-hosted / * enterprise). Returns null when there is no remote or it can't be parsed. */ declare function getRepositoryUrl(workingDir?: string): Promise; /** * Get system information for tracking inference source. * Works cross-platform (Windows, macOS, Linux). * Handles errors gracefully for containerized environments where user info may not be available. */ declare function getSystemInfo(): { computerName: string; userName: string | undefined; }; type UploadAiBlameOptions = { prompt: string[]; inference: string[]; aiResponseAt?: string[]; model?: string[]; toolName?: string[]; blameType?: AiBlameInferenceType[]; sessionId?: string[]; 'ai-response-at'?: string[]; 'tool-name'?: string[]; 'blame-type'?: AiBlameInferenceType[]; 'session-id'?: string[]; }; declare function uploadAiBlameBuilder(args: Yargs.Argv): Yargs.Argv; type UploadAiBlameResult = { promptsCounts: SanitizationCounts; inferenceCounts: SanitizationCounts; promptsUUID?: string; inferenceUUID?: string; sanitizationDurationMs?: number; }; declare function uploadAiBlameHandlerFromExtension(args: { prompts: PromptItemArray; inference: string; model: string; tool: string; responseTime: string; blameType?: AiBlameInferenceType; sessionId?: string; apiUrl?: string; webAppUrl?: string; repositoryUrl?: string | null; sanitize?: boolean; }): Promise; type UploadAiBlameHandlerOptions = { args: UploadAiBlameOptions; exitOnError?: boolean; apiUrl?: string; webAppUrl?: string; logger?: Logger; repositoryUrl?: string | null; }; declare function uploadAiBlameHandler(options: UploadAiBlameHandlerOptions): Promise; declare function uploadAiBlameCommandHandler(args: UploadAiBlameOptions): Promise; export { type PromptItem, type PromptItemArray, type RepoState, type RepoUrlCause, type UploadAiBlameOptions, type UploadAiBlameResult, getRepositoryUrl, getSystemInfo, readRepoState, uploadAiBlameBuilder, uploadAiBlameCommandHandler, uploadAiBlameHandler, uploadAiBlameHandlerFromExtension };