@botonic/core
Version:
Runtime and APIs for Botonic bots: actions, context, messaging, and integration hooks used by the **current** framework line.
30 lines (29 loc) • 1.72 kB
TypeScript
import type { BotonicSession, UserExtraData } from '@botonic/shared';
import type { BotonicSecrets, BotonicSettings } from '@botonic/shared';
import type { HubtypeApiService } from '../../services/hubtype-api-service';
import type { BotonicContextType } from './botonic-context';
import { BotonicContext } from './botonic-context';
import type { BotonicRequestInput } from './botonic-context-input';
import type { ResolvedPlugins, TypingMode } from './types';
/** Bot request after parsing the Hubtype v2 Lambda event (typed input + session + settings + secrets). */
export interface BotonicRequest<TExtraData extends UserExtraData = UserExtraData> {
input: BotonicRequestInput;
session: BotonicSession<TExtraData>;
settings: BotonicSettings;
secrets: BotonicSecrets;
}
/**
* Factory that creates BotonicContext from raw lambda request.
* Injects hubtypeService so the context has working sendMessages, doHandoff, etc.
*/
export declare class BotonicContextFactory<TPlugins extends ResolvedPlugins = ResolvedPlugins> {
private readonly hubtypeService;
private readonly plugins;
private readonly defaultTyping;
private readonly defaultDelay;
private readonly defaultTypingMode;
constructor(hubtypeService: HubtypeApiService, plugins: TPlugins, defaultTyping: number, defaultDelay: number, defaultTypingMode?: TypingMode);
/** Creates input, session, settings, and secrets from a {@link BotonicRequest}. */
static from<TExtraData extends UserExtraData = UserExtraData>(raw: BotonicRequest<TExtraData>): BotonicContextType<TExtraData>;
create<TExtraData extends UserExtraData = UserExtraData>(raw: BotonicRequest<TExtraData>): BotonicContext<TPlugins, TExtraData>;
}