feat(agent): hf agent status-of <agent-id> — read another agent's status
The backend has GET /calendar/agent/status?agent_id=<id> (read an agent's
runtime status, no side effects) but the CLI only exposed `hf agent status
--set` (sets the CALLER's own status). So delegate-task / on-call-handoff
status gates — which need to check whether the RECEIVER/incoming agent is
idle before pinging/handing off — had no CLI path; agents had to guess from
is_active.
Add `hf agent status-of <agent-id>` wrapping the GET endpoint
(X-Claw-Identifier header, no token). Prints {agent_id, status}; surfaces the
backend's 404 for unknown agents so callers can fail-open/closed.
Verified on sim: `hf agent status-of plxrec2` → idle; --json → {"agent_id",
"status"}; unknown agent → 404 "Agent not found".
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -60,11 +60,19 @@ func main() {
|
||||
// `POST /calendar/agent/status`, identifies caller via
|
||||
// AGENT_ID/CLAW_IDENTIFIER env, no token needed).
|
||||
if len(args) < 2 {
|
||||
output.Error("usage: hf agent status --set <idle|busy|on_call|exhausted|offline>")
|
||||
output.Error("usage: hf agent status --set <idle|busy|on_call|exhausted|offline> | hf agent status-of <agent-id>")
|
||||
}
|
||||
switch args[1] {
|
||||
case "status":
|
||||
commands.RunAgentStatus(args[2:])
|
||||
case "status-of":
|
||||
// `hf agent status-of <agent-id>` — read ANOTHER agent's runtime
|
||||
// status (no side effects), wrapping GET /calendar/agent/status.
|
||||
// Used by delegate-task / on-call-handoff status gates.
|
||||
if len(args) < 3 {
|
||||
output.Error("usage: hf agent status-of <agent-id>")
|
||||
}
|
||||
commands.RunAgentStatusOf(args[2])
|
||||
default:
|
||||
output.Errorf("unknown agent subcommand: %s", args[1])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user