pub struct ControlClient { /* private fields */ }Expand description
A client of a running kernel’s control plane (spec 3.2 §7.11), over its Unix socket, its named pipe on Windows (§10 W2) or HTTP. Surfaces hold no state (K-I17): every call reads the kernel.
§Example
use adk_kernel::control::ControlClient;
let client = match ControlClient::connect_local(home).await? {
Some(client) => client,
None => ControlClient::http("https://kernel.example.com").with_bearer_token("token"),
};
for process in client.processes(&Default::default()).await? {
println!("{} {:?}", process.meta.pid, process.run.state);
}Implementations§
Source§impl ControlClient
impl ControlClient
Sourcepub fn socket(path: impl Into<PathBuf>) -> Self
pub fn socket(path: impl Into<PathBuf>) -> Self
A client of the kernel listening on the Unix socket at path.
Sourcepub fn http(base_url: impl Into<String>) -> Self
pub fn http(base_url: impl Into<String>) -> Self
A client of the kernel serving HTTP at base_url, the routes under its /api.
Sourcepub fn with_bearer_token(self, token: impl Into<String>) -> Self
pub fn with_bearer_token(self, token: impl Into<String>) -> Self
Sends token as a bearer token.
Sourcepub fn bearer_token(&self) -> Option<&str>
pub fn bearer_token(&self) -> Option<&str>
The bearer token the client sends, so a caller of other routes on the same control plane (the approvals inbox, spec 3.3 §6) sends the same one.
§Example
use adk_kernel::control::ControlClient;
let client = ControlClient::http("https://kernel.example.com").with_bearer_token("token");
assert_eq!(client.bearer_token(), Some("token"));
assert_eq!(ControlClient::socket("/run/kernel.sock").bearer_token(), None);Sourcepub fn endpoint(&self) -> String
pub fn endpoint(&self) -> String
Where the client connects: unix:<path>, pipe:<name> or the base URL.
Sourcepub async fn connect_local(home: &Path) -> Result<Option<Self>>
pub async fn connect_local(home: &Path) -> Result<Option<Self>>
A client of the kernel running at home, or None when none answers on its socket,
or on Windows its named pipe (spec 3.2 §10 W2).
A socket left by a kernel that did not stop cleanly counts as none; a pipe goes away with its kernel.
§Errors
Returns KernelError::ControlPlane when the socket or pipe exists but this user may
not use it: another account owns it, or its permissions refuse this user; or when the
directory of its own that a socket too long for the home sits in is a symlink, another
user’s, or open to other users (spec 3.3 G18).
Sourcepub async fn health(&self) -> Result<KernelHealth>
pub async fn health(&self) -> Result<KernelHealth>
GET /kernel/health.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn inventory(&self) -> Result<KernelInventory>
pub async fn inventory(&self) -> Result<KernelInventory>
GET /kernel/inventory: what the kernel runs, and a warning for each thing it would
silently not do (Kernel::inventory); for the operator scope.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
kernel’s error for a caller without the operator scope.
Sourcepub async fn partitions(&self) -> Result<Vec<Partition>>
pub async fn partitions(&self) -> Result<Vec<Partition>>
GET /kernel/partitions: the partition table (spec 3.2 §7.8).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn agents(&self) -> Result<Vec<AgentView>>
pub async fn agents(&self) -> Result<Vec<AgentView>>
GET /kernel/agents: the agents a person added, but tombstones and refused
suggestions (spec 3.3 §10 K7).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn agent(&self, id: &str) -> Result<AgentView>
pub async fn agent(&self, id: &str) -> Result<AgentView>
GET /kernel/agents/{id}: one agent a person added, tombstones included (spec 3.3
§10 K7).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: kernel.agent.not_found for an unknown id.
Sourcepub async fn put_partition(&self, partition: &Partition) -> Result<Partition>
pub async fn put_partition(&self, partition: &Partition) -> Result<Partition>
POST /kernel/partitions: creates or replaces partition (spec 3.2 §7.8).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn set_partition_mode(
&self,
id: &str,
mode: PartitionMode,
) -> Result<Partition>
pub async fn set_partition_mode( &self, id: &str, mode: PartitionMode, ) -> Result<Partition>
POST /kernel/partitions/{id}/mode: sets partition id’s mode (spec 3.2 §8.1).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn settings(&self) -> Result<Vec<AreaView>>
pub async fn settings(&self) -> Result<Vec<AreaView>>
GET /kernel/settings: every area’s quiet time, daily spending limit and mode in
force (spec 3.3 §10 K3).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 403 without the operator scope or a device’s read.
Sourcepub async fn area_settings(&self, partition: &str) -> Result<AreaView>
pub async fn area_settings(&self, partition: &str) -> Result<AreaView>
Sourcepub async fn set_quiet_time(
&self,
partition: &str,
window: Option<QuietHours>,
) -> Result<AreaView>
pub async fn set_quiet_time( &self, partition: &str, window: Option<QuietHours>, ) -> Result<AreaView>
POST /kernel/settings/{partition}/quiet-time: sets the area’s quiet time, or turns
it off with None (spec 3.3 §10 K3).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 403 for a device token or without the operator scope,
404 for an unknown area.
Sourcepub async fn set_spending_limit(
&self,
partition: &str,
micro_usd: Option<u64>,
) -> Result<AreaView>
pub async fn set_spending_limit( &self, partition: &str, micro_usd: Option<u64>, ) -> Result<AreaView>
POST /kernel/settings/{partition}/spending-limit: sets the area’s daily spending
limit in micro-USD, or removes it with None (spec 3.3 §10 K3).
§Errors
As set_quiet_time.
Sourcepub async fn set_area_mode(
&self,
partition: &str,
mode: PartitionMode,
) -> Result<AreaView>
pub async fn set_area_mode( &self, partition: &str, mode: PartitionMode, ) -> Result<AreaView>
POST /kernel/settings/{partition}/mode: sets how much the area’s agents act alone
(spec 3.3 §10 K3).
§Errors
As set_quiet_time.
Sourcepub async fn away(&self, query: &AwayQuery) -> Result<AwayResponse>
pub async fn away(&self, query: &AwayQuery) -> Result<AwayResponse>
GET /kernel/away: “While you were away” after the viewer’s cursor (spec 3.3 §10
K4). A paired device reads as itself; query.viewer names any other surface.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn mark_away_seen(
&self,
viewer: Option<&str>,
through: u64,
) -> Result<AwayCursor>
pub async fn mark_away_seen( &self, viewer: Option<&str>, through: u64, ) -> Result<AwayCursor>
POST /kernel/away/seen: marks “While you were away” seen through row through, a
page’s through (spec 3.3 §10 K4); returns the cursor, which never moves back.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 400 for a row the ledger does not hold yet.
Sourcepub async fn away_line(&self, seq: u64) -> Result<AwayLineResponse>
pub async fn away_line(&self, seq: u64) -> Result<AwayLineResponse>
GET /kernel/away/lines/{seq}: one line of “While you were away” with its ledger
row, the line’s record (spec 3.3 §10 K4).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 404 for a row the ledger does not hold.
Sourcepub async fn memory(&self, area: Option<&str>) -> Result<MemoryResponse>
pub async fn memory(&self, area: Option<&str>) -> Result<MemoryResponse>
GET /kernel/memory: what the agents remember about the caller, with provenance, and
the overnight tidy-ups (spec 3.3 §10 K5).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 400 when the kernel shows no memory.
Sourcepub async fn confirm_fact(&self, id: &str) -> Result<RememberedFact>
pub async fn confirm_fact(&self, id: &str) -> Result<RememberedFact>
POST /kernel/memory/facts/{id}/confirm: “That’s right” (spec 3.3 §8.2, §10 K5).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 403 for a device token, 404 for a fact that is not
the caller’s.
Sourcepub async fn fix_fact(&self, id: &str, text: &str) -> Result<RememberedFact>
pub async fn fix_fact(&self, id: &str, text: &str) -> Result<RememberedFact>
POST /kernel/memory/facts/{id}/fix: “Fix it” with the person’s text (spec 3.3
§8.2, §10 K5).
§Errors
As confirm_fact, and 400 for a text the harness refuses.
Sourcepub async fn forget_fact(&self, id: &str) -> Result<()>
pub async fn forget_fact(&self, id: &str) -> Result<()>
POST /kernel/memory/facts/{id}/forget: “Forget it” (spec 3.3 §8.2, §10 K5).
§Errors
As confirm_fact.
Sourcepub async fn undo_tidy_up(&self, id: Option<&str>) -> Result<TidyUpUndo>
pub async fn undo_tidy_up(&self, id: Option<&str>) -> Result<TidyUpUndo>
POST /kernel/memory/undo: “Undo” the tidy-up id, or the latest one that can be
undone (spec 3.3 §8.2, §10 K5).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 403 for a device token, 404 when nothing is left to
undo, 409 for a tidy-up unfinished or undone.
Sourcepub async fn record(&self, limit: Option<usize>) -> Result<Vec<RecordLine>>
pub async fn record(&self, limit: Option<usize>) -> Result<Vec<RecordLine>>
GET /kernel/record: the latest limit actions on record, newest first (spec 3.3
§10 K5).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 400 when the kernel shows no record.
Sourcepub async fn check_record(&self) -> Result<RecordCheck>
pub async fn check_record(&self) -> Result<RecordCheck>
Sourcepub async fn processes(&self, query: &ProcessesQuery) -> Result<Vec<Process>>
pub async fn processes(&self, query: &ProcessesQuery) -> Result<Vec<Process>>
GET /kernel/processes.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn spawn(&self, request: &SpawnRequest) -> Result<Process>
pub async fn spawn(&self, request: &SpawnRequest) -> Result<Process>
POST /kernel/processes: starts a process of a registered target as the caller.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 404 for an unknown target, 403 without the operator
scope.
Sourcepub async fn approvals(&self) -> Result<Vec<ApprovalItem>>
pub async fn approvals(&self) -> Result<Vec<ApprovalItem>>
GET /approvals: the held calls the caller may decide, pending first page.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 404 when it serves no approvals inbox.
Sourcepub async fn decide(
&self,
id: &str,
version: u64,
action: ApprovalAction,
reason: Option<&str>,
) -> Result<ApprovalItem>
pub async fn decide( &self, id: &str, version: u64, action: ApprovalAction, reason: Option<&str>, ) -> Result<ApprovalItem>
POST /approvals/{id}/decide: decides a held call, at the version the caller read.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 409 for a stale version, 403 for a caller who may not
decide it.
Sourcepub async fn kill(&self, pid: &str, reason: Option<&str>) -> Result<Process>
pub async fn kill(&self, pid: &str, reason: Option<&str>) -> Result<Process>
POST /kernel/processes/{pid}/kill.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn nice(&self, pid: &str, queue: QueueClass) -> Result<Process>
pub async fn nice(&self, pid: &str, queue: QueueClass) -> Result<Process>
POST /kernel/processes/{pid}/nice.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn suspend(&self, pid: &str) -> Result<Process>
pub async fn suspend(&self, pid: &str) -> Result<Process>
POST /kernel/processes/{pid}/suspend.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn resume(&self, pid: &str) -> Result<Process>
pub async fn resume(&self, pid: &str) -> Result<Process>
POST /kernel/processes/{pid}/resume.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn run_now(
&self,
pid: &str,
request_id: Option<&str>,
) -> Result<RunNow>
pub async fn run_now( &self, pid: &str, request_id: Option<&str>, ) -> Result<RunNow>
POST /kernel/processes/{pid}/run-now: runs a cron sleeper now, outside its schedule
(Kernel::run_now); a retry with the same request_id
queues nothing new.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered, such as kernel.frozen.
Sourcepub async fn run_trigger_now(
&self,
name: &str,
request_id: Option<&str>,
) -> Result<RunNow>
pub async fn run_trigger_now( &self, name: &str, request_id: Option<&str>, ) -> Result<RunNow>
POST /kernel/triggers/{name}/run-now: runs a standing cron trigger now, outside its
schedule (Kernel::run_now).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn drivers(&self) -> Result<Vec<DriverView>>
pub async fn drivers(&self) -> Result<Vec<DriverView>>
GET /kernel/drivers: the mounted drivers (spec 3.2 §7.7).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn mount_driver(
&self,
id: &str,
manifest: &str,
confirm: bool,
) -> Result<MountDriverResponse>
pub async fn mount_driver( &self, id: &str, manifest: &str, confirm: bool, ) -> Result<MountDriverResponse>
POST /kernel/drivers/{id}/mount: what mounting manifest (its TOML) approves,
and with confirm the mount itself.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn unmount_driver(&self, id: &str) -> Result<bool>
pub async fn unmount_driver(&self, id: &str) -> Result<bool>
POST /kernel/drivers/{id}/unmount; false when no such driver was mounted.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn restart_driver(&self, id: &str) -> Result<DriverView>
pub async fn restart_driver(&self, id: &str) -> Result<DriverView>
POST /kernel/drivers/{id}/restart.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn reapprove_driver(&self, id: &str) -> Result<DriverView>
pub async fn reapprove_driver(&self, id: &str) -> Result<DriverView>
POST /kernel/drivers/{id}/reapprove.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn freeze(&self, reason: Option<&str>) -> Result<FreezeResponse>
pub async fn freeze(&self, reason: Option<&str>) -> Result<FreezeResponse>
POST /kernel/freeze.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn unfreeze(&self) -> Result<FreezeResponse>
pub async fn unfreeze(&self) -> Result<FreezeResponse>
POST /kernel/unfreeze.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn ledger(&self, params: &LedgerParams) -> Result<LedgerResponse>
pub async fn ledger(&self, params: &LedgerParams) -> Result<LedgerResponse>
GET /kernel/proc/ledger as JSON: one page of the activity ledger (spec 3.2 §7.10).
Page on with params.after set to the answer’s next.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 403 without the operator scope.
Sourcepub async fn baselines(&self) -> Result<Vec<PassState>>
pub async fn baselines(&self) -> Result<Vec<PassState>>
GET /kernel/proc/baselines: each partition’s last baseline pass (spec 3.2 §7.10).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn observations(
&self,
params: &ObservationsParams,
) -> Result<Vec<Observation>>
pub async fn observations( &self, params: &ObservationsParams, ) -> Result<Vec<Observation>>
GET /kernel/proc/observations: the observations the kernel offered, newest first
(spec 3.2 §7.10).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn events(
&self,
after: Option<u64>,
) -> Result<BoxStream<'static, Result<EventRecord>>>
pub async fn events( &self, after: Option<u64>, ) -> Result<BoxStream<'static, Result<EventRecord>>>
GET /kernel/events: the event bus from just after after, then live.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached; a broken
stream ends with the error as its last item.
Sourcepub async fn attach(
&self,
session_id: &str,
request: &AttachRequest,
) -> Result<AttachResponse>
pub async fn attach( &self, session_id: &str, request: &AttachRequest, ) -> Result<AttachResponse>
POST /kernel/attach/{session}.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn steer(&self, session_id: &str, text: &str) -> Result<SteerResponse>
pub async fn steer(&self, session_id: &str, text: &str) -> Result<SteerResponse>
POST /kernel/sessions/{session}/steer: sends text to the running turn of the
caller’s session session_id (spec 3.3 §6 “steer”).
SteerResponse::Accepted means the turn holds the message, not that it took it: the
message is delivered once attach shows an event whose steering marker
carries the answer’s steer id, and handed back once the process leaves the answer’s
claim without one. On SteerResponse::Returned, spawn it as the
session’s next message.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the error
the kernel answered: 403 without the operator scope or for a device token, 503
while everything is stopped, 400 for a blank message, or an input guardrail’s
refusal.
§Example
use adk_kernel::control::ControlClient;
use adk_kernel::control::api::{SpawnRequest, SteerResponse};
let text = "use the staging database";
if client.steer("s-1", text).await? == SteerResponse::Returned {
let next = SpawnRequest::new("adk-rust", serde_json::json!({ "text": text }));
client.spawn(&next.with_session_id("s-1")).await?;
}Sourcepub async fn agenda(&self, query: &AgendaQuery) -> Result<Vec<AgendaItem>>
pub async fn agenda(&self, query: &AgendaQuery) -> Result<Vec<AgendaItem>>
GET /kernel/agenda (spec 3.2 §7.5, §8.1 adk-rust agenda list).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn approve_item(&self, id: &str) -> Result<AgendaItem>
pub async fn approve_item(&self, id: &str) -> Result<AgendaItem>
POST /kernel/agenda/{id}/approve: approves the item as the caller, then schedules it.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 404 for an unknown item, 409 for one not proposed.
Sourcepub async fn reject_item(
&self,
id: &str,
reason: Option<&str>,
) -> Result<AgendaItem>
pub async fn reject_item( &self, id: &str, reason: Option<&str>, ) -> Result<AgendaItem>
POST /kernel/agenda/{id}/reject.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn schedule_item(&self, id: &str, wake: WakeSet) -> Result<AgendaItem>
pub async fn schedule_item(&self, id: &str, wake: WakeSet) -> Result<AgendaItem>
POST /kernel/agenda/{id}/schedule: puts the approved item’s process to sleep on
wake.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn issue_pairing_code(
&self,
request: &IssueRequest,
) -> Result<IssuedCode>
pub async fn issue_pairing_code( &self, request: &IssueRequest, ) -> Result<IssuedCode>
POST /kernel/pairing: issues a pairing code for a device acting for the caller
(spec 3.3 §10 K2, adk-rust pair).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 403 without the operator scope, 400 when the kernel
pairs no devices.
Sourcepub async fn claim_pairing(
&self,
code: &str,
name: Option<&str>,
) -> Result<ClaimedDevice>
pub async fn claim_pairing( &self, code: &str, name: Option<&str>, ) -> Result<ClaimedDevice>
POST /kernel/pairing/claim: pairs this client’s device with code and returns its
token, once (spec 3.3 §10 K2). The call needs no token and sends none, so a client
whose old token was revoked or expired re-pairs; send the one it returns with
with_bearer_token from then on.
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 401 for a wrong, used or expired code.
Sourcepub async fn devices(&self) -> Result<Vec<DeviceView>>
pub async fn devices(&self) -> Result<Vec<DeviceView>>
GET /kernel/devices: every paired device (spec 3.3 §10 K2, adk-rust pair list).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered.
Sourcepub async fn revoke_device(&self, id: &str) -> Result<DeviceView>
pub async fn revoke_device(&self, id: &str) -> Result<DeviceView>
POST /kernel/devices/{id}/revoke: removes a device; its token stops working at once
(spec 3.3 §10 K2, adk-rust pair revoke).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 404 for an unknown device.
Sourcepub async fn channel_accounts(&self) -> Result<ChannelAccountsResponse>
pub async fn channel_accounts(&self) -> Result<ChannelAccountsResponse>
GET /kernel/channels: the paired chat accounts and the ones waiting for their code
to be accepted (spec 3.3 §10 K1).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered; a kernel without chat channels answers none.
Sourcepub async fn accept_channel(&self, code: &str) -> Result<ChannelAccountView>
pub async fn accept_channel(&self, code: &str) -> Result<ChannelAccountView>
POST /kernel/channels/pair: accepts the code a chat account was sent, so its
messages reach the caller’s agents (spec 3.3 §10 K1).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 401 for a wrong or expired code, 400 when the kernel
has no chat channels.
Sourcepub async fn revoke_channel_account(
&self,
id: &str,
) -> Result<ChannelAccountView>
pub async fn revoke_channel_account( &self, id: &str, ) -> Result<ChannelAccountView>
POST /kernel/channels/{id}/revoke: removes a chat account (spec 3.3 §10 K1).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 404 for an unknown account.
Sourcepub async fn dismiss_channel_request(
&self,
id: &str,
) -> Result<ChannelPairingView>
pub async fn dismiss_channel_request( &self, id: &str, ) -> Result<ChannelPairingView>
POST /kernel/channels/waiting/{id}/dismiss: dismisses a chat account waiting to be
paired; its code stops working (spec 3.3 §10 K1).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the
error the kernel answered: 404 for an account that is not waiting.
Source§impl ControlClient
impl ControlClient
Sourcepub async fn commands(&self) -> Result<Vec<CommandInfo>>
pub async fn commands(&self) -> Result<Vec<CommandInfo>>
GET /kernel/commands: the REPL’s commands the kernel offers, in /help order (spec
3.3 §5.2).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the error
the kernel answered: 403 for a device token, 400 when the kernel offers none.
Sourcepub async fn run_command(
&self,
name: &str,
args: &str,
session: &str,
) -> Result<String>
pub async fn run_command( &self, name: &str, args: &str, session: &str, ) -> Result<String>
POST /kernel/commands/run: runs /name args in the caller’s session session, by
the REPL’s code on the kernel’s harness; returns what it printed (spec 3.3 §5.2).
§Errors
As commands, and 404 for a command the kernel does not offer,
409 for one that changes something while everything is stopped, or the command’s
error.
Sourcepub async fn always_allow_offer(&self, id: &str) -> Result<Option<String>>
pub async fn always_allow_offer(&self, id: &str) -> Result<Option<String>>
GET /kernel/rules/always-allow/{id}: the words of “Always allow” for the caller’s
waiting decision id, or None when no standing rule applies (spec 3.3 §8.2).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the error
the kernel answered: 403 for a device token, 409 for a decision no longer waiting.
Sourcepub async fn prepare_always_allow(&self, id: &str) -> Result<String>
pub async fn prepare_always_allow(&self, id: &str) -> Result<String>
POST /kernel/rules/always-allow/{id}/prepare: makes the standing rule “Always
allow” creates for the waiting decision id, before it is answered; returns its
words (spec 3.3 §8.2).
§Errors
As always_allow_offer, and 400 when no rule applies.
Sourcepub async fn grant_always_allow(&self, id: &str) -> Result<()>
pub async fn grant_always_allow(&self, id: &str) -> Result<()>
POST /kernel/rules/always-allow/{id}/grant: grants the rule prepared for the
decision id once it was allowed (spec 3.3 §8.2).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the error
the kernel answered: 403 for a device token, 409 for a decision not allowed,
404 when no rule was prepared for it.
Sourcepub async fn session_mode(&self, session: &str) -> Result<Option<String>>
pub async fn session_mode(&self, session: &str) -> Result<Option<String>>
GET /kernel/sessions/{session}/mode: the mode of the caller’s session session, as
the harness names it, or None when the kernel keeps no modes (spec 3.3 §5.2).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the error
the kernel answered: 403 for a device token, 400 when the kernel offers no
commands.
Sourcepub async fn record_surface(&self, record: &SurfaceRecord) -> Result<()>
pub async fn record_surface(&self, record: &SurfaceRecord) -> Result<()>
POST /kernel/surface/records: writes record, one record of a surface engine in this
process, on the kernel’s signed log, with the caller as its actor (spec 3.3 §11).
§Errors
Returns KernelError::ControlPlane when the kernel cannot be reached, or the error
the kernel answered: 403 for a device token, 400 for an action that is not a
surface’s, 404 for an answer to a decision that is not the caller’s, or the log’s
error.
Trait Implementations§
Source§impl Clone for ControlClient
impl Clone for ControlClient
Auto Trait Implementations§
impl !RefUnwindSafe for ControlClient
impl !UnwindSafe for ControlClient
impl Forget for ControlClient
impl Freeze for ControlClientwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<ClientRef> is !null: Freeze,
PhantomData<ArcInner<ClientRef>>: Freeze,
impl Move for ControlClient
impl Send for ControlClient
impl Sync for ControlClient
impl Unpin for ControlClient
impl UnsafeUnpin for ControlClientwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<ClientRef> is !null: UnsafeUnpin,
PhantomData<ArcInner<ClientRef>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.