mirror of
https://github.com/langgenius/dify.git
synced 2026-11-11 13:51:25 +08:00
Track backend integration, Ruff cleanup and migration reconciliation in ENG-1271. Retain required copy contracts without implementing frontend interactions.
26 lines
593 B
Python
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
|