@oh-my-pi/pi-mom 1.337.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +277 -0
- package/README.md +517 -0
- package/dev.sh +30 -0
- package/docker.sh +95 -0
- package/docs/artifacts-server.md +475 -0
- package/docs/events.md +307 -0
- package/docs/new.md +977 -0
- package/docs/sandbox.md +153 -0
- package/docs/slack-bot-minimal-guide.md +399 -0
- package/docs/v86.md +319 -0
- package/package.json +44 -0
- package/scripts/migrate-timestamps.ts +121 -0
- package/src/agent.ts +860 -0
- package/src/context.ts +636 -0
- package/src/download.ts +117 -0
- package/src/events.ts +383 -0
- package/src/log.ts +271 -0
- package/src/main.ts +332 -0
- package/src/sandbox.ts +215 -0
- package/src/slack.ts +623 -0
- package/src/store.ts +234 -0
- package/src/tools/attach.ts +47 -0
- package/src/tools/bash.ts +99 -0
- package/src/tools/edit.ts +165 -0
- package/src/tools/index.ts +19 -0
- package/src/tools/read.ts +165 -0
- package/src/tools/truncate.ts +236 -0
- package/src/tools/write.ts +45 -0
- package/tsconfig.build.json +9 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.31.1] - 2026-01-02
|
|
6
|
+
|
|
7
|
+
## [0.31.0] - 2026-01-02
|
|
8
|
+
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
|
|
11
|
+
- `AgentTool` import moved from `@oh-my-pi/pi-ai` to `@oh-my-pi/pi-agent-core`
|
|
12
|
+
- `AppMessage` type renamed to `AgentMessage`
|
|
13
|
+
- `Attachment` type replaced with `ImageContent` for image handling
|
|
14
|
+
- `MomSessionManager.loadSession()` renamed to `buildSessionContex()`
|
|
15
|
+
- `MomSessionManager.createBranchedSessionFromEntries()` signature changed to `createBranchedSession(leafId)`
|
|
16
|
+
- `ProviderTransport` removed from Agent config, replaced with direct `getApiKey` callback
|
|
17
|
+
- `messageTransformer` renamed to `convertToLlm`
|
|
18
|
+
- `ANTHROPIC_API_KEY`/`ANTHROPIC_OAUTH_TOKEN` no longer checked at startup (deferred to first API call)
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Session entries now include `id` and `parentId` fields for tree structure support
|
|
23
|
+
- Auth lookup now uses `AuthStorage` class instead of direct environment variable access
|
|
24
|
+
- Image attachments use `ImageContent` type with `data` field instead of `Attachment` with `content`
|
|
25
|
+
- `session.prompt()` now uses `images` option instead of `attachments`
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- Support for OAuth login via coding agent's `/login` command (link `~/.pi/agent/auth.json` to `~/.pi/mom/auth.json`)
|
|
30
|
+
|
|
31
|
+
## [0.20.2] - 2025-12-13
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- **Skill paths now use container paths**: Skill file paths in system prompt are translated to container paths (e.g., `/workspace/skills/...`) so mom can read them from inside Docker.
|
|
36
|
+
|
|
37
|
+
## [0.20.1] - 2025-12-13
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
|
|
41
|
+
- **Skills auto-discovery**: Mom now automatically discovers skills from `workspace/skills/` and `channel/skills/` directories. Skills are directories containing a `SKILL.md` file with `name` and `description` in YAML frontmatter. Available skills are listed in the system prompt with their descriptions. Mom reads the `SKILL.md` file before using a skill.
|
|
42
|
+
|
|
43
|
+
## [0.19.2] - 2025-12-12
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
|
|
47
|
+
- Events system: schedule wake-ups via JSON files in `workspace/events/`
|
|
48
|
+
- Immediate events: trigger when file is created (for webhooks, external signals)
|
|
49
|
+
- One-shot events: trigger at specific time (for reminders)
|
|
50
|
+
- Periodic events: trigger on cron schedule (for recurring tasks)
|
|
51
|
+
- `SlackBot.enqueueEvent()` for queueing events (max 5 per channel)
|
|
52
|
+
- `[SILENT]` response marker: deletes status message, posts nothing to Slack (for periodic events with nothing to report)
|
|
53
|
+
- Events documentation in `docs/events.md`
|
|
54
|
+
- System prompt section explaining events to mom
|
|
55
|
+
|
|
56
|
+
## [0.18.8] - 2025-12-12
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
60
|
+
- Timestamp prefix now includes timezone offset (`[YYYY-MM-DD HH:MM:SS+HH:MM]`)
|
|
61
|
+
|
|
62
|
+
## [0.18.7] - 2025-12-12
|
|
63
|
+
|
|
64
|
+
### Added
|
|
65
|
+
|
|
66
|
+
- Timestamp prefix on user messages (`[YYYY-MM-DD HH:MM:SS]`) so mom knows current date/time
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- Sync deduplication now strips timestamp prefix before comparing
|
|
71
|
+
|
|
72
|
+
## [0.18.6] - 2025-12-12
|
|
73
|
+
|
|
74
|
+
### Fixed
|
|
75
|
+
|
|
76
|
+
- Duplicate message in context when message has attachments (sync from log didn't strip attachment section before comparing)
|
|
77
|
+
- Use `<slack_attachments>` delimiter for attachments in messages (easier to parse/strip)
|
|
78
|
+
|
|
79
|
+
## [0.18.5] - 2025-12-12
|
|
80
|
+
|
|
81
|
+
### Added
|
|
82
|
+
|
|
83
|
+
- `--download <channel-id>` flag to download a channel's full history including thread replies as plain text
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
|
|
87
|
+
- Error handling: when agent returns `stopReason: "error"`, main message is updated to "Sorry, something went wrong" and error details are posted to the thread
|
|
88
|
+
|
|
89
|
+
## [0.18.4] - 2025-12-11
|
|
90
|
+
|
|
91
|
+
### Fixed
|
|
92
|
+
|
|
93
|
+
- Attachment downloads now work correctly
|
|
94
|
+
- SlackBot now receives store for processing file downloads
|
|
95
|
+
- Files are downloaded in background and stored in `<channel>/attachments/`
|
|
96
|
+
- Attachment paths passed to agent as absolute paths in execution environment
|
|
97
|
+
- Backfill also downloads attachments from historical messages
|
|
98
|
+
|
|
99
|
+
## [0.18.3] - 2025-12-11
|
|
100
|
+
|
|
101
|
+
### Changed
|
|
102
|
+
|
|
103
|
+
- Complete rewrite of message handling architecture (#115)
|
|
104
|
+
|
|
105
|
+
- Now uses `AgentSession` from coding-agent for session management
|
|
106
|
+
- Brings auto-compaction, overflow handling, and proper prompt caching
|
|
107
|
+
- `log.jsonl` is the source of truth for all channel messages
|
|
108
|
+
- `context.jsonl` stores LLM context (messages sent to Claude, same format as coding-agent)
|
|
109
|
+
- Sync mechanism ensures context.jsonl stays in sync with log.jsonl at run start
|
|
110
|
+
- Session header written immediately on new session creation (not lazily)
|
|
111
|
+
- Tool results preserved in context.jsonl for multi-turn continuity
|
|
112
|
+
|
|
113
|
+
- Backfill improvements
|
|
114
|
+
|
|
115
|
+
- Only backfills channels that already have a `log.jsonl` file
|
|
116
|
+
- Strips @mentions from backfilled messages (consistent with live messages)
|
|
117
|
+
- Uses largest timestamp in log for efficient incremental backfill
|
|
118
|
+
- Fetches DM channels in addition to public/private channels
|
|
119
|
+
|
|
120
|
+
- Message handling improvements
|
|
121
|
+
|
|
122
|
+
- Channel chatter (messages without @mention) logged but doesn't trigger processing
|
|
123
|
+
- Messages sent while mom is busy are logged and synced on next run
|
|
124
|
+
- Pre-startup messages (replayed by Slack on reconnect) logged but not auto-processed
|
|
125
|
+
- Stop command executes immediately (not queued), can interrupt running tasks
|
|
126
|
+
- Channel @mentions no longer double-logged (was firing both app_mention and message events)
|
|
127
|
+
|
|
128
|
+
- Usage summary now includes context window usage
|
|
129
|
+
- Shows current context tokens vs model's context window
|
|
130
|
+
- Example: `Context: 4.2k / 200k (2.1%)`
|
|
131
|
+
|
|
132
|
+
### Fixed
|
|
133
|
+
|
|
134
|
+
- Slack API errors (msg_too_long) no longer crash the process
|
|
135
|
+
|
|
136
|
+
- Added try/catch error handling to all Slack API calls in the message queue
|
|
137
|
+
- Main channel messages truncated at 35K with note to ask for elaboration
|
|
138
|
+
- Thread messages truncated at 20K
|
|
139
|
+
- replaceMessage also truncated at 35K
|
|
140
|
+
|
|
141
|
+
- Private channel messages not being logged
|
|
142
|
+
|
|
143
|
+
- Added `message.groups` to required bot events in README
|
|
144
|
+
- Added `groups:history` and `groups:read` to required scopes in README
|
|
145
|
+
|
|
146
|
+
- Stop command now updates "Stopping..." to "Stopped" instead of posting two messages
|
|
147
|
+
|
|
148
|
+
### Added
|
|
149
|
+
|
|
150
|
+
- Port truncation logic from coding-agent: bash and read tools now use consistent 2000 lines OR 50KB limits with actionable notices
|
|
151
|
+
|
|
152
|
+
## [0.10.2] - 2025-11-27
|
|
153
|
+
|
|
154
|
+
### Breaking Changes
|
|
155
|
+
|
|
156
|
+
- Timestamps now use Slack format (seconds.microseconds) and messages are sorted by `ts` field
|
|
157
|
+
- **Migration required**: Run `npx tsx scripts/migrate-timestamps.ts ./data` to fix existing logs
|
|
158
|
+
- Without migration, message context will be incorrectly ordered
|
|
159
|
+
|
|
160
|
+
### Added
|
|
161
|
+
|
|
162
|
+
- Channel and user ID mappings in system prompt
|
|
163
|
+
- Fetches all channels bot is member of and all workspace users at startup
|
|
164
|
+
- Mom can now reference channels by name and mention users properly
|
|
165
|
+
- Skills documentation in system prompt
|
|
166
|
+
- Explains custom CLI tools pattern with SKILL.md files
|
|
167
|
+
- Encourages mom to create reusable tools for recurring tasks
|
|
168
|
+
- Debug output: writes `last_prompt.txt` to channel directory with full context
|
|
169
|
+
- Bash working directory info in system prompt (/ for Docker, cwd for host)
|
|
170
|
+
- Token-efficient log queries that filter out tool calls/results for summaries
|
|
171
|
+
|
|
172
|
+
### Changed
|
|
173
|
+
|
|
174
|
+
- Turn-based message context instead of raw line count (#68)
|
|
175
|
+
- Groups consecutive bot messages (tool calls/results) as single turn
|
|
176
|
+
- "50 turns" now means ~50 conversation exchanges, not 50 log lines
|
|
177
|
+
- Prevents tool-heavy runs from pushing out conversation context
|
|
178
|
+
- Messages sorted by Slack timestamp before building context
|
|
179
|
+
- Fixes out-of-order issues from async attachment downloads
|
|
180
|
+
- Added monotonic counter for sub-millisecond ordering
|
|
181
|
+
- Condensed system prompt from ~5k to ~2.7k chars
|
|
182
|
+
- More concise workspace layout (tree format)
|
|
183
|
+
- Clearer log query examples (conversation-only vs full details)
|
|
184
|
+
- Removed redundant guidelines section
|
|
185
|
+
- User prompt simplified: removed duplicate "Current message" (already in history)
|
|
186
|
+
- Tool status labels (`_→ label_`) no longer logged to jsonl
|
|
187
|
+
- Thread messages and thinking no longer double-logged
|
|
188
|
+
|
|
189
|
+
### Fixed
|
|
190
|
+
|
|
191
|
+
- Duplicate message logging: removed redundant log from app_mention handler
|
|
192
|
+
- Username obfuscation in thread messages to prevent unwanted pings
|
|
193
|
+
- Handles @username, bare username, and <@USERID> formats
|
|
194
|
+
- Escapes special regex characters in usernames
|
|
195
|
+
|
|
196
|
+
## [0.10.1] - 2025-11-27
|
|
197
|
+
|
|
198
|
+
### Changed
|
|
199
|
+
|
|
200
|
+
- Reduced tool verbosity in main Slack messages (#65)
|
|
201
|
+
- During execution: show tool labels (with → prefix), thinking, and text
|
|
202
|
+
- After completion: replace main message with only final assistant response
|
|
203
|
+
- Full audit trail preserved in thread (tool details, thinking, text)
|
|
204
|
+
- Added promise queue to ensure message updates execute in correct order
|
|
205
|
+
|
|
206
|
+
## [0.10.0] - 2025-11-27
|
|
207
|
+
|
|
208
|
+
### Added
|
|
209
|
+
|
|
210
|
+
- Working memory system with MEMORY.md files
|
|
211
|
+
- Global workspace memory (`workspace/MEMORY.md`) shared across all channels
|
|
212
|
+
- Channel-specific memory (`workspace/<channel>/MEMORY.md`) for per-channel context
|
|
213
|
+
- Automatic memory loading into system prompt on each request
|
|
214
|
+
- Mom can update memory files to remember project details, preferences, and context
|
|
215
|
+
- ISO 8601 date field in log.jsonl for easy date-based grepping
|
|
216
|
+
- Format: `"date":"2025-11-26T10:44:00.123Z"`
|
|
217
|
+
- Enables queries like: `grep '"date":"2025-11-26' log.jsonl`
|
|
218
|
+
- Centralized logging system (`src/log.ts`)
|
|
219
|
+
- Structured, colored console output (green for user messages, yellow for mom activity, dim for details)
|
|
220
|
+
- Consistent format: `[HH:MM:SS] [context] message`
|
|
221
|
+
- Type-safe logging functions for all event types
|
|
222
|
+
- Usage tracking and cost reporting
|
|
223
|
+
- Tracks tokens (input, output, cache read, cache write) and costs per run
|
|
224
|
+
- Displays summary at end of each agent run in console and Slack thread
|
|
225
|
+
- Example: `💰 Usage: 12,543 in + 847 out (5,234 cache read, 127 cache write) = $0.0234`
|
|
226
|
+
- Working indicator in Slack messages
|
|
227
|
+
- Channel messages show "..." while mom is processing
|
|
228
|
+
- Automatically removed when work completes
|
|
229
|
+
- Improved stop command behavior
|
|
230
|
+
- Separate "Stopping..." message that updates to "Stopped" when abort completes
|
|
231
|
+
- Original working message continues to show tool results (including abort errors)
|
|
232
|
+
- Clean separation between status and results
|
|
233
|
+
|
|
234
|
+
### Changed
|
|
235
|
+
|
|
236
|
+
- Enhanced system prompt with clearer directory structure and path examples
|
|
237
|
+
- Improved memory file path documentation to prevent confusion
|
|
238
|
+
- Message history format now includes ISO 8601 date for better searchability
|
|
239
|
+
- System prompt now includes log.jsonl format documentation with grep examples
|
|
240
|
+
- System prompt now includes current date and time for date-aware operations
|
|
241
|
+
- Added efficient log query patterns using jq to prevent context overflow
|
|
242
|
+
- System prompt emphasizes limiting NUMBER of messages (10-50), not truncating message text
|
|
243
|
+
- Log queries now show full message text and attachments for better context
|
|
244
|
+
- Fixed jq patterns to handle null/empty attachments with `(.attachments // [])`
|
|
245
|
+
- Recent messages in system prompt now formatted as TSV (43% token savings vs raw JSONL)
|
|
246
|
+
- Enhanced security documentation with prompt injection risk warnings and mitigations
|
|
247
|
+
- **Moved recent messages from system prompt to user message** for better prompt caching
|
|
248
|
+
- System prompt is now mostly static (only changes when memory files change)
|
|
249
|
+
- Enables Anthropic's prompt caching to work effectively
|
|
250
|
+
- Significantly reduces costs on subsequent requests
|
|
251
|
+
- Switched from Claude Opus 4.5 to Claude Sonnet 4.5 (~40% cost reduction)
|
|
252
|
+
- Tool result display now extracts actual text instead of showing JSON wrapper
|
|
253
|
+
- Slack thread messages now show cleaner tool call formatting with duration and label
|
|
254
|
+
- All console logging centralized and removed from scattered locations
|
|
255
|
+
- Agent run now returns `{ stopReason }` instead of throwing exceptions
|
|
256
|
+
- Clean handling of "aborted", "error", "stop", "length", "toolUse" cases
|
|
257
|
+
- No more error-based control flow
|
|
258
|
+
|
|
259
|
+
### Fixed
|
|
260
|
+
|
|
261
|
+
- jq query patterns now properly handle messages without attachments (no more errors on empty arrays)
|
|
262
|
+
|
|
263
|
+
## [0.9.4] - 2025-11-26
|
|
264
|
+
|
|
265
|
+
### Added
|
|
266
|
+
|
|
267
|
+
- Initial release of Mom Slack bot
|
|
268
|
+
- Slack integration with @mentions and DMs
|
|
269
|
+
- Docker sandbox mode for isolated execution
|
|
270
|
+
- Bash tool with full shell access
|
|
271
|
+
- Read, write, edit file tools
|
|
272
|
+
- Attach tool for sharing files in Slack
|
|
273
|
+
- Thread-based tool details (clean main messages, verbose details in threads)
|
|
274
|
+
- Single accumulated message per agent run
|
|
275
|
+
- Stop command (`@mom stop`) to abort running tasks
|
|
276
|
+
- Persistent workspace per channel with scratchpad directory
|
|
277
|
+
- Streaming console output for monitoring
|