Skip to main content

HttpRequestTool

Struct HttpRequestTool 

Source
pub struct HttpRequestTool { /* private fields */ }

Implementations§

Source§

impl HttpRequestTool

Source

pub const AUTH_PROFILE_NAMESPACE: &'static str = "auth_profile:"

Source

pub const ACCOUNT_NAMESPACE: &'static str = "account:"

Source

pub fn new(profiles: Arc<RwLock<HashMap<String, HttpAuthProfile>>>) -> Self

The owner’s approval is asked by the agent kernel (its ApprovalPolicy with the daemon’s rules, from HttpRequestTool::owner_approval_request), never by the tool.

Source

pub fn with_oauth_gateway(self, gateway: impl OAuthTokens + 'static) -> Self

Source

pub async fn set_oauth_gateway(&self, gateway: impl OAuthTokens + 'static)

Source

pub fn domain_matches(request_domain: &str, allowed: &str) -> bool

Check if a request domain is allowed by the profile’s allowed_domains. Supports exact match and subdomain match (api.twitter.com matches twitter.com) but NOT suffix tricks (evil-twitter.com does NOT match twitter.com).

Source

pub fn auth_profile_resource_id(profile_name: &str) -> String

Source

pub fn apply_auth( builder: RequestBuilder, profile: &HttpAuthProfile, method: &str, url: &str, body: Option<&str>, content_type: Option<&str>, ) -> Result<RequestBuilder>

Apply auth to a request builder based on profile auth_type.

Source

pub fn owner_approval_request(args: &Value) -> Option<OwnerApprovalRequest>

The owner approval a request needs (H7), from its arguments as the model wrote them: none for a GET, HEAD or OPTIONS without a body or a method or authority override header, unless it targets a local site (one card per site, naming only the site); anything else asks, High risk, with subject "{METHOD} {url}" (the canonical URL, so grants match it exactly) and up to 500 characters of the body in the summary.

Trait Implementations§

Source§

impl OutcomeTool for HttpRequestTool

Source§

fn name(&self) -> &str

Source§

fn description(&self) -> &str

One-line description.
Source§

fn schema(&self) -> Value

The full function object: name, description and parameters.
Source§

fn execute<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, arguments: &'life1 str, facts: &'life2 ToolCallContext, ) -> Pin<Box<dyn Future<Output = Result<ToolCallOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Run one call. Err is a failed call whose message the model reads.
Source§

fn validate_call(&self, _arguments: &Value) -> Result<(), String>

Checks made before a kernel agent runs the call.
Source§

fn approval_card_mode(&self) -> Option<PermissionMode>

The permission mode the owner’s cards for this tool are sent with (it picks the buttons offered). None: the default, Cautious.
Source§

fn approval_card_kind(&self, _request: &OwnerApprovalRequest) -> ApprovalKind

The kind of card the owner is asked request (from ToolSemantics::owner_approval_request) with, which picks the buttons offered: a one-time card or a goal confirmation offers no session or persistent grant. The default is a standard command card.
Source§

fn record_owner_answer<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _call: &'life1 ApprovalCall<'life2>, _facts: &'life3 ToolCallContext, _response: Option<ApprovalResponse>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Apply the owner’s answer to a card asked for call (from ToolSemantics::owner_approval_request) to the tool’s own grant stores. None: the card timed out or never reached the owner. The default keeps nothing; the kernel’s session grants are separate.
Source§

impl ToolSemantics for HttpRequestTool

Source§

fn validate_arguments( &self, arguments: &str, ) -> Result<(), ToolArgumentContractViolation>

A body declared as JSON must parse. Rejected here, before any grant is reserved or byte is sent, the caller can fix it and call again.

Source§

fn owner_approval_request<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, call: &'life1 ApprovalCall<'life2>, facts: &'life3 ToolCallContext, ) -> Pin<Box<dyn Future<Output = OwnerApprovalNeed> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

H7: a trusted scheduled session or a mandate run (whose exact action grant the dispatcher checks) needs no card; otherwise a GET, HEAD or OPTIONS without a body or override header runs and anything else asks, High risk.

Source§

fn call_outbound(&self, arguments: &str) -> Outbound

Only the URL leaves on a plain read. Anything else the call adds (query parameters, headers, a body) is text the model wrote.

Source§

fn call_effects(&self, arguments: &str) -> CallEffects

The request’s host (host:port, the URL’s port or else the scheme’s default) and the stored credential profile it uses, after the same URL canonicalization the request runs with (tool parameters embedded in the query are recovered first).

Source§

fn call_annotations_in( &self, arguments: &str, _roots: &TrustRoots<'_>, ) -> ToolAnnotations

Owner credentials turn any method into egress: a credentialed GET can still trigger actions or leak the account’s data.

Source§

fn dispatch_facts(&self) -> ToolDispatchFacts

How the dispatcher and the engine treat this tool. Default: nothing special.
Source§

fn capabilities(&self) -> ToolCapabilities

Capability metadata used by the execution policy and risk gate. Defaults are intentionally conservative.
Source§

fn stable_observation_subjects(&self) -> Vec<StableObservationSubject>

Exact receipt subjects this adapter reports verbatim: fixed collection IDs and the namespaces of member identities it mints. The checklist tool publishes the union so declared targets bind only to identities a receipt can carry. The default advertises nothing.
Source§

fn call_semantics(&self, arguments: &str) -> ToolCallSemantics

Structured completion semantics for a specific call. Read more
Source§

fn canonicalize_arguments( &self, arguments: &str, ) -> Result<String, ToolArgumentContractViolation>

Canonicalize provider argument projections before any semantics, authority, retry, or access decision is made. The default is identity; adapters with representational aliases or optional-empty projection quirks can normalize them without teaching the orchestration layer adapter-specific rules.
Source§

fn on_task_end<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _task_id: &'life1 str, _session_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Task lifecycle callback fired after the agent emits TaskEnd. Tools that spawn background activity can use this to clean up task-scoped resources.
Source§

fn session_context_note<'life0, 'life1, 'async_trait>( &'life0 self, _session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Live state this tool holds for a session that outlives a turn (for example background processes still running), rendered for the next turn’s task context so a follow-up sees it instead of guessing.
Source§

fn background_jobs<'life0, 'life1, 'async_trait>( &'life0 self, _session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Vec<BackgroundJob>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The jobs this tool is running in the background for session_id (they outlive the turn that started them), as the chat’s list of running work shows them.
Source§

fn stop_background_job<'life0, 'life1, 'async_trait>( &'life0 self, _key: &'life1 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stop the background job key (from Self::background_jobs) and read its state back: true only once the job is gone.
Source§

fn jobs_ended_by_task_end<'life0, 'life1, 'async_trait>( &'life0 self, _task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

How many jobs task task_id started that are still running and that the task’s end would stop: nothing reports their result, so a run that ended now would lose their work.
Source§

fn tool_role(&self) -> ToolRole

Categorize this tool for role-based scoping. Default: Action (most tools are action tools).
Source§

fn owner_control_plane(&self) -> bool

The tool only manages the owner’s own durable policy (mandates). A request assessment that narrows a turn’s tools still offers it to the owner in a private chat, but only calls owner_control_plane_call accepts are admitted there.
Source§

fn owner_control_plane_call(&self, _arguments: &str) -> bool

Whether this exact call is safe on a turn whose assessment did not name the tool: read-only, or committing only through an explicit owner confirmation. Decided from the tool’s own schema enum.
Source§

fn receipt_kind(&self, _arguments: &str) -> ToolReceiptKind

Machine-receipt protocol emitted by this adapter. Read more
Source§

fn call_access_manifest(&self, arguments: &str) -> ToolCallAccessManifest

Filesystem access roles for this exact call. Open-ended adapters should override this when their schema exposes explicit read/write grants.
Source§

fn guarded_paths(&self, arguments: &str) -> (Vec<String>, Vec<String>)

The paths this call reads and writes, as ProtectedPathGuard judges them. Defaults to the access manifest; a tool overrides it for a path that scope checks must not see as a task read.
Source§

fn adapter_owned_access_manifest( &self, _arguments: &str, ) -> ToolCallAccessManifest

Capabilities supplied by the adapter rather than requested as task data. The common dispatcher uses this typed lane when attenuating the call against the task manifest. The default is empty so an adapter cannot accidentally widen authority by inheriting a generic grant.
Source§

fn durable_replay_decision<'life0, 'life1, 'async_trait>( &'life0 self, _arguments: &'life1 str, ) -> Pin<Box<dyn Future<Output = DurableReplayDecision> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reconcile a successful durable receipt with current state before replay. Read more
Source§

fn call_file_write(&self, _arguments: &str) -> Option<FileWrite>

The file this exact call writes and how, read from its arguments. A tool that does not declare one is invisible to stale-write checks.
Source§

fn file_write_result( &self, _arguments: &str, _current: Option<&[u8]>, ) -> Option<Result<Vec<u8>, String>>

What the file would hold after this exact call, were it holding current now (None: no such file). Err is the tool’s own reason the call cannot apply to that content. A tool that cannot say returns None, and a host that asks then treats the call as changing all of the file.
Source§

fn named_files(&self, arguments: &str) -> Vec<String>

Every file or resource this exact call names as something it reads or writes, from typed facts only (never its prose): its declared target hints, its access manifest and its typed path effects. A tool whose arguments name more structurally (a shell command’s operands) adds them. One reading for every tool, so a fact about a file (the request’s own work produced it) reaches each call that names it.
Source§

fn output_trust(&self, _arguments: &str, _roots: &TrustRoots<'_>) -> SourceTrust

Who authored what this exact call returns. The default is Untrusted iff the tool reaches outside the machine (external_side_effect); local tools override with the owner’s trusted roots.
Source§

fn call_title(&self, _arguments: &str) -> Option<String>

A few plain words the call itself gave for what it does (“running the site installer”), for the owner’s status line and lists of running work. Never authority. Default: none.
Source§

fn is_available(&self) -> bool

Whether this tool is currently operational. Read more
Source§

fn offered_in_session(&self, _session_id: &str) -> bool

Whether the tool is offered on a turn of session_id, judged from the tool’s own typed state, never from the request’s wording. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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: Sized + 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: Sized + 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, 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.
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