it0/packages/openclaw-bridge
hailin b0801e0983 feat(bridge): DingTalk channel plugin + OpenClaw Protocol v3 rewrite
Core changes:
- src/channels/dingtalk.ts: DingTalk Stream SDK channel (no public IP needed)
  - TokenManager: auto-refresh with refreshPromise mutex (prevents race condition)
  - UserQueue: per-user serial queue, max depth 5
  - MsgDedup: O(1) Map<string,timestamp> with 10min TTL + 10k cap
  - RateLimiter: sliding window 10 msg/min per user
  - ResilientOcClient: 10s heartbeat poll + atomic reconnect guard
  - DingTalkStream: exponential backoff reconnect (2s→60s), immediate ACK
  - replyToUser: sessionWebhook expiry check + 4800-char chunking

- src/openclaw-client.ts: rewritten for correct Protocol v3 wire format
  - Request frame: { type:"req", id, method, params }
  - Challenge-response Ed25519 handshake (connect.challenge → connect req)
  - Correct rpc() with configurable timeoutMs

- src/index.ts: fixed RPC method names
  - agent.run → chat.send with { sessionKey, message, timeoutSeconds }
  - metrics.get → gateway.status

- Dockerfile: adds start-dingtalk.sh COPY + chmod
- supervisord.conf: dingtalk-channel program block (autorestart=unexpected)
- start-dingtalk.sh: exits 0 if DINGTALK_CLIENT_ID unset (no restart loop)
- CHANNEL_DEV_GUIDE.md: full dev guide for future channel integrations

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08 05:10:01 -07:00
..
src feat(bridge): DingTalk channel plugin + OpenClaw Protocol v3 rewrite 2026-03-08 05:10:01 -07:00
CHANNEL_DEV_GUIDE.md feat(bridge): DingTalk channel plugin + OpenClaw Protocol v3 rewrite 2026-03-08 05:10:01 -07:00
Dockerfile feat(bridge): DingTalk channel plugin + OpenClaw Protocol v3 rewrite 2026-03-08 05:10:01 -07:00
README.md feat(openclaw): Phase 1 — server pool + agent instance deployment infrastructure 2026-03-07 11:11:21 -08:00
package-lock.json feat(bridge): DingTalk channel plugin + OpenClaw Protocol v3 rewrite 2026-03-08 05:10:01 -07:00
package.json feat(bridge): DingTalk channel plugin + OpenClaw Protocol v3 rewrite 2026-03-08 05:10:01 -07:00
start-dingtalk.sh feat(bridge): DingTalk channel plugin + OpenClaw Protocol v3 rewrite 2026-03-08 05:10:01 -07:00
supervisord.conf fix(bridge): remove user= from supervisord.conf to fix non-root startup 2026-03-08 05:07:25 -07:00
tsconfig.json feat(openclaw): Phase 1 — server pool + agent instance deployment infrastructure 2026-03-07 11:11:21 -08:00

README.md

IT0 OpenClaw Bridge

Custom Docker image that bundles the official OpenClaw agent with the IT0 Bridge process, enabling IT0's agent-service to manage and monitor OpenClaw instances.

Architecture

Container (single image, two processes via supervisord)
  ├── openclaw gateway  (internal port 18789, NOT exposed)
  └── it0-bridge        (external port 3000, exposed to IT0)
        ├── GET  /health    — liveness probe
        ├── GET  /status    — detailed status
        ├── POST /task      — submit task to OpenClaw
        ├── GET  /sessions  — list sessions
        └── GET  /metrics   — usage metrics

Build & Push

docker build -t it0hub/openclaw-bridge:latest .
docker push it0hub/openclaw-bridge:latest

Environment Variables

Variable Required Description
OPENCLAW_GATEWAY_TOKEN Yes Internal OpenClaw gateway auth token
CLAUDE_API_KEY Yes Anthropic API key (injected by IT0)
IT0_INSTANCE_ID Yes UUID from IT0's agent_instances table
IT0_AGENT_SERVICE_URL Yes IT0 agent-service URL for heartbeat

Deploy (via iAgent SSH)

docker run -d \
  --name openclaw-{instanceId} \
  --restart unless-stopped \
  -p {hostPort}:3000 \
  -v /data/openclaw/{instanceId}:/home/node/.openclaw \
  -e OPENCLAW_GATEWAY_TOKEN={token} \
  -e CLAUDE_API_KEY={claudeApiKey} \
  -e IT0_INSTANCE_ID={instanceId} \
  -e IT0_AGENT_SERVICE_URL=https://it0api.szaiai.com \
  it0hub/openclaw-bridge:latest