Poll OpenCode permission requests and forward chat_reply

This commit is contained in:
2026-10-16 08:06:39 +01:00
parent 9d1676df0a
commit 3ff5cd8838
10 changed files with 889 additions and 40 deletions
+5
View File
@@ -262,6 +262,11 @@ func (c *Connection) Native(ctx context.Context, method, path string, body any)
evidence, _ := io.ReadAll(io.LimitReader(response.Body, 16<<10))
return evidence, fmt.Errorf("OpenCode %s %s failed (HTTP %d)", method, path, response.StatusCode)
}
// A successful no-content operation (the permission-reply endpoint returns
// 204) carries no JSON body to validate.
if response.StatusCode == http.StatusNoContent {
return nil, nil
}
if !strings.HasPrefix(response.Header.Get("Content-Type"), "application/json") {
return nil, fmt.Errorf("OpenCode %s %s returned a non-JSON API response", method, path)
}