Domain model bridges frontend canvas, database, and xml-pipeline: - nodes.py: AgentNode, ToolNode, GatewayNode with serialization - Built-in tool mappings (calculate, fetch, shell, etc.) - Agent config (prompt, model, temperature) - Gateway config (federation + REST API) - edges.py: Edge connections with conditions - Auto-compute peers from edges - Cycle detection, entry/exit node finding - triggers.py: Webhook, Schedule, Manual, Event triggers - Config dataclasses for each type - Factory functions for common patterns - flow.py: Main Flow class aggregating all components - to_organism_yaml(): Generate xml-pipeline config - from_canvas_json() / to_canvas_json(): React Flow compat - validate(): Check for errors before execution - to_db_dict(): Database serialization Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
53 lines
1.1 KiB
Python
53 lines
1.1 KiB
Python
"""
|
|
BloxServer Domain Model.
|
|
|
|
This module contains the core domain classes that represent flows (teams),
|
|
nodes (agents/tools), edges (connections), and triggers.
|
|
|
|
The domain model serves as the bridge between:
|
|
- Frontend canvas JSON (React Flow)
|
|
- Database storage (FlowRecord)
|
|
- Execution engine (organism.yaml)
|
|
"""
|
|
|
|
from bloxserver.domain.nodes import (
|
|
Node,
|
|
NodeType,
|
|
AgentNode,
|
|
ToolNode,
|
|
GatewayNode,
|
|
)
|
|
from bloxserver.domain.edges import Edge, EdgeCondition
|
|
from bloxserver.domain.triggers import (
|
|
Trigger,
|
|
TriggerType,
|
|
TriggerConfig,
|
|
create_webhook_trigger,
|
|
create_schedule_trigger,
|
|
create_manual_trigger,
|
|
)
|
|
from bloxserver.domain.flow import Flow, FlowSettings, LLMSettings, ValidationError
|
|
|
|
__all__ = [
|
|
# Nodes
|
|
"Node",
|
|
"NodeType",
|
|
"AgentNode",
|
|
"ToolNode",
|
|
"GatewayNode",
|
|
# Edges
|
|
"Edge",
|
|
"EdgeCondition",
|
|
# Triggers
|
|
"Trigger",
|
|
"TriggerType",
|
|
"TriggerConfig",
|
|
"create_webhook_trigger",
|
|
"create_schedule_trigger",
|
|
"create_manual_trigger",
|
|
# Flow
|
|
"Flow",
|
|
"FlowSettings",
|
|
"LLMSettings",
|
|
"ValidationError",
|
|
]
|