pub struct Runtime { /* private fields */ }Expand description
A configured runtime: node registry, host services and a thread pool. Create one per app and share it.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn new(config_json: String) -> Result<Arc<Self>, GraphrtError>
pub fn new(config_json: String) -> Result<Arc<Self>, GraphrtError>
Create a runtime from a config JSON document ("{}" for defaults).
May perform network I/O (MCP handshakes); call it off the UI thread.
Sourcepub fn set_credential_provider(
&self,
provider: String,
callback: Arc<dyn CredentialProvider>,
)
pub fn set_credential_provider( &self, provider: String, callback: Arc<dyn CredentialProvider>, )
Register the host’s credential callback for provider (a name from the
config’s credentials section), or "*" for every provider. Replaces any
previous callback and drops every cached credential, so it takes effect for
requests made after the call (e.g. a different user signed in).
Sourcepub fn clear_credential_provider(&self, provider: String)
pub fn clear_credential_provider(&self, provider: String)
Remove the credential callback registered for provider (or "*") and drop
every cached credential (sign-out takes effect on the next request).
Sourcepub fn clear_credential_cache(&self)
pub fn clear_credential_cache(&self)
Drop every cached credential without changing the registered callbacks (e.g. the user signed out of your backend and broker tokens must not be reused).
Sourcepub fn register_wasm_plugin(
&self,
wasm: Vec<u8>,
) -> Result<Vec<String>, GraphrtError>
pub fn register_wasm_plugin( &self, wasm: Vec<u8>, ) -> Result<Vec<String>, GraphrtError>
Load a sandboxed WebAssembly plugin; its node kinds become available to workflows loaded afterwards. Returns the registered kinds.
Sourcepub fn catalog_json(&self) -> String
pub fn catalog_json(&self) -> String
Catalog of every node kind available in this runtime, as a JSON array.
Sourcepub fn load_workflow(
self: Arc<Self>,
document: String,
) -> Result<Arc<WorkflowHandle>, GraphrtError>
pub fn load_workflow( self: Arc<Self>, document: String, ) -> Result<Arc<WorkflowHandle>, GraphrtError>
Parse and compile a workflow (YAML or JSON).
Sourcepub fn load_bundle(
self: Arc<Self>,
bundle: Vec<u8>,
trusted_keys: Vec<String>,
) -> Result<Arc<WorkflowHandle>, GraphrtError>
pub fn load_bundle( self: Arc<Self>, bundle: Vec<u8>, trusted_keys: Vec<String>, ) -> Result<Arc<WorkflowHandle>, GraphrtError>
Open a portable bundle (.grt bytes), register its WebAssembly plugins and
compile its entry workflow. Every file is checked against the manifest’s
SHA-256; when trusted_keys (hex Ed25519 public keys) is non-empty, the
bundle must be signed by one of them. Bundles needing process or HTTP
plugins are rejected: embedded hosts cannot spawn processes.