feat: Update agent bead lookups to use correct tier (gt-eqptl)
Implement two-level beads architecture for agent lookups: - Town-level agents (Mayor, Deacon) now use hq- prefix and are looked up in town beads (~/.beads/) - Rig-level agents continue using rig prefix (e.g., gt-) and are looked up in rig beads Changes: - Add MayorBeadIDTown(), DeaconBeadIDTown(), DogBeadIDTown() helpers - Add GetTownBeadsPath() for town beads path resolution - Update gt status to pre-fetch town-level agent beads - Update agentIDToBeadID() to use town-level IDs - Update agent_beads_check.go to check/fix in correct tier - Update agentAddressToIDs() in deacon.go 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/steveyegge/gastown/internal/beads"
|
||||
"github.com/steveyegge/gastown/internal/config"
|
||||
"github.com/steveyegge/gastown/internal/constants"
|
||||
"github.com/steveyegge/gastown/internal/deacon"
|
||||
@@ -1118,14 +1119,13 @@ func notifyMayorOfWitnessFailure(townRoot string, zombies []zombieInfo) {
|
||||
|
||||
// agentAddressToIDs converts an agent address to bead ID and session name.
|
||||
// Supports formats: "gastown/polecats/max", "gastown/witness", "deacon", "mayor"
|
||||
// Note: Town-level agents (Mayor, Deacon) use hq- prefix bead IDs stored in town beads.
|
||||
func agentAddressToIDs(address string) (beadID, sessionName string, err error) {
|
||||
switch address {
|
||||
case "deacon":
|
||||
sessName := session.DeaconSessionName()
|
||||
return sessName, sessName, nil
|
||||
return beads.DeaconBeadIDTown(), session.DeaconSessionName(), nil
|
||||
case "mayor":
|
||||
sessName := session.MayorSessionName()
|
||||
return sessName, sessName, nil
|
||||
return beads.MayorBeadIDTown(), session.MayorSessionName(), nil
|
||||
}
|
||||
|
||||
parts := strings.Split(address, "/")
|
||||
|
||||
@@ -970,15 +970,15 @@ func detectActor() string {
|
||||
|
||||
// agentIDToBeadID converts an agent ID to its corresponding agent bead ID.
|
||||
// Uses canonical naming: prefix-rig-role-name
|
||||
// This function uses "gt-" prefix by default. For non-gastown rigs, use the
|
||||
// appropriate *WithPrefix functions that accept the rig's configured prefix.
|
||||
// Town-level agents (Mayor, Deacon) use hq- prefix and are stored in town beads.
|
||||
// Rig-level agents use the rig's configured prefix (default "gt-").
|
||||
func agentIDToBeadID(agentID string) string {
|
||||
// Handle simple cases (town-level agents)
|
||||
// Handle simple cases (town-level agents with hq- prefix)
|
||||
if agentID == "mayor" {
|
||||
return beads.MayorBeadID()
|
||||
return beads.MayorBeadIDTown()
|
||||
}
|
||||
if agentID == "deacon" {
|
||||
return beads.DeaconBeadID()
|
||||
return beads.DeaconBeadIDTown()
|
||||
}
|
||||
|
||||
// Parse path-style agent IDs
|
||||
|
||||
@@ -170,6 +170,37 @@ func runStatus(cmd *cobra.Command, args []string) error {
|
||||
// Pre-fetch agent beads across all rig-specific beads DBs.
|
||||
allAgentBeads := make(map[string]*beads.Issue)
|
||||
allHookBeads := make(map[string]*beads.Issue)
|
||||
|
||||
// Fetch town-level agent beads (Mayor, Deacon) from town beads
|
||||
townBeadsPath := beads.GetTownBeadsPath(townRoot)
|
||||
townBeadsClient := beads.New(townBeadsPath)
|
||||
townAgentBeads, _ := townBeadsClient.ListAgentBeads()
|
||||
for id, issue := range townAgentBeads {
|
||||
allAgentBeads[id] = issue
|
||||
}
|
||||
|
||||
// Fetch hook beads from town beads
|
||||
var townHookIDs []string
|
||||
for _, issue := range townAgentBeads {
|
||||
hookID := issue.HookBead
|
||||
if hookID == "" {
|
||||
fields := beads.ParseAgentFields(issue.Description)
|
||||
if fields != nil {
|
||||
hookID = fields.HookBead
|
||||
}
|
||||
}
|
||||
if hookID != "" {
|
||||
townHookIDs = append(townHookIDs, hookID)
|
||||
}
|
||||
}
|
||||
if len(townHookIDs) > 0 {
|
||||
townHookBeads, _ := townBeadsClient.ShowMultiple(townHookIDs)
|
||||
for id, issue := range townHookBeads {
|
||||
allHookBeads[id] = issue
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch rig-level agent beads
|
||||
for _, r := range rigs {
|
||||
rigBeadsPath := filepath.Join(r.Path, "mayor", "rig")
|
||||
rigBeads := beads.New(rigBeadsPath)
|
||||
@@ -650,6 +681,7 @@ func discoverGlobalAgents(allSessions map[string]bool, allAgentBeads map[string]
|
||||
deaconSession := getDeaconSessionName()
|
||||
|
||||
// Define agents to discover
|
||||
// Note: Mayor and Deacon are town-level agents with hq- prefix bead IDs
|
||||
agentDefs := []struct {
|
||||
name string
|
||||
address string
|
||||
@@ -657,8 +689,8 @@ func discoverGlobalAgents(allSessions map[string]bool, allAgentBeads map[string]
|
||||
role string
|
||||
beadID string
|
||||
}{
|
||||
{"mayor", "mayor/", mayorSession, "coordinator", mayorSession},
|
||||
{"deacon", "deacon/", deaconSession, "health-check", deaconSession},
|
||||
{"mayor", "mayor/", mayorSession, "coordinator", beads.MayorBeadIDTown()},
|
||||
{"deacon", "deacon/", deaconSession, "health-check", beads.DeaconBeadIDTown()},
|
||||
}
|
||||
|
||||
agents := make([]AgentRuntime, len(agentDefs))
|
||||
|
||||
Reference in New Issue
Block a user