brokerd: the podman argument lists
Implemented-By: OpenCode session (model recorded in docs/implementer-log.md)
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
//!
|
||||
//! ```compile_fail
|
||||
//! let _ = brokerd::runner::RunSpec {
|
||||
//! session: proto::SessionId::new("s1").unwrap(),
|
||||
//! call: proto::CallId(1),
|
||||
//! tool: brokerd::args::ToolName::Shell,
|
||||
//! arguments: todo!(),
|
||||
//! mounts: Vec::new(),
|
||||
@@ -20,7 +22,7 @@
|
||||
|
||||
use crate::args::{ToolArgs, ToolName};
|
||||
use crate::policy::Decision;
|
||||
use proto::ToolResponse;
|
||||
use proto::{CallId, SessionId, ToolResponse};
|
||||
|
||||
/// A directory mounted for one call: a path and whether the runtime may write to it.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@@ -29,10 +31,13 @@ pub struct Mount {
|
||||
pub writable: bool,
|
||||
}
|
||||
|
||||
/// What one call was turned into before it reached a `Runtime`: the tool, its arguments, the
|
||||
/// directories mounted and the hosts it may reach. Built only here, from a `Decision`.
|
||||
/// What one call was turned into before it reached a `Runtime`: the session and call it is, the
|
||||
/// tool, its arguments, the directories mounted and the hosts it may reach. Built only here, from a
|
||||
/// `Decision`.
|
||||
#[derive(Debug)]
|
||||
pub struct RunSpec {
|
||||
session: SessionId,
|
||||
call: CallId,
|
||||
tool: ToolName,
|
||||
arguments: ToolArgs,
|
||||
mounts: Vec<Mount>,
|
||||
@@ -40,6 +45,12 @@ pub struct RunSpec {
|
||||
}
|
||||
|
||||
impl RunSpec {
|
||||
pub fn session(&self) -> &SessionId {
|
||||
&self.session
|
||||
}
|
||||
pub fn call(&self) -> CallId {
|
||||
self.call
|
||||
}
|
||||
pub fn tool(&self) -> ToolName {
|
||||
self.tool
|
||||
}
|
||||
@@ -108,6 +119,8 @@ pub fn run(decision: Decision, runtime: &dyn Runtime) -> proto::ToolResponse {
|
||||
ToolArgs::HttpFetch(_) => (Vec::new(), Some(decision.hosts().to_vec())),
|
||||
};
|
||||
let spec = RunSpec {
|
||||
session: decision.request().session.clone(),
|
||||
call: decision.request().call,
|
||||
tool: args.tool(),
|
||||
arguments: args.clone(),
|
||||
mounts,
|
||||
|
||||
Reference in New Issue
Block a user