Commit Graph

430 Commits

Author SHA1 Message Date
Ani
7cd7bd3720 fix(main): restore upstream code accidentally dropped in matrix-adapter commit
The 18010eb commit deleted several upstream features from main.ts:
- resolveSessionMemfs and sleeptime/memfs integration
- parseOptionalBoolean, parseHeartbeatSkipRecentPolicy helpers
- heartbeat skip-recent policy/fraction/interrupt config
- duplicate agent name and turnLogFile validation
- turn log file collection for API server
- logging and blueskyEnabled bot config

Restores all upstream code while preserving our Matrix additions:
parseHeartbeatTarget first-colon fix, MatrixAdapter callback wiring,
heartbeatTargetChatId, sessionModel, API key propagation, Olm crash fix.
2026-03-16 14:02:37 -04:00
Ani
9a972c30a2 fix(matrix): remove hardcoded userId, clean personal references
Replace hardcoded @ani:wiuf.net with this.config.userId in
onMessageSent(). Remove casey-specific comment in key import.

Authored-by: Ani Tunturi <ani@wiuf.net>
2026-03-16 12:11:12 -04:00
Ani
77cf3c2a35 revert(prompts): restore upstream heartbeat prompts, keep targetRoom param
Reverts Ani-specific personalizations (first-person voice, "Casey",
"Cogito ergo sum") from the default heartbeat prompt. These belong
in the user's promptFile, not upstream source.

Adds targetRoom parameter to buildHeartbeatPrompt and
buildCustomHeartbeatPrompt so the agent knows which room to
message into.

Authored-by: Ani Tunturi <ani@wiuf.net>
2026-03-16 11:43:43 -04:00
Ani
aaf27980af refactor(matrix): unify !commands with upstream /commands
Matrix !commands that duplicated upstream bot logic (!new, !status,
!showreasoning, !restore) are removed. !reset, !cancel, !status,
!model, and bare !heartbeat now delegate to the upstream /reset,
/cancel, /status, /model, /heartbeat handlers via onCommand callback.

This fixes !new (now !reset) which only invalidated the session
without clearing the conversation from the store, causing stuck
processes to reconnect to poisoned conversations.

Matrix-specific commands (!pause, !resume, !ignorebot-*, !turns,
!timeout, !heartbeat on/off) remain local since they manage
per-room state with no upstream equivalent.

Authored-by: Ani Tunturi <ani@wiuf.net>
2026-03-16 11:34:38 -04:00
Ani Tunturi
18010eb14f feat: Matrix adapter with E2EE, TTS/STT, reactions, and heartbeat routing
Full Matrix channel integration for LettaBot:

- E2EE via rust crypto (ephemeral mode, cross-signing bootstrap)
- Proactive SAS verification with Element clients
- TTS (VibeVoice) and STT (Faster-Whisper) voice pipeline
- Streaming message edits with 800ms throttle
- Collapsible reasoning blocks via <details> htmlPrefix
- Per-tool emoji reactions (brain, eyes, tool-specific, max 6)
- Heartbeat room conversation routing (heartbeatTargetChatId)
- Custom heartbeat prompt with first-person voice
- Per-room conversation isolation (per-chat mode)
- !pause, !resume, !status, !new, !timeout, !turns commands
- Audio/image/file upload handlers with E2EE media
- SDK 0.1.11 (approval recovery), CLI 0.18.2

Tested against Synapse homeserver with E2EE enabled for 2+ weeks,
handles key backup/restore and device verification.
2026-03-14 21:27:32 -04:00
Cameron
f1f3540005 fix(heartbeat): prioritize user messages over in-flight heartbeats (#594)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-13 14:40:04 -07:00
Cameron
039707387e feat(bluesky): fetch parent thread context for reply posts (#592)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-13 14:17:33 -07:00
Cameron
f5005c33a0 fix(core): resize images before sending to LLM to prevent llm_api_error (#593) 2026-03-13 14:10:05 -07:00
Cameron
68056ed21b fix: clarify stuck approval error message with /reset and consequences (#590)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-12 23:33:23 -07:00
Cameron
25fbd7b9fa fix(cron): prevent cross-agent job leakage from global store migration (#588)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-12 22:53:20 -07:00
Cameron
b0fc98d064 fix(portal): fix JS syntax error that prevented login() from being defined (#587)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-12 22:47:55 -07:00
Cameron
35cff5098f fix(telegram): escape horizontal rules in MarkdownV2 output (#586)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-12 22:43:20 -07:00
Cameron
acfb90e2e5 feat: use SDK recoverPendingApprovals for approval conflict recovery (#585)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-12 22:28:14 -07:00
Cameron
227b986396 fix(skills): persist Railway skill directories across redeploys (#582)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-12 21:55:12 -07:00
Cameron
791e722fca fix: strip <no-reply/> marker in sendToAgent before returning to callers (#584)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-12 21:37:53 -07:00
Cameron
9bd74227d9 fix(bluesky): persist session JWTs and skip retries on rate limits (#583)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-12 21:27:59 -07:00
Cameron
5bed4e78cd fix(recovery): deny orphaned approvals sequentially for parallel tool calls (#580)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-12 18:37:27 -07:00
Cameron
00a0433358 fix(core): parse <actions> blocks anywhere in responses (#579)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-12 17:02:06 -07:00
Cameron
1d636d6fa9 feat(signal): default Signal read receipts to true (#576)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-12 09:10:38 -07:00
Cameron
a6b1a43ec5 fix(logging): record structured abort errors in turn logs (#572)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-11 23:45:27 -07:00
Cameron
6ecd78e294 feat: turn JSONL logging with live web viewer (v2) (#567)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-11 23:24:54 -07:00
Cameron
593b28892c fix: cast vi.fn() mock to satisfy bun-types fetch type (#571) 2026-03-11 20:13:05 -07:00
Cameron
d25da06852 fix: separate reasoning blocks with newline on markdown boundaries (#569) 2026-03-11 18:11:34 -07:00
Cameron
d873f04cc8 fix(help): centralize Telegram help output with shared command text (#566)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-11 17:27:07 -07:00
Cameron
f60b723f4e fix(telegram): simplify command responses and enrich status output (#565)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-11 16:58:38 -07:00
Cameron
fb32a4c3cd fix(discord): route thread messages with per-thread conversations (#564) 2026-03-11 16:54:19 -07:00
Cameron
13426396ac refactor: extract DisplayPipeline from processMessage stream loop (#550)
Extracts a DisplayPipeline async generator that wraps the raw SDK stream
and yields clean DisplayEvent types. Refactors processMessage() to consume
pipeline events instead of raw StreamMsg objects.

- Locks foreground on first substantive event (reasoning/tool_call/etc),
  eliminating buffering delay for real-time display
- Filters pre-foreground error/retry events to prevent false approval recovery
- Re-throws 429 in rejectApproval to prevent rate-limit loops
- Gates reasoning log on display config
- 12 pipeline unit tests + updated integration tests (56 total)
- Net -224 lines from bot.ts

Written by Cameron ◯ Letta Code

"The purpose of abstraction is not to be vague, but to create a new
semantic level in which one can be absolutely precise." -- Edsger Dijkstra
2026-03-11 16:22:26 -07:00
Cameron
dc4204d6f4 fix: default group chat settings and voice transcription to 'no' in o… (#563) 2026-03-11 16:09:30 -07:00
Cameron
6231af560d test(session): cover invalid tool-call mismatch recovery paths (#562)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-11 15:29:24 -07:00
github-actions[bot]
8973e97464 fix(whatsapp): warn when streaming is set in WhatsApp config (#558)
Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com>
Co-authored-by: Cameron <cpfiffer@users.noreply.github.com>
2026-03-11 15:18:52 -07:00
Jason Carreira
e38f5a4db7 fix(session): auto-clear stuck conversation on invalid tool call ID mismatch (#555)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 15:18:02 -07:00
github-actions[bot]
535e5680c3 fix: surface memfs errors in heartbeat with actionable diagnostics (#559)
Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com>
Co-authored-by: Cameron <cameron@pfiffer.org>
2026-03-11 15:10:43 -07:00
github-actions[bot]
0aedc6b4c9 fix: skip reasoning messages in sendToAgent response accumulation (#557)
Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com>
Co-authored-by: Cameron <cpfiffer@users.noreply.github.com>
Co-authored-by: Cameron <cameron@pfiffer.org>
2026-03-11 15:02:19 -07:00
Cameron
08ee846b71 refactor: extract memfs resolution with server-mode awareness (#560) 2026-03-11 14:51:41 -07:00
Cameron
ef1504bd9a fix(discord): gate managed commands and harden attachment fetches (#549)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-10 17:03:37 -07:00
Cameron
ef63efc892 docs: clarify Bluesky notification filtering and reply behavior (#551)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-10 17:02:48 -07:00
Cameron
7f44043962 feat: add Bluesky channel adapter and runtime tooling (supersedes #401) (#486) 2026-03-10 13:59:27 -07:00
Cameron
6e8d1fc19d feat: add core config TUI editor (#522)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-10 11:51:05 -07:00
Cameron
0321558ee6 feat: add config-driven sleeptime support with memfs guard (#534)
Co-authored-by: Letta Code <noreply@letta.com>
Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com>
Co-authored-by: Cameron <cpfiffer@users.noreply.github.com>
2026-03-10 11:51:02 -07:00
Cameron
d3367e8c6a fix: rebind foreground run ID on post-tool-call assistant events (#545) 2026-03-09 23:12:53 -07:00
Cameron
1c9489683f fix: escape accidental Telegram blockquote markers in MarkdownV2 output (#524)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-09 21:48:11 -07:00
Cameron
e8c57ebd9c fix: avoid false italic conversion in Telegram reasoning (#526) 2026-03-09 21:47:48 -07:00
dependabot[bot]
03618faf5b chore(deps): bump @letta-ai/letta-client from 1.7.11 to 1.7.12 (#531)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-09 21:47:37 -07:00
Cameron
15b98758cc Merge pull request #542 from letta-ai/fix/thread-only-per-thread-conversations 2026-03-09 18:47:14 -07:00
Cameron
be60a00057 fix: align commands, batching, reactions, and LRU with forcePerChat
Address review findings from self-review and codex:

- Commands (/reset, /cancel) now receive forcePerChat from the Discord
  adapter and resolve the correct per-thread conversation key
- Group batcher propagates forcePerChat to synthetic batch messages so
  debounced thread messages don't fall back to shared routing
- Reaction handler sets forcePerChat for thread-only reactions
- Session LRU eviction fires regardless of conversationMode so
  forcePerChat sessions don't accumulate without bounds
- Docs now correctly state thread-only overrides shared/per-channel
  modes (not disabled mode)

Written by Cameron ◯ Letta Code

"The best way to predict the future is to implement it." -- David Heinemeier Hansson
2026-03-09 18:40:09 -07:00
Cameron
b79f29d8fa fix(discord): isolate conversations per-thread in thread-only mode
Thread-only mode previously relied on the global conversationMode to
determine whether threads got separate conversations. In shared or
per-channel mode, all threads shared one conversation causing crosstalk.

Add forcePerChat flag on InboundMessage that the Discord adapter sets
when thread-only mode is active. resolveConversationKey treats flagged
messages as per-chat regardless of the configured mode, giving each
thread its own isolated conversation while still sharing agent memory.

Written by Cameron ◯ Letta Code

"Time is an illusion. Lunchtime doubly so." -- Douglas Adams
2026-03-09 18:25:09 -07:00
Cameron
69cd7e5225 fix: recover default-conversation approval deadlocks without conversation reset (#541)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-09 18:15:52 -07:00
Cameron
4d037aca6a feat(discord): add thread-only mode and reduce stream log noise (#538)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-09 17:28:01 -07:00
Cameron
30c74a716c feat(discord): thread-only groups with auto-thread mentions + reaction gating (#540)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-09 16:32:38 -07:00
Cameron
d038c1361a fix: reduce per-event stream log noise and add regression test (#539)
Co-authored-by: Letta Code <noreply@letta.com>
2026-03-09 16:19:11 -07:00