Files
GMW/services/discord-gateway/package.json
T
asepharyana b9bba643bd feat(gateway): Jev (System One) as primary text moderator with LLM fallback (#80)
* feat(gateway): Jev (System One) as primary text moderator with LLM fallback

Add TypeSafe Jev via @typesafe-ai/sdk v0.6.0 as the PRIMARY analyzer for
text-only moderation sub-batches; the existing LLM stays as the fallback
for anything Jev cannot decide confidently (per-message gate rejection or
API failure) and for media batches.

- jevAnalyzer.ts: TypeSafeClient wrapper, declarative state builder
  (System One models MUST get factual state, not chat-XML — chat framing
  made Jev confidently wrong on clean messages at 0.98 confidence),
  message-id-keyed question builder (5 typed questions per message),
  cross-consistency acceptance gate (noul↔status↔severity↔action↔category),
  answer→AnalysisResult mapper, fail-open outcome.
- textBatchProcessor.ts: Jev-first per sub-batch, rejected ids + API
  failures fall back to callModerationLLM; no cross-batch pollution.
- config: AI_LLM_JEV_ENABLED/API_KEY/BASE_URL/MODEL/TIMEOUT_MS/MIN_CONFIDENCE.
- .env.example: documented all 6 Jev env vars.
- tests: unit (question/state builders, gate, mapper) + live smoke
  (gated behind AI_LLM_JEV_SMOKE=1) verified 4/4 accepted vs real 9router.

* fix: auto-fix code quality [skip ci]
2026-09-23 17:51:38 +07:00

62 lines
1.7 KiB
JSON

{
"name": "@bete/discord-gateway",
"version": "1.0.0",
"description": "Discord Gateway service - handles message capture, voice recording, and AI moderation",
"type": "module",
"main": "dist/index.js",
"pnpm": {
"onlyBuiltDependencies": [
"@discordjs/opus",
"esbuild",
"sharp"
]
},
"scripts": {
"dev": "tsx watch src/index.ts",
"start": "node dist/index.js",
"build": "tsc",
"typecheck": "tsc --noEmit",
"lint": "biome check --diagnostic-level=error .",
"format": "biome format --write .",
"test": "vitest run",
"test:unit": "vitest run --exclude \"tests/llmE2e.test.ts\"",
"test:e2e": "vitest run tests/llmE2e.test.ts",
"test:e2e:live": "bash scripts/run-llm-e2e.sh"
},
"dependencies": {
"@discordjs/opus": "^0.10.0",
"@discordjs/voice": "file:vendor/discord-voice-fork",
"@snazzah/davey": "^0.1.11",
"@typesafe-ai/sdk": "^0.6.0",
"axios": "^1.20.0",
"discord.js-selfbot-v13": "^3.7.1",
"dotenv": "^18.0.0",
"drizzle-orm": "^0.45.2",
"ioredis": "^6.0.0",
"libsodium-wrappers": "^0.8.4",
"lru-cache": "^11.5.3",
"openai": "^7.19.0",
"opusscript": "^0.1.1",
"p-limit": "^7.3.3",
"p-retry": "^8.0.1",
"pg": "^8.23.0",
"pino": "^10.3.1",
"piscina": "^5.3.2",
"prism-media": "2.0.0-alpha.0",
"sharp": "^0.35.4",
"tiktoken": "^1.0.22",
"ws": "^8.21.3",
"zod": "^4.6.5"
},
"devDependencies": {
"@biomejs/biome": "latest",
"@types/node": "^26.4.0",
"@types/pg": "^8.23.1",
"@types/ws": "^8.18.1",
"drizzle-kit": "^0.31.10",
"tsx": "^4.23.13",
"typescript": "^7.0.2",
"vitest": "latest"
}
}