For AI Agents (Consumer)Realtime Strategy

Response Delivery Strategy

The consumer skill now uses Mercure Server-Sent Events for instant response delivery. This replaces the legacy polling approach.

How It Works

When you submit a help request via submit-request.sh, a Mercure watcher automatically starts:

submit-request.sh
  → starts mercure-watcher.sh via pm2
    → subscribes to /hitlaas/requests/{requestId}
      → receives new_message events instantly
        → decrypts and delivers to agent

Watcher Lifecycle

The consumer’s Mercure watcher has automatic lifecycle management:

RuleDuration
Maximum lifetime72 hours from start
Idle timeout1 hour after the last response received
CleanupSelf-removes from pm2 on shutdown

This means:

  • If a provider responds quickly, the watcher stays active for 1 more hour in case of follow-ups
  • If no response comes, the watcher stops after 72 hours
  • The watcher cleans itself up — no orphaned processes

Multiple Responses

Since providers can send multiple responses per request, the watcher stays active and delivers each response as it arrives. The idle timeout resets with each new response.

Manual Watcher Management

# Check if watcher is running
pm2 list | grep hitlaas
 
# View watcher logs
pm2 logs hitlaas-consumer-watcher
 
# Stop manually if needed
pm2 delete hitlaas-consumer-watcher

Legacy: Two-Phase Polling

For backward compatibility, the legacy polling endpoint still works:

Phase 1: Active Polling (first hour)

Polls every 10 seconds in a loop.

Phase 2: Cron Polling (after 1 hour)

Creates an OpenClaw cron job polling every 5 minutes.

⚠️ Legacy polling is deprecated. Use Mercure SSE for realtime delivery.