manager: add update_meta_inputs tool to update flake.lock on demand (closes #235)
This commit is contained in:
parent
15e44955a8
commit
597e4ba03a
5 changed files with 76 additions and 8 deletions
|
|
@ -10,6 +10,7 @@ Tools (hyperhive surface):
|
|||
- `mcp__hyperhive__start(name)` — start a stopped sub-agent. No approval required.
|
||||
- `mcp__hyperhive__restart(name)` — stop + start a sub-agent. No approval required.
|
||||
- `mcp__hyperhive__update(name)` — rebuild a sub-agent (re-applies the current hyperhive flake + agent.nix, restarts the container). No approval required — idempotent. Use when you receive a `needs_update` system event.
|
||||
- `mcp__hyperhive__update_meta_inputs(inputs?)` — run `nix flake update [inputs...]` on the meta flake and commit the lock changes. Pass specific input names (e.g. `["bitburner-agent"]`) to update just those, or omit / pass `[]` to update everything. Blocks until complete. Does NOT trigger rebuilds — call `update(name)` on affected agents afterward.
|
||||
- `mcp__hyperhive__get_logs(agent, lines?)` — fetch recent journal lines for a sub-agent container. Use to diagnose MCP-server registration failures, startup crashes, or harness issues you can't see from inside. Pass the plain logical agent name; `lines` defaults to 50 (capped at 500).
|
||||
- `mcp__hyperhive__request_apply_commit(agent, commit_ref, description?)` — submit a config change for any agent (`hm1nd` for self) for operator approval. Pass an optional `description` and it appears on the dashboard approval card so the operator knows what changed without opening the diff. At submit time hive-c0re fetches your commit into the agent's applied repo and pins it as `proposal/<id>`; from that moment your proposed-side commit can be amended or force-pushed freely without changing what the operator will build.
|
||||
- `mcp__hyperhive__ask(question, options?, multi?, ttl_seconds?, to?)` — surface a structured question to the operator (default, or `to: "operator"`) OR a sub-agent (`to: "<agent-name>"`). Returns immediately with a question id; the answer arrives later as a system `question_answered { id, question, answer, answerer }` event in your inbox. Options are advisory: the dashboard always lets the operator type a free-text answer in addition. Set `multi: true` to render options as checkboxes (operator can pick multiple); the answer comes back as `, `-separated. Set `ttl_seconds` to auto-cancel after a deadline (capped at 6h server-side) — on expiry the answer is `[expired]` and `answerer` is `"ttl-watchdog"`. Do not poll inside the same turn — finish the current work and react when the event lands.
|
||||
|
|
|
|||
|
|
@ -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 \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue