pub struct WorkOrder {
pub intent: Intent,
pub calls: Vec<ToolCall>,
pub requests: GrantSet,
pub origin: ProposalOrigin,
}Expand description
ω — a typed declaration of intended effect. Immutable.
A work order is a proposal. It commits to nothing, authorises nothing, and grants nothing. It records what the model intends, which tools it wants to call, which permissions it is asking for, and where the proposal came from.
§Example
use boundgraph_core::{Canonical, Digest, GrantAtom, GrantSet, Intent, ProposalOrigin, WorkOrder};
let order = WorkOrder::new(
Intent::new("patch.apply", &"fix the off-by-one in parse_header")?,
vec![],
GrantSet::new([GrantAtom::new("fs", "write", "/src/**")]),
ProposalOrigin::new("claude-opus-5", [], Digest::of(b"prompt")),
);
// A proposal asks; it does not receive.
assert_eq!(order.requests.len(), 1);
// And it is content-addressed, so it can be referenced from the ledger.
let _id = order.digest()?;Fields§
§intent: IntentWhat effect is intended.
calls: Vec<ToolCall>The tool calls proposed, in the order proposed.
requests: GrantSetThe permissions the model is asking for.
Named requests, not grants: what is actually permitted is decided
by the compiler and the grant gate, never by the proposer.
origin: ProposalOriginWhat produced this proposal.
Implementations§
Source§impl WorkOrder
impl WorkOrder
Sourcepub fn new(
intent: Intent,
calls: Vec<ToolCall>,
requests: GrantSet,
origin: ProposalOrigin,
) -> Self
pub fn new( intent: Intent, calls: Vec<ToolCall>, requests: GrantSet, origin: ProposalOrigin, ) -> Self
Construct a work order. Complete on construction, immutable thereafter.
Sourcepub fn id(&self) -> Result<Digest, CanonicalError>
pub fn id(&self) -> Result<Digest, CanonicalError>
This order’s content address.
§Errors
Returns CanonicalError if the order cannot be canonically encoded.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for WorkOrder
impl<'de> Deserialize<'de> for WorkOrder
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for WorkOrder
Auto Trait Implementations§
impl Freeze for WorkOrder
impl RefUnwindSafe for WorkOrder
impl Send for WorkOrder
impl Sync for WorkOrder
impl Unpin for WorkOrder
impl UnsafeUnpin for WorkOrder
impl UnwindSafe for WorkOrder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Canonical for T
impl<T> Canonical for T
Source§fn canonical_bytes(&self) -> Result<Vec<u8>, CanonicalError>
fn canonical_bytes(&self) -> Result<Vec<u8>, CanonicalError>
The canonical CBOR encoding of this value.