validate and select configured harness adapters

This commit is contained in:
kami
2026-07-26 20:25:17 +04:00
parent 4e05e4df7b
commit 98725c28c5
3 changed files with 22 additions and 1 deletions
+18 -1
View File
@@ -45,7 +45,24 @@ func main() {
continue
}
client := herdr.New(h.Address)
adapters[h.ID] = herdr.Codex(client, 200000)
protocol := h.Protocol
if protocol == "" {
protocol = os.Getenv("ORCHESTRA_HERDR_PROTOCOL")
}
if err := client.CheckProtocol(context.Background(), protocol); err != nil {
log.Printf("herdr %s unavailable: %v", h.ID, err)
continue
}
switch h.Harness {
case "claude":
adapters[h.ID] = herdr.Claude(client, 200000)
case "opencode":
adapters[h.ID] = herdr.OpenCode(client, 200000)
case "codex", "":
adapters[h.ID] = herdr.Codex(client, 200000)
default:
log.Printf("herdr %s has unsupported harness %q", h.ID, h.Harness)
}
}
coordinator := &orchestrator.Coordinator{Store: s, Worktrees: orchestrator.GitWorktrees{Root: root, Repo: repo}, Adapters: orchestrator.AdapterFactory{Herdrs: adapters}}
rt.OnLease = func(e domain.Event) error { return coordinator.Start(context.Background(), e) }
+2
View File
@@ -30,6 +30,8 @@ type Herdr struct {
ID string `json:"id"`
MachineID string `json:"machine_id"`
Address string `json:"address,omitempty"`
Harness string `json:"harness,omitempty"`
Protocol string `json:"protocol,omitempty"`
Capabilities []string `json:"capabilities"`
Concurrency int `json:"concurrency"`
}
+2
View File
@@ -55,6 +55,8 @@ The lifecycle API contract pass now requires callers to provide explicit release
Item 1 substrate hardening pass: newly appended events use schema envelope version 1; replay rejects unsupported versions and non-object payloads; and `TaskLeased` carries an `expected_version` guard that is checked before append. Legacy envelope events remain readable for tolerant replay.
Harness registration now uses configured `harness` and `protocol` fields, pings each configured herdr before exposing it to orchestration, selects Claude/Codex/opencode adapters accordingly, and skips unavailable or unsupported deployments at startup. This is an initial discovery/health slice; active-session discovery and ongoing heartbeats remain open.
Recommended order:
1. Add the orchestration coordinator: lease → worktree → harness session → bootstrap → lifecycle events.