3131---
3232"""
3333
34- from __future__ import annotations
35-
3634import os
3735import shlex
3836import shutil
4240from datetime import timedelta
4341
4442from runloop_api_client import AsyncRunloopSDK
43+ from runloop_api_client .sdk .async_devbox import AsyncDevbox
4544from runloop_api_client .sdk .async_storage_object import AsyncStorageObject
45+ from runloop_api_client .sdk .async_execution_result import AsyncExecutionResult
4646
4747from ._harness import run_as_cli , unique_name , wrap_recipe
4848from .example_types import ExampleCheck , RecipeOutput , RecipeContext
@@ -88,7 +88,7 @@ async def ensure_claude_code_agent(sdk: AsyncRunloopSDK) -> tuple[str, bool]:
8888 return agent .id , False
8989
9090
91- def create_bootstrap_dir () -> tuple [ Path , Path ] :
91+ def create_bootstrap_dir () -> Path :
9292 """Create local files that will be uploaded and extracted via object mount."""
9393 temp_dir = Path (tempfile .mkdtemp (prefix = "runloop-devbox-mounts-" ))
9494 copied_example_path = temp_dir / COPIED_EXAMPLE_FILE_NAME
@@ -97,12 +97,12 @@ def create_bootstrap_dir() -> tuple[Path, Path]:
9797 "This directory was uploaded with upload_from_dir(), stored as a tgz object, "
9898 "and extracted onto the devbox via an object mount.\n "
9999 )
100- return temp_dir , copied_example_path
100+ return temp_dir
101101
102102
103- async def discover_code_mount_path (devbox ) -> str :
103+ async def discover_code_mount_path (devbox : AsyncDevbox ) -> str :
104104 """Find the repository path created by the code mount."""
105- result = await devbox .cmd .exec (
105+ result : AsyncExecutionResult = await devbox .cmd .exec (
106106 "if [ -d /home/user/rl-cli ]; then printf /home/user/rl-cli; "
107107 "elif [ -d /home/user/rl-clis ]; then printf /home/user/rl-clis; "
108108 "else exit 1; fi"
@@ -141,7 +141,7 @@ async def recipe(ctx: RecipeContext) -> RecipeOutput:
141141 resources_created .append (f"secret:{ secret .name } " )
142142 cleanup .add (f"secret:{ secret .name } " , secret .delete )
143143
144- bootstrap_dir , copied_example_path = create_bootstrap_dir ()
144+ bootstrap_dir = create_bootstrap_dir ()
145145 cleanup .add (f"temp_dir:{ bootstrap_dir } " , lambda : shutil .rmtree (bootstrap_dir , ignore_errors = True ))
146146
147147 archive : AsyncStorageObject = await sdk .storage_object .upload_from_dir (
@@ -204,9 +204,7 @@ async def recipe(ctx: RecipeContext) -> RecipeOutput:
204204 # claude_prompt_result = await devbox.cmd.exec(claude_gateway_command)
205205
206206 repo_mount_path = await discover_code_mount_path (devbox )
207- repo_package_json = (
208- await devbox .file .read (file_path = f"{ repo_mount_path } /package.json" ) if repo_mount_path else ""
209- )
207+ repo_package_json = await devbox .file .read (file_path = f"{ repo_mount_path } /package.json" ) if repo_mount_path else ""
210208
211209 mounted_example_path = f"{ OBJECT_MOUNT_DIR } /{ COPIED_EXAMPLE_FILE_NAME } "
212210 mounted_example_contents = await devbox .file .read (file_path = mounted_example_path )
@@ -251,7 +249,7 @@ async def recipe(ctx: RecipeContext) -> RecipeOutput:
251249 ExampleCheck (
252250 name = "object mount extracted the uploaded example file onto the devbox" ,
253251 passed = (
254- ' title: Devbox Mounts (Agent, Code, Object)' in mounted_example_contents
252+ " title: Devbox Mounts (Agent, Code, Object)" in mounted_example_contents
255253 and mounted_example_contents .startswith ("#!/usr/bin/env -S uv run python" )
256254 ),
257255 details = mounted_example_path ,
0 commit comments