/** * `memoflow.step(...)` (P6.1) — retry-promotion for implicit HTTP steps. * * An implicit `fetch` follows fetch's own failure semantics: a network error * (and, when configured, a 5xx) throws into user code, and the user's try/catch * governs — exactly as an inline call would. There is no server-side retry * policy behind a bare fetch. * * When you WANT policy-driven retry for an HTTP call, wrap it: * * ```ts * const res = await memoflow.step(() => fetch(url), { * retry: { maxAttempts: 5, initialBackoff: '1s' }, * }); * ``` * * `memoflow.step` retries the provided function with exponential backoff. The * inner `fetch` is still captured as a durable implicit step, so the SUCCESSFUL * attempt's response is checkpointed and replayed on recovery — the retries * before it are transient and not individually durable (a crash mid-retry * simply re-runs from the last durable step, same at-least-once contract as an * activity). * * See docs/IMPLICIT-STEPS.md for the failure-semantics table comparing bare * fetch, `memoflow.step`, and `ctx.activity`. */ import type { RetryPolicy } from '../types.js'; export interface StepOptions { retry?: RetryPolicy; /** * Treat these HTTP statuses as retryable failures. Default: 5xx (>= 500). * A response whose status is retryable is thrown internally so the retry * loop re-runs `fn`; the final (successful or last) response is returned. */ retryOnStatus?: (status: number) => boolean; } /** * Run `fn` with policy-driven retry. `fn` typically performs an implicit * `fetch`. Returns the resolved value of the last (successful) attempt. */ export declare function step(fn: () => Promise, options?: StepOptions): Promise; /** The `memoflow` namespace object exported from the SDK root. */ export declare const memoflow: { step: typeof step; };