validateStartInput
validateStartInput(
input,modalityOf):ValidateStartResult
Defined in: console-sdk/src/session/plan.ts:178
Dry-runs a StartWorkoutInput through the SAME resolution start()
uses, returning the resolved plan or the rejection as a VALUE instead of
throwing (SDK_PLAN.md §3.6.5). This is what a pre-flight “can I start?” UI
needs: it can disable Start and show error.message without arming a workout
— and without copying the SDK’s mode-coherence / role-coverage / leg-ceiling
(MAX_EXPANDED_LEGS) rules, which would silently drift from firmware.
modalityOf resolves a bare-DeviceId input.devices to its modality (a
fleet lookup the caller owns); it is never called for a RoleAssignment
input. Pure apart from that callback: no clock, no I/O. It calls the exact
resolveAssignment + resolvePlan the engine calls, so it can never diverge
from what start() accepts.
Parameters
Section titled “Parameters”The programming input to validate.
modalityOf
Section titled “modalityOf”(id) => Modality | null
Resolves a device id to its modality (for the bare-id case).
Returns
Section titled “Returns”{ ok: true, plan }, or { ok: false, error } on any invalid-plan
rejection.
Example
Section titled “Example”const check = validateStartInput(input, (id) => deviceById(id)?.modality ?? null);const canStart = check.ok;