18 Commits

Author SHA1 Message Date
9c334d8550 chore: anvil.it.com → inouter.com
All checks were successful
TypeScript CI / build (push) Successful in 50s
2026-03-27 16:17:03 +00: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
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
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
5413605347 feat: add telegram-cli web chat interface and /api/chat endpoint
- Add telegram-cli Worker with web chat UI for browser-based bot testing
- Add POST /api/chat authenticated endpoint (Bearer token, production enabled)
- Fix ENVIRONMENT to production in wrangler.toml (was blocking Service Binding)
- Add Service Binding (BOT_WORKER) for Worker-to-Worker communication
- Add cloud-db-schema.sql for local development

telegram-cli features:
- Web UI at GET / with dark theme
- JSON API at POST /api/chat
- Service Binding to telegram-summary-bot Worker

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 04:24:02 +09:00
kappa
1fead51eff feat: add Queue-based server provisioning with security fixes
- Add Cloudflare Queue for async server provisioning
  - Producer: callback-handler.ts sends to queue
  - Consumer: provision-consumer.ts processes orders
  - DLQ: provision-dlq.ts handles failed orders with refund

- Security improvements (from code review):
  - Store password hash instead of plaintext (SHA-256)
  - Exclude root_password from logs
  - Add retryable flag to prevent duplicate instance creation
  - Atomic balance deduction with db.batch()
  - Race condition prevention with UPDATE...WHERE status='pending'
  - Auto-refund on DLQ processing

- Validation improvements:
  - OS image whitelist validation
  - Session required fields validation
  - Queue handler refactoring

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 22:54:15 +09:00
kappa
6563ee0650 feat: add server ordering system with session-based flow
- Add server recommendation integration (SERVER_RECOMMEND worker)
- Implement KV-based session management for multi-step ordering
- Add Linode/Vultr API clients for server provisioning
- Add server-tool for Function Calling support

refactor: major code reorganization (Phase 1-3)

- Remove 443 lines of deprecated callback handlers
- Extract handlers to separate files (message-handler, callback-handler)
- Extract cloud-spec-service, server-recommend-service
- Centralize constants (OS_IMAGES, REGION_FLAGS, NUM_EMOJIS)
- webhook.ts reduced from 1,951 to 30 lines

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:01:38 +09:00
kappa
dab279c765 fix: security hardening and performance improvements
Security:
- Add token+secret auth to /setup-webhook and /webhook-info endpoints
- Disable /api/test in production environment (ENVIRONMENT=production)

Performance:
- Add retryWithBackoff to weather-tool (maxRetries: 2)
- Add KV caching to executeLookupDocs (1h TTL)

Code Quality:
- Centralize error messages in src/constants/messages.ts
- Update 5 files to use centralized error constants

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:35:51 +09:00
kappa
91f50ddc12 fix: critical security improvements
- Apply optimistic locking to deposit-matcher.ts (race condition fix)
- Add timing-safe comparison for API key validation
- Move admin IDs from wrangler.toml vars to secrets
- Add .env.example for secure credential management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:18:21 +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
4eb5bbd3d3 feat(security): API 키 보호, CORS 강화, Rate Limiting KV 전환
보안 개선:
- API 키 하드코딩 제거 (NAMECHEAP_API_KEY_INTERNAL)
- CORS 정책: * → hosting.anvil.it.com 제한
- /health 엔드포인트 DB 정보 노출 방지
- Rate Limiting 인메모리 Map → Cloudflare KV 전환
  - 분산 환경 일관성 보장
  - 재시작 후에도 유지
  - 자동 만료 (TTL)

문서:
- CLAUDE.md Security 섹션 추가
- KV Namespace 설정 가이드 추가
- 배포/마이그레이션 가이드 추가

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 15:20:14 +09:00
kappa
db859efc56 feat: 도메인 인라인 버튼 등록 + cheapest TLD + Cron 자동취소
- 도메인 등록 인라인 버튼 확인 플로우 (domain-register.ts)
- manage_domain에 cheapest action 추가 (가장 저렴한 TLD TOP 15)
- 24시간 경과 입금 대기 자동 취소 Cron (UTC 15:00)
- 거래 내역 한글 라벨 + description 표시
- CLAUDE.md 문서 업데이트

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 15:24:03 +09:00
kappa
89f8ea19f1 fix: Email Routing MIME 파싱 개선 + 레거시 코드 정리
- Email Routing에서 수신한 이메일 파싱 수정
  - Quoted-Printable UTF-8 디코딩 함수 추가
  - HTML <br/> 태그를 줄바꿈으로 변환
  - SMS 키워드 위치 기반 본문 추출

- 레거시 코드 삭제
  - /api/bank-notification 엔드포인트 제거 (Email Routing으로 대체)
  - BANK_API_SECRET 관련 코드 및 문서 제거
  - DEPOSIT_AGENT_ID 제거 (Assistants API → 코드 직접 처리)

- CLI 테스트 클라이언트 개선
  - .env 파일 자동 로드 지원
  - WEBHOOK_SECRET 환경변수 불필요

- 문서 업데이트
  - NAMECHEAP_API_KEY 설명 명확화 (래퍼 인증 키)
  - CLI 테스트 섹션 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 13:12:26 +09:00
kappa
42ab702d1c feat: 도메인 시스템 개선 + 검색 한글→영문 번역
주요 변경:
- Domain Agent 제거, 코드 직접 처리로 전환
- suggest_domains: 등록 가능 도메인만 표시, 10개 미만 시 재시도
- search_web: 한글 검색어 자동 영문 번역 (GPT-4o-mini)
- WHOIS: raw 데이터 파싱으로 상세 정보 추출
- 가격 조회: API 필드명 수정 (register_krw → krw)
- 동적 도구 로딩 시스템 추가
- 문서 정리 및 업데이트

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 11:15:49 +09:00
kappa
9822b28028 feat: Gmail → Apps Script → Worker 입금 알림 연동
- POST /api/bank-notification 엔드포인트 추가
- 하나은행 Web발신 SMS 패턴 파싱 지원
- Gmail message_id 기반 중복 방지
- BANK_API_SECRET 인증 추가
- deposit_transactions 자동 매칭 구현
- 문서 업데이트 (CLAUDE.md, README.md)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 00:09:16 +09:00
kappa
e98bfd3a68 feat: 예치금 시스템 추가 (은행 SMS 자동 매칭)
- manage_deposit Function Calling 추가 (잔액조회, 입금신고, 거래내역, 취소)
- Email Worker로 은행 SMS 파싱 (하나/KB/신한 지원)
- 양방향 자동 매칭: 사용자 신고 ↔ 은행 알림
- D1 테이블: user_deposits, deposit_transactions, bank_notifications
- 관리자 전용: 대기목록 조회, 입금 확인/거절

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 12:29:57 +09:00
kappa
8b2ccf05b5 feat: 도메인 관리 기능 추가 (Domain Agent 연동)
- manage_domain Function Calling 도구 추가
- OpenAI Assistants API 기반 Domain Agent 연동
- Namecheap API 호출 (도메인 목록, 네임서버 관리 등)
- user_domains 테이블로 사용자별 도메인 권한 관리
- 타임스탬프 검증 비활성화 (WEBHOOK_SECRET으로 충분)
- CLAUDE.md 프로젝트 문서 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 08:50:16 +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