Spaces:
Running
Running
| export interface CanResolveResult { | |
| allowed: boolean; | |
| reason?: string; | |
| } | |
| const ALLOWED_STATES = new Set([ | |
| "waiting_for_response", | |
| "followup_due", | |
| "resolver_reply_received", | |
| ]); | |
| /** | |
| * Check if a mission is eligible to be resolved. | |
| * Only missions in response-waiting states can be resolved. | |
| */ | |
| export function canResolve(mission: { state: string }): CanResolveResult { | |
| if (ALLOWED_STATES.has(mission.state)) { | |
| return { allowed: true }; | |
| } | |
| return { | |
| allowed: false, | |
| reason: `Mission state "${mission.state}" is not eligible for resolution. Must be one of: waiting_for_response, followup_due, resolver_reply_received.`, | |
| }; | |
| } | |