Add goq backend support

This commit is contained in:
Levi Neely 2026-04-10 16:13:49 +02:00
parent 08a81c3317
commit 8ad8e35551
5 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,3 @@
---
no_implicit_system_prompt: true
---

15
cfg/backends/goq.yaml Normal file
View File

@ -0,0 +1,15 @@
# goq backend requirements
filesystem:
rw:
- "{HOME}/.config/goq"
- "{XDG_DATA_HOME}/goq"
- "{HOME}/.local/share/goq"
- "/dev/tty"
network:
unrestricted: true
env:
- GOQ_PROVIDER
- GOQ_MODEL
- OPENAI_API_KEY
- ANTHROPIC_API_KEY
- GITHUB_TOKEN

58
internal/backends/goq.go Normal file
View File

@ -0,0 +1,58 @@
// Package backends provides concrete backend implementations
package backends
import (
"anvillm/internal/backend"
"anvillm/internal/backend/tmux"
"fmt"
"os"
"os/exec"
"strings"
)
// NewGoq creates a goq backend
func NewGoq(nsSuffix string) backend.Backend {
goqCmd := os.Getenv("ANVILLM_GOQ_CMD")
if goqCmd == "" {
goqCmd = "goq"
}
return tmux.New(tmux.Config{
Name: "goq",
Command: append(strings.Fields(goqCmd), "--agent", "anvillm-agent"),
Environment: map[string]string{
"TERM": "xterm-256color",
"NO_COLOR": "1",
},
TmuxSize: tmux.TmuxSize{
Rows: 40,
Cols: 120,
},
StateInspector: &goqStateInspector{},
ClearHandler: goqClearHandler,
CompactHandler: goqCompactHandler,
NsSuffix: nsSuffix,
})
}
func goqClearHandler(target string) error {
return tmux.SendKeysTo(target, "/clear", "C-m")
}
func goqCompactHandler(target string) error {
return tmux.SendKeysTo(target, "/compact", "C-m")
}
type goqStateInspector struct{}
func (i *goqStateInspector) IsBusy(panePID int) bool {
bashPID := tmux.FindChildByName(panePID, "bash")
if bashPID == 0 {
return false
}
goqPID := tmux.FindChildByName(bashPID, "goq")
if goqPID == 0 {
return false
}
cmd := exec.Command("pgrep", "-P", fmt.Sprintf("%d", goqPID))
return cmd.Run() == nil
}

View File

@ -194,6 +194,7 @@ func start(daemonize bool) {
"kiro-cli": backends.NewKiroCLI(nsSuffix),
"claude": backends.NewClaude(nsSuffix),
"ollie": backends.NewOllie(nsSuffix),
"goq": backends.NewGoq(nsSuffix),
}
mgr := session.NewManager(backendMap)

2
mkfile
View File

@ -25,6 +25,8 @@ build:V:
cp hooks/claude/*.sh $HOME/.config/anvillm/claude/hooks/
chmod +x $HOME/.config/anvillm/claude/hooks/*.sh
bash hooks/claude/install-hooks.sh
mkdir -p $HOME/.config/goq/agents
cat agents/goq/anvillm-agent.md agents/OUTPUT_PROTOCOL.md agents/SKILLS_PROMPT.md > $HOME/.config/goq/agents/anvillm-agent.md
mkdir -p $HOME/.config/anvillm/tools
cp tools/*.sh $HOME/.config/anvillm/tools/
chmod +x $HOME/.config/anvillm/tools/*.sh