Commit Graph

71 Commits

Author SHA1 Message Date
Levi Neely 065e4a3295
Add bulk-archive via inline Put notation to inbox and archive windows (#12)
* Add inline Put actions for sessions and tasks windows

Introduce a Put command to both the sessions list and tasks windows,
allowing inline edits via prefixed annotations in the body:

Sessions (cmd/Assist/main.go):
  - `- <id>`              Kill session
  - `~ <id>`              Stop session (graceful)
  - `@ <id> <alias>`      Set alias on session
  - `+ <backend> <path> [alias]`  Start new session

Tasks (cmd/Assist/main.go + internal/p9/beads.go):
  - `- [idx]`   Delete bead
  - `~ [idx]`   Claim bead as user
  - `^ [idx]`   Unclaim bead (clear assignee, reset to open)
  - `x [idx]`   Complete bead
  - `f [idx]`   Fail bead
  - `+ <title>` Create new bead with title pre-filled

Also adds `unclaim` ctl command to BeadsFS and helper functions:
claimBeadAsUser, unclaimBead, completeBead, failBead,
openNewBeadWindowWithTitle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add [Failed] [PendingReview] [PendingApproval] filters to tasks window

Extends the tasks window filter bar with three new status filters:

- [Failed]          closed beads whose close_reason != "completed"
- [PendingReview]   beads with status "pending_review"
- [PendingApproval] beads with status "pending_approval"

Implementation details:
- Add CloseReason field (json:"close_reason") to Bead struct so
  fail-vs-complete distinction is available after JSON decode.
- listBeadsWithFilter: add "failed" special case (closed beads with
  non-"completed" close_reason); "pending_review" and
  "pending_approval" fall through the existing status equality path.
- handleTasksWindow: wire Failed/PendingReview/PendingApproval cases
  to set statusFilter and refresh the list.
- refreshTasksWindowWithBeads: update filter bar header line.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add bulk-archive via inline Put notation to inbox and archive windows

In the inbox window, lines prefixed with "- <shortID>" are parsed on Put
and each matching message is archived (moved to completed). In the archive
window the same notation permanently deletes the message from the archive.

Adds: parseMailEdits, mailEdit type, deleteArchivedMessage in Assist;
DeleteFromCompleted in mailbox.Manager; "delete <msg-id>" command on
user/ctl in the p9 server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Levi Neely <lkn@darkstar.example.net>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:58:37 +01:00
Levi Neely 5bba76d2b9 hotfixes, msg trace diagram generator 2026-02-23 12:20:46 +01:00
Levi Neely 45e495a975
Add requires_approval and requires_review flags to bead UI across all frontends (#10)
Implements bd-258: display and toggle of requires_approval / requires_review
boolean flags in all four AnviLLM frontends. Flags are backed by labels
(requires_approval, requires_review) on each bead, read from the labels
array in bead JSON and toggled via label/unlabel ctl commands.

- Acme: adds Labels/HasLabel to Bead struct; shows flags in frontmatter;
  updateBead parses and applies label/unlabel on Put
- TUI: showBead displays flags (green when set); edit dialog adds two
  checkboxes that toggle labels on save
- Web: detail view shows flag status with Set/Unset buttons; new
  toggleBeadFlag() function calls beads ctl API and refreshes
- Emacs: detail buffer shows flag lines; A/R keybindings invoke new
  anvillm-bead-toggle-approval and anvillm-bead-toggle-review commands

Co-authored-by: Levi Neely <lkn@darkstar.example.net>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 18:13:12 +01:00
Levi Neely db501cca26
Add approval/rejection flags and actions to tasks UI (#9)
* Add approval/rejection flags and actions to tasks UI

Adds visual flags for APPROVAL_REQUEST and REVIEW_REQUEST messages across
all UI frontends (Acme, TUI, web, Emacs), with one-click approve/reject
actions and inferred reply type mapping.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Auto-archive messages on approve or reject across all UIs

After an approval or rejection response is sent, the original inbox
message is now automatically completed/archived in all four frontends:

- Acme: handleReplyWindow gains an originalMsgID param; approve/reject
  windows pass the message ID so the original is archived on Send
- TUI: already archived via completeInboxMessage in approveMessage /
  rejectMessage — no change needed
- Web: approveCurrentMessage archives after reply succeeds; rejectCurrent-
  Message sets pendingArchiveId so the reply-form submit handler archives
  on send
- Emacs: anvillm-inbox-approve and anvillm-inbox-reject write "complete
  <id>" to user/ctl and refresh the inbox after sending the response

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Levi Neely <lkn@darkstar.example.net>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:38:23 +01:00
Levi Neely e1489a39fb fix: handle null sessions case in anvilwebgw
Initialize sessions slice as empty array instead of nil to ensure
JSON encoding returns [] instead of null when no sessions exist.
This prevents JavaScript iteration errors in the web frontend.
2026-02-22 11:14:57 +01:00
Levi Neely e9c78b11e0
Merge pull request #1 from lneely/anvilwebgw
Add anvilwebgw HTTP gateway service
2026-02-22 09:42:50 +01:00
Levi Neely 407b3732af Replace event queue with in-memory pub-sub event bus
Replaces the TTL-based event queue (internal/events) with a proper
in-memory pub-sub bus (internal/eventbus) backed by simonfxr/pubsub.

The agent/events 9P endpoint is now a streaming subscriber: clients
block on reads and receive one JSON-encoded event per read until they
disconnect. Each open(2) creates a per-connection subscription; clunk
and connection teardown cancel it automatically.

- internal/eventbus/bus.go: new package wrapping simonfxr/pubsub;
  provides Publish(agent, type, data) and Subscribe() -> (chan, cancel)
- internal/events/events.go: deleted
- internal/session/manager.go: SetEventQueue -> SetEventBus; all
  publish sites updated to use eventbus constants
- internal/p9/server.go: fid gains eventCh/eventUnsub fields; Topen
  subscribes, Tread blocks on channel, Tclunk/serve-defer cancel
- cmd/anvilsrv/main.go: wired to SetEventBus

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 09:38:14 +01:00
Levi Neely a28cf13cae Add anvilwebgw HTTP gateway service, simplify anvilweb
- New cmd/anvilwebgw: standalone HTTP gateway daemon with start/stop/fgstart/status
  subcommands, exposing all 9P-connected API endpoints on :8081
- cmd/anvilweb simplified to a plain static file server that reverse-proxies
  /api/* to anvilwebgw; removes all 9P connectivity
- Frontend error handling overhauled: replace alert() with styled dismissible
  error banner and inline container errors showing actual server response detail
- Fix CSS specificity bug that kept error banner always visible
- Fix nil slice JSON encoding (null vs []) for empty inbox/archive responses
- mkfile: add anvilwebgw build and clean targets

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 09:01:23 +01:00
Levi Neely 9d0e9b7e42 Add ollama backend support
- Add ollama backend implementation using mcphost and ollie
- Add ollama.yaml sandbox configuration
- Update README with ollama installation and usage instructions
- Add ollama command to Assist, anvilmcp, and anvilsrv
- Add ANVILLM_OLLAMA_MODEL environment variable
- Hardcode ollama-mcp.json config path to ~/.config/anvillm/ollama-mcp.json
2026-02-21 21:03:55 +01:00
Levi Neely 5a212793c3 ui parity 2026-02-21 13:57:05 +01:00
Levi Neely dd6528bfee fix 2026-02-21 10:35:45 +01:00
Levi Neely 4257e6595d fix 2026-02-21 10:33:06 +01:00
Levi Neely 1aa3010200 Add status filter buttons to Tasks window
- Filter out closed tasks by default
- Add [Open] [InProgress] [Closed] filter buttons
- Maintain filter state during window session
- Position window at top after refresh
2026-02-21 10:31:20 +01:00
Levi Neely c6987a7962 Remove deprecated audit endpoint
- Remove audit endpoint routes from 9P filesystem
- Delete audit handler functions (readAuditLog, GetAuditLog)
- Remove audit package and all audit logging code
- Remove audit log viewer from TUI (anvillm)
- Remove audit log streaming from web UI (anvilweb)
- Update documentation to reference events system instead
- All audit functionality replaced by events system
2026-02-20 22:18:53 +01:00
Levi Neely 6a8bad003f remove beads thin wrapper, github-to-beads 2026-02-20 21:24:06 +01:00
Levi Neely bf8c0d7cdb improve bead id special case "fire-forget" prompt 2026-02-20 19:05:06 +01:00
Levi Neely 5854f95f9b Assist: Add Tasks window for beads task management
- Tasks window with sorted list, blocker count column, index for navigation
- View window with frontmatter (title, status, blockers), Put saves changes
- New window with blockers field for setting deps on create
- Hierarchical subtask IDs (bd-s2r.1) via parent-id parameter
- Blocks tag for quick dependency add via selection
- Remove tag for deleting beads via chord
- beads/ctl commands: new, update, delete, dep, undep
- beads/{id}/json includes blockers array
- Fixed parseQuotedArgs to preserve empty quoted strings
- Fixed escape sequence handling in descriptions
2026-02-20 10:13:53 +01:00
Levi Neely 9ebd239a95 Add beads task tracking integration via 9P filesystem
- Add beads dependency (steveyegge/beads)
- Create internal/beads/beads.go: Storage wrapper for beads operations
- Create internal/p9/beads.go: 9P filesystem handlers for beads
- Integrate beads into 9P server (shared across all namespaces)
- Add beads directory to 9P filesystem: /agent/beads/
- Support commands: init, new, claim, complete, fail, dep
- Add ANVILLM_BEADS_PATH env var for custom beads location
- Update IDEAS.md with multi-tracker import design (Jira, GitHub, GitLab, Linear)
- Beads provides persistent, crash-resilient task tracking for multi-agent workflows
2026-02-19 23:08:50 +01:00
Levi Neely 65be761262 Fix event system: wire state changes to OnStateChange and fix /events 9p read
- Wire all state changes in tmux session to use transitionToLocked (triggers OnStateChange)
  - Close() exited state
  - Refresh() stopped states (intentional stop, restart spam prevention, auto-restart failure, PID=0)
- Add event callbacks to mailbox manager for send/receive events
  - Callbacks fire when message removed from outbox (send) and delivered to inbox (receive)
  - Consistent with state change callback pattern
- Fix /events 9p read handler to respect offset/count
  - Prevents infinite read loop by properly signaling EOF
  - Uses readFile() pattern like /list for consistency
2026-02-19 20:18:55 +01:00
Levi Neely b2502b3f5a Inbox/Archive: session ID arg, short UUID display, timestamp column, sort by date 2026-02-19 16:54:18 +01:00
Levi Neely d3f1d67547 Add Archive window, UUID-based message lookup, fix backend column in list 2026-02-19 16:39:43 +01:00
Levi Neely 840453f2cc Format read_inbox output like 9p-read-inbox
- Parse JSON and format as: [Message from X] / Type / Subject / Body
- Makes it clear who the sender is for replying
- Matches original 9p-read-inbox behavior
2026-02-18 22:14:01 +01:00
Levi Neely 1139172a7e Return actual error messages from 9p commands
- Capture stderr/stdout from 9p write failures
- Return helpful error messages (e.g., list of valid message types)
- Allows agents to retry with correct values
2026-02-18 22:03:50 +01:00
Levi Neely 3f5c4da1e7 Make read_inbox auto-complete messages like 9p-read-inbox
- Read only first message (not all messages)
- Automatically mark message as complete after reading
- Matches behavior of original 9p-read-inbox script
2026-02-18 21:56:08 +01:00
Levi Neely 199595416f Handle notifications/initialized properly
- Don't return error for notification methods
- Notifications don't expect responses per JSON-RPC spec
2026-02-18 21:43:30 +01:00
Levi Neely 19fb829d4e Add stdout flush for MCP protocol reliability
- Flush stdout after each JSON-RPC response
- Ensures responses are immediately available to MCP clients
2026-02-18 21:42:32 +01:00
Levi Neely f6a3de17ae Add set_state tool to anvilmcp
- Allows setting agent state via MCP (idle, running, stopped, etc.)
- Validates state values via enum in schema
- Enables agent hooks to update their own state
2026-02-18 19:54:36 +01:00
Levi Neely b0c069bfa4 Add anvilmcp: MCP server for 9p agent communication
- Implements MCP protocol server that translates to 9p operations
- Three tools: read_inbox, send_message, list_sessions
- Uses plan9port 9p client for filesystem operations
- Debug logging to stderr, JSON-RPC on stdout
- Enables MCP clients to interact with anvilsrv daemon
2026-02-18 19:52:37 +01:00
Levi Neely 4b87a7795f Assist: reuse existing terminal for tmux attach
- Check for existing tmux clients before launching new terminal
- Use 'tmux switch-client' to reuse existing terminal window
- Fall back to new terminal only when no client is attached
2026-02-18 16:31:21 +01:00
Levi Neely b8013b1b87 Assist: middle-click session ID attaches to tmux
- Middle-click on session ID without selection now attaches to tmux session
- Preserves existing fire-and-forget prompt behavior when text is selected
- Same functionality as 'Attach {session-id}' command
2026-02-18 16:26:21 +01:00
Levi Neely 937ad83e97 Remove deprecated endpoints and fix mailbox auto-completion
- Fix PROMPT_RESPONSE messages not auto-completing
- Remove deprecated message types (LogInfo, LogError, StatusUpdate)
- Remove entire chat log system (replaced by audit log)
- Migrate user prompts to mailbox system in main.go
- Remove {id}/in and {id}/out 9P endpoints
- Only mail processor uses sess.Send() directly
- Fix file index constants after removing in/out files
- Remove unused SendCtl function
2026-02-17 23:06:07 +01:00
Levi Neely b199fb23dc Remove Sandbox configuration window from Assist
- Remove Sandbox button from main window tag
- Remove Sandbox case handler and related functions
- Remove sandbox package import
- Delete internal/ui/sandbox.go

The Sandbox window is no longer needed as sandbox configuration
has been split into layered configuration (global, backends, roles, tools).
2026-02-17 22:18:02 +01:00
Levi Neely 314d347e76 Add centralized audit log system
- Created internal/audit package for centralized logging
- Replaced per-session log files with single agent/audit file
- Updated all UIs (TUI, web, Emacs) to use centralized audit log
- Modified mailbox manager to log all message deliveries with aliases
- Updated Alog script to stream centralized audit log
- Removed session-specific log streaming in favor of global audit log
2026-02-17 22:07:39 +01:00
Levi Neely ff2bd372c1 improve send message api 2026-02-17 18:20:01 +01:00
Levi Neely a069a98ccc Add Archive button to Acme inbox message windows
- Added Archive to message window tag line
- Archive writes 'complete <msg-id>' to user/ctl
- Window closes after successful archive
- Added ID field to Message struct
- Added error handling for archive failures
2026-02-17 17:28:52 +01:00
Levi Neely 53bf135d01 Add dynamic inbox refresh to anvilweb
- Inbox badge updates every 5 seconds automatically
- Messages view auto-refreshes every 5 seconds when inbox tab is visible
- Archive buttons trigger immediate inbox refresh
- Fixed backend to return empty array instead of null for empty inbox
- Added user/ctl endpoint for completing messages
2026-02-17 17:19:53 +01:00
Levi Neely d35e884a54 Add Reply functionality to inbox message windows 2026-02-17 16:37:04 +01:00
Levi Neely 45356673ec Update mailbox message types and validation 2026-02-17 16:32:20 +01:00
Levi Neely b66e9822a2 Fix attach for new tmux session naming and clean up emacs prompts
Front-ends were constructing anvillm-{backend} but backend now uses
anvillm-{namespace}. Updated Assist and emacs to read tmux target from
the tmux file instead of constructing it from backend name.

Also removed broken direct prompt functionality from emacs (P and M-P
keybindings that used /in file directly).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 15:32:48 +01:00
Levi Neely a856da7a34 Remove Prompt command, use only Send via outbox 2026-02-17 14:52:08 +01:00
Levi Neely 27f6a48411 Reapply "Fix Assist to use mailbox system instead of direct 'in' file writes"
This reverts commit 8a9ce2c9e1.
2026-02-17 14:50:10 +01:00
Levi Neely 8a9ce2c9e1 Revert "Fix Assist to use mailbox system instead of direct 'in' file writes"
This reverts commit bdd0039eba.
2026-02-17 14:49:12 +01:00
Levi Neely 35b3ff338e Fix 9p-read-inbox to strip .json extension when marking messages complete 2026-02-17 14:37:46 +01:00
Levi Neely 241e4b9818 Fix all UIs to use mailbox system for prompt sending
- cmd/anvillm: Added sendPrompt() using user/outbox
- cmd/anvilweb: Updated sendPrompt() to write to user/outbox
- elisp/anvillm.el: Changed to write JSON messages to user/outbox
- All UIs now queue prompts non-blocking via mailbox system
- Resolves blocking issue across all interfaces
2026-02-17 11:10:14 +01:00
Levi Neely bdd0039eba Fix Assist to use mailbox system instead of direct 'in' file writes
- Changed sendPrompt() to write JSON messages to user/outbox
- Messages now queue and deliver when session is idle (non-blocking)
- Fixed prompt window to stay open on send error
- Resolves blocking issue when bot is busy
2026-02-17 11:03:28 +01:00
Levi Neely 71605283ea Fix Assist to log sendPrompt errors instead of silently ignoring them 2026-02-17 10:47:06 +01:00
Levi Neely c1b3f525da anvilweb: fix attach button, improve UI
- Fix Attach button to launch foot terminal with tmux attach
- Add tmux file to 9P server to expose session:window target
- Replace action buttons with cleaner layout: main actions visible,
  secondary actions in dropdown menu
- Add browser notifications for session state changes
- Preserve open dropdown menu across table refresh
- Remove disabled state from Prompt button (mailbox queues prompts)
2026-02-16 16:41:58 +01:00
Levi Neely 8fe92c1182 Fix uneven columns in Assist main window
Change ID column width from 5 to 8 chars to match session ID length.
2026-02-16 14:46:48 +01:00
Levi Neely 37f38aa6d6 anvilweb: sortable data columns 2026-02-16 09:36:51 +01:00
Levi Neely 851ac311b0 remove acme log window in favor of external script 2026-02-15 13:22:12 +01:00