diff --git a/internal/codex/worker.go b/internal/codex/worker.go index 116f1dd..f4065d3 100644 --- a/internal/codex/worker.go +++ b/internal/codex/worker.go @@ -20,16 +20,16 @@ const executable = "/opt/codex/node_modules/.bin/codex" var errOutputLimit = errors.New("Codex output limit exceeded") type outputBuffer struct { - bytes.Buffer + buffer bytes.Buffer exceeded bool } func (b *outputBuffer) Write(p []byte) (int, error) { - if len(p) > maxOutput-b.Len() { + if len(p) > maxOutput-b.buffer.Len() { b.exceeded = true return 0, errOutputLimit } - return b.Buffer.Write(p) + return b.buffer.Write(p) } func ServeWorker(socket string) error { @@ -97,7 +97,7 @@ func execute(w http.ResponseWriter, r *http.Request, prompt string) { default: var result string var completed bool - for _, line := range bytes.Split(bytes.TrimSpace(output.Bytes()), []byte("\n")) { + for _, line := range bytes.Split(bytes.TrimSpace(output.buffer.Bytes()), []byte("\n")) { var event struct { Type string `json:"type"` Item struct {