Commit Graph

441 Commits

Author SHA1 Message Date
Ani Tunturi
59cdb40974 feat: wire up TTS on Discord — 🎤 actually does something now
storeAudioMessage + sendAudio + 🎤 reaction intercept.
Same synthesis path as Matrix, sends audio as file attachment.
2026-03-21 20:43:41 -04:00
Ani Tunturi
983b9541a7 wip: Ani lives here — heartbeat, streaming, images, Matrix patches
Everything that makes her *her*. Threads still broken,
streaming still rough around the edges. But she sees,
she thinks, she speaks. The rest is revision.
2026-03-21 17:43:34 -04:00
Ani Tunturi
f4f1d98655 refactor(display): remove details prepend path, add Matrix reasoning via formatReasoningDisplay
- Remove formatReasoningAsCodeBlock (was experimental, leaked into PR)
- Remove htmlPrefix from OutboundMessage and editMessage signatures
- Add Matrix-specific <details> collapsible to formatReasoningDisplay
- Matrix adapter handles parseMode='HTML' to skip double-escaping
- Reasoning now flows through the standard display path like all adapters
2026-03-17 13:50:01 -04:00
Ani Tunturi
228b9d74c4 fix(bot,matrix): use resolved conversation key for audio storage
Replace hardcoded 'default' conversation ID with convKey in core bot
path and chatId in adapter-internal audio calls. Prevents mapping
inconsistencies in per-chat/per-channel routing.
2026-03-17 13:43:25 -04:00
Ani Tunturi
9af2d2625f fix(letta-api): restore 429 rethrow in rejectApproval
Re-throws rate limit errors so callers bail out early instead of
hammering the API in a tight loop. This was accidentally dropped
during the merge.
2026-03-17 13:43:17 -04:00
Ani Tunturi
e451901ea1 fix(main): scope Olm error handler removal instead of clobbering globals
Surgically removes only the Olm-registered rethrow handler by inspecting
listener source, rather than nuking all process error handlers. Adds a
safety-net logger only when no other handlers remain.

Addresses reviewer feedback: global process.removeAllListeners was
removing handlers registered by other parts of the app/runtime.
2026-03-17 13:43:09 -04:00
Ani Tunturi
7a7393b8c1 merge: incorporate upstream fixes (cancel invalidation, approval dedup, cron logging) 2026-03-16 15:01:27 -04:00
Ani Tunturi
7476f341fd fix(bot): restore upstream inline reasoning display
The <details> htmlPrefix path was an internal experiment that
shouldn't have shipped — it replaced the working per-channel
reasoning display with silent collection and a HTML block that
doesn't render reliably in Element. Restoring the upstream
formatReasoningDisplay so reasoning shows inline as it arrives.
2026-03-16 14:29:25 -04:00
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
Cameron
695c5bc665 fix: deduplicate approval requests across runs (#601) (#602) 2026-03-15 22:45:15 -07:00
Jason Carreira
c50ce657d8 fix(logging): set correct trigger type for cron/heartbeat turns
Set the correct trigger type ('cron' and 'heartbeat') for cron/heartbeat turns instead of defaulting to 'message', and remove the spurious channel property from heartbeat turns.

Written by Cameron ◯ Letta Code

"The measure of intelligence is the ability to change." -- Albert Einstein
2026-03-15 22:22:43 -07:00
Cameron
f04e56d165 fix: kill session subprocess on /cancel to break stuck streams (#600) 2026-03-15 14:37:14 -07: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