northrays 0.1.0__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.
- northrays/__init__.py +245 -0
- northrays/_async/__init__.py +2 -0
- northrays/_async/code_interpreter.py +302 -0
- northrays/_async/computer_use.py +930 -0
- northrays/_async/filesystem.py +1240 -0
- northrays/_async/git.py +391 -0
- northrays/_async/lsp_server.py +256 -0
- northrays/_async/northrays.py +819 -0
- northrays/_async/object_storage.py +190 -0
- northrays/_async/process.py +781 -0
- northrays/_async/sandbox.py +904 -0
- northrays/_async/snapshot.py +262 -0
- northrays/_async/volume.py +94 -0
- northrays/_sync/__init__.py +2 -0
- northrays/_sync/code_interpreter.py +271 -0
- northrays/_sync/computer_use.py +929 -0
- northrays/_sync/filesystem.py +1063 -0
- northrays/_sync/git.py +389 -0
- northrays/_sync/lsp_server.py +256 -0
- northrays/_sync/northrays.py +704 -0
- northrays/_sync/object_storage.py +184 -0
- northrays/_sync/process.py +778 -0
- northrays/_sync/sandbox.py +919 -0
- northrays/_sync/snapshot.py +262 -0
- northrays/_sync/volume.py +94 -0
- northrays/_utils/__init__.py +2 -0
- northrays/_utils/deprecation.py +95 -0
- northrays/_utils/docs_ignore.py +11 -0
- northrays/_utils/enum.py +27 -0
- northrays/_utils/env.py +38 -0
- northrays/_utils/environment.py +23 -0
- northrays/_utils/errors.py +298 -0
- northrays/_utils/otel_decorator.py +331 -0
- northrays/_utils/stream.py +368 -0
- northrays/_utils/timeout.py +484 -0
- northrays/_utils/types.py +16 -0
- northrays/common/__init__.py +2 -0
- northrays/common/charts.py +118 -0
- northrays/common/code_interpreter.py +44 -0
- northrays/common/computer_use.py +44 -0
- northrays/common/errors.py +187 -0
- northrays/common/file_transfer.py +69 -0
- northrays/common/filesystem.py +177 -0
- northrays/common/git.py +13 -0
- northrays/common/image.py +700 -0
- northrays/common/lsp_server.py +45 -0
- northrays/common/northrays.py +202 -0
- northrays/common/process.py +140 -0
- northrays/common/protocols.py +14 -0
- northrays/common/pty.py +65 -0
- northrays/common/sandbox.py +99 -0
- northrays/common/snapshot.py +84 -0
- northrays/common/volume.py +39 -0
- northrays/handle/async_pty_handle.py +323 -0
- northrays/handle/pty_handle.py +341 -0
- northrays/internal/__init__.py +2 -0
- northrays/internal/api_client_proxy.py +22 -0
- northrays/internal/http_client.py +99 -0
- northrays/internal/pool_tracker.py +44 -0
- northrays/internal/shared_session.py +262 -0
- northrays/internal/toolbox_api_client_proxy.py +114 -0
- northrays/internal/urllib3_retry.py +53 -0
- northrays/py.typed +0 -0
- northrays-0.1.0.dist-info/METADATA +211 -0
- northrays-0.1.0.dist-info/RECORD +711 -0
- northrays-0.1.0.dist-info/WHEEL +5 -0
- northrays-0.1.0.dist-info/licenses/LICENSE +191 -0
- northrays-0.1.0.dist-info/licenses/NOTICE +46 -0
- northrays-0.1.0.dist-info/top_level.txt +5 -0
- northrays_api_client/__init__.py +684 -0
- northrays_api_client/api/__init__.py +64 -0
- northrays_api_client/api/admin_api.py +5998 -0
- northrays_api_client/api/api_keys_api.py +1672 -0
- northrays_api_client/api/audit_api.py +402 -0
- northrays_api_client/api/config_api.py +278 -0
- northrays_api_client/api/docker_registry_api.py +1707 -0
- northrays_api_client/api/health_api.py +517 -0
- northrays_api_client/api/jobs_api.py +1185 -0
- northrays_api_client/api/object_storage_api.py +298 -0
- northrays_api_client/api/organizations_api.py +10857 -0
- northrays_api_client/api/preview_api.py +1104 -0
- northrays_api_client/api/regions_api.py +279 -0
- northrays_api_client/api/runners_api.py +2987 -0
- northrays_api_client/api/sandbox_api.py +12813 -0
- northrays_api_client/api/snapshots_api.py +2331 -0
- northrays_api_client/api/toolbox_api.py +20758 -0
- northrays_api_client/api/users_api.py +1304 -0
- northrays_api_client/api/volumes_api.py +1421 -0
- northrays_api_client/api/webhooks_api.py +1135 -0
- northrays_api_client/api_client.py +810 -0
- northrays_api_client/api_response.py +21 -0
- northrays_api_client/configuration.py +607 -0
- northrays_api_client/exceptions.py +219 -0
- northrays_api_client/models/__init__.py +405 -0
- northrays_api_client/models/account_provider.py +105 -0
- northrays_api_client/models/admin_create_runner.py +131 -0
- northrays_api_client/models/admin_get_webhook_status200_response.py +103 -0
- northrays_api_client/models/announcement.py +105 -0
- northrays_api_client/models/api_key_list.py +126 -0
- northrays_api_client/models/api_key_response.py +117 -0
- northrays_api_client/models/audit_log.py +134 -0
- northrays_api_client/models/build_info.py +112 -0
- northrays_api_client/models/command.py +107 -0
- northrays_api_client/models/completion_context.py +105 -0
- northrays_api_client/models/completion_item.py +115 -0
- northrays_api_client/models/completion_list.py +113 -0
- northrays_api_client/models/compressed_screenshot_response.py +107 -0
- northrays_api_client/models/computer_use_start_response.py +105 -0
- northrays_api_client/models/computer_use_status_response.py +103 -0
- northrays_api_client/models/computer_use_stop_response.py +105 -0
- northrays_api_client/models/create_api_key.py +113 -0
- northrays_api_client/models/create_build_info.py +105 -0
- northrays_api_client/models/create_docker_registry.py +111 -0
- northrays_api_client/models/create_linked_account.py +105 -0
- northrays_api_client/models/create_organization.py +105 -0
- northrays_api_client/models/create_organization_invitation.py +110 -0
- northrays_api_client/models/create_organization_quota.py +119 -0
- northrays_api_client/models/create_organization_region_quota.py +169 -0
- northrays_api_client/models/create_organization_role.py +107 -0
- northrays_api_client/models/create_region.py +124 -0
- northrays_api_client/models/create_region_response.py +131 -0
- northrays_api_client/models/create_runner.py +107 -0
- northrays_api_client/models/create_runner_response.py +105 -0
- northrays_api_client/models/create_sandbox.py +156 -0
- northrays_api_client/models/create_sandbox_snapshot.py +105 -0
- northrays_api_client/models/create_session_request.py +103 -0
- northrays_api_client/models/create_snapshot.py +129 -0
- northrays_api_client/models/create_user.py +119 -0
- northrays_api_client/models/create_volume.py +103 -0
- northrays_api_client/models/display_info_response.py +103 -0
- northrays_api_client/models/docker_registry.py +118 -0
- northrays_api_client/models/download_files.py +103 -0
- northrays_api_client/models/execute_request.py +107 -0
- northrays_api_client/models/execute_response.py +105 -0
- northrays_api_client/models/file_info.py +117 -0
- northrays_api_client/models/file_status.py +109 -0
- northrays_api_client/models/fork_sandbox.py +103 -0
- northrays_api_client/models/git_add_request.py +105 -0
- northrays_api_client/models/git_branch_request.py +105 -0
- northrays_api_client/models/git_checkout_request.py +105 -0
- northrays_api_client/models/git_clone_request.py +113 -0
- northrays_api_client/models/git_commit_info.py +111 -0
- northrays_api_client/models/git_commit_request.py +111 -0
- northrays_api_client/models/git_commit_response.py +103 -0
- northrays_api_client/models/git_delete_branch_request.py +105 -0
- northrays_api_client/models/git_repo_request.py +107 -0
- northrays_api_client/models/git_status.py +119 -0
- northrays_api_client/models/gpu_type.py +43 -0
- northrays_api_client/models/health_controller_check200_response.py +156 -0
- northrays_api_client/models/health_controller_check200_response_info_value.py +103 -0
- northrays_api_client/models/health_controller_check503_response.py +156 -0
- northrays_api_client/models/job.py +123 -0
- northrays_api_client/models/job_status.py +45 -0
- northrays_api_client/models/job_type.py +56 -0
- northrays_api_client/models/keyboard_hotkey_request.py +103 -0
- northrays_api_client/models/keyboard_press_request.py +105 -0
- northrays_api_client/models/keyboard_type_request.py +105 -0
- northrays_api_client/models/list_branch_response.py +103 -0
- northrays_api_client/models/list_sandboxes_response.py +118 -0
- northrays_api_client/models/log_entry.py +119 -0
- northrays_api_client/models/lsp_completion_params.py +119 -0
- northrays_api_client/models/lsp_document_request.py +107 -0
- northrays_api_client/models/lsp_location.py +109 -0
- northrays_api_client/models/lsp_server_request.py +105 -0
- northrays_api_client/models/lsp_symbol.py +111 -0
- northrays_api_client/models/match.py +107 -0
- northrays_api_client/models/metric_data_point.py +105 -0
- northrays_api_client/models/metric_series.py +113 -0
- northrays_api_client/models/metrics_response.py +111 -0
- northrays_api_client/models/mouse_click_request.py +109 -0
- northrays_api_client/models/mouse_click_response.py +105 -0
- northrays_api_client/models/mouse_drag_request.py +111 -0
- northrays_api_client/models/mouse_drag_response.py +105 -0
- northrays_api_client/models/mouse_move_request.py +105 -0
- northrays_api_client/models/mouse_move_response.py +105 -0
- northrays_api_client/models/mouse_position.py +105 -0
- northrays_api_client/models/mouse_scroll_request.py +109 -0
- northrays_api_client/models/mouse_scroll_response.py +103 -0
- northrays_api_client/models/northrays_configuration.py +162 -0
- northrays_api_client/models/oidc_config.py +107 -0
- northrays_api_client/models/organization.py +191 -0
- northrays_api_client/models/organization_invitation.py +132 -0
- northrays_api_client/models/organization_role.py +116 -0
- northrays_api_client/models/organization_sandbox_default_limited_network_egress.py +103 -0
- northrays_api_client/models/organization_suspension.py +109 -0
- northrays_api_client/models/organization_usage_overview.py +119 -0
- northrays_api_client/models/organization_user.py +126 -0
- northrays_api_client/models/otel_config.py +110 -0
- northrays_api_client/models/paginated_audit_logs.py +119 -0
- northrays_api_client/models/paginated_jobs.py +117 -0
- northrays_api_client/models/paginated_logs.py +117 -0
- northrays_api_client/models/paginated_sandboxes_deprecated.py +117 -0
- northrays_api_client/models/paginated_snapshots.py +117 -0
- northrays_api_client/models/paginated_traces.py +117 -0
- northrays_api_client/models/poll_jobs_response.py +111 -0
- northrays_api_client/models/port_preview_url.py +107 -0
- northrays_api_client/models/position.py +105 -0
- northrays_api_client/models/posthog_config.py +105 -0
- northrays_api_client/models/process_errors_response.py +105 -0
- northrays_api_client/models/process_logs_response.py +105 -0
- northrays_api_client/models/process_restart_response.py +105 -0
- northrays_api_client/models/process_status_response.py +105 -0
- northrays_api_client/models/project_dir_response.py +103 -0
- northrays_api_client/models/pty_create_request.py +113 -0
- northrays_api_client/models/pty_create_response.py +103 -0
- northrays_api_client/models/pty_list_response.py +111 -0
- northrays_api_client/models/pty_resize_request.py +105 -0
- northrays_api_client/models/pty_session_info.py +117 -0
- northrays_api_client/models/range.py +112 -0
- northrays_api_client/models/rate_limit_config.py +122 -0
- northrays_api_client/models/rate_limit_entry.py +105 -0
- northrays_api_client/models/regenerate_api_key_response.py +103 -0
- northrays_api_client/models/region.py +140 -0
- northrays_api_client/models/region_quota.py +168 -0
- northrays_api_client/models/region_screenshot_response.py +107 -0
- northrays_api_client/models/region_type.py +44 -0
- northrays_api_client/models/region_usage_overview.py +174 -0
- northrays_api_client/models/registry_push_access_dto.py +113 -0
- northrays_api_client/models/replace_request.py +107 -0
- northrays_api_client/models/replace_result.py +107 -0
- northrays_api_client/models/resize_sandbox.py +108 -0
- northrays_api_client/models/runner.py +166 -0
- northrays_api_client/models/runner_class.py +42 -0
- northrays_api_client/models/runner_full.py +171 -0
- northrays_api_client/models/runner_health_metrics.py +129 -0
- northrays_api_client/models/runner_healthcheck.py +125 -0
- northrays_api_client/models/runner_service_health.py +107 -0
- northrays_api_client/models/runner_snapshot_dto.py +107 -0
- northrays_api_client/models/runner_state.py +46 -0
- northrays_api_client/models/sandbox.py +188 -0
- northrays_api_client/models/sandbox_class.py +45 -0
- northrays_api_client/models/sandbox_desired_state.py +47 -0
- northrays_api_client/models/sandbox_labels.py +103 -0
- northrays_api_client/models/sandbox_list_item.py +161 -0
- northrays_api_client/models/sandbox_list_sort_direction.py +43 -0
- northrays_api_client/models/sandbox_list_sort_field.py +47 -0
- northrays_api_client/models/sandbox_state.py +63 -0
- northrays_api_client/models/sandbox_volume.py +107 -0
- northrays_api_client/models/screenshot_response.py +107 -0
- northrays_api_client/models/search_files_response.py +103 -0
- northrays_api_client/models/send_webhook_dto.py +108 -0
- northrays_api_client/models/session.py +118 -0
- northrays_api_client/models/session_execute_request.py +107 -0
- northrays_api_client/models/session_execute_response.py +107 -0
- northrays_api_client/models/set_snapshot_general_status_dto.py +103 -0
- northrays_api_client/models/signed_port_preview_url.py +109 -0
- northrays_api_client/models/snapshot_dto.py +172 -0
- northrays_api_client/models/snapshot_manager_credentials.py +105 -0
- northrays_api_client/models/snapshot_state.py +49 -0
- northrays_api_client/models/ssh_access_dto.py +116 -0
- northrays_api_client/models/ssh_access_validation_dto.py +105 -0
- northrays_api_client/models/storage_access_dto.py +113 -0
- northrays_api_client/models/toolbox_proxy_url.py +103 -0
- northrays_api_client/models/trace_span.py +119 -0
- northrays_api_client/models/trace_summary.py +115 -0
- northrays_api_client/models/update_docker_registry.py +111 -0
- northrays_api_client/models/update_job_status.py +108 -0
- northrays_api_client/models/update_organization_default_region.py +103 -0
- northrays_api_client/models/update_organization_invitation.py +108 -0
- northrays_api_client/models/update_organization_member_access.py +105 -0
- northrays_api_client/models/update_organization_quota.py +192 -0
- northrays_api_client/models/update_organization_region_quota.py +189 -0
- northrays_api_client/models/update_organization_role.py +107 -0
- northrays_api_client/models/update_region.py +122 -0
- northrays_api_client/models/update_sandbox_network_settings.py +107 -0
- northrays_api_client/models/update_sandbox_state_dto.py +107 -0
- northrays_api_client/models/url.py +103 -0
- northrays_api_client/models/user.py +120 -0
- northrays_api_client/models/user_home_dir_response.py +103 -0
- northrays_api_client/models/user_public_key.py +105 -0
- northrays_api_client/models/volume_dto.py +128 -0
- northrays_api_client/models/volume_state.py +48 -0
- northrays_api_client/models/webhook_app_portal_access.py +105 -0
- northrays_api_client/models/webhook_event.py +48 -0
- northrays_api_client/models/webhook_initialization_status.py +123 -0
- northrays_api_client/models/windows_response.py +105 -0
- northrays_api_client/models/work_dir_response.py +103 -0
- northrays_api_client/py.typed +0 -0
- northrays_api_client/rest.py +264 -0
- northrays_api_client_async/__init__.py +684 -0
- northrays_api_client_async/api/__init__.py +64 -0
- northrays_api_client_async/api/admin_api.py +5998 -0
- northrays_api_client_async/api/api_keys_api.py +1672 -0
- northrays_api_client_async/api/audit_api.py +402 -0
- northrays_api_client_async/api/config_api.py +278 -0
- northrays_api_client_async/api/docker_registry_api.py +1707 -0
- northrays_api_client_async/api/health_api.py +517 -0
- northrays_api_client_async/api/jobs_api.py +1185 -0
- northrays_api_client_async/api/object_storage_api.py +298 -0
- northrays_api_client_async/api/organizations_api.py +10857 -0
- northrays_api_client_async/api/preview_api.py +1104 -0
- northrays_api_client_async/api/regions_api.py +279 -0
- northrays_api_client_async/api/runners_api.py +2987 -0
- northrays_api_client_async/api/sandbox_api.py +12813 -0
- northrays_api_client_async/api/snapshots_api.py +2331 -0
- northrays_api_client_async/api/toolbox_api.py +20758 -0
- northrays_api_client_async/api/users_api.py +1304 -0
- northrays_api_client_async/api/volumes_api.py +1421 -0
- northrays_api_client_async/api/webhooks_api.py +1135 -0
- northrays_api_client_async/api_client.py +813 -0
- northrays_api_client_async/api_response.py +21 -0
- northrays_api_client_async/configuration.py +605 -0
- northrays_api_client_async/exceptions.py +219 -0
- northrays_api_client_async/models/__init__.py +405 -0
- northrays_api_client_async/models/account_provider.py +105 -0
- northrays_api_client_async/models/admin_create_runner.py +131 -0
- northrays_api_client_async/models/admin_get_webhook_status200_response.py +103 -0
- northrays_api_client_async/models/announcement.py +105 -0
- northrays_api_client_async/models/api_key_list.py +126 -0
- northrays_api_client_async/models/api_key_response.py +117 -0
- northrays_api_client_async/models/audit_log.py +134 -0
- northrays_api_client_async/models/build_info.py +112 -0
- northrays_api_client_async/models/command.py +107 -0
- northrays_api_client_async/models/completion_context.py +105 -0
- northrays_api_client_async/models/completion_item.py +115 -0
- northrays_api_client_async/models/completion_list.py +113 -0
- northrays_api_client_async/models/compressed_screenshot_response.py +107 -0
- northrays_api_client_async/models/computer_use_start_response.py +105 -0
- northrays_api_client_async/models/computer_use_status_response.py +103 -0
- northrays_api_client_async/models/computer_use_stop_response.py +105 -0
- northrays_api_client_async/models/create_api_key.py +113 -0
- northrays_api_client_async/models/create_build_info.py +105 -0
- northrays_api_client_async/models/create_docker_registry.py +111 -0
- northrays_api_client_async/models/create_linked_account.py +105 -0
- northrays_api_client_async/models/create_organization.py +105 -0
- northrays_api_client_async/models/create_organization_invitation.py +110 -0
- northrays_api_client_async/models/create_organization_quota.py +119 -0
- northrays_api_client_async/models/create_organization_region_quota.py +169 -0
- northrays_api_client_async/models/create_organization_role.py +107 -0
- northrays_api_client_async/models/create_region.py +124 -0
- northrays_api_client_async/models/create_region_response.py +131 -0
- northrays_api_client_async/models/create_runner.py +107 -0
- northrays_api_client_async/models/create_runner_response.py +105 -0
- northrays_api_client_async/models/create_sandbox.py +156 -0
- northrays_api_client_async/models/create_sandbox_snapshot.py +105 -0
- northrays_api_client_async/models/create_session_request.py +103 -0
- northrays_api_client_async/models/create_snapshot.py +129 -0
- northrays_api_client_async/models/create_user.py +119 -0
- northrays_api_client_async/models/create_volume.py +103 -0
- northrays_api_client_async/models/display_info_response.py +103 -0
- northrays_api_client_async/models/docker_registry.py +118 -0
- northrays_api_client_async/models/download_files.py +103 -0
- northrays_api_client_async/models/execute_request.py +107 -0
- northrays_api_client_async/models/execute_response.py +105 -0
- northrays_api_client_async/models/file_info.py +117 -0
- northrays_api_client_async/models/file_status.py +109 -0
- northrays_api_client_async/models/fork_sandbox.py +103 -0
- northrays_api_client_async/models/git_add_request.py +105 -0
- northrays_api_client_async/models/git_branch_request.py +105 -0
- northrays_api_client_async/models/git_checkout_request.py +105 -0
- northrays_api_client_async/models/git_clone_request.py +113 -0
- northrays_api_client_async/models/git_commit_info.py +111 -0
- northrays_api_client_async/models/git_commit_request.py +111 -0
- northrays_api_client_async/models/git_commit_response.py +103 -0
- northrays_api_client_async/models/git_delete_branch_request.py +105 -0
- northrays_api_client_async/models/git_repo_request.py +107 -0
- northrays_api_client_async/models/git_status.py +119 -0
- northrays_api_client_async/models/gpu_type.py +43 -0
- northrays_api_client_async/models/health_controller_check200_response.py +156 -0
- northrays_api_client_async/models/health_controller_check200_response_info_value.py +103 -0
- northrays_api_client_async/models/health_controller_check503_response.py +156 -0
- northrays_api_client_async/models/job.py +123 -0
- northrays_api_client_async/models/job_status.py +45 -0
- northrays_api_client_async/models/job_type.py +56 -0
- northrays_api_client_async/models/keyboard_hotkey_request.py +103 -0
- northrays_api_client_async/models/keyboard_press_request.py +105 -0
- northrays_api_client_async/models/keyboard_type_request.py +105 -0
- northrays_api_client_async/models/list_branch_response.py +103 -0
- northrays_api_client_async/models/list_sandboxes_response.py +118 -0
- northrays_api_client_async/models/log_entry.py +119 -0
- northrays_api_client_async/models/lsp_completion_params.py +119 -0
- northrays_api_client_async/models/lsp_document_request.py +107 -0
- northrays_api_client_async/models/lsp_location.py +109 -0
- northrays_api_client_async/models/lsp_server_request.py +105 -0
- northrays_api_client_async/models/lsp_symbol.py +111 -0
- northrays_api_client_async/models/match.py +107 -0
- northrays_api_client_async/models/metric_data_point.py +105 -0
- northrays_api_client_async/models/metric_series.py +113 -0
- northrays_api_client_async/models/metrics_response.py +111 -0
- northrays_api_client_async/models/mouse_click_request.py +109 -0
- northrays_api_client_async/models/mouse_click_response.py +105 -0
- northrays_api_client_async/models/mouse_drag_request.py +111 -0
- northrays_api_client_async/models/mouse_drag_response.py +105 -0
- northrays_api_client_async/models/mouse_move_request.py +105 -0
- northrays_api_client_async/models/mouse_move_response.py +105 -0
- northrays_api_client_async/models/mouse_position.py +105 -0
- northrays_api_client_async/models/mouse_scroll_request.py +109 -0
- northrays_api_client_async/models/mouse_scroll_response.py +103 -0
- northrays_api_client_async/models/northrays_configuration.py +162 -0
- northrays_api_client_async/models/oidc_config.py +107 -0
- northrays_api_client_async/models/organization.py +191 -0
- northrays_api_client_async/models/organization_invitation.py +132 -0
- northrays_api_client_async/models/organization_role.py +116 -0
- northrays_api_client_async/models/organization_sandbox_default_limited_network_egress.py +103 -0
- northrays_api_client_async/models/organization_suspension.py +109 -0
- northrays_api_client_async/models/organization_usage_overview.py +119 -0
- northrays_api_client_async/models/organization_user.py +126 -0
- northrays_api_client_async/models/otel_config.py +110 -0
- northrays_api_client_async/models/paginated_audit_logs.py +119 -0
- northrays_api_client_async/models/paginated_jobs.py +117 -0
- northrays_api_client_async/models/paginated_logs.py +117 -0
- northrays_api_client_async/models/paginated_sandboxes_deprecated.py +117 -0
- northrays_api_client_async/models/paginated_snapshots.py +117 -0
- northrays_api_client_async/models/paginated_traces.py +117 -0
- northrays_api_client_async/models/poll_jobs_response.py +111 -0
- northrays_api_client_async/models/port_preview_url.py +107 -0
- northrays_api_client_async/models/position.py +105 -0
- northrays_api_client_async/models/posthog_config.py +105 -0
- northrays_api_client_async/models/process_errors_response.py +105 -0
- northrays_api_client_async/models/process_logs_response.py +105 -0
- northrays_api_client_async/models/process_restart_response.py +105 -0
- northrays_api_client_async/models/process_status_response.py +105 -0
- northrays_api_client_async/models/project_dir_response.py +103 -0
- northrays_api_client_async/models/pty_create_request.py +113 -0
- northrays_api_client_async/models/pty_create_response.py +103 -0
- northrays_api_client_async/models/pty_list_response.py +111 -0
- northrays_api_client_async/models/pty_resize_request.py +105 -0
- northrays_api_client_async/models/pty_session_info.py +117 -0
- northrays_api_client_async/models/range.py +112 -0
- northrays_api_client_async/models/rate_limit_config.py +122 -0
- northrays_api_client_async/models/rate_limit_entry.py +105 -0
- northrays_api_client_async/models/regenerate_api_key_response.py +103 -0
- northrays_api_client_async/models/region.py +140 -0
- northrays_api_client_async/models/region_quota.py +168 -0
- northrays_api_client_async/models/region_screenshot_response.py +107 -0
- northrays_api_client_async/models/region_type.py +44 -0
- northrays_api_client_async/models/region_usage_overview.py +174 -0
- northrays_api_client_async/models/registry_push_access_dto.py +113 -0
- northrays_api_client_async/models/replace_request.py +107 -0
- northrays_api_client_async/models/replace_result.py +107 -0
- northrays_api_client_async/models/resize_sandbox.py +108 -0
- northrays_api_client_async/models/runner.py +166 -0
- northrays_api_client_async/models/runner_class.py +42 -0
- northrays_api_client_async/models/runner_full.py +171 -0
- northrays_api_client_async/models/runner_health_metrics.py +129 -0
- northrays_api_client_async/models/runner_healthcheck.py +125 -0
- northrays_api_client_async/models/runner_service_health.py +107 -0
- northrays_api_client_async/models/runner_snapshot_dto.py +107 -0
- northrays_api_client_async/models/runner_state.py +46 -0
- northrays_api_client_async/models/sandbox.py +188 -0
- northrays_api_client_async/models/sandbox_class.py +45 -0
- northrays_api_client_async/models/sandbox_desired_state.py +47 -0
- northrays_api_client_async/models/sandbox_labels.py +103 -0
- northrays_api_client_async/models/sandbox_list_item.py +161 -0
- northrays_api_client_async/models/sandbox_list_sort_direction.py +43 -0
- northrays_api_client_async/models/sandbox_list_sort_field.py +47 -0
- northrays_api_client_async/models/sandbox_state.py +63 -0
- northrays_api_client_async/models/sandbox_volume.py +107 -0
- northrays_api_client_async/models/screenshot_response.py +107 -0
- northrays_api_client_async/models/search_files_response.py +103 -0
- northrays_api_client_async/models/send_webhook_dto.py +108 -0
- northrays_api_client_async/models/session.py +118 -0
- northrays_api_client_async/models/session_execute_request.py +107 -0
- northrays_api_client_async/models/session_execute_response.py +107 -0
- northrays_api_client_async/models/set_snapshot_general_status_dto.py +103 -0
- northrays_api_client_async/models/signed_port_preview_url.py +109 -0
- northrays_api_client_async/models/snapshot_dto.py +172 -0
- northrays_api_client_async/models/snapshot_manager_credentials.py +105 -0
- northrays_api_client_async/models/snapshot_state.py +49 -0
- northrays_api_client_async/models/ssh_access_dto.py +116 -0
- northrays_api_client_async/models/ssh_access_validation_dto.py +105 -0
- northrays_api_client_async/models/storage_access_dto.py +113 -0
- northrays_api_client_async/models/toolbox_proxy_url.py +103 -0
- northrays_api_client_async/models/trace_span.py +119 -0
- northrays_api_client_async/models/trace_summary.py +115 -0
- northrays_api_client_async/models/update_docker_registry.py +111 -0
- northrays_api_client_async/models/update_job_status.py +108 -0
- northrays_api_client_async/models/update_organization_default_region.py +103 -0
- northrays_api_client_async/models/update_organization_invitation.py +108 -0
- northrays_api_client_async/models/update_organization_member_access.py +105 -0
- northrays_api_client_async/models/update_organization_quota.py +192 -0
- northrays_api_client_async/models/update_organization_region_quota.py +189 -0
- northrays_api_client_async/models/update_organization_role.py +107 -0
- northrays_api_client_async/models/update_region.py +122 -0
- northrays_api_client_async/models/update_sandbox_network_settings.py +107 -0
- northrays_api_client_async/models/update_sandbox_state_dto.py +107 -0
- northrays_api_client_async/models/url.py +103 -0
- northrays_api_client_async/models/user.py +120 -0
- northrays_api_client_async/models/user_home_dir_response.py +103 -0
- northrays_api_client_async/models/user_public_key.py +105 -0
- northrays_api_client_async/models/volume_dto.py +128 -0
- northrays_api_client_async/models/volume_state.py +48 -0
- northrays_api_client_async/models/webhook_app_portal_access.py +105 -0
- northrays_api_client_async/models/webhook_event.py +48 -0
- northrays_api_client_async/models/webhook_initialization_status.py +123 -0
- northrays_api_client_async/models/windows_response.py +105 -0
- northrays_api_client_async/models/work_dir_response.py +103 -0
- northrays_api_client_async/py.typed +0 -0
- northrays_api_client_async/rest.py +227 -0
- northrays_toolbox_api_client/__init__.py +386 -0
- northrays_toolbox_api_client/api/__init__.py +46 -0
- northrays_toolbox_api_client/api/computer_use_api.py +9075 -0
- northrays_toolbox_api_client/api/file_system_api.py +3583 -0
- northrays_toolbox_api_client/api/git_api.py +2969 -0
- northrays_toolbox_api_client/api/info_api.py +773 -0
- northrays_toolbox_api_client/api/interpreter_api.py +1075 -0
- northrays_toolbox_api_client/api/lsp_api.py +1971 -0
- northrays_toolbox_api_client/api/port_api.py +543 -0
- northrays_toolbox_api_client/api/process_api.py +4865 -0
- northrays_toolbox_api_client/api/server_api.py +298 -0
- northrays_toolbox_api_client/api_client.py +809 -0
- northrays_toolbox_api_client/api_response.py +21 -0
- northrays_toolbox_api_client/configuration.py +626 -0
- northrays_toolbox_api_client/exceptions.py +218 -0
- northrays_toolbox_api_client/models/__init__.py +224 -0
- northrays_toolbox_api_client/models/accessibility_bounds.py +108 -0
- northrays_toolbox_api_client/models/accessibility_invoke_request.py +104 -0
- northrays_toolbox_api_client/models/accessibility_node_request.py +102 -0
- northrays_toolbox_api_client/models/accessibility_nodes_response.py +112 -0
- northrays_toolbox_api_client/models/accessibility_set_value_request.py +104 -0
- northrays_toolbox_api_client/models/accessibility_tree_response.py +108 -0
- northrays_toolbox_api_client/models/chart.py +132 -0
- northrays_toolbox_api_client/models/chart_element.py +134 -0
- northrays_toolbox_api_client/models/code_run_artifacts.py +110 -0
- northrays_toolbox_api_client/models/code_run_request.py +110 -0
- northrays_toolbox_api_client/models/code_run_response.py +110 -0
- northrays_toolbox_api_client/models/command.py +106 -0
- northrays_toolbox_api_client/models/completion_context.py +104 -0
- northrays_toolbox_api_client/models/completion_item.py +114 -0
- northrays_toolbox_api_client/models/completion_list.py +112 -0
- northrays_toolbox_api_client/models/computer_use_accessibility_node.py +129 -0
- northrays_toolbox_api_client/models/computer_use_start_response.py +117 -0
- northrays_toolbox_api_client/models/computer_use_status_response.py +102 -0
- northrays_toolbox_api_client/models/computer_use_stop_response.py +117 -0
- northrays_toolbox_api_client/models/create_context_request.py +104 -0
- northrays_toolbox_api_client/models/create_session_request.py +102 -0
- northrays_toolbox_api_client/models/display_info.py +112 -0
- northrays_toolbox_api_client/models/display_info_response.py +110 -0
- northrays_toolbox_api_client/models/execute_request.py +108 -0
- northrays_toolbox_api_client/models/execute_response.py +104 -0
- northrays_toolbox_api_client/models/file_info.py +118 -0
- northrays_toolbox_api_client/models/file_status.py +109 -0
- northrays_toolbox_api_client/models/files_download_request.py +102 -0
- northrays_toolbox_api_client/models/find_accessibility_nodes_request.py +114 -0
- northrays_toolbox_api_client/models/git_add_request.py +104 -0
- northrays_toolbox_api_client/models/git_branch_request.py +104 -0
- northrays_toolbox_api_client/models/git_checkout_request.py +104 -0
- northrays_toolbox_api_client/models/git_clone_request.py +114 -0
- northrays_toolbox_api_client/models/git_commit_info.py +110 -0
- northrays_toolbox_api_client/models/git_commit_request.py +110 -0
- northrays_toolbox_api_client/models/git_commit_response.py +102 -0
- northrays_toolbox_api_client/models/git_delete_branch_request.py +104 -0
- northrays_toolbox_api_client/models/git_repo_request.py +106 -0
- northrays_toolbox_api_client/models/git_status.py +118 -0
- northrays_toolbox_api_client/models/initialize_request.py +102 -0
- northrays_toolbox_api_client/models/interpreter_context.py +110 -0
- northrays_toolbox_api_client/models/is_port_in_use_response.py +102 -0
- northrays_toolbox_api_client/models/keyboard_hotkey_request.py +102 -0
- northrays_toolbox_api_client/models/keyboard_press_request.py +104 -0
- northrays_toolbox_api_client/models/keyboard_type_request.py +104 -0
- northrays_toolbox_api_client/models/list_branch_response.py +102 -0
- northrays_toolbox_api_client/models/list_contexts_response.py +110 -0
- northrays_toolbox_api_client/models/list_recordings_response.py +110 -0
- northrays_toolbox_api_client/models/lsp_completion_params.py +118 -0
- northrays_toolbox_api_client/models/lsp_document_request.py +106 -0
- northrays_toolbox_api_client/models/lsp_location.py +108 -0
- northrays_toolbox_api_client/models/lsp_position.py +104 -0
- northrays_toolbox_api_client/models/lsp_range.py +111 -0
- northrays_toolbox_api_client/models/lsp_server_request.py +104 -0
- northrays_toolbox_api_client/models/lsp_symbol.py +110 -0
- northrays_toolbox_api_client/models/match.py +106 -0
- northrays_toolbox_api_client/models/mouse_click_request.py +108 -0
- northrays_toolbox_api_client/models/mouse_click_response.py +104 -0
- northrays_toolbox_api_client/models/mouse_drag_request.py +110 -0
- northrays_toolbox_api_client/models/mouse_drag_response.py +104 -0
- northrays_toolbox_api_client/models/mouse_move_request.py +104 -0
- northrays_toolbox_api_client/models/mouse_position_response.py +104 -0
- northrays_toolbox_api_client/models/mouse_scroll_request.py +109 -0
- northrays_toolbox_api_client/models/port_list.py +102 -0
- northrays_toolbox_api_client/models/position.py +104 -0
- northrays_toolbox_api_client/models/process_errors_response.py +104 -0
- northrays_toolbox_api_client/models/process_logs_response.py +104 -0
- northrays_toolbox_api_client/models/process_restart_response.py +104 -0
- northrays_toolbox_api_client/models/process_status.py +108 -0
- northrays_toolbox_api_client/models/process_status_response.py +104 -0
- northrays_toolbox_api_client/models/pty_create_request.py +112 -0
- northrays_toolbox_api_client/models/pty_create_response.py +102 -0
- northrays_toolbox_api_client/models/pty_list_response.py +110 -0
- northrays_toolbox_api_client/models/pty_resize_request.py +105 -0
- northrays_toolbox_api_client/models/pty_session_info.py +116 -0
- northrays_toolbox_api_client/models/recording.py +116 -0
- northrays_toolbox_api_client/models/replace_request.py +106 -0
- northrays_toolbox_api_client/models/replace_result.py +106 -0
- northrays_toolbox_api_client/models/screenshot_response.py +110 -0
- northrays_toolbox_api_client/models/scroll_response.py +102 -0
- northrays_toolbox_api_client/models/search_files_response.py +102 -0
- northrays_toolbox_api_client/models/session.py +112 -0
- northrays_toolbox_api_client/models/session_command_logs_response.py +106 -0
- northrays_toolbox_api_client/models/session_execute_request.py +108 -0
- northrays_toolbox_api_client/models/session_execute_response.py +110 -0
- northrays_toolbox_api_client/models/session_send_input_request.py +102 -0
- northrays_toolbox_api_client/models/start_recording_request.py +102 -0
- northrays_toolbox_api_client/models/status.py +48 -0
- northrays_toolbox_api_client/models/stop_recording_request.py +102 -0
- northrays_toolbox_api_client/models/user_home_dir_response.py +102 -0
- northrays_toolbox_api_client/models/window_info.py +114 -0
- northrays_toolbox_api_client/models/windows_response.py +110 -0
- northrays_toolbox_api_client/models/work_dir_response.py +102 -0
- northrays_toolbox_api_client/py.typed +0 -0
- northrays_toolbox_api_client/rest.py +263 -0
- northrays_toolbox_api_client_async/__init__.py +386 -0
- northrays_toolbox_api_client_async/api/__init__.py +46 -0
- northrays_toolbox_api_client_async/api/computer_use_api.py +9075 -0
- northrays_toolbox_api_client_async/api/file_system_api.py +3583 -0
- northrays_toolbox_api_client_async/api/git_api.py +2969 -0
- northrays_toolbox_api_client_async/api/info_api.py +773 -0
- northrays_toolbox_api_client_async/api/interpreter_api.py +1075 -0
- northrays_toolbox_api_client_async/api/lsp_api.py +1971 -0
- northrays_toolbox_api_client_async/api/port_api.py +543 -0
- northrays_toolbox_api_client_async/api/process_api.py +4865 -0
- northrays_toolbox_api_client_async/api/server_api.py +298 -0
- northrays_toolbox_api_client_async/api_client.py +812 -0
- northrays_toolbox_api_client_async/api_response.py +21 -0
- northrays_toolbox_api_client_async/configuration.py +624 -0
- northrays_toolbox_api_client_async/exceptions.py +218 -0
- northrays_toolbox_api_client_async/models/__init__.py +224 -0
- northrays_toolbox_api_client_async/models/accessibility_bounds.py +108 -0
- northrays_toolbox_api_client_async/models/accessibility_invoke_request.py +104 -0
- northrays_toolbox_api_client_async/models/accessibility_node_request.py +102 -0
- northrays_toolbox_api_client_async/models/accessibility_nodes_response.py +112 -0
- northrays_toolbox_api_client_async/models/accessibility_set_value_request.py +104 -0
- northrays_toolbox_api_client_async/models/accessibility_tree_response.py +108 -0
- northrays_toolbox_api_client_async/models/chart.py +132 -0
- northrays_toolbox_api_client_async/models/chart_element.py +134 -0
- northrays_toolbox_api_client_async/models/code_run_artifacts.py +110 -0
- northrays_toolbox_api_client_async/models/code_run_request.py +110 -0
- northrays_toolbox_api_client_async/models/code_run_response.py +110 -0
- northrays_toolbox_api_client_async/models/command.py +106 -0
- northrays_toolbox_api_client_async/models/completion_context.py +104 -0
- northrays_toolbox_api_client_async/models/completion_item.py +114 -0
- northrays_toolbox_api_client_async/models/completion_list.py +112 -0
- northrays_toolbox_api_client_async/models/computer_use_accessibility_node.py +129 -0
- northrays_toolbox_api_client_async/models/computer_use_start_response.py +117 -0
- northrays_toolbox_api_client_async/models/computer_use_status_response.py +102 -0
- northrays_toolbox_api_client_async/models/computer_use_stop_response.py +117 -0
- northrays_toolbox_api_client_async/models/create_context_request.py +104 -0
- northrays_toolbox_api_client_async/models/create_session_request.py +102 -0
- northrays_toolbox_api_client_async/models/display_info.py +112 -0
- northrays_toolbox_api_client_async/models/display_info_response.py +110 -0
- northrays_toolbox_api_client_async/models/execute_request.py +108 -0
- northrays_toolbox_api_client_async/models/execute_response.py +104 -0
- northrays_toolbox_api_client_async/models/file_info.py +118 -0
- northrays_toolbox_api_client_async/models/file_status.py +109 -0
- northrays_toolbox_api_client_async/models/files_download_request.py +102 -0
- northrays_toolbox_api_client_async/models/find_accessibility_nodes_request.py +114 -0
- northrays_toolbox_api_client_async/models/git_add_request.py +104 -0
- northrays_toolbox_api_client_async/models/git_branch_request.py +104 -0
- northrays_toolbox_api_client_async/models/git_checkout_request.py +104 -0
- northrays_toolbox_api_client_async/models/git_clone_request.py +114 -0
- northrays_toolbox_api_client_async/models/git_commit_info.py +110 -0
- northrays_toolbox_api_client_async/models/git_commit_request.py +110 -0
- northrays_toolbox_api_client_async/models/git_commit_response.py +102 -0
- northrays_toolbox_api_client_async/models/git_delete_branch_request.py +104 -0
- northrays_toolbox_api_client_async/models/git_repo_request.py +106 -0
- northrays_toolbox_api_client_async/models/git_status.py +118 -0
- northrays_toolbox_api_client_async/models/initialize_request.py +102 -0
- northrays_toolbox_api_client_async/models/interpreter_context.py +110 -0
- northrays_toolbox_api_client_async/models/is_port_in_use_response.py +102 -0
- northrays_toolbox_api_client_async/models/keyboard_hotkey_request.py +102 -0
- northrays_toolbox_api_client_async/models/keyboard_press_request.py +104 -0
- northrays_toolbox_api_client_async/models/keyboard_type_request.py +104 -0
- northrays_toolbox_api_client_async/models/list_branch_response.py +102 -0
- northrays_toolbox_api_client_async/models/list_contexts_response.py +110 -0
- northrays_toolbox_api_client_async/models/list_recordings_response.py +110 -0
- northrays_toolbox_api_client_async/models/lsp_completion_params.py +118 -0
- northrays_toolbox_api_client_async/models/lsp_document_request.py +106 -0
- northrays_toolbox_api_client_async/models/lsp_location.py +108 -0
- northrays_toolbox_api_client_async/models/lsp_position.py +104 -0
- northrays_toolbox_api_client_async/models/lsp_range.py +111 -0
- northrays_toolbox_api_client_async/models/lsp_server_request.py +104 -0
- northrays_toolbox_api_client_async/models/lsp_symbol.py +110 -0
- northrays_toolbox_api_client_async/models/match.py +106 -0
- northrays_toolbox_api_client_async/models/mouse_click_request.py +108 -0
- northrays_toolbox_api_client_async/models/mouse_click_response.py +104 -0
- northrays_toolbox_api_client_async/models/mouse_drag_request.py +110 -0
- northrays_toolbox_api_client_async/models/mouse_drag_response.py +104 -0
- northrays_toolbox_api_client_async/models/mouse_move_request.py +104 -0
- northrays_toolbox_api_client_async/models/mouse_position_response.py +104 -0
- northrays_toolbox_api_client_async/models/mouse_scroll_request.py +109 -0
- northrays_toolbox_api_client_async/models/port_list.py +102 -0
- northrays_toolbox_api_client_async/models/position.py +104 -0
- northrays_toolbox_api_client_async/models/process_errors_response.py +104 -0
- northrays_toolbox_api_client_async/models/process_logs_response.py +104 -0
- northrays_toolbox_api_client_async/models/process_restart_response.py +104 -0
- northrays_toolbox_api_client_async/models/process_status.py +108 -0
- northrays_toolbox_api_client_async/models/process_status_response.py +104 -0
- northrays_toolbox_api_client_async/models/pty_create_request.py +112 -0
- northrays_toolbox_api_client_async/models/pty_create_response.py +102 -0
- northrays_toolbox_api_client_async/models/pty_list_response.py +110 -0
- northrays_toolbox_api_client_async/models/pty_resize_request.py +105 -0
- northrays_toolbox_api_client_async/models/pty_session_info.py +116 -0
- northrays_toolbox_api_client_async/models/recording.py +116 -0
- northrays_toolbox_api_client_async/models/replace_request.py +106 -0
- northrays_toolbox_api_client_async/models/replace_result.py +106 -0
- northrays_toolbox_api_client_async/models/screenshot_response.py +110 -0
- northrays_toolbox_api_client_async/models/scroll_response.py +102 -0
- northrays_toolbox_api_client_async/models/search_files_response.py +102 -0
- northrays_toolbox_api_client_async/models/session.py +112 -0
- northrays_toolbox_api_client_async/models/session_command_logs_response.py +106 -0
- northrays_toolbox_api_client_async/models/session_execute_request.py +108 -0
- northrays_toolbox_api_client_async/models/session_execute_response.py +110 -0
- northrays_toolbox_api_client_async/models/session_send_input_request.py +102 -0
- northrays_toolbox_api_client_async/models/start_recording_request.py +102 -0
- northrays_toolbox_api_client_async/models/status.py +48 -0
- northrays_toolbox_api_client_async/models/stop_recording_request.py +102 -0
- northrays_toolbox_api_client_async/models/user_home_dir_response.py +102 -0
- northrays_toolbox_api_client_async/models/window_info.py +114 -0
- northrays_toolbox_api_client_async/models/windows_response.py +110 -0
- northrays_toolbox_api_client_async/models/work_dir_response.py +102 -0
- northrays_toolbox_api_client_async/py.typed +0 -0
- northrays_toolbox_api_client_async/rest.py +226 -0
|
@@ -0,0 +1,930 @@
|
|
|
1
|
+
# Copyright Daytona Platforms Inc.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
|
|
8
|
+
import aiofiles
|
|
9
|
+
|
|
10
|
+
from northrays_toolbox_api_client_async import (
|
|
11
|
+
AccessibilityInvokeRequest,
|
|
12
|
+
AccessibilityNodeRequest,
|
|
13
|
+
AccessibilityNodesResponse,
|
|
14
|
+
AccessibilitySetValueRequest,
|
|
15
|
+
AccessibilityTreeResponse,
|
|
16
|
+
ComputerUseApi,
|
|
17
|
+
ComputerUseStartResponse,
|
|
18
|
+
ComputerUseStatusResponse,
|
|
19
|
+
ComputerUseStopResponse,
|
|
20
|
+
DisplayInfoResponse,
|
|
21
|
+
FindAccessibilityNodesRequest,
|
|
22
|
+
KeyboardHotkeyRequest,
|
|
23
|
+
KeyboardPressRequest,
|
|
24
|
+
KeyboardTypeRequest,
|
|
25
|
+
ListRecordingsResponse,
|
|
26
|
+
MouseClickRequest,
|
|
27
|
+
MouseClickResponse,
|
|
28
|
+
MouseDragRequest,
|
|
29
|
+
MouseDragResponse,
|
|
30
|
+
MouseMoveRequest,
|
|
31
|
+
MousePositionResponse,
|
|
32
|
+
MouseScrollRequest,
|
|
33
|
+
ProcessErrorsResponse,
|
|
34
|
+
ProcessLogsResponse,
|
|
35
|
+
ProcessRestartResponse,
|
|
36
|
+
ProcessStatusResponse,
|
|
37
|
+
Recording,
|
|
38
|
+
ScreenshotResponse,
|
|
39
|
+
StartRecordingRequest,
|
|
40
|
+
StopRecordingRequest,
|
|
41
|
+
WindowsResponse,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
from .._utils.errors import intercept_errors
|
|
45
|
+
from .._utils.otel_decorator import with_instrumentation
|
|
46
|
+
from ..common.computer_use import ScreenshotOptions, ScreenshotRegion
|
|
47
|
+
from ..internal.http_client import aiohttp_request_timeout as _request_timeout
|
|
48
|
+
from ..internal.shared_session import http_session_of
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class AsyncMouse:
|
|
52
|
+
"""Mouse operations for computer use functionality."""
|
|
53
|
+
|
|
54
|
+
def __init__(self, api_client: ComputerUseApi):
|
|
55
|
+
self._api_client: ComputerUseApi = api_client
|
|
56
|
+
|
|
57
|
+
@intercept_errors(message_prefix="Failed to get mouse position: ")
|
|
58
|
+
@with_instrumentation()
|
|
59
|
+
async def get_position(self) -> MousePositionResponse:
|
|
60
|
+
"""Gets the current mouse cursor position.
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
MousePositionResponse: Current mouse position with x and y coordinates.
|
|
64
|
+
|
|
65
|
+
Example:
|
|
66
|
+
```python
|
|
67
|
+
position = await sandbox.computer_use.mouse.get_position()
|
|
68
|
+
print(f"Mouse is at: {position.x}, {position.y}")
|
|
69
|
+
```
|
|
70
|
+
"""
|
|
71
|
+
response = await self._api_client.get_mouse_position()
|
|
72
|
+
return response
|
|
73
|
+
|
|
74
|
+
@intercept_errors(message_prefix="Failed to move mouse: ")
|
|
75
|
+
@with_instrumentation()
|
|
76
|
+
async def move(self, x: int, y: int) -> MousePositionResponse:
|
|
77
|
+
"""Moves the mouse cursor to the specified coordinates.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
x (int): The x coordinate to move to.
|
|
81
|
+
y (int): The y coordinate to move to.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
MousePositionResponse: Position after move.
|
|
85
|
+
|
|
86
|
+
Example:
|
|
87
|
+
```python
|
|
88
|
+
result = await sandbox.computer_use.mouse.move(100, 200)
|
|
89
|
+
print(f"Mouse moved to: {result.x}, {result.y}")
|
|
90
|
+
```
|
|
91
|
+
"""
|
|
92
|
+
request = MouseMoveRequest(x=x, y=y)
|
|
93
|
+
response = await self._api_client.move_mouse(request)
|
|
94
|
+
return response
|
|
95
|
+
|
|
96
|
+
@intercept_errors(message_prefix="Failed to click mouse: ")
|
|
97
|
+
@with_instrumentation()
|
|
98
|
+
async def click(self, x: int, y: int, button: str = "left", double: bool = False) -> MouseClickResponse:
|
|
99
|
+
"""Clicks the mouse at the specified coordinates.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
x (int): The x coordinate to click at.
|
|
103
|
+
y (int): The y coordinate to click at.
|
|
104
|
+
button (str): The mouse button to click ('left', 'right', 'middle').
|
|
105
|
+
double (bool): Whether to perform a double-click.
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
MouseClickResponse: Click operation result.
|
|
109
|
+
|
|
110
|
+
Example:
|
|
111
|
+
```python
|
|
112
|
+
# Single left click
|
|
113
|
+
result = await sandbox.computer_use.mouse.click(100, 200)
|
|
114
|
+
|
|
115
|
+
# Double click
|
|
116
|
+
double_click = await sandbox.computer_use.mouse.click(100, 200, "left", True)
|
|
117
|
+
|
|
118
|
+
# Right click
|
|
119
|
+
right_click = await sandbox.computer_use.mouse.click(100, 200, "right")
|
|
120
|
+
```
|
|
121
|
+
"""
|
|
122
|
+
request = MouseClickRequest(x=x, y=y, button=button, double=double)
|
|
123
|
+
response = await self._api_client.click(request)
|
|
124
|
+
return response
|
|
125
|
+
|
|
126
|
+
@intercept_errors(message_prefix="Failed to drag mouse: ")
|
|
127
|
+
@with_instrumentation()
|
|
128
|
+
async def drag(self, start_x: int, start_y: int, end_x: int, end_y: int, button: str = "left") -> MouseDragResponse:
|
|
129
|
+
"""Drags the mouse from start coordinates to end coordinates.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
start_x (int): The starting x coordinate.
|
|
133
|
+
start_y (int): The starting y coordinate.
|
|
134
|
+
end_x (int): The ending x coordinate.
|
|
135
|
+
end_y (int): The ending y coordinate.
|
|
136
|
+
button (str): The mouse button to use for dragging.
|
|
137
|
+
|
|
138
|
+
Returns:
|
|
139
|
+
MouseDragResponse: Drag operation result.
|
|
140
|
+
|
|
141
|
+
Example:
|
|
142
|
+
```python
|
|
143
|
+
result = await sandbox.computer_use.mouse.drag(50, 50, 150, 150)
|
|
144
|
+
print(f"Drag ended at {result.x}, {result.y}")
|
|
145
|
+
```
|
|
146
|
+
"""
|
|
147
|
+
request = MouseDragRequest(start_x=start_x, start_y=start_y, end_x=end_x, end_y=end_y, button=button)
|
|
148
|
+
response = await self._api_client.drag(request=request)
|
|
149
|
+
return response
|
|
150
|
+
|
|
151
|
+
@intercept_errors(message_prefix="Failed to scroll mouse: ")
|
|
152
|
+
@with_instrumentation()
|
|
153
|
+
async def scroll(self, x: int, y: int, direction: str, amount: int = 1) -> bool:
|
|
154
|
+
"""Scrolls the mouse wheel at the specified coordinates.
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
x (int): The x coordinate to scroll at.
|
|
158
|
+
y (int): The y coordinate to scroll at.
|
|
159
|
+
direction (str): The direction to scroll ('up' or 'down').
|
|
160
|
+
amount (int): The amount to scroll.
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
bool: Whether the scroll operation was successful.
|
|
164
|
+
|
|
165
|
+
Example:
|
|
166
|
+
```python
|
|
167
|
+
# Scroll up
|
|
168
|
+
scroll_up = await sandbox.computer_use.mouse.scroll(100, 200, "up", 3)
|
|
169
|
+
|
|
170
|
+
# Scroll down
|
|
171
|
+
scroll_down = await sandbox.computer_use.mouse.scroll(100, 200, "down", 5)
|
|
172
|
+
```
|
|
173
|
+
"""
|
|
174
|
+
request = MouseScrollRequest(x=x, y=y, direction=direction, amount=amount)
|
|
175
|
+
response = await self._api_client.scroll(request=request)
|
|
176
|
+
return response.success is True
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class AsyncKeyboard:
|
|
180
|
+
"""Keyboard operations for computer use functionality."""
|
|
181
|
+
|
|
182
|
+
def __init__(self, api_client: ComputerUseApi):
|
|
183
|
+
self._api_client: ComputerUseApi = api_client
|
|
184
|
+
|
|
185
|
+
@intercept_errors(message_prefix="Failed to type text: ")
|
|
186
|
+
@with_instrumentation()
|
|
187
|
+
async def type(self, text: str, delay: int | None = None) -> None:
|
|
188
|
+
"""Types the specified text.
|
|
189
|
+
|
|
190
|
+
Args:
|
|
191
|
+
text (str): The text to type.
|
|
192
|
+
delay (int): Delay between characters in milliseconds.
|
|
193
|
+
|
|
194
|
+
Raises:
|
|
195
|
+
NorthraysError: If the type operation fails.
|
|
196
|
+
|
|
197
|
+
Example:
|
|
198
|
+
```python
|
|
199
|
+
try:
|
|
200
|
+
await sandbox.computer_use.keyboard.type("Hello, World!")
|
|
201
|
+
print(f"Operation success")
|
|
202
|
+
except Exception as e:
|
|
203
|
+
print(f"Operation failed: {e}")
|
|
204
|
+
|
|
205
|
+
# With delay between characters
|
|
206
|
+
try:
|
|
207
|
+
await sandbox.computer_use.keyboard.type("Slow typing", 100)
|
|
208
|
+
print(f"Operation success")
|
|
209
|
+
except Exception as e:
|
|
210
|
+
print(f"Operation failed: {e}")
|
|
211
|
+
```
|
|
212
|
+
"""
|
|
213
|
+
request = KeyboardTypeRequest(text=text, delay=delay)
|
|
214
|
+
_ = await self._api_client.type_text(request=request)
|
|
215
|
+
|
|
216
|
+
@intercept_errors(message_prefix="Failed to press key: ")
|
|
217
|
+
@with_instrumentation()
|
|
218
|
+
async def press(self, key: str, modifiers: list[str] | None = None) -> None:
|
|
219
|
+
"""Presses a key with optional modifiers.
|
|
220
|
+
|
|
221
|
+
Args:
|
|
222
|
+
key (str): The key to press. Canonical names include 'enter', 'escape',
|
|
223
|
+
'tab', letters, digits, unshifted punctuation, function keys, and
|
|
224
|
+
grammar-safe numpad names such as 'num_plus'. Named keys are
|
|
225
|
+
case-insensitive, and common aliases such as 'Return' and 'Escape'
|
|
226
|
+
are normalized.
|
|
227
|
+
modifiers (list[str]): Canonical modifier names are 'ctrl', 'alt',
|
|
228
|
+
'shift', and 'cmd'. Common aliases such as 'control', 'option',
|
|
229
|
+
'meta', and 'win' are normalized.
|
|
230
|
+
|
|
231
|
+
Raises:
|
|
232
|
+
NorthraysError: If the press operation fails.
|
|
233
|
+
|
|
234
|
+
Example:
|
|
235
|
+
```python
|
|
236
|
+
# Press Enter
|
|
237
|
+
try:
|
|
238
|
+
await sandbox.computer_use.keyboard.press("enter")
|
|
239
|
+
print(f"Operation success")
|
|
240
|
+
except Exception as e:
|
|
241
|
+
print(f"Operation failed: {e}")
|
|
242
|
+
|
|
243
|
+
# Press Ctrl+C
|
|
244
|
+
try:
|
|
245
|
+
await sandbox.computer_use.keyboard.press("c", ["ctrl"])
|
|
246
|
+
print(f"Operation success")
|
|
247
|
+
|
|
248
|
+
# Press Ctrl+Shift+T
|
|
249
|
+
try:
|
|
250
|
+
await sandbox.computer_use.keyboard.press("t", ["ctrl", "shift"])
|
|
251
|
+
print(f"Operation success")
|
|
252
|
+
except Exception as e:
|
|
253
|
+
print(f"Operation failed: {e}")
|
|
254
|
+
```
|
|
255
|
+
"""
|
|
256
|
+
request = KeyboardPressRequest(key=key, modifiers=modifiers or [])
|
|
257
|
+
_ = await self._api_client.press_key(request=request)
|
|
258
|
+
|
|
259
|
+
@intercept_errors(message_prefix="Failed to press hotkey: ")
|
|
260
|
+
@with_instrumentation()
|
|
261
|
+
async def hotkey(self, keys: str) -> None:
|
|
262
|
+
"""Presses a hotkey combination.
|
|
263
|
+
|
|
264
|
+
Args:
|
|
265
|
+
keys (str): A single atomic hotkey chord (e.g., 'ctrl+c', 'alt+tab',
|
|
266
|
+
'cmd+shift+t', 'ctrl + c', 'shift'). Uses the same normalized key
|
|
267
|
+
contract as ``press()``.
|
|
268
|
+
|
|
269
|
+
Raises:
|
|
270
|
+
NorthraysError: If the hotkey operation fails.
|
|
271
|
+
|
|
272
|
+
Example:
|
|
273
|
+
```python
|
|
274
|
+
# Copy
|
|
275
|
+
try:
|
|
276
|
+
await sandbox.computer_use.keyboard.hotkey("ctrl+c")
|
|
277
|
+
print(f"Operation success")
|
|
278
|
+
except Exception as e:
|
|
279
|
+
print(f"Operation failed: {e}")
|
|
280
|
+
|
|
281
|
+
# Paste
|
|
282
|
+
try:
|
|
283
|
+
await sandbox.computer_use.keyboard.hotkey("ctrl+v")
|
|
284
|
+
print(f"Operation success")
|
|
285
|
+
except Exception as e:
|
|
286
|
+
print(f"Operation failed: {e}")
|
|
287
|
+
|
|
288
|
+
# Alt+Tab
|
|
289
|
+
try:
|
|
290
|
+
await sandbox.computer_use.keyboard.hotkey("alt+tab")
|
|
291
|
+
print(f"Operation success")
|
|
292
|
+
except Exception as e:
|
|
293
|
+
print(f"Operation failed: {e}")
|
|
294
|
+
```
|
|
295
|
+
"""
|
|
296
|
+
request = KeyboardHotkeyRequest(keys=keys)
|
|
297
|
+
_ = await self._api_client.press_hotkey(request=request)
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
class AsyncScreenshot:
|
|
301
|
+
"""Screenshot operations for computer use functionality."""
|
|
302
|
+
|
|
303
|
+
def __init__(self, api_client: ComputerUseApi):
|
|
304
|
+
self._api_client: ComputerUseApi = api_client
|
|
305
|
+
|
|
306
|
+
@intercept_errors(message_prefix="Failed to take screenshot: ")
|
|
307
|
+
@with_instrumentation()
|
|
308
|
+
async def take_full_screen(self, show_cursor: bool = False) -> ScreenshotResponse:
|
|
309
|
+
"""Takes a screenshot of the entire screen.
|
|
310
|
+
|
|
311
|
+
Args:
|
|
312
|
+
show_cursor (bool): Whether to show the cursor in the screenshot.
|
|
313
|
+
|
|
314
|
+
Returns:
|
|
315
|
+
ScreenshotResponse: Screenshot data with base64 encoded image.
|
|
316
|
+
|
|
317
|
+
Example:
|
|
318
|
+
```python
|
|
319
|
+
screenshot = await sandbox.computer_use.screenshot.take_full_screen()
|
|
320
|
+
print(f"Screenshot size: {screenshot.width}x{screenshot.height}")
|
|
321
|
+
|
|
322
|
+
# With cursor visible
|
|
323
|
+
with_cursor = await sandbox.computer_use.screenshot.take_full_screen(True)
|
|
324
|
+
```
|
|
325
|
+
"""
|
|
326
|
+
response = await self._api_client.take_screenshot(show_cursor=show_cursor)
|
|
327
|
+
return response
|
|
328
|
+
|
|
329
|
+
@intercept_errors(message_prefix="Failed to take region screenshot: ")
|
|
330
|
+
@with_instrumentation()
|
|
331
|
+
async def take_region(self, region: ScreenshotRegion, show_cursor: bool = False) -> ScreenshotResponse:
|
|
332
|
+
"""Takes a screenshot of a specific region.
|
|
333
|
+
|
|
334
|
+
Args:
|
|
335
|
+
region (ScreenshotRegion): The region to capture.
|
|
336
|
+
show_cursor (bool): Whether to show the cursor in the screenshot.
|
|
337
|
+
|
|
338
|
+
Returns:
|
|
339
|
+
ScreenshotResponse: Screenshot data with base64 encoded image.
|
|
340
|
+
|
|
341
|
+
Example:
|
|
342
|
+
```python
|
|
343
|
+
region = ScreenshotRegion(x=100, y=100, width=300, height=200)
|
|
344
|
+
screenshot = await sandbox.computer_use.screenshot.take_region(region)
|
|
345
|
+
print(f"Captured region: {screenshot.region.width}x{screenshot.region.height}")
|
|
346
|
+
```
|
|
347
|
+
"""
|
|
348
|
+
response = await self._api_client.take_region_screenshot(
|
|
349
|
+
height=region.height, width=region.width, y=region.y, x=region.x, show_cursor=show_cursor
|
|
350
|
+
)
|
|
351
|
+
return response
|
|
352
|
+
|
|
353
|
+
@intercept_errors(message_prefix="Failed to take compressed screenshot: ")
|
|
354
|
+
@with_instrumentation()
|
|
355
|
+
async def take_compressed(self, options: ScreenshotOptions | None = None) -> ScreenshotResponse:
|
|
356
|
+
"""Takes a compressed screenshot of the entire screen.
|
|
357
|
+
|
|
358
|
+
Args:
|
|
359
|
+
options (ScreenshotOptions | None): Compression and display options.
|
|
360
|
+
|
|
361
|
+
Returns:
|
|
362
|
+
ScreenshotResponse: Compressed screenshot data.
|
|
363
|
+
|
|
364
|
+
Example:
|
|
365
|
+
```python
|
|
366
|
+
# Default compression
|
|
367
|
+
screenshot = await sandbox.computer_use.screenshot.take_compressed()
|
|
368
|
+
|
|
369
|
+
# High quality JPEG
|
|
370
|
+
jpeg = await sandbox.computer_use.screenshot.take_compressed(
|
|
371
|
+
ScreenshotOptions(format="jpeg", quality=95, show_cursor=True)
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
# Scaled down PNG
|
|
375
|
+
scaled = await sandbox.computer_use.screenshot.take_compressed(
|
|
376
|
+
ScreenshotOptions(format="png", scale=0.5)
|
|
377
|
+
)
|
|
378
|
+
```
|
|
379
|
+
"""
|
|
380
|
+
if options is None:
|
|
381
|
+
options = ScreenshotOptions()
|
|
382
|
+
|
|
383
|
+
response = await self._api_client.take_compressed_screenshot(
|
|
384
|
+
scale=options.scale,
|
|
385
|
+
quality=options.quality,
|
|
386
|
+
format=options.fmt,
|
|
387
|
+
show_cursor=options.show_cursor,
|
|
388
|
+
)
|
|
389
|
+
return response
|
|
390
|
+
|
|
391
|
+
@intercept_errors(message_prefix="Failed to take compressed region screenshot: ")
|
|
392
|
+
@with_instrumentation()
|
|
393
|
+
async def take_compressed_region(
|
|
394
|
+
self, region: ScreenshotRegion, options: ScreenshotOptions | None = None
|
|
395
|
+
) -> ScreenshotResponse:
|
|
396
|
+
"""Takes a compressed screenshot of a specific region.
|
|
397
|
+
|
|
398
|
+
Args:
|
|
399
|
+
region (ScreenshotRegion): The region to capture.
|
|
400
|
+
options (ScreenshotOptions | None): Compression and display options.
|
|
401
|
+
|
|
402
|
+
Returns:
|
|
403
|
+
ScreenshotResponse: Compressed screenshot data.
|
|
404
|
+
|
|
405
|
+
Example:
|
|
406
|
+
```python
|
|
407
|
+
region = ScreenshotRegion(x=0, y=0, width=800, height=600)
|
|
408
|
+
screenshot = await sandbox.computer_use.screenshot.take_compressed_region(
|
|
409
|
+
region,
|
|
410
|
+
ScreenshotOptions(format="webp", quality=80, show_cursor=True)
|
|
411
|
+
)
|
|
412
|
+
print(f"Compressed size: {screenshot.size_bytes} bytes")
|
|
413
|
+
```
|
|
414
|
+
"""
|
|
415
|
+
if options is None:
|
|
416
|
+
options = ScreenshotOptions()
|
|
417
|
+
|
|
418
|
+
response = await self._api_client.take_compressed_region_screenshot(
|
|
419
|
+
height=region.height,
|
|
420
|
+
width=region.width,
|
|
421
|
+
y=region.y,
|
|
422
|
+
x=region.x,
|
|
423
|
+
scale=options.scale,
|
|
424
|
+
quality=options.quality,
|
|
425
|
+
format=options.fmt,
|
|
426
|
+
show_cursor=options.show_cursor,
|
|
427
|
+
)
|
|
428
|
+
return response
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
class AsyncDisplay:
|
|
432
|
+
"""Display operations for computer use functionality."""
|
|
433
|
+
|
|
434
|
+
def __init__(self, api_client: ComputerUseApi):
|
|
435
|
+
self._api_client: ComputerUseApi = api_client
|
|
436
|
+
|
|
437
|
+
@intercept_errors(message_prefix="Failed to get display info: ")
|
|
438
|
+
@with_instrumentation()
|
|
439
|
+
async def get_info(self) -> DisplayInfoResponse:
|
|
440
|
+
"""Gets information about the displays.
|
|
441
|
+
|
|
442
|
+
Returns:
|
|
443
|
+
DisplayInfoResponse: Display information including primary display and all available displays.
|
|
444
|
+
|
|
445
|
+
Example:
|
|
446
|
+
```python
|
|
447
|
+
info = await sandbox.computer_use.display.get_info()
|
|
448
|
+
print(f"Primary display: {info.primary_display.width}x{info.primary_display.height}")
|
|
449
|
+
print(f"Total displays: {info.total_displays}")
|
|
450
|
+
for i, display in enumerate(info.displays):
|
|
451
|
+
print(f"Display {i}: {display.width}x{display.height} at {display.x},{display.y}")
|
|
452
|
+
```
|
|
453
|
+
"""
|
|
454
|
+
response = await self._api_client.get_display_info()
|
|
455
|
+
return response
|
|
456
|
+
|
|
457
|
+
@intercept_errors(message_prefix="Failed to get windows: ")
|
|
458
|
+
@with_instrumentation()
|
|
459
|
+
async def get_windows(self) -> WindowsResponse:
|
|
460
|
+
"""Gets the list of open windows.
|
|
461
|
+
|
|
462
|
+
Returns:
|
|
463
|
+
WindowsResponse: List of open windows with their IDs and titles.
|
|
464
|
+
|
|
465
|
+
Example:
|
|
466
|
+
```python
|
|
467
|
+
windows = await sandbox.computer_use.display.get_windows()
|
|
468
|
+
print(f"Found {windows.count} open windows:")
|
|
469
|
+
for window in windows.windows:
|
|
470
|
+
print(f"- {window.title} (ID: {window.id})")
|
|
471
|
+
```
|
|
472
|
+
"""
|
|
473
|
+
response = await self._api_client.get_windows()
|
|
474
|
+
return response
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
class AsyncRecordingService:
|
|
478
|
+
"""Recording operations for computer use functionality."""
|
|
479
|
+
|
|
480
|
+
def __init__(
|
|
481
|
+
self,
|
|
482
|
+
api_client: ComputerUseApi,
|
|
483
|
+
):
|
|
484
|
+
self._api_client: ComputerUseApi = api_client
|
|
485
|
+
|
|
486
|
+
@intercept_errors(message_prefix="Failed to start recording: ")
|
|
487
|
+
@with_instrumentation()
|
|
488
|
+
async def start(self, label: str | None = None) -> Recording:
|
|
489
|
+
"""Starts a new screen recording session.
|
|
490
|
+
|
|
491
|
+
Args:
|
|
492
|
+
label (str | None): Optional custom label for the recording.
|
|
493
|
+
|
|
494
|
+
Returns:
|
|
495
|
+
Recording: Recording start response.
|
|
496
|
+
|
|
497
|
+
Example:
|
|
498
|
+
```python
|
|
499
|
+
# Start a recording with a label
|
|
500
|
+
recording = await sandbox.computer_use.recording.start("my-test-recording")
|
|
501
|
+
print(f"Recording started: {recording.id}")
|
|
502
|
+
print(f"File: {recording.file_path}")
|
|
503
|
+
```
|
|
504
|
+
"""
|
|
505
|
+
request = StartRecordingRequest(label=label)
|
|
506
|
+
return await self._api_client.start_recording(request=request)
|
|
507
|
+
|
|
508
|
+
@intercept_errors(message_prefix="Failed to stop recording: ")
|
|
509
|
+
@with_instrumentation()
|
|
510
|
+
async def stop(self, recording_id: str) -> Recording:
|
|
511
|
+
"""Stops an active screen recording session.
|
|
512
|
+
|
|
513
|
+
Args:
|
|
514
|
+
recording_id (str): The ID of the recording to stop.
|
|
515
|
+
|
|
516
|
+
Returns:
|
|
517
|
+
Recording: Recording stop response.
|
|
518
|
+
|
|
519
|
+
Example:
|
|
520
|
+
```python
|
|
521
|
+
result = await sandbox.computer_use.recording.stop(recording.id)
|
|
522
|
+
print(f"Recording stopped: {result.duration_seconds} seconds")
|
|
523
|
+
print(f"Saved to: {result.file_path}")
|
|
524
|
+
```
|
|
525
|
+
"""
|
|
526
|
+
request = StopRecordingRequest(id=recording_id)
|
|
527
|
+
return await self._api_client.stop_recording(request=request)
|
|
528
|
+
|
|
529
|
+
@intercept_errors(message_prefix="Failed to list recordings: ")
|
|
530
|
+
@with_instrumentation()
|
|
531
|
+
async def list(self) -> ListRecordingsResponse:
|
|
532
|
+
"""Lists all recordings (active and completed).
|
|
533
|
+
|
|
534
|
+
Returns:
|
|
535
|
+
ListRecordingsResponse: List of all recordings.
|
|
536
|
+
|
|
537
|
+
Example:
|
|
538
|
+
```python
|
|
539
|
+
recordings = await sandbox.computer_use.recording.list()
|
|
540
|
+
print(f"Found {len(recordings.recordings)} recordings")
|
|
541
|
+
for rec in recordings.recordings:
|
|
542
|
+
print(f"- {rec.file_name}: {rec.status}")
|
|
543
|
+
```
|
|
544
|
+
"""
|
|
545
|
+
return await self._api_client.list_recordings()
|
|
546
|
+
|
|
547
|
+
@intercept_errors(message_prefix="Failed to get recording: ")
|
|
548
|
+
@with_instrumentation()
|
|
549
|
+
async def get(self, recording_id: str) -> Recording:
|
|
550
|
+
"""Gets details of a specific recording by ID.
|
|
551
|
+
|
|
552
|
+
Args:
|
|
553
|
+
recording_id (str): The ID of the recording to retrieve.
|
|
554
|
+
|
|
555
|
+
Returns:
|
|
556
|
+
Recording: Recording details.
|
|
557
|
+
|
|
558
|
+
Example:
|
|
559
|
+
```python
|
|
560
|
+
recording = await sandbox.computer_use.recording.get(recording_id)
|
|
561
|
+
print(f"Recording: {recording.file_name}")
|
|
562
|
+
print(f"Status: {recording.status}")
|
|
563
|
+
print(f"Duration: {recording.duration_seconds} seconds")
|
|
564
|
+
```
|
|
565
|
+
"""
|
|
566
|
+
return await self._api_client.get_recording(id=recording_id)
|
|
567
|
+
|
|
568
|
+
@intercept_errors(message_prefix="Failed to delete recording: ")
|
|
569
|
+
@with_instrumentation()
|
|
570
|
+
async def delete(self, recording_id: str) -> None:
|
|
571
|
+
"""Deletes a recording by ID.
|
|
572
|
+
|
|
573
|
+
Args:
|
|
574
|
+
recording_id (str): The ID of the recording to delete.
|
|
575
|
+
|
|
576
|
+
Example:
|
|
577
|
+
```python
|
|
578
|
+
await sandbox.computer_use.recording.delete(recording_id)
|
|
579
|
+
print("Recording deleted")
|
|
580
|
+
```
|
|
581
|
+
"""
|
|
582
|
+
await self._api_client.delete_recording(id=recording_id)
|
|
583
|
+
|
|
584
|
+
@intercept_errors(message_prefix="Failed to download recording: ")
|
|
585
|
+
@with_instrumentation()
|
|
586
|
+
async def download(self, recording_id: str, local_path: str) -> None:
|
|
587
|
+
"""Downloads a recording file from the Sandbox and saves it to a local file.
|
|
588
|
+
|
|
589
|
+
The file is streamed directly to disk without loading the entire content into memory.
|
|
590
|
+
|
|
591
|
+
Args:
|
|
592
|
+
recording_id (str): The ID of the recording to download.
|
|
593
|
+
local_path (str): Path to save the recording file locally.
|
|
594
|
+
|
|
595
|
+
Example:
|
|
596
|
+
```python
|
|
597
|
+
# Download recording to file
|
|
598
|
+
await sandbox.computer_use.recording.download(recording_id, "local_recording.mp4")
|
|
599
|
+
print("Recording downloaded")
|
|
600
|
+
```
|
|
601
|
+
"""
|
|
602
|
+
# Serialize the request to get the URL and headers
|
|
603
|
+
method, url, headers, *_ = self._api_client._download_recording_serialize(
|
|
604
|
+
id=recording_id,
|
|
605
|
+
_request_auth=None,
|
|
606
|
+
_content_type=None,
|
|
607
|
+
_headers=None,
|
|
608
|
+
_host_index=None,
|
|
609
|
+
)
|
|
610
|
+
|
|
611
|
+
# Create parent directory if it doesn't exist
|
|
612
|
+
parent_dir = os.path.dirname(os.path.abspath(local_path))
|
|
613
|
+
if parent_dir:
|
|
614
|
+
os.makedirs(parent_dir, exist_ok=True)
|
|
615
|
+
|
|
616
|
+
download_timeout = 30 * 60
|
|
617
|
+
async with http_session_of(self._api_client.api_client).request(
|
|
618
|
+
method,
|
|
619
|
+
url,
|
|
620
|
+
headers=headers,
|
|
621
|
+
timeout=_request_timeout(download_timeout),
|
|
622
|
+
) as response:
|
|
623
|
+
response.raise_for_status()
|
|
624
|
+
|
|
625
|
+
async with aiofiles.open(local_path, "wb") as f:
|
|
626
|
+
async for chunk in response.content.iter_chunked(64 * 1024):
|
|
627
|
+
_ = await f.write(chunk)
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
class AsyncAccessibility:
|
|
631
|
+
"""Accessibility operations for computer use functionality.
|
|
632
|
+
|
|
633
|
+
This service exposes thin wrappers over the toolbox AT-SPI accessibility
|
|
634
|
+
API. Start computer use before calling these methods.
|
|
635
|
+
"""
|
|
636
|
+
|
|
637
|
+
def __init__(self, api_client: ComputerUseApi):
|
|
638
|
+
self._api_client: ComputerUseApi = api_client
|
|
639
|
+
|
|
640
|
+
@intercept_errors(message_prefix="Failed to get accessibility tree: ")
|
|
641
|
+
@with_instrumentation()
|
|
642
|
+
async def get_tree(
|
|
643
|
+
self,
|
|
644
|
+
scope: str | None = None,
|
|
645
|
+
pid: int | None = None,
|
|
646
|
+
max_depth: int | None = None,
|
|
647
|
+
) -> AccessibilityTreeResponse:
|
|
648
|
+
"""Fetches the AT-SPI accessibility tree.
|
|
649
|
+
|
|
650
|
+
Args:
|
|
651
|
+
scope (str | None): Tree scope to inspect: ``focused``, ``pid``, or ``all``.
|
|
652
|
+
pid (int | None): Process ID when ``scope`` is ``pid``.
|
|
653
|
+
max_depth (int | None): Maximum depth to descend. Use ``0`` for the root only.
|
|
654
|
+
|
|
655
|
+
Returns:
|
|
656
|
+
AccessibilityTreeResponse: Accessibility tree rooted at the requested scope.
|
|
657
|
+
|
|
658
|
+
Example:
|
|
659
|
+
```python
|
|
660
|
+
tree = await sandbox.computer_use.accessibility.get_tree(scope="all", max_depth=3)
|
|
661
|
+
print(tree.root.name)
|
|
662
|
+
```
|
|
663
|
+
"""
|
|
664
|
+
return await self._api_client.get_accessibility_tree(scope=scope, pid=pid, max_depth=max_depth)
|
|
665
|
+
|
|
666
|
+
@intercept_errors(message_prefix="Failed to find accessibility nodes: ")
|
|
667
|
+
@with_instrumentation()
|
|
668
|
+
async def find_nodes(
|
|
669
|
+
self,
|
|
670
|
+
scope: str | None = None,
|
|
671
|
+
pid: int | None = None,
|
|
672
|
+
role: str | None = None,
|
|
673
|
+
name: str | None = None,
|
|
674
|
+
name_match: str | None = None,
|
|
675
|
+
states: list[str] | None = None,
|
|
676
|
+
limit: int | None = None,
|
|
677
|
+
) -> AccessibilityNodesResponse:
|
|
678
|
+
"""Finds AT-SPI accessibility nodes matching the provided filters.
|
|
679
|
+
|
|
680
|
+
Args:
|
|
681
|
+
scope (str | None): Search scope: ``focused``, ``pid``, or ``all``.
|
|
682
|
+
pid (int | None): Process ID when ``scope`` is ``pid``.
|
|
683
|
+
role (str | None): Accessibility role to match, such as ``button``.
|
|
684
|
+
name (str | None): Accessible name to match.
|
|
685
|
+
name_match (str | None): Name match mode, such as ``exact`` or ``substring``.
|
|
686
|
+
states (list[str] | None): Required accessibility states.
|
|
687
|
+
limit (int | None): Maximum number of matches. Use ``0`` to let the API apply its default.
|
|
688
|
+
|
|
689
|
+
Returns:
|
|
690
|
+
AccessibilityNodesResponse: Matching accessibility nodes.
|
|
691
|
+
|
|
692
|
+
Example:
|
|
693
|
+
```python
|
|
694
|
+
buttons = await sandbox.computer_use.accessibility.find_nodes(
|
|
695
|
+
scope="all",
|
|
696
|
+
role="button",
|
|
697
|
+
name="Submit",
|
|
698
|
+
name_match="substring",
|
|
699
|
+
)
|
|
700
|
+
print(len(buttons.matches))
|
|
701
|
+
```
|
|
702
|
+
"""
|
|
703
|
+
request = FindAccessibilityNodesRequest(
|
|
704
|
+
scope=scope,
|
|
705
|
+
pid=pid,
|
|
706
|
+
role=role,
|
|
707
|
+
name=name,
|
|
708
|
+
name_match=name_match,
|
|
709
|
+
states=states,
|
|
710
|
+
limit=limit,
|
|
711
|
+
)
|
|
712
|
+
return await self._api_client.find_accessibility_nodes(request=request)
|
|
713
|
+
|
|
714
|
+
@intercept_errors(message_prefix="Failed to focus accessibility node: ")
|
|
715
|
+
@with_instrumentation()
|
|
716
|
+
async def focus_node(self, node_id: str) -> None:
|
|
717
|
+
"""Focuses an AT-SPI accessibility node.
|
|
718
|
+
|
|
719
|
+
Args:
|
|
720
|
+
node_id (str): Accessibility node ID returned by ``get_tree`` or ``find_nodes``.
|
|
721
|
+
|
|
722
|
+
Raises:
|
|
723
|
+
NorthraysError: If the focus operation fails. API failures may use a more specific subclass.
|
|
724
|
+
|
|
725
|
+
Example:
|
|
726
|
+
```python
|
|
727
|
+
await sandbox.computer_use.accessibility.focus_node(node.id)
|
|
728
|
+
```
|
|
729
|
+
"""
|
|
730
|
+
request = AccessibilityNodeRequest(id=node_id)
|
|
731
|
+
_ = await self._api_client.focus_accessibility_node(request=request)
|
|
732
|
+
|
|
733
|
+
@intercept_errors(message_prefix="Failed to invoke accessibility node: ")
|
|
734
|
+
@with_instrumentation()
|
|
735
|
+
async def invoke_node(self, node_id: str, action: str | None = None) -> None:
|
|
736
|
+
"""Invokes an AT-SPI accessibility node action.
|
|
737
|
+
|
|
738
|
+
Args:
|
|
739
|
+
node_id (str): Accessibility node ID returned by ``get_tree`` or ``find_nodes``.
|
|
740
|
+
action (str | None): Action name to invoke. If omitted, the API invokes the primary action.
|
|
741
|
+
|
|
742
|
+
Raises:
|
|
743
|
+
NorthraysError: If the invoke operation fails. API failures may use a more specific subclass.
|
|
744
|
+
|
|
745
|
+
Example:
|
|
746
|
+
```python
|
|
747
|
+
await sandbox.computer_use.accessibility.invoke_node(node.id, action="click")
|
|
748
|
+
```
|
|
749
|
+
"""
|
|
750
|
+
request = AccessibilityInvokeRequest(id=node_id, action=action)
|
|
751
|
+
_ = await self._api_client.invoke_accessibility_node(request=request)
|
|
752
|
+
|
|
753
|
+
@intercept_errors(message_prefix="Failed to set accessibility node value: ")
|
|
754
|
+
@with_instrumentation()
|
|
755
|
+
async def set_node_value(self, node_id: str, value: str) -> None:
|
|
756
|
+
"""Sets an AT-SPI accessibility node value.
|
|
757
|
+
|
|
758
|
+
Args:
|
|
759
|
+
node_id (str): Accessibility node ID returned by ``get_tree`` or ``find_nodes``.
|
|
760
|
+
value (str): Value to write to the node.
|
|
761
|
+
|
|
762
|
+
Raises:
|
|
763
|
+
NorthraysError: If the value update fails. API failures may use a more specific subclass.
|
|
764
|
+
|
|
765
|
+
Example:
|
|
766
|
+
```python
|
|
767
|
+
await sandbox.computer_use.accessibility.set_node_value(node.id, "hello")
|
|
768
|
+
```
|
|
769
|
+
"""
|
|
770
|
+
request = AccessibilitySetValueRequest(id=node_id, value=value)
|
|
771
|
+
_ = await self._api_client.set_accessibility_node_value(request=request)
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
class AsyncComputerUse:
|
|
775
|
+
"""Computer Use functionality for interacting with the desktop environment.
|
|
776
|
+
|
|
777
|
+
Provides access to mouse, keyboard, screenshot, display, recording, and accessibility operations
|
|
778
|
+
for automating desktop interactions within a sandbox.
|
|
779
|
+
|
|
780
|
+
Attributes:
|
|
781
|
+
mouse (AsyncMouse): Mouse operations interface.
|
|
782
|
+
keyboard (AsyncKeyboard): Keyboard operations interface.
|
|
783
|
+
screenshot (AsyncScreenshot): Screenshot operations interface.
|
|
784
|
+
display (AsyncDisplay): Display operations interface.
|
|
785
|
+
recording (AsyncRecordingService): Screen recording operations interface.
|
|
786
|
+
accessibility (AsyncAccessibility): Accessibility operations interface.
|
|
787
|
+
"""
|
|
788
|
+
|
|
789
|
+
def __init__(
|
|
790
|
+
self,
|
|
791
|
+
api_client: ComputerUseApi,
|
|
792
|
+
):
|
|
793
|
+
self._api_client: ComputerUseApi = api_client
|
|
794
|
+
|
|
795
|
+
self.mouse: AsyncMouse = AsyncMouse(api_client)
|
|
796
|
+
self.keyboard: AsyncKeyboard = AsyncKeyboard(api_client)
|
|
797
|
+
self.screenshot: AsyncScreenshot = AsyncScreenshot(api_client)
|
|
798
|
+
self.display: AsyncDisplay = AsyncDisplay(api_client)
|
|
799
|
+
self.recording: AsyncRecordingService = AsyncRecordingService(api_client)
|
|
800
|
+
self.accessibility: AsyncAccessibility = AsyncAccessibility(api_client)
|
|
801
|
+
|
|
802
|
+
@intercept_errors(message_prefix="Failed to start computer use: ")
|
|
803
|
+
@with_instrumentation()
|
|
804
|
+
async def start(self) -> ComputerUseStartResponse:
|
|
805
|
+
"""Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc).
|
|
806
|
+
|
|
807
|
+
Returns:
|
|
808
|
+
ComputerUseStartResponse: Computer use start response.
|
|
809
|
+
|
|
810
|
+
Example:
|
|
811
|
+
```python
|
|
812
|
+
result = await sandbox.computer_use.start()
|
|
813
|
+
print("Computer use processes started:", result.message)
|
|
814
|
+
```
|
|
815
|
+
"""
|
|
816
|
+
response = await self._api_client.start_computer_use()
|
|
817
|
+
return response
|
|
818
|
+
|
|
819
|
+
@intercept_errors(message_prefix="Failed to stop computer use: ")
|
|
820
|
+
@with_instrumentation()
|
|
821
|
+
async def stop(self) -> ComputerUseStopResponse:
|
|
822
|
+
"""Stops all computer use processes.
|
|
823
|
+
|
|
824
|
+
Returns:
|
|
825
|
+
ComputerUseStopResponse: Computer use stop response.
|
|
826
|
+
|
|
827
|
+
Example:
|
|
828
|
+
```python
|
|
829
|
+
result = await sandbox.computer_use.stop()
|
|
830
|
+
print("Computer use processes stopped:", result.message)
|
|
831
|
+
```
|
|
832
|
+
"""
|
|
833
|
+
response = await self._api_client.stop_computer_use()
|
|
834
|
+
return response
|
|
835
|
+
|
|
836
|
+
@intercept_errors(message_prefix="Failed to get computer use status: ")
|
|
837
|
+
@with_instrumentation()
|
|
838
|
+
async def get_status(self) -> ComputerUseStatusResponse:
|
|
839
|
+
"""Gets the status of all computer use processes.
|
|
840
|
+
|
|
841
|
+
Returns:
|
|
842
|
+
ComputerUseStatusResponse: Status information about all VNC desktop processes.
|
|
843
|
+
|
|
844
|
+
Example:
|
|
845
|
+
```python
|
|
846
|
+
response = await sandbox.computer_use.get_status()
|
|
847
|
+
print("Computer use status:", response.status)
|
|
848
|
+
```
|
|
849
|
+
"""
|
|
850
|
+
return await self._api_client.get_computer_use_status()
|
|
851
|
+
|
|
852
|
+
@intercept_errors(message_prefix="Failed to get process status: ")
|
|
853
|
+
@with_instrumentation()
|
|
854
|
+
async def get_process_status(self, process_name: str) -> ProcessStatusResponse:
|
|
855
|
+
"""Gets the status of a specific VNC process.
|
|
856
|
+
|
|
857
|
+
Args:
|
|
858
|
+
process_name (str): Name of the process to check.
|
|
859
|
+
|
|
860
|
+
Returns:
|
|
861
|
+
ProcessStatusResponse: Status information about the specific process.
|
|
862
|
+
|
|
863
|
+
Example:
|
|
864
|
+
```python
|
|
865
|
+
xvfb_status = await sandbox.computer_use.get_process_status("xvfb")
|
|
866
|
+
no_vnc_status = await sandbox.computer_use.get_process_status("novnc")
|
|
867
|
+
```
|
|
868
|
+
"""
|
|
869
|
+
response = await self._api_client.get_process_status(process_name=process_name)
|
|
870
|
+
return response
|
|
871
|
+
|
|
872
|
+
@intercept_errors(message_prefix="Failed to restart process: ")
|
|
873
|
+
@with_instrumentation()
|
|
874
|
+
async def restart_process(self, process_name: str) -> ProcessRestartResponse:
|
|
875
|
+
"""Restarts a specific VNC process.
|
|
876
|
+
|
|
877
|
+
Args:
|
|
878
|
+
process_name (str): Name of the process to restart.
|
|
879
|
+
|
|
880
|
+
Returns:
|
|
881
|
+
ProcessRestartResponse: Process restart response.
|
|
882
|
+
|
|
883
|
+
Example:
|
|
884
|
+
```python
|
|
885
|
+
result = await sandbox.computer_use.restart_process("xfce4")
|
|
886
|
+
print("XFCE4 process restarted:", result.message)
|
|
887
|
+
```
|
|
888
|
+
"""
|
|
889
|
+
response = await self._api_client.restart_process(process_name=process_name)
|
|
890
|
+
return response
|
|
891
|
+
|
|
892
|
+
@intercept_errors(message_prefix="Failed to get process logs: ")
|
|
893
|
+
@with_instrumentation()
|
|
894
|
+
async def get_process_logs(self, process_name: str) -> ProcessLogsResponse:
|
|
895
|
+
"""Gets logs for a specific VNC process.
|
|
896
|
+
|
|
897
|
+
Args:
|
|
898
|
+
process_name (str): Name of the process to get logs for.
|
|
899
|
+
|
|
900
|
+
Returns:
|
|
901
|
+
ProcessLogsResponse: Process logs.
|
|
902
|
+
|
|
903
|
+
Example:
|
|
904
|
+
```python
|
|
905
|
+
logs = await sandbox.computer_use.get_process_logs("novnc")
|
|
906
|
+
print("NoVNC logs:", logs)
|
|
907
|
+
```
|
|
908
|
+
"""
|
|
909
|
+
response = await self._api_client.get_process_logs(process_name=process_name)
|
|
910
|
+
return response
|
|
911
|
+
|
|
912
|
+
@intercept_errors(message_prefix="Failed to get process errors: ")
|
|
913
|
+
@with_instrumentation()
|
|
914
|
+
async def get_process_errors(self, process_name: str) -> ProcessErrorsResponse:
|
|
915
|
+
"""Gets error logs for a specific VNC process.
|
|
916
|
+
|
|
917
|
+
Args:
|
|
918
|
+
process_name (str): Name of the process to get error logs for.
|
|
919
|
+
|
|
920
|
+
Returns:
|
|
921
|
+
ProcessErrorsResponse: Process error logs.
|
|
922
|
+
|
|
923
|
+
Example:
|
|
924
|
+
```python
|
|
925
|
+
errors = await sandbox.computer_use.get_process_errors("x11vnc")
|
|
926
|
+
print("X11VNC errors:", errors)
|
|
927
|
+
```
|
|
928
|
+
"""
|
|
929
|
+
response = await self._api_client.get_process_errors(process_name=process_name)
|
|
930
|
+
return response
|