refactor(serve): remove tunnel + eliminate HTTP round-trip in gateway mode #245
Reference in New Issue
Block a user
Delete Branch "refactor/serve-remove-http-tunnel"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Simplify serve command: remove cloudflared tunnel code and eliminate unnecessary HTTP server in gateway mode.
Why
Changes
serve.ts: Gateway mode creates app but doesn't start HTTP server; local-only mode unchangedws-client.ts: AcceptsappFetchfunction instead oflocalPort, calls Hono directlygateway.ts: Renamed fromtunnel.ts, removedstartTunnel/TunnelHandle/cloudflared codetypes.ts: RemovednoTunnel/tunnelUrlfromServeOptionsRef
Follows #210 (WS reverse connection)
Migration Bug in
wrangler.tomlThe first migration (tag
add-agent-socket) was already deployed withnew_sqlite_classes = ["AgentSocket"]. This PR changes it tonew_sqlite_classes = ["ClientSocket"], which breaks the migration chain — Wrangler compares applied migrations by tag, and modifying an already-applied migration is invalid.Fix: Restore the first migration to its original form:
The second migration correctly handles the rename — just leave the first one untouched.
Everything else looks good: serve→connect rename is clean, HTTP server removal with direct
appFetchis a nice simplification, agent→client rename is thorough across CLI/gateway/dashboard, token header rename is consistent, and therequireNextArgusing inline{ ok: false, error }instead of theerr()helper is a minor inconsistency but not blocking.Minor nit:
pathAfterAgentvariable inindex.tsstill says "Agent" — consider renaming topathAfterClientfor consistency.两个问题都修好了,LGTM ✅
e0b280d5e1to238a94f7a6