import type { VerificationAuditSummary } from "./verification-summary.js";
import type { ModelCapability } from "./gateway.js";
import { CONNECTED_CONTEXT_SCHEMA_VERSION, type CandidateOmissionReason, type ConnectedContextPack, type ExplorationBudget, type ExplorationUsage, type RetrievalQueryKind, type SelectedScopeKind } from "./connected-context.js";
import type { CapsuleSetId, KnowledgeCapsuleId } from "./local-knowledge.js";
import type { ExpectedCheck, WorkflowKind } from "./workflow-handoff.js";
export interface Project {
    readonly path: string;
    readonly name: string;
    readonly favorite: boolean;
    readonly createdAt: number;
    readonly lastOpenedAt: number;
}
export interface ChatConnectedScope {
    readonly kind: SelectedScopeKind;
    readonly relativePaths: readonly string[];
    readonly connectedAtMs: number;
    readonly root?: string;
}
export interface GroundingLimits {
    readonly maxConnectedSources: number;
    readonly maxLocalKnowledgeSources: number;
    readonly maxPromptReferences: number;
    readonly maxExcerptChars: number;
    readonly referenceBudget: number;
    readonly hybridMaxCandidates: number;
    readonly hybridMaxExcerptBytes: number;
}
export declare const DEFAULT_GROUNDING_LIMITS: GroundingLimits;
export declare const GROUNDING_LIMIT_CEILINGS: GroundingLimits;
export declare function resolveGroundingLimits(partial?: Partial<GroundingLimits>): GroundingLimits;
export declare const MAX_CONNECTED_SOURCES: number;
export declare const MAX_LOCAL_KNOWLEDGE_SOURCES: number;
export type ChatLocalKnowledgeScope = {
    readonly kind: "capsule";
    readonly capsuleId: KnowledgeCapsuleId;
    readonly connectedAtMs: number;
} | {
    readonly kind: "capsule-set";
    readonly capsuleSetId: CapsuleSetId;
    readonly connectedAtMs: number;
};
export interface Chat {
    readonly id: string;
    readonly projectPath: string;
    readonly title: string;
    readonly selectedModel: string;
    readonly branchLabel: string | undefined;
    readonly status: "open" | "closed" | undefined;
    readonly connectedScopes?: readonly ChatConnectedScope[];
    readonly connectedScope: ChatConnectedScope | undefined;
    readonly localKnowledgeScopes?: readonly ChatLocalKnowledgeScope[];
    readonly localKnowledgeScope: ChatLocalKnowledgeScope | undefined;
    readonly createdAt: number;
    readonly updatedAt: number;
}
export type ChatRole = "user" | "assistant" | "system";
export type WorkflowStatus = "pending" | "running" | "completed" | "failed" | "cancelled";
export interface ChatMessage {
    readonly id: string;
    readonly chatId: string;
    readonly role: ChatRole;
    readonly content: string;
    readonly timestamp: number;
    readonly runId: string | undefined;
    readonly workflowId: string | undefined;
    readonly workflowStatus: WorkflowStatus | undefined;
    readonly shortResult: string | undefined;
    readonly taskType: string | undefined;
}
export interface CreateChatOptions {
    readonly branchLabel?: string;
}
export interface UpdateProjectPatch {
    readonly name?: string;
    readonly favorite?: boolean;
}
export interface UpdateChatPatch {
    readonly title?: string;
    readonly selectedModel?: string;
    readonly branchLabel?: string;
    readonly status?: "open" | "closed";
    readonly connectedScopes?: readonly ChatConnectedScope[] | null;
    readonly connectedScope?: ChatConnectedScope | null;
    readonly localKnowledgeScopes?: readonly ChatLocalKnowledgeScope[] | null;
    readonly localKnowledgeScope?: ChatLocalKnowledgeScope | null;
}
export interface NewChatMessage {
    readonly chatId: string;
    readonly role: ChatRole;
    readonly content: string;
    readonly timestamp: number;
    readonly runId: string | undefined;
    readonly workflowId: string | undefined;
    readonly workflowStatus: WorkflowStatus | undefined;
    readonly shortResult: string | undefined;
    readonly taskType: string | undefined;
}
export interface UpdateChatMessagePatch {
    readonly workflowStatus?: WorkflowStatus;
    readonly shortResult?: string;
    readonly taskType?: string;
}
export interface ProjectWithAvailability extends Project {
    readonly available: boolean;
}
export type ChatStatus = "open" | "closed";
export type ChatMessageRole = ChatRole;
export type ChatWorkflowStatus = WorkflowStatus;
export interface PatchChatMessageBody {
    readonly workflowStatus?: ChatWorkflowStatus;
    readonly shortResult?: string;
    readonly taskType?: string;
}
export interface PatchMessageResponse {
    readonly message: ChatMessage;
}
export interface ProjectsResponse {
    readonly projects: readonly ProjectWithAvailability[];
}
export interface ProjectResponse {
    readonly project: ProjectWithAvailability;
}
export interface ChatsResponse {
    readonly chats: readonly Chat[];
}
export interface ChatResponse {
    readonly chat: Chat;
}
export interface MessagesResponse {
    readonly messages: readonly ChatMessage[];
}
export interface MessageResponse {
    readonly message: ChatMessage;
}
export interface GroundedWorkflowHandoffRequest {
    readonly assistantMessageId: string;
    readonly modelId: string;
    readonly workflowKind: WorkflowKind;
    readonly input: Record<string, unknown>;
    readonly editablePaths: readonly string[];
    readonly expectedChecks?: readonly ExpectedCheck[] | undefined;
    readonly unknowns?: readonly string[] | undefined;
    readonly requestedAtMs: number;
}
export interface GroundedWorkflowHandoffResponse {
    readonly run: {
        readonly runId: string;
        readonly fingerprint: string;
    };
    readonly messages: readonly ChatMessage[];
}
export interface DesktopChatBootstrapResponse {
    readonly project: ProjectWithAvailability;
    readonly chat: Chat;
    readonly messages: readonly ChatMessage[];
    readonly projects: readonly ProjectWithAvailability[];
    readonly chats: readonly Chat[];
}
export interface DesktopChatSendUsage {
    readonly requestId: string;
    readonly promptTokens: number;
    readonly completionTokens: number;
    readonly latencyMs: number;
}
export interface ConversationMemoryScopeContextWire {
    readonly userId: string;
    readonly workspaceId?: string | undefined;
    readonly projectId?: string | undefined;
    readonly conversationId?: string | undefined;
}
export interface ConversationMemoryRequestWire {
    readonly enabled?: boolean | undefined;
    readonly budgetTokens?: number | undefined;
    readonly context: ConversationMemoryScopeContextWire;
}
export interface ConversationMemoryContextEntryWire {
    readonly memoryId: string;
    readonly bodyExcerpt: string;
    readonly inclusionReason: string;
}
export interface ConversationMemoryContextWire {
    readonly enabled: boolean;
    readonly text: string;
    readonly memories: readonly ConversationMemoryContextEntryWire[];
    readonly budget: {
        readonly tokens: number;
        readonly used: number;
    };
}
export type ConversationMemoryActionWire = {
    readonly kind: "candidate";
    readonly proposalId: string;
    readonly body: string;
    readonly scopeLabel: string;
    readonly requiresApproval: boolean;
} | {
    readonly kind: "update";
    readonly memoryId: string;
    readonly bodyPatch?: string | undefined;
} | {
    readonly kind: "forget";
    readonly memoryId: string;
    readonly requiresConfirmation: boolean;
} | {
    readonly kind: "rejected";
    readonly reason: string;
};
export interface ConversationMemoryResultWire {
    readonly context: ConversationMemoryContextWire;
    readonly actions: readonly ConversationMemoryActionWire[];
}
export interface DesktopChatSendResponse {
    readonly chat: Chat;
    readonly messages: readonly ChatMessage[];
    readonly usage?: DesktopChatSendUsage;
    readonly memory?: ConversationMemoryResultWire;
}
export interface ConversationDocumentContextWire {
    readonly id: string;
    readonly displayName: string;
    readonly mimeType: string;
    readonly sizeBytes: number;
    readonly extractedBytes: number;
    readonly truncated: boolean;
    readonly truncationMarker?: string | undefined;
    readonly text: string;
}
export interface ConversationAttachmentDescriptorWire {
    readonly id: string;
    readonly kind: "image" | "document";
    readonly name: string;
    readonly mimeType: string;
    readonly sizeBytes: number;
}
export interface DesktopChatSendRequestWire {
    readonly chatId: string;
    readonly projectPath: string;
    readonly content: string;
    readonly modelId?: string | undefined;
    readonly documentContext?: readonly ConversationDocumentContextWire[] | undefined;
    readonly attachments?: readonly ConversationAttachmentDescriptorWire[] | undefined;
}
export interface SafeProviderConfig {
    readonly modelId: string;
    readonly credentialHeaderName: string;
    readonly timeoutMs: number;
    readonly maxRetries: number;
    readonly retryBaseDelayMs: number;
}
export interface SafeCircuitBreakerConfig {
    readonly failureThreshold: number;
    readonly cooldownMs: number;
    readonly halfOpenProbes: number;
}
export interface SafeGatewayConfig {
    readonly providers: readonly SafeProviderConfig[];
    readonly circuitBreaker: SafeCircuitBreakerConfig;
    readonly capabilities?: readonly ModelCapability[];
    readonly grounding?: GroundingLimits;
}
export type WorkflowInputType = "string" | "boolean" | "string[]" | "object";
export interface WorkflowModelOptions {
    readonly arbitrary: boolean;
    readonly preferredCostClass: "low" | "medium" | "high";
}
export interface ExplainPlanInputSpec {
    readonly inputs: readonly {
        readonly name: string;
        readonly type: WorkflowInputType;
        readonly required: boolean;
    }[];
    readonly defaultLimits: Readonly<Record<string, unknown>>;
}
export interface VerifyInputSpec {
    readonly inputs: readonly {
        readonly name: string;
        readonly type: WorkflowInputType;
        readonly required: boolean;
    }[];
    readonly defaultLimits: Readonly<Record<string, unknown>>;
}
import type { WorkflowDescriptor } from "./workflow-descriptor.js";
export interface WorkflowsResponse {
    readonly descriptors: readonly WorkflowDescriptor[];
    readonly explainPlan: ExplainPlanInputSpec;
    readonly verify: VerifyInputSpec;
}
export type AgentWorkflowId = "verify" | "explain-plan" | "unit-test-generation" | "bug-investigation";
export type UnitTestTargetKind = "file" | "module" | "changedFiles";
export interface AgentVerifyInput {
    readonly targetFiles?: readonly string[];
}
export interface AgentExplainPlanInput {
    readonly filePath: string;
    readonly question?: string;
}
export interface AgentUnitTestInput {
    readonly targetKind: UnitTestTargetKind;
    readonly filePath?: string;
    readonly moduleDir?: string;
    readonly filePaths?: readonly string[];
}
export interface AgentBugInvestigationInput {
    readonly description?: string;
    readonly failingOutput?: string;
    readonly stackTrace?: string;
    readonly targetFiles?: readonly string[];
}
export interface GroundedAskRequest {
    readonly chatId: string;
    readonly content: string;
    readonly modelId?: string | undefined;
}
export interface GroundedEvidenceCitation {
    readonly scopePath: string;
    readonly lineRange: {
        readonly startLine: number;
        readonly endLine: number;
    } | undefined;
    readonly score: number;
    readonly stableId: string;
    readonly source?: string;
    readonly marker?: number;
}
export interface GroundedUncertainty {
    readonly kind: string;
    readonly claim: string;
}
export interface GroundedAnswerContextPackSummary {
    readonly schemaVersion: typeof CONNECTED_CONTEXT_SCHEMA_VERSION;
    readonly scopeId: string;
    readonly scopeKind: SelectedScopeKind;
    readonly fileCount: number;
    readonly queryKind: RetrievalQueryKind;
    readonly usage: ExplorationUsage;
    readonly budget: ExplorationBudget;
    readonly citationCount: number;
    readonly omittedCount: number;
    readonly omittedCounts: Readonly<Record<CandidateOmissionReason, number>>;
    readonly uncertaintyCount: number;
    readonly elapsedMs: number;
}
export interface LocalKnowledgeGroundedAnswerContextSummary {
    readonly kind: "local-knowledge";
    readonly scopeKind: "capsule" | "capsule-set";
    readonly scopeId: string;
    readonly scopeLabel: string;
    readonly capsuleCount: number;
    readonly sourceCount: number;
    readonly citationCount: number;
    readonly referenceBudget: number;
    readonly referencesUsed: number;
}
export declare function buildGroundedAnswerContextPackSummary(pack: ConnectedContextPack, citationCount: number, elapsedMs: number): GroundedAnswerContextPackSummary;
export interface ConnectedContextGroundedAnswer {
    readonly groundingKind: "connected-context";
    readonly userMessageId: string;
    readonly assistantMessageId: string;
    readonly evidenceRunId?: string | undefined;
    readonly content: string;
    readonly citations: readonly GroundedEvidenceCitation[];
    readonly uncertainty: readonly GroundedUncertainty[];
    readonly omittedCount: number;
    readonly elapsedMs: number;
    readonly contextPack: GroundedAnswerContextPackSummary;
}
export interface LocalKnowledgeEvidenceCitation {
    readonly stableId: string;
    readonly marker: string;
    readonly label: string;
    readonly score: number;
    readonly source?: string;
}
export interface LocalKnowledgeGroundedAnswer {
    readonly groundingKind: "local-knowledge";
    readonly userMessageId: string;
    readonly assistantMessageId: string;
    readonly evidenceRunId?: string | undefined;
    readonly content: string;
    readonly citations: readonly LocalKnowledgeEvidenceCitation[];
    readonly uncertainty: readonly GroundedUncertainty[];
    readonly omittedCount: number;
    readonly elapsedMs: number;
    readonly noEvidence: boolean;
    readonly noEvidenceReason?: string | undefined;
    readonly contextPack: LocalKnowledgeGroundedAnswerContextSummary;
}
export interface HybridGroundedAnswerContextSummary {
    readonly kind: "hybrid";
    readonly folderSourceCount: number;
    readonly connectorSourceCount: number;
    readonly folder: GroundedAnswerContextPackSummary;
    readonly knowledge: LocalKnowledgeGroundedAnswerContextSummary;
}
export interface HybridGroundedAnswer {
    readonly groundingKind: "hybrid";
    readonly userMessageId: string;
    readonly assistantMessageId: string;
    readonly evidenceRunId?: string | undefined;
    readonly content: string;
    readonly citations: readonly GroundedEvidenceCitation[];
    readonly knowledgeCitations: readonly LocalKnowledgeEvidenceCitation[];
    readonly uncertainty: readonly GroundedUncertainty[];
    readonly omittedCount: number;
    readonly elapsedMs: number;
    readonly contextPack: HybridGroundedAnswerContextSummary;
}
export type GroundedAnswer = ConnectedContextGroundedAnswer | LocalKnowledgeGroundedAnswer | HybridGroundedAnswer;
export type BffErrorCode = "BAD_REQUEST" | "NOT_FOUND" | "NOT_APPLIABLE" | "EVIDENCE_SCHEMA" | "WORKSPACE_FILE_TOO_LARGE" | "WORKSPACE_NOT_FOUND" | "WORKSPACE_PATH_DENIED" | "WORKSPACE_PATH_ESCAPE" | "WORKSPACE_READ_FAILED" | "CONVERSATION_UNAVAILABLE_MODEL" | "CONVERSATION_UNSUPPORTED_MODALITY" | "CONVERSATION_UNSUPPORTED_FILE_TYPE" | "CONVERSATION_OVERSIZED_CONTEXT" | "INTERNAL";
export interface BffError {
    readonly error: {
        readonly code: string;
        readonly message: string;
    };
}
export type RunStatus = "running" | "completed" | "dry-run" | "rejected" | "cancelled" | "failed" | "fix-applied" | "fix-proposed" | "investigation-only";
export interface ChangedFile {
    readonly path: string;
    readonly kind: string;
    readonly addedLines: number;
    readonly removedLines: number;
    readonly elevatedReview: boolean;
}
export interface RunReportVerificationStep {
    readonly kind: string;
    readonly status: string;
    readonly command: string;
    readonly durationMs?: number;
}
export interface RunReportHypothesis {
    readonly rootCause?: string;
    readonly regressionTestStrategy?: string;
    readonly uncertainty?: string;
    readonly confidence?: string;
}
export interface RunReportUsage {
    readonly requestId: string;
    readonly promptTokens: number;
    readonly completionTokens: number;
    readonly latencyMs: number;
}
export interface RunReport {
    readonly status: RunStatus;
    readonly modelId?: string;
    readonly durationMs?: number;
    readonly report?: string;
    readonly overallStatus?: string;
    readonly results?: readonly RunReportVerificationStep[];
    readonly proposedDiff?: string;
    readonly dryRunPreview?: string;
    readonly changedFiles?: readonly ChangedFile[];
    readonly addedTestFiles?: readonly {
        readonly path: string;
        readonly estimatedTestCount?: number;
    }[];
    readonly coveredBehavior?: string;
    readonly knownGaps?: string;
    readonly verificationSkipReason?: string;
    readonly nextActions?: readonly string[];
    readonly failureReason?: string;
    readonly hypothesis?: RunReportHypothesis;
    readonly verificationSummary?: VerificationAuditSummary;
    readonly usage?: RunReportUsage;
    readonly applyReport?: RunReport;
    readonly appliedAt?: number;
}
export type EvidenceOutcome = "completed" | "cancelled" | "failed" | "limit-exceeded";
export interface EvidenceListEntry {
    readonly runId: string;
    readonly taskType: string;
    readonly outcome: EvidenceOutcome;
    readonly startedAt: number;
    readonly finishedAt: number;
    readonly modelId: string;
    readonly workspaceRoot?: string;
}
export interface TerminalPolicySummary {
    readonly commands: readonly string[];
    readonly limits: {
        readonly maxOutputBytes: number;
        readonly defaultTimeoutMs: number;
    };
}
export interface TerminalDirectoryRoot {
    readonly label: string;
    readonly path: string;
}
export interface TerminalDirectoryEntry {
    readonly name: string;
    readonly path: string;
}
export interface TerminalDirectoryListing {
    readonly path: string;
    readonly parent: string | null;
    readonly entries: readonly TerminalDirectoryEntry[];
    readonly roots: readonly TerminalDirectoryRoot[];
}
export interface TerminalExecutionInput {
    readonly projectId: string;
    readonly command: string;
    readonly args: readonly string[];
    readonly cwd?: string;
    readonly timeoutMs?: number;
    readonly requestId?: string;
}
export interface TerminalExecutionResult {
    readonly executionId: string;
    readonly exitCode: number | null;
    readonly stdout: string;
    readonly stderr: string;
    readonly durationMs: number;
    readonly truncated: boolean;
    readonly timedOut: boolean;
}
export type TerminalEventKind = "execution-started" | "execution-completed" | "execution-failed" | "execution-cancelled";
export interface TerminalEventEnvelope {
    readonly kind: TerminalEventKind;
    readonly executionId: string;
    readonly payload: Readonly<Record<string, unknown>>;
}
export interface FilesDirectoryRoot {
    readonly label: string;
    readonly path: string;
}
export interface FilesDirectoryEntry {
    readonly name: string;
    readonly path: string;
}
export interface FilesDirectoryListing {
    readonly path: string;
    readonly parent: string | null;
    readonly entries: readonly FilesDirectoryEntry[];
    readonly roots: readonly FilesDirectoryRoot[];
}
export type FilesEntryKind = "directory" | "file" | "symlink";
export interface FilesTreeEntry {
    readonly name: string;
    readonly path: string;
    readonly kind: FilesEntryKind;
    readonly sizeBytes: number;
    readonly modifiedAt: number;
    readonly extension: string | null;
    readonly symlink: boolean;
    readonly readable: boolean;
}
export interface FilesTreeResponse {
    readonly root: string;
    readonly path: string;
    readonly entries: readonly FilesTreeEntry[];
    readonly truncated: boolean;
}
export interface FilesPreviewBase {
    readonly root: string;
    readonly path: string;
    readonly name: string;
    readonly sizeBytes: number;
    readonly modifiedAt: number;
    readonly extension: string | null;
    readonly mime: string;
    readonly symlink: boolean;
}
export type FilesPreviewResponse = (FilesPreviewBase & {
    readonly kind: "text";
    readonly content: string;
    readonly truncated: boolean;
    readonly maxBytes: number;
}) | (FilesPreviewBase & {
    readonly kind: "image";
    readonly dataUrl: string;
    readonly maxBytes: number;
}) | (FilesPreviewBase & {
    readonly kind: "binary";
    readonly reason: "unsupported" | "too_large";
    readonly maxBytes?: number;
});
export interface BrowserViewportPx {
    readonly width: number;
    readonly height: number;
}
export interface CdpReachability {
    readonly reachable: boolean;
    readonly userAgent: string | null;
    readonly browserVersion: string | null;
    readonly webSocketDebuggerUrl: string | null;
}
export interface BrowserSessionMeta {
    readonly sessionId: string;
    readonly cdpPort: number;
    readonly targetId: string;
    readonly status: "open" | "closed";
    readonly createdAt: number;
}
export interface BrowserNavigateResult {
    readonly originOnly: string;
    readonly httpStatus: number | null;
}
export type BrowserScreenshotResult = {
    readonly seq: number;
    readonly viewportPx: BrowserViewportPx;
    readonly dataBase64: string;
    readonly persisted: false;
} | {
    readonly seq: number;
    readonly viewportPx: BrowserViewportPx;
    readonly persisted: true;
    readonly path: string;
    readonly sha256: string;
    readonly bytes: number;
};
export interface BrowserContentResult {
    readonly seq: number;
    readonly byteLength: number;
    readonly redactedHtml: string;
}
export type BrowserEventKind = "session-opened" | "navigated" | "screenshot-captured" | "page-content-captured" | "session-closed" | "trust-warning" | "error";
export interface BrowserEventEnvelope {
    readonly schemaVersion?: "1";
    readonly type?: string;
    readonly runId?: string;
    readonly fingerprint?: string;
    readonly seq?: number;
    readonly ts?: number;
    readonly kind: BrowserEventKind;
    readonly sessionId: string;
    readonly payload: Readonly<Record<string, unknown>>;
}
//# sourceMappingURL=bff-wire.d.ts.map