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:
+18
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user