e2b 2.57.0__tar.gz → 2.58.0__tar.gz
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.
- {e2b-2.57.0 → e2b-2.58.0}/PKG-INFO +1 -1
- {e2b-2.57.0 → e2b-2.58.0}/e2b/__init__.py +2 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/client.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/connection_config.py +12 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/client_async/__init__.py +10 -8
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/interceptors.py +48 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/paginator.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/_git/types.py +1 -3
- e2b-2.58.0/e2b/sandbox/commands/stream_input.py +37 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/filesystem/filesystem.py +1 -1
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/sandbox_api.py +2 -2
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_async/commands/command.py +28 -0
- e2b-2.58.0/e2b/sandbox_async/commands/command_input_handle.py +131 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_async/commands/pty.py +28 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_async/filesystem/filesystem.py +1 -1
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_async/main.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_async/paginator.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_async/sandbox_api.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_sync/commands/command.py +46 -1
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_sync/commands/pty.py +46 -1
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_sync/main.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_sync/paginator.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_sync/sandbox_api.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/secret/secret_async.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/secret/secret_sync.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/template/types.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/template_async/main.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/template_sync/main.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/connection_config.py +1 -3
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/volume_async.py +13 -4
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/volume_sync.py +12 -3
- {e2b-2.57.0 → e2b-2.58.0}/pyproject.toml +1 -1
- {e2b-2.57.0 → e2b-2.58.0}/README.md +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/get_sandboxes.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/get_v2_sandboxes.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/get_v_2_sandboxes_sandbox_id_logs.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/post_sandboxes.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_fork.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_snapshots.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/post_v2_sandboxes.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/post_v_2_sandboxes_sandbox_id_connect.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/sandboxes/put_sandboxes_sandbox_id_network.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/secrets/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/secrets/delete_secrets_secret_id.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/secrets/get_secrets.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/secrets/get_secrets_secret_id.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/secrets/post_secrets.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/secrets/post_secrets_secret_id.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/snapshots/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/snapshots/get_snapshots.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/tags/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/tags/delete_templates_tags.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/tags/get_templates_template_id_tags.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/tags/post_templates_tags.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/delete_templates_template_id.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/get_templates.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/get_templates_aliases_alias.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/get_templates_template_id.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/get_templates_template_id_files_hash.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/get_v2_templates.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/patch_templates_template_id.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/patch_v_2_templates_template_id.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/post_v3_templates.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/volumes/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/volumes/delete_volumes_volume_id.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/volumes/get_volumes.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/volumes/get_volumes_volume_id.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/api/volumes/post_volumes.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/client.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/errors.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/assign_template_tags_request.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/assigned_template_tags.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/aws_registry.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/aws_registry_type.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/build_log_entry.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/build_status_reason.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/connect_sandbox.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/connect_sandbox_v2.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/delete_template_tags_request.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/error.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/gcp_registry.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/gcp_registry_type.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/general_registry.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/general_registry_type.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/listed_sandbox.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/log_level.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/logs_direction.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/logs_source.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/mcp_type_0.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/new_sandbox.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/new_sandbox_v2.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/new_secret.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/new_volume.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/order_direction.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/resumed_sandbox.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_auto_resume_config.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_detail.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_egress_proxy_config_type_0.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_egress_proxy_tls_config_type_0.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_fork_request.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_fork_result.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_iam.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_iam_token.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_iam_tokens.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_lifecycle.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_log.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_log_entry.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_log_entry_fields.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_logs.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_logs_v2_response.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_metric.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_network_config.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_network_config_rules.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_network_rule.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_network_transform.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_network_transform_headers.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_network_update_config.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_network_update_config_rules.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_on_timeout.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_pause_request.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_refresh_request.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_snapshot_request.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_state.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_timeout_request.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandbox_volume_mount.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/sandboxes_with_metrics.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/secret.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/secret_metadata.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/secret_update.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/snapshot_info.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/team_user.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_alias_response.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_build.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_build_file_upload.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_build_file_upload_headers.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_build_info.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_build_logs_response.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_build_request_v3.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_build_start_v2.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_build_status.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_request_response_v3.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_step.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_tag.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_update_request.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_update_response.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/template_with_builds.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/volume.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/models/volume_and_token.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/py.typed +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client/types.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client_async/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/client_sync/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/api/metadata.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/api.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/client_shared.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/client_sync/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/filesystem/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/filesystem/filesystem_connect.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/filesystem/filesystem_pb.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/process/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/process/process_connect.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/process/process_pb.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/rpc.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/utils.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/envd/versions.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/exceptions.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/io_utils.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/py.typed +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/retry.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/_git/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/_git/args.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/_git/auth.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/_git/config.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/_git/parse.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/commands/command_handle.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/commands/main.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/filesystem/watch_handle.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/iam.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/main.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/mcp.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/network.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/signature.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox/utils.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_async/commands/command_handle.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_async/filesystem/watch_handle.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_async/git.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_async/utils.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_domains.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_sync/commands/command_handle.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_sync/filesystem/filesystem.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_sync/filesystem/watch_handle.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/sandbox_sync/git.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/secret/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/secret/base.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/secret/types.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/template/consts.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/template/dockerfile_parser.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/template/logger.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/template/main.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/template/readycmd.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/template/utils.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/template_async/build_api.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/template_sync/build_api.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/api/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/api/volumes/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/api/volumes/delete_volumecontent_volume_id_path.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/api/volumes/get_volumecontent_volume_id_dir.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/api/volumes/get_volumecontent_volume_id_file.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/api/volumes/get_volumecontent_volume_id_path.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/api/volumes/patch_volumecontent_volume_id_path.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/api/volumes/post_volumecontent_volume_id_dir.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/api/volumes/put_volumecontent_volume_id_file.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/client.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/errors.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/models/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/models/error.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/models/patch_volumecontent_volume_id_path_body.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/models/volume_entry_stat.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/models/volume_entry_stat_type.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/py.typed +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client/types.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client_async/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/client_sync/__init__.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/types.py +0 -0
- {e2b-2.57.0 → e2b-2.58.0}/e2b/volume/utils.py +0 -0
|
@@ -114,6 +114,7 @@ from .sandbox.sandbox_api import (
|
|
|
114
114
|
SnapshotMode,
|
|
115
115
|
)
|
|
116
116
|
from .sandbox_async.commands.command_handle import AsyncCommandHandle
|
|
117
|
+
from .sandbox_async.commands.command_input_handle import AsyncCommandInputHandle
|
|
117
118
|
from .sandbox_async.filesystem.watch_handle import AsyncWatchHandle
|
|
118
119
|
from .sandbox_async.main import AsyncSandbox
|
|
119
120
|
from .sandbox_async.paginator import AsyncSandboxPaginator, AsyncSnapshotPaginator
|
|
@@ -280,6 +281,7 @@ __all__ = [
|
|
|
280
281
|
"AsyncSandbox",
|
|
281
282
|
"AsyncWatchHandle",
|
|
282
283
|
"AsyncCommandHandle",
|
|
284
|
+
"AsyncCommandInputHandle",
|
|
283
285
|
# Template
|
|
284
286
|
"Template",
|
|
285
287
|
"AsyncTemplate",
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
|
-
from typing import
|
|
4
|
+
from typing import (
|
|
5
|
+
cast,
|
|
6
|
+
Literal,
|
|
7
|
+
Mapping,
|
|
8
|
+
Optional,
|
|
9
|
+
Dict,
|
|
10
|
+
Tuple,
|
|
11
|
+
TypedDict,
|
|
12
|
+
Union,
|
|
13
|
+
Unpack,
|
|
14
|
+
)
|
|
5
15
|
|
|
6
16
|
import httpx
|
|
7
|
-
from typing_extensions import Unpack
|
|
8
|
-
|
|
9
17
|
from e2b.exceptions import InvalidArgumentException
|
|
10
18
|
from e2b.retry import resolve_max_retries
|
|
11
19
|
from e2b.api.metadata import package_version
|
|
@@ -22,6 +30,7 @@ narrows it to what the pyqwest REST transports take.
|
|
|
22
30
|
"""
|
|
23
31
|
|
|
24
32
|
REQUEST_TIMEOUT: float = 60.0 # 60 seconds
|
|
33
|
+
STREAM_INPUT_TIMEOUT: float = 60.0 # 60 seconds
|
|
25
34
|
DEFAULT_RETRIES = 3
|
|
26
35
|
|
|
27
36
|
# Idle bound for every read on the streaming envd file-transfer transport:
|
|
@@ -124,24 +124,26 @@ async def first_event(
|
|
|
124
124
|
"""
|
|
125
125
|
if not request_timeout:
|
|
126
126
|
return await events.__anext__()
|
|
127
|
+
task = asyncio.current_task()
|
|
128
|
+
cancelling_before = task.cancelling() if task is not None else 0
|
|
127
129
|
try:
|
|
128
130
|
return await asyncio.wait_for(events.__anext__(), request_timeout)
|
|
129
|
-
except
|
|
131
|
+
except TimeoutError as e:
|
|
130
132
|
raise _request_timeout_exception(request_timeout) from e
|
|
131
133
|
except ConnectError as e:
|
|
132
134
|
# wait_for's expiry cancels the __anext__ task, but connectrpc
|
|
133
135
|
# converts the delivered CancelledError into ConnectError(CANCELED)
|
|
134
136
|
# before wait_for can turn it into TimeoutError. A caller cancelling
|
|
135
|
-
# the surrounding task surfaces identically, so
|
|
136
|
-
#
|
|
137
|
-
#
|
|
138
|
-
#
|
|
139
|
-
#
|
|
140
|
-
cancelling = getattr(asyncio.current_task(), "cancelling", None)
|
|
137
|
+
# the surrounding task surfaces identically, so compare the pending-
|
|
138
|
+
# cancellation count with its entry value: wait_for uncancels its own
|
|
139
|
+
# expiry back to that value, while an external cancel leaves it above
|
|
140
|
+
# it. Comparing against zero would misclassify a timer expiry when the
|
|
141
|
+
# caller had an already-pending, swallowed cancellation.
|
|
141
142
|
if (
|
|
142
143
|
e.code is Code.CANCELED
|
|
143
144
|
and isinstance(e.__cause__, asyncio.CancelledError)
|
|
144
|
-
and
|
|
145
|
+
and task is not None
|
|
146
|
+
and task.cancelling() == cancelling_before
|
|
145
147
|
):
|
|
146
148
|
raise _request_timeout_exception(request_timeout) from e
|
|
147
149
|
raise
|
|
@@ -79,6 +79,24 @@ class DefaultHeadersInterceptor:
|
|
|
79
79
|
self._apply(ctx)
|
|
80
80
|
return await call_next(request, ctx)
|
|
81
81
|
|
|
82
|
+
def intercept_client_stream_sync(
|
|
83
|
+
self,
|
|
84
|
+
call_next: Callable[[Iterator[REQ], RequestContext], RES],
|
|
85
|
+
request: Iterator[REQ],
|
|
86
|
+
ctx: RequestContext,
|
|
87
|
+
) -> RES:
|
|
88
|
+
self._apply(ctx)
|
|
89
|
+
return call_next(request, ctx)
|
|
90
|
+
|
|
91
|
+
async def intercept_client_stream(
|
|
92
|
+
self,
|
|
93
|
+
call_next: Callable[[AsyncIterator[REQ], RequestContext], Awaitable[RES]],
|
|
94
|
+
request: AsyncIterator[REQ],
|
|
95
|
+
ctx: RequestContext,
|
|
96
|
+
) -> RES:
|
|
97
|
+
self._apply(ctx)
|
|
98
|
+
return await call_next(request, ctx)
|
|
99
|
+
|
|
82
100
|
def intercept_server_stream_sync(
|
|
83
101
|
self,
|
|
84
102
|
call_next: Callable[[REQ, RequestContext], Iterator[RES]],
|
|
@@ -161,6 +179,36 @@ class LoggingInterceptor:
|
|
|
161
179
|
self._log_response(ctx, None)
|
|
162
180
|
return response
|
|
163
181
|
|
|
182
|
+
def intercept_client_stream_sync(
|
|
183
|
+
self,
|
|
184
|
+
call_next: Callable[[Iterator[REQ], RequestContext], RES],
|
|
185
|
+
request: Iterator[REQ],
|
|
186
|
+
ctx: RequestContext,
|
|
187
|
+
) -> RES:
|
|
188
|
+
self._log_request(ctx)
|
|
189
|
+
try:
|
|
190
|
+
response = call_next(request, ctx)
|
|
191
|
+
except Exception as e:
|
|
192
|
+
self._log_response(ctx, e)
|
|
193
|
+
raise
|
|
194
|
+
self._log_response(ctx, None)
|
|
195
|
+
return response
|
|
196
|
+
|
|
197
|
+
async def intercept_client_stream(
|
|
198
|
+
self,
|
|
199
|
+
call_next: Callable[[AsyncIterator[REQ], RequestContext], Awaitable[RES]],
|
|
200
|
+
request: AsyncIterator[REQ],
|
|
201
|
+
ctx: RequestContext,
|
|
202
|
+
) -> RES:
|
|
203
|
+
self._log_request(ctx)
|
|
204
|
+
try:
|
|
205
|
+
response = await call_next(request, ctx)
|
|
206
|
+
except Exception as e:
|
|
207
|
+
self._log_response(ctx, e)
|
|
208
|
+
raise
|
|
209
|
+
self._log_response(ctx, None)
|
|
210
|
+
return response
|
|
211
|
+
|
|
164
212
|
def intercept_server_stream_sync(
|
|
165
213
|
self,
|
|
166
214
|
call_next: Callable[[REQ, RequestContext], Iterator[RES]],
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from typing import Literal, Union
|
|
2
|
+
|
|
3
|
+
from protobuf import Oneof
|
|
4
|
+
|
|
5
|
+
from e2b.envd.process import process_pb
|
|
6
|
+
|
|
7
|
+
InputKind = Literal["stdin", "pty"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def stream_input_start(pid: int) -> process_pb.StreamInputRequest:
|
|
11
|
+
return process_pb.StreamInputRequest(
|
|
12
|
+
event=Oneof(
|
|
13
|
+
"start",
|
|
14
|
+
process_pb.StreamInputRequest.StartEvent(
|
|
15
|
+
process=process_pb.ProcessSelector(selector=Oneof("pid", pid))
|
|
16
|
+
),
|
|
17
|
+
)
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def stream_input_data(
|
|
22
|
+
input_kind: InputKind, data: Union[str, bytes]
|
|
23
|
+
) -> process_pb.StreamInputRequest:
|
|
24
|
+
payload = data.encode("utf-8") if isinstance(data, str) else data
|
|
25
|
+
input_value: Oneof[Literal["stdin"], bytes] | Oneof[Literal["pty"], bytes]
|
|
26
|
+
if input_kind == "stdin":
|
|
27
|
+
input_value = Oneof("stdin", payload)
|
|
28
|
+
else:
|
|
29
|
+
input_value = Oneof("pty", payload)
|
|
30
|
+
return process_pb.StreamInputRequest(
|
|
31
|
+
event=Oneof(
|
|
32
|
+
"data",
|
|
33
|
+
process_pb.StreamInputRequest.DataEvent(
|
|
34
|
+
input=process_pb.ProcessInput(input=input_value)
|
|
35
|
+
),
|
|
36
|
+
)
|
|
37
|
+
)
|
|
@@ -240,7 +240,7 @@ class AsyncFileStreamReader(AsyncIterator[bytes]):
|
|
|
240
240
|
if self._idle_timeout:
|
|
241
241
|
return await asyncio.wait_for(read, self._idle_timeout)
|
|
242
242
|
return await read
|
|
243
|
-
except
|
|
243
|
+
except TimeoutError as e:
|
|
244
244
|
# `wait_for`'s expiry; keep the documented httpx exception. The
|
|
245
245
|
# transport's own idle read timeout already arrives as one.
|
|
246
246
|
await self.aclose()
|
|
@@ -9,14 +9,14 @@ from typing import (
|
|
|
9
9
|
List,
|
|
10
10
|
Literal,
|
|
11
11
|
Mapping,
|
|
12
|
+
NotRequired,
|
|
12
13
|
Optional,
|
|
13
14
|
TypedDict,
|
|
15
|
+
Unpack,
|
|
14
16
|
Union,
|
|
15
17
|
cast,
|
|
16
18
|
)
|
|
17
19
|
|
|
18
|
-
from typing_extensions import NotRequired, Unpack
|
|
19
|
-
|
|
20
20
|
from e2b.api.client.models import (
|
|
21
21
|
ListedSandbox,
|
|
22
22
|
SandboxDetail,
|
|
@@ -9,6 +9,7 @@ from e2b.connection_config import (
|
|
|
9
9
|
Username,
|
|
10
10
|
KEEPALIVE_PING_HEADER,
|
|
11
11
|
KEEPALIVE_PING_INTERVAL_SEC,
|
|
12
|
+
STREAM_INPUT_TIMEOUT,
|
|
12
13
|
)
|
|
13
14
|
from protobuf import Oneof
|
|
14
15
|
|
|
@@ -25,6 +26,7 @@ from e2b.envd.versions import ENVD_COMMANDS_STDIN, ENVD_ENVD_CLOSE
|
|
|
25
26
|
from e2b.exceptions import SandboxException
|
|
26
27
|
from e2b.sandbox.commands.main import ProcessInfo
|
|
27
28
|
from e2b.sandbox.commands.command_handle import CommandResult
|
|
29
|
+
from e2b.sandbox_async.commands.command_input_handle import AsyncCommandInputHandle
|
|
28
30
|
from e2b.sandbox_async.commands.command_handle import AsyncCommandHandle, Stderr, Stdout
|
|
29
31
|
from e2b.sandbox_async.utils import OutputHandler
|
|
30
32
|
|
|
@@ -145,6 +147,32 @@ class Commands:
|
|
|
145
147
|
except Exception as e:
|
|
146
148
|
raise await ahandle_rpc_exception_with_health(e, self._check_health)
|
|
147
149
|
|
|
150
|
+
def stream_input(
|
|
151
|
+
self,
|
|
152
|
+
pid: int,
|
|
153
|
+
*,
|
|
154
|
+
timeout: Optional[float] = STREAM_INPUT_TIMEOUT,
|
|
155
|
+
) -> AsyncCommandInputHandle:
|
|
156
|
+
"""Open an ordered input handle to command stdin.
|
|
157
|
+
|
|
158
|
+
:param pid: Process ID of the command.
|
|
159
|
+
:param timeout: Timeout in seconds; defaults to ``STREAM_INPUT_TIMEOUT``
|
|
160
|
+
(60 seconds). ``0`` or ``None`` disables the timeout.
|
|
161
|
+
:return: Handle for queuing ordered input with ``send()`` and ending the
|
|
162
|
+
stream with ``close()``.
|
|
163
|
+
:raises NotFoundException: If the command does not exist; surfaced by
|
|
164
|
+
the handle's ``send()`` or ``close()``.
|
|
165
|
+
:raises TimeoutException: If the stream timeout expires; surfaced by
|
|
166
|
+
the handle's ``send()`` or ``close()``.
|
|
167
|
+
"""
|
|
168
|
+
return AsyncCommandInputHandle(
|
|
169
|
+
self._rpc,
|
|
170
|
+
pid,
|
|
171
|
+
"stdin",
|
|
172
|
+
timeout,
|
|
173
|
+
self._check_health,
|
|
174
|
+
)
|
|
175
|
+
|
|
148
176
|
async def close_stdin(
|
|
149
177
|
self,
|
|
150
178
|
pid: int,
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from typing import Any, AsyncGenerator, Awaitable, Callable, Optional, Union
|
|
3
|
+
|
|
4
|
+
from protobuf import Oneof
|
|
5
|
+
|
|
6
|
+
from e2b.connection_config import KEEPALIVE_PING_INTERVAL_SEC
|
|
7
|
+
from e2b.envd.process import process_pb
|
|
8
|
+
from e2b.envd.rpc import ahandle_rpc_exception_with_health
|
|
9
|
+
from e2b.envd.utils import timeout_to_ms
|
|
10
|
+
from e2b.exceptions import SandboxException
|
|
11
|
+
from e2b.sandbox.commands.stream_input import (
|
|
12
|
+
InputKind,
|
|
13
|
+
stream_input_data,
|
|
14
|
+
stream_input_start,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class _CloseSignal:
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
_CLOSE = _CloseSignal()
|
|
23
|
+
_QueueItem = Union[str, bytes, _CloseSignal]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class AsyncCommandInputHandle:
|
|
27
|
+
"""An ordered, long-lived input handle for a command or PTY."""
|
|
28
|
+
|
|
29
|
+
def __init__(
|
|
30
|
+
self,
|
|
31
|
+
rpc: Any,
|
|
32
|
+
pid: int,
|
|
33
|
+
input_kind: InputKind,
|
|
34
|
+
timeout: Optional[float],
|
|
35
|
+
check_health: Callable[[], Awaitable[Optional[bool]]],
|
|
36
|
+
_keepalive_interval: float = KEEPALIVE_PING_INTERVAL_SEC,
|
|
37
|
+
) -> None:
|
|
38
|
+
self._rpc = rpc
|
|
39
|
+
self._pid = pid
|
|
40
|
+
self._input_kind = input_kind
|
|
41
|
+
self._timeout = timeout
|
|
42
|
+
self._check_health = check_health
|
|
43
|
+
self._keepalive_interval = _keepalive_interval
|
|
44
|
+
self._queue: asyncio.Queue[_QueueItem] = asyncio.Queue()
|
|
45
|
+
self._closing = False
|
|
46
|
+
self._stopped = False
|
|
47
|
+
self._failure: Optional[Exception] = None
|
|
48
|
+
self._task = asyncio.create_task(self._run())
|
|
49
|
+
|
|
50
|
+
async def send(self, data: Union[str, bytes]) -> None:
|
|
51
|
+
"""Queue input for ordered transmission.
|
|
52
|
+
|
|
53
|
+
:param data: Input data to send.
|
|
54
|
+
:return: ``None`` once the input has been queued.
|
|
55
|
+
:raises NotFoundException: If the command or PTY does not exist.
|
|
56
|
+
:raises TimeoutException: If the input stream times out.
|
|
57
|
+
:raises SandboxException: If this handle is closed. Open a new one with
|
|
58
|
+
``sandbox.commands.stream_input(pid)`` or
|
|
59
|
+
``sandbox.pty.stream_input(pid)``.
|
|
60
|
+
"""
|
|
61
|
+
if self._failure is not None:
|
|
62
|
+
raise self._failure
|
|
63
|
+
if self._closing or self._stopped:
|
|
64
|
+
raise SandboxException(
|
|
65
|
+
"Cannot send input after the input handle is closed. Open a new one "
|
|
66
|
+
"with `sandbox.commands.stream_input(pid)` or "
|
|
67
|
+
"`sandbox.pty.stream_input(pid)`."
|
|
68
|
+
)
|
|
69
|
+
self._queue.put_nowait(data)
|
|
70
|
+
|
|
71
|
+
async def close(self) -> None:
|
|
72
|
+
"""Finish the input stream and wait for envd to acknowledge it.
|
|
73
|
+
|
|
74
|
+
:return: ``None`` when envd acknowledges the end of the input stream.
|
|
75
|
+
:raises NotFoundException: If the command or PTY does not exist.
|
|
76
|
+
:raises TimeoutException: If the input stream times out.
|
|
77
|
+
"""
|
|
78
|
+
if not self._closing:
|
|
79
|
+
self._closing = True
|
|
80
|
+
self._queue.put_nowait(_CLOSE)
|
|
81
|
+
await asyncio.shield(self._task)
|
|
82
|
+
if self._failure is not None:
|
|
83
|
+
raise self._failure
|
|
84
|
+
|
|
85
|
+
async def __aenter__(self) -> "AsyncCommandInputHandle":
|
|
86
|
+
return self
|
|
87
|
+
|
|
88
|
+
async def __aexit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
|
|
89
|
+
await self.close()
|
|
90
|
+
|
|
91
|
+
async def _run(self) -> None:
|
|
92
|
+
try:
|
|
93
|
+
await self._rpc.stream_input(
|
|
94
|
+
self._requests(),
|
|
95
|
+
timeout_ms=timeout_to_ms(self._timeout),
|
|
96
|
+
)
|
|
97
|
+
except Exception as error:
|
|
98
|
+
self._failure = await ahandle_rpc_exception_with_health(
|
|
99
|
+
error, self._check_health
|
|
100
|
+
)
|
|
101
|
+
self._stopped = True
|
|
102
|
+
self._discard_pending_input()
|
|
103
|
+
else:
|
|
104
|
+
self._stopped = True
|
|
105
|
+
|
|
106
|
+
def _discard_pending_input(self) -> None:
|
|
107
|
+
while not self._queue.empty():
|
|
108
|
+
try:
|
|
109
|
+
self._queue.get_nowait()
|
|
110
|
+
except asyncio.QueueEmpty:
|
|
111
|
+
break
|
|
112
|
+
self._queue.put_nowait(_CLOSE)
|
|
113
|
+
|
|
114
|
+
async def _requests(self) -> AsyncGenerator[process_pb.StreamInputRequest, None]:
|
|
115
|
+
yield stream_input_start(self._pid)
|
|
116
|
+
|
|
117
|
+
while not self._stopped:
|
|
118
|
+
try:
|
|
119
|
+
data = await asyncio.wait_for(
|
|
120
|
+
self._queue.get(), timeout=self._keepalive_interval
|
|
121
|
+
)
|
|
122
|
+
except asyncio.TimeoutError:
|
|
123
|
+
yield process_pb.StreamInputRequest(
|
|
124
|
+
event=Oneof("keepalive", process_pb.StreamInputRequest.KeepAlive())
|
|
125
|
+
)
|
|
126
|
+
continue
|
|
127
|
+
|
|
128
|
+
if isinstance(data, _CloseSignal):
|
|
129
|
+
return
|
|
130
|
+
|
|
131
|
+
yield stream_input_data(self._input_kind, data)
|
|
@@ -13,6 +13,7 @@ from e2b.connection_config import (
|
|
|
13
13
|
ConnectionConfig,
|
|
14
14
|
KEEPALIVE_PING_HEADER,
|
|
15
15
|
KEEPALIVE_PING_INTERVAL_SEC,
|
|
16
|
+
STREAM_INPUT_TIMEOUT,
|
|
16
17
|
)
|
|
17
18
|
from e2b.envd.api import acheck_sandbox_health
|
|
18
19
|
from e2b.envd.rpc import akill_process, ahandle_rpc_exception_with_health
|
|
@@ -23,6 +24,7 @@ from e2b.envd.utils import (
|
|
|
23
24
|
)
|
|
24
25
|
from e2b.envd.client_async import as_stream, create_rpc_client, first_event
|
|
25
26
|
from e2b.sandbox.commands.command_handle import PtySize
|
|
27
|
+
from e2b.sandbox_async.commands.command_input_handle import AsyncCommandInputHandle
|
|
26
28
|
from e2b.sandbox_async.commands.command_handle import (
|
|
27
29
|
AsyncCommandHandle,
|
|
28
30
|
OutputHandler,
|
|
@@ -108,6 +110,32 @@ class Pty:
|
|
|
108
110
|
except Exception as e:
|
|
109
111
|
raise await ahandle_rpc_exception_with_health(e, self._check_health)
|
|
110
112
|
|
|
113
|
+
def stream_input(
|
|
114
|
+
self,
|
|
115
|
+
pid: int,
|
|
116
|
+
*,
|
|
117
|
+
timeout: Optional[float] = STREAM_INPUT_TIMEOUT,
|
|
118
|
+
) -> AsyncCommandInputHandle:
|
|
119
|
+
"""Open an ordered input handle to a PTY.
|
|
120
|
+
|
|
121
|
+
:param pid: Process ID of the PTY.
|
|
122
|
+
:param timeout: Timeout in seconds; defaults to ``STREAM_INPUT_TIMEOUT``
|
|
123
|
+
(60 seconds). ``0`` or ``None`` disables the timeout.
|
|
124
|
+
:return: Handle for queuing ordered input with ``send()`` and ending the
|
|
125
|
+
stream with ``close()``.
|
|
126
|
+
:raises NotFoundException: If the PTY does not exist; surfaced by the
|
|
127
|
+
handle's ``send()`` or ``close()``.
|
|
128
|
+
:raises TimeoutException: If the stream timeout expires; surfaced by
|
|
129
|
+
the handle's ``send()`` or ``close()``.
|
|
130
|
+
"""
|
|
131
|
+
return AsyncCommandInputHandle(
|
|
132
|
+
self._rpc,
|
|
133
|
+
pid,
|
|
134
|
+
"pty",
|
|
135
|
+
timeout,
|
|
136
|
+
self._check_health,
|
|
137
|
+
)
|
|
138
|
+
|
|
111
139
|
async def create(
|
|
112
140
|
self,
|
|
113
141
|
size: PtySize,
|
|
@@ -255,7 +255,7 @@ class Filesystem:
|
|
|
255
255
|
raise await ahandle_envd_api_transport_exception_with_health(
|
|
256
256
|
e, self._envd_health_api
|
|
257
257
|
)
|
|
258
|
-
except
|
|
258
|
+
except TimeoutError as e:
|
|
259
259
|
# wait_for's expiry; keep the httpx exception the
|
|
260
260
|
# streamed-read contract established.
|
|
261
261
|
raise httpx.ReadTimeout(str(e)) from e
|
|
@@ -4,12 +4,10 @@ import json
|
|
|
4
4
|
import logging
|
|
5
5
|
import shlex
|
|
6
6
|
import uuid
|
|
7
|
-
from typing import Dict, List, Optional, Union, overload
|
|
7
|
+
from typing import Dict, List, Optional, Self, Unpack, Union, overload
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
10
|
from packaging.version import Version
|
|
11
|
-
from typing_extensions import Self, Unpack
|
|
12
|
-
|
|
13
11
|
from e2b.api.client.types import Unset
|
|
14
12
|
from e2b.api.client_async import get_envd_api
|
|
15
13
|
from e2b.connection_config import ApiParams, ConnectionConfig
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import logging
|
|
3
|
-
from typing import Any, Dict, List, Optional, Union, cast
|
|
3
|
+
from typing import Any, Dict, List, Optional, Unpack, Union, cast
|
|
4
4
|
|
|
5
5
|
from packaging.version import Version
|
|
6
|
-
from typing_extensions import Unpack
|
|
7
|
-
|
|
8
6
|
from e2b.api import (
|
|
9
7
|
SandboxCreateResponse,
|
|
10
8
|
api_exception_from_code,
|
|
@@ -3,6 +3,7 @@ from typing import (
|
|
|
3
3
|
Callable,
|
|
4
4
|
Dict,
|
|
5
5
|
Generator,
|
|
6
|
+
Iterable,
|
|
6
7
|
List,
|
|
7
8
|
Literal,
|
|
8
9
|
Optional,
|
|
@@ -19,6 +20,7 @@ from e2b.connection_config import (
|
|
|
19
20
|
Username,
|
|
20
21
|
KEEPALIVE_PING_HEADER,
|
|
21
22
|
KEEPALIVE_PING_INTERVAL_SEC,
|
|
23
|
+
STREAM_INPUT_TIMEOUT,
|
|
22
24
|
)
|
|
23
25
|
from protobuf import Oneof
|
|
24
26
|
|
|
@@ -32,9 +34,10 @@ from e2b.envd.utils import (
|
|
|
32
34
|
)
|
|
33
35
|
from e2b.envd.client_sync import as_stream, create_rpc_client
|
|
34
36
|
from e2b.envd.versions import ENVD_COMMANDS_STDIN, ENVD_ENVD_CLOSE
|
|
35
|
-
from e2b.exceptions import SandboxException
|
|
37
|
+
from e2b.exceptions import InvalidArgumentException, SandboxException
|
|
36
38
|
from e2b.sandbox.commands.main import ProcessInfo
|
|
37
39
|
from e2b.sandbox.commands.command_handle import CommandResult
|
|
40
|
+
from e2b.sandbox.commands.stream_input import stream_input_data, stream_input_start
|
|
38
41
|
from e2b.sandbox_sync.commands.command_handle import CommandHandle
|
|
39
42
|
|
|
40
43
|
|
|
@@ -154,6 +157,48 @@ class Commands:
|
|
|
154
157
|
except Exception as e:
|
|
155
158
|
raise handle_rpc_exception_with_health(e, self._check_health)
|
|
156
159
|
|
|
160
|
+
def stream_input(
|
|
161
|
+
self,
|
|
162
|
+
pid: int,
|
|
163
|
+
data: Iterable[Union[str, bytes]],
|
|
164
|
+
*,
|
|
165
|
+
timeout: Optional[float] = STREAM_INPUT_TIMEOUT,
|
|
166
|
+
) -> None:
|
|
167
|
+
"""Stream input to command stdin.
|
|
168
|
+
|
|
169
|
+
Blocks until ``data`` is exhausted; input is sent as the iterable
|
|
170
|
+
yields it, and no keepalives are sent while it blocks.
|
|
171
|
+
|
|
172
|
+
:param pid: Process ID of the command.
|
|
173
|
+
:param data: Iterable of strings or bytes to send in order.
|
|
174
|
+
:param timeout: Timeout in seconds; defaults to ``STREAM_INPUT_TIMEOUT``
|
|
175
|
+
(60 seconds). ``0`` or ``None`` disables the timeout.
|
|
176
|
+
:return: ``None`` after all input is sent and envd acknowledges the stream.
|
|
177
|
+
:raises NotFoundException: If the command does not exist.
|
|
178
|
+
:raises TimeoutException: If the stream timeout expires.
|
|
179
|
+
:raises SandboxException: If the streaming request fails.
|
|
180
|
+
:raises InvalidArgumentException: If ``data`` is a single ``str`` or
|
|
181
|
+
``bytes`` value instead of an iterable of chunks.
|
|
182
|
+
"""
|
|
183
|
+
if isinstance(data, (str, bytes, bytearray, memoryview)):
|
|
184
|
+
raise InvalidArgumentException(
|
|
185
|
+
"`data` must be an iterable of str or bytes chunks, not a single "
|
|
186
|
+
"chunk; wrap it in a list, e.g. `stream_input(pid, [data])`."
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
def requests() -> Generator[process_pb.StreamInputRequest, None, None]:
|
|
190
|
+
yield stream_input_start(pid)
|
|
191
|
+
for item in data:
|
|
192
|
+
yield stream_input_data("stdin", item)
|
|
193
|
+
|
|
194
|
+
try:
|
|
195
|
+
self._rpc.stream_input(
|
|
196
|
+
requests(),
|
|
197
|
+
timeout_ms=timeout_to_ms(timeout),
|
|
198
|
+
)
|
|
199
|
+
except Exception as error:
|
|
200
|
+
raise handle_rpc_exception_with_health(error, self._check_health)
|
|
201
|
+
|
|
157
202
|
def close_stdin(
|
|
158
203
|
self,
|
|
159
204
|
pid: int,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Dict, Optional
|
|
1
|
+
from typing import Dict, Generator, Iterable, Optional, Union
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
|
|
@@ -13,6 +13,7 @@ from e2b.connection_config import (
|
|
|
13
13
|
ConnectionConfig,
|
|
14
14
|
KEEPALIVE_PING_HEADER,
|
|
15
15
|
KEEPALIVE_PING_INTERVAL_SEC,
|
|
16
|
+
STREAM_INPUT_TIMEOUT,
|
|
16
17
|
)
|
|
17
18
|
from e2b.envd.api import check_sandbox_health
|
|
18
19
|
from e2b.envd.rpc import handle_rpc_exception_with_health, kill_process
|
|
@@ -22,7 +23,9 @@ from e2b.envd.utils import (
|
|
|
22
23
|
timeout_to_ms,
|
|
23
24
|
)
|
|
24
25
|
from e2b.envd.client_sync import as_stream, create_rpc_client
|
|
26
|
+
from e2b.exceptions import InvalidArgumentException
|
|
25
27
|
from e2b.sandbox.commands.command_handle import PtySize
|
|
28
|
+
from e2b.sandbox.commands.stream_input import stream_input_data, stream_input_start
|
|
26
29
|
from e2b.sandbox_sync.commands.command_handle import CommandHandle
|
|
27
30
|
|
|
28
31
|
|
|
@@ -104,6 +107,48 @@ class Pty:
|
|
|
104
107
|
except Exception as e:
|
|
105
108
|
raise handle_rpc_exception_with_health(e, self._check_health)
|
|
106
109
|
|
|
110
|
+
def stream_input(
|
|
111
|
+
self,
|
|
112
|
+
pid: int,
|
|
113
|
+
data: Iterable[Union[str, bytes]],
|
|
114
|
+
*,
|
|
115
|
+
timeout: Optional[float] = STREAM_INPUT_TIMEOUT,
|
|
116
|
+
) -> None:
|
|
117
|
+
"""Stream input to a PTY.
|
|
118
|
+
|
|
119
|
+
Blocks until ``data`` is exhausted; input is sent as the iterable
|
|
120
|
+
yields it, and no keepalives are sent while it blocks.
|
|
121
|
+
|
|
122
|
+
:param pid: Process ID of the PTY.
|
|
123
|
+
:param data: Iterable of strings or bytes to send in order.
|
|
124
|
+
:param timeout: Timeout in seconds; defaults to ``STREAM_INPUT_TIMEOUT``
|
|
125
|
+
(60 seconds). ``0`` or ``None`` disables the timeout.
|
|
126
|
+
:return: ``None`` after all input is sent and envd acknowledges the stream.
|
|
127
|
+
:raises NotFoundException: If the PTY does not exist.
|
|
128
|
+
:raises TimeoutException: If the stream timeout expires.
|
|
129
|
+
:raises SandboxException: If the streaming request fails.
|
|
130
|
+
:raises InvalidArgumentException: If ``data`` is a single ``str`` or
|
|
131
|
+
``bytes`` value instead of an iterable of chunks.
|
|
132
|
+
"""
|
|
133
|
+
if isinstance(data, (str, bytes, bytearray, memoryview)):
|
|
134
|
+
raise InvalidArgumentException(
|
|
135
|
+
"`data` must be an iterable of str or bytes chunks, not a single "
|
|
136
|
+
"chunk; wrap it in a list, e.g. `stream_input(pid, [data])`."
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
def requests() -> Generator[process_pb.StreamInputRequest, None, None]:
|
|
140
|
+
yield stream_input_start(pid)
|
|
141
|
+
for item in data:
|
|
142
|
+
yield stream_input_data("pty", item)
|
|
143
|
+
|
|
144
|
+
try:
|
|
145
|
+
self._rpc.stream_input(
|
|
146
|
+
requests(),
|
|
147
|
+
timeout_ms=timeout_to_ms(timeout),
|
|
148
|
+
)
|
|
149
|
+
except Exception as error:
|
|
150
|
+
raise handle_rpc_exception_with_health(error, self._check_health)
|
|
151
|
+
|
|
107
152
|
def create(
|
|
108
153
|
self,
|
|
109
154
|
size: PtySize,
|