(setq load-path (cons "./projects/org-agent/src" load-path)) (require 'org-agent) (defun prove-shell-works () (message "SIMulation: Connecting to agent...") (setq org-agent-executable-path nil) (org-agent-connect) (let ((retries 0)) (while (and (not org-agent--network-process) (< retries 10)) (sleep-for 0.5) (setq retries (1+ retries)))) (message "SIMulation: Connection established. Sending message 'run date'...") (with-current-buffer (get-buffer-create "*org-agent-chat*") (erase-buffer) (insert "* Welcome\n\nPlease run the 'date' command for me.\n") (org-agent-chat-send)) (message "SIMulation: Message sent. Waiting for response (timeout 60s)...") (let ((retries 0) (found nil)) (while (and (not found) (< retries 120)) (sleep-for 0.5) (accept-process-output org-agent--network-process 0.1) (with-current-buffer "*org-agent-chat*" (when (and (not (string-match-p "Thinking..." (buffer-string))) (> (buffer-size) 50)) (setq found t) (message "SIMulation: RESPONSE RECEIVED!\n\n--- BUFFER START ---\n%s\n--- BUFFER END ---" (buffer-string)))) (setq retries (1+ retries))) (if (not found) (error "SIMulation: Timeout waiting for agent response. Check daemon logs.")))) (prove-shell-works)