Commit Graph
63 Commits
Author SHA1 Message Date
MythEclipse decfb8fb61 [CommandCode error: {"type":"server_error","message":"Service temporarily unavailable. Please try again shortly.","statusCode":503,"isRetryable":true}] 2026-06-02 22:49:15 +07:00
MythEclipse f8bdb16598 chore: session auto-commit 2026-06-02 22:44:58 +07:00
MythEclipse bf6ec728c4 chore(discord-gateway): remove stale eslint-disable comment for sticker cache stats 2026-06-02 22:20:46 +07:00
MythEclipse c80a344391 fix(discord-gateway): change statsCache from const to let for reassignment in initStickerCache 2026-06-02 22:20:26 +07:00
MythEclipse 3b86bf4920 fix(discord-gateway): use const for sticker cache stats variable 2026-06-02 22:20:14 +07:00
MythEclipse 204e181e0e There are no staged changes to commit. The working tree is clean — git diff --cached returned nothing. You'll need to stage some changes first (git add ...) before I can write a commit message. 2026-06-02 22:20:02 +07:00
MythEclipse 00851e76da There are **no staged changes** to work with — the working tree is clean and git diff --cached returned nothing. 2026-06-02 22:16:06 +07:00
MythEclipse 9e8881f4f0 There are no staged changes to summarize. The working tree is clean and git diff --cached returned nothing. 2026-06-02 22:15:33 +07:00
MythEclipse d98ce9406e No staged or unstaged changes — the working directory is clean. There's nothing to commit. 2026-06-02 22:15:01 +07:00
MythEclipse cdbd8e1684 fix(discord-gateway): use PostgreSQL positional parameters in sticker cache query 2026-06-02 22:14:05 +07:00
MythEclipse 22b8e1a698 I can see the git command needs permission to run. Could you approve the git diff --cached command so I can see the staged changes and write the commit message? 2026-06-02 22:13:29 +07:00
MythEclipse 9b1f6b4a8d There are no staged changes to summarize. 2026-06-02 22:13:03 +07:00
MythEclipse 57d28a08af feat(ai-moderation): add per-batch timeout for text-only moderation calls 2026-06-02 22:12:32 +07:00
MythEclipse 4c5d76ea38 No staged changes detected. Would you like me to check unstaged changes instead? 2026-06-02 22:12:25 +07:00
MythEclipse 0a71e76e62 fix(ai-moderation): enforce concurrency cap, prune stale counters, and prevent retry collisions 2026-06-02 22:12:03 +07:00
MythEclipse 9c352c94c9 chore: no staged changes 2026-06-02 22:05:47 +07:00
MythEclipse 862586a863 No staged changes found. 2026-06-02 22:04:46 +07:00
MythEclipse 1359dd4955 chore: no staged changes 2026-06-02 22:04:09 +07:00
MythEclipse a4e91822f6 chore: no staged changes 2026-06-02 22:03:53 +07:00
MythEclipse 55042ca9eb chore: no staged changes 2026-06-02 22:03:44 +07:00
MythEclipse 1e1fbb4583 fix(discord-gateway): require LLM API key only when AI analysis is enabled 2026-06-02 21:46:15 +07:00
MythEclipse 831bb692d9 chore: no staged changes 2026-06-02 21:44:42 +07:00
MythEclipse 19028cf244 refactor: migrate discord-gateway from winston to @bete/shared/logger and utils
- Replace all local logger imports (../../shared/logger/logger.js) with @bete/shared/logger across 26 files
- Remove winston dependency, add pino to discord-gateway package.json
- Delete shared/logger/logger.ts (winston-based, 132 lines) and serialization.ts (109 lines)
- Replace local retryWithBackoff imports with @bete/shared/utils across 6 files
- Delete shared/utils/retry.ts (42 lines)
- Add CustomLogger type alias to @bete/shared/logger for backwards compatibility
- Remove logger param from all retryWithBackoff calls and uploadToTele interfaces
- Frontend: convert entity type files to re-exports from shared/api/client.ts
- Full monorepo typecheck clean (4/4 packages)

35 files changed, 42 insertions(+), 488 deletions(-)
2026-06-02 21:23:12 +07:00
MythEclipse 2d79d8aefd feat(shared): reorder AppError constructor to (message, code, status), add singleton logger, retry and TTL cache utilities 2026-06-02 21:06:42 +07:00
MythEclipse 9045e7e347 chore(backend): switch moduleResolution to bundler and remove baseUrl from tsconfig 2026-06-02 19:14:50 +07:00
MythEclipse 61b5a59ed3 chore: auto-commit task - 2026-06-02 19:08:06 +07:00
MythEclipse 685a6b2ea9 chore: auto-commit task - 2026-06-02 19:04:49 +07:00
MythEclipse d1ad397be6 chore: session auto-commit 2026-06-02 18:57:38 +07:00
MythEclipse 924a6b8819 chore: session auto-commit 2026-06-02 18:57:13 +07:00
MythEclipse 0fa49b3613 chore: session auto-commit 2026-06-02 18:55:48 +07:00
MythEclipse 1a0090429e chore: auto-commit task - 2026-06-02 18:47:18 +07:00
MythEclipseandClaude Opus 4.8 363676b608 fix: remove dead OpenAI client instance and fix ChatCompletion type imports
- Delete unused OpenAI WAF bypass client block (60+ lines) from both monolith
  and microservice llmModerationClient.ts
- Replace OpenAI.Chat.Completions.ChatCompletion with type-only ChatCompletion
  import from openai/resources/chat/completions
- All LLM chat calls already go through centralized llmClient.ts helper

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 18:22:42 +07:00
MythEclipse 71de941470 chore: session auto-commit 2026-06-02 18:09:00 +07:00
MythEclipse 292fcbf238 chore: session auto-commit 2026-06-02 17:55:42 +07:00
MythEclipse a2d4ba3f95 chore: auto-commit task - 2026-06-02 17:45:47 +07:00
MythEclipse e0d54b7770 chore: auto-commit task - 2026-06-02 17:33:19 +07:00
MythEclipse 049fd49737 chore: session auto-commit 2026-06-02 17:25:01 +07:00
MythEclipse b23ccf0837 chore: session auto-commit 2026-06-02 17:12:42 +07:00
MythEclipse 498ab73d62 chore: auto-commit task - 2026-06-02 17:08:42 +07:00
MythEclipse 406a6cbf79 refactor: migrate sticker cache to PostgreSQL, remove versioning
- Replace file-based sticker cache (.dat + index.json) with PostgreSQL sticker_cache table
- Remove model_version column and all versioning logic (git branch detection, GitHub API, CACHE_MODEL_VERSION)
- Strip VISION_MODEL_VERSION, logCacheEvent calls, and version filtering from SQL queries
- Remove STICKER_CACHE_DIR and STICKER_CACHE_MAX_SIZE_MB config variables
- Delete dead migration add_model_version_to_cache.sql

textCacheStore.ts reduced 482→204 lines (-57%)
stickerCache.ts reduced 210→144 lines (-31%)
Total: 11 files changed, 233 insertions, 591 deletions
2026-06-02 14:05:51 +07:00
MythEclipseandClaude Opus 4.8 e584a7941e fix(text-cache): apply model version migration on existing dbs
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 13:05:05 +07:00
MythEclipseandClaude Opus 4.8 e5673c2bbd feat(text-cache): resolve cache version from real GitHub API, no static env or dummy
- Add fetchRemoteBranchFromGitHub() to query https://api.github.com/repos/MythEclipse/bete for actual default_branch
- Add resolveBranch() tiered resolver: git CLI → GitHub API → env → error
- Async post-startup branch resolution upgrades version from emergency fallback to real remote branch
- normalizeBranchName() for consistent version key formatting
- Emergency fallback 'v1' logged as ERROR with repo context — not a silent dummy
- Removed static env-first approach; env is now tier 3 override, not tier 1

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 12:52:56 +07:00
MythEclipseandClaude Opus 4.8 682fb31deb fix(text-cache): add missing model_version column to migration + strict git detection
- Create new migration 0001_add_model_version_to_cache.sql to add model_version column to text_analysis_cache table (default 'v1')
- Add composite index on source + model_version for efficient cache lookups
- Improve git branch detection in textCacheStore.ts:
  * Check CACHE_MODEL_VERSION env var first (required in Docker)
  * Suppress stderr with stdio pipes to eliminate spurious warnings
  * Log ERROR (not warning) when git unavailable AND no env var set
  * Only fall back to 'v1' as last resort, preventing silent dummy usage
- Remove unused imports (logModelVersionChange, logCacheInvalidation) and previousVersion variable
- Fixes repeated 'column model_version does not exist' errors on bot startup

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 12:46:37 +07:00
MythEclipse 505c30f124 chore(discord-gateway): remove unused imports from response logger
- aiAnalyzer.ts: removed unused logAnalysisSummary and logFalsePositiveDetected
- llmModerationClient.ts: removed unused logVisionAnalysis, logVisionError, logRetryAttempt

These functions are not called in the codebase.
2026-06-02 12:36:05 +07:00
MythEclipse 1acd452a2c fix(discord-gateway): resolve type errors in error logging - cast unknown error types to Error | string for logModerationError calls
- aiAnalyzer.ts: cast error to Error | string in individual fallback phase
- llmModerationClient.ts: cast parseError to Error | string in parse response phase

Fixes GitHub Actions build failure (exit code 2)
2026-06-02 12:30:59 +07:00
MythEclipse 385fc0bbbf feat: add response logger for moderation/vision audit trail + cache model versioning
- Add responseLogger.ts with comprehensive logging: vision analysis, moderation
  analysis batches, cache hit/miss events, errors, retries, false positives,
  model version changes, cache invalidation
- Integrate responseLogger calls into llmModerationClient.ts (cache events,
  moderation results, errors, retries)
- Add model_version column to text_analysis_cache schema with composite
  index for efficient filtering
- Add migration SQL for model_version column
- Document CACHE_MODEL_VERSION in .env.example
2026-06-02 12:23:52 +07:00
MythEclipseandClaude Opus 4.8 c5c667b147 feat: comprehensive UX improvements — messages, analysis, moderation
Fix #1 (CRITICAL): Wire message_analyzed through Redis EventBroadcaster
- DG aiAnalyzer.ts: Add broadcastAnalysisCompleted() helper that publishes
  to both in-memory WS broadcaster AND Redis EventBroadcaster
- DG bootstrap.ts: Pass eventBroadcaster to startPendingAIAnalysisWorker()
- Fixes broken real-time chain so analysis results appear instantly

Fix #2: Collapsible AI Analysis with Rich Formatting
- MessageCard: AI analysis now collapsible with color-coded severity border
  (red/yellow/blue), summary line showing categories + confidence + severity
- Default collapsed for clean, expanded for warn/flagged

Fix #3: Toast Notifications for Flagged Content
- Wrap app in ToastProvider; ModerationAlertListener component listens for
  moderation_alert custom events and shows toast with emoji + details

Fix #4: Discord-style Message Grouping
- MessageFeed: Group consecutive messages from same user within 5 min
- MessageCard: Compact variant hides avatar, reduces padding for non-first

Fix #5: Moderation Action Buttons in UI
- BE: POST /api/messages/:id/moderate endpoint + publishCommand() for Redis
- FE: Delete/Warn buttons on flagged/warned cards with confirmation dialog

Fix #6: Search Results Include Full Data
- BE analysis.service.ts: SELECT all 26 message columns instead of just 11
- Search results now render with full MessageCard including images/analysis

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 12:17:51 +07:00
MythEclipseandClaude Opus 4.8 74400376a0 fix: vision analysis retry + fallback jelas saat gagal
Vision API call sekarang pakai retryWithBackoff (2 retries instant).
Fallback message tegas: 'GAGAL DIANALISIS — JANGAN mengasumsikan aman'.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 11:41:18 +07:00
MythEclipseandClaude Opus 4.8 64643bb066 perf: hapus semua cooldown/backoff delay — retry tanpa bottleneck
Semua retry sekarang instant (retries=0, minTimeout=0, maxTimeout=0):
- retry.ts (kedua) — default minTimeout/maxTimeout 0, factor 1
- config.ts (kedua) — DECODER_COOLDOWN_MS=0, AI_ANALYSIS_ERROR_COOLDOWN_MS=0
- llmModerationClient.ts (kedua) — retries 0 tanpa delay
- aiAnalyzer.ts (kedua) — retries 0, AI_ANALYSIS_ERROR_COOLDOWN jadi 0
- indonesianTextNormalizer.ts (kedua) — semua rate limit cooldown 0
- recorder.ts (kedua), teleUpload (3 files), uploader (2 files) — retry instant
- attachmentUploader (kedua) — retries 0
- syncRoutes.ts — BACKLOG_SYNC_COOLDOWN 0

20 files changed. Semua cooldown bottleneck dihapus.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 11:29:52 +07:00
MythEclipseandClaude Opus 4.8 62d7d19b53 fix: analysis output wajib deskriptif — bukan generic placeholder
Sebelumnya: 'Pesan hanya berisi attachment tanpa teks yang melanggar'
Sekarang: harus deskriptif berdasarkan tipe konten:
- Text only: '[user] membahas tentang <topik>. <konteks>.'
- Image only: 'Gambar berupa <jenis>. Terlihat <isi>.'
- Text+Image: '[user] mengirim <gambar> sambil membahas <topik>.'

Tambahkan contoh baik vs buruk di OUTPUT_INSTRUCTIONS sebagai format wajib.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 11:24:21 +07:00