import { type ReactNode } from 'react';
export interface ToolActionEvent {
    tool: string;
    toolCallId: string;
    decision: string;
    input: any;
}
export interface ClientToolExecuteContext {
    /** The id of the tool call being fulfilled. */
    toolCallId: string;
}
/**
 * A host-provided tool the agent can call and have executed client-side.
 *
 * The serializable parts (`name`, `description`, `parameters`) are forwarded
 * to the chat endpoint as `clientTools` so the backend can expose them to the
 * agent. When the agent calls one, `execute` runs in the browser and its
 * resolved value is sent back to the agent as the tool result.
 */
export interface ClientTool<TInput = any, TOutput = any> {
    /** Unique tool name. Must match the name the agent uses to call it. */
    name: string;
    /** Natural-language description the agent uses to decide when to call it. */
    description: string;
    /** JSON Schema (draft-07) describing the tool input. Forwarded to the backend. */
    parameters?: Record<string, unknown>;
    /**
     * Runs client-side when the agent calls this tool. The resolved value is
     * serialized and sent back to the agent as the tool result. Throwing (or
     * rejecting) reports the error back to the agent.
     */
    execute: (input: TInput, context: ClientToolExecuteContext) => TOutput | Promise<TOutput>;
    /** Icon rendered in the tool-call card. */
    icon?: ReactNode;
    /** Message shown while the tool is executing. */
    progressMessage?: string;
    /** Message shown when the tool resolves successfully. */
    successMessage?: string;
    /** Message shown when the tool throws or rejects. */
    failMessage?: string;
}
export interface ApiResponse<T = unknown> {
    success: boolean;
    data?: T;
    error?: string;
    message?: string;
}
export declare const WorkTypes: {
    readonly Record: "record";
    readonly Data: "data";
    readonly Text: "text";
    readonly Code: "code";
    readonly Image: "image";
    readonly Xlsx: "xlsx";
    readonly Docx: "docx";
    readonly Pptx: "pptx";
    readonly Html: "html";
    readonly Docyment: "docyment";
    readonly Chart: "chart";
    readonly DataSource: "data_source";
    readonly HtmlTemplate: "html_template";
    readonly CustomQuerySql: "custom_query_sql";
    readonly CustomQueryJson: "custom_query_json";
    readonly App: "app";
};
export type WorkTypes = typeof WorkTypes[keyof typeof WorkTypes];
export interface AssistantMessagePart {
    type: 'text' | 'loading' | 'image' | 'file';
    text?: string;
    url?: string;
    name?: string;
}
export interface AssistantMessage {
    id: string;
    role: 'user' | 'assistant';
    parts?: AssistantMessagePart[];
    timestamp: Date;
}
export interface AssistantSession {
    id: string;
    title: string;
    messages: AssistantMessage[];
    createdAt: Date;
    updatedAt: Date;
    createdBy?: {
        id: string;
        name: string;
    } | null;
}
export interface Project {
    id: string;
    name: string;
    tenant_ai_agent_id: string;
    description?: string;
    instructions?: string;
    tenant_ai_agent_deployment_id?: string;
    color?: string;
    icon?: string;
    shared_to?: string[];
    created_by?: string;
}
export interface Work {
    id: string;
    title: string;
    core_ai_model_id?: string | null;
    base_message_id?: string;
    base_thread_id?: string;
    content_json?: any;
    content_text?: string;
    created_by?: string;
    description?: string;
    shared_to?: string[];
    created_external_record_id?: string;
    created_record_id?: string;
    tenant_ai_agent_deployment_id?: string;
    tenant_ai_agent_id?: string;
    tenant_data_source_id?: string;
    tenant_ai_project_id?: string;
    type?: WorkTypes;
    image_url?: string;
    created_on?: Date;
    last_modified_on?: Date;
}
export interface Version {
    id: string;
    title: string;
    created_on: Date;
    created_by?: string;
    content_text?: string;
    content_json?: any;
    type?: WorkTypes;
}
export interface SpeechRecognitionInstance {
    continuous: boolean;
    interimResults: boolean;
    lang: string;
    start: () => void;
    stop: () => void;
    onstart: (() => void) | null;
    onresult: ((event: SpeechRecognitionEvent) => void) | null;
    onerror: ((event: SpeechRecognitionErrorEvent) => void) | null;
    onend: (() => void) | null;
}
export interface SpeechRecognitionResultList {
    length: number;
    [index: number]: SpeechRecognitionResult;
}
export interface SpeechRecognitionResult {
    [index: number]: SpeechRecognitionAlternative;
}
export interface SpeechRecognitionAlternative {
    transcript: string;
    confidence: number;
}
export interface SpeechRecognitionEvent {
    results: SpeechRecognitionResultList;
}
export interface SpeechRecognitionErrorEvent {
    error: string;
    message?: string;
}
export interface ReasoningLevel {
    id: string;
    name: string;
    default?: boolean;
}
export interface Model {
    id: string;
    name: string;
    provider: string;
    providerName?: string;
    providerLogoUrl?: string;
    supportThinking?: boolean;
    reasoningLevels?: ReasoningLevel[];
}
export interface Agent {
    id: string;
    name: string;
    description?: string;
    skillName?: string;
    avatar?: string;
    supportWebSearch?: boolean;
    supportThinking?: boolean;
    supportDocumentSearch?: boolean;
    supportDeepResearch?: boolean;
    supportWorkCanvas?: boolean;
}
export interface McpServer {
    id: string;
    name: string;
    logo?: {
        url?: string;
        signed_url?: string;
    };
    tenantConnections?: any[];
}
export interface DeploymentData {
    selectedModel?: Model | null;
    setSelectedModel?: (model: Model | null) => void;
    showMultiModels?: boolean;
    models?: Model[];
    selectedAgent?: Agent | null;
    setSelectedAgent?: (agent: Agent | null) => void;
    showAgents?: boolean;
    agents?: Agent[];
    agentAvatar?: string;
}
export interface Memory {
    id: string;
    title: string;
    content: string;
    memoryLevel?: string;
    importance?: number;
    tags?: string[];
    alwaysInclude?: boolean;
    archived?: boolean;
    createdOn?: string;
    lastModifiedOn?: string | null;
    sourceType?: string;
    tenantAiAgentId?: string | null;
}
export interface InitialFeatureFlags {
    webSearch?: boolean;
    thinking?: boolean;
    deepResearch?: boolean;
    documentSearch?: boolean;
    workCanvas?: boolean;
}
export declare const BASE_DATA_SOURCE_ID: {
    readonly thread: "f42b3daa-ca43-11ed-be9d-6fe3a1a7b37c";
    readonly message: "010e9ce2-ca44-11ed-bda6-6b0c6905cf5e";
};
export type PrincipalType = 'user' | 'team' | 'role' | 'tenant' | 'public';
export interface Principal {
    id: string;
    name: string;
    email?: string | null;
    photo?: string | null;
    icon?: string | null;
    principalType: PrincipalType;
    principalId: string;
    status?: number;
}
export interface ShareItem {
    id: string;
    aclId?: string;
    name: string;
    email?: string | null;
    photo?: string | null;
    icon?: string | null;
    principalType: PrincipalType;
    principalId: string | null;
    permissions: number;
    expiresAt?: string | null;
}
export declare const SHARE_PERMISSIONS: {
    readonly READ: 1;
    readonly WRITE: 2;
    readonly COMMENT: 4;
    readonly SHARE: 8;
    readonly DELETE: 16;
};
export declare const SHARE_PERMISSION_LEVELS: readonly [{
    readonly value: 1;
    readonly label: "Can view";
}, {
    readonly value: 3;
    readonly label: "Can edit";
}, {
    readonly value: 7;
    readonly label: "Can comment";
}, {
    readonly value: 11;
    readonly label: "Can share";
}, {
    readonly value: 31;
    readonly label: "Full access";
}];
/** An assistant (agent) reply the user picked while message selection is on. */
export interface SelectedAssistantMessage {
    id: string;
    text: string;
    /**
     * Raw AI SDK message parts (text, reasoning, tool calls, …). Passed through
     * untouched so hosts can extract tool outputs — e.g. an Adaptive Card from a
     * `renderAdaptiveCard` tool part — and forward them however they need.
     */
    parts: unknown[];
}
export interface DocyAssistantProps {
    isOpen?: boolean;
    onClose?: () => void;
    /**
     * When true, each assistant (agent) message renders a selection checkbox and
     * a Send/Cancel footer appears below the thread. Off by default. Hosts use
     * this to let the user pick agent replies and forward them elsewhere (e.g. a
     * Microsoft Teams chat).
     */
    enableMessageSelection?: boolean;
    /** Called with the picked assistant messages when the user presses Send. */
    onSendSelectedMessages?: (messages: SelectedAssistantMessage[]) => void | Promise<void>;
    /** Called when the user presses Cancel in the selection footer. */
    onCancelSelection?: () => void;
    supportWebSearch?: boolean;
    supportThinking?: boolean;
    supportFiles?: boolean;
    supportDocumentSearch?: boolean;
    supportDeepResearch?: boolean;
    supportMultiModels?: boolean;
    supportWorkCanvas?: boolean;
    supportedFileFormats?: string[];
    apiEndpoint?: string;
    title?: string;
    description?: string;
    placeholder?: string;
    logo?: string;
    footerText?: string;
    variant?: 'default' | 'docked' | 'expanded';
    /** Render mode: "modal" opens as dialog overlay, "inline" renders directly in parent container */
    renderMode?: 'modal' | 'inline';
    size?: 'default' | 'large';
    theme?: 'auto' | 'light' | 'dark';
    enableSidebar?: boolean;
    enableVoice?: boolean;
    enableMicrophone?: boolean;
    enableWelcomePage?: boolean;
    /** Show the header agent-tabs strip (pinned tab + "add agent"). Defaults to true. */
    enableAgentTabs?: boolean;
    maxMessages?: number;
    tenantAiAgentId: string;
    onMessageSend?: (message: string) => void;
    onVoiceStart?: () => void;
    onVoiceEnd?: () => void;
    className?: string;
    defaultFullscreen?: boolean;
    /**
     * Controlled fullscreen state. When provided, the package no longer manages
     * its own fullscreen state — pair with `onFullscreenChange` to fully control
     * the expand button.
     */
    isFullscreen?: boolean;
    hideExpand?: boolean;
    /** Hide the close (X) button in the header */
    hideCloseButton?: boolean;
    /** Hide the outer border of the assistant container */
    hideBorder?: boolean;
    /** Show the header bar (default true). */
    showHeader?: boolean;
    /** URL listing deployed agents for the "+" tab dropdown (defaults to `/ai/agent-deployments`). */
    agentSelectorUrl?: string;
    /** Fired when the user opens a new agent tab from the "+" dropdown. */
    onAgentChange?: (agentId: string, agentType: 'base' | 'deployment') => void;
    /** Fired when the assistant enters or exits fullscreen (true = entered). */
    onFullscreenChange?: (isFullscreen: boolean) => void;
    /** Show the share button on threads. Defaults to `false`. */
    enableSharing?: boolean;
    /**
     * Enable the floating thread debug panel (model picker, simulate, usage
     * statistics, system prompt inspection). Adds a debug toggle to the thread
     * header. Defaults to `false`.
     */
    enableDebugPanel?: boolean;
    /**
     * Host-driven "pin to side" control. When `onPin` is provided, a pin button
     * appears in the header to the left of the expand button. The host is
     * responsible for the actual docking layout (rendering the panel as a fixed,
     * resizable left column). `isPinned` reflects the current pinned state.
     */
    onPin?: () => void;
    isPinned?: boolean;
    /**
     * Callback when user taps the share button on a thread.
     * When provided, the host handles sharing UI. When omitted, the built-in sharing editor is used.
     */
    onShare?: (payload: {
        dataSourceId: string;
        recordId: string;
    }) => void;
    /**
     * Opens the assistant directly on a deployed agent: seeds the pinned tab with
     * this deployment id so its name, welcome message, model and tools come from
     * the deployment (`/ai/agent-deployments/:id`) instead of the base agent.
     */
    initialDeploymentId?: string;
    /**
     * Prompt staged into the composer when the assistant opens. The user reviews
     * and sends it — it is never submitted automatically. Re-staged whenever the
     * value changes, so hosts do not need to remount to hand over a new prompt.
     */
    initialPrompt?: string;
    /** Model preselected in the composer alongside the staged prompt */
    initialModelId?: string;
    /** Feature toggles preset in the composer alongside the staged prompt */
    initialFeatures?: InitialFeatureFlags;
    /** Files staged as composer attachments alongside the staged prompt */
    initialFiles?: File[];
    /**
     * Host environment identifier sent to the chat endpoint as `hostEnvironment`.
     * The backend uses this to filter the tool list bound to the agent so that
     * only tools available in the current environment are exposed.
     * Common values: 'web' | 'desktop' | 'chrome' | 'word' | 'excel' | 'powerpoint' | 'outlook'.
     */
    hostEnvironment?: string;
    /**
     * Id of the host app currently open in the page. Forwarded to the chat
     * endpoint as `appId` so the agent can scope its behavior/tools to it.
     * The user can dismiss the context chip in the assistant; once dismissed
     * the id stops being sent.
     */
    appId?: string;
    /** Display name for the current host app, shown in the context chip. */
    appName?: string;
    /** Docyrus icon identifier (e.g. "fas inbox") for the current host app, rendered via `<DocyrusIcon>` in the context chip. */
    appIcon?: string;
    /**
     * Host-provided tools the agent can call and have executed client-side.
     * Their definitions are forwarded to the chat endpoint as `clientTools`;
     * when the agent calls one, its `execute` runs in the browser and the
     * result is sent back to the agent automatically.
     */
    clientTools?: ClientTool[];
}
