Job events are emitted through JobContext and logged as envelopes with
job_id and trace_id metadata.
PHP exposes typed messages for progress, heartbeats, streams, logs, metrics, artifacts, and terminal job messages.
$ctx->reportProgress(10, 'started');
$ctx->emitLog('info', 'working');
$ctx->emitMetric('tokens.used', 120, 'tokens');Use subscribe() for live events:
$client->subscribe(['types' => ['log', 'metric']], fn (Envelope $env) => null);PHP currently uses message ids and event-log insertion order for replay.
JobProgress carries percent and an optional message.
$ctx->emitResultChunk('res_x', 'hello, ');
$ctx->emitResultChunk('res_x', 'world', more: false);The client buffers chunks in ARCPClient::$resultChunks.
Use EventEmit for structured custom events and extension message types
for arcpx.* custom envelopes.
cost.* metrics participate in cost.budget enforcement.
Keep subscriber callbacks short and do heavy work outside the read loop.
See samples/result-chunk/, samples/subscribe/, and
samples/reasoning-streams/.