ConduitMcp.Ext.Tasks.ListenNotifier (ConduitMCP v0.11.0)

Copy Markdown View Source

The default ConduitMcp.Ext.Tasks.Notifier (experimental, unstable): delivers every task change as notifications/tasks to the subscriptions/listen streams of this node that asked for the task with the taskIds filter (ConduitMcp.Subscriptions.Filter).

The notification's params are the full task state, ConduitMcp.Ext.Tasks.to_wire/1 — what tasks/get would answer at that moment.

A change reaches only streams whose principal owns the task (SV-1): it is published to the topic {:task, owner, task_id}, and a stream registers under that topic with its own ConduitMcp.Principal.id/1, the owner identity tasks/get checks. A stream of another principal is never sent the change, even if it names the task id; a task owned by nil (created without authentication) reaches only unauthenticated streams.

Delivery is node-local, like the rest of ConduitMcp.Subscriptions. A custom notifier replaces this one; call task_changed/1 from it to keep listen delivery:

defmodule MyApp.TaskNotifier do
  @behaviour ConduitMcp.Ext.Tasks.Notifier

  @impl true
  def task_changed(task) do
    ConduitMcp.Ext.Tasks.ListenNotifier.task_changed(task)
    MyApp.Workers.wake(task.task_id)
  end
end

Summary

Functions

Publishes notifications/tasks with the task's state to the listen streams of the task's owner. Call it from a custom notifier to keep listen delivery.

Functions

task_changed(task)

Publishes notifications/tasks with the task's state to the listen streams of the task's owner. Call it from a custom notifier to keep listen delivery.