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

from __future__ import annotations
from .shellservertoolengine import ShellServerToolEngine
from .shellservertoolenvironment import (
    ShellServerToolEnvironment,
    ShellServerToolEnvironmentTypedDict,
)
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 ShellServerToolConfigTypedDict(TypedDict):
    r"""Configuration for the openrouter:shell server tool"""

    engine: NotRequired[ShellServerToolEngine]
    r"""Which shell engine to use. \"openrouter\" runs commands server-side in the OpenRouter sandbox. \"auto\" (default) keeps the provider's native hosted shell when available (OpenAI); on other providers the call is routed to the OpenRouter sandbox."""
    environment: NotRequired[ShellServerToolEnvironmentTypedDict]
    r"""Server-side execution environment for the shell tool. Only container-backed environments are supported; \"local\" shells are not."""
    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 ShellServerToolConfig(BaseModel):
    r"""Configuration for the openrouter:shell server tool"""

    engine: Annotated[
        Optional[ShellServerToolEngine], PlainValidator(validate_open_enum(False))
    ] = None
    r"""Which shell engine to use. \"openrouter\" runs commands server-side in the OpenRouter sandbox. \"auto\" (default) keeps the provider's native hosted shell when available (OpenAI); on other providers the call is routed to the OpenRouter sandbox."""

    environment: Optional[ShellServerToolEnvironment] = None
    r"""Server-side execution environment for the shell tool. Only container-backed environments are supported; \"local\" shells are not."""

    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)."""
