xml-pipeline/xml_pipeline/primitives/boot.py
dullfig e653d63bc1 Rename agentserver to xml_pipeline, add console example
OSS restructuring for open-core model:
- Rename package from agentserver/ to xml_pipeline/
- Update all imports (44 Python files, 31 docs/configs)
- Update pyproject.toml for OSS distribution (v0.3.0)
- Move prompt_toolkit from core to optional [console] extra
- Remove auth/server/lsp from core optional deps (-> Nextra)

New console example in examples/console/:
- Self-contained demo with handlers and config
- Uses prompt_toolkit (optional, falls back to input())
- No password auth, no TUI, no LSP — just the basics
- Shows how to use xml-pipeline as a library

Import changes:
- from agentserver.* -> from xml_pipeline.*
- CLI entry points updated: xml_pipeline.cli:main

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 21:41:19 -08:00

58 lines
1.6 KiB
Python

"""
boot.py — System boot primitive.
The <boot> message is the first message in every organism's lifetime.
It establishes the root thread from which all other threads descend.
The boot handler:
1. Logs organism startup
2. Initializes any system-level state
All external messages that arrive without a known thread parent
will be registered as children of the boot thread.
Note: The SecureConsole (v3.0) handles the console directly, so the boot
handler no longer sends to a console listener.
"""
from dataclasses import dataclass
import logging
from third_party.xmlable import xmlify
from xml_pipeline.message_bus.message_state import HandlerMetadata, HandlerResponse
logger = logging.getLogger(__name__)
@xmlify
@dataclass
class Boot:
"""
System boot message — first message in organism lifetime.
Injected automatically at startup. Establishes root thread context.
"""
organism_name: str = ""
timestamp: str = ""
listener_count: int = 0
async def handle_boot(payload: Boot, metadata: HandlerMetadata) -> None:
"""
Handle the system boot message.
Logs the boot event. The SecureConsole handles user interaction directly.
"""
logger.info(
f"Organism '{payload.organism_name}' booted at {payload.timestamp} "
f"with {payload.listener_count} listeners. "
f"Root thread: {metadata.thread_id}"
)
# Could initialize system state here:
# - Warm up LLM connections
# - Load cached schemas
# - Pre-populate routing caches
# No response needed - SecureConsole handles user interaction
return None