feat(done): Add --phase-complete flag for gate-based phase handoffs
Add support for signaling phase completion when a polecat needs to wait on a gate before continuing. The --phase-complete flag with --gate ID allows polecats to hand off control while awaiting external conditions. Changes: - done.go: Add --phase-complete and --gate flags, PHASE_COMPLETE exit type - protocol.go: Add Gate field to PolecatDonePayload - handlers.go: Handle PHASE_COMPLETE by recycling session (keep worktree) - beads.go: Add AddGateWaiter method for gate registration This enables multi-phase molecule workflows with async coordination (bd-gxb4) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1423,3 +1423,16 @@ func (b *Beads) FindMRForBranch(branch string) (*Issue, error) {
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// AddGateWaiter registers an agent as a waiter on a gate bead.
|
||||
// When the gate closes, the waiter will receive a wake notification via gt gate wake.
|
||||
// The waiter is typically the polecat's address (e.g., "gastown/polecats/Toast").
|
||||
func (b *Beads) AddGateWaiter(gateID, waiter string) error {
|
||||
// Use bd gate add-waiter to register the waiter on the gate
|
||||
// This adds the waiter to the gate's native waiters field
|
||||
_, err := b.run("gate", "add-waiter", gateID, waiter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("adding gate waiter: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user