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
northrays/_async/git.py
ADDED
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
# Copyright 2025 Daytona Platforms Inc.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from northrays_toolbox_api_client_async import (
|
|
7
|
+
GitAddRequest,
|
|
8
|
+
GitApi,
|
|
9
|
+
GitBranchRequest,
|
|
10
|
+
GitCheckoutRequest,
|
|
11
|
+
GitCloneRequest,
|
|
12
|
+
GitCommitRequest,
|
|
13
|
+
GitDeleteBranchRequest,
|
|
14
|
+
GitRepoRequest,
|
|
15
|
+
GitStatus,
|
|
16
|
+
ListBranchResponse,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
from .._utils.errors import intercept_errors
|
|
20
|
+
from .._utils.otel_decorator import with_instrumentation
|
|
21
|
+
from ..common.git import GitCommitResponse
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class AsyncGit:
|
|
25
|
+
"""Provides Git operations within a Sandbox.
|
|
26
|
+
|
|
27
|
+
Example:
|
|
28
|
+
```python
|
|
29
|
+
# Clone a repository
|
|
30
|
+
await sandbox.git.clone(
|
|
31
|
+
url="https://github.com/user/repo.git",
|
|
32
|
+
path="workspace/repo"
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# Check repository status
|
|
36
|
+
status = await sandbox.git.status("workspace/repo")
|
|
37
|
+
print(f"Modified files: {status.modified}")
|
|
38
|
+
|
|
39
|
+
# Stage and commit changes
|
|
40
|
+
await sandbox.git.add("workspace/repo", ["file.txt"])
|
|
41
|
+
await sandbox.git.commit(
|
|
42
|
+
path="workspace/repo",
|
|
43
|
+
message="Update file",
|
|
44
|
+
author="John Doe",
|
|
45
|
+
email="john@example.com"
|
|
46
|
+
)
|
|
47
|
+
```
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
def __init__(
|
|
51
|
+
self,
|
|
52
|
+
api_client: GitApi,
|
|
53
|
+
):
|
|
54
|
+
"""Initializes a new Git handler instance.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
api_client (GitApi): API client for Sandbox Git operations.
|
|
58
|
+
"""
|
|
59
|
+
self._api_client: GitApi = api_client
|
|
60
|
+
|
|
61
|
+
@intercept_errors(message_prefix="Failed to add files: ")
|
|
62
|
+
@with_instrumentation()
|
|
63
|
+
async def add(self, path: str, files: list[str]) -> None:
|
|
64
|
+
"""Stages the specified files for the next commit, similar to
|
|
65
|
+
running 'git add' on the command line.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
path (str): Path to the Git repository root. Relative paths are resolved based on
|
|
69
|
+
the sandbox working directory.
|
|
70
|
+
files (list[str]): List of file paths or directories to stage, relative to the repository root.
|
|
71
|
+
|
|
72
|
+
Example:
|
|
73
|
+
```python
|
|
74
|
+
# Stage a single file
|
|
75
|
+
await sandbox.git.add("workspace/repo", ["file.txt"])
|
|
76
|
+
|
|
77
|
+
# Stage multiple files
|
|
78
|
+
await sandbox.git.add("workspace/repo", [
|
|
79
|
+
"src/main.py",
|
|
80
|
+
"tests/test_main.py",
|
|
81
|
+
"README.md"
|
|
82
|
+
])
|
|
83
|
+
```
|
|
84
|
+
"""
|
|
85
|
+
await self._api_client.add_files(
|
|
86
|
+
request=GitAddRequest(path=path, files=files),
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
@intercept_errors(message_prefix="Failed to list branches: ")
|
|
90
|
+
@with_instrumentation()
|
|
91
|
+
async def branches(self, path: str) -> ListBranchResponse:
|
|
92
|
+
"""Lists branches in the repository.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
path (str): Path to the Git repository root. Relative paths are resolved based on
|
|
96
|
+
the sandbox working directory.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
ListBranchResponse: List of branches in the repository.
|
|
100
|
+
|
|
101
|
+
Example:
|
|
102
|
+
```python
|
|
103
|
+
response = await sandbox.git.branches("workspace/repo")
|
|
104
|
+
print(f"Branches: {response.branches}")
|
|
105
|
+
```
|
|
106
|
+
"""
|
|
107
|
+
return await self._api_client.list_branches(
|
|
108
|
+
path=path,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
@intercept_errors(message_prefix="Failed to clone repository: ")
|
|
112
|
+
@with_instrumentation()
|
|
113
|
+
async def clone(
|
|
114
|
+
self,
|
|
115
|
+
url: str,
|
|
116
|
+
path: str,
|
|
117
|
+
branch: str | None = None,
|
|
118
|
+
commit_id: str | None = None,
|
|
119
|
+
username: str | None = None,
|
|
120
|
+
password: str | None = None,
|
|
121
|
+
insecure_skip_tls: bool | None = None,
|
|
122
|
+
) -> None:
|
|
123
|
+
"""Clones a Git repository into the specified path. It supports
|
|
124
|
+
cloning specific branches or commits, and can authenticate with the remote
|
|
125
|
+
repository if credentials are provided.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
url (str): Repository URL to clone from.
|
|
129
|
+
path (str): Path where the repository should be cloned. Relative paths are resolved
|
|
130
|
+
based on the sandbox working directory.
|
|
131
|
+
branch (str | None): Specific branch to clone. If not specified,
|
|
132
|
+
clones the default branch.
|
|
133
|
+
commit_id (str | None): Specific commit to clone. If specified,
|
|
134
|
+
the repository will be left in a detached HEAD state at this commit.
|
|
135
|
+
username (str | None): Git username for authentication.
|
|
136
|
+
password (str | None): Git password or token for authentication.
|
|
137
|
+
insecure_skip_tls (bool | None): Skip TLS certificate verification (insecure).
|
|
138
|
+
Use only for trusted internal Git servers with self-signed or private-CA certs;
|
|
139
|
+
credentials, if supplied, are transmitted over an unverified TLS connection.
|
|
140
|
+
|
|
141
|
+
Example:
|
|
142
|
+
```python
|
|
143
|
+
# Clone the default branch
|
|
144
|
+
await sandbox.git.clone(
|
|
145
|
+
url="https://github.com/user/repo.git",
|
|
146
|
+
path="workspace/repo"
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
# Clone a specific branch with authentication
|
|
150
|
+
await sandbox.git.clone(
|
|
151
|
+
url="https://github.com/user/private-repo.git",
|
|
152
|
+
path="workspace/private",
|
|
153
|
+
branch="develop",
|
|
154
|
+
username="user",
|
|
155
|
+
password="token"
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
# Clone a specific commit
|
|
159
|
+
await sandbox.git.clone(
|
|
160
|
+
url="https://github.com/user/repo.git",
|
|
161
|
+
path="workspace/repo-old",
|
|
162
|
+
commit_id="abc123"
|
|
163
|
+
)
|
|
164
|
+
```
|
|
165
|
+
"""
|
|
166
|
+
await self._api_client.clone_repository(
|
|
167
|
+
request=GitCloneRequest(
|
|
168
|
+
url=url,
|
|
169
|
+
branch=branch,
|
|
170
|
+
path=path,
|
|
171
|
+
username=username,
|
|
172
|
+
password=password,
|
|
173
|
+
commit_id=commit_id,
|
|
174
|
+
insecure_skip_tls=insecure_skip_tls,
|
|
175
|
+
),
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
@intercept_errors(message_prefix="Failed to commit changes: ")
|
|
179
|
+
@with_instrumentation()
|
|
180
|
+
async def commit(
|
|
181
|
+
self, path: str, message: str, author: str, email: str, allow_empty: bool = False
|
|
182
|
+
) -> GitCommitResponse:
|
|
183
|
+
"""Creates a new commit with the staged changes. Make sure to stage
|
|
184
|
+
changes using the add() method before committing.
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
path (str): Path to the Git repository root. Relative paths are resolved based on
|
|
188
|
+
the sandbox working directory.
|
|
189
|
+
message (str): Commit message describing the changes.
|
|
190
|
+
author (str): Name of the commit author.
|
|
191
|
+
email (str): Email address of the commit author.
|
|
192
|
+
allow_empty (bool): Allow creating an empty commit when no changes are staged. Defaults to False.
|
|
193
|
+
|
|
194
|
+
Example:
|
|
195
|
+
```python
|
|
196
|
+
# Stage and commit changes
|
|
197
|
+
await sandbox.git.add("workspace/repo", ["README.md"])
|
|
198
|
+
await sandbox.git.commit(
|
|
199
|
+
path="workspace/repo",
|
|
200
|
+
message="Update documentation",
|
|
201
|
+
author="John Doe",
|
|
202
|
+
email="john@example.com",
|
|
203
|
+
allow_empty=True
|
|
204
|
+
)
|
|
205
|
+
```
|
|
206
|
+
"""
|
|
207
|
+
response = await self._api_client.commit_changes(
|
|
208
|
+
request=GitCommitRequest(
|
|
209
|
+
path=path,
|
|
210
|
+
message=message,
|
|
211
|
+
author=author,
|
|
212
|
+
email=email,
|
|
213
|
+
allow_empty=allow_empty,
|
|
214
|
+
),
|
|
215
|
+
)
|
|
216
|
+
return GitCommitResponse(sha=response.hash)
|
|
217
|
+
|
|
218
|
+
@intercept_errors(message_prefix="Failed to push changes: ")
|
|
219
|
+
@with_instrumentation()
|
|
220
|
+
async def push(
|
|
221
|
+
self,
|
|
222
|
+
path: str,
|
|
223
|
+
username: str | None = None,
|
|
224
|
+
password: str | None = None,
|
|
225
|
+
) -> None:
|
|
226
|
+
"""Pushes all local commits on the current branch to the remote
|
|
227
|
+
repository. If the remote repository requires authentication, provide
|
|
228
|
+
username and password/token.
|
|
229
|
+
|
|
230
|
+
Args:
|
|
231
|
+
path (str): Path to the Git repository root. Relative paths are resolved based on
|
|
232
|
+
the sandbox working directory.
|
|
233
|
+
username (str | None): Git username for authentication.
|
|
234
|
+
password (str | None): Git password or token for authentication.
|
|
235
|
+
|
|
236
|
+
Example:
|
|
237
|
+
```python
|
|
238
|
+
# Push without authentication (for public repos or SSH)
|
|
239
|
+
await sandbox.git.push("workspace/repo")
|
|
240
|
+
|
|
241
|
+
# Push with authentication
|
|
242
|
+
await sandbox.git.push(
|
|
243
|
+
path="workspace/repo",
|
|
244
|
+
username="user",
|
|
245
|
+
password="github_token"
|
|
246
|
+
)
|
|
247
|
+
```
|
|
248
|
+
"""
|
|
249
|
+
await self._api_client.push_changes(
|
|
250
|
+
request=GitRepoRequest(
|
|
251
|
+
path=path,
|
|
252
|
+
username=username,
|
|
253
|
+
password=password,
|
|
254
|
+
),
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
@intercept_errors(message_prefix="Failed to pull changes: ")
|
|
258
|
+
@with_instrumentation()
|
|
259
|
+
async def pull(
|
|
260
|
+
self,
|
|
261
|
+
path: str,
|
|
262
|
+
username: str | None = None,
|
|
263
|
+
password: str | None = None,
|
|
264
|
+
) -> None:
|
|
265
|
+
"""Pulls changes from the remote repository. If the remote repository requires authentication,
|
|
266
|
+
provide username and password/token.
|
|
267
|
+
|
|
268
|
+
Args:
|
|
269
|
+
path (str): Path to the Git repository root. Relative paths are resolved based on
|
|
270
|
+
the sandbox working directory.
|
|
271
|
+
username (str | None): Git username for authentication.
|
|
272
|
+
password (str | None): Git password or token for authentication.
|
|
273
|
+
|
|
274
|
+
Example:
|
|
275
|
+
```python
|
|
276
|
+
# Pull without authentication
|
|
277
|
+
await sandbox.git.pull("workspace/repo")
|
|
278
|
+
|
|
279
|
+
# Pull with authentication
|
|
280
|
+
await sandbox.git.pull(
|
|
281
|
+
path="workspace/repo",
|
|
282
|
+
username="user",
|
|
283
|
+
password="github_token"
|
|
284
|
+
)
|
|
285
|
+
```
|
|
286
|
+
"""
|
|
287
|
+
await self._api_client.pull_changes(
|
|
288
|
+
request=GitRepoRequest(
|
|
289
|
+
path=path,
|
|
290
|
+
username=username,
|
|
291
|
+
password=password,
|
|
292
|
+
),
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
@intercept_errors(message_prefix="Failed to get status: ")
|
|
296
|
+
@with_instrumentation()
|
|
297
|
+
async def status(self, path: str) -> GitStatus:
|
|
298
|
+
"""Gets the current Git repository status.
|
|
299
|
+
|
|
300
|
+
Args:
|
|
301
|
+
path (str): Path to the Git repository root. Relative paths are resolved based on
|
|
302
|
+
the sandbox working directory.
|
|
303
|
+
|
|
304
|
+
Returns:
|
|
305
|
+
GitStatus: Repository status information including:
|
|
306
|
+
- current_branch: Current branch name
|
|
307
|
+
- file_status: List of file statuses
|
|
308
|
+
- ahead: Number of local commits not pushed to remote
|
|
309
|
+
- behind: Number of remote commits not pulled locally
|
|
310
|
+
- branch_published: Whether the branch has been published to the remote repository
|
|
311
|
+
|
|
312
|
+
Example:
|
|
313
|
+
```python
|
|
314
|
+
status = await sandbox.git.status("workspace/repo")
|
|
315
|
+
print(f"On branch: {status.current_branch}")
|
|
316
|
+
print(f"Commits ahead: {status.ahead}")
|
|
317
|
+
print(f"Commits behind: {status.behind}")
|
|
318
|
+
```
|
|
319
|
+
"""
|
|
320
|
+
return await self._api_client.get_status(
|
|
321
|
+
path=path,
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
@intercept_errors(message_prefix="Failed to checkout branch: ")
|
|
325
|
+
@with_instrumentation()
|
|
326
|
+
async def checkout_branch(self, path: str, branch: str) -> None:
|
|
327
|
+
"""Checkout branch in the repository.
|
|
328
|
+
|
|
329
|
+
Args:
|
|
330
|
+
path (str): Path to the Git repository root. Relative paths are resolved based on
|
|
331
|
+
the sandbox working directory.
|
|
332
|
+
branch (str): Name of the branch to checkout
|
|
333
|
+
|
|
334
|
+
Example:
|
|
335
|
+
```python
|
|
336
|
+
# Checkout a branch
|
|
337
|
+
await sandbox.git.checkout_branch("workspace/repo", "feature-branch")
|
|
338
|
+
```
|
|
339
|
+
"""
|
|
340
|
+
await self._api_client.checkout_branch(
|
|
341
|
+
request=GitCheckoutRequest(
|
|
342
|
+
path=path,
|
|
343
|
+
branch=branch,
|
|
344
|
+
),
|
|
345
|
+
)
|
|
346
|
+
|
|
347
|
+
@intercept_errors(message_prefix="Failed to create branch: ")
|
|
348
|
+
@with_instrumentation()
|
|
349
|
+
async def create_branch(self, path: str, name: str) -> None:
|
|
350
|
+
"""Create branch in the repository.
|
|
351
|
+
|
|
352
|
+
Args:
|
|
353
|
+
path (str): Path to the Git repository root. Relative paths are resolved based on
|
|
354
|
+
the sandbox working directory.
|
|
355
|
+
name (str): Name of the new branch to create
|
|
356
|
+
|
|
357
|
+
Example:
|
|
358
|
+
```python
|
|
359
|
+
# Create a new branch
|
|
360
|
+
await sandbox.git.create_branch("workspace/repo", "new-feature")
|
|
361
|
+
```
|
|
362
|
+
"""
|
|
363
|
+
await self._api_client.create_branch(
|
|
364
|
+
request=GitBranchRequest(
|
|
365
|
+
path=path,
|
|
366
|
+
name=name,
|
|
367
|
+
),
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
@intercept_errors(message_prefix="Failed to delete branch: ")
|
|
371
|
+
@with_instrumentation()
|
|
372
|
+
async def delete_branch(self, path: str, name: str) -> None:
|
|
373
|
+
"""Delete branch in the repository.
|
|
374
|
+
|
|
375
|
+
Args:
|
|
376
|
+
path (str): Path to the Git repository root. Relative paths are resolved based on
|
|
377
|
+
the sandbox working directory.
|
|
378
|
+
name (str): Name of the branch to delete
|
|
379
|
+
|
|
380
|
+
Example:
|
|
381
|
+
```python
|
|
382
|
+
# Delete a branch
|
|
383
|
+
await sandbox.git.delete_branch("workspace/repo", "old-feature")
|
|
384
|
+
```
|
|
385
|
+
"""
|
|
386
|
+
await self._api_client.delete_branch(
|
|
387
|
+
request=GitDeleteBranchRequest(
|
|
388
|
+
path=path,
|
|
389
|
+
name=name,
|
|
390
|
+
),
|
|
391
|
+
)
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# Copyright 2025 Daytona Platforms Inc.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from deprecated import deprecated
|
|
7
|
+
|
|
8
|
+
from northrays_toolbox_api_client_async import (
|
|
9
|
+
CompletionList,
|
|
10
|
+
LspApi,
|
|
11
|
+
LspCompletionParams,
|
|
12
|
+
LspDocumentRequest,
|
|
13
|
+
LspPosition,
|
|
14
|
+
LspServerRequest,
|
|
15
|
+
LspSymbol,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
from .._utils.errors import intercept_errors
|
|
19
|
+
from .._utils.otel_decorator import with_instrumentation
|
|
20
|
+
from ..common.lsp_server import LspCompletionPosition, LspLanguageId, LspLanguageIdLiteral
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class AsyncLspServer:
|
|
24
|
+
"""Provides Language Server Protocol functionality for code intelligence to provide
|
|
25
|
+
IDE-like features such as code completion, symbol search, and more.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
language_id: LspLanguageId | LspLanguageIdLiteral,
|
|
31
|
+
path_to_project: str,
|
|
32
|
+
api_client: LspApi,
|
|
33
|
+
):
|
|
34
|
+
"""Initializes a new LSP server instance.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
language_id (LspLanguageId | LspLanguageIdLiteral): The language server type
|
|
38
|
+
(e.g., LspLanguageId.TYPESCRIPT).
|
|
39
|
+
path_to_project (str): Absolute path to the project root directory.
|
|
40
|
+
api_client (LspApi): API client for Sandbox operations.
|
|
41
|
+
"""
|
|
42
|
+
self._language_id: str = str(language_id)
|
|
43
|
+
self._path_to_project: str = path_to_project
|
|
44
|
+
self._api_client: LspApi = api_client
|
|
45
|
+
|
|
46
|
+
@intercept_errors(message_prefix="Failed to start LSP server: ")
|
|
47
|
+
@with_instrumentation()
|
|
48
|
+
async def start(self) -> None:
|
|
49
|
+
"""Starts the language server.
|
|
50
|
+
|
|
51
|
+
This method must be called before using any other LSP functionality.
|
|
52
|
+
It initializes the language server for the specified language and project.
|
|
53
|
+
|
|
54
|
+
Example:
|
|
55
|
+
```python
|
|
56
|
+
lsp = sandbox.create_lsp_server("typescript", "workspace/project")
|
|
57
|
+
await lsp.start() # Initialize the server
|
|
58
|
+
# Now ready for LSP operations
|
|
59
|
+
```
|
|
60
|
+
"""
|
|
61
|
+
await self._api_client.start(
|
|
62
|
+
request=LspServerRequest(
|
|
63
|
+
language_id=self._language_id,
|
|
64
|
+
path_to_project=self._path_to_project,
|
|
65
|
+
),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
@intercept_errors(message_prefix="Failed to stop LSP server: ")
|
|
69
|
+
@with_instrumentation()
|
|
70
|
+
async def stop(self) -> None:
|
|
71
|
+
"""Stops the language server.
|
|
72
|
+
|
|
73
|
+
This method should be called when the LSP server is no longer needed to
|
|
74
|
+
free up system resources.
|
|
75
|
+
|
|
76
|
+
Example:
|
|
77
|
+
```python
|
|
78
|
+
# When done with LSP features
|
|
79
|
+
await lsp.stop() # Clean up resources
|
|
80
|
+
```
|
|
81
|
+
"""
|
|
82
|
+
await self._api_client.stop(
|
|
83
|
+
request=LspServerRequest(
|
|
84
|
+
language_id=self._language_id,
|
|
85
|
+
path_to_project=self._path_to_project,
|
|
86
|
+
),
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
@intercept_errors(message_prefix="Failed to open file: ")
|
|
90
|
+
@with_instrumentation()
|
|
91
|
+
async def did_open(self, path: str) -> None:
|
|
92
|
+
"""Notifies the language server that a file has been opened.
|
|
93
|
+
|
|
94
|
+
This method should be called when a file is opened in the editor to enable
|
|
95
|
+
language features like diagnostics and completions for that file. The server
|
|
96
|
+
will begin tracking the file's contents and providing language features.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
path (str): Path to the opened file. Relative paths are resolved based on the project path
|
|
100
|
+
set in the LSP server constructor.
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
```python
|
|
104
|
+
# When opening a file for editing
|
|
105
|
+
await lsp.did_open("workspace/project/src/index.ts")
|
|
106
|
+
# Now can get completions, symbols, etc. for this file
|
|
107
|
+
```
|
|
108
|
+
"""
|
|
109
|
+
await self._api_client.did_open(
|
|
110
|
+
request=LspDocumentRequest(
|
|
111
|
+
language_id=self._language_id,
|
|
112
|
+
path_to_project=self._path_to_project,
|
|
113
|
+
uri=f"file://{path}",
|
|
114
|
+
),
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
@intercept_errors(message_prefix="Failed to close file: ")
|
|
118
|
+
@with_instrumentation()
|
|
119
|
+
async def did_close(self, path: str) -> None:
|
|
120
|
+
"""Notify the language server that a file has been closed.
|
|
121
|
+
|
|
122
|
+
This method should be called when a file is closed in the editor to allow
|
|
123
|
+
the language server to clean up any resources associated with that file.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
path (str): Path to the closed file. Relative paths are resolved based on the project path
|
|
127
|
+
set in the LSP server constructor.
|
|
128
|
+
|
|
129
|
+
Example:
|
|
130
|
+
```python
|
|
131
|
+
# When done editing a file
|
|
132
|
+
await lsp.did_close("workspace/project/src/index.ts")
|
|
133
|
+
```
|
|
134
|
+
"""
|
|
135
|
+
await self._api_client.did_close(
|
|
136
|
+
request=LspDocumentRequest(
|
|
137
|
+
language_id=self._language_id,
|
|
138
|
+
path_to_project=self._path_to_project,
|
|
139
|
+
uri=f"file://{path}",
|
|
140
|
+
),
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
@intercept_errors(message_prefix="Failed to get symbols from document: ")
|
|
144
|
+
@with_instrumentation()
|
|
145
|
+
async def document_symbols(self, path: str) -> list[LspSymbol]:
|
|
146
|
+
"""Gets symbol information (functions, classes, variables, etc.) from a document.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
path (str): Path to the file to get symbols from. Relative paths are resolved based on the project path
|
|
150
|
+
set in the LSP server constructor.
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
list[LspSymbol]: List of symbols in the document. Each symbol includes:
|
|
154
|
+
- name: The symbol's name
|
|
155
|
+
- kind: The symbol's kind (function, class, variable, etc.)
|
|
156
|
+
- location: The location of the symbol in the file
|
|
157
|
+
|
|
158
|
+
Example:
|
|
159
|
+
```python
|
|
160
|
+
# Get all symbols in a file
|
|
161
|
+
symbols = await lsp.document_symbols("workspace/project/src/index.ts")
|
|
162
|
+
for symbol in symbols:
|
|
163
|
+
print(f"{symbol.kind} {symbol.name}: {symbol.location}")
|
|
164
|
+
```
|
|
165
|
+
"""
|
|
166
|
+
return await self._api_client.document_symbols(
|
|
167
|
+
language_id=self._language_id,
|
|
168
|
+
path_to_project=self._path_to_project,
|
|
169
|
+
uri=f"file://{path}",
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
@deprecated(
|
|
173
|
+
reason="Method is deprecated. Use `sandbox_symbols` instead. This method will be removed in a future version."
|
|
174
|
+
)
|
|
175
|
+
@with_instrumentation()
|
|
176
|
+
async def workspace_symbols(self, query: str) -> list[LspSymbol]:
|
|
177
|
+
"""Searches for symbols matching the query string across all files
|
|
178
|
+
in the Sandbox.
|
|
179
|
+
|
|
180
|
+
Args:
|
|
181
|
+
query (str): Search query to match against symbol names.
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
list[LspSymbol]: List of matching symbols from all files.
|
|
185
|
+
"""
|
|
186
|
+
return await self.sandbox_symbols(query)
|
|
187
|
+
|
|
188
|
+
@intercept_errors(message_prefix="Failed to get symbols from sandbox: ")
|
|
189
|
+
@with_instrumentation()
|
|
190
|
+
async def sandbox_symbols(self, query: str) -> list[LspSymbol]:
|
|
191
|
+
"""Searches for symbols matching the query string across all files
|
|
192
|
+
in the Sandbox.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
query (str): Search query to match against symbol names.
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
list[LspSymbol]: List of matching symbols from all files. Each symbol
|
|
199
|
+
includes:
|
|
200
|
+
- name: The symbol's name
|
|
201
|
+
- kind: The symbol's kind (function, class, variable, etc.)
|
|
202
|
+
- location: The location of the symbol in the file
|
|
203
|
+
|
|
204
|
+
Example:
|
|
205
|
+
```python
|
|
206
|
+
# Search for all symbols containing "User"
|
|
207
|
+
symbols = await lsp.sandbox_symbols("User")
|
|
208
|
+
for symbol in symbols:
|
|
209
|
+
print(f"{symbol.name} in {symbol.location}")
|
|
210
|
+
```
|
|
211
|
+
"""
|
|
212
|
+
return await self._api_client.workspace_symbols(
|
|
213
|
+
language_id=self._language_id,
|
|
214
|
+
path_to_project=self._path_to_project,
|
|
215
|
+
query=query,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
@intercept_errors(message_prefix="Failed to get completions: ")
|
|
219
|
+
@with_instrumentation()
|
|
220
|
+
async def completions(self, path: str, position: LspCompletionPosition) -> CompletionList:
|
|
221
|
+
"""Gets completion suggestions at a position in a file.
|
|
222
|
+
|
|
223
|
+
Args:
|
|
224
|
+
path (str): Path to the file. Relative paths are resolved based on the project path
|
|
225
|
+
set in the LSP server constructor.
|
|
226
|
+
position (LspCompletionPosition): Cursor position to get completions for.
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
CompletionList: List of completion suggestions. The list includes:
|
|
230
|
+
- isIncomplete: Whether more items might be available
|
|
231
|
+
- items: List of completion items, each containing:
|
|
232
|
+
- label: The text to insert
|
|
233
|
+
- kind: The kind of completion
|
|
234
|
+
- detail: Additional details about the item
|
|
235
|
+
- documentation: Documentation for the item
|
|
236
|
+
- sortText: Text used to sort the item in the list
|
|
237
|
+
- filterText: Text used to filter the item
|
|
238
|
+
- insertText: The actual text to insert (if different from label)
|
|
239
|
+
|
|
240
|
+
Example:
|
|
241
|
+
```python
|
|
242
|
+
# Get completions at a specific position
|
|
243
|
+
pos = LspCompletionPosition(line=10, character=15)
|
|
244
|
+
completions = await lsp.completions("workspace/project/src/index.ts", pos)
|
|
245
|
+
for item in completions.items:
|
|
246
|
+
print(f"{item.label} ({item.kind}): {item.detail}")
|
|
247
|
+
```
|
|
248
|
+
"""
|
|
249
|
+
return await self._api_client.completions(
|
|
250
|
+
request=LspCompletionParams(
|
|
251
|
+
language_id=self._language_id,
|
|
252
|
+
path_to_project=self._path_to_project,
|
|
253
|
+
uri=f"file://{path}",
|
|
254
|
+
position=LspPosition(line=position.line, character=position.character),
|
|
255
|
+
),
|
|
256
|
+
)
|