import { EventLog } from '../../workflows/events/append.js';
import { createRun, type BotResolver } from '../../workflows/run-init.js';
import { type RunLoopResult } from '../../workflows/loop.js';
import type { WorkflowDefinition } from '../../workflows/definition.js';
import { coerceWorkflowParamsFromStrings as coerceWorkflowParams } from '../../workflows/params.js';
export { coerceWorkflowParams };
import type { BotSnapshot } from '../../workflows/events/payloads.js';
import type { WorkflowRuntimeContext, WorkerSpawnFn } from '../../workflows/runtime.js';
import { type Locale } from '../../i18n/index.js';
export type WorkflowCommand = {
    kind: 'run';
    workflowId: string;
    rawParams: Record<string, string>;
} | {
    kind: 'cancel';
    runId: string;
} | {
    kind: 'invalid';
    error: string;
    usage: string;
};
export type WorkflowRunCreatedInfo = {
    runId: string;
    workflowId: string;
    params: Record<string, unknown>;
    ctx: WorkflowRuntimeContext;
};
export type WorkflowCommandResult = {
    handled: false;
} | {
    handled: true;
    ok: false;
    error: string;
    usage?: string;
} | {
    handled: true;
    ok: true;
    command: 'run';
    runId: string;
    workflowId: string;
    params: Record<string, unknown>;
    loopResult: RunLoopResult;
} | {
    handled: true;
    ok: true;
    command: 'cancel';
    runId: string;
    status: string;
    alreadyTerminal: boolean;
    pending?: boolean;
    cancelEventId?: string;
    lastSeq: number;
};
export type WorkflowCommandDeps = {
    loadWorkflowDefinitionFn?: (workflowId: string) => Promise<WorkflowDefinition>;
    makeRunId?: (workflowId: string) => string;
    makeEventLog?: (runId: string) => EventLog;
    createRunFn?: typeof createRun;
    botResolver?: BotResolver;
    spawnSubagent?: WorkerSpawnFn;
    attachWorkflowEventWatcher?: (runId: string, ctx: WorkflowRuntimeContext) => {
        ready?: Promise<unknown>;
    };
    runLoopFn?: (ctx: WorkflowRuntimeContext) => Promise<RunLoopResult>;
    cancelWorkflowRunFn?: (runId: string, reason: string, opts?: {
        expectedChatId?: string;
        by?: string;
    }) => Promise<{
        ok: true;
        runId: string;
        status: string;
        alreadyTerminal: boolean;
        pending?: boolean;
        cancelEventId?: string;
        lastSeq: number;
    } | {
        ok: false;
        error: string;
        status?: string;
    }>;
    onRunCreated?: (info: WorkflowRunCreatedInfo) => Promise<void> | void;
};
export type ExecuteWorkflowCommandInput = {
    content: string;
    chatId: string;
    larkAppId: string;
    initiator: string;
};
export declare function parseWorkflowCommand(content: string, locale?: Locale): WorkflowCommand | null;
export declare function executeWorkflowCommand(input: ExecuteWorkflowCommandInput, deps?: WorkflowCommandDeps): Promise<WorkflowCommandResult>;
export declare function createWorkflowRunId(workflowId: string, nowMs?: number): string;
export declare function resolveBotSnapshot(botName: string): BotSnapshot | undefined;
//# sourceMappingURL=workflow-slash-command.d.ts.map