117 Commits

Author SHA1 Message Date
07c5ffb82d Fix Bind Topic Error by making callback handling more robust
- Wrap answerCallbackQuery and editMessageText in try-catch to handle expired queries
- Answer callback queries as early as possible
- Add setup_tracking to allowed pending action types for better type safety
- Ignore 'query is too old' and 'message is not modified' errors gracefully
2026-03-15 02:50:32 +04:00
5e39cdf455 Fix setup command and refine payment clarification logic
- Fix BUTTON_TYPE_INVALID in non-private chats by using URL buttons for mini app links
- Localize clarification questions and processing messages
- Add language instructions to AI prompt
- Allow default payment amounts when not explicitly specified
2026-03-15 02:34:34 +04:00
afbda43c0e fix(bot): localize topic processor responses and allow optional payment amounts 2026-03-15 02:27:44 +04:00
3c53ab9e1a feat(bot): implement /app and /keyboard commands, add dashboard links 2026-03-15 02:13:32 +04:00
531e52b238 feat(bot): improve /setup UX and update checklist on /bind
- Enhance /setup message with a warmer greeting and binding instructions\n- Rename 'Setup' buttons to 'Create' for clarity\n- Track /setup message ID to enable automatic checklist updates when /bind is used\n- Refresh /setup checklist after successful topic binding\n- Update English and Russian translations
2026-03-15 01:44:13 +04:00
d0475743f8 fix(finance): gracefully handle initial state without rent rules
Allow building the finance dashboard even if no rent rule is configured for the cycle.
Defaults to 0 rent in the cycle's currency. Added regression tests in application
service and miniapp dashboard handler.
2026-03-15 01:38:54 +04:00
f4e5a49621 feat(bot): restore /bind command and improve /setup welcoming experience 2026-03-15 01:17:22 +04:00
b2e1e0f213 feat(bot): refactor /setup and add /bind command
- Simplify /setup message: remove chat ID, use emojis, compact layout
- Remove 'Bind' buttons from /setup
- Add /bind command for binding existing topics
- Remove old binding mode with 10-min timeout
- Update i18n translations for en and ru
2026-03-15 00:14:40 +04:00
e24c53dce2 feat(bot): replace /invite with /join_link command
- Remove /invite command and targeted invite flow
- Add /join_link command to generate shareable household join link
- Update i18n translations for en and ru
- Update command registration to include join_link in admin commands
2026-03-14 23:46:32 +04:00
0af8ea6f48 feat: add chat topic binding for casual conversation
Add ability to bind a dedicated chat topic where normal conversation
happens, separate from functional topics (purchases, payments, etc.)

- Add 'chat' to HOUSEHOLD_TOPIC_ROLES
- Add /bind_chat_topic command for admins
- Update i18n strings for en/ru
- Add command to admin scope in telegram-commands
2026-03-14 23:32:14 +04:00
290b18545e chore(bot): clean up topic processor log levels and add start log 2026-03-14 15:23:12 +04:00
b01a129466 fix(bot): include all schema properties in required array for OpenAI Structured Outputs 2026-03-14 15:04:13 +04:00
8de8419028 feat(bot): enhance topic processor logging for diagnosis
Added comprehensive logging to topic-processor.ts to capture API errors, parsing failures, and silent decisions. Also added result logging to purchase and payment ingestion handlers to trace the processor's output.
2026-03-14 14:54:49 +04:00
572c21f621 feat(bot): add error logging to topic processor
Previously, the topic processor swallowed errors silently, making debugging impossible. This commit adds error logging to the topic processor catch block.
2026-03-14 14:43:32 +04:00
b44b3bde93 fix(bot): silence topic processor failure messages unless explicitly mentioned
Previously, the bot would reply with a 'Zzz...' message to every message in a topic if the topic processor failed or was missing. This change ensures the bot remains silent unless it is explicitly mentioned by the user.
2026-03-14 14:33:29 +04:00
f38ee499ae feat(bot): unified topic processor replacing router+interpreter stack
Replace 3-layer architecture (gpt-5-nano router + gpt-4o-mini interpreter) with
single unified topic processor (gpt-4o-mini) for simplified message handling.

New components:
- HouseholdContextCache: TTL-based caching (5 min) for household config data
- TopicProcessor: Unified classification + parsing with structured JSON output

Key changes:
- Renamed ASSISTANT_ROUTER_MODEL → TOPIC_PROCESSOR_MODEL
- Added TOPIC_PROCESSOR_TIMEOUT_MS (default 10s)
- Refactored save() → saveWithInterpretation() for pre-parsed interpretations
- Removed deprecated createOpenAiTopicMessageRouter and ~300 lines legacy code
- Fixed typing indicator to only start when needed (purchase routes)
- Fixed amount formatting: convert minor units to major for rawText

Routes: silent, chat_reply, purchase, purchase_clarification, payment,
payment_clarification, topic_helper, dismiss_workflow

All 212 bot tests pass. Typecheck, lint, format, build clean.
2026-03-14 13:33:57 +04:00
9cac339d0a fix: improve AI router prompt for topic message routing
- Add engagement rule: respond when engaged=yes/mention/reply (not silent)
- Add explicit purchase rules: classify as candidate when realistic items + amount
- Add fantastical purchase rule: respond with chat_reply (playful), not silent
- Add payment classification rules
- Simplify prompt structure for clarity
2026-03-14 10:44:03 +04:00
488a488137 feat: add quick payment action and improve copy button UX
Mini App Home Screen:
- Add 'Record Payment' button to utilities and rent period cards
- Pre-fill payment amount with member's share (rentShare/utilityShare)
- Modal dialog with amount input and currency display
- Toast notifications for copy and payment success/failure feedback

Copy Button Improvements:
- Increase spacing between icon and text (4px → 8px)
- Add hover background and padding for better touch target
- Green background highlight when copied (in addition to icon color change)
- Toast notification appears when copying any value

Backend:
- Add /api/miniapp/payments/add endpoint for quick payments
- Payment notifications sent to 'reminders' topic in Telegram
- Include member name, payment type, amount, and period in notification

Files:
- New: apps/miniapp/src/components/ui/toast.tsx
- Modified: apps/miniapp/src/routes/home.tsx, apps/miniapp/src/index.css,
  apps/miniapp/src/theme.css, apps/miniapp/src/i18n.ts,
  apps/bot/src/miniapp-billing.ts, apps/bot/src/server.ts

Quality Gates:  format, lint, typecheck, build, test

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-14 08:51:53 +04:00
1274cefc0f Stabilize purchase functionality: fix ID prefix, uniqueness, and split participant inclusion 2026-03-13 22:29:17 +04:00
94a5904f54 feat(miniapp): refine UI and add utility bill management
- Fix collapsible padding and button spacing
- Add subtotal to balance card
- Add utility bill management for admins
- Fix lints and type checks across the monorepo
- Implement rejectPendingHouseholdMember in repository and service
2026-03-13 05:52:34 +04:00
f1670c521f Refine topic workflow followups 2026-03-13 02:21:08 +04:00
88b50d2cb7 Refine topic assistant conversation context 2026-03-12 22:00:31 +04:00
401bbbdcca Refine topic context and purchase followup guards 2026-03-12 20:24:50 +04:00
b7fa489d24 Fix topic message history persistence 2026-03-12 19:21:37 +04:00
23faeef738 feat(bot): add topic history-aware assistant replies 2026-03-12 19:06:51 +04:00
5ebae7714c fix(bot): improve purchase-topic conversation flow 2026-03-12 18:23:26 +04:00
8374d18189 feat(bot): add shared topic router 2026-03-12 17:12:26 +04:00
014d791bdc fix(bot): improve calculated purchase confirmation flow 2026-03-12 15:35:02 +04:00
ca61085179 Fix purchase topic engagement gating 2026-03-12 14:44:55 +04:00
0d2065fd5e feat(miniapp): redesign balance and due-state flows 2026-03-12 14:08:55 +04:00
6053379f31 fix(miniapp): clarify cycle summary and balance sections 2026-03-12 13:12:39 +04:00
a50b826b40 feat(miniapp): improve billing settings controls 2026-03-12 11:37:57 +04:00
4c19ee798d feat(miniapp): add household general settings 2026-03-12 11:30:11 +04:00
4e7400e908 feat(bot): add configurable household assistant behavior 2026-03-12 03:22:43 +04:00
e56f1194e9 fix(bot): improve utilities reminder template flow 2026-03-12 02:54:42 +04:00
135a2301ca feat(miniapp): redesign member balance surfaces 2026-03-12 02:10:22 +04:00
a78eb88fa4 fix(bot): hand off reminder dashboard opens through dm 2026-03-11 22:36:43 +04:00
6b8c2fa397 feat(bot): add reminder utility entry flow 2026-03-11 22:23:24 +04:00
c8c6bd2e39 feat(bot): redesign household status output 2026-03-11 15:24:00 +04:00
086e521ce7 feat(setup): add reply-based household invites 2026-03-11 15:21:18 +04:00
0787847c19 feat(member): improve assistant roster awareness 2026-03-11 15:10:20 +04:00
79f96ba45b feat(payments): add transparent balance guidance 2026-03-11 14:52:09 +04:00
8401688032 feat(purchase): add per-purchase participant splits 2026-03-11 14:34:27 +04:00
98988159eb feat(member): add away billing policies 2026-03-11 14:05:52 +04:00
773abf2531 feat(member): add household lifecycle states 2026-03-11 13:44:38 +04:00
fce2d30beb feat(bot): support tagged assistant replies in topics 2026-03-11 12:15:56 +04:00
9553ca342a fix(bot): shorten payment topic callback payloads 2026-03-11 11:46:25 +04:00
690347e7ea fix(bot): expire pending payment topic actions 2026-03-11 11:26:16 +04:00
3ff4bbc246 feat(bot): add structured payment topic confirmations 2026-03-11 11:23:49 +04:00
4cd5622d63 fix(bot): refresh setup checklist after manual binds 2026-03-11 11:23:33 +04:00