manager: add update_meta_inputs tool to update flake.lock on demand (closes #235)

This commit is contained in:
damocles 2026-05-22 01:31:26 +02:00 committed by Mara
parent 15e44955a8
commit 597e4ba03a
5 changed files with 76 additions and 8 deletions

View file

@ -807,6 +807,14 @@ pub struct RequestApplyCommitArgs {
pub description: Option<String>,
}
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
pub struct UpdateMetaInputsArgs {
/// Flake input names to update (e.g. `["bitburner-agent", "nixpkgs"]`).
/// Pass an empty list to update ALL inputs.
#[serde(default)]
pub inputs: Vec<String>,
}
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
pub struct GetLogsArgs {
/// Logical agent name to fetch logs for (e.g. `gui`, `hm1nd`).
@ -1022,6 +1030,38 @@ impl ManagerServer {
.await
}
#[tool(
description = "Run `nix flake update` on the meta flake and commit the resulting \
`flake.lock` changes. Pass specific input names to update only those inputs \
(e.g. `[\"bitburner-agent\"]`), or pass an empty list to update ALL inputs. \
Blocks until the lock step completes (~30-120s depending on download size). \
Does NOT trigger container rebuilds call `update` on each affected agent \
separately after the lock settles."
)]
async fn update_meta_inputs(
&self,
Parameters(args): Parameters<UpdateMetaInputsArgs>,
) -> String {
let log = format!("{args:?}");
run_tool_envelope("update_meta_inputs", log, async move {
let label = if args.inputs.is_empty() {
"all inputs".to_string()
} else {
args.inputs.join(", ")
};
let (resp, retries) = self
.dispatch(hive_sh4re::ManagerRequest::UpdateMetaInputs {
inputs: args.inputs,
})
.await;
annotate_retries(
format_ack(resp, "update_meta_inputs", format!("lock updated: {label}")),
retries,
)
})
.await
}
#[tool(
description = "Surface a structured question to either the operator OR a sub-agent. \
Returns immediately with a question id do NOT wait inline. When the recipient \