remove more bugs

This commit is contained in:
2026-01-09 15:10:24 -05:00
parent 8b4075de6a
commit ddecde940e
3 changed files with 11 additions and 42 deletions

View File

@@ -171,21 +171,24 @@
(defun codex--parse-msg-from-response (response-string)
(let* ((output (string-trim response-string))
(lines (string-lines output))
(jsons (mapcar #'json-parse-string lines))
(jsons (delq nil
(mapcar (lambda (line)
(condition-case nil
(json-parse-string line)
(json-parse-error nil)))
lines)))
(msg (cl-find-if (lambda (hm) (let ((type (gethash "type" hm))
(item (gethash "item" hm)))
(and type
item
(string-equal type "item.completed")
(string-equal (gethash "type" item) "agent_message"))))
jsons)))
(unless msg
(error "No proper agent_message" received))
(let* ((item (gethash "item" msg))
(text (gethash "text" item)))
jsons))
(item (and msg (gethash "item" msg)))
(text (and item (gethash "text" item))))
;; We should make sure we get one and only one message here, otherwise bail out
(setf codex--session-id (codex--parse-session-id jsons))
text)))
(or text output)))
(defun codex--ensure-session-in-sessions-file (prompt)
(let ((sessions (codex--read-sessions-file)))

32
history

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +0,0 @@
;;; -*- lisp-data -*-
(("/Users/grant/repos/builtecho/"))