Repository navigation
Expand file tree
/
Copy path__init__.py
More file actions
61 lines (53 loc) · 2.38 KB
/
Copy path__init__.py
File metadata and controls
61 lines (53 loc) · 2.38 KB
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
# ABOUTME: Plugin entry point — registers the Steel browser provider and the
# ABOUTME: steel_scrape tool with the Hermes Agent plugin context.
"""Steel cloud browser plugin for Hermes Agent.
Standalone plugin (not bundled with hermes-agent core, per the project's
third-party-provider policy). The repository root is the plugin package —
install with ``hermes plugins install steel-dev/hermes-steel --enable``,
which clones it into ``~/.hermes/plugins/browser-steel/``.
"""
from __future__ import annotations
def register(ctx) -> None:
"""Register the Steel browser provider, tools, and hooks."""
from .provider import SteelBrowserProvider
from . import scrape_tool
from . import session_note
from . import session_options
ctx.register_browser_provider(SteelBrowserProvider())
# Tag the first browser_* result of each Steel session with the backend
# name and live-viewer URL so the agent can pass both on to the user.
ctx.register_hook("transform_tool_result", session_note.steel_session_note)
ctx.register_tool(
name="steel_session_options",
toolset="browser",
schema=session_options.STEEL_SESSION_OPTIONS_SCHEMA,
handler=lambda args, **kw: session_options.steel_session_options(
use_proxy=args.get("use_proxy"),
solve_captcha=args.get("solve_captcha"),
task_id=kw.get("task_id"),
),
check_fn=scrape_tool.check_steel_scrape_requirements,
requires_env=[],
description=(
"Tune the Steel session's proxy / CAPTCHA solving for the current "
"site, then start a fresh session"
),
)
ctx.register_tool(
name="steel_scrape",
toolset="browser",
schema=scrape_tool.STEEL_SCRAPE_SCHEMA,
handler=lambda args, **kw: scrape_tool.steel_scrape(
url=args.get("url", ""),
format=args.get("format", "markdown"),
),
check_fn=scrape_tool.check_steel_scrape_requirements,
# Cloud Steel requires a key, while a custom STEEL_BASE_URL may be an
# unauthenticated self-hosted deployment. The dynamic check_fn above
# enforces the right requirement for the selected endpoint.
requires_env=[],
description=(
"Server-side webpage extraction as markdown/HTML via Steel's "
"scrape API — no browser session required"
),
)