187 Commits

Author SHA1 Message Date
kappa
1160719a78 docs: add SessionManager usage guide
- Comprehensive API documentation
- Migration examples (before/after)
- Specialized manager patterns
- Next steps for agent refactoring

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00
kappa
36fdc4fe3d feat: add SessionManager generic class for agent sessions
- Create reusable SessionManager<T> with CRUD operations
- Support for session expiry, message limits
- Specialized managers for Domain and Server agents
- Reduce code duplication across 4 agents

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00
kappa
c6345a8f2f chore: clean up unused code and fix test imports
- Remove unused config in commands.ts
- Remove deprecated formatDepositResult function in deposit-tool.ts
- Remove unused type imports in deposit-tool.ts
- Fix import path in deposit-agent.test.ts (src/deposit-agent → src/agents/deposit-agent)

This is a cleanup commit following the agent pattern unification work.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +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
2bd9bc4c2b feat: complete agent refactoring integration
- Add deposit session routing to openai-service.ts
- Convert deposit-tool to agent trigger (delegate to deposit-agent)
- Update CLAUDE.md with new agent architecture

Changes:
- openai-service.ts: Import and check hasDepositSession, route to processDepositConsultation
- deposit-tool.ts: Convert action → natural language → delegate to Deposit Agent
- CLAUDE.md: Update Core Services, Function Calling Tools, Data Layer, Deposit System sections

All tests passing (192/195), dev server starts successfully.

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
cb2bd48ad6 refactor: convert domain-tool to agent trigger
- Modify executeManageDomain to delegate to domain agent
- Add buildDomainMessage helper for action-to-message conversion
- Keep internal functions for agent tool execution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00
kappa
d069e84efd feat: add domain session routing to openai-service
- Import domain agent functions
- Add domain session check before main AI processing
- Route to domain agent when session exists
- Handle __PASSTHROUGH__ for non-domain messages

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
676f3866e8 feat: add DomainSession and DepositSession types
- Add type definitions for domain and deposit agent sessions
- Follow existing ServerSession pattern

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
kappa
f3596fb509 chore: add domain/deposit agent session tables migration
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:47:34 +09:00
kaffa
356eb6ccc8 Add Gitea Actions CI workflow 2026-02-03 11:39:08 +09:00
kaffa
94d615a3bf Add MIT LICENSE 2026-02-03 11:20:55 +09:00
kappa
619e952520 docs: restructure CLAUDE.md for better readability
- Add numbered sections (1-9) for clear navigation
- Remove verbose agent descriptions, keep concise
- Consolidate duplicate content
- Improve formatting consistency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 23:47:20 +09:00
kappa
2b1bc6a371 feat: improve server management and refund display
Server Management:
- Fix /server command API auth (query param instead of header)
- Show server specs (vCPU/RAM/Bandwidth) in /server list
- Prevent AI from refusing server deletion based on expiration date
- Add explicit instructions in tool description and system prompt

Refund Display:
- Show before/after balance in server deletion refund message
- Format: 환불 전 잔액 → 환불 금액 → 환불 후 잔액

Other Changes:
- Add stopped status migration for server orders
- Clean up callback handler (remove deprecated code)
- Update constants and pattern utilities

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 05:30:59 +09:00
kappa
18e7d3ca6e test: add comprehensive unit tests for utils and security
- Add security.test.ts: 36 tests for webhook validation, rate limiting
- Add circuit-breaker.test.ts: 31 tests for state transitions
- Add retry.test.ts: 25 tests for exponential backoff
- Add api-helper.test.ts: 25 tests for API abstraction
- Add optimistic-lock.test.ts: 11 tests for concurrency control
- Add summary-service.test.ts: 29 tests for profile system

Total: 157 new test cases (222 passing overall)

- Fix setup.ts D1 schema initialization for Miniflare
- Update vitest.config.ts to exclude demo files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:38:49 +09:00
kappa
fbe696b88c refactor: complete P0-P1 improvements
Constants migration:
- server-agent.ts: SERVER_CONSULTATION_STATUS, LANGUAGE_CODE
- troubleshoot-agent.ts: TROUBLESHOOT_STATUS
- notification.ts: NOTIFICATION_TYPE

API improvements:
- search-tool.ts: Zod schema validation for Brave/Context7 APIs
- api-helper.ts: Centralized API call utility with retry/timeout

Testing:
- kv-cache.test.ts: 38 test cases for cache abstraction

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:02:27 +09:00
kappa
f304c6a7d4 refactor: apply new utilities and constants across codebase
P0 fixes:
- KV Cache migration: security.ts now delegates to kv-cache.ts (74% code reduction)
- Environment validation: index.ts validates env on first request
- Type safety: optimistic-lock.ts removes `as any` with proper interface

P1 improvements:
- Constants applied to deposit-agent.ts (TRANSACTION_STATUS, TRANSACTION_TYPE)
- Constants applied to callback-handler.ts (CALLBACK_PREFIXES)
- Constants applied to domain-tool.ts (MESSAGE_MARKERS)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 10:49:31 +09:00
kappa
699eed1530 refactor: add KV cache, env validation, logger types, constants
- Add KV cache abstraction layer (src/services/kv-cache.ts)
- Add Zod-based env validation (src/utils/env-validation.ts)
- Improve logger types: any → unknown for type safety
- Add centralized constants file (src/constants/index.ts)
- Fix security.ts unused import

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 10:40:51 +09:00
kappa
3a671a5707 refactor: add pattern utils and split api.ts into modules
1. Pattern Detection Utility (src/utils/patterns.ts)
- Centralize tool category patterns (domain, deposit, server, etc.)
- Add memory category patterns (company, tech, role)
- Add region detection (korea, japan, singapore, us)
- Add tech stack detection (postgres, redis, nodejs, etc.)
- Export detectToolCategories(), detectRegion(), detectTechStack()

2. API Route Modularization (src/routes/api/)
- deposit.ts: /balance, /deduct with apiKeyAuth middleware
- chat.ts: /test, /chat with session handling
- contact.ts: Contact form with CORS middleware
- metrics.ts: Circuit Breaker status endpoint

3. Updates
- tools/index.ts: Use detectToolCategories from patterns.ts
- api.ts: Compose sub-routers (899 → 53 lines, 94% reduction)

Benefits:
- Single source of truth for patterns
- Better code organization
- Easier maintenance and testing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 10:34:12 +09:00
kappa
40447952a9 refactor: migrate webhook to Hono router with auth middleware
webhook.ts:
- Convert handleWebhook() to Hono router pattern
- Create telegramAuth middleware with security validations:
  - HTTP method validation (POST only)
  - Content-Type validation (application/json)
  - Timing-safe secret token comparison
  - Timestamp validation (5-min replay attack prevention)
  - Request body structure validation
- Always return 200 to Telegram (prevents retry storms)
- Structured logging with context

index.ts:
- Import webhookRouter instead of handleWebhook
- Use app.route('/webhook', webhookRouter)

Benefits:
- Consistent Hono pattern across all routes
- Reusable auth middleware
- Better separation of concerns

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 10:02:35 +09:00
kappa
3cfcb06f27 refactor: centralize auth middleware and standardize logging
1. API Key Middleware (api.ts)
- Create apiKeyAuth Hono middleware with timing-safe comparison
- Apply to /deposit/balance and /deposit/deduct routes
- Remove duplicate requireApiKey() calls from handlers
- Reduce ~15 lines of duplicated code

2. Logger Standardization (6 files, 27 replacements)
- webhook.ts: 2 console.error → logger
- message-handler.ts: 7 console → logger
- deposit-matcher.ts: 4 console → logger
- n8n-service.ts: 3 console.error → logger
- circuit-breaker.ts: 8 console → logger
- retry.ts: 3 console → logger

Benefits:
- Single point of auth change
- Structured logging with context
- Better observability in production

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:58:15 +09:00
kappa
86af187aa1 refactor: migrate API routes to Hono sub-router
- Create Hono router in api.ts
- Convert 6 API endpoints to Hono format:
  - GET /api/deposit/balance
  - POST /api/deposit/deduct
  - POST /api/test
  - POST /api/chat
  - POST /api/contact
  - GET /api/metrics
- Use Hono CORS middleware for /contact
- Remove manual handleApiRequest and handleContactPreflight
- Integrate with main app via app.route('/api', apiRouter)

Benefits:
- Cleaner declarative routing (44 insertions, 48 deletions)
- Built-in CORS middleware
- Better code organization

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:48:07 +09:00
kappa
2756dbe804 refactor: migrate HTTP routing to Hono framework
- Add hono dependency
- Replace if/else routing chain with Hono app
- Convert all HTTP routes to Hono format:
  - GET /health, /setup-webhook, /webhook-info
  - POST /webhook
  - ALL /api/*
  - GET /
- Keep email, scheduled, queue handlers unchanged
- Maintain 100% backward compatibility

Benefits:
- Cleaner declarative routing
- Type-safe Env bindings
- Ready for future middleware (CORS, rate limiting)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:40:38 +09:00
kappa
41f99334eb feat: implement server start/stop functionality
- Replace stub implementations with actual API calls
- POST /api/provision/orders/{order_id}/start
- POST /api/provision/orders/{order_id}/stop
- Add proper validation, logging, and error handling
- Follow existing code patterns (callProvisionAPI, __DIRECT__)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:46:05 +09:00
kappa
79b8555893 refactor: P3 low priority improvements
P3-1: Magic numbers to named constants
- SMS_CONTENT_MAX_LENGTH = 500 (bank-sms-parser.ts)
- DEFAULT_HISTORY_LIMIT = 10 (deposit-agent.ts)
- LOG_RESULT_MAX_LENGTH = 200 (deposit-tool.ts)

P3-2: Debug command admin-only access
- Add DEPOSIT_ADMIN_ID check for /debug command
- Return "관리자만 사용 가능" for non-admins

P3-3: Stats query null handling
- Replace || with ?? for COUNT results
- Prevents 0 being overwritten incorrectly

P3-4: Memory save error logging
- Add logger.debug for saveMemorySilently failures
- Non-critical but helps debug memory issues

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:43:00 +09:00
kappa
69e4dcc338 fix: P2 medium priority issues - validation and logging
P2-1: Tool selection fallback optimization
- Return only utility tools when no patterns match
- Reduces token usage by ~80% in fallback cases

P2-2: Minimum deposit amount validation
- Add MIN_DEPOSIT_AMOUNT = 1,000원
- Prevents spam with tiny deposits

P2-3: Standardize logging
- Replace console.log/error with structured logger
- bank-sms-parser.ts and security.ts

P2-4: Nameserver format validation
- Add validateNameservers() function
- Check minimum 2 NS, valid hostname format
- Clear error messages in Korean

P2-5: Optimistic lock error context
- Return specific error for version conflicts
- User-friendly message: "동시 요청으로 처리가 지연됨"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:40:41 +09:00
kappa
97b8f3c7f7 fix: add comprehensive error handling for P1 critical issues
P1-1: Callback query error handling
- Add try-catch around domain registration and server order
- Send user-friendly error messages on failure
- Use answerCallbackQuery to acknowledge button clicks
- Add structured logging with createLogger

P1-2: Queue DLQ monitoring
- Add admin notification when server provisioning fails
- Update order status to 'failed' in database
- Include detailed context in notifications
- Apply rate limiting (1 notification per hour)

P1-3: Email handler error recovery
- Add admin notification when SMS parsing fails
- Include email preview in notifications
- Mask email addresses for privacy
- Add structured logging with emailLogger

Also add 'failed' status to ServerOrder type.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:36:49 +09:00
kappa
9fc6820b77 chore: update package-lock.json
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:26:35 +09:00
kappa
e32e3c6a44 refactor: improve OpenAI service and tools
- Enhance OpenAI message types with tool_calls support
- Improve security validation and rate limiting
- Update utility tools and weather tool
- Minor fixes in deposit-agent and domain-register

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:26:31 +09:00
kappa
7ef0ec7594 chore: add server provisioning migrations
- 003_add_server_tables.sql: server_orders, server_instances tables
- 003_server_sessions.sql: KV-based session tracking
- 004_add_terminated_at.sql: track instance termination time

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:26:23 +09:00
kappa
5ba555864a feat: add server provisioning system with Queue
- Add server-provision.ts for async server creation
- Add SERVER_PROVISION_QUEUE with DLQ for reliability
- Add cron job for auto-cleanup of pending orders (5min)
- Add server delete confirmation with inline keyboard
- Update types for server orders, images, and provisioning
- Add server tables to schema (server_orders, server_instances)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:26:17 +09:00
kappa
d3b743c3c1 fix: server recommendation issues and __DIRECT__ tag visibility
- Fix USD price display: all prices now show in KRW (₩)
- Add Korea region auto-detection: extracts region preference from user messages
- Fix low-spec recommendation for high-performance requirements:
  - Add extractTechStack() to detect PostgreSQL, Redis, MongoDB keywords
  - Enhance inferExpectedUsers() to consider tech stack complexity
  - SaaS/B2B services now recommend 4GB+ RAM servers
- Fix __DIRECT__ tag appearing in output:
  - Reorder message concatenation in server-agent.ts
  - Add stripping logic in conversation-service.ts and api.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:24:54 +09:00
kappa
53547f097e chore: remove TODO.md
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 10:37:52 +09:00
kappa
23e3972fbb docs: add TODO for Anvil troubleshooting enhancement
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 14:31:42 +09:00
kappa
860e36a688 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>
2026-01-27 14:28:22 +09:00
kappa
6392a17d4f refactor: extract common bandwidth formatting utilities
- Add BandwidthInfo interface to types.ts (single source of truth)
- Create formatters.ts with formatTB() and formatTrafficInfo()
- Display CDN hit rate and gross/origin traffic in recommendations
- Fix floating point formatting (consistent decimal places)
- Fix undefined handling in toLocaleString() calls
- Unify overage detection logic (overage_tb > 0 && cost > 0)
- Add CDN hit rate range validation (0-100%)
- Extract CDN_CACHE_HIT_RATES constants

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 12:33:58 +09:00
kappa
0277f0539b fix: Reset session when user says "서버 추천" during active session
When user requests server recommendation while in an existing session
(e.g., selecting state), reset the session and start fresh instead of
continuing the old session context.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 11:59:44 +09:00
kappa
2a258605f2 fix: Server Expert AI JSON parsing and numeric type conversion
- Add response_format: { type: 'json_object' } for review mode to force JSON response
- Convert expectedDau and expectedConcurrent from string to number before API call
- Add enhanced KV session debugging with key names in logs

Fixes:
- AI returning plain text instead of JSON in review mode
- 400 error from recommend API due to string values in expected_users

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 11:36:07 +09:00
kappa
b1bbce5375 fix: allow session cancellation in all states
Previously cancellation only worked in 'selecting' or 'ordering' states.
Now users can cancel server consultation at any stage using keywords:
취소, 다시, 처음, 리셋, 초기화, 다시 시작, 처음부터

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 11:26:54 +09:00
kappa
8815654137 feat: distinguish DAU from concurrent users in Server Expert AI
- Add expectedDau and expectedConcurrent fields to ServerSession
- Update system prompts to explain DAU vs concurrent users concept
- AI now asks for clarification when users mention visitor counts
- Use concurrent users (5-10% of DAU) for server recommendations
- Update inference rules: personal=10, business=50 concurrent users

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 11:15:22 +09:00
kappa
20b4139dd4 feat: add AI review of server recommendations
- Server Expert AI now reviews recommendation results before showing to user
- Changed flow: get recommendations first → AI reviews → show with comments
- AI provides specific advice based on actual recommended specs
- Reviews include: spec adequacy, bandwidth warnings, CDN suggestions

Before: AI gave generic advice without seeing recommendations
After: AI reviews actual results and gives contextual feedback

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 11:08:36 +09:00
kappa
1591202d2f fix: add cancellation keyword handling in server consultation
- Add cancel logic for selecting/ordering states
- Keywords: 취소, 다시, 처음
- Delete session and return to normal conversation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 10:49:31 +09:00
kappa
0c3bfede7d feat: add server selection and order flow after recommendation
- Add 'selecting' and 'ordering' status to ServerSession
- Add lastRecommendation field to store recommendation results
- Keep session alive after recommendation (don't delete immediately)
- Add selection pattern matching (1번, 첫번째, 1번 선택 등)
- Add order confirmation message with inline buttons
- Add server_order/server_cancel callback handlers
- Add ServerOrderKeyboardData type for button data

Flow: recommend → select number → confirm with buttons → order/cancel

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 10:45:04 +09:00