@draht/mom 2026.3.2-2

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +448 -0
  2. package/README.md +490 -0
  3. package/dist/agent.d.ts +24 -0
  4. package/dist/agent.d.ts.map +1 -0
  5. package/dist/agent.js +758 -0
  6. package/dist/agent.js.map +1 -0
  7. package/dist/context.d.ts +70 -0
  8. package/dist/context.d.ts.map +1 -0
  9. package/dist/context.js +221 -0
  10. package/dist/context.js.map +1 -0
  11. package/dist/download.d.ts +2 -0
  12. package/dist/download.d.ts.map +1 -0
  13. package/dist/download.js +89 -0
  14. package/dist/download.js.map +1 -0
  15. package/dist/events.d.ts +57 -0
  16. package/dist/events.d.ts.map +1 -0
  17. package/dist/events.js +310 -0
  18. package/dist/events.js.map +1 -0
  19. package/dist/log.d.ts +39 -0
  20. package/dist/log.d.ts.map +1 -0
  21. package/dist/log.js +222 -0
  22. package/dist/log.js.map +1 -0
  23. package/dist/main.d.ts +3 -0
  24. package/dist/main.d.ts.map +1 -0
  25. package/dist/main.js +271 -0
  26. package/dist/main.js.map +1 -0
  27. package/dist/sandbox.d.ts +34 -0
  28. package/dist/sandbox.d.ts.map +1 -0
  29. package/dist/sandbox.js +183 -0
  30. package/dist/sandbox.js.map +1 -0
  31. package/dist/slack.d.ts +128 -0
  32. package/dist/slack.d.ts.map +1 -0
  33. package/dist/slack.js +455 -0
  34. package/dist/slack.js.map +1 -0
  35. package/dist/store.d.ts +60 -0
  36. package/dist/store.d.ts.map +1 -0
  37. package/dist/store.js +180 -0
  38. package/dist/store.js.map +1 -0
  39. package/dist/tools/attach.d.ts +10 -0
  40. package/dist/tools/attach.d.ts.map +1 -0
  41. package/dist/tools/attach.js +34 -0
  42. package/dist/tools/attach.js.map +1 -0
  43. package/dist/tools/bash.d.ts +10 -0
  44. package/dist/tools/bash.d.ts.map +1 -0
  45. package/dist/tools/bash.js +78 -0
  46. package/dist/tools/bash.js.map +1 -0
  47. package/dist/tools/edit.d.ts +11 -0
  48. package/dist/tools/edit.d.ts.map +1 -0
  49. package/dist/tools/edit.js +131 -0
  50. package/dist/tools/edit.js.map +1 -0
  51. package/dist/tools/index.d.ts +5 -0
  52. package/dist/tools/index.d.ts.map +1 -0
  53. package/dist/tools/index.js +16 -0
  54. package/dist/tools/index.js.map +1 -0
  55. package/dist/tools/read.d.ts +11 -0
  56. package/dist/tools/read.d.ts.map +1 -0
  57. package/dist/tools/read.js +134 -0
  58. package/dist/tools/read.js.map +1 -0
  59. package/dist/tools/truncate.d.ts +57 -0
  60. package/dist/tools/truncate.d.ts.map +1 -0
  61. package/dist/tools/truncate.js +184 -0
  62. package/dist/tools/truncate.js.map +1 -0
  63. package/dist/tools/write.d.ts +10 -0
  64. package/dist/tools/write.d.ts.map +1 -0
  65. package/dist/tools/write.js +33 -0
  66. package/dist/tools/write.js.map +1 -0
  67. package/package.json +54 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,448 @@
1
+ # Changelog
2
+
3
+ ## [2026.3.1] - 2026-02-28
4
+
5
+ ## [0.55.3] - 2026-02-27
6
+
7
+ ## [0.55.2] - 2026-02-27
8
+
9
+ ## [0.55.1] - 2026-02-26
10
+
11
+ ## [0.55.0] - 2026-02-24
12
+
13
+ ## [0.54.2] - 2026-02-23
14
+
15
+ ## [0.54.1] - 2026-02-22
16
+
17
+ ## [0.54.0] - 2026-02-19
18
+
19
+ ## [0.53.1] - 2026-02-19
20
+
21
+ ## [0.53.0] - 2026-02-17
22
+
23
+ ## [0.52.12] - 2026-02-13
24
+
25
+ ## [0.52.11] - 2026-02-13
26
+
27
+ ## [0.52.10] - 2026-02-12
28
+
29
+ ## [0.52.9] - 2026-02-08
30
+
31
+ ## [0.52.8] - 2026-02-07
32
+
33
+ ## [0.52.7] - 2026-02-06
34
+
35
+ ## [0.52.6] - 2026-02-05
36
+
37
+ ## [0.52.5] - 2026-02-05
38
+
39
+ ## [0.52.4] - 2026-02-05
40
+
41
+ ## [0.52.3] - 2026-02-05
42
+
43
+ ## [0.52.2] - 2026-02-05
44
+
45
+ ## [0.52.1] - 2026-02-05
46
+
47
+ ## [0.52.0] - 2026-02-05
48
+
49
+ ## [0.51.6] - 2026-02-04
50
+
51
+ ## [0.51.5] - 2026-02-04
52
+
53
+ ## [0.51.4] - 2026-02-03
54
+
55
+ ## [0.51.3] - 2026-02-03
56
+
57
+ ## [0.51.2] - 2026-02-03
58
+
59
+ ## [0.51.1] - 2026-02-02
60
+
61
+ ## [0.51.0] - 2026-02-01
62
+
63
+ ## [0.50.9] - 2026-02-01
64
+
65
+ ## [0.50.8] - 2026-02-01
66
+
67
+ ## [0.50.7] - 2026-01-31
68
+
69
+ ## [0.50.6] - 2026-01-30
70
+
71
+ ## [0.50.5] - 2026-01-30
72
+
73
+ ## [0.50.3] - 2026-01-29
74
+
75
+ ## [0.50.2] - 2026-01-29
76
+
77
+ ## [0.50.1] - 2026-01-26
78
+
79
+ ## [0.50.0] - 2026-01-26
80
+
81
+ ## [0.49.3] - 2026-01-22
82
+
83
+ ## [0.49.2] - 2026-01-19
84
+
85
+ ## [0.49.1] - 2026-01-18
86
+
87
+ ## [0.49.0] - 2026-01-17
88
+
89
+ ## [0.48.0] - 2026-01-16
90
+
91
+ ## [0.47.0] - 2026-01-16
92
+
93
+ ## [0.46.0] - 2026-01-15
94
+
95
+ ## [0.45.7] - 2026-01-13
96
+
97
+ ## [0.45.6] - 2026-01-13
98
+
99
+ ## [0.45.5] - 2026-01-13
100
+
101
+ ## [0.45.4] - 2026-01-13
102
+
103
+ ## [0.45.3] - 2026-01-13
104
+
105
+ ## [0.45.2] - 2026-01-13
106
+
107
+ ## [0.45.1] - 2026-01-13
108
+
109
+ ## [0.45.0] - 2026-01-13
110
+
111
+ ## [0.44.0] - 2026-01-12
112
+
113
+ ## [0.43.0] - 2026-01-11
114
+
115
+ ## [0.42.5] - 2026-01-11
116
+
117
+ ### Fixed
118
+
119
+ - Use coding-agent's SessionManager instead of custom MomSessionManager to fix API mismatch crash ([#595](https://github.com/badlogic/pi-mono/issues/595))
120
+
121
+ ## [0.42.4] - 2026-01-10
122
+
123
+ ## [0.42.3] - 2026-01-10
124
+
125
+ ## [0.42.2] - 2026-01-10
126
+
127
+ ## [0.42.1] - 2026-01-09
128
+
129
+ ## [0.42.0] - 2026-01-09
130
+
131
+ ## [0.41.0] - 2026-01-09
132
+
133
+ ## [0.40.1] - 2026-01-09
134
+
135
+ ## [0.40.0] - 2026-01-08
136
+
137
+ ## [0.39.1] - 2026-01-08
138
+
139
+ ## [0.39.0] - 2026-01-08
140
+
141
+ ## [0.38.0] - 2026-01-08
142
+
143
+ ## [0.37.8] - 2026-01-07
144
+
145
+ ## [0.37.7] - 2026-01-07
146
+
147
+ ## [0.37.6] - 2026-01-06
148
+
149
+ ## [0.37.5] - 2026-01-06
150
+
151
+ ## [0.37.4] - 2026-01-06
152
+
153
+ ## [0.37.3] - 2026-01-06
154
+
155
+ ## [0.37.2] - 2026-01-05
156
+
157
+ ## [0.37.1] - 2026-01-05
158
+
159
+ ## [0.37.0] - 2026-01-05
160
+
161
+ ## [0.36.0] - 2026-01-05
162
+
163
+ ## [0.35.0] - 2026-01-05
164
+
165
+ ## [0.34.2] - 2026-01-04
166
+
167
+ ## [0.34.1] - 2026-01-04
168
+
169
+ ## [0.34.0] - 2026-01-04
170
+
171
+ ## [0.33.0] - 2026-01-04
172
+
173
+ ## [0.32.3] - 2026-01-03
174
+
175
+ ## [0.32.2] - 2026-01-03
176
+
177
+ ## [0.32.1] - 2026-01-03
178
+
179
+ ## [0.32.0] - 2026-01-03
180
+
181
+ ## [0.31.1] - 2026-01-02
182
+
183
+ ## [0.31.0] - 2026-01-02
184
+
185
+ ### Breaking Changes
186
+
187
+ - `AgentTool` import moved from `@mariozechner/pi-ai` to `@mariozechner/pi-agent-core`
188
+ - `AppMessage` type renamed to `AgentMessage`
189
+ - `Attachment` type replaced with `ImageContent` for image handling
190
+ - `MomSessionManager.loadSession()` renamed to `buildSessionContex()`
191
+ - `MomSessionManager.createBranchedSessionFromEntries()` signature changed to `createBranchedSession(leafId)`
192
+ - `ProviderTransport` removed from Agent config, replaced with direct `getApiKey` callback
193
+ - `messageTransformer` renamed to `convertToLlm`
194
+ - `ANTHROPIC_API_KEY`/`ANTHROPIC_OAUTH_TOKEN` no longer checked at startup (deferred to first API call)
195
+
196
+ ### Changed
197
+
198
+ - Session entries now include `id` and `parentId` fields for tree structure support
199
+ - Auth lookup now uses `AuthStorage` class instead of direct environment variable access
200
+ - Image attachments use `ImageContent` type with `data` field instead of `Attachment` with `content`
201
+ - `session.prompt()` now uses `images` option instead of `attachments`
202
+
203
+ ### Added
204
+
205
+ - Support for OAuth login via coding agent's `/login` command (link `~/.pi/agent/auth.json` to `~/.pi/mom/auth.json`)
206
+
207
+ ## [0.20.2] - 2025-12-13
208
+
209
+ ### Fixed
210
+
211
+ - **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.
212
+
213
+ ## [0.20.1] - 2025-12-13
214
+
215
+ ### Added
216
+
217
+ - **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.
218
+
219
+ ## [0.19.2] - 2025-12-12
220
+
221
+ ### Added
222
+
223
+ - Events system: schedule wake-ups via JSON files in `workspace/events/`
224
+ - Immediate events: trigger when file is created (for webhooks, external signals)
225
+ - One-shot events: trigger at specific time (for reminders)
226
+ - Periodic events: trigger on cron schedule (for recurring tasks)
227
+ - `SlackBot.enqueueEvent()` for queueing events (max 5 per channel)
228
+ - `[SILENT]` response marker: deletes status message, posts nothing to Slack (for periodic events with nothing to report)
229
+ - Events documentation in `docs/events.md`
230
+ - System prompt section explaining events to mom
231
+
232
+ ## [0.18.8] - 2025-12-12
233
+
234
+ ### Changed
235
+
236
+ - Timestamp prefix now includes timezone offset (`[YYYY-MM-DD HH:MM:SS+HH:MM]`)
237
+
238
+ ## [0.18.7] - 2025-12-12
239
+
240
+ ### Added
241
+
242
+ - Timestamp prefix on user messages (`[YYYY-MM-DD HH:MM:SS]`) so mom knows current date/time
243
+
244
+ ### Fixed
245
+
246
+ - Sync deduplication now strips timestamp prefix before comparing
247
+
248
+ ## [0.18.6] - 2025-12-12
249
+
250
+ ### Fixed
251
+
252
+ - Duplicate message in context when message has attachments (sync from log didn't strip attachment section before comparing)
253
+ - Use `<slack_attachments>` delimiter for attachments in messages (easier to parse/strip)
254
+
255
+ ## [0.18.5] - 2025-12-12
256
+
257
+ ### Added
258
+
259
+ - `--download <channel-id>` flag to download a channel's full history including thread replies as plain text
260
+
261
+ ### Fixed
262
+
263
+ - Error handling: when agent returns `stopReason: "error"`, main message is updated to "Sorry, something went wrong" and error details are posted to the thread
264
+
265
+ ## [0.18.4] - 2025-12-11
266
+
267
+ ### Fixed
268
+
269
+ - Attachment downloads now work correctly
270
+ - SlackBot now receives store for processing file downloads
271
+ - Files are downloaded in background and stored in `<channel>/attachments/`
272
+ - Attachment paths passed to agent as absolute paths in execution environment
273
+ - Backfill also downloads attachments from historical messages
274
+
275
+ ## [0.18.3] - 2025-12-11
276
+
277
+ ### Changed
278
+
279
+ - Complete rewrite of message handling architecture (#115)
280
+ - Now uses `AgentSession` from coding-agent for session management
281
+ - Brings auto-compaction, overflow handling, and proper prompt caching
282
+ - `log.jsonl` is the source of truth for all channel messages
283
+ - `context.jsonl` stores LLM context (messages sent to Claude, same format as coding-agent)
284
+ - Sync mechanism ensures context.jsonl stays in sync with log.jsonl at run start
285
+ - Session header written immediately on new session creation (not lazily)
286
+ - Tool results preserved in context.jsonl for multi-turn continuity
287
+
288
+ - Backfill improvements
289
+ - Only backfills channels that already have a `log.jsonl` file
290
+ - Strips @mentions from backfilled messages (consistent with live messages)
291
+ - Uses largest timestamp in log for efficient incremental backfill
292
+ - Fetches DM channels in addition to public/private channels
293
+
294
+ - Message handling improvements
295
+ - Channel chatter (messages without @mention) logged but doesn't trigger processing
296
+ - Messages sent while mom is busy are logged and synced on next run
297
+ - Pre-startup messages (replayed by Slack on reconnect) logged but not auto-processed
298
+ - Stop command executes immediately (not queued), can interrupt running tasks
299
+ - Channel @mentions no longer double-logged (was firing both app_mention and message events)
300
+
301
+ - Usage summary now includes context window usage
302
+ - Shows current context tokens vs model's context window
303
+ - Example: `Context: 4.2k / 200k (2.1%)`
304
+
305
+ ### Fixed
306
+
307
+ - Slack API errors (msg_too_long) no longer crash the process
308
+ - Added try/catch error handling to all Slack API calls in the message queue
309
+ - Main channel messages truncated at 35K with note to ask for elaboration
310
+ - Thread messages truncated at 20K
311
+ - replaceMessage also truncated at 35K
312
+
313
+ - Private channel messages not being logged
314
+ - Added `message.groups` to required bot events in README
315
+ - Added `groups:history` and `groups:read` to required scopes in README
316
+
317
+ - Stop command now updates "Stopping..." to "Stopped" instead of posting two messages
318
+
319
+ ### Added
320
+
321
+ - Port truncation logic from coding-agent: bash and read tools now use consistent 2000 lines OR 50KB limits with actionable notices
322
+
323
+ ## [0.10.2] - 2025-11-27
324
+
325
+ ### Breaking Changes
326
+
327
+ - Timestamps now use Slack format (seconds.microseconds) and messages are sorted by `ts` field
328
+ - **Migration required**: Run `npx tsx scripts/migrate-timestamps.ts ./data` to fix existing logs
329
+ - Without migration, message context will be incorrectly ordered
330
+
331
+ ### Added
332
+
333
+ - Channel and user ID mappings in system prompt
334
+ - Fetches all channels bot is member of and all workspace users at startup
335
+ - Mom can now reference channels by name and mention users properly
336
+ - Skills documentation in system prompt
337
+ - Explains custom CLI tools pattern with SKILL.md files
338
+ - Encourages mom to create reusable tools for recurring tasks
339
+ - Debug output: writes `last_prompt.txt` to channel directory with full context
340
+ - Bash working directory info in system prompt (/ for Docker, cwd for host)
341
+ - Token-efficient log queries that filter out tool calls/results for summaries
342
+
343
+ ### Changed
344
+
345
+ - Turn-based message context instead of raw line count (#68)
346
+ - Groups consecutive bot messages (tool calls/results) as single turn
347
+ - "50 turns" now means ~50 conversation exchanges, not 50 log lines
348
+ - Prevents tool-heavy runs from pushing out conversation context
349
+ - Messages sorted by Slack timestamp before building context
350
+ - Fixes out-of-order issues from async attachment downloads
351
+ - Added monotonic counter for sub-millisecond ordering
352
+ - Condensed system prompt from ~5k to ~2.7k chars
353
+ - More concise workspace layout (tree format)
354
+ - Clearer log query examples (conversation-only vs full details)
355
+ - Removed redundant guidelines section
356
+ - User prompt simplified: removed duplicate "Current message" (already in history)
357
+ - Tool status labels (`_→ label_`) no longer logged to jsonl
358
+ - Thread messages and thinking no longer double-logged
359
+
360
+ ### Fixed
361
+
362
+ - Duplicate message logging: removed redundant log from app_mention handler
363
+ - Username obfuscation in thread messages to prevent unwanted pings
364
+ - Handles @username, bare username, and <@USERID> formats
365
+ - Escapes special regex characters in usernames
366
+
367
+ ## [0.10.1] - 2025-11-27
368
+
369
+ ### Changed
370
+
371
+ - Reduced tool verbosity in main Slack messages (#65)
372
+ - During execution: show tool labels (with → prefix), thinking, and text
373
+ - After completion: replace main message with only final assistant response
374
+ - Full audit trail preserved in thread (tool details, thinking, text)
375
+ - Added promise queue to ensure message updates execute in correct order
376
+
377
+ ## [0.10.0] - 2025-11-27
378
+
379
+ ### Added
380
+
381
+ - Working memory system with MEMORY.md files
382
+ - Global workspace memory (`workspace/MEMORY.md`) shared across all channels
383
+ - Channel-specific memory (`workspace/<channel>/MEMORY.md`) for per-channel context
384
+ - Automatic memory loading into system prompt on each request
385
+ - Mom can update memory files to remember project details, preferences, and context
386
+ - ISO 8601 date field in log.jsonl for easy date-based grepping
387
+ - Format: `"date":"2025-11-26T10:44:00.123Z"`
388
+ - Enables queries like: `grep '"date":"2025-11-26' log.jsonl`
389
+ - Centralized logging system (`src/log.ts`)
390
+ - Structured, colored console output (green for user messages, yellow for mom activity, dim for details)
391
+ - Consistent format: `[HH:MM:SS] [context] message`
392
+ - Type-safe logging functions for all event types
393
+ - Usage tracking and cost reporting
394
+ - Tracks tokens (input, output, cache read, cache write) and costs per run
395
+ - Displays summary at end of each agent run in console and Slack thread
396
+ - Example: `💰 Usage: 12,543 in + 847 out (5,234 cache read, 127 cache write) = $0.0234`
397
+ - Working indicator in Slack messages
398
+ - Channel messages show "..." while mom is processing
399
+ - Automatically removed when work completes
400
+ - Improved stop command behavior
401
+ - Separate "Stopping..." message that updates to "Stopped" when abort completes
402
+ - Original working message continues to show tool results (including abort errors)
403
+ - Clean separation between status and results
404
+
405
+ ### Changed
406
+
407
+ - Enhanced system prompt with clearer directory structure and path examples
408
+ - Improved memory file path documentation to prevent confusion
409
+ - Message history format now includes ISO 8601 date for better searchability
410
+ - System prompt now includes log.jsonl format documentation with grep examples
411
+ - System prompt now includes current date and time for date-aware operations
412
+ - Added efficient log query patterns using jq to prevent context overflow
413
+ - System prompt emphasizes limiting NUMBER of messages (10-50), not truncating message text
414
+ - Log queries now show full message text and attachments for better context
415
+ - Fixed jq patterns to handle null/empty attachments with `(.attachments // [])`
416
+ - Recent messages in system prompt now formatted as TSV (43% token savings vs raw JSONL)
417
+ - Enhanced security documentation with prompt injection risk warnings and mitigations
418
+ - **Moved recent messages from system prompt to user message** for better prompt caching
419
+ - System prompt is now mostly static (only changes when memory files change)
420
+ - Enables Anthropic's prompt caching to work effectively
421
+ - Significantly reduces costs on subsequent requests
422
+ - Switched from Claude Opus 4.5 to Claude Sonnet 4.5 (~40% cost reduction)
423
+ - Tool result display now extracts actual text instead of showing JSON wrapper
424
+ - Slack thread messages now show cleaner tool call formatting with duration and label
425
+ - All console logging centralized and removed from scattered locations
426
+ - Agent run now returns `{ stopReason }` instead of throwing exceptions
427
+ - Clean handling of "aborted", "error", "stop", "length", "toolUse" cases
428
+ - No more error-based control flow
429
+
430
+ ### Fixed
431
+
432
+ - jq query patterns now properly handle messages without attachments (no more errors on empty arrays)
433
+
434
+ ## [0.9.4] - 2025-11-26
435
+
436
+ ### Added
437
+
438
+ - Initial release of Mom Slack bot
439
+ - Slack integration with @mentions and DMs
440
+ - Docker sandbox mode for isolated execution
441
+ - Bash tool with full shell access
442
+ - Read, write, edit file tools
443
+ - Attach tool for sharing files in Slack
444
+ - Thread-based tool details (clean main messages, verbose details in threads)
445
+ - Single accumulated message per agent run
446
+ - Stop command (`@mom stop`) to abort running tasks
447
+ - Persistent workspace per channel with scratchpad directory
448
+ - Streaming console output for monitoring