Skip to main content

beez_process/
execution.rs

1use std::ffi::OsString;
2use std::path::PathBuf;
3
4use beez_policy::HeadlessHarness;
5
6use crate::harness::HarnessCall;
7use crate::process_call::ProcessCall;
8
9/// A process invocation Beez can run.
10#[derive(Clone, Debug, Eq, PartialEq)]
11pub enum ExecutionRequest {
12    /// Sends a prompt to a coding harness.
13    Harness(HarnessCall),
14    /// Runs a direct process call.
15    Command(ProcessCall),
16}
17
18impl ExecutionRequest {
19    /// The harness this request prompts, if any.
20    #[must_use]
21    pub fn harness(&self) -> Option<HeadlessHarness> {
22        match self {
23            Self::Harness(call) => Some(call.harness()),
24            Self::Command(_) => None,
25        }
26    }
27
28    pub(crate) fn into_parts(self) -> (PathBuf, Vec<OsString>) {
29        match self {
30            Self::Harness(call) => call.into_parts(),
31            Self::Command(call) => call.into_parts(),
32        }
33    }
34}