75 lines
2.6 KiB
Python
75 lines
2.6 KiB
Python
"""Configuration for browser page context capture."""
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class BrowserContextConfig(BaseModel):
|
|
"""Controls the optional Chrome-extension page capture integration."""
|
|
|
|
enabled: bool = Field(
|
|
default=False,
|
|
description="Enable /api/browser-context endpoints for Chrome extension page capture.",
|
|
)
|
|
max_content_chars: int = Field(
|
|
default=200_000,
|
|
ge=1_000,
|
|
description="Maximum captured page text stored per request. Longer content is truncated.",
|
|
)
|
|
max_title_chars: int = Field(
|
|
default=300,
|
|
ge=20,
|
|
description="Maximum title length accepted from the browser extension.",
|
|
)
|
|
max_url_chars: int = Field(
|
|
default=2_048,
|
|
ge=100,
|
|
description="Maximum source URL length accepted from the browser extension.",
|
|
)
|
|
filename_prefix: str = Field(
|
|
default="webpage",
|
|
description="Prefix used for Markdown files created from captured pages.",
|
|
)
|
|
route_base: str = Field(
|
|
default="/page/workspace",
|
|
description="Frontend route base used when returning chat paths to the extension.",
|
|
)
|
|
task_result_timeout_seconds: int = Field(
|
|
default=60,
|
|
ge=5,
|
|
description="Maximum time the browser_fetch_page tool waits for the extension result.",
|
|
)
|
|
task_poll_interval_seconds: float = Field(
|
|
default=1.0,
|
|
ge=0.25,
|
|
description="How often the backend tool checks for a returned browser task result.",
|
|
)
|
|
task_lease_seconds: int = Field(
|
|
default=120,
|
|
ge=10,
|
|
description="How long a claimed browser task is reserved before another extension may retry it.",
|
|
)
|
|
tool_result_max_chars: int = Field(
|
|
default=60_000,
|
|
ge=1_000,
|
|
description="Maximum page characters returned from browser_fetch_page into the model context.",
|
|
)
|
|
actions_enabled: bool = Field(
|
|
default=True,
|
|
description="Enable the interactive browser_act tool (click/type/scroll/wait/navigate on the user's page).",
|
|
)
|
|
action_result_timeout_seconds: int = Field(
|
|
default=45,
|
|
ge=5,
|
|
description="Maximum time the browser_act tool waits for the extension to perform one step and return an observation.",
|
|
)
|
|
max_observed_elements: int = Field(
|
|
default=150,
|
|
ge=10,
|
|
description="Maximum number of interactive elements returned in a browser_act observation.",
|
|
)
|
|
observation_text_max_chars: int = Field(
|
|
default=12_000,
|
|
ge=500,
|
|
description="Maximum page text characters returned alongside a browser_act observation.",
|
|
)
|