Watch
0
0
Fork
You've already forked hyperhive
0

move the review classifier, agent login and inference types into swarm-wire

This commit is contained in:
atlas 2026-10-18 08:58:13 +02:00 • committed by mara
commit 6ea13c02e3
44 changed files with 344 additions and 332 deletions

View file

@ -26,6 +26,7 @@ serde.workspace = true
serde_json.workspace = true
# The try-out subject and the shapes the controller sends and reads back.
swarm-queue-client.workspace = true
swarm-wire.workspace = true
# The API key and queue client secret paths, and the store login.
swarm-secret-client.workspace = true
tokio.workspace = true

View file

@ -28,7 +28,7 @@ use hive_runtime::{
AcpCommand, AcpRuntime, Config, PermissionAsk, PermissionPolicy, Runtime as _, Sink,
};
use serde_json::{Value, json};
use swarm_queue_client::review_classifier::{Acp as Provider, Runtime, TryOut};
use swarm_wire::review_classifier::{Acp as Provider, Runtime, TryOut};
use crate::cost::{Cost, CostSink};
@ -276,7 +276,7 @@ impl Sink for FinalText {
mod tests {
use std::os::unix::fs::PermissionsExt as _;
use swarm_queue_client::review_classifier::Prices;
use swarm_wire::review_classifier::Prices;
use super::*;
use crate::prompt::Prompt;

View file

@ -1,7 +1,7 @@
//! Turning answers into the result table and the overall verdict, as the
//! architecture doc's "Aggregation into the verdict" states it.
use swarm_queue_client::review_classifier::{Classification, Overall, Polarity, Row, Verdict};
use swarm_wire::review_classifier::{Classification, Overall, Polarity, Row, Verdict};
use crate::answer::Answer;

View file

@ -6,7 +6,7 @@
//! is cut to the cap, so the verdict and certainty survive.
use serde::Deserialize;
use swarm_queue_client::review_classifier::Verdict;
use swarm_wire::review_classifier::Verdict;
/// The longest reason, in characters, an answer carries; a longer one is
/// truncated to this, ending in `…`.

View file

@ -23,7 +23,7 @@ use opentelemetry::KeyValue;
use opentelemetry::metrics::{Counter, MeterProvider as _};
use opentelemetry_otlp::{MetricExporter, Protocol, WithExportConfig};
use opentelemetry_sdk::metrics::{PeriodicReader, SdkMeterProvider};
use swarm_queue_client::review_classifier::Prices;
use swarm_wire::review_classifier::Prices;
/// The currency every price is in.
pub const CURRENCY: &str = "USD";

View file

@ -2,7 +2,7 @@
//!
//! Connects to the swarm queue as its own OIDC client, takes try-out requests
//! from swarm-controller on
//! [`swarm_queue_client::review_classifier::SUBJECT`], answers each one on its
//! [`swarm_wire::review_classifier::SUBJECT`], answers each one on its
//! reply subject, and logs one line per run. It holds no forge credential:
//! the controller reads the PR and sends it along.
//!
@ -14,9 +14,9 @@ use std::path::PathBuf;
use anyhow::{Context, Result, bail};
use futures_util::StreamExt as _;
use swarm_queue_client::review_classifier::{QUEUE_GROUP, Reply, SUBJECT, TryOut};
use swarm_queue_client::{ClientSecret, QueueConfig};
use swarm_secret_client::stored_secret::StoredSecret;
use swarm_wire::review_classifier::{QUEUE_GROUP, Reply, SUBJECT, TryOut};
mod acp;
mod aggregate;

View file

@ -7,7 +7,7 @@
use std::fmt::Write as _;
use swarm_queue_client::review_classifier::{Classification, Polarity, TryOut};
use swarm_wire::review_classifier::{Classification, Polarity, TryOut};
use crate::answer::REASON_ASKED_CHARS;
@ -240,7 +240,7 @@ fn closing_quote(s: &str) -> Option<usize> {
#[cfg(test)]
mod tests {
use swarm_queue_client::review_classifier::{Classification, Commit, Polarity, TryOut};
use swarm_wire::review_classifier::{Classification, Commit, Polarity, TryOut};
use super::*;
@ -274,7 +274,7 @@ diff --git a/src/main.rs b/src/main.rs
classifications: Vec::new(),
model: "haiku".to_owned(),
effort: None,
runtime: swarm_queue_client::review_classifier::Runtime::ApiKey,
runtime: swarm_wire::review_classifier::Runtime::ApiKey,
}
}

View file

@ -16,10 +16,10 @@ use std::sync::atomic::{AtomicU64, Ordering};
use std::time::{Duration, Instant};
use hive_claude::{Attach, Config, Sink};
use swarm_queue_client::agent_inference::Effort;
use swarm_queue_client::review_classifier::{CLASSIFICATION_DEADLINE, Reply, Row, Runtime, TryOut};
use swarm_secret_client::acp::ProviderKey;
use swarm_secret_client::review_classifier::{ApiKey, acp_provider_key_path, api_key_path};
use swarm_wire::agent_inference::Effort;
use swarm_wire::review_classifier::{CLASSIFICATION_DEADLINE, Reply, Row, Runtime, TryOut};
use crate::prompt::Prompt;
use crate::{aggregate, answer, prompt};
@ -373,7 +373,7 @@ impl Sink for ResultSink {
#[cfg(test)]
mod tests {
use swarm_queue_client::review_classifier::{Classification, Overall, Polarity};
use swarm_wire::review_classifier::{Classification, Overall, Polarity};
use super::*;
@ -449,10 +449,10 @@ mod tests {
fn acp_run(descriptions: &[&str]) -> TryOut {
TryOut {
runtime: Runtime::Acp(swarm_queue_client::review_classifier::Acp {
runtime: Runtime::Acp(swarm_wire::review_classifier::Acp {
base_url: "https://llm.example/v1".to_owned(),
model: "qwen".to_owned(),
prices: swarm_queue_client::review_classifier::Prices {
prices: swarm_wire::review_classifier::Prices {
input: 1.0,
output: 1.0,
cache_read: None,
@ -654,7 +654,7 @@ mod tests {
let answer = classify_slow(&model).await.expect("the retry answers");
assert_eq!(
answer.verdict,
swarm_queue_client::review_classifier::Verdict::NoMatch
swarm_wire::review_classifier::Verdict::NoMatch
);
let [first, second] = model.deadlines().try_into().expect("two asks");
assert_eq!(first, BUDGET);