Expand description
Talk to Arvo’s engine over gRPC.
This is the client side of the
contract: the stubs
generated from its services, how to find the engine running for this
user, and the token each service takes. The types the stubs carry are
arvo-api, re-exported under proto so a call site names one path
whether it wants a stub or a shape.
§Finding the engine
The engine serves on loopback and writes where it is into the user’s app
data directory. discovery reads that: the address, whether the engine
at it is still answering, and the two tokens.
§Two tokens
Which token a service takes is a property of the service, not of the
call. The research token, from engine.json, reaches the Research
service and nothing else: an agent or a script holding it can read
findings and run studies, and cannot fetch, trade, share, import or name
a credential. The control token, from control.json, reaches every
other service, which is where a person’s decisions live. request puts
either one on a call.
§A call
use arvo_client::{discovery, proto, request};
use proto::common::Empty;
use proto::services::research_client::ResearchClient;
let engine = discovery::running(&discovery::default_root()?).ok_or("start arvo-engine first")?;
let mut research = ResearchClient::connect(engine.endpoint()).await?;
let listed = research.list_strategies(request(&engine.token, Empty {})?).await?.into_inner();
for strategy in listed.strategies {
println!("{}: {}", strategy.name, strategy.premise);
}A refusal crosses as a gRPC status code, never as a message with an error
field. A study’s answer is large; see wire::MAX_MESSAGE_BYTES.
§The server side
The same generated module holds the server traits, research_server::Research
and the rest. Arvo’s engine implements them; so can a test double.
Modules§
- discovery
- How a front end finds the engine:
engine.jsonin the app data directory. - proto
- The contract, as this side of the wire uses it.
- wire
- What both ends of the wire agree on beyond the messages themselves.
Enums§
- Command
Error - What a front end shows when a call did not do what was asked.
Functions§
- request
message, carryingtokenthe way the engine admits it.