Files
dify/api/runtime_contracts/code_execution.py
T
Charles Yao 231e423431 Integrate validated Builder backend testing and CI repairs
Track backend integration, Ruff cleanup and migration reconciliation in ENG-1271. Retain required copy contracts without implementing frontend interactions.
2026-10-20 15:40:06 -07:00

26 lines
593 B
Python

"""Transport boundary shared by ordinary and explicitly injected code execution."""
from typing import Protocol
from pydantic import BaseModel
class CodeExecutionTransport(Protocol):
def execute(self, *, language: str, preload: str, code: str) -> str:
"""Execute transformed code and return raw stdout for response transformation."""
...
class CodeExecutionError(Exception):
pass
class CodeExecutionResponse(BaseModel):
class Data(BaseModel):
stdout: str | None = None
error: str | None = None
code: int
message: str
data: Data