style: apply nix fmt
This commit is contained in:
parent
9a0d525fdf
commit
e1e3bda94a
7 changed files with 22 additions and 10 deletions
|
|
@ -8,7 +8,6 @@ use std::path::{Path, PathBuf};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use hive_ag3nt::events::{Bus, LiveEvent, TurnState};
|
use hive_ag3nt::events::{Bus, LiveEvent, TurnState};
|
||||||
|
|
@ -549,8 +548,7 @@ async fn serve_loop<S: Surface>(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let ctrl =
|
let ctrl = handle_turn::<S>(socket, &bus, stats.as_ref(), files, &session, next).await;
|
||||||
handle_turn::<S>(socket, &bus, stats.as_ref(), files, &session, next).await;
|
|
||||||
if ctrl.auth_failed {
|
if ctrl.auth_failed {
|
||||||
*login_state.lock().unwrap() = LoginState::NeedsLogin;
|
*login_state.lock().unwrap() = LoginState::NeedsLogin;
|
||||||
login::wait_for_login(
|
login::wait_for_login(
|
||||||
|
|
|
||||||
|
|
@ -433,7 +433,6 @@ impl EventStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Authoritative turn-loop state. The harness owns it; the web UI
|
/// Authoritative turn-loop state. The harness owns it; the web UI
|
||||||
/// reads via `/api/state` and renders. Lives alongside the bus
|
/// reads via `/api/state` and renders. Lives alongside the bus
|
||||||
/// because everyone who has a `Bus` already has the right handle to
|
/// because everyone who has a `Bus` already has the right handle to
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,10 @@ mod tests {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
fs::write(dir.path().join("history.jsonl"), b"{}").unwrap();
|
fs::write(dir.path().join("history.jsonl"), b"{}").unwrap();
|
||||||
let snap = snapshot_dir(dir.path());
|
let snap = snapshot_dir(dir.path());
|
||||||
assert_eq!(snap.file_count, 0, "history files must not count as session");
|
assert_eq!(
|
||||||
|
snap.file_count, 0,
|
||||||
|
"history files must not count as session"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,11 @@ pub(super) async fn api_stats(
|
||||||
/// the `mcp__hyperhive__get_loose_ends` tool sees from inside the
|
/// the `mcp__hyperhive__get_loose_ends` tool sees from inside the
|
||||||
/// container.
|
/// container.
|
||||||
pub(super) async fn api_loose_ends(State(state): State<AppState>) -> Response {
|
pub(super) async fn api_loose_ends(State(state): State<AppState>) -> Response {
|
||||||
match super::broker_request(&state.socket, &hive_sh4re::Request::GetLooseEnds { agent: None })
|
match super::broker_request(
|
||||||
.await
|
&state.socket,
|
||||||
|
&hive_sh4re::Request::GetLooseEnds { agent: None },
|
||||||
|
)
|
||||||
|
.await
|
||||||
{
|
{
|
||||||
Ok(hive_sh4re::Response::LooseEnds { loose_ends }) => {
|
Ok(hive_sh4re::Response::LooseEnds { loose_ends }) => {
|
||||||
axum::Json(serde_json::json!({ "loose_ends": loose_ends })).into_response()
|
axum::Json(serde_json::json!({ "loose_ends": loose_ends })).into_response()
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,10 @@ impl Claude {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if let Some(mut stdin) = child.stdin.take() {
|
if let Some(mut stdin) = child.stdin.take() {
|
||||||
stdin.write_all(prompt.as_bytes()).await.map_err(Error::Stdin)?;
|
stdin
|
||||||
|
.write_all(prompt.as_bytes())
|
||||||
|
.await
|
||||||
|
.map_err(Error::Stdin)?;
|
||||||
// Best-effort flush/close; claude sees EOF and starts the turn.
|
// Best-effort flush/close; claude sees EOF and starts the turn.
|
||||||
stdin.shutdown().await.ok();
|
stdin.shutdown().await.ok();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,11 @@ impl CompactionPolicy for PercentPolicy {
|
||||||
if self.percent == 0 {
|
if self.percent == 0 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let Some(window) = usage.context_window.or(self.default_window).filter(|&w| w > 0) else {
|
let Some(window) = usage
|
||||||
|
.context_window
|
||||||
|
.or(self.default_window)
|
||||||
|
.filter(|&w| w > 0)
|
||||||
|
else {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
usage.context_tokens.saturating_mul(100) >= u64::from(self.percent) * window
|
usage.context_tokens.saturating_mul(100) >= u64::from(self.percent) * window
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ use std::sync::Mutex;
|
||||||
|
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use crate::{Attach, Claude, CompactionPolicy, Config, Error, Result, SessionStore, Sink, Telemetry};
|
use crate::{
|
||||||
|
Attach, Claude, CompactionPolicy, Config, Error, Result, SessionStore, Sink, Telemetry,
|
||||||
|
};
|
||||||
|
|
||||||
/// A named claude session that outlives the model's context window by
|
/// A named claude session that outlives the model's context window by
|
||||||
/// compacting itself. Bundles the three things a durable session needs:
|
/// compacting itself. Bundles the three things a durable session needs:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue