crates/edge/sdk/src/lib.rs 1.7 KiB 42 lines Raw
1 //! inf3r-plugin-sdk — the plugin side of the wire, and `serve()`.2 //!3 //! A plugin answers one question: given the parts of a job, what are its4 //! channels? This crate gives that question a shape and gives the answer a5 //! transport, so a plugin never reads a frame, never parses CBOR, and never6 //! counts credit. `serve()` owns the socket and the credit; the plugin owns the7 //! model.8 //!9 //! The vocabulary of a capability — the parts it takes and the channels it10 //! sends — is the wire contract that its capability page states. The model file11 //! belongs to the plugin. This crate knows no capability by name.12 13 pub mod cache;14 pub mod capability;15 pub mod emitter;16 pub mod launch;17 pub mod serve;18 19 pub use cache::{CacheCodec, CacheFile, CacheTransport, CacheWrite, FlushReport, Reserve};20 pub use capability::{Artifact, Failure, Part, Report, Request};21 pub use emitter::{EmitError, Emitter};22 pub use launch::{DESCRIBE, SOCKET, catalogue_json, launch, serve_socket};23 pub use serve::{Plugin, RuntimeVersion, serve};24 25 /// The number of tokens that the job produced.26 ///27 /// Two bindings are comparable only when both put this count under the same28 /// key in the terminal frame's usage map.29 pub const USAGE_TOKENS_OUT: &str = "tokens_out";30 31 /// Milliseconds from the job's start to its first token.32 ///33 /// A rate alone hides a load that spent most of its time before the first34 /// token, so the bench prints both.35 pub const USAGE_FIRST_TOKEN_MS: &str = "first_token_ms";36 37 /// Hundredths of a token per second.38 ///39 /// A `done.usage` value is a `u64`, so the rate is an integer. A count of 123440 /// means 12.34 tokens per second, which keeps two decimal places without a41 /// float on the wire.42 pub const USAGE_TOKENS_PER_S: &str = "tokens_per_s";