/** * Caller intention ids for mutating MT5 actions (eaera-mt5 T010, PO ruling * 2026-10-11). * * eaera-mt5 executes every mutating action at most once per `intention_id` * and refuses one without it (`missing_intention_id`). The id names the * USER'S INTENT, not the wire request: * - one user action (one click / one confirm) = one fresh UUID v4; * - a retry of that same intent (WS resend, double submit of the same * intent) re-sends the SAME id, so the server answers with the recorded * outcome instead of executing it again. * * The WS client (`core/ws/createEaeraWebSocket.invokeAction`) injects a * fresh id when the caller omits it; callers that own the retry loop keep * minting intents via `createActionIntent` and re-sending `intent.params` * verbatim so every retry carries the same id. * * The action result is now `data.status = 'sent'` (handed to MT5), never * "filled": the fill arrives later as a deal / position / order update on * the realtime streams. `isActionSent` lets the UI show "submitted" instead * of a fill or an error. */ /** Wire name of the intention param (action params are snake_case). */ export declare const INTENTION_ID_PARAM = "intention_id"; /** `action_result.data.status` values eaera-mt5 reports for an intention. */ export declare const ACTION_RESULT_STATUS: { readonly SENT: "sent"; readonly FILLED: "filled"; readonly FAILED_TO_SEND: "failed_to_send"; }; export type ActionResultStatus = (typeof ACTION_RESULT_STATUS)[keyof typeof ACTION_RESULT_STATUS]; /** One user intent: its id plus the action params that carry it. */ export interface IActionIntent { readonly intentionId: string; readonly params: Readonly>; } /** * A fresh UUID v4. Uses `crypto.randomUUID` when available; falls back to * `crypto.getRandomValues` (randomUUID needs a secure context in browsers). * Never falls back to `Math.random` — a weak id could collide with another * intent and be deduplicated away server-side. */ export declare const createIntentionId: () => string; /** * Build the intent for ONE user action. Pass `intentionId` only to retry an * existing intent; omit it for a new action. The returned params are frozen, * so every (re)send of this intent carries the same id. */ export declare const createActionIntent: (params?: Record, intentionId?: string) => IActionIntent; /** `action_result.data.status`, or `null` when the result carries none. */ export declare const actionResultStatus: (result: { data?: unknown; } | null | undefined) => string | null; /** * True when the action was accepted and handed to MT5 but its outcome is not * known yet (`status: 'sent'`). The caller should show "submitted" and wait * for the realtime deal / position / order update — not a fill, not an error. */ export declare const isActionSent: (result: { success: boolean; data?: unknown; } | null | undefined) => boolean; //# sourceMappingURL=intention.d.ts.map