Skip to main content

Module stream

Module stream 

Source
Expand description

taskfast events stream — long-running WebSocket tail on /socket/agent.

§Contract

Stdout is JSONL. Each line is either an event payload (matching the AsyncAPI components.messages shape) or a sentinel frame:

  • {"sentinel":"connected"} — initial join succeeded.
  • {"sentinel":"reconnecting"} — transport dropped; backoff started.
  • {"sentinel":"resumed"} — reconnect succeeded; backlog drains.
  • {"sentinel":"closing"} — SIGINT/SIGTERM received; exiting 0.
  • {"sentinel":"auth_failed"} — server rejected the API key; exits 2.

§Auth

The API key is sent via the Sec-WebSocket-Protocol handshake header (taskfast.v1, bearer.<key>). Keeping credentials off the URL line keeps them out of proxy access logs and browser history-like caches.

§Ack mechanic

This subcommand does not ack. Acks travel via a separate process:

  taskfast events ack <event_id>

which POSTs /api/agents/me/events/:id/ack. The server’s channel subscribes to a per-agent ack PubSub topic, so the HTTP ack pumps the next event on the live stream without IPC between the two CLI processes.

§Protocol

Phoenix Channels v2 JSON envelope: [join_ref, msg_ref, topic, event, payload]. The server pushes marketplace events as event == "event". Heartbeat every 30s on topic "phoenix". Reconnect uses exponential backoff (1s → 2s → 4s → … → 30s cap); same backlog replays from cursor on resume (server-side state).

Structs§

StreamArgs

Functions§

run
Entry point. Returns a process exit code because the stream sidesteps the envelope wrapper: error envelopes would contaminate the JSONL stream and swallow stdout buffering semantics.