Skip to content

Commit 396d3da

Browse files
committed
Fix agent buffer input region to be editable
- Set buffer-read-only to nil in efrit-agent-mode, allowing users to type in the input region without needing inhibit-read-only - Add front-sticky property to conversation region to prevent insertion at point-min while still allowing insertion in the input region - The conversation region is still protected by read-only text properties
1 parent d15903c commit 396d3da

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

.beads/issues.jsonl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
{"id":"ef-bxb","title":"Agent hangs: \"Wrong type argument: integer-or-marker-p, nil\" during directory walk","description":"User ran: \"M-x efrit-do with the command: let's look at the code in ~/ai/mayor/rigs/gastown/elisp/ -- first visit all the non-test elisp files\"\n\nResult: Agent appears to hang (still showing \"Working 0.0s\"), with error in *Messages* buffer:\n```\nERROR: API request failed: Wrong type argument: integer-or-marker-p, nil\n```\n\nThe agent never completes the task. Need to debug the directory traversal logic.","acceptance_criteria":"Agent successfully visits all non-test .el files in a given directory when asked to browse them, returns within reasonable time, and displays results without errors","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-12-04T11:33:23.978829-08:00","updated_at":"2025-12-04T14:50:31.554359-08:00","closed_at":"2025-12-04T14:50:31.554359-08:00"}
6060
{"id":"ef-byp","title":"Standardize tool naming between chat and do modes","description":"Inconsistent tool names across modes:\n- buffer_create (do schema) vs create_buffer (chat-tool handling)\n- Chat-only tools (create_buffer, edit_buffer, read_buffer, buffer_info, get_context) not in efrit-do-schema.el\n\nThis makes it hard to reason about \"the set of tools Efrit supports\".\n\nOptions:\n1. Decide on canonical names (prefer existing do schema: buffer_create, buffer_read, etc.)\n2. Add aliases in dispatcher (accept both \"create_buffer\" and \"buffer_create\")\n3. Long-term: derive chat and do schemas from same source\n\nStart with option 2 - add aliases without breaking existing code.\n\nFiles affected:\n- lisp/interfaces/efrit-do.el (dispatch table)\n- lisp/core/efrit-do-schema.el (add any missing tools)\n- lisp/core/efrit-chat-api.el (tool handling)","acceptance_criteria":"1. Documented canonical tool naming convention\n2. Both old and new names work via aliases\n3. No behavior change for existing users","status":"closed","priority":3,"issue_type":"task","created_at":"2025-12-02T21:58:07.25901-08:00","updated_at":"2025-12-02T23:27:02.989309-08:00","closed_at":"2025-12-02T23:27:02.989309-08:00"}
6161
{"id":"ef-c2r","title":"Add session lifecycle: pause/resume/reset","description":"Implement session lifecycle commands:\n\n- efrit-repl-pause: Interrupt gracefully, preserve state\n- efrit-repl-resume: Continue from where we left off\n- efrit-repl-reset: Clear conversation, start fresh in same buffer\n- efrit-repl-new: Create new named session\n\nKeybindings in agent-mode:\n- C-c C-k: pause\n- C-c C-r: resume\n- C-c C-n: new session","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-05T14:29:22.425691-08:00","updated_at":"2025-12-05T14:55:29.783104-08:00","closed_at":"2025-12-05T14:55:29.783104-08:00","dependencies":[{"issue_id":"ef-c2r","depends_on_id":"ef-j59","type":"blocks","created_at":"2025-12-05T14:29:31.11069-08:00","created_by":"daemon"}]}
62-
{"id":"ef-c3e","title":"Enhancement: Add non-interactive mode for web_search","description":"Currently web_search requires interactive confirmation via y-or-n-p, which fails in batch mode with \"End of file during parsing\".\n\nAdd a customizable variable like efrit-web-search-auto-approve or check noninteractive to auto-approve in batch/daemon mode.","status":"in_progress","priority":3,"issue_type":"feature","created_at":"2025-12-05T16:11:38.702086-08:00","updated_at":"2025-12-05T16:35:35.475352-08:00"}
62+
{"id":"ef-c3e","title":"Enhancement: Add non-interactive mode for web_search","description":"Currently web_search requires interactive confirmation via y-or-n-p, which fails in batch mode with \"End of file during parsing\".\n\nAdd a customizable variable like efrit-web-search-auto-approve or check noninteractive to auto-approve in batch/daemon mode.","status":"closed","priority":3,"issue_type":"feature","created_at":"2025-12-05T16:11:38.702086-08:00","updated_at":"2025-12-05T16:36:18.116386-08:00","closed_at":"2025-12-05T16:36:18.116386-08:00"}
6363
{"id":"ef-cjg","title":"Missing hook definitions for agent buffer integration","description":"The efrit-agent-integration.el module references hooks like `efrit-progress-tool-start-hook` and `efrit-progress-tool-end-hook` to integrate with the agent buffer, but these hooks are never defined. This means the agent buffer won't receive updates when tools start/end execution.\n\nHooks referenced but not defined:\n- efrit-progress-tool-start-hook\n- efrit-progress-tool-end-hook\n\nImpact: Agent buffer won't display tool execution in real-time, breaking the interactive agentic mode experience.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-12-03T17:25:57.241594-08:00","updated_at":"2025-12-03T17:26:49.476805-08:00","closed_at":"2025-12-03T17:26:49.476805-08:00"}
6464
{"id":"ef-csd","title":"Tool call progress display","description":"Show tool calls with clear progress:\n\nBefore:\n```\n[edit_file] (completed)\n```\n\nAfter:\n```\n→ edit_file: src/auth.js\n Editing lines 42-45...\n ✓ Done (3 lines changed)\n```\n\nStates: pending → running → success/error\nShow tool name, target, progress, result","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-05T14:30:03.093529-08:00","updated_at":"2025-12-05T15:30:31.744774-08:00","closed_at":"2025-12-05T15:30:31.744774-08:00","dependencies":[{"issue_id":"ef-csd","depends_on_id":"ef-9cv","type":"blocks","created_at":"2025-12-05T14:41:06.107561-08:00","created_by":"daemon"}]}
6565
{"id":"ef-d57","title":"Feature: Add Mermaid diagram rendering tool","description":"Amp can render Mermaid diagrams to visualize:\n- System architecture\n- Component relationships\n- Workflows and data flows\n- State machines\n\nCould add a tool that renders Mermaid to an image and displays it in Emacs (via image-mode or similar).","status":"open","priority":3,"issue_type":"feature","created_at":"2025-12-05T16:10:41.477367-08:00","updated_at":"2025-12-05T16:10:41.477367-08:00"}

lisp/interfaces/efrit-agent-core.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ Should be called after `efrit-agent--init-regions' when the buffer is empty."
294294
;; Set markers at the saved positions (after all inserts to avoid insertion-type issues)
295295
(set-marker efrit-agent--conversation-end conversation-end-pos)
296296
(set-marker efrit-agent--input-start input-start-pos)
297-
;; Make conversation region read-only
297+
;; Make conversation region read-only (front-sticky prevents insertion at point-min)
298298
(add-text-properties (point-min) efrit-agent--conversation-end
299-
'(read-only t))))
299+
'(read-only t front-sticky (read-only)))))
300300

301301
(defun efrit-agent--append-to-conversation (text &optional properties)
302302
"Append TEXT with optional PROPERTIES to the conversation region.

lisp/interfaces/efrit-agent.el

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ Status is shown in the header-line at top of window.
293293
(setq-local line-spacing 0.1)
294294
;; Don't let cursor jump around during updates
295295
(setq-local cursor-in-non-selected-windows nil)
296+
;; Allow editing input region (conversation is protected by text properties)
297+
;; This overrides special-mode's buffer-read-only setting
298+
(setq-local buffer-read-only nil)
296299
;; Initialize state
297300
(setq efrit-agent--expanded-items (make-hash-table :test 'equal))
298301
;; Initialize user expansion state tracking (persists across buffer updates)

0 commit comments

Comments
 (0)