From 8a9ce2c9e1aeab0ccc7c94a3938c7a59fe408e57 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Tue, 17 Feb 2026 14:49:12 +0100 Subject: [PATCH] Revert "Fix Assist to use mailbox system instead of direct 'in' file writes" This reverts commit bdd0039ebaa4d04c29dcb555ab32fcfa4ec61c80. --- cmd/Assist/main.go | 48 ++-------------------------------------------- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/cmd/Assist/main.go b/cmd/Assist/main.go index 065df71..073fb6a 100644 --- a/cmd/Assist/main.go +++ b/cmd/Assist/main.go @@ -3,7 +3,6 @@ package main import ( "anvillm/internal/sandbox" - "encoding/json" "flag" "fmt" "log" @@ -355,42 +354,6 @@ func sendPrompt(id, prompt string) error { if !isConnected() { return fmt.Errorf("not connected to anvilsrv") } - - // Create message JSON - msg := map[string]interface{}{ - "to": id, - "type": "PROMPT", - "subject": "User prompt", - "body": prompt, - } - msgJSON, err := json.Marshal(msg) - if err != nil { - return fmt.Errorf("failed to marshal message: %w", err) - } - - // Write to user outbox - timestamp := time.Now().Unix() - filename := fmt.Sprintf("msg-%d.json", timestamp) - path := filepath.Join("user/outbox", filename) - - fid, err := fs.Create(path, plan9.OWRITE, 0644) - if err != nil { - return fmt.Errorf("failed to create message file: %w", err) - } - defer fid.Close() - - _, err = fid.Write(msgJSON) - if err != nil { - return fmt.Errorf("failed to write message: %w", err) - } - - return nil -} - -func sendPromptDirect(id, prompt string) error { - if !isConnected() { - return fmt.Errorf("not connected to anvilsrv") - } path := filepath.Join(id, "in") fid, err := fs.Open(path, plan9.OWRITE) if err != nil { @@ -607,15 +570,8 @@ func handlePromptWindow(w *acme.Win, sess *SessionInfo) { } prompt := strings.TrimSpace(string(body)) if prompt != "" { - var sendErr error - if cmd == "Prompt" { - sendErr = sendPromptDirect(sess.ID, prompt) - } else { - sendErr = sendPrompt(sess.ID, prompt) - } - if sendErr != nil { - fmt.Fprintf(os.Stderr, "Failed to send %s: %v\n", strings.ToLower(cmd), sendErr) - continue + if err := sendPrompt(sess.ID, prompt); err != nil { + fmt.Fprintf(os.Stderr, "Failed to send prompt: %v\n", err) } w.Ctl("delete") return