3838from ..lib .context_loader import TarFilter , build_directory_tar
3939from .async_storage_object import AsyncStorageObject
4040from ..types .object_create_params import ContentType
41+ from ..types .shared_params .agent_source import Git , Npm , Pip , Object
4142
4243
4344class AsyncDevboxOps :
@@ -622,18 +623,16 @@ async def create_from_npm(
622623 "Cannot specify 'source' when using create_from_npm(); source is automatically set to npm configuration"
623624 )
624625
625- npm_config : dict = {"package_name" : package_name }
626+ npm_config : Npm = {"package_name" : package_name }
626627 if npm_version is not None :
627628 npm_config ["npm_version" ] = npm_version
628629 if registry_url is not None :
629630 npm_config ["registry_url" ] = registry_url
630631 if agent_setup is not None :
631632 npm_config ["agent_setup" ] = agent_setup
632633
633- return await self .create (
634- source = {"type" : "npm" , "npm" : npm_config },
635- ** params ,
636- )
634+ params ["source" ] = {"type" : "npm" , "npm" : npm_config }
635+ return await self .create (** params )
637636
638637 async def create_from_pip (
639638 self ,
@@ -664,18 +663,16 @@ async def create_from_pip(
664663 "Cannot specify 'source' when using create_from_pip(); source is automatically set to pip configuration"
665664 )
666665
667- pip_config : dict = {"package_name" : package_name }
666+ pip_config : Pip = {"package_name" : package_name }
668667 if pip_version is not None :
669668 pip_config ["pip_version" ] = pip_version
670669 if registry_url is not None :
671670 pip_config ["registry_url" ] = registry_url
672671 if agent_setup is not None :
673672 pip_config ["agent_setup" ] = agent_setup
674673
675- return await self .create (
676- source = {"type" : "pip" , "pip" : pip_config },
677- ** params ,
678- )
674+ params ["source" ] = {"type" : "pip" , "pip" : pip_config }
675+ return await self .create (** params )
679676
680677 async def create_from_git (
681678 self ,
@@ -703,16 +700,14 @@ async def create_from_git(
703700 "Cannot specify 'source' when using create_from_git(); source is automatically set to git configuration"
704701 )
705702
706- git_config : dict = {"repository" : repository }
703+ git_config : Git = {"repository" : repository }
707704 if ref is not None :
708705 git_config ["ref" ] = ref
709706 if agent_setup is not None :
710707 git_config ["agent_setup" ] = agent_setup
711708
712- return await self .create (
713- source = {"type" : "git" , "git" : git_config },
714- ** params ,
715- )
709+ params ["source" ] = {"type" : "git" , "git" : git_config }
710+ return await self .create (** params )
716711
717712 async def create_from_object (
718713 self ,
@@ -737,14 +732,12 @@ async def create_from_object(
737732 "Cannot specify 'source' when using create_from_object(); source is automatically set to object configuration"
738733 )
739734
740- object_config : dict = {"object_id" : object_id }
735+ object_config : Object = {"object_id" : object_id }
741736 if agent_setup is not None :
742737 object_config ["agent_setup" ] = agent_setup
743738
744- return await self .create (
745- source = {"type" : "object" , "object" : object_config },
746- ** params ,
747- )
739+ params ["source" ] = {"type" : "object" , "object" : object_config }
740+ return await self .create (** params )
748741
749742 def from_id (self , agent_id : str ) -> AsyncAgent :
750743 """Attach to an existing agent by ID.
0 commit comments