Skip to main content

Module host_js

Module host_js 

Source
Expand description

HostJsLib — a JavaScript library the host gives plugin code: a namespace of async functions, JSON in and JSON out, that becomes a global in the runtime of every plugin command and function whose package uses it (docs/agix-sdk.md §10「宿主 JS 库」). The host never sees the script engine: the engine writes the stubs, and each call reaches the host through HostFn with who made it and a cancellation signal.

Re-exports§

pub use crate::command::PackageSource;

Structs§

HostCallContext
Who calls a host function, from where; the host decides on it whether the call goes ahead.
HostJsError
A host function’s failure, as the script’s rejected Error carries it.
HostJsLib

Traits§

HostFn
One function of a host library. Any Fn(HostCallContext, Value) -> impl Future<Output = Result<Value, HostJsError>> is one.