File size: 1,792 Bytes
4cf7fc5
4997b06
 
 
 
a64c042
 
 
 
 
09e0e4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4cf7fc5
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
from enum import StrEnum
from typing import Annotated, NotRequired, TypedDict

from pydantic import AfterValidator, Field

from multi_agent_sdlc.tools.shared.validation import (
    validate_application_arguments,
    validate_file_content,
    validate_project_relative_path,
)

ProjectRelativePath = Annotated[
    str,
    Field(
        min_length=1,
        max_length=500,
        description=(
            "A path relative to the project directory. "
            "Absolute paths and parent-directory traversal are prohibited."
        ),
    ),
    AfterValidator(validate_project_relative_path),
]

FileContent = Annotated[
    str,
    Field(
        max_length=500_000,
        description="Complete UTF-8 text content to write to the file.",
    ),
    AfterValidator(validate_file_content),
]

ExecutionTimeout = Annotated[
    int,
    Field(
        ge=1,
        le=200,
        description="Maximum application execution time in seconds.",
    ),
]

StandardInput = Annotated[
    str,
    Field(
        max_length=10_000,
        description=(
            "Text sent to the application's standard input. Separate "
            "interactive responses with newline characters. Omit this "
            "argument when no standard input is required."
        ),
    ),
]

ApplicationArguments = Annotated[
    list[str],
    Field(
        max_length=50,
        description="Arguments passed directly to the application.",
    ),
    AfterValidator(validate_application_arguments),
]


class ProcessResult(TypedDict):
    command: list[str]
    exit_code: int | None
    stdout: str
    stderr: str
    timed_out: bool
    message: NotRequired[str]


class DockerComposeOperation(StrEnum):
    UP = "up"
    DOWN = "down"
    BUILD = "build"
    CONFIG = "config"
    PS = "ps"