Skip to main content

Worker

Struct Worker 

Source
pub struct Worker {
    pub name: String,
    pub command: String,
    pub args: Vec<String>,
    pub allow: Option<String>,
    pub parse: Parser,
    pub reports_cost: bool,
    pub enforces_budget: bool,
    pub sandbox: bool,
    pub resumes: bool,
    pub env: BTreeMap<String, String>,
}

Fields§

§name: String§command: String§args: Vec<String>

Arguments, with {prompt}, {dir}, {model}, {budget} and {timeout} filled in at dispatch. {extra} stands for however many arguments a preset adds, and sits where a worker wants them: before a positional prompt for one that takes its message last.

§allow: Option<String>

A flag and a rule template separated by a space, such as --allowedTools Bash({cmd}). The flag is emitted once, the rule once per subcommand of the verify command. None means the worker has no allowlist, which the worktree and the scope check cover instead.

§parse: Parser§reports_cost: bool

Whether its output states what the run cost. A worker that does not leaves the cost unknown, never zero.

§enforces_budget: bool

Whether the budget argument is a bound the worker holds itself. claude checks its cap between turns and can exceed it, so this is false for claude too: a timeout is not a spend bound.

§sandbox: bool§resumes: bool

Whether a rework can continue the earlier session rather than re-prompting. Unused until a worker that does arrives.

§env: BTreeMap<String, String>

Environment the worker needs, such as a base URL for an OpenAI-compatible endpoint or a config path. Applied to the child after the credentials agent::restrict strips, so it cannot restore one. Provider API keys are inherited from the session and belong here only when a worker needs a different one from the shell’s.

Implementations§

Source§

impl Worker

Source

pub fn build( &self, prompt: &str, dir: &Path, model: Option<&str>, budget: f64, extra: &[String], timeout: Duration, ) -> Command

The command to run in dir. An argument whose placeholder has no value is dropped, and with it the argument before it when that one is a flag, so --model {model} disappears whole when no model is chosen.

Source

pub fn allow_verify(&self, cmd: &mut Command, verify: Option<&str>)

Appends the allowlist for verify, so the worker may run the check pma runs afterwards. A worker without an allowlist gets nothing: its reach is bounded by the worktree, not by this.

Source

pub fn claude() -> Worker

The worker pma shipped with. Seeded into the store on upgrade, and editable from there like any other.

Source

pub fn opencode() -> Worker

The two other workers pma ships a template for, both installed separately. Each reaches OpenAI, OpenRouter or an OpenAI-compatible endpoint through its own provider configuration: {model} is passed verbatim as provider/model, and the key comes from the environment.

Both are seeded with text-tail, which takes the verdict from the exit status and leaves the cost unknown rather than guessing at a field. A json: parser reads a cost once its output shape is known, and that is a pma agent set away rather than a code change.

Source

pub fn sanduk() -> Worker

The same claude, in a disposable container. sanduk holds the API key on the host and bind-mounts the worktree, so the container has the files and never the credential.

Four flags are not optional and are the reason this is a template rather than a line in the README. --work-at-host-path mounts the worktree at its own path, so a path in a diff or a stack trace resolves for whoever reads it here. --stream-json passes the agent’s own output through, which is what claude-json reads a cost from – without it sanduk reformats the result into prose and the cost is lost. --no-report-instruction keeps REPORT.md out of the worktree, where it would land in the diff and in the scope check. --timeout bounds the container from inside, so sanduk tears it down rather than leaving it for its own sweep.

key-safe over sealed: sealed blocks the fetch that cargo, go and pip do mid-build, and a run that cannot fetch fails for a reason that has nothing to do with the task. pma agent set sanduk args is where a portfolio whose images carry their toolchains tightens it.

No allowlist. The box is the bound, and a container that denies egress does not also need a Bash() rule: shipping both means believing in both.

Source

pub fn omp() -> Worker

Trait Implementations§

Source§

impl Clone for Worker

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Worker

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Worker

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Worker

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.