"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .bashservertoolengine import BashServerToolEngine
from .bashservertoolenvironment import (
    BashServerToolEnvironment,
    BashServerToolEnvironmentTypedDict,
)
from openrouter.types import BaseModel
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class BashServerToolConfigTypedDict(TypedDict):
    r"""Configuration for the openrouter:bash server tool"""

    engine: NotRequired[BashServerToolEngine]
    r"""Which bash engine to use. \"openrouter\" runs commands server-side in the OpenRouter sandbox. \"auto\" (default) and \"native\" use native passthrough, returning the tool call to your application to run client-side; OpenRouter does not execute the commands."""
    environment: NotRequired[BashServerToolEnvironmentTypedDict]
    r"""Execution environment for the bash server tool."""
    sleep_after_seconds: NotRequired[int]
    r"""How long (in seconds) the container stays warm after its last command before sleeping, freeing its capacity slot. Idle-based: each command renews the timer. Defaults to 900 (15 minutes); capped at 2592000 (30 days)."""


class BashServerToolConfig(BaseModel):
    r"""Configuration for the openrouter:bash server tool"""

    engine: Annotated[
        Optional[BashServerToolEngine], PlainValidator(validate_open_enum(False))
    ] = None
    r"""Which bash engine to use. \"openrouter\" runs commands server-side in the OpenRouter sandbox. \"auto\" (default) and \"native\" use native passthrough, returning the tool call to your application to run client-side; OpenRouter does not execute the commands."""

    environment: Optional[BashServerToolEnvironment] = None
    r"""Execution environment for the bash server tool."""

    sleep_after_seconds: Optional[int] = None
    r"""How long (in seconds) the container stays warm after its last command before sleeping, freeing its capacity slot. Idle-based: each command renews the timer. Defaults to 900 (15 minutes); capped at 2592000 (30 days)."""
