feat: add bd agent state command for ZFC-compliant state reporting (bd-uxlb)

Add agent commands for self-reporting state:
- bd agent state <agent> <state>: Update agent state and last_activity
- bd agent heartbeat <agent>: Update last_activity timestamp only
- bd agent show <agent>: Display agent bead details

States: idle, spawning, running, working, stuck, done, stopped, dead

Also adds AgentState and LastActivity fields to UpdateArgs in RPC protocol.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-28 01:56:53 -08:00
parent dfc796589f
commit 947b5ee1c6
4 changed files with 464 additions and 0 deletions

View File

@@ -129,6 +129,9 @@ type UpdateArgs struct {
// Agent slot fields (gt-h5sza)
HookBead *string `json:"hook_bead,omitempty"` // Current work on agent's hook (0..1)
RoleBead *string `json:"role_bead,omitempty"` // Role definition bead for agent
// Agent state fields (bd-uxlb)
AgentState *string `json:"agent_state,omitempty"` // Agent state (idle|running|stuck|stopped|dead)
LastActivity *bool `json:"last_activity,omitempty"` // If true, update last_activity to now
}
// CloseArgs represents arguments for the close operation

View File

@@ -108,6 +108,13 @@ func updatesFromArgs(a UpdateArgs) map[string]interface{} {
if a.RoleBead != nil {
u["role_bead"] = *a.RoleBead
}
// Agent state fields (bd-uxlb)
if a.AgentState != nil {
u["agent_state"] = *a.AgentState
}
if a.LastActivity != nil && *a.LastActivity {
u["last_activity"] = time.Now()
}
return u
}