useFlightManager provides direct control over the flight lifecycle: starting, pausing, resuming, ending, and commenting on flights. It hydrates state from GET /api/flight-manager/state and subscribes to flight:manager Socket.io events for real-time updates.
For most plugins, useTrackingSession is the better starting point — it wraps useFlightManager with derived state (isTracking, isPaused, elapsedTime, phase) and recovery handling. Use useFlightManager when you need lower-level control or want to avoid the extra derived state computation.
Import
Signature
Return value
| Field | Type | Description |
|---|---|---|
currentFlight | CurrentFlight | null | Active flight state, or null when no flight is in progress |
startFlight | (plan: FlightPlan) => Promise<StartFlightResult> | Begin a new flight with the given flight plan |
pauseFlight | () => Promise<boolean> | Pause the active flight |
resumeFlight | () => Promise<boolean> | Resume a paused flight |
endFlight | (status?) => Promise<boolean> | End the active flight with an optional terminal status |
addComment | (message: string) => Promise<boolean> | Attach a pilot comment to the active flight |
runPreflightChecks | (plan: FlightPlan) => Promise<PreflightCheckResult | null> | Validate a flight plan before starting |
Types
FlightPlan
StartFlightResult
PreflightCheckResult
CurrentFlight
Usage
Start a flight
Run preflight checks first
End a flight
Notes
- All action methods (
startFlight,pauseFlight, etc.) call REST endpoints on the local shell server at port 2066. They return a boolean or result object indicating success. - State updates arrive via
flight:managerSocket.io events — thecurrentFlightvalue updates reactively without polling. runPreflightChecksreturnsnullif the server is unreachable.