Skip to content

Support the new type-safe event system

Choose a tag to compare

@psarno psarno released this 19 Oct 14:17
· 46 commits to main since this release

Updated for Type-Safe Engine API

This release updates the CLI to support the new type-safe event system introduced in dialectus-engine v0.3.0.

Changes

Engine Compatibility

  • Updated to require dialectus-engine>=0.3.0
  • Adopted new type-safe event callback system with enum-based event types
  • Migrated from string-based event types to PhaseEventType and MessageEventType enums

Internal Improvements

  • Type-Safe Callbacks: Event handlers now use strongly-typed enum values instead of string literals
  • Enhanced Type Checking: Full support for Pyright/mypy type validation
  • Better IDE Support: Improved autocomplete and inline documentation for event handling

Code Example

The CLI now uses the new type-safe API internally:

from dialectus.engine.debate_engine.types import (
    MessageEventType,
    PhaseEventType,
    PhaseStartedEventData,
    MessageCompleteEventData,
)

async def phase_callback(
    event: PhaseEventType,
    data: PhaseStartedEventData
):
    if event == PhaseEventType.PHASE_STARTED:
        # Handle phase start
        ...

async def message_callback(
    event: MessageEventType,
    data: MessageStartEventData | MessageCompleteEventData,
):
    if event == MessageEventType.MESSAGE_COMPLETE:
        # Handle message completion
        ...

User-Facing Features

No changes to CLI commands or user interface - all updates are internal improvements that maintain full backward compatibility with existing debate configurations and usage patterns.

Requirements

  • Python >= 3.12
  • dialectus-engine >= 0.3.0 (breaking change in engine)

Upgrade Notes

If you're upgrading from v0.1.x:

  1. The CLI will automatically use the new engine when you update
  2. No changes needed to your debate_config.json files
  3. All CLI commands work exactly as before
# Upgrade to latest versions
pip install --upgrade dialectus-cli

# Or with uv
uv pip install --upgrade dialectus-cli

This release maintains CLI functionality while adopting the improved type safety of the underlying engine, providing a more robust foundation for future development.