withruntime 0.15.0__tar.gz → 0.16.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.
- {withruntime-0.15.0 → withruntime-0.16.0}/PKG-INFO +1 -1
- {withruntime-0.15.0 → withruntime-0.16.0}/pyproject.toml +1 -1
- withruntime-0.16.0/tests/test_exec_user.py +92 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_identity_token.py +27 -4
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_package_typing.py +1 -1
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/__init__.py +54 -8
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_client.py +22 -9
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_client.py +22 -9
- withruntime-0.16.0/withruntime/_version.py +1 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime.egg-info/PKG-INFO +1 -1
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime.egg-info/SOURCES.txt +1 -0
- withruntime-0.15.0/withruntime/_version.py +0 -1
- {withruntime-0.15.0 → withruntime-0.16.0}/LICENSE +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/README.md +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/setup.cfg +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_account_errors.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_answer_start.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_async_stream_cleanup.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_audit.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_billing.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_blaxel.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_blaxel_0_4_17.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_blaxel_0_4_18.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_blaxel_create_timeout.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_blaxel_wait_deadline.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_browser.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_capacity_wait.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_live.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_modal_deadline_errors.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_new_providers.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_prime_contract.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_prime_process_lifecycle.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_prime_validation.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_disk_snapshots.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_e2b_deadline.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_e2b_pty.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_e2b_stream.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_e2b_watch.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_interpreter_deadline.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_modal.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_morph.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_official.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_pins.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_processes.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_request_scope.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_runloop.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_shell.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_snapshot_capture.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_python_sprites.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_compat_router.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_customer_usage.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_daytona.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_daytona_0_223_1.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_daytona_0_224_1.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_daytona_create_cleanup.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_daytona_create_options.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_daytona_download_labels.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_daytona_refusals_lifted.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_deepagents.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_e2b_2_55.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_e2b_code_interpreter.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_e2b_connection_cap.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_e2b_exports.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_e2b_fork_validation.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_e2b_sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_e2b_upstream.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_e2b_watch.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_embed_and_webhook_watch.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_eval_sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_exec_stream.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_exec_stream_names.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_file_archives.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_files_download.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_files_mode.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_files_upload_parallel.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_files_write_lost_body.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_harbor.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_http_tls_close.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_image_delete_by_name.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_images_v2.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_images_volumes_interpreter.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_inspect_ai.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_interface_contract.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_jobs.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_late_answer.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_lifecycle_settings.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_limits.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_machine_engine.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_modal_1_6_2.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_modal_dropin.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_mounts.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_network_funding.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_network_products.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_observability.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_openai_agents.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_out_of_memory.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_previews_network_desktop.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_prime_0_4_5.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_private_network.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_process_deadline.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_process_input.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_process_object.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_process_output.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_process_write_backpressure.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_product_aliases.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_proxy.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_referrals.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_replayed_create_message.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_runloop_stream_cleanup.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_runloop_v2.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_sandbox_origin.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_sandbox_sessions.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_sandboxes_delete_all.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_sandboxes_stop_all.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_saved_connection.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_secrets.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_signed_requests.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_snapshot_after_fork.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_snapshot_recovery.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_sso.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_start_report_kept.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_stream_cut_short.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_stream_exit_close.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_switch_image.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_switching.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_tailscale.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_tools.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_transport_body_recovery.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_transport_connection_limits.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_transport_never_sent.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_unpack.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_upload_deadline.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_vercel.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_vercel_create_validation.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_vercel_disk_snapshot.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_vercel_refusals_lifted.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_volume_backups.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_volume_operations.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_wake_awake.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_wallet.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/tests/test_watch.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_api_defaults.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/audit.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/billing.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/browser.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/desktop.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/images.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/interpreter.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/jobs.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/limits.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/mcp.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/mounts.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/network.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/network_products.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/observability.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/previews.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/private_network.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/referrals.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/secrets.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/signed_requests.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/sso.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/switching.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/tailscale.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/volumes.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_async_products/watch.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_clock.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_compat.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_compat_lease.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_compat_lifecycle.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_compat_shell.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_connection.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_errors.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_eval_sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_http.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_proxy.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_renamed.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_request_scope.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/audit.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/billing.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/browser.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/desktop.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/images.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/interpreter.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/jobs.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/limits.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/mcp.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/mounts.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/network.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/network_products.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/observability.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/previews.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/private_network.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/referrals.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/secrets.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/signed_requests.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/sso.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/switching.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/tailscale.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/volumes.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_sync_products/watch.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_tunnel.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_unpack.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/_ws.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/_async_io.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/_async_sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/_core.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/_sync_io.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/_sync_sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/agents.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/api/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/api/applications/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/api/applications/list_application_revisions.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/api/compute/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/api/compute/get_sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/api/compute/update_sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/api/functions/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/api/functions/create_function.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/api/images.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/api/workspaces.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/client.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/models/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/models/create_job_execution_request.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/models/create_job_execution_request_env.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/models/env.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/models/function.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/models/function_runtime.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/models/function_spec.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/models/metadata.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/models/pagination_meta.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/models/workspace.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/pagination.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/client/types.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/common.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/drive.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/errors.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/jobs.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/sandbox/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/sandbox/types.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/core/secret.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/crewai.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/googleadk.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/langgraph.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/livekit.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/llamaindex.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/openai.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/pydantic.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/blaxel/telemetry.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/daytona/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/daytona/_async_daytona.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/daytona/_async_io.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/daytona/_core.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/daytona/_sync_daytona.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/daytona/_sync_io.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/deepagents.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/_async_io.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/_async_sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/_core.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/_sync_io.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/_sync_sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/code_interpreter/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/code_interpreter/_async_ci.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/code_interpreter/_models.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/code_interpreter/_sync_ci.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/code_interpreter/charts.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/code_interpreter/code_interpreter_async.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/code_interpreter/code_interpreter_sync.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/code_interpreter/models.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/connection_config.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/exceptions.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox/commands/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox/commands/command_handle.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox/commands/main.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox/filesystem/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox/filesystem/filesystem.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox/filesystem/watch_handle.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox/network.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox/sandbox_api.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox/signature.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_async/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_async/commands/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_async/commands/command.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_async/commands/command_handle.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_async/commands/pty.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_async/filesystem/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_async/filesystem/filesystem.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_async/filesystem/watch_handle.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_async/main.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_async/paginator.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_async/utils.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_sync/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_sync/commands/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_sync/commands/command.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_sync/commands/command_handle.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_sync/commands/pty.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_sync/filesystem/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_sync/filesystem/filesystem.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_sync/filesystem/watch_handle.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_sync/git.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_sync/main.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/sandbox_sync/paginator.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/secret/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/template/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/template/dockerfile_parser.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/template/logger.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/template/main.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/template/readycmd.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/template/types.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/template_async/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/template_async/main.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/template_sync/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/template_sync/main.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/volume/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/volume/connection_config.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/volume/types.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/volume/volume_async.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/e2b/volume/volume_sync.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/harbor.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/inspect_ai.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/_async.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/_dual.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/_fs_async.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/_fs_common.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/_fs_sync.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/_lookup.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/_object.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/_probe.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/_snapshot.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/_tunnel.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/app.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/cloud_bucket_mount.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/exception.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/file_pattern_matcher.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/image.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/proxy.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/sandbox/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/sandbox/sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/sandbox_fs.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/secret.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/snapshot.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/types.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/modal/volume.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/morph/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/morph/api.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/openai_agents.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/prime/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/prime/_async.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/prime/_sync.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/prime/core/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/prime/core/client.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/prime/exceptions.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/prime/models.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/prime/process.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/prime/sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/py.typed +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/runloop/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/runloop/_async.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/runloop/_exceptions.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/runloop/_snapshots.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/runloop/_sync.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/runloop/_v2.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/runloop/lib/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/runloop/lib/polling.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/runloop/sdk/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/_capture.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/_capture_async.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/_features.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/_metadata.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/_stream.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/_stream_async.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/_translate.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/async_client.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/async_exec.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/client.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/control.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/exceptions.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/exec.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/filesystem.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/sprite.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/sprites/types.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/tools.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/vercel/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/vercel/_async_io.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/vercel/_async_sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/vercel/_core.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/vercel/_sync_io.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/vercel/_sync_sandbox.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/vercel/api.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/vercel/sandbox/__init__.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/vercel/sandbox/sync.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/wallet.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime/webhooks.py +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime.egg-info/dependency_links.txt +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime.egg-info/entry_points.txt +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime.egg-info/requires.txt +0 -0
- {withruntime-0.15.0 → withruntime-0.16.0}/withruntime.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "withruntime"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.16.0"
|
|
8
8
|
description = "Runtime Cloud: one client (sync and async) for every Runtime product. Sandboxes first."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "Apache-2.0" }
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""exec, exec_stream, spawn and terminal take user="root", sent only when given."""
|
|
2
|
+
import asyncio
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
from withruntime._async_client import AsyncSandbox
|
|
6
|
+
from withruntime._sync_client import Sandbox
|
|
7
|
+
|
|
8
|
+
ID = "11111111-2222-4333-8444-555555555555"
|
|
9
|
+
RESULT = {"exitCode": 0, "stdout": "", "stderr": "", "state": "exited", "timedOut": False}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Recorder:
|
|
13
|
+
"""Stands in for the transport: keeps each body and query it was given."""
|
|
14
|
+
|
|
15
|
+
def __init__(self, is_async):
|
|
16
|
+
self.is_async, self.bodies, self.queries = is_async, [], []
|
|
17
|
+
|
|
18
|
+
def json(self, method, path, body=None, **_k):
|
|
19
|
+
self.bodies.append(body)
|
|
20
|
+
data = {"id": "p1", "state": "running"} if path.endswith("/processes") else RESULT
|
|
21
|
+
if self.is_async:
|
|
22
|
+
async def later():
|
|
23
|
+
return data
|
|
24
|
+
return later()
|
|
25
|
+
return data
|
|
26
|
+
|
|
27
|
+
def events(self, method, path, body=None, **_k):
|
|
28
|
+
self.bodies.append(body)
|
|
29
|
+
events = [{"type": "start", "processId": "p1"}, {"type": "exit", "exitCode": 0, "state": "exited"}]
|
|
30
|
+
if self.is_async:
|
|
31
|
+
async def gen():
|
|
32
|
+
for event in events:
|
|
33
|
+
yield event
|
|
34
|
+
return gen()
|
|
35
|
+
return (event for event in events)
|
|
36
|
+
|
|
37
|
+
def websocket(self, path, query):
|
|
38
|
+
self.queries.append(query)
|
|
39
|
+
raise OSError("stop")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def drive(is_async, call):
|
|
43
|
+
recorder = Recorder(is_async)
|
|
44
|
+
sandbox = (AsyncSandbox if is_async else Sandbox)(recorder, {"id": ID})
|
|
45
|
+
|
|
46
|
+
def run(name, *args, **kwargs):
|
|
47
|
+
result = getattr(sandbox, name)(*args, **kwargs)
|
|
48
|
+
if name == "exec_stream":
|
|
49
|
+
if is_async:
|
|
50
|
+
async def drain():
|
|
51
|
+
return [e async for e in result]
|
|
52
|
+
return asyncio.run(drain())
|
|
53
|
+
return list(result)
|
|
54
|
+
return asyncio.run(result) if is_async else result
|
|
55
|
+
|
|
56
|
+
call(run)
|
|
57
|
+
return recorder
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class ExecUser(unittest.TestCase):
|
|
61
|
+
def test_user_is_sent_only_when_given(self):
|
|
62
|
+
for is_async in (False, True):
|
|
63
|
+
def call(run):
|
|
64
|
+
run("exec", "id", user="root")
|
|
65
|
+
run("exec", "id")
|
|
66
|
+
run("exec_stream", "id", user="root")
|
|
67
|
+
run("exec_stream", "id")
|
|
68
|
+
run("spawn", "sleep 1", user="root")
|
|
69
|
+
run("spawn", "sleep 1")
|
|
70
|
+
bodies = drive(is_async, call).bodies
|
|
71
|
+
self.assertEqual([b.get("user") for b in bodies], ["root", None] * 3)
|
|
72
|
+
self.assertTrue(all("user" not in b for b in bodies[1::2]))
|
|
73
|
+
|
|
74
|
+
def test_terminal_sends_user_only_when_given(self):
|
|
75
|
+
for is_async in (False, True):
|
|
76
|
+
def call(run):
|
|
77
|
+
for kwargs in ({"user": "root"}, {}):
|
|
78
|
+
try:
|
|
79
|
+
run("terminal", **kwargs)
|
|
80
|
+
except OSError:
|
|
81
|
+
pass
|
|
82
|
+
queries = drive(is_async, call).queries
|
|
83
|
+
self.assertEqual([q.get("user") for q in queries], ["root", None])
|
|
84
|
+
|
|
85
|
+
def test_process_reports_its_user(self):
|
|
86
|
+
from withruntime._sync_client import Process
|
|
87
|
+
self.assertEqual(Process(None, ID, {"id": "p1", "user": "root"}).user, "root")
|
|
88
|
+
self.assertIsNone(Process(None, ID, {"id": "p1"}).user)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
if __name__ == "__main__":
|
|
92
|
+
unittest.main()
|
|
@@ -9,11 +9,14 @@ import unittest
|
|
|
9
9
|
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
10
10
|
from urllib.parse import parse_qs, urlparse
|
|
11
11
|
|
|
12
|
+
import withruntime
|
|
12
13
|
from withruntime import RuntimeError, Sandbox
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class Stub(BaseHTTPRequestHandler):
|
|
16
17
|
seen: list = []
|
|
18
|
+
# What the sandbox's listener answers at /v1/environment; None: nothing.
|
|
19
|
+
current = None
|
|
17
20
|
|
|
18
21
|
def log_message(self, *args):
|
|
19
22
|
pass
|
|
@@ -21,7 +24,9 @@ class Stub(BaseHTTPRequestHandler):
|
|
|
21
24
|
def do_GET(self):
|
|
22
25
|
url = urlparse(self.path)
|
|
23
26
|
Stub.seen.append((url.path, parse_qs(url.query), self.headers.get("Authorization")))
|
|
24
|
-
if
|
|
27
|
+
if url.path == "/v1/environment":
|
|
28
|
+
body, status = (Stub.current, 200) if Stub.current else ({}, 404)
|
|
29
|
+
elif self.headers.get("Authorization") != "Bearer rtid1.statement.sig":
|
|
25
30
|
body, status = {"error": {"code": "unauthorized", "message": "This request token is not valid."}}, 401
|
|
26
31
|
else:
|
|
27
32
|
body, status = {"token": "header.payload.signature", "expiresAt": "2026-09-24T00:10:00Z"}, 200
|
|
@@ -40,9 +45,13 @@ class IdentityTokenTest(unittest.TestCase):
|
|
|
40
45
|
self.thread.start()
|
|
41
46
|
self.saved = {k: os.environ.get(k) for k in ("RUNTIME_ID_TOKEN_REQUEST_URL", "RUNTIME_ID_TOKEN_REQUEST_TOKEN")}
|
|
42
47
|
os.environ["RUNTIME_ID_TOKEN_REQUEST_URL"] = f"http://127.0.0.1:{self.server.server_port}/v1/identity/token"
|
|
43
|
-
Stub.seen = []
|
|
48
|
+
Stub.seen, Stub.current = [], None
|
|
49
|
+
self.where = (withruntime._ENVIRONMENT_URL, withruntime._ENVIRONMENT_FILE)
|
|
50
|
+
withruntime._ENVIRONMENT_URL = f"http://127.0.0.1:{self.server.server_port}/v1/environment"
|
|
51
|
+
withruntime._ENVIRONMENT_FILE = "/nonexistent/runtime/environment.json"
|
|
44
52
|
|
|
45
53
|
def tearDown(self):
|
|
54
|
+
withruntime._ENVIRONMENT_URL, withruntime._ENVIRONMENT_FILE = self.where
|
|
46
55
|
self.server.shutdown()
|
|
47
56
|
self.server.server_close()
|
|
48
57
|
self.thread.join()
|
|
@@ -83,14 +92,28 @@ class IdentityTokenTest(unittest.TestCase):
|
|
|
83
92
|
Sandbox.identity_token("sts.amazonaws.com")
|
|
84
93
|
self.assertIn("not valid", str(caught.exception))
|
|
85
94
|
self.assertEqual(caught.exception.status, 401)
|
|
86
|
-
|
|
87
|
-
self.
|
|
95
|
+
# The listener had nothing newer: one ask, and its environment read.
|
|
96
|
+
self.assertEqual([seen[0] for seen in Stub.seen], ["/v1/identity/token", "/v1/environment"])
|
|
97
|
+
self.assertEqual(len(responses), 2)
|
|
98
|
+
self.assertTrue(all(r.closed for r in responses), "an error response was not closed")
|
|
88
99
|
finally:
|
|
89
100
|
# Preserve deterministic cleanup even against the unfixed client;
|
|
90
101
|
# the assertion above observes SDK ownership, before this fallback.
|
|
91
102
|
for response in responses:
|
|
92
103
|
response.close()
|
|
93
104
|
|
|
105
|
+
def test_a_stale_request_token_is_read_again_from_the_host_once(self):
|
|
106
|
+
# The build sandbox's statement, as an App copy's saved server holds it.
|
|
107
|
+
os.environ["RUNTIME_ID_TOKEN_REQUEST_TOKEN"] = "rtid1.build.sig"
|
|
108
|
+
Stub.current = {"RUNTIME_ID_TOKEN_REQUEST_URL": os.environ["RUNTIME_ID_TOKEN_REQUEST_URL"],
|
|
109
|
+
"RUNTIME_ID_TOKEN_REQUEST_TOKEN": "rtid1.statement.sig"}
|
|
110
|
+
self.assertEqual(Sandbox.identity_token("sts.amazonaws.com"), "header.payload.signature")
|
|
111
|
+
self.assertEqual([(path, auth) for path, _, auth in Stub.seen], [
|
|
112
|
+
("/v1/identity/token", "Bearer rtid1.build.sig"),
|
|
113
|
+
("/v1/environment", None),
|
|
114
|
+
("/v1/identity/token", "Bearer rtid1.statement.sig"),
|
|
115
|
+
])
|
|
116
|
+
|
|
94
117
|
def test_outside_a_sandbox_there_is_nothing_to_ask_with(self):
|
|
95
118
|
os.environ.pop("RUNTIME_ID_TOKEN_REQUEST_TOKEN", None)
|
|
96
119
|
if os.path.exists("/run/runtime/environment.json"):
|
|
@@ -62,6 +62,42 @@ class Sandbox(_Sandbox):
|
|
|
62
62
|
return _identity_token(audience, lifetime_seconds, timeout)
|
|
63
63
|
|
|
64
64
|
|
|
65
|
+
# The sandbox's own listener (packages/cloud/src/linux/egress.ts).
|
|
66
|
+
_ENVIRONMENT_URL = "http://runtime.internal/v1/environment"
|
|
67
|
+
_ENVIRONMENT_FILE = "/run/runtime/environment.json"
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _file_credentials():
|
|
71
|
+
import json as _json
|
|
72
|
+
try:
|
|
73
|
+
with open(_ENVIRONMENT_FILE, "rb") as file:
|
|
74
|
+
env = _json.load(file)
|
|
75
|
+
return env.get("RUNTIME_ID_TOKEN_REQUEST_URL"), env.get("RUNTIME_ID_TOKEN_REQUEST_TOKEN")
|
|
76
|
+
except (OSError, ValueError, AttributeError):
|
|
77
|
+
return None, None
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _current_credentials(timeout: float):
|
|
81
|
+
"""The sandbox's request token as its host holds it now. The one in
|
|
82
|
+
os.environ was current when the process started: it changes with every
|
|
83
|
+
renewal of the sandbox's lease (about every 30 minutes for one that keeps
|
|
84
|
+
running), and a server restored from a snapshot (an App's copies, a fork)
|
|
85
|
+
holds the statement of the sandbox it was saved from."""
|
|
86
|
+
import json as _json
|
|
87
|
+
import urllib.request as _request
|
|
88
|
+
try:
|
|
89
|
+
with _request.urlopen(_ENVIRONMENT_URL, timeout=min(timeout, 5.0)) as answer:
|
|
90
|
+
env = _json.load(answer)
|
|
91
|
+
url, token = env.get("RUNTIME_ID_TOKEN_REQUEST_URL"), env.get("RUNTIME_ID_TOKEN_REQUEST_TOKEN")
|
|
92
|
+
if isinstance(url, str) and url and isinstance(token, str) and token:
|
|
93
|
+
return url, token
|
|
94
|
+
except _request.HTTPError as error: # type: ignore[attr-defined]
|
|
95
|
+
error.close()
|
|
96
|
+
except (OSError, ValueError, AttributeError):
|
|
97
|
+
pass # Not in a sandbox, or a host that predates the listener's environment.
|
|
98
|
+
return _file_credentials()
|
|
99
|
+
|
|
100
|
+
|
|
65
101
|
def _identity_token(audience: str, lifetime_seconds: Optional[int], timeout: float) -> str:
|
|
66
102
|
import json as _json
|
|
67
103
|
import os as _os
|
|
@@ -71,22 +107,32 @@ def _identity_token(audience: str, lifetime_seconds: Optional[int], timeout: flo
|
|
|
71
107
|
url = _os.environ.get("RUNTIME_ID_TOKEN_REQUEST_URL")
|
|
72
108
|
token = _os.environ.get("RUNTIME_ID_TOKEN_REQUEST_TOKEN")
|
|
73
109
|
if not url or not token:
|
|
74
|
-
|
|
75
|
-
with open("/run/runtime/environment.json", "rb") as file:
|
|
76
|
-
env = _json.load(file)
|
|
77
|
-
url, token = env.get("RUNTIME_ID_TOKEN_REQUEST_URL"), env.get("RUNTIME_ID_TOKEN_REQUEST_TOKEN")
|
|
78
|
-
except (OSError, ValueError):
|
|
79
|
-
pass
|
|
110
|
+
url, token = _file_credentials()
|
|
80
111
|
if not url or not token:
|
|
81
112
|
raise RuntimeError("Identity tokens are issued only inside a Runtime sandbox (RUNTIME_ID_TOKEN_REQUEST_TOKEN is not set).",
|
|
82
113
|
code="identity_unavailable")
|
|
83
114
|
query = {"audience": audience}
|
|
84
115
|
if lifetime_seconds is not None:
|
|
85
116
|
query["lifetimeSeconds"] = str(lifetime_seconds)
|
|
86
|
-
|
|
87
|
-
|
|
117
|
+
|
|
118
|
+
def ask(url, token):
|
|
119
|
+
request = _request.Request(f"{url}?{_parse.urlencode(query)}", headers={"Authorization": f"Bearer {token}"})
|
|
88
120
|
with _request.urlopen(request, timeout=timeout) as answer:
|
|
89
121
|
return _json.load(answer)["token"]
|
|
122
|
+
|
|
123
|
+
try:
|
|
124
|
+
try:
|
|
125
|
+
return ask(url, token)
|
|
126
|
+
except _request.HTTPError as error: # type: ignore[attr-defined]
|
|
127
|
+
# Refused for a request token that is no longer this sandbox's
|
|
128
|
+
# current one: ask once more with the one its host holds now.
|
|
129
|
+
if error.code not in (401, 403):
|
|
130
|
+
raise
|
|
131
|
+
current_url, current_token = _current_credentials(timeout)
|
|
132
|
+
if not current_url or not current_token or current_token == token:
|
|
133
|
+
raise
|
|
134
|
+
error.close()
|
|
135
|
+
return ask(current_url, current_token)
|
|
90
136
|
except _request.HTTPError as error: # type: ignore[attr-defined]
|
|
91
137
|
try:
|
|
92
138
|
message = _json.load(error).get("error", {}).get("message", str(error))
|
|
@@ -10,7 +10,7 @@ import os
|
|
|
10
10
|
import random
|
|
11
11
|
import time
|
|
12
12
|
import uuid
|
|
13
|
-
from typing import Any, AsyncIterator, Callable, Generic, Optional, TypeVar, Union
|
|
13
|
+
from typing import Any, Literal, AsyncIterator, Callable, Generic, Optional, TypeVar, Union
|
|
14
14
|
from urllib.parse import quote, urlencode
|
|
15
15
|
|
|
16
16
|
from ._api_defaults import KEEP_ALIVE_MARGIN_SECONDS, STREAMED_EXEC_TIMEOUT_MS, WAIT_FOR_TIMEOUT_SECONDS
|
|
@@ -597,10 +597,13 @@ class AsyncPage:
|
|
|
597
597
|
|
|
598
598
|
|
|
599
599
|
def _command(command: Union[str, list[str], tuple[str, ...]], cwd: Optional[str], env: Optional[dict[str, str]],
|
|
600
|
-
stdin: Optional[Union[str, bytes]], timeout_ms: Optional[int]
|
|
600
|
+
stdin: Optional[Union[str, bytes]], timeout_ms: Optional[int],
|
|
601
|
+
user: Optional[Literal["sandbox", "root"]] = None) -> dict[str, Any]:
|
|
601
602
|
body: dict[str, Any] = {"command": command} if isinstance(command, str) else {"argv": list(command)}
|
|
602
603
|
if cwd is not None:
|
|
603
604
|
body["cwd"] = cwd
|
|
605
|
+
if user is not None:
|
|
606
|
+
body["user"] = user
|
|
604
607
|
if env is not None:
|
|
605
608
|
body["env"] = env
|
|
606
609
|
if isinstance(stdin, str):
|
|
@@ -691,6 +694,11 @@ class AsyncProcess:
|
|
|
691
694
|
"""The command line as the sandbox reports it."""
|
|
692
695
|
return self.info.get("command")
|
|
693
696
|
|
|
697
|
+
@property
|
|
698
|
+
def user(self) -> Optional[str]:
|
|
699
|
+
"""Who it runs as, "sandbox" or "root"; None from an API that does not say."""
|
|
700
|
+
return self.info.get("user")
|
|
701
|
+
|
|
694
702
|
@property
|
|
695
703
|
def state(self) -> Optional[str]:
|
|
696
704
|
"""As of the last answer: spawn, wait() or refresh()."""
|
|
@@ -1572,6 +1580,7 @@ class AsyncSandbox(AsyncMachine):
|
|
|
1572
1580
|
return AsyncSandbox(t, {"id": sandbox_id})
|
|
1573
1581
|
|
|
1574
1582
|
async def exec(self, command: Union[str, list[str], tuple[str, ...]], *, cwd: Optional[str] = None,
|
|
1583
|
+
user: Optional[Literal["sandbox", "root"]] = None,
|
|
1575
1584
|
env: Optional[dict[str, str]] = None, stdin: Optional[Union[str, bytes]] = None,
|
|
1576
1585
|
timeout_ms: Optional[int] = None, on_stdout: Optional[Callable[[str], Any]] = None,
|
|
1577
1586
|
on_stderr: Optional[Callable[[str], Any]] = None, check: bool = False,
|
|
@@ -1580,10 +1589,11 @@ class AsyncSandbox(AsyncMachine):
|
|
|
1580
1589
|
With on_stdout/on_stderr the output streams. The timeout is 60 s by
|
|
1581
1590
|
default, 24 h when the output streams. A timeout is a result
|
|
1582
1591
|
(timed_out=True, the output so far), never an error; ``check=True``
|
|
1583
|
-
raises CommandError on a non-zero exit.""
|
|
1592
|
+
raises CommandError on a non-zero exit. ``user="root"`` runs it as root
|
|
1593
|
+
through the sandbox's sudo (the default is "sandbox")."""
|
|
1584
1594
|
streaming = on_stdout is not None or on_stderr is not None or (timeout_ms or 0) > 60_000
|
|
1585
1595
|
if not streaming:
|
|
1586
|
-
data = await self._t.json("POST", self._path(":exec"), body=_command(command, cwd, env, stdin, timeout_ms),
|
|
1596
|
+
data = await self._t.json("POST", self._path(":exec"), body=_command(command, cwd, env, stdin, timeout_ms, user),
|
|
1587
1597
|
idempotency_key=idempotency_key, timeout=(timeout_ms or 60_000) / 1000 + 60)
|
|
1588
1598
|
result = CommandResult.from_json(data)
|
|
1589
1599
|
else:
|
|
@@ -1595,7 +1605,7 @@ class AsyncSandbox(AsyncMachine):
|
|
|
1595
1605
|
# both flags carry it.
|
|
1596
1606
|
dropped = False
|
|
1597
1607
|
try:
|
|
1598
|
-
async for event in self.exec_stream(command, cwd=cwd, env=env, stdin=stdin, timeout_ms=timeout_ms,
|
|
1608
|
+
async for event in self.exec_stream(command, cwd=cwd, user=user, env=env, stdin=stdin, timeout_ms=timeout_ms,
|
|
1599
1609
|
idempotency_key=idempotency_key):
|
|
1600
1610
|
if event["type"] == "start":
|
|
1601
1611
|
process_id = event["processId"]
|
|
@@ -1634,6 +1644,7 @@ class AsyncSandbox(AsyncMachine):
|
|
|
1634
1644
|
return result
|
|
1635
1645
|
|
|
1636
1646
|
async def exec_stream(self, command: Union[str, list[str], tuple[str, ...]], *, cwd: Optional[str] = None,
|
|
1647
|
+
user: Optional[Literal["sandbox", "root"]] = None,
|
|
1637
1648
|
env: Optional[dict[str, str]] = None, stdin: Optional[Union[str, bytes]] = None,
|
|
1638
1649
|
timeout_ms: Optional[int] = None,
|
|
1639
1650
|
idempotency_key: Optional[str] = None) -> AsyncIterator[dict[str, Any]]:
|
|
@@ -1648,7 +1659,7 @@ class AsyncSandbox(AsyncMachine):
|
|
|
1648
1659
|
"stderrTruncated": "stderr_truncated", "droppedBytes": "dropped_bytes",
|
|
1649
1660
|
"resumeAt": "resume_at", "outOfMemory": "out_of_memory"}
|
|
1650
1661
|
return {**event, **{alias: event[name] for name, alias in aliases.items() if name in event}}
|
|
1651
|
-
body = {**_command(command, cwd, env, stdin, timeout_ms if timeout_ms is not None else STREAMED_EXEC_TIMEOUT_MS), "stream": True}
|
|
1662
|
+
body = {**_command(command, cwd, env, stdin, timeout_ms if timeout_ms is not None else STREAMED_EXEC_TIMEOUT_MS, user), "stream": True}
|
|
1652
1663
|
events = self._t.events("POST", self._path(":exec"), body=body, idempotency_key=idempotency_key,
|
|
1653
1664
|
timeout=((timeout_ms or STREAMED_EXEC_TIMEOUT_MS) / 1000) + 60)
|
|
1654
1665
|
read = _OutputCursor()
|
|
@@ -1685,12 +1696,13 @@ class AsyncSandbox(AsyncMachine):
|
|
|
1685
1696
|
await _close_events(continued)
|
|
1686
1697
|
|
|
1687
1698
|
async def spawn(self, command: Union[str, list[str], tuple[str, ...]], *, cwd: Optional[str] = None,
|
|
1699
|
+
user: Optional[Literal["sandbox", "root"]] = None,
|
|
1688
1700
|
env: Optional[dict[str, str]] = None, stdin: Optional[str] = None,
|
|
1689
1701
|
pty: Optional[dict[str, int]] = None, timeout_ms: Optional[int] = None,
|
|
1690
1702
|
output_encoding: Optional[str] = None) -> AsyncProcess:
|
|
1691
1703
|
"""Starts a background process and returns at once. ``stdin="pipe"``
|
|
1692
1704
|
keeps input open for write(); ``pty={"cols": 120, "rows": 40}`` gives a terminal."""
|
|
1693
|
-
body = _command(command, cwd, env, None if stdin == "pipe" else stdin, timeout_ms)
|
|
1705
|
+
body = _command(command, cwd, env, None if stdin == "pipe" else stdin, timeout_ms, user)
|
|
1694
1706
|
if output_encoding is not None:
|
|
1695
1707
|
if output_encoding not in ("utf8", "base64"):
|
|
1696
1708
|
raise ValueError("output_encoding must be utf8 or base64")
|
|
@@ -1709,10 +1721,11 @@ class AsyncSandbox(AsyncMachine):
|
|
|
1709
1721
|
return AsyncProcess(self._t, self.id, await self._t.json("GET", self._path(f"/processes/{_enc(process_id)}")))
|
|
1710
1722
|
|
|
1711
1723
|
async def terminal(self, *, cols: int = 80, rows: int = 24, command: Optional[str] = None,
|
|
1712
|
-
cwd: Optional[str] = None,
|
|
1724
|
+
cwd: Optional[str] = None, user: Optional[Literal["sandbox", "root"]] = None,
|
|
1725
|
+
process_id: Optional[str] = None) -> AsyncTerminal:
|
|
1713
1726
|
"""An interactive terminal over a WebSocket."""
|
|
1714
1727
|
socket = await self._t.websocket(self._path("/terminal"), {
|
|
1715
|
-
"cols": cols, "rows": rows, "command": command, "cwd": cwd, "processId": process_id})
|
|
1728
|
+
"cols": cols, "rows": rows, "command": command, "cwd": cwd, "user": user, "processId": process_id})
|
|
1716
1729
|
ready = await socket.recv()
|
|
1717
1730
|
if not isinstance(ready, str):
|
|
1718
1731
|
raise RuntimeError("The terminal did not start.", code="terminal_refused")
|
|
@@ -9,7 +9,7 @@ import os
|
|
|
9
9
|
import random
|
|
10
10
|
import time
|
|
11
11
|
import uuid
|
|
12
|
-
from typing import Any, Iterator, Callable, Generic, Optional, TypeVar, Union
|
|
12
|
+
from typing import Any, Literal, Iterator, Callable, Generic, Optional, TypeVar, Union
|
|
13
13
|
from urllib.parse import quote, urlencode
|
|
14
14
|
|
|
15
15
|
from ._api_defaults import KEEP_ALIVE_MARGIN_SECONDS, STREAMED_EXEC_TIMEOUT_MS, WAIT_FOR_TIMEOUT_SECONDS
|
|
@@ -596,10 +596,13 @@ class Page:
|
|
|
596
596
|
|
|
597
597
|
|
|
598
598
|
def _command(command: Union[str, list[str], tuple[str, ...]], cwd: Optional[str], env: Optional[dict[str, str]],
|
|
599
|
-
stdin: Optional[Union[str, bytes]], timeout_ms: Optional[int]
|
|
599
|
+
stdin: Optional[Union[str, bytes]], timeout_ms: Optional[int],
|
|
600
|
+
user: Optional[Literal["sandbox", "root"]] = None) -> dict[str, Any]:
|
|
600
601
|
body: dict[str, Any] = {"command": command} if isinstance(command, str) else {"argv": list(command)}
|
|
601
602
|
if cwd is not None:
|
|
602
603
|
body["cwd"] = cwd
|
|
604
|
+
if user is not None:
|
|
605
|
+
body["user"] = user
|
|
603
606
|
if env is not None:
|
|
604
607
|
body["env"] = env
|
|
605
608
|
if isinstance(stdin, str):
|
|
@@ -690,6 +693,11 @@ class Process:
|
|
|
690
693
|
"""The command line as the sandbox reports it."""
|
|
691
694
|
return self.info.get("command")
|
|
692
695
|
|
|
696
|
+
@property
|
|
697
|
+
def user(self) -> Optional[str]:
|
|
698
|
+
"""Who it runs as, "sandbox" or "root"; None from an API that does not say."""
|
|
699
|
+
return self.info.get("user")
|
|
700
|
+
|
|
693
701
|
@property
|
|
694
702
|
def state(self) -> Optional[str]:
|
|
695
703
|
"""As of the last answer: spawn, wait() or refresh()."""
|
|
@@ -1571,6 +1579,7 @@ class Sandbox(Machine):
|
|
|
1571
1579
|
return Sandbox(t, {"id": sandbox_id})
|
|
1572
1580
|
|
|
1573
1581
|
def exec(self, command: Union[str, list[str], tuple[str, ...]], *, cwd: Optional[str] = None,
|
|
1582
|
+
user: Optional[Literal["sandbox", "root"]] = None,
|
|
1574
1583
|
env: Optional[dict[str, str]] = None, stdin: Optional[Union[str, bytes]] = None,
|
|
1575
1584
|
timeout_ms: Optional[int] = None, on_stdout: Optional[Callable[[str], Any]] = None,
|
|
1576
1585
|
on_stderr: Optional[Callable[[str], Any]] = None, check: bool = False,
|
|
@@ -1579,10 +1588,11 @@ class Sandbox(Machine):
|
|
|
1579
1588
|
With on_stdout/on_stderr the output streams. The timeout is 60 s by
|
|
1580
1589
|
default, 24 h when the output streams. A timeout is a result
|
|
1581
1590
|
(timed_out=True, the output so far), never an error; ``check=True``
|
|
1582
|
-
raises CommandError on a non-zero exit.""
|
|
1591
|
+
raises CommandError on a non-zero exit. ``user="root"`` runs it as root
|
|
1592
|
+
through the sandbox's sudo (the default is "sandbox")."""
|
|
1583
1593
|
streaming = on_stdout is not None or on_stderr is not None or (timeout_ms or 0) > 60_000
|
|
1584
1594
|
if not streaming:
|
|
1585
|
-
data = self._t.json("POST", self._path(":exec"), body=_command(command, cwd, env, stdin, timeout_ms),
|
|
1595
|
+
data = self._t.json("POST", self._path(":exec"), body=_command(command, cwd, env, stdin, timeout_ms, user),
|
|
1586
1596
|
idempotency_key=idempotency_key, timeout=(timeout_ms or 60_000) / 1000 + 60)
|
|
1587
1597
|
result = CommandResult.from_json(data)
|
|
1588
1598
|
else:
|
|
@@ -1594,7 +1604,7 @@ class Sandbox(Machine):
|
|
|
1594
1604
|
# both flags carry it.
|
|
1595
1605
|
dropped = False
|
|
1596
1606
|
try:
|
|
1597
|
-
for event in self.exec_stream(command, cwd=cwd, env=env, stdin=stdin, timeout_ms=timeout_ms,
|
|
1607
|
+
for event in self.exec_stream(command, cwd=cwd, user=user, env=env, stdin=stdin, timeout_ms=timeout_ms,
|
|
1598
1608
|
idempotency_key=idempotency_key):
|
|
1599
1609
|
if event["type"] == "start":
|
|
1600
1610
|
process_id = event["processId"]
|
|
@@ -1633,6 +1643,7 @@ class Sandbox(Machine):
|
|
|
1633
1643
|
return result
|
|
1634
1644
|
|
|
1635
1645
|
def exec_stream(self, command: Union[str, list[str], tuple[str, ...]], *, cwd: Optional[str] = None,
|
|
1646
|
+
user: Optional[Literal["sandbox", "root"]] = None,
|
|
1636
1647
|
env: Optional[dict[str, str]] = None, stdin: Optional[Union[str, bytes]] = None,
|
|
1637
1648
|
timeout_ms: Optional[int] = None,
|
|
1638
1649
|
idempotency_key: Optional[str] = None) -> Iterator[dict[str, Any]]:
|
|
@@ -1647,7 +1658,7 @@ class Sandbox(Machine):
|
|
|
1647
1658
|
"stderrTruncated": "stderr_truncated", "droppedBytes": "dropped_bytes",
|
|
1648
1659
|
"resumeAt": "resume_at", "outOfMemory": "out_of_memory"}
|
|
1649
1660
|
return {**event, **{alias: event[name] for name, alias in aliases.items() if name in event}}
|
|
1650
|
-
body = {**_command(command, cwd, env, stdin, timeout_ms if timeout_ms is not None else STREAMED_EXEC_TIMEOUT_MS), "stream": True}
|
|
1661
|
+
body = {**_command(command, cwd, env, stdin, timeout_ms if timeout_ms is not None else STREAMED_EXEC_TIMEOUT_MS, user), "stream": True}
|
|
1651
1662
|
events = self._t.events("POST", self._path(":exec"), body=body, idempotency_key=idempotency_key,
|
|
1652
1663
|
timeout=((timeout_ms or STREAMED_EXEC_TIMEOUT_MS) / 1000) + 60)
|
|
1653
1664
|
read = _OutputCursor()
|
|
@@ -1684,12 +1695,13 @@ class Sandbox(Machine):
|
|
|
1684
1695
|
_close_events(continued)
|
|
1685
1696
|
|
|
1686
1697
|
def spawn(self, command: Union[str, list[str], tuple[str, ...]], *, cwd: Optional[str] = None,
|
|
1698
|
+
user: Optional[Literal["sandbox", "root"]] = None,
|
|
1687
1699
|
env: Optional[dict[str, str]] = None, stdin: Optional[str] = None,
|
|
1688
1700
|
pty: Optional[dict[str, int]] = None, timeout_ms: Optional[int] = None,
|
|
1689
1701
|
output_encoding: Optional[str] = None) -> Process:
|
|
1690
1702
|
"""Starts a background process and returns at once. ``stdin="pipe"``
|
|
1691
1703
|
keeps input open for write(); ``pty={"cols": 120, "rows": 40}`` gives a terminal."""
|
|
1692
|
-
body = _command(command, cwd, env, None if stdin == "pipe" else stdin, timeout_ms)
|
|
1704
|
+
body = _command(command, cwd, env, None if stdin == "pipe" else stdin, timeout_ms, user)
|
|
1693
1705
|
if output_encoding is not None:
|
|
1694
1706
|
if output_encoding not in ("utf8", "base64"):
|
|
1695
1707
|
raise ValueError("output_encoding must be utf8 or base64")
|
|
@@ -1708,10 +1720,11 @@ class Sandbox(Machine):
|
|
|
1708
1720
|
return Process(self._t, self.id, self._t.json("GET", self._path(f"/processes/{_enc(process_id)}")))
|
|
1709
1721
|
|
|
1710
1722
|
def terminal(self, *, cols: int = 80, rows: int = 24, command: Optional[str] = None,
|
|
1711
|
-
cwd: Optional[str] = None,
|
|
1723
|
+
cwd: Optional[str] = None, user: Optional[Literal["sandbox", "root"]] = None,
|
|
1724
|
+
process_id: Optional[str] = None) -> Terminal:
|
|
1712
1725
|
"""An interactive terminal over a WebSocket."""
|
|
1713
1726
|
socket = self._t.websocket(self._path("/terminal"), {
|
|
1714
|
-
"cols": cols, "rows": rows, "command": command, "cwd": cwd, "processId": process_id})
|
|
1727
|
+
"cols": cols, "rows": rows, "command": command, "cwd": cwd, "user": user, "processId": process_id})
|
|
1715
1728
|
ready = socket.recv()
|
|
1716
1729
|
if not isinstance(ready, str):
|
|
1717
1730
|
raise RuntimeError("The terminal did not start.", code="terminal_refused")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "0.16.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = "0.15.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|