feat: add memory system and troubleshoot agent

Memory System:
- Add category-based memory storage (company, tech, role, location, server)
- Silent background saving via saveMemorySilently()
- Category-based overwrite (same category replaces old memory)
- Server-related pattern detection (AWS, GCP, k8s, traffic info)
- Memory management tool (list, delete)

Troubleshoot Agent:
- Session-based troubleshooting conversation (KV, 1h TTL)
- 20-year DevOps/SRE expert persona
- Support for server/infra, domain/DNS, code/deploy, network, database issues
- Internal tools: search_solution (Brave), lookup_docs (Context7)
- Auto-trigger on error-related keywords
- Session completion and cancellation support

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kappa
2026-01-27 14:28:22 +09:00
parent 6392a17d4f
commit 860e36a688
13 changed files with 1328 additions and 58 deletions

View File

@@ -526,7 +526,20 @@ export async function processServerConsultation(
// 선택 단계 처리
if (session.status === 'selecting' && session.lastRecommendation) {
const selectionMatch = userMessage.match(/(\d+)(?:번|번째)?|첫\s*번째|두\s*번째|세\s*번째/);
// 상담과 무관한 키워드 감지 (selecting 상태에서만)
// 명확히 다른 기능 요청인 경우 세션 종료하고 일반 처리로 전환
const unrelatedPatterns = /기억|날씨|계산|검색|도메인|입금|충전|잔액|시간|문서/;
if (unrelatedPatterns.test(userMessage)) {
await deleteServerSession(env.SESSION_KV, session.telegramUserId);
logger.info('무관한 요청으로 세션 자동 종료', {
userId: session.telegramUserId,
message: userMessage.slice(0, 30)
});
// 'PASSTHROUGH' 반환하여 상위에서 일반 처리로 전환
return '__PASSTHROUGH__';
}
const selectionMatch = userMessage.match(/^(\d+)\s*(?:번|번째)?$|^(첫|두|세)\s*번째$/);
if (selectionMatch) {
let selectedIndex = -1;