inspect-ai 0.3.92__py3-none-any.whl → 0.3.93__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- inspect_ai/_cli/eval.py +27 -0
- inspect_ai/_eval/eval.py +19 -2
- inspect_ai/_eval/evalset.py +4 -1
- inspect_ai/_eval/run.py +41 -0
- inspect_ai/_eval/task/generate.py +38 -44
- inspect_ai/_eval/task/log.py +26 -28
- inspect_ai/_eval/task/run.py +13 -20
- inspect_ai/_util/local_server.py +368 -0
- inspect_ai/_util/working.py +10 -4
- inspect_ai/_view/www/dist/assets/index.css +159 -146
- inspect_ai/_view/www/dist/assets/index.js +1020 -1061
- inspect_ai/_view/www/log-schema.json +4 -3
- inspect_ai/_view/www/package.json +1 -1
- inspect_ai/_view/www/src/@types/log.d.ts +3 -2
- inspect_ai/_view/www/src/app/content/MetaDataGrid.tsx +2 -2
- inspect_ai/_view/www/src/app/content/MetaDataView.module.css +1 -1
- inspect_ai/_view/www/src/app/content/MetadataGrid.module.css +1 -1
- inspect_ai/_view/www/src/app/content/RenderedContent.tsx +1 -1
- inspect_ai/_view/www/src/app/log-view/LogView.tsx +11 -0
- inspect_ai/_view/www/src/app/log-view/tabs/InfoTab.tsx +2 -9
- inspect_ai/_view/www/src/app/log-view/tabs/ModelsTab.tsx +51 -0
- inspect_ai/_view/www/src/app/log-view/tabs/TaskTab.module.css +6 -0
- inspect_ai/_view/www/src/app/log-view/tabs/TaskTab.tsx +143 -0
- inspect_ai/_view/www/src/app/plan/ModelCard.tsx +1 -2
- inspect_ai/_view/www/src/app/plan/PlanCard.tsx +29 -7
- inspect_ai/_view/www/src/app/plan/PlanDetailView.module.css +1 -1
- inspect_ai/_view/www/src/app/plan/PlanDetailView.tsx +1 -198
- inspect_ai/_view/www/src/app/samples/descriptor/score/NumericScoreDescriptor.tsx +2 -1
- inspect_ai/_view/www/src/app/usage/ModelUsagePanel.tsx +3 -2
- inspect_ai/_view/www/src/app/usage/TokenTable.module.css +4 -1
- inspect_ai/_view/www/src/app/usage/TokenTable.tsx +2 -2
- inspect_ai/_view/www/src/app/usage/UsageCard.module.css +8 -3
- inspect_ai/_view/www/src/app/usage/UsageCard.tsx +1 -35
- inspect_ai/_view/www/src/components/Card.css +0 -1
- inspect_ai/_view/www/src/constants.ts +2 -0
- inspect_ai/_view/www/src/utils/numeric.ts +17 -0
- inspect_ai/agent/_agent.py +3 -3
- inspect_ai/agent/_as_solver.py +20 -12
- inspect_ai/agent/_as_tool.py +15 -3
- inspect_ai/agent/_handoff.py +8 -1
- inspect_ai/agent/_run.py +11 -3
- inspect_ai/log/__init__.py +4 -0
- inspect_ai/log/_file.py +56 -0
- inspect_ai/log/_log.py +99 -0
- inspect_ai/log/_recorders/__init__.py +2 -0
- inspect_ai/log/_recorders/buffer/database.py +12 -11
- inspect_ai/log/_recorders/buffer/filestore.py +2 -2
- inspect_ai/log/_recorders/buffer/types.py +2 -2
- inspect_ai/log/_recorders/eval.py +20 -65
- inspect_ai/log/_recorders/file.py +28 -6
- inspect_ai/log/_recorders/recorder.py +7 -0
- inspect_ai/log/_recorders/types.py +1 -23
- inspect_ai/log/_samples.py +0 -8
- inspect_ai/log/_transcript.py +7 -1
- inspect_ai/log/_util.py +52 -0
- inspect_ai/model/__init__.py +5 -1
- inspect_ai/model/_call_tools.py +32 -12
- inspect_ai/model/_generate_config.py +14 -8
- inspect_ai/model/_model.py +21 -48
- inspect_ai/model/_model_output.py +25 -0
- inspect_ai/model/_openai.py +2 -0
- inspect_ai/model/_providers/anthropic.py +13 -23
- inspect_ai/model/_providers/openai_o1.py +8 -2
- inspect_ai/model/_providers/providers.py +18 -4
- inspect_ai/model/_providers/sglang.py +241 -0
- inspect_ai/model/_providers/vllm.py +207 -400
- inspect_ai/solver/__init__.py +7 -2
- inspect_ai/solver/_basic_agent.py +3 -10
- inspect_ai/solver/_task_state.py +26 -88
- inspect_ai/tool/_json_rpc_helpers.py +45 -17
- inspect_ai/tool/_mcp/_mcp.py +2 -0
- inspect_ai/tool/_mcp/_sandbox.py +8 -2
- inspect_ai/tool/_mcp/server.py +3 -1
- inspect_ai/tool/_tool_call.py +4 -1
- inspect_ai/tool/_tool_support_helpers.py +51 -12
- inspect_ai/tool/_tools/_bash_session.py +190 -68
- inspect_ai/tool/_tools/_computer/_computer.py +25 -1
- inspect_ai/tool/_tools/_text_editor.py +4 -3
- inspect_ai/tool/_tools/_web_browser/_web_browser.py +10 -3
- inspect_ai/util/__init__.py +12 -0
- inspect_ai/util/_limit.py +393 -0
- inspect_ai/util/_limited_conversation.py +57 -0
- {inspect_ai-0.3.92.dist-info → inspect_ai-0.3.93.dist-info}/METADATA +1 -1
- {inspect_ai-0.3.92.dist-info → inspect_ai-0.3.93.dist-info}/RECORD +89 -108
- {inspect_ai-0.3.92.dist-info → inspect_ai-0.3.93.dist-info}/WHEEL +1 -1
- inspect_ai/solver/_limit.py +0 -39
- inspect_ai/tool/_tools/_computer/_resources/Dockerfile +0 -102
- inspect_ai/tool/_tools/_computer/_resources/README.md +0 -30
- inspect_ai/tool/_tools/_computer/_resources/entrypoint/entrypoint.sh +0 -18
- inspect_ai/tool/_tools/_computer/_resources/entrypoint/novnc_startup.sh +0 -20
- inspect_ai/tool/_tools/_computer/_resources/entrypoint/x11vnc_startup.sh +0 -48
- inspect_ai/tool/_tools/_computer/_resources/entrypoint/xfce_startup.sh +0 -13
- inspect_ai/tool/_tools/_computer/_resources/entrypoint/xvfb_startup.sh +0 -48
- inspect_ai/tool/_tools/_computer/_resources/image_home_dir/.config/Code/User/globalStorage/state.vscdb +0 -0
- inspect_ai/tool/_tools/_computer/_resources/image_home_dir/.config/Code/User/settings.json +0 -9
- inspect_ai/tool/_tools/_computer/_resources/image_home_dir/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml +0 -61
- inspect_ai/tool/_tools/_computer/_resources/image_home_dir/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-screensaver.xml +0 -10
- inspect_ai/tool/_tools/_computer/_resources/image_home_dir/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml +0 -91
- inspect_ai/tool/_tools/_computer/_resources/image_home_dir/Desktop/Firefox Web Browser.desktop +0 -10
- inspect_ai/tool/_tools/_computer/_resources/image_home_dir/Desktop/Terminal.desktop +0 -10
- inspect_ai/tool/_tools/_computer/_resources/image_home_dir/Desktop/Visual Studio Code.desktop +0 -10
- inspect_ai/tool/_tools/_computer/_resources/tool/.pylintrc +0 -8
- inspect_ai/tool/_tools/_computer/_resources/tool/.vscode/settings.json +0 -12
- inspect_ai/tool/_tools/_computer/_resources/tool/_args.py +0 -78
- inspect_ai/tool/_tools/_computer/_resources/tool/_constants.py +0 -22
- inspect_ai/tool/_tools/_computer/_resources/tool/_logger.py +0 -22
- inspect_ai/tool/_tools/_computer/_resources/tool/_run.py +0 -42
- inspect_ai/tool/_tools/_computer/_resources/tool/_tool_result.py +0 -33
- inspect_ai/tool/_tools/_computer/_resources/tool/_x11_client.py +0 -341
- inspect_ai/tool/_tools/_computer/_resources/tool/computer_tool.py +0 -141
- inspect_ai/tool/_tools/_computer/_resources/tool/pyproject.toml +0 -65
- inspect_ai/tool/_tools/_computer/_resources/tool/requirements.txt +0 -0
- inspect_ai/tool/_tools/_computer/test_args.py +0 -151
- /inspect_ai/{tool/_tools/_computer/_resources/tool/__init__.py → _view/www/src/app/log-view/tabs/ModelsTab.module.css} +0 -0
- {inspect_ai-0.3.92.dist-info → inspect_ai-0.3.93.dist-info}/entry_points.txt +0 -0
- {inspect_ai-0.3.92.dist-info → inspect_ai-0.3.93.dist-info}/licenses/LICENSE +0 -0
- {inspect_ai-0.3.92.dist-info → inspect_ai-0.3.93.dist-info}/top_level.txt +0 -0
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
set -e
|
3
|
-
|
4
|
-
# remove marker files
|
5
|
-
rm -f /tmp/.X${DISPLAY_NUM}-lock
|
6
|
-
rm -f /tmp/xfce_started
|
7
|
-
|
8
|
-
/opt/inspect/entrypoint/xvfb_startup.sh
|
9
|
-
/opt/inspect/entrypoint/xfce_startup.sh
|
10
|
-
/opt/inspect/entrypoint/x11vnc_startup.sh
|
11
|
-
/opt/inspect/entrypoint/novnc_startup.sh
|
12
|
-
|
13
|
-
# Run CMD if provided
|
14
|
-
echo "Executing CMD from derived Dockerfile: $@"
|
15
|
-
exec "$@"
|
16
|
-
|
17
|
-
# Keep the container running
|
18
|
-
tail -f /dev/null
|
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
echo "starting noVNC"
|
3
|
-
|
4
|
-
# Start noVNC with explicit websocket settings
|
5
|
-
websockify \
|
6
|
-
--web=/usr/share/novnc/ \
|
7
|
-
6080 localhost:5900 \
|
8
|
-
> /tmp/novnc.log 2>&1 &
|
9
|
-
|
10
|
-
# Wait for noVNC to start
|
11
|
-
timeout=10
|
12
|
-
while [ $timeout -gt 0 ]; do
|
13
|
-
if netstat -tuln | grep -q ":6080 "; then
|
14
|
-
break
|
15
|
-
fi
|
16
|
-
sleep 1
|
17
|
-
((timeout--))
|
18
|
-
done
|
19
|
-
|
20
|
-
echo "noVNC started successfully"
|
@@ -1,48 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
echo "starting vnc"
|
3
|
-
|
4
|
-
(x11vnc -display $DISPLAY \
|
5
|
-
-forever \
|
6
|
-
-shared \
|
7
|
-
-wait 50 \
|
8
|
-
-multiptr \
|
9
|
-
-cursor arrow \
|
10
|
-
-rfbport 5900 \
|
11
|
-
-nopw \
|
12
|
-
2>/tmp/x11vnc_stderr.log) &
|
13
|
-
|
14
|
-
x11vnc_pid=$!
|
15
|
-
|
16
|
-
# Wait for x11vnc to start
|
17
|
-
timeout=10
|
18
|
-
while [ $timeout -gt 0 ]; do
|
19
|
-
if netstat -tuln | grep -q ":5900 "; then
|
20
|
-
break
|
21
|
-
fi
|
22
|
-
sleep 1
|
23
|
-
((timeout--))
|
24
|
-
done
|
25
|
-
|
26
|
-
if [ $timeout -eq 0 ]; then
|
27
|
-
echo "x11vnc failed to start, stderr output:" >&2
|
28
|
-
cat /tmp/x11vnc_stderr.log >&2
|
29
|
-
exit 1
|
30
|
-
fi
|
31
|
-
|
32
|
-
: > /tmp/x11vnc_stderr.log
|
33
|
-
|
34
|
-
# Monitor x11vnc process in the background
|
35
|
-
(
|
36
|
-
while true; do
|
37
|
-
if ! kill -0 $x11vnc_pid 2>/dev/null; then
|
38
|
-
echo "x11vnc process crashed, restarting..." >&2
|
39
|
-
if [ -f /tmp/x11vnc_stderr.log ]; then
|
40
|
-
echo "x11vnc stderr output:" >&2
|
41
|
-
cat /tmp/x11vnc_stderr.log >&2
|
42
|
-
rm /tmp/x11vnc_stderr.log
|
43
|
-
fi
|
44
|
-
exec "$0"
|
45
|
-
fi
|
46
|
-
sleep 5
|
47
|
-
done
|
48
|
-
) &
|
@@ -1,48 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
set -e # Exit on error
|
3
|
-
|
4
|
-
DPI=96
|
5
|
-
RES_AND_DEPTH=${WIDTH}x${HEIGHT}x24
|
6
|
-
|
7
|
-
# Function to check if Xvfb is already running
|
8
|
-
check_xvfb_running() {
|
9
|
-
if [ -e /tmp/.X${DISPLAY_NUM}-lock ]; then
|
10
|
-
return 0 # Xvfb is already running
|
11
|
-
else
|
12
|
-
return 1 # Xvfb is not running
|
13
|
-
fi
|
14
|
-
}
|
15
|
-
|
16
|
-
# Function to check if Xvfb is ready
|
17
|
-
wait_for_xvfb() {
|
18
|
-
local timeout=10
|
19
|
-
local start_time=$(date +%s)
|
20
|
-
while ! xdpyinfo >/dev/null 2>&1; do
|
21
|
-
if [ $(($(date +%s) - start_time)) -gt $timeout ]; then
|
22
|
-
echo "Xvfb failed to start within $timeout seconds" >&2
|
23
|
-
return 1
|
24
|
-
fi
|
25
|
-
sleep 0.1
|
26
|
-
done
|
27
|
-
return 0
|
28
|
-
}
|
29
|
-
|
30
|
-
# Check if Xvfb is already running
|
31
|
-
if check_xvfb_running; then
|
32
|
-
echo "Xvfb is already running on display ${DISPLAY}"
|
33
|
-
exit 0
|
34
|
-
fi
|
35
|
-
|
36
|
-
# Start Xvfb
|
37
|
-
Xvfb $DISPLAY -ac -screen 0 $RES_AND_DEPTH -retro -dpi $DPI -nolisten tcp -nolisten unix &
|
38
|
-
XVFB_PID=$!
|
39
|
-
|
40
|
-
# Wait for Xvfb to start
|
41
|
-
if wait_for_xvfb; then
|
42
|
-
echo "Xvfb started successfully on display ${DISPLAY}"
|
43
|
-
echo "Xvfb PID: $XVFB_PID"
|
44
|
-
else
|
45
|
-
echo "Xvfb failed to start"
|
46
|
-
kill $XVFB_PID
|
47
|
-
exit 1
|
48
|
-
fi
|
Binary file
|
@@ -1,61 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
|
3
|
-
<channel name="xfce4-panel" version="1.0">
|
4
|
-
<property name="configver" type="int" value="2"/>
|
5
|
-
<property name="panels" type="array">
|
6
|
-
<value type="int" value="1"/>
|
7
|
-
<property name="dark-mode" type="bool" value="true"/>
|
8
|
-
<property name="panel-1" type="empty">
|
9
|
-
<property name="position" type="string" value="p=6;x=0;y=0"/>
|
10
|
-
<property name="length" type="uint" value="100"/>
|
11
|
-
<property name="position-locked" type="bool" value="true"/>
|
12
|
-
<property name="icon-size" type="uint" value="16"/>
|
13
|
-
<property name="size" type="uint" value="26"/>
|
14
|
-
<property name="plugin-ids" type="array">
|
15
|
-
<value type="int" value="1"/>
|
16
|
-
<value type="int" value="2"/>
|
17
|
-
<value type="int" value="3"/>
|
18
|
-
<value type="int" value="4"/>
|
19
|
-
<value type="int" value="5"/>
|
20
|
-
<value type="int" value="6"/>
|
21
|
-
<value type="int" value="8"/>
|
22
|
-
<value type="int" value="10"/>
|
23
|
-
<value type="int" value="11"/>
|
24
|
-
<value type="int" value="12"/>
|
25
|
-
<value type="int" value="13"/>
|
26
|
-
<value type="int" value="14"/>
|
27
|
-
</property>
|
28
|
-
</property>
|
29
|
-
</property>
|
30
|
-
<property name="plugins" type="empty">
|
31
|
-
<property name="plugin-1" type="string" value="applicationsmenu"/>
|
32
|
-
<property name="plugin-2" type="string" value="tasklist">
|
33
|
-
<property name="grouping" type="uint" value="1"/>
|
34
|
-
</property>
|
35
|
-
<property name="plugin-3" type="string" value="separator">
|
36
|
-
<property name="expand" type="bool" value="true"/>
|
37
|
-
<property name="style" type="uint" value="0"/>
|
38
|
-
</property>
|
39
|
-
<property name="plugin-4" type="string" value="pager"/>
|
40
|
-
<property name="plugin-5" type="string" value="separator">
|
41
|
-
<property name="style" type="uint" value="0"/>
|
42
|
-
</property>
|
43
|
-
<property name="plugin-6" type="string" value="systray">
|
44
|
-
<property name="square-icons" type="bool" value="true"/>
|
45
|
-
</property>
|
46
|
-
<property name="plugin-8" type="string" value="pulseaudio">
|
47
|
-
<property name="enable-keyboard-shortcuts" type="bool" value="true"/>
|
48
|
-
<property name="show-notifications" type="bool" value="true"/>
|
49
|
-
</property>
|
50
|
-
<property name="plugin-9" type="string" value="power-manager-plugin"/>
|
51
|
-
<property name="plugin-10" type="string" value="notification-plugin"/>
|
52
|
-
<property name="plugin-11" type="string" value="separator">
|
53
|
-
<property name="style" type="uint" value="0"/>
|
54
|
-
</property>
|
55
|
-
<property name="plugin-12" type="string" value="clock"/>
|
56
|
-
<property name="plugin-13" type="string" value="separator">
|
57
|
-
<property name="style" type="uint" value="0"/>
|
58
|
-
</property>
|
59
|
-
<property name="plugin-14" type="string" value="actions"/>
|
60
|
-
</property>
|
61
|
-
</channel>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
|
3
|
-
<channel name="xfce4-screensaver" version="1.0">
|
4
|
-
<property name="saver" type="empty">
|
5
|
-
<property name="mode" type="int" value="0" />
|
6
|
-
</property>
|
7
|
-
<property name="lock" type="empty">
|
8
|
-
<property name="enabled" type="bool" value="false" />
|
9
|
-
</property>
|
10
|
-
</channel>
|
@@ -1,91 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
|
3
|
-
<channel name="xfwm4" version="1.0">
|
4
|
-
<property name="general" type="empty">
|
5
|
-
<property name="activate_action" type="string" value="bring" />
|
6
|
-
<property name="borderless_maximize" type="bool" value="true" />
|
7
|
-
<property name="box_move" type="bool" value="false" />
|
8
|
-
<property name="box_resize" type="bool" value="false" />
|
9
|
-
<property name="button_layout" type="string" value="O|SHMC" />
|
10
|
-
<property name="button_offset" type="int" value="0" />
|
11
|
-
<property name="button_spacing" type="int" value="0" />
|
12
|
-
<property name="click_to_focus" type="bool" value="true" />
|
13
|
-
<property name="cycle_apps_only" type="bool" value="false" />
|
14
|
-
<property name="cycle_draw_frame" type="bool" value="true" />
|
15
|
-
<property name="cycle_raise" type="bool" value="false" />
|
16
|
-
<property name="cycle_hidden" type="bool" value="true" />
|
17
|
-
<property name="cycle_minimum" type="bool" value="true" />
|
18
|
-
<property name="cycle_minimized" type="bool" value="false" />
|
19
|
-
<property name="cycle_preview" type="bool" value="true" />
|
20
|
-
<property name="cycle_tabwin_mode" type="int" value="0" />
|
21
|
-
<property name="cycle_workspaces" type="bool" value="false" />
|
22
|
-
<property name="double_click_action" type="string" value="maximize" />
|
23
|
-
<property name="double_click_distance" type="int" value="5" />
|
24
|
-
<property name="double_click_time" type="int" value="250" />
|
25
|
-
<property name="easy_click" type="string" value="Alt" />
|
26
|
-
<property name="focus_delay" type="int" value="250" />
|
27
|
-
<property name="focus_hint" type="bool" value="true" />
|
28
|
-
<property name="focus_new" type="bool" value="true" />
|
29
|
-
<property name="frame_opacity" type="int" value="100" />
|
30
|
-
<property name="frame_border_top" type="int" value="0" />
|
31
|
-
<property name="full_width_title" type="bool" value="true" />
|
32
|
-
<property name="horiz_scroll_opacity" type="bool" value="false" />
|
33
|
-
<property name="inactive_opacity" type="int" value="100" />
|
34
|
-
<property name="maximized_offset" type="int" value="0" />
|
35
|
-
<property name="mousewheel_rollup" type="bool" value="true" />
|
36
|
-
<property name="move_opacity" type="int" value="100" />
|
37
|
-
<property name="placement_mode" type="string" value="center" />
|
38
|
-
<property name="placement_ratio" type="int" value="20" />
|
39
|
-
<property name="popup_opacity" type="int" value="100" />
|
40
|
-
<property name="prevent_focus_stealing" type="bool" value="false" />
|
41
|
-
<property name="raise_delay" type="int" value="250" />
|
42
|
-
<property name="raise_on_click" type="bool" value="true" />
|
43
|
-
<property name="raise_on_focus" type="bool" value="false" />
|
44
|
-
<property name="raise_with_any_button" type="bool" value="true" />
|
45
|
-
<property name="repeat_urgent_blink" type="bool" value="false" />
|
46
|
-
<property name="resize_opacity" type="int" value="100" />
|
47
|
-
<property name="scroll_workspaces" type="bool" value="true" />
|
48
|
-
<property name="shadow_delta_height" type="int" value="0" />
|
49
|
-
<property name="shadow_delta_width" type="int" value="0" />
|
50
|
-
<property name="shadow_delta_x" type="int" value="0" />
|
51
|
-
<property name="shadow_delta_y" type="int" value="-3" />
|
52
|
-
<property name="shadow_opacity" type="int" value="50" />
|
53
|
-
<property name="show_app_icon" type="bool" value="false" />
|
54
|
-
<property name="show_dock_shadow" type="bool" value="true" />
|
55
|
-
<property name="show_frame_shadow" type="bool" value="true" />
|
56
|
-
<property name="show_popup_shadow" type="bool" value="false" />
|
57
|
-
<property name="snap_resist" type="bool" value="false" />
|
58
|
-
<property name="snap_to_border" type="bool" value="true" />
|
59
|
-
<property name="snap_to_windows" type="bool" value="false" />
|
60
|
-
<property name="snap_width" type="int" value="10" />
|
61
|
-
<property name="vblank_mode" type="string" value="auto" />
|
62
|
-
<property name="theme" type="string" value="Default" />
|
63
|
-
<property name="tile_on_move" type="bool" value="true" />
|
64
|
-
<property name="title_alignment" type="string" value="center" />
|
65
|
-
<property name="title_font" type="string" value="Sans Bold 9" />
|
66
|
-
<property name="title_horizontal_offset" type="int" value="0" />
|
67
|
-
<property name="titleless_maximize" type="bool" value="false" />
|
68
|
-
<property name="title_shadow_active" type="string" value="false" />
|
69
|
-
<property name="title_shadow_inactive" type="string" value="false" />
|
70
|
-
<property name="title_vertical_offset_active" type="int" value="0" />
|
71
|
-
<property name="title_vertical_offset_inactive" type="int" value="0" />
|
72
|
-
<property name="toggle_workspaces" type="bool" value="false" />
|
73
|
-
<property name="unredirect_overlays" type="bool" value="true" />
|
74
|
-
<property name="urgent_blink" type="bool" value="false" />
|
75
|
-
<property name="use_compositing" type="bool" value="true" />
|
76
|
-
<property name="workspace_count" type="int" value="1" />
|
77
|
-
<property name="wrap_cycle" type="bool" value="true" />
|
78
|
-
<property name="wrap_layout" type="bool" value="true" />
|
79
|
-
<property name="wrap_resistance" type="int" value="10" />
|
80
|
-
<property name="wrap_windows" type="bool" value="true" />
|
81
|
-
<property name="wrap_workspaces" type="bool" value="false" />
|
82
|
-
<property name="zoom_desktop" type="bool" value="true" />
|
83
|
-
<property name="zoom_pointer" type="bool" value="true" />
|
84
|
-
<property name="workspace_names" type="array">
|
85
|
-
<value type="string" value="Workspace 1" />
|
86
|
-
<value type="string" value="Workspace 2" />
|
87
|
-
<value type="string" value="Workspace 3" />
|
88
|
-
<value type="string" value="Workspace 4" />
|
89
|
-
</property>
|
90
|
-
</property>
|
91
|
-
</channel>
|
@@ -1,78 +0,0 @@
|
|
1
|
-
from argparse import Action, ArgumentParser, Namespace
|
2
|
-
from typing import Sequence
|
3
|
-
|
4
|
-
|
5
|
-
def parse_arguments(args: Sequence[str] | None = None) -> Namespace:
|
6
|
-
return _create_parser().parse_args(args)
|
7
|
-
|
8
|
-
|
9
|
-
def _create_parser() -> ArgumentParser:
|
10
|
-
parser = ArgumentParser(prog="computer_tool")
|
11
|
-
subparsers = parser.add_subparsers(dest="action", required=True)
|
12
|
-
|
13
|
-
# these take no additional arguments
|
14
|
-
subparsers.add_parser(
|
15
|
-
"screenshot",
|
16
|
-
aliases=["cursor_position", "left_mouse_down", "left_mouse_up"],
|
17
|
-
)
|
18
|
-
|
19
|
-
key_and_type = subparsers.add_parser("type", aliases=["key"])
|
20
|
-
_add_text(key_and_type)
|
21
|
-
|
22
|
-
hold_key = subparsers.add_parser("hold_key")
|
23
|
-
_add_text(hold_key)
|
24
|
-
_add_duration(hold_key)
|
25
|
-
|
26
|
-
mouse_move = subparsers.add_parser("mouse_move")
|
27
|
-
_add_coordinate(mouse_move)
|
28
|
-
|
29
|
-
click = subparsers.add_parser(
|
30
|
-
"left_click",
|
31
|
-
aliases=["right_click", "middle_click", "double_click", "triple_click"],
|
32
|
-
)
|
33
|
-
_add_coordinate(click, False)
|
34
|
-
_add_text(click, False)
|
35
|
-
|
36
|
-
left_click_drag = subparsers.add_parser("left_click_drag")
|
37
|
-
_add_start_coordinate(left_click_drag)
|
38
|
-
_add_coordinate(left_click_drag)
|
39
|
-
_add_text(left_click_drag, False)
|
40
|
-
|
41
|
-
scroll = subparsers.add_parser("scroll")
|
42
|
-
_add_scroll_direction(scroll)
|
43
|
-
_add_scroll_amount(scroll)
|
44
|
-
# despite what the doc says, the model doesn't always provide a coordinate
|
45
|
-
_add_coordinate(scroll, False)
|
46
|
-
|
47
|
-
wait = subparsers.add_parser("wait")
|
48
|
-
_add_duration(wait)
|
49
|
-
|
50
|
-
return parser
|
51
|
-
|
52
|
-
|
53
|
-
def _add_scroll_direction(subparser: ArgumentParser) -> Action:
|
54
|
-
return subparser.add_argument(
|
55
|
-
"--scroll_direction", choices=["up", "down", "left", "right"], required=True
|
56
|
-
)
|
57
|
-
|
58
|
-
|
59
|
-
def _add_scroll_amount(subparser: ArgumentParser) -> Action:
|
60
|
-
return subparser.add_argument("--scroll_amount", type=int, required=True)
|
61
|
-
|
62
|
-
|
63
|
-
def _add_coordinate(subparser: ArgumentParser, required: bool = True) -> Action:
|
64
|
-
return subparser.add_argument("--coordinate", type=int, nargs=2, required=required)
|
65
|
-
|
66
|
-
|
67
|
-
def _add_start_coordinate(subparser: ArgumentParser) -> Action:
|
68
|
-
return subparser.add_argument(
|
69
|
-
"--start_coordinate", type=int, nargs=2, required=True
|
70
|
-
)
|
71
|
-
|
72
|
-
|
73
|
-
def _add_duration(subparser: ArgumentParser) -> Action:
|
74
|
-
return subparser.add_argument("--duration", type=int, required=True)
|
75
|
-
|
76
|
-
|
77
|
-
def _add_text(subparser: ArgumentParser, required: bool = True) -> Action:
|
78
|
-
return subparser.add_argument("--text", type=str, required=required)
|
@@ -1,22 +0,0 @@
|
|
1
|
-
from typing import Literal
|
2
|
-
|
3
|
-
Action = Literal[
|
4
|
-
"key",
|
5
|
-
"hold_key",
|
6
|
-
"type",
|
7
|
-
"cursor_position",
|
8
|
-
"mouse_move",
|
9
|
-
"left_mouse_down",
|
10
|
-
"left_mouse_up",
|
11
|
-
"left_click",
|
12
|
-
"left_click_drag",
|
13
|
-
"right_click",
|
14
|
-
"middle_click",
|
15
|
-
"back_click",
|
16
|
-
"forward_click",
|
17
|
-
"double_click",
|
18
|
-
"triple_click",
|
19
|
-
"scroll",
|
20
|
-
"wait",
|
21
|
-
"screenshot",
|
22
|
-
]
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import logging
|
2
|
-
|
3
|
-
|
4
|
-
def setup_logger(level=logging.INFO):
|
5
|
-
"""
|
6
|
-
This logger emits all of its output to PID 1's stdout.
|
7
|
-
|
8
|
-
This makes it so that logging from invocations of the computer_tool cli show up in `docker logs` output.
|
9
|
-
"""
|
10
|
-
new_logger = logging.getLogger("computer_tool")
|
11
|
-
new_logger.setLevel(level)
|
12
|
-
|
13
|
-
stdout_handler = logging.FileHandler("/proc/1/fd/1", mode="w")
|
14
|
-
stdout_handler.setLevel(level)
|
15
|
-
stdout_handler.setFormatter(
|
16
|
-
logging.Formatter("%(name)s(pid=%(process)d) - %(levelname)s - %(message)s")
|
17
|
-
)
|
18
|
-
|
19
|
-
if not new_logger.handlers:
|
20
|
-
new_logger.addHandler(stdout_handler)
|
21
|
-
|
22
|
-
return new_logger
|
@@ -1,42 +0,0 @@
|
|
1
|
-
"""Utility to run shell commands asynchronously with a timeout."""
|
2
|
-
|
3
|
-
import asyncio
|
4
|
-
|
5
|
-
TRUNCATED_MESSAGE: str = "<response clipped><NOTE>To save on context only part of this file has been shown to you. You should retry this tool after you have searched inside the file with `grep -n` in order to find the line numbers of what you are looking for.</NOTE>"
|
6
|
-
MAX_RESPONSE_LEN: int = 16000
|
7
|
-
|
8
|
-
|
9
|
-
def maybe_truncate(content: str, truncate_after: int | None = MAX_RESPONSE_LEN):
|
10
|
-
"""Truncate content and append a notice if content exceeds the specified length."""
|
11
|
-
return (
|
12
|
-
content
|
13
|
-
if not truncate_after or len(content) <= truncate_after
|
14
|
-
else content[:truncate_after] + TRUNCATED_MESSAGE
|
15
|
-
)
|
16
|
-
|
17
|
-
|
18
|
-
async def run(
|
19
|
-
cmd: str,
|
20
|
-
timeout: float | None = 120.0, # seconds
|
21
|
-
truncate_after: int | None = MAX_RESPONSE_LEN,
|
22
|
-
):
|
23
|
-
"""Run a shell command asynchronously with a timeout."""
|
24
|
-
process = await asyncio.create_subprocess_shell(
|
25
|
-
cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
26
|
-
)
|
27
|
-
|
28
|
-
try:
|
29
|
-
stdout, stderr = await asyncio.wait_for(process.communicate(), timeout=timeout)
|
30
|
-
return (
|
31
|
-
process.returncode or 0,
|
32
|
-
maybe_truncate(stdout.decode(), truncate_after=truncate_after),
|
33
|
-
maybe_truncate(stderr.decode(), truncate_after=truncate_after),
|
34
|
-
)
|
35
|
-
except (TimeoutError, asyncio.TimeoutError) as exc:
|
36
|
-
try:
|
37
|
-
process.kill()
|
38
|
-
except ProcessLookupError:
|
39
|
-
pass
|
40
|
-
raise TimeoutError(
|
41
|
-
f"Command '{cmd}' timed out after {timeout} seconds"
|
42
|
-
) from exc
|
@@ -1,33 +0,0 @@
|
|
1
|
-
from dataclasses import dataclass, fields, replace
|
2
|
-
|
3
|
-
|
4
|
-
@dataclass(kw_only=True, frozen=True)
|
5
|
-
class ToolResult:
|
6
|
-
"""Represents the result of a tool execution."""
|
7
|
-
|
8
|
-
output: str | None = None
|
9
|
-
error: str | None = None
|
10
|
-
base64_image: str | None = None
|
11
|
-
|
12
|
-
def __bool__(self):
|
13
|
-
return any(getattr(self, field.name) for field in fields(self))
|
14
|
-
|
15
|
-
def __add__(self, other: "ToolResult"):
|
16
|
-
def combine_fields(
|
17
|
-
field: str | None, other_field: str | None, concatenate: bool = True
|
18
|
-
):
|
19
|
-
if field and other_field:
|
20
|
-
if concatenate:
|
21
|
-
return field + other_field
|
22
|
-
raise ValueError("Cannot combine tool results")
|
23
|
-
return field or other_field
|
24
|
-
|
25
|
-
return ToolResult(
|
26
|
-
output=combine_fields(self.output, other.output),
|
27
|
-
error=combine_fields(self.error, other.error),
|
28
|
-
base64_image=combine_fields(self.base64_image, other.base64_image, False),
|
29
|
-
)
|
30
|
-
|
31
|
-
def replace(self, **kwargs):
|
32
|
-
"""Returns a new ToolResult with the given fields replaced."""
|
33
|
-
return replace(self, **kwargs)
|