OperationRegistry
Process-singleton registry of in-flight value-bearing wallet operations (#261-264). Mirrors MidnightWallet.syncStatus's observable-state model:
active — the set of operations in flight. The foreground service keeps the process alive while it is non-empty; com.midnight.kuira.sdk callers in wallet-runtime hold the session-lock off it.
outcomes — a one-shot terminal stream the finalization notifier rides.
The SDK's built-ins (send / dust-registration / contract call) and any third-party dApp enroll through the SAME registry via run (wrapped publicly by MidnightSdk.runForegroundOperation), so there is ONE source of truth, not three. The registry is pure Kotlin/coroutines — no Android, fully unit-testable.
Functions
Request the user's ATTENTION for the operation the CURRENT coroutine is inside (#264): emits an OperationAttention a presentation edge turns into a heads-up notification, to pull a user who left the app back to a step that needs them. Tagged with the op's OperationDescriptor.contentIntent so the alert taps back to the right screen. No-op outside a tracked operation. The edge decides whether to actually alert (e.g. suppress when foreground), so callers may fire this unconditionally.
Run block as a tracked operation: enroll it in active, run it, classify the result into a terminal OperationOutcome (emitted on outcomes), and de-enroll in finally — whether block returns OR throws.
Update the live ActiveOperation.stage of the operation the CURRENT coroutine is running inside (identified by the context Marker) — so a tracked block can drive the foreground-service notification text ("Submitting commit…" → "Finalizing…") without threading an id around. No-op outside a tracked operation.