import type { AgentStatus } from "./agentStatus";
export declare const AGENT_BASE_URL = "/parhelia/agent";
export type { AgentStatus } from "./agentStatus";
export interface StartAgentRequest {
    agentId: string;
    message: string;
    sessionId: string;
    profileId: string;
    mode?: "autonomous" | "read-only" | "supervised";
    model?: string;
    context?: any;
}
export interface StartAgentResponse {
    agentId: string;
    status: AgentStatus;
    message: string;
    reason?: string;
    startedAt: string;
}
export interface AgentCostInfo {
    total?: number;
    input?: number;
    output?: number;
    cached?: number;
    cacheWrite?: number;
    imageCost?: number;
    totalImageCost?: number;
    limit?: number;
    tokens?: {
        total?: number;
        input?: number;
        output?: number;
        cached?: number;
        cacheWrite?: number;
    };
    contextWindow?: number;
    contextUsed?: number;
}
export interface AgentStreamMessage {
    type: string;
    data: any;
    cost?: AgentCostInfo;
    timestamp: string;
    error?: string;
}
export type AgentStreamMessageType = "statusUpdate" | "contentChunk" | "toolCall" | "toolResult" | "editOperations" | "heartbeat" | "completed" | "error" | "contextUpdate";
export type Agent = {
    id: string;
    name: string;
    description?: string;
    userId: string;
    updatedDate: string;
    status: AgentStatus;
    isShared?: boolean;
    ownerName?: string;
    visibilityMode?: "Private" | "ProjectMembers" | "ExplicitMembers" | string;
    effectiveAccessLevel?: "None" | "View" | "FullAccess" | string;
    canManage?: boolean;
    profileId?: string;
    profileName?: string;
    profileSvgIcon?: string;
    triggerSubscriptionCount?: number;
    messageCount?: number;
    totalCost?: number;
    totalTokensUsed?: number;
    statusMessage?: string;
    lastMessageDate?: string;
    nextRunAt?: string;
    /** ID of the parent agent if this agent was spawned from another agent */
    parentAgentId?: string;
    /** Active skills assigned to the agent in the backend table. */
    assignedSkillIds?: string[];
};
export type AgentDetails = Agent & {
    profileId?: string;
    profileName: string;
    profileSvgIcon?: string;
    model: string;
    createdDate: string;
    lastMessageDate?: string;
    totalTokensUsed: number;
    totalInputTokens: number;
    totalOutputTokens: number;
    totalCachedInputTokens: number;
    totalInputTokenCost: number;
    totalOutputTokenCost: number;
    totalCachedInputTokenCost: number;
    totalImageCost: number;
    totalCost: number;
    currency: string;
    messageCount: number;
    /** Cost limit for this agent (in USD) */
    costLimit?: number;
    /** Agent context data (JSON string) - contains pages, componentIds, field, comment, etc. */
    agentContext?: string;
    messages?: AgentChatMessage[];
    /** Status message providing context about the agent's current state, especially when in error status */
    statusMessage?: string;
    /** Message index up to which conversation compression was applied */
    compressionMarkerIndex?: number;
    /** Compressed summary of conversation messages before compressionMarkerIndex */
    compressedSummary?: string;
    /** Maximum context window tokens for the model (looked up from model config) */
    contextWindowTokens?: number;
    /** Estimated tokens used in the current context (persisted in DB) */
    contextUsedTokens?: number;
};
export interface AgentSkill {
    id: string;
    name: string;
    disabled: boolean;
    description?: string;
    instructions?: string;
    allowedAgentProfiles?: Array<{
        id: string;
        name: string;
    }>;
    additionalAllowedTools?: string[];
}
export interface AgentSkillCatalog {
    skills: AgentSkill[];
    rootIds: string[];
    selectableTemplateIds: string[];
}
export declare function getAgentAvailableTools(agentId: string): Promise<string[]>;
export declare function approveToolCall(params: {
    agentId: string;
    messageId: string;
    toolCallId: string;
    note?: string;
}): Promise<{
    success: boolean;
}>;
export declare function approveToolCalls(params: {
    agentId: string;
    toolCalls: Array<{
        messageId: string;
        toolCallId: string;
        note?: string;
    }>;
}): Promise<{
    success: boolean;
    approvedToolCallIds?: string[];
}>;
export declare function rejectToolCall(params: {
    agentId: string;
    messageId: string;
    toolCallId: string;
    note?: string;
}): Promise<{
    success: boolean;
}>;
export declare function createOperationAllowance(params: {
    agentId: string;
    itemId: string;
    operationType: string;
    scopeType: "itemSubtree";
}): Promise<{
    success: boolean;
}>;
export type AgentContextData = {
    selection?: string[];
    selectedText?: string;
    items?: Array<{
        id: string;
        language: string;
        version: number;
        path?: string;
        name?: string;
        createdByAgent?: boolean;
    }>;
    /** ID of the currently loaded/active item that the user is viewing */
    currentItemId?: string;
    /** Component context with page information per component */
    components?: Array<{
        componentId: string;
        componentName?: string;
        componentType?: string;
        renderingItemId?: string;
        pageItem: {
            id: string;
            language: string;
            version: number;
            path?: string;
            name?: string;
        };
        createdByAgent?: boolean;
    }>;
    field?: {
        fieldId: string;
        fieldName?: string;
        fieldType?: string;
        item?: {
            id: string;
            language: string;
            version: number;
            path?: string;
            name?: string;
        };
    };
    comment?: {
        id: string;
        text?: string;
        fieldName?: string;
        itemName?: string;
        author?: string;
        selectedText?: string;
        rangeStart?: number;
        rangeEnd?: number;
    };
    mode?: "autonomous" | "read-only" | "supervised";
    profile?: string;
    /** The currently active workspace in the editor (e.g., "home", "editor", "settings") */
    activeWorkspace?: string;
    /** Whether a page with layout is currently loaded */
    hasPageLoaded?: boolean;
    /** List of currently open sidebar panel IDs (e.g., ["content-tree", "reviews"]) */
    openSidebars?: string[];
    additionalData?: Record<string, any>;
};
export interface AgentBrowserClaim {
    sessionId?: string;
    browserId?: string;
    terminalInstanceId?: string;
    claimedAt?: string;
}
export interface AgentBrowserClaimResponse {
    success: boolean;
    message?: string;
    claim?: AgentBrowserClaim | null;
    claimedByCurrentSession?: boolean;
    claimedByAnotherBrowser?: boolean;
}
export type AgentMetadata = AgentContextData;
export interface AgentDocument {
    id: string;
    agentId: string;
    fileName: string;
    fileSize: number;
    contentType?: string;
    extractedText?: string;
    uploadedBy: string;
    uploadedDate: string;
}
export declare const AGENT_DOCUMENT_UPLOADED_EVENT = "agent:document:uploaded";
export interface AgentDocumentUploadedDetail {
    agentId: string;
    document: AgentDocument;
}
export declare const AGENT_DOCUMENTS_CHANGED_EVENT = "agent:documents:changed";
export interface AgentDocumentsChangedDetail {
    agentId: string;
    reason?: string;
}
export declare function emitAgentDocumentsChanged(detail: AgentDocumentsChangedDetail): void;
export interface AgentChatMessage {
    id: string;
    agentId: string;
    messageIndex: number;
    role: string;
    content: string;
    reasoning?: string;
    reasoningDetails?: any[];
    name: string;
    toolCallId?: string;
    messageType: string;
    isCompleted: boolean;
    model: string;
    tokensUsed: number;
    inputTokens: number;
    outputTokens: number;
    cachedInputTokens: number;
    inputTokenCost: number;
    outputTokenCost: number;
    cachedInputTokenCost: number;
    totalCost: number;
    currency: string;
    responseTimeMs?: number;
    createdDate: string;
    editOperations?: string;
    longRunningTaskIds?: string;
    metadata?: string;
    toolCalls?: AgentChatToolCall[];
}
export interface AgentChatToolCall {
    id: string;
    messageId: string;
    toolCallId: string;
    functionName: string;
    functionArguments: string;
    functionResult?: string;
    functionResultRichContent?: string;
    functionError?: string;
    isPruned?: boolean;
    prunedAt?: string;
    isCompleted: boolean;
    responseTimeMs?: number;
    createdDate: string;
    requiresApproval?: {
        summary: string;
        riskLevel?: "low" | "medium" | "high";
    };
}
/**
 * Starts an agent execution and returns immediately
 */
export declare function startAgent(request: StartAgentRequest): Promise<StartAgentResponse>;
export interface StartSuggestionAgentRequest {
    agentId: string;
    sessionId: string;
    context: any;
}
/**
 * Starts a suggestion agent to describe an image based on context.
 */
export declare function startSuggestionAgent(request: StartSuggestionAgentRequest): Promise<StartAgentResponse>;
export interface AwaitAgentResponseOptions {
    /** The agent ID to listen for */
    agentId: string;
    /** Function to add a socket message listener (from editContext) */
    addSocketMessageListener: (handler: (message: any) => void) => () => void;
    /** Optional timeout in milliseconds (default: 60000ms / 1 minute) */
    timeout?: number;
    /** Optional callback for streaming content updates */
    onContentUpdate?: (content: string) => void;
}
export interface AwaitAgentResponseResult {
    /** The final content from the agent */
    content: string;
    /** Whether the agent completed successfully */
    success: boolean;
    /** Error message if failed */
    error?: string;
}
/**
 * Awaits an agent's response via WebSocket messages.
 * Subscribes to the agent, accumulates streaming content, and resolves when complete.
 */
export declare function awaitAgentResponse(options: AwaitAgentResponseOptions): Promise<AwaitAgentResponseResult>;
/**
 * Gets the current status of an agent execution
 */
export declare function getAgentStatus(agentId: string): Promise<any>;
/**
 * Gets all currently running agents for monitoring
 */
export declare function getRunningAgents(): Promise<any>;
/**
 * Gets a single agent by ID with complete message history and cost information
 */
export declare function getAgent(agentId: string): Promise<AgentDetails>;
/**
 * Gets the last API payload and raw response for an agent (for debugging purposes)
 */
export declare function getLastPayload(agentId: string): Promise<{
    payload: string;
    rawResponse: string;
}>;
export interface AgentDiagnosticsEvent {
    timestamp: string;
    kind: string;
    messageType: string;
    detail?: string | null;
    seq?: number | null;
    sessionId?: string | null;
    deliveryStatus?: string | null;
}
export interface AgentDiagnosticsSessionDelivery {
    lastAttemptAt?: string | null;
    lastSuccessAt?: string | null;
    lastFailureAt?: string | null;
    lastFailureReason?: string | null;
    lastMessageType?: string | null;
    lastSeq?: number | null;
    lastDeliveryStatus?: string | null;
}
export interface AgentDiagnosticsSession {
    sessionId?: string | null;
    sessionFound: boolean;
    browserMatched: boolean;
    isConnected: boolean;
    isSubscribed: boolean;
    connectedAt?: string | null;
    lastDelivery?: AgentDiagnosticsSessionDelivery | null;
}
export interface AgentDiagnosticsExecution {
    status: string;
    startedAt?: string | null;
    completedAt?: string | null;
    error?: string | null;
    isInMemoryExecution: boolean;
    runId?: string | null;
}
export interface AgentDiagnosticsRunRequest {
    requestedAt?: string | null;
    source?: string | null;
    detail?: string | null;
}
export interface AgentDiagnosticsCancellation {
    requestedAt?: string | null;
    source?: string | null;
    reason?: string | null;
    requestedBy?: string | null;
    detail?: string | null;
    observedAt?: string | null;
    observedSource?: string | null;
    observedDetail?: string | null;
}
export interface AgentDiagnosticsTransport {
    lastMessageType?: string | null;
    lastDeltaType?: string | null;
    lastStatusState?: string | null;
    lastLifecycleEventType?: string | null;
    lastSeq?: number | null;
    lastProducedAt?: string | null;
    lastBroadcastAt?: string | null;
    lastFailureAt?: string | null;
    lastFailure?: string | null;
    targetSessionCount: number;
    successfulSessionCount: number;
    failedSessionCount: number;
    connectedSubscriberCount: number;
    recentEvents: AgentDiagnosticsEvent[];
}
export interface AgentPersistentLog {
    logId: string;
    agentId?: string | null;
    projectId?: string | null;
    taskId?: string | null;
    runId?: string | null;
    sessionId?: string | null;
    userId?: string | null;
    parentAgentId?: string | null;
    messageId?: string | null;
    toolCallId?: string | null;
    eventType?: string | null;
    stage?: string | null;
    status?: string | null;
    source?: string | null;
    seq?: number | null;
    summary?: string | null;
    payloadPreview?: string | null;
    resultPreview?: string | null;
    metadataJson?: string | null;
    durationMs?: number | null;
    success?: boolean | null;
    error?: string | null;
    createdAt: string;
}
export interface AgentMachineCapacityOccupant {
    agentId: string;
    agentName?: string | null;
    runId?: string | null;
    status?: string | null;
    startedAt?: string | null;
    completedAt?: string | null;
    userId?: string | null;
    sessionId?: string | null;
    mode?: string | null;
    hasActiveExecutionTask: boolean;
    isInExecutionLoop: boolean;
    executionTaskStatus?: string | null;
    consumesMachineCapacity: boolean;
}
export interface AgentMachineCapacityDiagnostics {
    maxRunningAgents: number;
    runningExecutions: number;
    occupants: AgentMachineCapacityOccupant[];
}
export interface AgentDiagnosticsResponse {
    agentId: string;
    execution: AgentDiagnosticsExecution;
    transport: AgentDiagnosticsTransport;
    currentSession: AgentDiagnosticsSession;
    lastRunRequest?: AgentDiagnosticsRunRequest | null;
    lastCancellation?: AgentDiagnosticsCancellation | null;
    persistentLogs: AgentPersistentLog[];
    machineCapacity?: AgentMachineCapacityDiagnostics | null;
}
export declare function getAgentDiagnostics(agentId: string, sessionId?: string): Promise<AgentDiagnosticsResponse>;
export interface GetAgentsParams {
    skip?: number;
    limit?: number;
    includeShared?: boolean;
    includeOwned?: boolean;
    searchTerm?: string;
    excludeClosed?: boolean;
    signal?: AbortSignal;
}
export interface GetAgentsResponse {
    agents: Agent[];
    totalCount: number;
    hasMore: boolean;
}
export interface ProfileAgentsGroup {
    profileId: string | null;
    profileName: string;
    profileSvgIcon?: string;
    totalClosedCount: number;
    agents: Agent[];
}
export interface GetAgentsGroupedResponse {
    activeAgents: Agent[];
    closedAgentsByProfile: ProfileAgentsGroup[];
}
/**
 * Gets all agents for the current user with pagination and search support
 */
export declare function getActiveAgents(params?: GetAgentsParams): Promise<GetAgentsResponse>;
/**
 * Gets all active agents and closed agents grouped by profile for the current user
 */
export declare function getAgentsGrouped(searchTerm?: string, includeShared?: boolean, includeOwned?: boolean): Promise<GetAgentsGroupedResponse>;
/**
 * Gets more closed agents for a specific profile
 */
export declare function getClosedAgentsByProfile(profileId: string, skip: number, limit: number, searchTerm?: string): Promise<GetAgentsResponse>;
/**
 * Gets all non-closed agents across all users (admin only)
 */
export declare function getAllAgents(limit?: number): Promise<AgentDetails[]>;
/**
 * Cancels a running agent execution
 */
export declare function cancelAgent(agentId: string): Promise<any>;
/**
 * Permanently deletes an agent and all its messages
 */
export declare function deleteAgent(agentId: string): Promise<any>;
/**
 * Closes an agent by canceling execution and setting status to closed
 */
export declare function closeAgent(agentId: string): Promise<any>;
/**
 * Updates the selected model for an agent chat (persists to DB)
 */
/**
 * Updates agent settings like model name and mode in one call.
 */
export declare function updateAgentSettings(agentId: string, settings: {
    model?: string | null;
    mode?: "autonomous" | "read-only" | "supervised" | string | null;
    profileId?: string | null;
    profileName?: string | null;
}): Promise<{
    success: boolean;
    updates?: {
        model: boolean;
        mode: boolean;
    };
}>;
/**
 * Updates the metadata (context) for an agent chat
 */
export declare function updateAgentContext(agentId: string, metadata: AgentMetadata): Promise<{
    success: boolean;
}>;
export declare function persistDraftAgent(params: {
    agentId: string;
    sessionId?: string;
    profileId: string;
    mode?: "autonomous" | "read-only" | "supervised" | string | null;
    model?: string | null;
    name?: string;
    context?: AgentMetadata | null;
}): Promise<AgentDetails>;
export declare function assignAgentSkill(params: {
    agentId: string;
    skillId: string;
}): Promise<{
    success: boolean;
}>;
export declare function revokeAgentSkill(params: {
    agentId: string;
    skillId: string;
}): Promise<{
    success: boolean;
}>;
export declare function claimAgentBrowser(params: {
    agentId: string;
    sessionId: string;
    takeOver?: boolean;
    terminalInstanceId?: string;
}): Promise<AgentBrowserClaimResponse>;
export declare function releaseAgentBrowser(params: {
    agentId: string;
    sessionId: string;
    terminalInstanceId?: string;
}): Promise<AgentBrowserClaimResponse>;
export declare function cancelAgentDialog(params: {
    callbackId: string;
    sessionId: string;
    error?: string;
}): Promise<{
    success?: boolean;
}>;
export declare function updateAgentCostLimit(agentId: string, action: "extend" | "set", amount?: number): Promise<{
    success: boolean;
    costLimit?: number;
    initialCostLimit?: number;
}>;
/**
 * Uploads a document to an agent
 * Server uses Pandoc for PDF text extraction
 */
export declare function uploadDocument(agentId: string, file: File, profileId?: string): Promise<{
    success: boolean;
    document?: AgentDocument;
    error?: string;
}>;
export declare function getAgentSkillCatalog(includeDisabled?: boolean): Promise<AgentSkillCatalog>;
export declare function getAgentSkills(includeDisabled?: boolean): Promise<AgentSkill[]>;
/**
 * Gets all documents for an agent
 */
export declare function getAgentDocuments(agentId: string): Promise<{
    success: boolean;
    documents?: AgentDocument[];
    error?: string;
}>;
/**
 * Deletes a document
 */
export declare function deleteDocument(documentId: string): Promise<{
    success: boolean;
    error?: string;
}>;
/**
 * Downloads a document file
 */
export declare function downloadDocument(documentId: string): Promise<Blob>;
export interface QueuedPrompt {
    id: string;
    targetAgentId: string;
    sourceAgentId?: string | null;
    sourceAgentName?: string | null;
    userId?: string | null;
    prompt: string;
    data?: string | null;
    priority: number;
    status: number;
    createdDate: string;
    scheduledFor?: string | null;
    processedDate?: string | null;
}
export interface AgentTriggerSubscription {
    id: string;
    agentId: string;
    triggerName: string;
    filter?: string | null;
    isActive: boolean;
    createdAtUtc: string;
}
export interface AgentSitecoreAllowance {
    itemId: string;
    itemPath: string;
    operationType: string;
    scopeType: string;
    source?: string | null;
    grantedBy?: string | null;
    grantedAt?: string | null;
}
export interface AgentFilesystemAllowance {
    normalizedPath: string;
    operationType: string;
    source?: string | null;
    grantedBy?: string | null;
    grantedAt?: string | null;
}
export interface AgentOperationAllowancesResponse {
    sitecore: AgentSitecoreAllowance[];
    filesystem: AgentFilesystemAllowance[];
}
/**
 * Gets pending queued prompts for an agent
 */
export declare function getPendingPrompts(agentId: string): Promise<QueuedPrompt[]>;
/**
 * Gets trigger subscriptions for an agent
 */
export declare function getAgentTriggerSubscriptions(agentId: string): Promise<AgentTriggerSubscription[]>;
export declare function getAgentOperationAllowances(agentId: string): Promise<AgentOperationAllowancesResponse>;
export declare function canonicalizeAgentMetadata(meta: AgentMetadata | any): AgentContextData;
