feat(harness): dispatch /v1/harness/complete by harness kind (codex/opencode)

Adds an optional "harness" field so codex/opencode completions route to
their own Usage readers instead of always assuming Claude's transcript
format; unblocks the server side named as open in progress.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W1rkJ2hBMybnJctPbcy4tT
This commit is contained in:
kami
2026-07-27 23:31:10 +04:00
parent 44376f0709
commit 72f6230b4a
3 changed files with 39 additions and 3 deletions
+18 -1
View File
@@ -260,6 +260,7 @@ func main() {
}
var p struct {
TaskID string `json:"task_id"`
Harness string `json:"harness"`
TranscriptPath string `json:"transcript_path"`
Report string `json:"report"`
}
@@ -272,7 +273,23 @@ func main() {
http.Error(w, "task not found", http.StatusNotFound)
return
}
usage, err := herdr.ClaudeUsage(p.TranscriptPath)
// Harness-specific session-state readers (AUDIT.md "Codex/opencode
// completion producers"). Same local-filesystem assumption B3 already
// made for Claude: the caller supplies the path to its own session
// state (transcript / rollout / message file), never a herdr pane id.
var usage herdr.Usage
var err error
switch p.Harness {
case "codex":
usage, err = herdr.CodexUsage(p.TranscriptPath)
case "opencode":
usage, err = herdr.OpenCodeUsage(p.TranscriptPath)
case "", "claude":
usage, err = herdr.ClaudeUsage(p.TranscriptPath)
default:
http.Error(w, "unknown harness: "+p.Harness, http.StatusBadRequest)
return
}
if err != nil {
http.Error(w, "reading transcript: "+err.Error(), http.StatusBadRequest)
return