`swarmctl agent create <name> --hive <hive>` POSTs `/api/agents` to swarm-controller over the daemon's unix socket and prints the queued job's node id. It deliberately does not wait. The endpoint queues a DAG whose last node *publishes* a deploy message; the hive's `hive-c0re` then converges on its own clock, out of the controller's sight. So even a fully settled graph would not mean the agent is up, and there is nothing this CLI could wait for that would let it claim otherwise. Printing the id is exactly what the response says and all of what it says. Transport is a bare hyper HTTP/1.1 client handshaked onto a tokio `UnixStream` via `hyper_util::rt::TokioIo` — the same crate family `hivectl/src/watch.rs` and `hive-agent/src/web_ui/proxy.rs` already use, all of it already workspace-pinned. The request/response shapes are a local mirror rather than a shared crate: the controller's own types are private to its binary and this crate does not link it, the same separation `hivectl` keeps from `hive-c0re`. Errors are reduced to one actionable line — the controller answers RFC 9457 problem+json, so an unknown `--hive` reaches the operator as the roster of hives that would have worked rather than a body dump. Response `warnings` are printed when non-empty. The nix module wraps the binary with `SWARM_CONTROLLER_SOCKET`, read from the same `socketPath` the daemon binds. Refs #4399
30 lines
718 B
TOML
30 lines
718 B
TOML
[package]
|
|
name = "swarmctl"
|
|
version.workspace = true
|
|
readme = "README.md"
|
|
edition.workspace = true
|
|
|
|
[[bin]]
|
|
name = "swarmctl"
|
|
path = "src/main.rs"
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
# `agent create` — bare HTTP/1.1 client over swarm-controller's unix
|
|
# socket. No new workspace dependency: `bytes`, `http-body-util`,
|
|
# `hyper` and `hyper-util` are all already pinned in the root manifest.
|
|
bytes = "1"
|
|
clap.workspace = true
|
|
clap-markdown = "0.1"
|
|
clap_complete.workspace = true
|
|
hive-types.workspace = true
|
|
http-body-util.workspace = true
|
|
hyper.workspace = true
|
|
hyper-util.workspace = true
|
|
serde.workspace = true
|
|
serde_json.workspace = true
|
|
serde_norway = "0.9.42"
|
|
tokio.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|