Skip to main content

EffectiveBindingPolicy

Struct EffectiveBindingPolicy 

Source
pub struct EffectiveBindingPolicy {
Show 25 fields pub binding_index: Option<usize>, pub allowed_tools: Vec<String>, pub outbound_allowlist: OutboundAllowlistConfig, pub skills: Vec<String>, pub model: ModelConfig, pub system_prompt: String, pub sender_rate_limit: Option<SenderRateLimitConfig>, pub allowed_delegates: Vec<String>, pub remote_triggers: Vec<RemoteTriggerEntry>, pub language: Option<String>, pub link_understanding: LinkUnderstandingConfig, pub web_search: WebSearchPolicy, pub pairing: PairingPolicy, pub dispatch_policy: DispatchPolicy, pub proactive: ProactiveConfig, pub role: Option<String>, pub lsp: LspPolicy, pub team: TeamPolicy, pub config_tool: ConfigToolPolicy, pub repl: ReplConfig, pub auto_approve: bool, pub workspace_path: Option<PathBuf>, pub channel: Option<String>, pub account_id: Option<String>, pub tool_rate_limits: Option<ToolRateLimitsConfig>,
}
Expand description

Concrete capability snapshot for one session attached to one binding.

Held behind an Arc so it can be cheaply cloned into session tasks, tool handlers, and rate-limiter lookups.

Fields§

§binding_index: Option<usize>

Index of the matched binding in AgentConfig::inbound_bindings when the runtime resolved the event to a concrete binding. None for policies synthesised from agent-level defaults (legacy bindingless agents, delegation receive, heartbeat). Used for tracing/telemetry and as the cache key for per-binding tool registries and sender rate limiters.

§allowed_tools: Vec<String>

Replaces AgentConfig::allowed_tools for this session. The special value ["*"] means “every registered tool”; any other content is matched with the usual trailing-* glob convention.

§outbound_allowlist: OutboundAllowlistConfig§skills: Vec<String>§model: ModelConfig§system_prompt: String

Fully composed system prompt (agent base + optional addendum).

§sender_rate_limit: Option<SenderRateLimitConfig>

Resolved rate limit: None means “no per-sender cap on this binding”, Some(cfg) means “apply cfg”. Both the Disable keyword and an absent agent-level limit resolve to None.

§allowed_delegates: Vec<String>§remote_triggers: Vec<RemoteTriggerEntry>

Phase 79.8 — resolved RemoteTrigger destination allowlist. InboundBinding::remote_triggers replaces the agent-level list when present; otherwise the agent-level remote_triggers is inherited.

§language: Option<String>

Output language for LLM replies. None = no directive (model picks based on user input). When Some(lang), the runtime renders a # OUTPUT LANGUAGE system block telling the model to reply in that language while keeping workspace docs (English) as-is.

§link_understanding: LinkUnderstandingConfig

Phase 21 — resolved link-understanding config (per-binding override over agent-level default). Disabled by default; operators opt in per agent or per channel.

§web_search: WebSearchPolicy

Phase 25 — resolved web-search policy. Disabled by default. provider == "auto" (or empty) lets the router pick by available credentials.

§pairing: PairingPolicy

Phase 26 — pairing policy. Default auto_challenge=false, i.e. the inbound gate is a no-op. Per-binding config can flip this on for user-facing surfaces (whatsapp / telegram).

§dispatch_policy: DispatchPolicy

Phase 67.D.1 — resolved project-tracker dispatch policy. mode == None (default) keeps program_phase and friends unregistered for this binding; read_only exposes the query tools; full exposes the dispatch surface. The DispatchGate (67.D.2) consumes this together with the pairing trust signal before admitting a program_phase call.

§proactive: ProactiveConfig

Phase 77.20 — resolved proactive tick-loop config for this binding.

§role: Option<String>

Optional binding role tag (coordinator, worker, proactive).

§lsp: LspPolicy

Phase 79.5 — resolved LSP policy. Per-binding override replaces the agent-level lsp block; binding None inherits.

§team: TeamPolicy

Phase 79.6 — resolved team policy. Per-binding override replaces the agent-level team block.

§config_tool: ConfigToolPolicy

Phase 79.10 — resolved config-tool policy (gates self-edit, allowed_paths, approval_timeout). Per-binding override replaces the agent-level config_tool block.

§repl: ReplConfig

Phase 79.12 — resolved REPL config. Per-binding override replaces the agent-level repl block. Closes a latent bug: the override was already declared on InboundBinding::repl but never consumed by the resolver before C1.

§auto_approve: bool

Phase 80.17 — resolved auto-approve dial. false (default) keeps the existing interactive-approval behaviour; true enables auto-allow for the curated tool subset (read-only + scoped writes + notifications + multi-agent coordination). Destructive bash, writes outside workspace_path, ConfigTool, REPL, remote_trigger, schedule_cron and unknown tools always fall through to the interactive prompt regardless of this flag. Composes with Phase 16 binding policy: the flag never adds tools to the binding’s surface, only skips approval for tools already on the surface AND in the curated subset.

§workspace_path: Option<PathBuf>

Phase 80.17 — canonical workspace path used by the auto-approve dial to scope FileEdit / FileWrite. None disables the workspace-bounded auto-allow path (those tools always ask). Set at boot from agent.workspace.

§channel: Option<String>

Phase 82.1 Step 2 — channel name copied from InboundBinding.plugin ("whatsapp" / "telegram" / "email" / "web" / …) when the runtime resolved the inbound to a concrete binding. None for synthesised policies (delegation receive, heartbeat, tests). Feeds the BindingContext propagated to tool calls so extensions and MCP servers can route per-channel.

§account_id: Option<String>

Phase 82.1 Step 2 — account / instance discriminator copied from InboundBinding.instance. None when the binding declared no instance (single-account default) or for synthesised policies.

§tool_rate_limits: Option<ToolRateLimitsConfig>

Phase 82.7 — resolved per-binding tool rate-limit overrides. None (default) inherits the global AgentConfig.tool_rate_limits (or unlimited if neither is set). Some(map) FULLY REPLACES the global decision for this binding — no fall-through to global patterns. Operators wanting per-binding tighter caps with global fallback must explicitly include the global patterns in the binding map.

Implementations§

Source§

impl EffectiveBindingPolicy

Source

pub fn binding_id(&self) -> Option<String>

Phase 82.1 Step 2 — render the stable <channel>:<account_id|"default"> binding identifier. Returns None when the policy has no channel match (synthesised — delegation / heartbeat / tests).

Reusable across tests and downstream consumers; the binding_context_from_effective free fn calls this helper to fill the BindingContext.binding_id field.

Source§

impl EffectiveBindingPolicy

Source

pub fn resolve(agent: &AgentConfig, binding_index: usize) -> Self

Build the effective policy for the binding_index-th binding of agent. Out-of-range indices fall back to the agent-level defaults so callers in legacy/unbound code paths can still produce a policy.

Source

pub fn from_agent_defaults(agent: &AgentConfig) -> Self

Build a policy that simply mirrors agent-level settings, used by code paths that don’t have a matched binding (delegation intake, heartbeat wake-ups, tests). binding_index is None so the cache key space for real bindings (0..N) stays disjoint from the legacy/unbound path.

Source

pub fn resolved(agent: &AgentConfig, binding_index: usize) -> Arc<Self> ⓘ

Convenience helper for the common Arc-wrapped usage.

Source

pub fn tool_allowed(&self, name: &str) -> bool

Check whether a tool name is permitted by this binding’s allowlist. Rules:

  • empty list → every tool allowed (back-compat: agents that don’t narrow the set).
  • "*" entry → every tool allowed.
  • pattern ending in * → prefix match.
  • anything else → exact match.

Used in the LLM turn loop both to prune the tool list shown to the model and to deny execution of anything the model calls from outside the allowlist (defense-in-depth).

Trait Implementations§

Source§

impl Clone for EffectiveBindingPolicy

Source§

fn clone(&self) -> EffectiveBindingPolicy

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 EffectiveBindingPolicy

Source§

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

Formats the value using the given formatter. Read more

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<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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more