Skip to content

Commit c4dbcf3

Browse files
feat(api): api update
1 parent a9a0d2b commit c4dbcf3

6 files changed

Lines changed: 239 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 92
1+
configured_endpoints: 93
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-6b65a42b74406a77acb03ddb582288396d7af64df16eebf887c77246d3a54470.yml
33
openapi_spec_hash: aeb9f595d53412926ef507174f33a1a1
4-
config_hash: f008c82c6ae5099c9a4b8e1fce1e15f1
4+
config_hash: 97c56b44c382faf3f8cbb0999532054f

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ Methods:
198198
- <code title="post /v1/devboxes/{id}/execute_async">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">execute_async</a>(id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_execute_async_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
199199
- <code title="post /v1/devboxes/{id}/execute_sync">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">execute_sync</a>(id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_execute_sync_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
200200
- <code title="post /v1/devboxes/{devbox_id}/executions/{execution_id}/kill">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">kill</a>(execution_id, \*, devbox_id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_kill_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
201+
- <code title="post /v1/devboxes/{devbox_id}/executions/{execution_id}/send_std_in">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">send_std_in</a>(execution_id, \*, devbox_id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_send_std_in_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
201202
- <code title="get /v1/devboxes/{devbox_id}/executions/{execution_id}/stream_stderr_updates">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">stream_stderr_updates</a>(execution_id, \*, devbox_id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_stream_stderr_updates_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devboxes/execution_update_chunk.py">ExecutionUpdateChunk</a></code>
202203
- <code title="get /v1/devboxes/{devbox_id}/executions/{execution_id}/stream_stdout_updates">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">stream_stdout_updates</a>(execution_id, \*, devbox_id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_stream_stdout_updates_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devboxes/execution_update_chunk.py">ExecutionUpdateChunk</a></code>
203204

src/runloop_api_client/resources/devboxes/executions.py

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from ...types.devboxes import (
2626
execution_kill_params,
2727
execution_retrieve_params,
28+
execution_send_std_in_params,
2829
execution_execute_sync_params,
2930
execution_execute_async_params,
3031
execution_stream_stderr_updates_params,
@@ -332,6 +333,53 @@ def kill(
332333
cast_to=DevboxAsyncExecutionDetailView,
333334
)
334335

336+
def send_std_in(
337+
self,
338+
execution_id: str,
339+
*,
340+
devbox_id: str,
341+
text: str | Omit = omit,
342+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
343+
# The extra values given here take precedence over values defined on the client or passed to this method.
344+
extra_headers: Headers | None = None,
345+
extra_query: Query | None = None,
346+
extra_body: Body | None = None,
347+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
348+
idempotency_key: str | None = None,
349+
) -> DevboxAsyncExecutionDetailView:
350+
"""
351+
Send content to the Std In of a running execution.
352+
353+
Args:
354+
text: Text to send to std in of the running execution.
355+
356+
extra_headers: Send extra headers
357+
358+
extra_query: Add additional query parameters to the request
359+
360+
extra_body: Add additional JSON properties to the request
361+
362+
timeout: Override the client-level default timeout for this request, in seconds
363+
364+
idempotency_key: Specify a custom idempotency key for this request
365+
"""
366+
if not devbox_id:
367+
raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}")
368+
if not execution_id:
369+
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
370+
return self._post(
371+
f"/v1/devboxes/{devbox_id}/executions/{execution_id}/send_std_in",
372+
body=maybe_transform({"text": text}, execution_send_std_in_params.ExecutionSendStdInParams),
373+
options=make_request_options(
374+
extra_headers=extra_headers,
375+
extra_query=extra_query,
376+
extra_body=extra_body,
377+
timeout=timeout,
378+
idempotency_key=idempotency_key,
379+
),
380+
cast_to=DevboxAsyncExecutionDetailView,
381+
)
382+
335383
def stream_stderr_updates(
336384
self,
337385
execution_id: str,
@@ -785,6 +833,53 @@ async def kill(
785833
cast_to=DevboxAsyncExecutionDetailView,
786834
)
787835

836+
async def send_std_in(
837+
self,
838+
execution_id: str,
839+
*,
840+
devbox_id: str,
841+
text: str | Omit = omit,
842+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
843+
# The extra values given here take precedence over values defined on the client or passed to this method.
844+
extra_headers: Headers | None = None,
845+
extra_query: Query | None = None,
846+
extra_body: Body | None = None,
847+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
848+
idempotency_key: str | None = None,
849+
) -> DevboxAsyncExecutionDetailView:
850+
"""
851+
Send content to the Std In of a running execution.
852+
853+
Args:
854+
text: Text to send to std in of the running execution.
855+
856+
extra_headers: Send extra headers
857+
858+
extra_query: Add additional query parameters to the request
859+
860+
extra_body: Add additional JSON properties to the request
861+
862+
timeout: Override the client-level default timeout for this request, in seconds
863+
864+
idempotency_key: Specify a custom idempotency key for this request
865+
"""
866+
if not devbox_id:
867+
raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}")
868+
if not execution_id:
869+
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
870+
return await self._post(
871+
f"/v1/devboxes/{devbox_id}/executions/{execution_id}/send_std_in",
872+
body=await async_maybe_transform({"text": text}, execution_send_std_in_params.ExecutionSendStdInParams),
873+
options=make_request_options(
874+
extra_headers=extra_headers,
875+
extra_query=extra_query,
876+
extra_body=extra_body,
877+
timeout=timeout,
878+
idempotency_key=idempotency_key,
879+
),
880+
cast_to=DevboxAsyncExecutionDetailView,
881+
)
882+
788883
async def stream_stderr_updates(
789884
self,
790885
execution_id: str,
@@ -973,6 +1068,9 @@ def __init__(self, executions: ExecutionsResource) -> None:
9731068
self.kill = to_raw_response_wrapper(
9741069
executions.kill,
9751070
)
1071+
self.send_std_in = to_raw_response_wrapper(
1072+
executions.send_std_in,
1073+
)
9761074
self.stream_stdout_updates = to_raw_response_wrapper(
9771075
executions.stream_stdout_updates,
9781076
)
@@ -999,6 +1097,9 @@ def __init__(self, executions: AsyncExecutionsResource) -> None:
9991097
self.kill = async_to_raw_response_wrapper(
10001098
executions.kill,
10011099
)
1100+
self.send_std_in = async_to_raw_response_wrapper(
1101+
executions.send_std_in,
1102+
)
10021103
self.stream_stdout_updates = async_to_raw_response_wrapper(
10031104
executions.stream_stdout_updates,
10041105
)
@@ -1025,6 +1126,9 @@ def __init__(self, executions: ExecutionsResource) -> None:
10251126
self.kill = to_streamed_response_wrapper(
10261127
executions.kill,
10271128
)
1129+
self.send_std_in = to_streamed_response_wrapper(
1130+
executions.send_std_in,
1131+
)
10281132
self.stream_stdout_updates = to_streamed_response_wrapper(
10291133
executions.stream_stdout_updates,
10301134
)
@@ -1051,6 +1155,9 @@ def __init__(self, executions: AsyncExecutionsResource) -> None:
10511155
self.kill = async_to_streamed_response_wrapper(
10521156
executions.kill,
10531157
)
1158+
self.send_std_in = async_to_streamed_response_wrapper(
1159+
executions.send_std_in,
1160+
)
10541161
self.stream_stdout_updates = async_to_streamed_response_wrapper(
10551162
executions.stream_stdout_updates,
10561163
)

src/runloop_api_client/types/devboxes/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .disk_snapshot_list_params import DiskSnapshotListParams as DiskSnapshotListParams
1414
from .execution_retrieve_params import ExecutionRetrieveParams as ExecutionRetrieveParams
1515
from .disk_snapshot_update_params import DiskSnapshotUpdateParams as DiskSnapshotUpdateParams
16+
from .execution_send_std_in_params import ExecutionSendStdInParams as ExecutionSendStdInParams
1617
from .execution_execute_sync_params import ExecutionExecuteSyncParams as ExecutionExecuteSyncParams
1718
from .execution_execute_async_params import ExecutionExecuteAsyncParams as ExecutionExecuteAsyncParams
1819
from .computer_mouse_interaction_params import ComputerMouseInteractionParams as ComputerMouseInteractionParams
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Required, TypedDict
6+
7+
__all__ = ["ExecutionSendStdInParams"]
8+
9+
10+
class ExecutionSendStdInParams(TypedDict, total=False):
11+
devbox_id: Required[str]
12+
13+
text: str
14+
"""Text to send to std in of the running execution."""

tests/api_resources/devboxes/test_executions.py

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,63 @@ def test_path_params_kill(self, client: Runloop) -> None:
247247
devbox_id="devbox_id",
248248
)
249249

250+
@parametrize
251+
def test_method_send_std_in(self, client: Runloop) -> None:
252+
execution = client.devboxes.executions.send_std_in(
253+
execution_id="execution_id",
254+
devbox_id="devbox_id",
255+
)
256+
assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"])
257+
258+
@parametrize
259+
def test_method_send_std_in_with_all_params(self, client: Runloop) -> None:
260+
execution = client.devboxes.executions.send_std_in(
261+
execution_id="execution_id",
262+
devbox_id="devbox_id",
263+
text="text",
264+
)
265+
assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"])
266+
267+
@parametrize
268+
def test_raw_response_send_std_in(self, client: Runloop) -> None:
269+
response = client.devboxes.executions.with_raw_response.send_std_in(
270+
execution_id="execution_id",
271+
devbox_id="devbox_id",
272+
)
273+
274+
assert response.is_closed is True
275+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
276+
execution = response.parse()
277+
assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"])
278+
279+
@parametrize
280+
def test_streaming_response_send_std_in(self, client: Runloop) -> None:
281+
with client.devboxes.executions.with_streaming_response.send_std_in(
282+
execution_id="execution_id",
283+
devbox_id="devbox_id",
284+
) as response:
285+
assert not response.is_closed
286+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
287+
288+
execution = response.parse()
289+
assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"])
290+
291+
assert cast(Any, response.is_closed) is True
292+
293+
@parametrize
294+
def test_path_params_send_std_in(self, client: Runloop) -> None:
295+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `devbox_id` but received ''"):
296+
client.devboxes.executions.with_raw_response.send_std_in(
297+
execution_id="execution_id",
298+
devbox_id="",
299+
)
300+
301+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"):
302+
client.devboxes.executions.with_raw_response.send_std_in(
303+
execution_id="",
304+
devbox_id="devbox_id",
305+
)
306+
250307
@parametrize
251308
def test_method_stream_stdout_updates(self, client: Runloop, respx_mock: MockRouter) -> None:
252309
respx_mock.get("/v1/devboxes/devbox_id/executions/execution_id/stream_stdout_updates").mock(
@@ -770,6 +827,63 @@ async def test_path_params_kill(self, async_client: AsyncRunloop) -> None:
770827
devbox_id="devbox_id",
771828
)
772829

830+
@parametrize
831+
async def test_method_send_std_in(self, async_client: AsyncRunloop) -> None:
832+
execution = await async_client.devboxes.executions.send_std_in(
833+
execution_id="execution_id",
834+
devbox_id="devbox_id",
835+
)
836+
assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"])
837+
838+
@parametrize
839+
async def test_method_send_std_in_with_all_params(self, async_client: AsyncRunloop) -> None:
840+
execution = await async_client.devboxes.executions.send_std_in(
841+
execution_id="execution_id",
842+
devbox_id="devbox_id",
843+
text="text",
844+
)
845+
assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"])
846+
847+
@parametrize
848+
async def test_raw_response_send_std_in(self, async_client: AsyncRunloop) -> None:
849+
response = await async_client.devboxes.executions.with_raw_response.send_std_in(
850+
execution_id="execution_id",
851+
devbox_id="devbox_id",
852+
)
853+
854+
assert response.is_closed is True
855+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
856+
execution = await response.parse()
857+
assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"])
858+
859+
@parametrize
860+
async def test_streaming_response_send_std_in(self, async_client: AsyncRunloop) -> None:
861+
async with async_client.devboxes.executions.with_streaming_response.send_std_in(
862+
execution_id="execution_id",
863+
devbox_id="devbox_id",
864+
) as response:
865+
assert not response.is_closed
866+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
867+
868+
execution = await response.parse()
869+
assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"])
870+
871+
assert cast(Any, response.is_closed) is True
872+
873+
@parametrize
874+
async def test_path_params_send_std_in(self, async_client: AsyncRunloop) -> None:
875+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `devbox_id` but received ''"):
876+
await async_client.devboxes.executions.with_raw_response.send_std_in(
877+
execution_id="execution_id",
878+
devbox_id="",
879+
)
880+
881+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"):
882+
await async_client.devboxes.executions.with_raw_response.send_std_in(
883+
execution_id="",
884+
devbox_id="devbox_id",
885+
)
886+
773887
@parametrize
774888
async def test_method_stream_stdout_updates(self, async_client: AsyncRunloop, respx_mock: MockRouter) -> None:
775889
respx_mock.get("/v1/devboxes/devbox_id/executions/execution_id/stream_stdout_updates").mock(

0 commit comments

Comments
 (0)