1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! Host-provided services (WIT `host-service`, v2 ext-abi §3): one thin wrapper over
//! [`wit::host_service`].
//!
//! A service `name` ("browser", "cron", …) is registered by the embedding host;
//! under a plain `oino` TUI no service exists and `available` returns
//! `false` (extensions degrade: tools report unavailable). `call` is permission-gated
//! per name (`permissions.hostServices`); `payload` and the reply are the service's own
//! JSON contract — user-facing failures travel inside the reply, the host-error is only
//! permission (`denied`), missing service (`not-found`) and transport problems.
use DeserializeOwned;
use Value;
use crateResult;
use cratehost_service as whs;
/// Whether this host provides the service `name` (cheap, never traps).
/// Names of the services this host provides (sorted).
/// Runs one operation of host service `name` with a JSON payload; returns the service's
/// reply JSON.
///
/// # Errors
/// `Error::Host` when the host denies the call (`hostServices:<name>`), provides no such
/// service (`not-found`) or the transport fails.
pub async
/// Runs one operation and decodes the reply.
///
/// # Errors
/// As [`call`], plus a decode error when the reply does not match `T`.
pub async