Full pipeline: IMAP ingress -> OpenClaw dispatch -> callback -> SMTP reply. SQLite stateful storage with idempotency, threading, and retry logic. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1.4 KiB
1.4 KiB
Checkpoint 003 — OpenClaw Dispatch
Ngày: 2026-04-24
Trạng thái: ✅ Hoàn thành
Verify: go build ./... thành công
Việc đã làm
OpenClaw Dispatcher (internal/ai_client/client.go)
Chức năng chính:
- Gửi HTTP POST đến OpenClaw API với payload theo spec:
input= body emailsession_id= thread_idhistory= các cặp user/assistant từ tasks COMPLETED cùng threadcallback_url= endpoint nhận kết quảmetadata.task_uuid= ID để callback tìm lại task
Retry logic (đúng requirements 4.2):
- Tối đa 3 lần, backoff: 1s → 5s → 15s
- Mỗi lần retry tăng
attempt_openclaw - Hết retry:
status = FAILED, ghilast_error
HTTP Client:
Transport.Proxy = nil— direct connection, không kế thừa proxy hệ thống- Timeout 30s
- Bearer token auth (nếu
OPENCLAW_API_KEYcó giá trị)
Wiring (cmd/bridge/main.go)
watcher.OnReceived→go dispatcher.Dispatch(task)(async)- Pipeline hoàn chỉnh: IMAP → RECEIVED → AI_PROCESSING → (chờ callback)
Files thay đổi
- Rewrite:
internal/ai_client/client.go(từ stub → full implementation) - Cập nhật:
cmd/bridge/main.go(wire dispatcher)
Tiếp theo
- Callback handler —
POST /callback+ token auth + cập nhậtai_response - SMTP Egress — gửi reply với In-Reply-To/References + retry