| 226 | |
| 227 | // fallow-ignore-next-line complexity |
| 228 | export async function handleSessionCommands(params: { |
| 229 | req: DaemonRequest; |
| 230 | sessionName: string; |
| 231 | logPath: string; |
| 232 | sessionStore: SessionStore; |
| 233 | leaseRegistry?: LeaseRegistry; |
| 234 | leaseLifecycleProvider?: LeaseLifecycleProvider; |
| 235 | invoke: DaemonInvokeFn; |
| 236 | invokeReplayAction?: DaemonInvokeFn; |
| 237 | androidAdbExecutor?: AndroidAdbExecutor; |
| 238 | }): Promise<DaemonResponse | null> { |
| 239 | const { |
| 240 | req, |
| 241 | sessionName, |
| 242 | logPath, |
| 243 | sessionStore, |
| 244 | leaseRegistry = new LeaseRegistry(), |
| 245 | leaseLifecycleProvider, |
| 246 | invoke, |
| 247 | invokeReplayAction, |
| 248 | androidAdbExecutor, |
| 249 | } = params; |
| 250 | |
| 251 | if (req.command === PUBLIC_COMMANDS.doctor) { |
| 252 | return await handleDoctorCommand({ |
| 253 | req, |
| 254 | sessionName, |
| 255 | sessionStore, |
| 256 | androidAdbExecutor, |
| 257 | }); |
| 258 | } |
| 259 | |
| 260 | if (getSessionCommandKind(req.command) === 'inventory') { |
| 261 | return await handleSessionInventoryCommands({ |
| 262 | req, |
| 263 | sessionName, |
| 264 | sessionStore, |
| 265 | }); |
| 266 | } |
| 267 | |
| 268 | if (req.command === 'runtime') { |
| 269 | return await handleRuntimeCommand({ |
| 270 | req, |
| 271 | sessionName, |
| 272 | sessionStore, |
| 273 | }); |
| 274 | } |
| 275 | |
| 276 | if (getSessionCommandKind(req.command) === 'state') { |
| 277 | return await handleSessionStateCommands({ |
| 278 | req, |
| 279 | sessionName, |
| 280 | logPath, |
| 281 | sessionStore, |
| 282 | }); |
| 283 | } |
| 284 | |
| 285 | if (req.command === PUBLIC_COMMANDS.clipboard) { |