<commit_before>package window

import (
	"fmt"

	"github.com/sclevine/agouti/core/internal/types"
)

type Window struct {
	ID      string
	Session types.Session
}

func (w *Window) SetSize(width, height int) error {
	endpoint := "window/" + w.ID + "/size"
	request := struct {
		Width  int `json:"width"`
		Height int `json:"height"`
	}{width, height}

	if err := w.Session.Execute(endpoint, "POST", &request, &struct{}{}); err != nil {
		return err
	}
	return nil
}

func (w *Window) SwitchTo() error {
	request := struct {
		Handle string `json:"handle"`
	}{w.ID}
	if err := w.Session.Execute("window", "POST", &request, nil); err != nil {
		return err
	}
	return nil
}

func (w *Window) Close() error {
	fmt.Println("OK, switching to", w.ID)
	err := w.SwitchTo()
	if err != nil {
		return err
	}

	fmt.Println("OK, Closing now", w.ID)
	if err := w.Session.Execute("window_handle", "DELETE", nil, nil); err != nil {
		fmt.Println("OK, failed, here", err)
		return err
	}
	return nil
}
<commit_msg>Removed messages. Fix the endpoint.<commit_after>package window

import "github.com/sclevine/agouti/core/internal/types"

type Window struct {
	ID      string
	Session types.Session
}

func (w *Window) SetSize(width, height int) error {
	endpoint := "window/" + w.ID + "/size"
	request := struct {
		Width  int `json:"width"`
		Height int `json:"height"`
	}{width, height}

	if err := w.Session.Execute(endpoint, "POST", &request, &struct{}{}); err != nil {
		return err
	}
	return nil
}

func (w *Window) SwitchTo() error {
	request := struct {
		Handle string `json:"handle"`
	}{w.ID}
	if err := w.Session.Execute("window", "POST", &request, nil); err != nil {
		return err
	}
	return nil
}

func (w *Window) Close() error {
	err := w.SwitchTo()
	if err != nil {
		return err
	}

	if err := w.Session.Execute("window", "DELETE", nil, nil); err != nil {
		return err
	}
	return nil
}

{'fraction_non_alphanumeric': 0.16878980891719744, 'fraction_numerical': 0.0, 'mean_word_length': 3.642857142857143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5430355', 'n_tokens_mistral': 691, 'n_tokens_neox': 670, 'n_words': 199}