agents: remove the hive-level /effort control too
mara on #5034: "effort shares /models fate". The per-agent web UI no longer sets effort: the `/effort` slash command, the effort picker, `POST /api/effort`, `Bus::set_effort`, the `hyperhive-effort` writer, `EFFORT_LEVELS`/`is_valid_effort` and the ACP effort-list payload are gone, and `lib/modelEffort.ts` with them. The effort chip is display-only and shows its source (`effort_source` in `/api/state`); on ACP it stays hidden while the session offers no effort level. The read side is unchanged: with no swarm value an agent runs an existing `hyperhive-effort` file, else its agent.nix effort, else medium. Existing files are not touched. Refs #5034
This commit is contained in:
parent
594693f4c7
commit
ed271e655f
25 changed files with 170 additions and 464 deletions
|
|
@ -80,7 +80,6 @@ fn routes() -> Router<AppState> {
|
|||
.route("/login/cancel", post(auth::post_login_cancel))
|
||||
.route("/api/cancel", post(actions::post_cancel_turn))
|
||||
.route("/api/compact", post(actions::post_compact))
|
||||
.route("/api/effort", post(actions::post_set_effort))
|
||||
.route("/api/new-session", post(actions::post_new_session))
|
||||
.route("/api/logout", post(auth::post_logout))
|
||||
.route("/api/todos", get(stats::api_todos))
|
||||
|
|
@ -444,10 +443,10 @@ mod tests {
|
|||
.unwrap()
|
||||
}
|
||||
|
||||
/// The swarm sets the model, so the agent serves no route for it; effort
|
||||
/// is still set here.
|
||||
/// The swarm sets the model and effort, so the agent serves no route for
|
||||
/// either.
|
||||
#[test]
|
||||
fn the_model_has_no_route_and_effort_still_does() {
|
||||
fn neither_model_nor_effort_has_a_route() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let _env = crate::paths::HARNESS_DIR_ENV
|
||||
.lock()
|
||||
|
|
@ -465,15 +464,20 @@ mod tests {
|
|||
interrupted: Arc::new(AtomicBool::new(false)),
|
||||
};
|
||||
let app = routes().with_state(state);
|
||||
let (model, effort) = tokio::runtime::Builder::new_current_thread()
|
||||
let (model, effort, compact) = tokio::runtime::Builder::new_current_thread()
|
||||
.build()
|
||||
.unwrap()
|
||||
.block_on(async {
|
||||
let model = app.clone().oneshot(form("/api/model", "model=opus"));
|
||||
// An unknown level reaches the handler, which refuses it
|
||||
// before anything is applied.
|
||||
let effort = app.oneshot(form("/api/effort", "effort=bogus"));
|
||||
(model.await.unwrap(), effort.await.unwrap())
|
||||
let effort = app.clone().oneshot(form("/api/effort", "effort=high"));
|
||||
// A route the router does serve, so the 404s above are not
|
||||
// the router refusing everything.
|
||||
let compact = app.oneshot(form("/api/compact", ""));
|
||||
(
|
||||
model.await.unwrap(),
|
||||
effort.await.unwrap(),
|
||||
compact.await.unwrap(),
|
||||
)
|
||||
});
|
||||
match prev {
|
||||
// SAFETY: as above.
|
||||
|
|
@ -481,6 +485,7 @@ mod tests {
|
|||
None => unsafe { std::env::remove_var("HYPERHIVE_HARNESS_DIR") },
|
||||
}
|
||||
assert_eq!(model.status(), StatusCode::NOT_FOUND);
|
||||
assert_eq!(effort.status(), StatusCode::BAD_REQUEST);
|
||||
assert_eq!(effort.status(), StatusCode::NOT_FOUND);
|
||||
assert_eq!(compact.status(), StatusCode::OK);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue