9 Commits

Author SHA1 Message Date
kappa
fa7d8b2d1a chore: upgrade wrangler 4.63.0, vitest 2.1.9, vitest-pool-workers 0.12.10
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:41:04 +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
87c92e1ed1 refactor: migrate server provisioning to Cloud Orchestrator service
- Remove Queue-based server provisioning (moved to cloud-orchestrator)
- Add manage_server tool with Service Binding to Cloud Orchestrator
- Add CDN cache hit rate estimation based on tech_stack
- Always display bandwidth info (show "포함 범위 내" when no overage)
- Add language auto-detection (ko, ja, zh, en)
- Update system prompt to always call tools fresh
- Add Server System documentation to CLAUDE.md

BREAKING: Server provisioning now requires cloud-orchestrator service

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:26:21 +09:00
kappa
43419a8025 docs: update documentation and add server schema
- Update CLAUDE.md with server provisioning docs
- Add server tables to schema.sql (cloud_providers, instance_specs, etc.)
- Register manage_server tool in tools/index.ts
- Minor fixes to conversation-service and summary-service

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:41:14 +09:00
kappa
f5df0c0ffe feat: add optimistic locking and improve type safety
- Implement optimistic locking for deposit balance updates
  - Prevent race conditions in concurrent deposit requests
  - Add automatic retry with exponential backoff (max 3 attempts)
  - Add version column to user_deposits table

- Improve type safety across codebase
  - Add explicit types for Namecheap API responses
  - Add typed function arguments (ManageDepositArgs, etc.)
  - Remove `any` types from deposit-agent and tool files

- Add reconciliation job for balance integrity verification
  - Compare user_deposits.balance vs SUM(confirmed transactions)
  - Alert admin on discrepancy detection

- Set up test environment with Vitest + Miniflare
  - Add 50+ test cases for deposit system
  - Add helper functions for test data creation

- Update documentation
  - Add migration guide for version columns
  - Document optimistic locking patterns

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 23:23:09 +09:00
kappa
45e0677ab0 refactor: code quality improvements (P3)
## Type Safety
- Add zod runtime validation for external API responses
  * Namecheap API responses (domain-register.ts)
  * n8n webhook responses (n8n-service.ts)
  * User request bodies (routes/api.ts)
  * Replaced unsafe type assertions with safeParse()
  * Proper error handling and logging

## Dead Code Removal
- Remove unused callDepositAgent function (127 lines)
  * Legacy Assistants API code no longer needed
  * Now using direct code execution
  * File reduced from 469 → 345 lines (26.4% reduction)

## Configuration Management
- Extract hardcoded URLs to environment variables
  * Added 7 new vars in wrangler.toml:
    OPENAI_API_BASE, NAMECHEAP_API_URL, WHOIS_API_URL,
    CONTEXT7_API_BASE, BRAVE_API_BASE, WTTR_IN_URL, HOSTING_SITE_URL
  * Updated Env interface in types.ts
  * All URLs have fallback to current production values
  * Enables environment-specific configuration (dev/staging/prod)

## Dependencies
- Add zod 4.3.5 for runtime type validation

## Files Modified
- Configuration: wrangler.toml, types.ts, package.json
- Services: 11 TypeScript files with URL/validation updates
- Total: 15 files, +196/-189 lines

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 22:06:01 +09:00
kappa
410676e322 feat(domain): enhance domain info lookup & handler refactoring
- 도메인 조회(info): 내 도메인 아니면 자동으로 WHOIS 조회 (naver.com 등 지원)
- SMS 파싱: 정규식 실패 시 AI 폴백 로직 추가
- 리팩토링: UserService, ConversationService 분리
- 문서: README.md 및 CODE_REVIEW.md 업데이트
2026-01-19 17:12:07 +09:00
kappa
cbadf99944 feat: CLI 테스트 클라이언트 추가
- /api/test 엔드포인트 추가 (Worker에서 직접 응답 반환)
- scripts/chat.ts CLI 클라이언트
- npm run chat 스크립트 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 11:26:18 +09:00
kappa
1e71e035e7 Initial commit: Telegram bot with Cloudflare Workers
- OpenAI GPT-4o-mini with Function Calling
- Cloudflare D1 for user profiles and message buffer
- Sliding window (3 summaries max) for infinite context
- Tools: weather, search, time, calculator
- Workers AI fallback support
- Webhook security with rate limiting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 13:00:44 +09:00