xml-pipeline/xml_pipeline/primitives/text_input.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

45 lines
1.2 KiB
Python

"""
TextInput — Generic text message for external/human input.
This primitive allows external sources (console, webhook, API) to send
simple text messages to listeners without needing to know their schema.
Listeners that want to accept human input should handle TextInput.
"""
# Note: Do NOT use `from __future__ import annotations` here
# as it breaks the xmlify decorator which needs concrete types
from dataclasses import dataclass, field
from typing import Optional
from third_party.xmlable import xmlify
@xmlify
@dataclass
class TextInput:
"""
Generic text input from external sources.
Attributes:
text: The message content
source: Origin of the message (console, webhook, api)
user: Authenticated user who sent it (if any)
"""
text: str
source: str = "console"
user: str = "" # Empty string instead of Optional for xmlify compatibility
@xmlify
@dataclass
class TextOutput:
"""
Generic text output for responses to external sources.
Used when a listener wants to send a simple text response
back to the console/webhook/api.
"""
text: str
status: str = "ok" # ok, error, pending