
    PmjC                       U d Z ddlmZ ddlmZmZ dddi ddg d	d
dddg dddddddddddddddddddddddddddd d!did"d"d#d$d%dg d&d'dd(d dg d)d*d+d,d-dd.dd/dd0dd1d d!did"d"d2d$d3d d!did"d"d4d$d5dg d6d7dd8dd9dd:dd;di d<dd=dd>dd?dd@dAdBddCdDdEddFddGdHgdIddJdDdKddLddMddNddOddPddQddRddSddTddUdVgdWddXddYdZgd[dd\dd]dd^dd_dd`ddaddbdg dcddddeddfddDdgddg dhdiddg djdkdddldmgdndddodddpdd d!didqd,ddrddAdsddAdtddAduddAdvddAdwddAdxddDdyddzdgd{d|Zd}ed~<   ddZdS )uN  Schema for the generic `computer_use` tool.

Model-agnostic. Any tool-calling model can drive this. Vision-capable models
should prefer `capture(mode='som')` then `click(element=N)` — much more
reliable than pixel coordinates. Pixel coordinates remain supported for
models that were trained on them (e.g. Claude's computer-use RL).
    )annotations)AnyDictcomputer_useu  Drive the desktop in the background via cua-driver — screenshots, mouse, keyboard, scroll, drag — without stealing the user's cursor or keyboard focus. Supported on macOS, Windows, and Linux. Preferred workflow: call with action='capture' (mode='som' gives numbered element overlays), then click by `element` index for reliability. Pixel coordinates are supported for models trained on them. Works on any window — hidden, minimized, or behind another app. Requires cua-driver to be installed.objectactionstring)captureclickdouble_clickright_clickmiddle_clickdragscrolltypekey	set_valuewait	list_appslist_windows	focus_appcua_browser_statecua_browser_preparecua_browser_navigatecua_browser_clickcua_browser_typecua_browser_pointercua_browser_dialogcua_browser_set_input_filescua_browser_downloadu
  Which action to perform. `capture` is free (no side effects). All other actions require approval unless auto-approved. Use `set_value` for select/popup elements and sliders — it selects the matching option directly without opening the native menu (no focus steal).)r   enumdescriptionmode)somvisionaxu  Capture mode. `som` (default) is a screenshot with numbered overlays on every interactable element plus the AX tree — best for vision models, lets you click by element index. `vision` is a plain screenshot. `ax` is the accessibility tree only (no image; useful for text-only models).appu  Optional. Limit capture/action to a specific app (by name, e.g. 'Safari', or bundle ID, 'com.apple.Safari'). If omitted, operates on the frontmost app's window. Pass app='screen' (or 'desktop') to capture the OS desktop/shell surface — e.g. to see the wallpaper or click the taskbar. Note: capture is per-window; a single image cannot span multiple monitors, so on a multi-screen setup capture one window or display at a time.)r   r"   pidintegerzqOptional exact process target for action='capture'. Pair with window_id when discovery cannot resolve an X11 app.	window_idzOptional exact native window target for action='capture'. Pair with pid when an external cua-driver list_windows lookup has already identified the window.max_elementsu  Optional cap on the AX `elements` array returned by `action='capture'`. Default 100, hard maximum 1000. Dense UIs (Electron apps such as Obsidian or VS Code, JetBrains IDEs) can publish 500+ AX nodes — capping prevents a single capture from blowing session context. When the cap trims the response, `total_elements` and `truncated_elements` are surfaced in the result so you can re-call with `app=` to narrow scope or raise `max_elements` when the full tree is required. Has no effect on `mode='som'` / `mode='vision'` when a screenshot is included in the response; only the rare image-missing fallback returns an `elements` array and is subject to the cap.d      i  )r   r"   defaultminimummaximumelementzoThe 1-based SOM index returned by the last `capture(mode='som')` call. Strongly preferred over raw coordinates.
coordinatearrayr      zPixel coordinates [x, y] relative to the captured window screenshot (top-left origin). Only use this if no element index is available.)r   itemsminItemsmaxItemsr"   button)leftrightmiddlezMouse button. Defaults to left.	modifiers)
cmdshiftoptionaltctrlfnwinwindowssupermeta)r   r!   z%Modifier keys held during the action.)r   r5   r"   from_elementzSource element index (drag).
to_elementzTarget element index (drag).from_coordinatez3Source [x,y] (drag; use when no element available).to_coordinatez3Target [x,y] (drag; use when no element available).	direction)updownr9   r:   zScroll direction.amountzScroll wheel ticks. Default 3.valuezFor action='set_value': the value to set on the element. For AXPopUpButton / select dropdowns, pass the option's display label (e.g. 'Blue'). For sliders and other AXValue-settable elements, pass the numeric or string value.textz+Text to type (respects the current layout).keyszUKey combo, e.g. 'cmd+s', 'ctrl+alt+t', 'return', 'escape', 'tab'. Use '+' to combine.secondsnumberzSeconds to wait. Max 30.raise_windowbooleanu   Only for action='focus_app'. If true, brings the window to front (DISRUPTS the user). Default false — input is routed to the app without raising, matching the background co-work model.delivery_mode
background
foregroundud  How input is delivered, for the input actions (click, double_click, right_click, drag, scroll, type, key). `background` (DEFAULT) routes input to the target without raising it or stealing focus — the co-work model. `foreground` briefly fronts the window, acts, then restores the prior frontmost app. A `confirmed` effect is done. For `unverifiable`, inspect fresh state before any retry even if escalation is recommended. Escalate only after `suspected_noop` or a structured refusal. Do not predict the rung from the app being Electron/Chromium. Foreground is a visible focus change and needs its own approval.bring_to_frontzOptional and only valid with delivery_mode='foreground'. Explicitly invokes cua-driver's standalone bring_to_front tool before the input; it is never passed as an input property. This persistent focus change has a separate approval scope. Default false.tab_idz4Opaque tab capability returned by cua_browser_state.refz@Current semantic ref from the latest cua_browser_state snapshot.destination_refz3Current destination ref for a typed pointer action.urlzURL for cua_browser_navigate.input_routetrusted	dom_eventzrTyped-browser trust class. Defaults to trusted. dom_event is an explicit downgrade and is never selected silently.snapshot_formatsemantic_v2dom_refs_v1z:Typed-browser snapshot format; semantic_v2 is the default.queryzOptional browser-state query.	scope_refz)Optional current ref to scope a snapshot.continuationz,Continuation minted by the current snapshot.profile_mode)isolated_newisolated_namedexisting_profilezBrowser preparation mode. existing_profile is decided by cua-driver's immutable permission mode: standard requires a certified protected host; explicit Hermes YOLO uses a private unrestricted daemon.profile_namezName for isolated_named setup.z;Explicitly allow launch of a driver-owned isolated browser.)hoverr   r   r   r   z"Operation for cua_browser_pointer.)inspectacceptdismisszHPage JavaScript dialog action; native prompts stay on the native ladder.insert_text
keystrokesz<Delivery form for cua_browser_type; defaults to insert_text.zOpaque page-dialog capability.z'Optional text for a page prompt dialog.z/Explicit paths for cua_browser_set_input_files.z3Approved destination root for cua_browser_download.zTyped pointer horizontal delta.zTyped pointer vertical delta.z$Typed browser viewport x coordinate.z$Typed browser viewport y coordinate.z!Typed browser drag destination x.z!Typed browser drag destination y.zIf true, take a follow-up capture after the action and include it in the response. Saves a round-trip when you need to verify an action's effect.)allow_launchbrowser_pointer_actionbrowser_dialog_actionbrowser_type_mode	dialog_idprompt_textfilesdestination_rootdelta_xdelta_yxyto_xto_ycapture_after)r   
propertiesrequired)namer"   
parametersDict[str, Any]COMPUTER_USE_SCHEMAreturnc                     t           S )z2Return the generic OpenAI function-calling schema.)r        ?/home/thesage/.hermes/hermes-agent/tools/computer_use/schema.pyget_computer_use_schemar   _  s    r   N)r   r   )	__doc__
__future__r   typingr   r   r   __annotations__r   r   r   r   <module>r      sT     # " " " " "         	 z
   4H9" "z
J  ///-	 Kz
b  7 cz
~ !O z
L !@ Mz
\ !* ) ]z
J !' Kz
Z  ),*
 
[z
p  333@ qz
z $     G
 
{z
R Y-KM MSz
V 9+IK KWz
Z  ),1T	   [z
f  ),1T	 gz
t  7772 uz
~ !? z
H  S Iz
 z
\  L ]z
d  ; ez
r  9 sz
| != }z
P  %|4 	 Qz
t !5	 	uz
J  U Kz
R  a Sz
Z  T   [z
b H5TUUcz
d  "K0O	 ez
t  &6[   uz
~ h7VWWz
@ (;fggAz
B X>lmmCz
D  NNN+		 	Ez
X X>^__Yz
 z
\ "\ 
 !RRRC' ' !888i& & !&5]" "
 #+;[\\$,=fgg (+P  !T! ! !)9Z[[ (9XYY"3YZZ"3YZZ%6YZZ%6YZZ "B e	z
 z
 z
v	 J{	~ ~L' L'  L L L L^
     r   