use serde_json::Value;
use super::Verb;
pub const PROVIDERS: Verb = Verb {
word: "providers",
params: &["workspace"],
flags: &[],
summary: "the provider rows this workspace routes to",
detail: "One row per provider the workspace routes — the rows named in \
the brazen config plus the built-in presets holding a credential \
— in the server's own listing order, which is brazen's routing \
order, so the first row that can answer is the one a turn goes \
down. Each says what the server knows about its credential, why \
a sign-in cannot be started on it where one cannot, and whether \
it takes an effort level and the priority lane at all. A preset \
nobody named and nobody signed into is not here; `catalog` lists \
what can be signed into. It is read on the workspace the \
workspace names, so a workspace held elsewhere answers about the \
credentials its own agents read.",
};
pub const CATALOG: Verb = Verb {
word: "catalog",
params: &["workspace"],
flags: &[],
summary: "the providers this workspace can sign in to",
detail: "One row per provider `login` can serve on this workspace, signed \
in or not — every row carrying a sign-in flow, built in or \
declared — in `providers`' own row shape, so a row that is \
not signed in here is the row that appears there once it is. \
It is the login pane's listing; a fresh workspace routes nothing \
and can still sign in to what is here.",
};
pub const MODELS: Verb = Verb {
word: "models",
params: &["workspace", "provider"],
flags: &[],
summary: "the models one provider offers",
detail: "The ids that row answers to, as the server has them — the \
values `model` takes as its last argument. It is asked of one \
row rather than of the workspace, because two rows offering the same \
id are still two different routes to it.",
};
pub const LOGIN: Verb = Verb {
word: "login",
params: &["workspace", "provider"],
flags: &[],
summary: "sign this workspace in to one provider",
detail: "The run happens on the SERVER, inside the named workspace's \
workspace, so the credential lands where the agents that need it run \
— nothing credential-shaped ever crosses this wire. It answers \
at once with the run's standing rather than waiting the flow \
out, and the lines are read with `login-tail`. A second sign-in \
on a live pair replaces the first, which is the operator's own \
restart and the reason there is no cancel. A row whose flow \
needs a browser at the server's own loopback can only be \
completed from a browser on that box, or through a port-forward \
the operator sets up.",
};
pub const LOGIN_TAIL: Verb = Verb {
word: "login-tail",
params: &["workspace", "provider"],
flags: &[],
summary: "hold the line on one sign-in's output",
detail: "Buffered from the start, then live to the outcome, with the \
settled exit as the last frame. Each frame carries what the run \
said SINCE the last one, so a read starts from empty and asking \
twice replays the whole of it. A pair nobody has signed in to \
answers one empty frame — nobody has signed in here is a \
reading, not a silence.",
};
pub fn providers(workspace: String) -> Value {
PROVIDERS.built(vec![workspace], &[])
}
pub fn catalog(workspace: String) -> Value {
CATALOG.built(vec![workspace], &[])
}
pub fn models(workspace: String, provider: String) -> Value {
MODELS.built(vec![workspace, provider], &[])
}
pub fn login(workspace: String, provider: String) -> Value {
LOGIN.built(vec![workspace, provider], &[])
}
pub fn login_tail(workspace: String, provider: String) -> Value {
LOGIN_TAIL.built(vec![workspace, provider], &[])
}