import type { ActivityFailedEvent, ActivitySucceededEvent } from '../events/types.js';
import type { ExecutorErrorClassification, HostExecutorContext, SideEffectingExecutor } from './types.js';
export type SideEffectingResult<Output> = {
    ok: true;
    event: ActivitySucceededEvent;
    output: Output;
    externalRefs: Record<string, unknown>;
} | {
    ok: false;
    event: ActivityFailedEvent;
    error: ExecutorErrorClassification;
};
/**
 * Drive the side-effecting protocol for one attempt (events doc v0.1.2
 * §2.3, §4.3).  Writes three events in order:
 *
 *   1. `effectAttempted` — written **before** invoking the provider so a
 *      crash mid-call leaves a dangling intent that resume can reconcile.
 *   2. provider invocation (via `executor.invoke`).
 *   3. `activitySucceeded` OR `activityFailed` — terminal event for this
 *      attempt; carries `externalRefs` on success or classified error on
 *      failure.
 *
 * The protocol does NOT write `attemptCreated/leaseSigned/activityRunning`
 * — those are the scheduler/worker layer's responsibility.  This function
 * assumes the caller has already advanced the activity to `running`.
 *
 * The protocol does NOT do retry/backoff — that's the scheduler's job
 * (Step 7+).  A failed invocation is reported via `ok: false` and the
 * caller decides whether to spawn a new `attemptCreated`.
 *
 * Idempotency contract:
 *   - `idempotencyKey` is deterministic per attempt (5-tuple hash), so
 *     re-running the same attempt with the same input produces the same
 *     uuid → Feishu/schedule provider returns the original ref.
 *   - `inputHash` is recorded for the resume path to detect attempt
 *     mutability violations (Step 7).  This function doesn't enforce
 *     immutability across calls — Step 7 reads recorded inputHash and
 *     fails if a future attempt re-derives a different one.
 */
export declare function executeSideEffect<I, O>(ctx: HostExecutorContext, input: I, executor: SideEffectingExecutor<I, O>): Promise<SideEffectingResult<O>>;
//# sourceMappingURL=protocol.d.ts.map