Commit Graph

379 Commits

Author SHA1 Message Date
Peter Steinberger
ad5c87c193 fix: relax slash command parsing 2026-01-08 03:24:18 +01:00
Lutro
36b443f4f3 Telegram: fix /think command to show current level when no arg 2026-01-08 03:24:18 +01:00
Peter Steinberger
a450390f7c refactor: share reply payload threading/dedupe 2026-01-08 01:09:23 +00:00
Peter Steinberger
05b8679c8b feat: add providers CLI and multi-account onboarding 2026-01-08 01:55:59 +01:00
Peter Steinberger
17d052bcda fix: polish reply threading + tool dedupe (thanks @mneves75) (#326) 2026-01-08 00:50:47 +00:00
mneves75
33e2d53be3 feat(telegram): wire replyToMode config, add forum topic support, fix messaging tool duplicates
Changes:
- Default replyToMode from "off" to "first" for better threading UX
- Add messageThreadId and replyToMessageId params for forum topic support
- Add messaging tool duplicate detection to suppress redundant block replies
- Add sendMessage action to telegram tool schema
- Add @grammyjs/types devDependency for proper TypeScript typing
- Remove @ts-nocheck and fix all type errors in send.ts
- Add comprehensive docs/telegram.md documentation
- Add PR-326-REVIEW.md with John Carmack-level code review

Test coverage:
- normalizeTextForComparison: 5 cases
- isMessagingToolDuplicate: 7 cases
- sendMessageTelegram thread params: 5 cases
- handleTelegramAction sendMessage: 4 cases
- Forum topic isolation: 4 cases

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 00:50:47 +00:00
Peter Steinberger
b2de667b11 fix: persist topic session files 2026-01-07 22:56:50 +00:00
hsrvc
8da4f259dd Implement Phase 2: Topic-level message history isolation for multi-topic Telegram support
Add topic-specific session file isolation to fix root cause of Gemini turn validation errors.
Each Telegram topic now maintains its own conversation history file, eliminating race
conditions and message corruption during concurrent topic processing.

Changes:
1. Enhanced resolveSessionTranscriptPath() to support optional topicId parameter
   - Topic ID (Telegram messageThreadId) now incorporated into session filename
   - Format: sessionId.jsonl (direct chats) vs sessionId-topic-{topicId}.jsonl (topics)
   - Backward compatible: topicId is optional

2. Updated reply.ts to pass MessageThreadId to session file resolution
   - ctx.MessageThreadId now flows through to resolveSessionTranscriptPath()
   - Automatically provides topic context for each incoming message

3. Automatic propagation through entire system
   - sessionFile parameter automatically carries topic-specific path through:
     - FollowupRun object (queued runs)
     - runEmbeddedPiAgent() calls
     - compactEmbeddedPiSession() calls
     - SessionManager lifecycle (load, read, write operations)

Benefits:
✓ Complete elimination of shared .jsonl race conditions
✓ Each topic's conversation history independently cached
✓ SessionManager instances operate on isolated files
✓ No concurrent mutations of the same message history
✓ Maintains full Phase 1 turn validation as safety layer

Testing:
✓ Build succeeds with no TypeScript errors
✓ Backward compatible with non-topic sessions (direct messages)
✓ Topic ID properly extracted from Telegram messageThreadId

Expected impact:
- Gemini "function call turn" errors eliminated (root cause fixed)
- Message history corruption prevented across all topics
- Improved stability in multi-topic scenarios
- Each topic maintains independent conversation state

This completes the two-phase fix:
- Phase 1 (previous): Turn validation to suppress errors
- Phase 2 (current): Topic isolation to fix root cause

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-07 22:51:26 +00:00
Peter Steinberger
434c25331e refactor: centralize typing mode signals 2026-01-07 22:18:11 +00:00
Peter Steinberger
bac1608933 feat: add typing mode controls 2026-01-07 21:58:54 +00:00
Peter Steinberger
7ce1f635cd fix(commands): harden model alias parsing 2026-01-07 20:41:41 +00:00
Azade
bb29a3ee3f fix: filter reserved commands from model aliases + add tests 2026-01-07 20:41:41 +00:00
Azade
e41540e4ff feat(commands): add dynamic /<alias> model switching 2026-01-07 20:41:41 +00:00
Peter Steinberger
cb9f8146c4 refactor: centralize thread helpers 2026-01-07 20:01:19 +01:00
Peter Steinberger
8584bcd2f6 Merge remote-tracking branch 'origin/main' 2026-01-07 19:44:26 +01:00
Peter Steinberger
0d021391a9 fix: scope thread sessions and discord starter fetch 2026-01-07 19:42:50 +01:00
Peter Steinberger
aba4695cd1 test(status): cover model override display 2026-01-07 18:38:55 +00:00
Azade
2b09cb3d9f fix(status): show configured model instead of last-run model 2026-01-07 18:37:42 +00:00
Shadow
7e5cef29a0 Threads: add Slack/Discord thread sessions 2026-01-07 19:30:30 +01:00
Peter Steinberger
1011640a13 refactor: drop autoReply, add topic requireMention
Co-authored-by: kitze <kristijan.mkd@gmail.com>
2026-01-07 12:07:15 +01:00
Peter Steinberger
eef90b47a3 chore: satisfy lint 2026-01-07 11:49:01 +01:00
Peter Steinberger
43c6bb7595 feat: add channel/topic overrides for skills + auto-reply 2026-01-07 11:44:37 +01:00
Peter Steinberger
61f720b945 feat: add skill filter + group system prompt plumbing 2026-01-07 11:44:37 +01:00
Peter Steinberger
9bf6684366 feat: add provider usage tracking 2026-01-07 11:42:46 +01:00
Peter Steinberger
a700f9896d feat: telegram draft streaming 2026-01-07 11:08:32 +01:00
Peter Steinberger
e8420bd047 fix: refine bootstrap injections 2026-01-07 10:04:23 +00:00
Tobias Bischoff
412990a139 Reduce prompt token overhead with leaner context injections 2026-01-07 10:04:23 +00:00
Peter Steinberger
7973fd4caf feat: add agents command 2026-01-07 10:03:53 +01:00
Peter Steinberger
8b1263ce11 fix: split status activation line 2026-01-07 07:26:52 +01:00
Peter Steinberger
dc941b7e57 fix: refresh status output 2026-01-07 07:22:06 +01:00
Peter Steinberger
1673a221f8 feat: add /reasoning reasoning visibility 2026-01-07 06:17:31 +01:00
Peter Steinberger
cb2a72f8a9 test(routing): add route-reply coverage 2026-01-07 05:07:53 +00:00
Peter Steinberger
3668388912 fix(routing): harden originating reply routing 2026-01-07 05:02:34 +00:00
Josh Lehman
5414da9fd4 fix(routing): handle cross-provider messages in collect mode
When queued messages come from different providers (Slack + Telegram),
process them individually instead of collecting into a single prompt.
This ensures each reply routes back to its originating provider.

- Add hasCrossProviderItems() to detect multi-provider queues
- Skip collect mode when cross-provider detected
- Preserve originatingChannel/originatingTo when collecting same-provider
2026-01-07 04:51:33 +00:00
Josh Lehman
2d67ec5bfa fix(routing): only route to originating channel when cross-provider
When OriginatingChannel matches Surface (same provider), use normal
dispatcher. Only route via routeReply() when they differ, ensuring
cross-provider messages (e.g., Telegram queued while Slack active)
get routed back to their origin.
2026-01-07 04:51:33 +00:00
Josh Lehman
9d50ebad7d feat(routing): route replies to originating channel
Implement reply routing based on OriginatingChannel/OriginatingTo fields.
This ensures replies go back to the provider where the message originated
instead of using the session's lastChannel.

Changes:
- Add OriginatingChannel/OriginatingTo fields to MsgContext (templating.ts)
- Add originatingChannel/originatingTo fields to FollowupRun (queue.ts)
- Create route-reply.ts with provider-agnostic router
- Update all providers (Telegram, Slack, Discord, Signal, iMessage)
  to pass originating channel info
- Update reply.ts to pass originating channel to followupRun
- Update followup-runner.ts to use route-reply for originating channels

This addresses the issue where messages from one provider (e.g., Slack)
would receive replies on a different provider (e.g., Telegram) because
the queue used the last active dispatcher instead of the originating one.
2026-01-07 04:51:33 +00:00
Peter Steinberger
80112433a5 fix(telegram): support forum topics
Co-authored-by: Daniel Griesser <HazAT@users.noreply.github.com>
Co-authored-by: Nacho Iacovino <nachoiacovino@users.noreply.github.com>
Co-authored-by: Randy Ventures <RandyVentures@users.noreply.github.com>
2026-01-07 02:19:42 +00:00
Peter Steinberger
dd0d23cd96 test(commands): add /stop native regression 2026-01-06 23:11:57 +00:00
Peter Steinberger
e0efcda77f fix(commands): wire /stop across chat commands 2026-01-06 23:11:57 +00:00
Peter Steinberger
fec7f37271 merge upstream/main 2026-01-06 23:09:01 +01:00
Peter Steinberger
86b56b2308 fix: harden gemini session reset 2026-01-06 23:06:01 +01:00
Peter Steinberger
7aa7fa79d0 feat: update heartbeat defaults 2026-01-06 21:54:42 +00:00
Peter Steinberger
96164b5955 fix: improve socket error handling 2026-01-06 22:43:29 +01:00
Emanuel Stadler
fb17a32283 feat: enhance error handling for socket connection errors
- Added `isError` property to `EmbeddedPiRunResult` and reply items to indicate error states.
- Updated error handling in `runReplyAgent` to provide more informative messages for specific socket connection errors.
2026-01-06 22:19:37 +01:00
Peter Steinberger
84c8209158 fix(slack): clear assistant thread status after replies 2026-01-06 21:41:30 +01:00
Shadow
9b22e1f6e9 feat(commands): unify chat commands (#275)
* Chat commands: registry, access groups, Carbon

* Chat commands: clear native commands on disable

* fix(commands): align command surface typing

* docs(changelog): note commands registry (PR #275)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-01-06 20:17:56 +00:00
Peter Steinberger
67bda21811 fix: preserve markdown fences when chunking 2026-01-06 20:23:41 +01:00
Peter Steinberger
31dbc62bdd fix(telegram): prevent stuck typing after tool runs 2026-01-06 18:56:43 +00:00
Abhi
bdf597eb95 fix(telegram): stop typing after tool results (#322)
Thanks @AbhisekBasu1.
2026-01-06 18:54:08 +00:00
Peter Steinberger
2f24ea492b fix: restore Anthropic token accounting 2026-01-06 18:52:01 +00:00