wtb 0.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wtb/__init__.py +145 -0
- wtb/api/__init__.py +36 -0
- wtb/api/grpc/__init__.py +42 -0
- wtb/api/grpc/protos/wtb_service.proto +318 -0
- wtb/api/grpc/servicer.py +746 -0
- wtb/api/rest/__init__.py +92 -0
- wtb/api/rest/app.py +265 -0
- wtb/api/rest/dependencies.py +591 -0
- wtb/api/rest/models.py +592 -0
- wtb/api/rest/routes/__init__.py +24 -0
- wtb/api/rest/routes/audit.py +155 -0
- wtb/api/rest/routes/batch_tests.py +253 -0
- wtb/api/rest/routes/executions.py +501 -0
- wtb/api/rest/routes/health.py +85 -0
- wtb/api/rest/routes/workflows.py +312 -0
- wtb/api/websocket/__init__.py +21 -0
- wtb/api/websocket/handlers.py +317 -0
- wtb/application/__init__.py +19 -0
- wtb/application/factories.py +888 -0
- wtb/application/services/__init__.py +181 -0
- wtb/application/services/actor_lifecycle.py +1031 -0
- wtb/application/services/api_services.py +1215 -0
- wtb/application/services/async_execution_controller.py +599 -0
- wtb/application/services/batch_execution_coordinator.py +974 -0
- wtb/application/services/batch_test_runner.py +607 -0
- wtb/application/services/execution_controller.py +1017 -0
- wtb/application/services/external_storage.py +131 -0
- wtb/application/services/graph_loader.py +41 -0
- wtb/application/services/langgraph_node_replacer.py +672 -0
- wtb/application/services/node_replacer.py +297 -0
- wtb/application/services/outbox_controller_decorator.py +232 -0
- wtb/application/services/parity_checker.py +547 -0
- wtb/application/services/project_service.py +403 -0
- wtb/application/services/ray_batch_runner.py +2043 -0
- wtb/application/validators.py +430 -0
- wtb/config.py +707 -0
- wtb/domain/__init__.py +19 -0
- wtb/domain/events/__init__.py +220 -0
- wtb/domain/events/checkpoint_events.py +193 -0
- wtb/domain/events/environment_events.py +186 -0
- wtb/domain/events/execution_events.py +82 -0
- wtb/domain/events/file_processing_events.py +519 -0
- wtb/domain/events/langgraph_events.py +335 -0
- wtb/domain/events/node_events.py +59 -0
- wtb/domain/events/ray_events.py +432 -0
- wtb/domain/events/workspace_events.py +349 -0
- wtb/domain/interfaces/__init__.py +211 -0
- wtb/domain/interfaces/_deprecated.py +59 -0
- wtb/domain/interfaces/api_services.py +647 -0
- wtb/domain/interfaces/async_file_tracking.py +70 -0
- wtb/domain/interfaces/async_repositories.py +268 -0
- wtb/domain/interfaces/async_state_adapter.py +119 -0
- wtb/domain/interfaces/async_unit_of_work.py +91 -0
- wtb/domain/interfaces/batch_coordinator.py +437 -0
- wtb/domain/interfaces/batch_runner.py +215 -0
- wtb/domain/interfaces/checkpoint_store.py +198 -0
- wtb/domain/interfaces/evaluator.py +262 -0
- wtb/domain/interfaces/execution_controller.py +186 -0
- wtb/domain/interfaces/file_processing_repository.py +430 -0
- wtb/domain/interfaces/file_tracking.py +623 -0
- wtb/domain/interfaces/node_executor.py +140 -0
- wtb/domain/interfaces/node_replacer.py +189 -0
- wtb/domain/interfaces/repositories.py +510 -0
- wtb/domain/interfaces/state_adapter.py +425 -0
- wtb/domain/interfaces/unit_of_work.py +113 -0
- wtb/domain/models/__init__.py +138 -0
- wtb/domain/models/audit.py +26 -0
- wtb/domain/models/batch_test.py +367 -0
- wtb/domain/models/checkpoint.py +420 -0
- wtb/domain/models/evaluation.py +169 -0
- wtb/domain/models/file_processing/__init__.py +85 -0
- wtb/domain/models/file_processing/checkpoint_link.py +155 -0
- wtb/domain/models/file_processing/entities.py +454 -0
- wtb/domain/models/file_processing/exceptions.py +74 -0
- wtb/domain/models/file_processing/value_objects.py +181 -0
- wtb/domain/models/integrity.py +279 -0
- wtb/domain/models/node_boundary.py +218 -0
- wtb/domain/models/outbox.py +395 -0
- wtb/domain/models/workflow.py +759 -0
- wtb/domain/models/workspace.py +570 -0
- wtb/infrastructure/__init__.py +101 -0
- wtb/infrastructure/adapters/__init__.py +59 -0
- wtb/infrastructure/adapters/async_langgraph_state_adapter.py +584 -0
- wtb/infrastructure/adapters/inmemory_state_adapter.py +406 -0
- wtb/infrastructure/adapters/langgraph_state_adapter.py +881 -0
- wtb/infrastructure/database/__init__.py +68 -0
- wtb/infrastructure/database/async_repositories/__init__.py +30 -0
- wtb/infrastructure/database/async_repositories/async_core_repositories.py +59 -0
- wtb/infrastructure/database/async_repositories/async_file_processing_repository.py +574 -0
- wtb/infrastructure/database/async_repositories/async_outbox_repository.py +93 -0
- wtb/infrastructure/database/async_repositories/base.py +76 -0
- wtb/infrastructure/database/async_unit_of_work.py +132 -0
- wtb/infrastructure/database/config.py +220 -0
- wtb/infrastructure/database/engine_cache.py +24 -0
- wtb/infrastructure/database/factory.py +148 -0
- wtb/infrastructure/database/file_processing_orm.py +230 -0
- wtb/infrastructure/database/inmemory_unit_of_work.py +663 -0
- wtb/infrastructure/database/mappers/__init__.py +27 -0
- wtb/infrastructure/database/mappers/blob_storage_core.py +329 -0
- wtb/infrastructure/database/mappers/outbox_mapper.py +193 -0
- wtb/infrastructure/database/migrations/002_batch_tests.sql +90 -0
- wtb/infrastructure/database/migrations/003_postgresql_production.sql +156 -0
- wtb/infrastructure/database/migrations/004_consolidate_checkpoint_files.sql +46 -0
- wtb/infrastructure/database/migrations/005_node_boundary_cleanup.sql +36 -0
- wtb/infrastructure/database/migrations/__init__.py +6 -0
- wtb/infrastructure/database/models.py +375 -0
- wtb/infrastructure/database/repositories/__init__.py +34 -0
- wtb/infrastructure/database/repositories/audit_repository.py +123 -0
- wtb/infrastructure/database/repositories/base.py +81 -0
- wtb/infrastructure/database/repositories/batch_test_repository.py +98 -0
- wtb/infrastructure/database/repositories/evaluation_result_repository.py +84 -0
- wtb/infrastructure/database/repositories/execution_repository.py +102 -0
- wtb/infrastructure/database/repositories/file_processing_repository.py +718 -0
- wtb/infrastructure/database/repositories/node_boundary_repository.py +210 -0
- wtb/infrastructure/database/repositories/node_variant_repository.py +128 -0
- wtb/infrastructure/database/repositories/outbox_repository.py +137 -0
- wtb/infrastructure/database/repositories/workflow_repository.py +80 -0
- wtb/infrastructure/database/setup.py +245 -0
- wtb/infrastructure/database/unit_of_work.py +121 -0
- wtb/infrastructure/environment/__init__.py +23 -0
- wtb/infrastructure/environment/providers.py +780 -0
- wtb/infrastructure/environment/uv_manager/__init__.py +40 -0
- wtb/infrastructure/environment/uv_manager/grpc_generated/__init__.py +0 -0
- wtb/infrastructure/environment/uv_manager/grpc_generated/env_manager_pb2.py +86 -0
- wtb/infrastructure/environment/uv_manager/grpc_generated/env_manager_pb2.pyi +336 -0
- wtb/infrastructure/environment/uv_manager/grpc_generated/env_manager_pb2_grpc.py +613 -0
- wtb/infrastructure/environment/venv_cache.py +684 -0
- wtb/infrastructure/events/__init__.py +87 -0
- wtb/infrastructure/events/langgraph_event_bridge.py +625 -0
- wtb/infrastructure/events/metrics_event_listener.py +428 -0
- wtb/infrastructure/events/ray_event_bridge.py +893 -0
- wtb/infrastructure/events/stream_mode_config.py +304 -0
- wtb/infrastructure/events/wtb_audit_trail.py +860 -0
- wtb/infrastructure/events/wtb_event_bus.py +379 -0
- wtb/infrastructure/file_tracking/__init__.py +62 -0
- wtb/infrastructure/file_tracking/async_filetracker_service.py +150 -0
- wtb/infrastructure/file_tracking/async_orphan_cleaner.py +95 -0
- wtb/infrastructure/file_tracking/cleanup_service.py +387 -0
- wtb/infrastructure/file_tracking/filetracker_service.py +831 -0
- wtb/infrastructure/file_tracking/mock_service.py +427 -0
- wtb/infrastructure/file_tracking/ray_filetracker_service.py +359 -0
- wtb/infrastructure/file_tracking/sqlite_service.py +801 -0
- wtb/infrastructure/integrity/__init__.py +6 -0
- wtb/infrastructure/integrity/checker.py +326 -0
- wtb/infrastructure/llm/__init__.py +19 -0
- wtb/infrastructure/llm/openai_langchain.py +462 -0
- wtb/infrastructure/outbox/__init__.py +24 -0
- wtb/infrastructure/outbox/lifecycle.py +455 -0
- wtb/infrastructure/outbox/processor.py +1451 -0
- wtb/infrastructure/stores/__init__.py +19 -0
- wtb/infrastructure/stores/inmemory_checkpoint_store.py +213 -0
- wtb/infrastructure/stores/langgraph_checkpoint_store.py +432 -0
- wtb/infrastructure/workspace/__init__.py +31 -0
- wtb/infrastructure/workspace/manager.py +838 -0
- wtb/py.typed +1 -0
- wtb/sdk/__init__.py +109 -0
- wtb/sdk/_example_graphs.py +51 -0
- wtb/sdk/test_bench.py +1096 -0
- wtb/sdk/workflow_project.py +894 -0
- wtb/testing/__init__.py +22 -0
- wtb/testing/fixtures.py +354 -0
- wtb-0.2.3.dist-info/METADATA +387 -0
- wtb-0.2.3.dist-info/RECORD +166 -0
- wtb-0.2.3.dist-info/WHEEL +5 -0
- wtb-0.2.3.dist-info/licenses/LICENSE +191 -0
- wtb-0.2.3.dist-info/top_level.txt +1 -0
wtb/__init__.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Workflow Test Bench (WTB) - Testing Framework for Agent Git v0.2
|
|
3
|
+
|
|
4
|
+
A DDD-based orchestration layer for workflow testing with:
|
|
5
|
+
- Execution Controller: Manages workflow lifecycle (run/pause/resume/stop)
|
|
6
|
+
- Node Replacer: A/B testing via node variant substitution
|
|
7
|
+
- State Adapters: Pluggable persistence (AgentGit, InMemory, LangGraph)
|
|
8
|
+
- Evaluation Engine: Metrics and scoring
|
|
9
|
+
- External API: REST, WebSocket, gRPC
|
|
10
|
+
- SDK: WorkflowProject, WTBTestBench
|
|
11
|
+
|
|
12
|
+
Architecture follows:
|
|
13
|
+
- SOLID principles
|
|
14
|
+
- Domain-Driven Design
|
|
15
|
+
- Repository + Unit of Work pattern
|
|
16
|
+
- Interface-based abstractions
|
|
17
|
+
|
|
18
|
+
API Usage:
|
|
19
|
+
from wtb.api import create_app
|
|
20
|
+
app = create_app()
|
|
21
|
+
|
|
22
|
+
SDK Usage:
|
|
23
|
+
from wtb.sdk import WorkflowProject, WTBTestBench
|
|
24
|
+
|
|
25
|
+
project = WorkflowProject(name="my_workflow", graph_factory=create_graph)
|
|
26
|
+
wtb = WTBTestBench()
|
|
27
|
+
wtb.register_project(project)
|
|
28
|
+
result = wtb.run(project="my_workflow", initial_state={})
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
__version__ = "0.2.3"
|
|
32
|
+
|
|
33
|
+
# Domain Models
|
|
34
|
+
from wtb.domain.models import (
|
|
35
|
+
TestWorkflow,
|
|
36
|
+
WorkflowNode,
|
|
37
|
+
WorkflowEdge,
|
|
38
|
+
Execution,
|
|
39
|
+
ExecutionState,
|
|
40
|
+
ExecutionStatus,
|
|
41
|
+
NodeVariant,
|
|
42
|
+
NodeBoundary,
|
|
43
|
+
NodeStatus,
|
|
44
|
+
CheckpointFileLink, # 2026-01-27: Renamed from CheckpointFile
|
|
45
|
+
BatchTest,
|
|
46
|
+
BatchTestStatus,
|
|
47
|
+
VariantCombination,
|
|
48
|
+
BatchTestResult,
|
|
49
|
+
EvaluationResult,
|
|
50
|
+
MetricValue,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# Domain Interfaces
|
|
54
|
+
from wtb.domain.interfaces import (
|
|
55
|
+
IExecutionController,
|
|
56
|
+
INodeReplacer,
|
|
57
|
+
IStateAdapter,
|
|
58
|
+
IUnitOfWork,
|
|
59
|
+
CheckpointTrigger,
|
|
60
|
+
CheckpointInfo,
|
|
61
|
+
NodeBoundaryInfo,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# Application Services
|
|
65
|
+
try:
|
|
66
|
+
from wtb.application import (
|
|
67
|
+
ExecutionController,
|
|
68
|
+
NodeReplacer,
|
|
69
|
+
)
|
|
70
|
+
except ImportError:
|
|
71
|
+
ExecutionController = None
|
|
72
|
+
NodeReplacer = None
|
|
73
|
+
|
|
74
|
+
# Infrastructure
|
|
75
|
+
try:
|
|
76
|
+
from wtb.infrastructure import (
|
|
77
|
+
SQLAlchemyUnitOfWork,
|
|
78
|
+
InMemoryStateAdapter,
|
|
79
|
+
)
|
|
80
|
+
except ImportError:
|
|
81
|
+
SQLAlchemyUnitOfWork = None
|
|
82
|
+
InMemoryStateAdapter = None
|
|
83
|
+
|
|
84
|
+
# SDK (lazy import to avoid circular dependencies)
|
|
85
|
+
def _get_sdk():
|
|
86
|
+
"""Lazy import SDK components."""
|
|
87
|
+
from wtb.sdk import (
|
|
88
|
+
WorkflowProject,
|
|
89
|
+
WTBTestBench,
|
|
90
|
+
FileTrackingConfig,
|
|
91
|
+
EnvironmentConfig,
|
|
92
|
+
ExecutionConfig,
|
|
93
|
+
)
|
|
94
|
+
return {
|
|
95
|
+
"WorkflowProject": WorkflowProject,
|
|
96
|
+
"WTBTestBench": WTBTestBench,
|
|
97
|
+
"FileTrackingConfig": FileTrackingConfig,
|
|
98
|
+
"EnvironmentConfig": EnvironmentConfig,
|
|
99
|
+
"ExecutionConfig": ExecutionConfig,
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
# API (lazy import)
|
|
103
|
+
def _get_api():
|
|
104
|
+
"""Lazy import API components."""
|
|
105
|
+
from wtb.api import create_app, get_app
|
|
106
|
+
return {
|
|
107
|
+
"create_app": create_app,
|
|
108
|
+
"get_app": get_app,
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
__all__ = [
|
|
112
|
+
# Version
|
|
113
|
+
"__version__",
|
|
114
|
+
# Domain Models
|
|
115
|
+
"TestWorkflow",
|
|
116
|
+
"WorkflowNode",
|
|
117
|
+
"WorkflowEdge",
|
|
118
|
+
"Execution",
|
|
119
|
+
"ExecutionState",
|
|
120
|
+
"ExecutionStatus",
|
|
121
|
+
"NodeVariant",
|
|
122
|
+
"NodeBoundary",
|
|
123
|
+
"NodeStatus",
|
|
124
|
+
"CheckpointFileLink", # 2026-01-27: Renamed from CheckpointFile
|
|
125
|
+
"BatchTest",
|
|
126
|
+
"BatchTestStatus",
|
|
127
|
+
"VariantCombination",
|
|
128
|
+
"BatchTestResult",
|
|
129
|
+
"EvaluationResult",
|
|
130
|
+
"MetricValue",
|
|
131
|
+
# Domain Interfaces
|
|
132
|
+
"IExecutionController",
|
|
133
|
+
"INodeReplacer",
|
|
134
|
+
"IStateAdapter",
|
|
135
|
+
"IUnitOfWork",
|
|
136
|
+
"CheckpointTrigger",
|
|
137
|
+
"CheckpointInfo",
|
|
138
|
+
"NodeBoundaryInfo",
|
|
139
|
+
# Application Services
|
|
140
|
+
"ExecutionController",
|
|
141
|
+
"NodeReplacer",
|
|
142
|
+
# Infrastructure
|
|
143
|
+
"SQLAlchemyUnitOfWork",
|
|
144
|
+
"InMemoryStateAdapter",
|
|
145
|
+
]
|
wtb/api/__init__.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""
|
|
2
|
+
WTB External API Layer.
|
|
3
|
+
|
|
4
|
+
Provides:
|
|
5
|
+
- REST API (FastAPI) - Port 8000
|
|
6
|
+
- WebSocket for real-time updates - Port 8000/ws
|
|
7
|
+
- gRPC API for internal services - Port 50051
|
|
8
|
+
|
|
9
|
+
Architecture Decision (2026-01-15):
|
|
10
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
11
|
+
|
|
12
|
+
Protocol Selection:
|
|
13
|
+
- REST: Web UI, external clients, CRUD operations
|
|
14
|
+
- WebSocket: Real-time UI updates, execution progress
|
|
15
|
+
- gRPC: Internal services, Ray workers, streaming
|
|
16
|
+
|
|
17
|
+
All protocols share the same Application Service Layer for consistent behavior.
|
|
18
|
+
|
|
19
|
+
Note: FastAPI is an optional dependency. Import create_app/get_app only when needed.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
# Lazy imports - FastAPI is optional
|
|
23
|
+
def create_app(*args, **kwargs):
|
|
24
|
+
"""Create FastAPI app. Requires fastapi to be installed."""
|
|
25
|
+
from .rest.app import create_app as _create_app
|
|
26
|
+
return _create_app(*args, **kwargs)
|
|
27
|
+
|
|
28
|
+
def get_app(*args, **kwargs):
|
|
29
|
+
"""Get FastAPI app instance. Requires fastapi to be installed."""
|
|
30
|
+
from .rest.app import get_app as _get_app
|
|
31
|
+
return _get_app(*args, **kwargs)
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"create_app",
|
|
35
|
+
"get_app",
|
|
36
|
+
]
|
wtb/api/grpc/__init__.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""
|
|
2
|
+
gRPC API for internal services and high-throughput communication.
|
|
3
|
+
|
|
4
|
+
Created: 2026-01-28
|
|
5
|
+
Status: Active
|
|
6
|
+
|
|
7
|
+
Provides:
|
|
8
|
+
- Execution control (start, pause, resume, stop, rollback)
|
|
9
|
+
- Event streaming (execution events, audit events)
|
|
10
|
+
- Batch test management with progress streaming
|
|
11
|
+
- Interactive debugging session (bidirectional)
|
|
12
|
+
|
|
13
|
+
Port: 50051 (default)
|
|
14
|
+
|
|
15
|
+
Usage:
|
|
16
|
+
from wtb.api.grpc import create_grpc_server, WTBServicer
|
|
17
|
+
|
|
18
|
+
servicer = WTBServicer(
|
|
19
|
+
execution_service=execution_api_service,
|
|
20
|
+
audit_service=audit_api_service,
|
|
21
|
+
batch_test_service=batch_test_api_service,
|
|
22
|
+
)
|
|
23
|
+
server = create_grpc_server(servicer, port=50051)
|
|
24
|
+
server.start()
|
|
25
|
+
|
|
26
|
+
Proto Compilation:
|
|
27
|
+
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. wtb_service.proto
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
from .servicer import (
|
|
31
|
+
WTBServicer,
|
|
32
|
+
create_grpc_server,
|
|
33
|
+
create_async_grpc_server,
|
|
34
|
+
GRPC_AVAILABLE,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
__all__ = [
|
|
38
|
+
"WTBServicer",
|
|
39
|
+
"create_grpc_server",
|
|
40
|
+
"create_async_grpc_server",
|
|
41
|
+
"GRPC_AVAILABLE",
|
|
42
|
+
]
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
// WTB gRPC Service Definition
|
|
2
|
+
//
|
|
3
|
+
// Provides high-performance API for:
|
|
4
|
+
// - Execution control
|
|
5
|
+
// - Event streaming
|
|
6
|
+
// - Batch test management
|
|
7
|
+
// - Interactive debugging
|
|
8
|
+
|
|
9
|
+
syntax = "proto3";
|
|
10
|
+
|
|
11
|
+
package wtb.v1;
|
|
12
|
+
|
|
13
|
+
import "google/protobuf/timestamp.proto";
|
|
14
|
+
import "google/protobuf/struct.proto";
|
|
15
|
+
|
|
16
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
17
|
+
// Main WTB Service
|
|
18
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
19
|
+
|
|
20
|
+
service WTBService {
|
|
21
|
+
// Execution Control
|
|
22
|
+
rpc StartExecution(StartExecutionRequest) returns (ExecutionResponse);
|
|
23
|
+
rpc PauseExecution(PauseExecutionRequest) returns (ControlResponse);
|
|
24
|
+
rpc ResumeExecution(ResumeExecutionRequest) returns (ControlResponse);
|
|
25
|
+
rpc StopExecution(StopExecutionRequest) returns (ControlResponse);
|
|
26
|
+
rpc RollbackExecution(RollbackRequest) returns (RollbackResponse);
|
|
27
|
+
|
|
28
|
+
// Execution Streaming (for Ray workers)
|
|
29
|
+
rpc StreamExecutionEvents(ExecutionStreamRequest) returns (stream ExecutionEvent);
|
|
30
|
+
rpc StreamCheckpoints(CheckpointStreamRequest) returns (stream CheckpointEvent);
|
|
31
|
+
|
|
32
|
+
// Batch Testing
|
|
33
|
+
rpc RunBatchTest(BatchTestRequest) returns (stream BatchTestProgress);
|
|
34
|
+
rpc GetBatchTestResults(BatchTestResultsRequest) returns (BatchTestResultsResponse);
|
|
35
|
+
|
|
36
|
+
// Audit Event Streaming
|
|
37
|
+
rpc StreamAuditEvents(AuditStreamRequest) returns (stream AuditEvent);
|
|
38
|
+
|
|
39
|
+
// Bidirectional Control Stream (for interactive debugging)
|
|
40
|
+
rpc InteractiveSession(stream InteractiveCommand) returns (stream InteractiveResponse);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
44
|
+
// Execution Messages
|
|
45
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
46
|
+
|
|
47
|
+
message StartExecutionRequest {
|
|
48
|
+
string workflow_id = 1;
|
|
49
|
+
google.protobuf.Struct initial_state = 2;
|
|
50
|
+
repeated string breakpoints = 3;
|
|
51
|
+
ExecutionConfig config = 4;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
message ExecutionConfig {
|
|
55
|
+
bool enable_file_tracking = 1;
|
|
56
|
+
bool enable_audit = 2;
|
|
57
|
+
int32 checkpoint_interval = 3; // 0 = every node, N = every N nodes
|
|
58
|
+
map<string, string> metadata = 4;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
message ExecutionResponse {
|
|
62
|
+
string execution_id = 1;
|
|
63
|
+
string status = 2;
|
|
64
|
+
string thread_id = 3; // LangGraph thread_id
|
|
65
|
+
google.protobuf.Timestamp started_at = 4;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
message PauseExecutionRequest {
|
|
69
|
+
string execution_id = 1;
|
|
70
|
+
string reason = 2;
|
|
71
|
+
string at_node = 3; // Optional: pause at specific node
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
message ResumeExecutionRequest {
|
|
75
|
+
string execution_id = 1;
|
|
76
|
+
google.protobuf.Struct modified_state = 2; // Optional state modifications
|
|
77
|
+
string from_node = 3; // Optional: resume from specific node
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
message StopExecutionRequest {
|
|
81
|
+
string execution_id = 1;
|
|
82
|
+
string reason = 2;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
message ControlResponse {
|
|
86
|
+
bool success = 1;
|
|
87
|
+
string status = 2;
|
|
88
|
+
string checkpoint_id = 3;
|
|
89
|
+
string message = 4;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
message RollbackRequest {
|
|
93
|
+
string execution_id = 1;
|
|
94
|
+
string checkpoint_id = 2;
|
|
95
|
+
bool create_branch = 3; // Create new session or modify in-place
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
message RollbackResponse {
|
|
99
|
+
bool success = 1;
|
|
100
|
+
string new_session_id = 2; // If branch created
|
|
101
|
+
int32 tools_reversed = 3;
|
|
102
|
+
int32 files_restored = 4;
|
|
103
|
+
google.protobuf.Struct restored_state = 5;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
107
|
+
// Streaming Messages
|
|
108
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
109
|
+
|
|
110
|
+
message ExecutionStreamRequest {
|
|
111
|
+
string execution_id = 1;
|
|
112
|
+
repeated string event_types = 2; // Filter: NODE_START, NODE_END, CHECKPOINT, etc.
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
message ExecutionEvent {
|
|
116
|
+
string event_id = 1;
|
|
117
|
+
string execution_id = 2;
|
|
118
|
+
EventType type = 3;
|
|
119
|
+
google.protobuf.Timestamp timestamp = 4;
|
|
120
|
+
oneof payload {
|
|
121
|
+
NodeStartEvent node_start = 5;
|
|
122
|
+
NodeEndEvent node_end = 6;
|
|
123
|
+
CheckpointEvent checkpoint = 7;
|
|
124
|
+
StateChangeEvent state_change = 8;
|
|
125
|
+
ErrorEvent error = 9;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
enum EventType {
|
|
130
|
+
EVENT_TYPE_UNSPECIFIED = 0;
|
|
131
|
+
NODE_START = 1;
|
|
132
|
+
NODE_END = 2;
|
|
133
|
+
CHECKPOINT_CREATED = 3;
|
|
134
|
+
EXECUTION_PAUSED = 4;
|
|
135
|
+
EXECUTION_RESUMED = 5;
|
|
136
|
+
EXECUTION_COMPLETED = 6;
|
|
137
|
+
EXECUTION_FAILED = 7;
|
|
138
|
+
STATE_MODIFIED = 8;
|
|
139
|
+
ROLLBACK_PERFORMED = 9;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
message NodeStartEvent {
|
|
143
|
+
string node_id = 1;
|
|
144
|
+
string node_name = 2;
|
|
145
|
+
string node_type = 3;
|
|
146
|
+
string entry_checkpoint_id = 4;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
message NodeEndEvent {
|
|
150
|
+
string node_id = 1;
|
|
151
|
+
string node_name = 2;
|
|
152
|
+
bool success = 3;
|
|
153
|
+
int64 duration_ms = 4;
|
|
154
|
+
int32 tool_invocations = 5;
|
|
155
|
+
string exit_checkpoint_id = 6;
|
|
156
|
+
string error = 7;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
message CheckpointEvent {
|
|
160
|
+
string checkpoint_id = 1;
|
|
161
|
+
string node_id = 2;
|
|
162
|
+
string trigger_type = 3; // node_entry, node_exit, manual, auto
|
|
163
|
+
bool has_file_commit = 4;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
message CheckpointStreamRequest {
|
|
167
|
+
string execution_id = 1;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
message StateChangeEvent {
|
|
171
|
+
string source = 1; // manual, tool, rollback
|
|
172
|
+
repeated string changed_keys = 2;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
message ErrorEvent {
|
|
176
|
+
string error_type = 1;
|
|
177
|
+
string message = 2;
|
|
178
|
+
string node_id = 3;
|
|
179
|
+
bool recoverable = 4;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
183
|
+
// Batch Test Messages
|
|
184
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
185
|
+
|
|
186
|
+
message BatchTestRequest {
|
|
187
|
+
string workflow_id = 1;
|
|
188
|
+
repeated VariantCombination variants = 2;
|
|
189
|
+
google.protobuf.Struct initial_state = 3;
|
|
190
|
+
int32 parallelism = 4; // 0 = auto
|
|
191
|
+
bool use_ray = 5;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
message VariantCombination {
|
|
195
|
+
string name = 1;
|
|
196
|
+
map<string, string> node_variants = 2; // node_id -> variant_id
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
message BatchTestProgress {
|
|
200
|
+
string batch_test_id = 1;
|
|
201
|
+
int32 total_variants = 2;
|
|
202
|
+
int32 completed = 3;
|
|
203
|
+
int32 failed = 4;
|
|
204
|
+
VariantProgress current_variant = 5;
|
|
205
|
+
float estimated_remaining_seconds = 6;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
message VariantProgress {
|
|
209
|
+
string variant_name = 1;
|
|
210
|
+
string status = 2; // running, completed, failed
|
|
211
|
+
string current_node = 3;
|
|
212
|
+
float progress_percent = 4;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
message BatchTestResultsRequest {
|
|
216
|
+
string batch_test_id = 1;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
message BatchTestResultsResponse {
|
|
220
|
+
string batch_test_id = 1;
|
|
221
|
+
string status = 2;
|
|
222
|
+
ComparisonMatrix matrix = 3;
|
|
223
|
+
google.protobuf.Timestamp completed_at = 4;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
message ComparisonMatrix {
|
|
227
|
+
repeated string metric_names = 1;
|
|
228
|
+
repeated VariantResult variants = 2;
|
|
229
|
+
string best_variant = 3;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
message VariantResult {
|
|
233
|
+
string variant_name = 1;
|
|
234
|
+
map<string, double> metrics = 2;
|
|
235
|
+
double overall_score = 3;
|
|
236
|
+
string status = 4;
|
|
237
|
+
string error = 5;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
241
|
+
// Audit Stream Messages
|
|
242
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
243
|
+
|
|
244
|
+
message AuditStreamRequest {
|
|
245
|
+
string execution_id = 1; // Optional: filter by execution
|
|
246
|
+
repeated string event_types = 2;
|
|
247
|
+
google.protobuf.Timestamp since = 3;
|
|
248
|
+
bool include_debug = 4;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
message AuditEvent {
|
|
252
|
+
string event_id = 1;
|
|
253
|
+
google.protobuf.Timestamp timestamp = 2;
|
|
254
|
+
string event_type = 3;
|
|
255
|
+
string severity = 4; // info, success, warning, error, debug
|
|
256
|
+
string message = 5;
|
|
257
|
+
string execution_id = 6;
|
|
258
|
+
string node_id = 7;
|
|
259
|
+
google.protobuf.Struct details = 8;
|
|
260
|
+
string error = 9;
|
|
261
|
+
int64 duration_ms = 10;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
265
|
+
// Interactive Session (Bidirectional)
|
|
266
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
267
|
+
|
|
268
|
+
message InteractiveCommand {
|
|
269
|
+
string execution_id = 1;
|
|
270
|
+
oneof command {
|
|
271
|
+
InspectStateCommand inspect_state = 2;
|
|
272
|
+
ModifyStateCommand modify_state = 3;
|
|
273
|
+
SetBreakpointCommand set_breakpoint = 4;
|
|
274
|
+
StepCommand step = 5;
|
|
275
|
+
ContinueCommand continue_exec = 6;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
message InspectStateCommand {
|
|
280
|
+
repeated string keys = 1; // Empty = all keys
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
message ModifyStateCommand {
|
|
284
|
+
google.protobuf.Struct changes = 1;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
message SetBreakpointCommand {
|
|
288
|
+
string node_id = 1;
|
|
289
|
+
bool enabled = 2;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
message StepCommand {
|
|
293
|
+
int32 steps = 1; // Number of nodes to execute
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
message ContinueCommand {
|
|
297
|
+
string until_node = 1; // Optional: run until this node
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
message InteractiveResponse {
|
|
301
|
+
bool success = 1;
|
|
302
|
+
string message = 2;
|
|
303
|
+
oneof payload {
|
|
304
|
+
StateInspectionResult state = 3;
|
|
305
|
+
ExecutionStatusResult status = 4;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
message StateInspectionResult {
|
|
310
|
+
google.protobuf.Struct state = 1;
|
|
311
|
+
string current_node = 2;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
message ExecutionStatusResult {
|
|
315
|
+
string status = 1;
|
|
316
|
+
string current_node = 2;
|
|
317
|
+
string last_checkpoint_id = 3;
|
|
318
|
+
}
|