mom: add working indicator and improve stop command

Working Indicator:
- Add '...' to channel messages while mom is processing
- Automatically removed when work completes or stops
- Applies to working message, not status messages

Improved Stop Command:
- Posts separate 'Stopping...' message that updates to 'Stopped'
- Original working message continues updating with tool results
- Clean separation between status and work output
- Properly handles abort during multi-step operations

Clean Stop Reason Handling:
- Agent run() now returns { stopReason } instead of throwing
- Handle 'aborted', 'error', 'stop', 'length', 'toolUse' cases cleanly
- No more exception-based control flow
- Track stopReason from assistant message.stopReason field

New SlackContext Methods:
- replaceMessage() - replace message text instead of appending
- setWorking() - add/remove working indicator
- Improved context tracking for stop command updates
This commit is contained in:
Mario Zechner 2025-11-26 20:49:02 +01:00
parent bfe7df6a49
commit 0c6c0f34dd
4 changed files with 104 additions and 23 deletions

View file

@ -20,6 +20,13 @@
- Tracks tokens (input, output, cache read, cache write) and costs per run
- Displays summary at end of each agent run in console and Slack thread
- Example: `💰 Usage: 12,543 in + 847 out (5,234 cache read, 127 cache write) = $0.0234`
- Working indicator in Slack messages
- Channel messages show "..." while mom is processing
- Automatically removed when work completes
- Improved stop command behavior
- Separate "Stopping..." message that updates to "Stopped" when abort completes
- Original working message continues to show tool results (including abort errors)
- Clean separation between status and results
### Changed
@ -42,6 +49,9 @@
- Tool result display now extracts actual text instead of showing JSON wrapper
- Slack thread messages now show cleaner tool call formatting with duration and label
- All console logging centralized and removed from scattered locations
- Agent run now returns `{ stopReason }` instead of throwing exceptions
- Clean handling of "aborted", "error", "stop", "length", "toolUse" cases
- No more error-based control flow
### Fixed