25 Commits

Author SHA1 Message Date
a3ac459871 chore: anvil.it.com → inouter.com 2026-03-27 16:19:47 +00:00
3ecfd31c17 chore: anvil.it.com → inouter.com 2026-03-27 16:19:14 +00:00
kappa
7dc43bd331 Add guidance message for non-customers before onboarding redirect
Non-customers attempting to use customer-only features (troubleshoot,
billing, asset) now see a friendly explanation before being handed off
to the onboarding agent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 10:02:48 +09:00
kappa
ae8e72119e Restrict troubleshoot/billing/asset to customers only
Non-customers (no assets and no wallet balance) are redirected to
onboarding agent. Customer check queries servers, domains, DDoS/VPN
services, and wallet balance. Admins bypass the check. On DB error,
defaults to allowing access to prevent false lockouts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 09:38:52 +09:00
kappa
cde2ddc713 Add .deploy-token and .envrc to gitignore, add utility scripts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 09:33:18 +09:00
kappa
3d97190186 Add queue handler and tag-based queue dispatcher
- Add queue() handler in index.ts for WORK_QUEUE processing
- Add consumers/queue-dispatcher.ts with tag-based routing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 09:33:11 +09:00
kappa
4b3cb21a15 Auto-create wallet on first balance check and show deposit info
- billing-agent: auto-create wallet if not exists, include deposit
  account info when balance is 0
- wallet-tool: auto-create wallet on balance check instead of error

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 09:33:03 +09:00
kappa
b9484908c7 Pass chatId/messageId through agent pipeline for sub-agent access
- Add chatId/messageId to AgentToolContext
- Update BaseAgent.processConsultation to accept meta parameter
- Update agent-registry routeToActiveAgent to forward meta
- Fix session end detection to check __SESSION_END__ in finalResponse

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 09:32:55 +09:00
kappa
7dda198f47 Replace D2 rendering with DiagramAgent (Mermaid + Kroki)
- Delete d2-tool.ts and D2_RENDER_URL references
- Add diagram-agent.ts: OpenAI generates Mermaid → Kroki renders PNG → Telegram sendPhoto + R2 cache
- Update onboarding-agent to use generate_diagram tool with DiagramAgent
- Switch wrangler.toml from D2_RENDER_URL to KROKI_URL
- Remove D2 from env-validation, api-urls, tools/index

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 09:32:46 +09:00
kappa
25e56d3f58 Add SK Broadband SNI block pattern (TLS disconnect before handshake)
SK uses different error than KT/LG: "socket disconnected before secure
TLS connection was established" instead of ECONNRESET. Now all 3 Korean
ISPs (KT, LG U+, SK) are correctly detected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 09:28:27 +09:00
kappa
f840e60371 Add SK Broadband inference note when KT/LG blocking detected
No SK eyeball probes available in Globalping, so summary now notes
"SK Broadband 등 다른 통신사에서도 동일하게 차단되었을 것으로 추정"
when KT/LG SNI blocking is detected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 08:51:16 +09:00
kappa
04b322b378 Request eyeball probes separately for reliable ISP block detection
Split HTTP measurements: general probes for performance + eyeball-only
probes (KT, LG U+) for SNI blocking detection. Ensures ISP probes are
always included regardless of random probe selection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 08:49:21 +09:00
kappa
8eb89da6c0 Replace TCP DNS ISP block detection with Globalping SNI block detection
Korean ISPs use SNI-based DPI (not DNS hijacking) to block sites.
TCP DNS queries to ISP servers from Cloudflare Workers returned real IPs
even for blocked domains. Now uses Globalping eyeball probes (KT, LG U+)
to detect ECONNRESET on HTTPS — the signature of SNI-based blocking.

Verified: pornhub.com correctly detected as blocked by Korea Telecom.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 08:45:07 +09:00
kappa
8120c42951 Update CLAUDE.md with network diagnostic and AI intent classification docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 08:32:02 +09:00
kappa
0d24350445 Add Globalping API for Korea-based latency measurement in domain diagnostics
Integrates Globalping API to measure ping and HTTP response times from
Korean probes (Seoul, Chuncheon, Daejeon). Results include per-probe
ping stats and HTTP timing breakdown (DNS, TCP, TLS, TTFB).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 03:33:23 +09:00
kappa
d5600a5d25 Improve intent classification to distinguish billing from asset
예치금/잔액 등 금전 단일 질문은 billing으로, 전체 현황 조회만
asset으로 분류하도록 프롬프트 개선.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 03:09:58 +09:00
kappa
36d50525f1 Fix TCP socket API and skip HTTP port testing in network diagnostic
- Import connect from cloudflare:sockets instead of globalThis
- Fix socket.opened / readable / writable API usage
- Skip TCP test for HTTP ports (80/443) since fetch HEAD already covers
  them; only test user-specified non-HTTP ports (e.g. SSH, DB)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 02:56:39 +09:00
kappa
1ebe765691 Replace pattern-based agent routing with AI intent classification
Instead of regex patterns to detect user intent, use a lightweight AI
call (classifyIntent) that categorizes messages into troubleshoot,
onboarding, billing, asset, or general. This catches ambiguous
expressions like "example.com 좀 봐주세요" that patterns would miss.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 02:38:55 +09:00
kappa
d261d01981 Add network diagnostic tool for domain connectivity troubleshooting
DNS lookup (DoH via Cloudflare/Google), Korean ISP block detection
(KT/LG/SK via TCP DNS), HTTP/HTTPS check, and TCP port test — all
run in parallel with per-check timeouts. Integrated as diagnose_domain
tool in troubleshoot-agent with updated patterns for network keywords.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 02:33:29 +09:00
kappa
0e338aa0fa Fix feedback prompt by returning agent name from route registry
routeToActiveAgent now returns {response, agentName} so the message
handler can reliably determine which agent handled the request. Feedback
is only prompted for troubleshoot and onboarding agents, not billing
or asset single-shot agents.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 20:42:25 +09:00
kappa
42e7f4a72a Only prompt feedback after multi-round agent sessions
Billing and asset agents (single-shot) no longer trigger the star rating
feedback prompt after every response. Feedback is now only requested
after troubleshoot/onboarding sessions or when the conversation had 3+
exchanges in the last hour.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 20:38:35 +09:00
kappa
b213f4d352 Improve single-shot agent to synthesize tool results via AI
Previously, single-shot agents (billing, asset) returned raw JSON tool
results directly to users. Now tool results are sent back to the AI for
natural language synthesis, with graceful fallback to raw results if the
synthesis call fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 20:31:49 +09:00
kappa
f4fa017de0 Update wrangler.toml with actual D1, KV namespace IDs
Replace placeholder IDs with provisioned Cloudflare resource IDs
for D1 database, RATE_LIMIT_KV, SESSION_KV, and CACHE_KV.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 18:35:06 +09:00
kappa
f7046f4c66 Add RAG semantic search and proactive event notifications
Implement hybrid knowledge search using Cloudflare Vectorize + Workers AI
embeddings (bge-base-en-v1.5, 768d) merged with existing D1 LIKE queries,
with graceful degradation when Vectorize is unavailable. Add admin API
endpoints for batch/single article indexing.

Add 4 proactive notification cron jobs: server status changes, deposit
confirmation/rejection alerts, pending payment reminders (1h+), and bank
deposit matching notifications — all with DB-column-based deduplication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 18:09:13 +09:00
kappa
1d6b64c9e4 Initial implementation of Telegram AI customer support bot
Cloudflare Workers + Hono + D1 + KV + R2 stack with 4 specialized AI agents
(onboarding, troubleshoot, asset, billing), OpenAI function calling with
7 tool definitions, human escalation, pending action approval workflow,
feedback collection, audit logging, i18n (ko/en), and Workers AI fallback.

43 source files, 45 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 13:21:38 +09:00