Commit Graph

12 Commits

Author SHA1 Message Date
kappa
7d43db3054 refactor: delete server-agent.ts (905 lines)
Remove server recommendation consultation system:
- 30-year expert AI persona
- Session-based information gathering
- Brave Search / Context7 tool integration
- Automatic spec inference

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:25:36 +09:00
kappa
02b18301a1 fix: resolve TypeScript errors after SessionManager refactoring
- Remove unused import types (*SessionStatus, OpenAIMessage)
- Replace deprecated session functions with SessionManager API
- Prefix unused base class parameters with underscore
- Update all session management calls across agents and tools

Files affected:
- src/agents/*.ts (removed unused imports)
- src/utils/session-manager.ts (unused param prefixes)
- src/tools/server-tool.ts (SessionManager migration)
- src/tools/troubleshoot-tool.ts (SessionManager migration)
- src/routes/api/chat.ts (SessionManager migration)
- src/routes/handlers/message-handler.ts (SessionManager migration)

Verification:
- TypeScript: compiles without errors
- Tests: 223 passed (10 pre-existing failures)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:35 +09:00
kappa
edf1bbc9a2 refactor: apply SessionManager to all agents
- domain-agent: use DomainSessionManager (handles target_domain)
- deposit-agent: use SessionManager<DepositSession>
- troubleshoot-agent: use SessionManager<TroubleshootSession>
- server-agent: use ServerSessionManager (handles last_recommendation)
- Remove ~760 lines of duplicated session CRUD code
- Use centralized constants from agent-config.ts
- Import OpenAI types from types.ts instead of local definitions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:35 +09:00
kappa
de36978de4 refactor: unify server-agent to new pattern
- Change field names to snake_case (user_id, collected_info, last_recommendation, created_at, updated_at, expires_at)
- Extract system prompts to constants (SERVER_EXPERT_PROMPT, SERVER_REVIEW_PROMPT)
- Add __PASSTHROUGH__/__SESSION_END__ marker support
- Change handler signature to match other agents (db, userId, userMessage, env, options)
- Add helper functions for consistency (createServerSession, isSessionExpired, addMessageToSession, hasServerSession)
- Update saveSe rverSession signature to not need userId separately
- Rename tools constant from serverExpertTools to serverExpertTools (camelCase)
- Change AI call parameter order for consistency
- Add performance logging
- Update openai-service.ts routing to use hasServerSession
- Update server-tool.ts to use new session creation helpers
- Update message-handler.ts and api/chat.ts field references

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00
kappa
5d8150e67c refactor: migrate troubleshoot-agent from KV to D1
- Create troubleshoot_sessions table in D1
- Replace KV session storage with D1
- Unify field names to snake_case (user_id, collected_info, created_at, updated_at, expires_at)
- Add __PASSTHROUGH__/__SESSION_END__ marker support
- Change handler signature to match domain/deposit pattern
- Extract system prompt to constant TROUBLESHOOT_EXPERT_PROMPT
- Add hasTroubleshootSession() for routing
- Update openai-service.ts to use new D1-based functions
- Update troubleshoot-tool.ts to use D1 instead of KV
- Add TroubleshootSessionStatus type

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00
kappa
f5c38ad909 refactor: move deposit-agent to agents/ and add session support
- Move deposit-agent.ts to src/agents/
- Add D1 session CRUD functions (getDepositSession, saveDepositSession, etc.)
- Add Deposit Expert AI with function calling
- Add processDepositConsultation handler for session-based flow
- Add deposit_sessions table migration (006_add_deposit_sessions.sql)
- Update import paths in deposit-tool.ts
- Add DEPOSIT_BANK_* environment variables to Env interface

Session flow: collecting_amount → collecting_name → confirming → completed
Smart parsing: "홍길동 5만원" → Go directly to confirming

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00
kappa
f9f577f25c feat: implement processDomainConsultation main handler
- Add full conversation flow with session management
- Handle tool call execution
- Support __PASSTHROUGH__ and __SESSION_END__ markers
- Add hasDomainSession helper for routing
- Export executeDomainAction from domain-tool.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00
kappa
160569bf8c feat: add domain tool execution dispatcher
- Add executeDomainToolCall function
- Integrate with existing domain-tool.ts functions
- Map AI tool calls to domain actions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00
kappa
69aac96daa feat: add domain agent AI call functions
- Add domain expert system prompt
- Add domain tools for function calling
- Add callDomainExpertAI function

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00
kappa
e463a88803 feat: create domain-agent basic structure
- Add D1 session CRUD functions (getDomainSession, saveDomainSession, deleteDomainSession)
- Add session helper functions (createDomainSession, isSessionExpired, addMessageToSession)
- Add placeholder for main consultation handler (processDomainConsultation)
- Fix server-agent import paths in server-tool.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00
kappa
8f16de40cc refactor: move troubleshoot-agent to agents directory
- Move troubleshoot-agent.ts to src/agents/
- Update import paths in dependent files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00
kappa
4642c1ff94 refactor: move server-agent to agents directory
- Create src/agents/ directory for agent modules
- Move server-agent.ts to new location
- Update import paths in all dependent files:
  - openai-service.ts
  - tools/server-tool.ts
  - routes/handlers/message-handler.ts
  - routes/api/chat.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00