Fix gastown mail routing for rig-specific agent beads
All checks were successful
CI / check (push) Successful in 3m18s
All checks were successful
CI / check (push) Successful in 3m18s
- Add title-based lookup for hq- prefixed beads (uses title as address if contains "/") - Add rig-specific prefix handling to parse IDs like j-java-crew-americano → java/crew/americano - Handles crew, polecat, witness, refinery role patterns Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,11 +41,45 @@ let
|
|||||||
'if AddressToIdentity(agentBeadToAddress(agent)) == AddressToIdentity(identity) {'
|
'if AddressToIdentity(agentBeadToAddress(agent)) == AddressToIdentity(identity) {'
|
||||||
|
|
||||||
# Fix agentBeadToAddress to use title field for hq- prefixed beads
|
# Fix agentBeadToAddress to use title field for hq- prefixed beads
|
||||||
|
# Title should contain the address (e.g., "java/crew/americano")
|
||||||
substituteInPlace internal/mail/router.go \
|
substituteInPlace internal/mail/router.go \
|
||||||
--replace-fail \
|
--replace-fail \
|
||||||
'return parseAgentAddressFromDescription(bead.Description)' \
|
'return parseAgentAddressFromDescription(bead.Description)' \
|
||||||
'if bead.Title != "" && strings.Contains(bead.Title, "/") { return bead.Title }; return parseAgentAddressFromDescription(bead.Description)'
|
'if bead.Title != "" && strings.Contains(bead.Title, "/") { return bead.Title }; return parseAgentAddressFromDescription(bead.Description)'
|
||||||
|
|
||||||
|
# Fix agentBeadToAddress to handle rig-specific prefixes (j-, sc-, etc.)
|
||||||
|
# Bead IDs like j-java-crew-americano should map to java/crew/americano
|
||||||
|
substituteInPlace internal/mail/router.go \
|
||||||
|
--replace-fail \
|
||||||
|
'// Handle gt- prefixed IDs (legacy format)
|
||||||
|
if !strings.HasPrefix(id, "gt-") {
|
||||||
|
return "" // Not a valid agent bead ID
|
||||||
|
}' \
|
||||||
|
'// Handle rig-specific prefixes: <prefix>-<rig>-<role>-<name>
|
||||||
|
// Examples: j-java-crew-americano -> java/crew/americano
|
||||||
|
idParts := strings.Split(id, "-")
|
||||||
|
if len(idParts) >= 3 {
|
||||||
|
for i, part := range idParts {
|
||||||
|
if part == "crew" || part == "polecat" || part == "polecats" {
|
||||||
|
if i >= 1 && i < len(idParts)-1 {
|
||||||
|
rig := idParts[i-1]
|
||||||
|
name := strings.Join(idParts[i+1:], "-")
|
||||||
|
return rig + "/" + part + "/" + name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if part == "witness" || part == "refinery" {
|
||||||
|
if i >= 1 {
|
||||||
|
return idParts[i-1] + "/" + part
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle gt- prefixed IDs (legacy format)
|
||||||
|
if !strings.HasPrefix(id, "gt-") {
|
||||||
|
return "" // Not a valid agent bead ID
|
||||||
|
}'
|
||||||
|
|
||||||
# Fix crew/polecat home paths: remove incorrect /rig suffix
|
# Fix crew/polecat home paths: remove incorrect /rig suffix
|
||||||
substituteInPlace internal/cmd/role.go \
|
substituteInPlace internal/cmd/role.go \
|
||||||
--replace-fail \
|
--replace-fail \
|
||||||
|
|||||||
Reference in New Issue
Block a user