"""Streaming Primitives - VM-internal event sources.

These are fundamental to the pathway VM's streaming execution model:
- Timer intervals for scheduled triggers
- Webhook bus for event-driven triggers
- Event bus for internal pathway events

This module is NOT a general-purpose tool library.
It's part of the VM's execution infrastructure.
"""

# ---------------------------------------------------------------------------
# Stub node types for streaming scheduler detection.
# These are marker classes used by StreamingScheduler.execute() to identify
# which nodes produce async event streams vs. normal compute results.
# Concrete implementations may be provided by plugins/extensions.
# ---------------------------------------------------------------------------
from core.pathways.nodes.base import NodeBase
from core.pathways.streaming.event_bus import (
    WEBHOOK_BUS,
    WebhookBus,
)
from core.pathways.streaming.registry import (
    STREAMING_HANDLERS,
    get_streaming_handler,
    register_streaming_handler,
)
from core.pathways.streaming.timer import (
    timer_interval,
    timer_interval_stream,
)
from core.pathways.streaming.webhook import (
    webhook_listen,
    webhook_listen_stream,
    webhook_publish,
)


class EventSourceNode(NodeBase):
    """Marker base for nodes that yield async event streams."""

    type: str = "event_source"


class IntrospectionNode(NodeBase):
    """Marker base for nodes that perform runtime pathway introspection."""

    type: str = "introspection"


__all__ = [
    # Registry
    "STREAMING_HANDLERS",
    "WEBHOOK_BUS",
    # Streaming node types
    "EventSourceNode",
    "IntrospectionNode",
    # Event bus
    "WebhookBus",
    "get_streaming_handler",
    "register_streaming_handler",
    # Timer
    "timer_interval",
    "timer_interval_stream",
    # Webhook
    "webhook_listen",
    "webhook_listen_stream",
    "webhook_publish",
]
