Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

936 B
Raw Blame
import { DateTime } from 'luxon'

import { HogFlowAction } from '~/cdp/schema/hogflow'

import { CyclotronJobInvocationHogFlow, CyclotronJobInvocationResult } from '../../../types'
import { HogExecutorExecuteAsyncOptions } from '../../hog-executor-async.service'

export interface ActionHandlerResult {
    nextAction?: HogFlowAction
    scheduledAt?: DateTime
    finished?: boolean
    /** The action deliberately ended the invocation because its input did not match. */
    skipped?: boolean
    result?: unknown
    error?: any
}

export interface ActionHandlerOptions<T extends HogFlowAction> {
    invocation: CyclotronJobInvocationHogFlow
    action: T
    result: CyclotronJobInvocationResult<CyclotronJobInvocationHogFlow>
    hogExecutorOptions?: HogExecutorExecuteAsyncOptions
}

export interface ActionHandler {
    execute(options: ActionHandlerOptions<HogFlowAction>): ActionHandlerResult | Promise<ActionHandlerResult>
}