Revert "Fix Assist to use mailbox system instead of direct 'in' file writes"

This reverts commit bdd0039eba.
This commit is contained in:
Levi Neely 2026-02-17 14:49:12 +01:00
parent 3f3b5e9f69
commit 8a9ce2c9e1
1 changed files with 2 additions and 46 deletions

View File

@ -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