import { CitationsManager } from 'llmz';
import { Client, Conversation, User, Workflow } from '@botpress/client';
import { AnyIncomingEvent, AnyIncomingMessage, BaseBot, BotSpecificClient, BotLogger, BotOperation } from '@botpress/sdk/dist/bot';
import { Cognitive } from '@botpress/cognitive';
import { Chat } from '../chat/chat.js';
import { HttpRequest } from './http.js';
import { type TrackedState } from '../tracked-state.js';
import { type TrackedTags } from '../tracked-tags.js';
import { RegisteredIntegration, RegisteredInterface } from '../../types.js';
import type { WorkflowStepContext } from '../../primitives/workflow-instance.js';
import { PromiseTracker } from './promises.js';
import { BotTags } from '../../_types/tags.js';
export type InternalClient<TBot extends BaseBot> = BotSpecificClient<TBot> & {
    _inner: Client;
};
export type WorkflowControlContext = {
    workflow: Workflow;
    signal: AbortSignal;
    abort: () => void;
    fail: (reason: string) => void;
    complete: (result: unknown) => void;
    aborted: boolean;
    failed: boolean;
    failedReason?: string;
    completed: boolean;
    completedResult?: unknown;
    acked: boolean;
    ack: () => Promise<void>;
    restart: () => void;
    restarted: boolean;
};
export type BotContext<TBot extends BaseBot = BaseBot, Config = any> = {
    executionId: string;
    executionFinished: boolean;
    request: HttpRequest;
    botId: string;
    bot: {
        id: string;
        tags: BotTags;
        userId: string;
        configuration: Config;
    };
    client: InternalClient<TBot>;
    cognitive: Cognitive;
    logger: BotLogger;
    operation: BotOperation;
    configuration: Config;
    conversation?: Conversation;
    citations: CitationsManager;
    user?: User;
    event?: AnyIncomingEvent<TBot>;
    message?: AnyIncomingMessage<TBot>;
    workflow?: Workflow;
    workflowControlContext?: WorkflowControlContext;
    workflowStep?: WorkflowStepContext;
    interfaces?: RegisteredInterface[];
    integrations?: RegisteredIntegration[];
    chat?: Chat;
    states: TrackedState[];
    tags: TrackedTags[];
    runtime: {
        sandboxName: string;
        memoryInMb: number;
        getRemainingExecutionTimeInMs: () => number;
    };
    scheduledHeavyImports: Set<string>;
    promiseTracker: PromiseTracker;
};
export declare const context: {
    enterWith: (data: BotContext) => void;
    run: <TReturn>(data: BotContext, callback: () => TReturn) => TReturn;
    getAll: () => BotContext;
    get: <T extends keyof BotContext = keyof BotContext<BaseBot, any>>(key: T, opts?: {
        optional?: boolean;
    }) => Required<BotContext>[T];
    set: (key: keyof BotContext, value: any) => void;
    /**
     * Set a default context that will be used as a fallback when no AsyncLocalStorage context is active.
     * This is useful for testing and script execution where code runs outside of request handlers.
     *
     * @example
     * ```typescript
     * context.setDefaultContext({
     *   botId: 'my-bot',
     *   integrations: agentRegistry.integrations,
     *   interfaces: agentRegistry.interfaces,
     * })
     * ```
     */
    setDefaultContext: (data: Partial<BotContext>) => void;
    /**
     * Clear the default context.
     */
    clearDefaultContext: () => void;
};
//# sourceMappingURL=context.d.ts.map