import type { RailDeckDirectIntegrationClient as Client } from '@raildeck/frontend-sdk/direct-integration'; /** * Recover the original trial command before reading its signal setup again. * @param client - Configured client; the caller owns current authority. * @param accountId - Authorised account for this workflow. * @param layoutId - Explicitly selected layout within the account. * @param controllerId - Explicitly selected command station. * @param setupId - Original signal setup being reviewed. * @param commandId - Original command identity; never replace it to retry. * @param signal - Caller-owned cancellation signal. * @returns Original command evidence and setup; an unknown result never triggers another trial. */ export async function recoverSignalTrial( client: Client, accountId: string, layoutId: string, controllerId: string, setupId: string, commandId: string, signal: AbortSignal, ) { const options = { signal, timeoutMs: 15_000 }; const outcome = await client.liveCommands.recoverAccessoryCommand( accountId, controllerId, commandId, { layoutId }, options, ); const setup = await client.signalSetups.get(accountId, layoutId, setupId, options); return { outcome, setup }; }