Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
feat: resolve Fleet pools by name
r33drichards6e68fb07e632
diff --git a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/cyclops_sdk.go b/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/cyclops_sdk.goindex b09e309620..60e0896f78 100644--- a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/cyclops_sdk.go+++ b/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk/cyclops_sdk.go@@ -443,7 +443,7 @@ func uniffiCheckChecksums() {checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool()})- if checksum != 43327 {+ if checksum != 49450 {// If this happens try cleaning and rebuilding your projectpanic("cyclops_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool: UniFFI API checksum mismatch")}@@ -1069,7 +1069,7 @@ type CyclopsClientInterface interface {WaitClaim(claim Claim) (Sandbox, error)CreatePool(request CreatePoolRequest) (Pool, error)DeletePool(pool Pool) error- GetPool(pool Pool) (Pool, error)+ GetPool(name string) (Pool, error)ListPools(namespace string) ([]Pool, error)UpdatePool(pool Pool) (Pool, error)ServiceRequest(sandbox Sandbox, service string, path string, request HttpRequest) (HttpResponse, error)@@ -1363,7 +1363,7 @@ func (_self *CyclopsClient) DeletePool(pool Pool) error {return err}-func (_self *CyclopsClient) GetPool(pool Pool) (Pool, error) {+func (_self *CyclopsClient) GetPool(name string) (Pool, error) {_pointer := _self.ffiObject.incrementPointer("*CyclopsClient")defer _self.ffiObject.decrementPointer()res, err := uniffiRustCallAsync[*SdkError](@@ -1380,7 +1380,7 @@ func (_self *CyclopsClient) GetPool(pool Pool) (Pool, error) {return FfiConverterPoolINSTANCE.Lift(ffi)},C.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(- _pointer, FfiConverterPoolINSTANCE.Lower(pool)),+ _pointer, FfiConverterStringINSTANCE.Lower(name)),// pollFnfunc(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {C.ffi_cyclops_sdk_rust_future_poll_rust_buffer(handle, continuation, data)diff --git a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/cyclops_sdk.kt b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/cyclops_sdk.ktindex 43e4eb922e..556adc642a 100644--- a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/cyclops_sdk.kt+++ b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/cyclops_sdk.kt@@ -794,7 +794,7 @@ internal object UniffiLib {): Longexternal fun uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_pool(`ptr`: Long,`pool`: RustBuffer.ByValue,): Long- external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(`ptr`: Long,`pool`: RustBuffer.ByValue,+ external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(`ptr`: Long,`name`: RustBuffer.ByValue,): Longexternal fun uniffi_cyclops_sdk_fn_method_cyclopsclient_list_pools(`ptr`: Long,`namespace`: RustBuffer.ByValue,): Long@@ -964,7 +964,7 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool() != 31235.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}- if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() != 43327.toShort()) {+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() != 49450.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools() != 27984.toShort()) {@@ -1939,7 +1939,7 @@ public interface CyclopsClientInterface {suspend fun `deletePool`(`pool`: Pool)- suspend fun `getPool`(`pool`: Pool): Pool+ suspend fun `getPool`(`name`: kotlin.String): Poolsuspend fun `listPools`(`namespace`: kotlin.String): List<Pool>@@ -2198,12 +2198,12 @@ open class CyclopsClient: Disposable, AutoCloseable, CyclopsClientInterface@Throws(SdkException::class)@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")- override suspend fun `getPool`(`pool`: Pool) : Pool {+ override suspend fun `getPool`(`name`: kotlin.String) : Pool {return uniffiRustCallAsync(callWithHandle { uniffiHandle ->UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(uniffiHandle,- FfiConverterTypePool.lower(`pool`),+ FfiConverterString.lower(`name`),)},{ future, callback, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },diff --git a/libs/fleet/sdk-bindings/python/cyclops_sdk/_sdk.py b/libs/fleet/sdk-bindings/python/cyclops_sdk/_sdk.pyindex 9e23f40c8b..b47eac80af 100644--- a/libs/fleet/sdk-bindings/python/cyclops_sdk/_sdk.py+++ b/libs/fleet/sdk-bindings/python/cyclops_sdk/_sdk.py@@ -506,7 +506,7 @@ def _uniffi_check_api_checksums(lib):raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim() != 17760:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")- if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() != 43327:+ if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() != 49450:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims() != 7802:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")@@ -2676,7 +2676,7 @@ class CyclopsClientProtocol(typing.Protocol):raise NotImplementedErrorasync def get_claim(self, claim: Claim) -> Claim:raise NotImplementedError- async def get_pool(self, pool: Pool) -> Pool:+ async def get_pool(self, name: str) -> Pool:raise NotImplementedErrorasync def list_claims(self, namespace: str) -> typing.List[Claim]:raise NotImplementedError@@ -2927,12 +2927,12 @@ class CyclopsClient(CyclopsClientProtocol):_uniffi_lift_return,_uniffi_error_converter,)- async def get_pool(self, pool: Pool) -> Pool:+ async def get_pool(self, name: str) -> Pool:- _UniffiFfiConverterTypePool.check_lower(pool)+ _UniffiFfiConverterString.check_lower(name)_uniffi_lowered_args = (self._uniffi_clone_handle(),- _UniffiFfiConverterTypePool.lower(pool),+ _UniffiFfiConverterString.lower(name),)_uniffi_lift_return = _UniffiFfiConverterTypePool.lift_uniffi_error_converter = _UniffiFfiConverterTypeSdkErrordiff --git a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rbindex a183e2d7d4..55b47b5d4a 100644--- a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb+++ b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb@@ -2566,12 +2566,15 @@ end)end- def get_pool(pool)- pool = pool- RustBuffer.check_lower_TypePool(pool)+ def get_pool(name)+ name = CyclopsSdk::uniffi_utf8(name)+result = CyclopsSdk.uniffi_rust_future_rust_buffer(+SdkError,- UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(uniffi_clone_handle(),RustBuffer.alloc_from_TypePool(pool),RustCallStatus.new),++ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(uniffi_clone_handle(),RustBuffer.allocFromString(name),RustCallStatus.new),+)return result.consumeIntoTypePoolenddiff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swiftindex 23153e182e..753c492618 100644--- a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift@@ -786,7 +786,7 @@ public protocol CyclopsClientProtocol: AnyObject, Sendable {func deletePool(pool: Pool) async throws- func getPool(pool: Pool) async throws -> Pool+ func getPool(name: String) async throws -> Poolfunc listPools(namespace: String) async throws -> [Pool]@@ -1031,13 +1031,13 @@ open func deletePool(pool: Pool)async throws {)}-open func getPool(pool: Pool)async throws -> Pool {+open func getPool(name: String)async throws -> Pool {returntry await uniffiRustCallAsync(rustFutureFunc: {uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(self.uniffiCloneHandle(),- FfiConverterTypePool_lower(pool)+ FfiConverterString.lower(name))},pollFunc: ffi_cyclops_sdk_rust_future_poll_rust_buffer,@@ -2893,7 +2893,7 @@ private let initializationResult: InitializationResult = {if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool() != 31235) {return InitializationResult.apiChecksumMismatch}- if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() != 43327) {+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() != 49450) {return InitializationResult.apiChecksumMismatch}if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_pools() != 27984) {diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h b/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.hindex 5f5d1d2b3c..90ff87732b 100644--- a/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h@@ -355,7 +355,7 @@ uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_pool(uint64_t ptr, Ru#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_GET_POOL#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_GET_POOL-uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(uint64_t ptr, RustBuffer pool+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(uint64_t ptr, RustBuffer name);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_POOLSdiff --git a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk.ts b/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk.tsindex b0f3a27bd6..3cdac50df7 100644--- a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk.ts+++ b/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk.ts@@ -1536,14 +1536,14 @@ private constructor(pointer: UniffiHandle) {}}- async getPool(pool: Pool, asyncOpts_?: { signal: AbortSignal }): Promise<Pool> /*throws*/ {+ async getPool(name: string, asyncOpts_?: { signal: AbortSignal }): Promise<Pool> /*throws*/ {const __stack = uniffiIsDebug ? new Error().stack : undefined;try {return await uniffiRustCallAsync(/*rustCaller:*/ uniffiCaller,/*rustFutureFunc:*/ () => {return nativeModule().uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool(- uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterTypePool.lower(pool, nativeModule().rustbuffer_alloc)+ uniffiTypeCyclopsClientObjectFactory.clonePointer(this),FfiConverterString.lower(name, nativeModule().rustbuffer_alloc));},/*pollFunc:*/ nativeModule().ffi_cyclops_sdk_rust_future_poll_rust_buffer,@@ -2074,7 +2074,7 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim() !== 17760) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim");}- if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() !== 43327) {+ if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool() !== 49450) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool");}if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_claims() !== 7802) {diff --git a/libs/fleet/sdk/src/pools.rs b/libs/fleet/sdk/src/pools.rsindex 64efb3c299..51d64500c2 100644--- a/libs/fleet/sdk/src/pools.rs+++ b/libs/fleet/sdk/src/pools.rs@@ -84,8 +84,8 @@ impl CyclopsClient {Ok(list.items)}- pub async fn get_pool(self: Arc<Self>, pool: Pool) -> Result<Pool, SdkError> {- let item_url = self.pool_item_url(&pool)?;+ pub async fn get_pool(self: Arc<Self>, name: String) -> Result<Pool, SdkError> {+ let item_url = routes::named_pool_item(self.base_url(), &name)?;self.send_json("get pool", json_request("GET", item_url, None), &[200]).await}diff --git a/libs/fleet/sdk/src/routes.rs b/libs/fleet/sdk/src/routes.rsindex 97c7802868..0cd4459a7e 100644--- a/libs/fleet/sdk/src/routes.rs+++ b/libs/fleet/sdk/src/routes.rs@@ -26,6 +26,14 @@ pub fn pool_item(base: &Url, namespace: &str, name: &str) -> Result<Url, SdkErro)}+pub fn named_pool_item(base: &Url, name: &str) -> Result<Url, SdkError> {+ validate_dns_label_for("name", name)?;+ route(+ base,+ format!("{POOL_COLLECTION_PREFIX}{name}{POOL_COLLECTION_SUFFIX}/{name}"),+ )+}+pub fn namespace_collection(base: &Url) -> Result<Url, SdkError> {route(base, NAMESPACE_COLLECTION.into())}diff --git a/libs/fleet/sdk/tests/pool_flow.rs b/libs/fleet/sdk/tests/pool_flow.rsindex 0b17b7f58a..5e4bf83790 100644--- a/libs/fleet/sdk/tests/pool_flow.rs+++ b/libs/fleet/sdk/tests/pool_flow.rs@@ -371,7 +371,7 @@ async fn create_and_delete_for_the_same_namespace_do_not_interleave() {}#[tokio::test]-async fn lists_gets_and_updates_typed_pools() {+async fn gets_named_pool_and_updates_typed_pools() {let current = pool();let updated = Pool {spec: serde_json::from_value(serde_json::json!({@@ -383,21 +383,13 @@ async fn lists_gets_and_updates_typed_pools() {};let http = Arc::new(ScriptedHttpClient::new([Ok(token()),- Ok(response(- 200,- &json_bytes(&serde_json::json!({ "items": [current.clone()] })),- )),Ok(json_response(200, ¤t)),Ok(json_response(200, &updated)),]));let client = client(Arc::clone(&http));assert_eq!(- client.clone().list_pools(NAMESPACE.into()).await.unwrap(),- vec![current.clone()]- );- assert_eq!(- client.clone().get_pool(current.clone()).await.unwrap(),+ client.clone().get_pool(NAMESPACE.into()).await.unwrap(),current);assert_eq!(@@ -406,9 +398,8 @@ async fn lists_gets_and_updates_typed_pools() {);let requests = resource_requests(&http).await;- assert_request(&requests[0], "GET", COLLECTION, None);- assert_request(&requests[1], "GET", ITEM, None);- assert_merge_patch_request(&requests[2], ITEM, Some(&json_bytes(&updated)));+ assert_request(&requests[0], "GET", ITEM, None);+ assert_merge_patch_request(&requests[1], ITEM, Some(&json_bytes(&updated)));}#[tokio::test]@@ -449,7 +440,7 @@ async fn rejects_deleting_a_pool_outside_the_namespace_owned_lifecycle() {}#[tokio::test]-async fn gets_and_updates_non_lifecycle_pool_resources_without_namespace_cleanup() {+async fn updates_non_lifecycle_pool_resources_without_namespace_cleanup() {let other = Pool {metadata: ResourceMetadata {namespace: NAMESPACE.into(),@@ -462,20 +453,17 @@ async fn gets_and_updates_non_lifecycle_pool_resources_without_namespace_cleanuplet http = Arc::new(ScriptedHttpClient::new([Ok(token()),Ok(json_response(200, &other)),- Ok(json_response(200, &other)),]));let client = client(Arc::clone(&http));- assert_eq!(client.clone().get_pool(other.clone()).await.unwrap(), other);assert_eq!(client.update_pool(other.clone()).await.unwrap(),other.clone());let requests = resource_requests(&http).await;- assert_eq!(requests.len(), 2);- assert_request(&requests[0], "GET", &other_item, None);- assert_merge_patch_request(&requests[1], &other_item, Some(&json_bytes(&other)));+ assert_eq!(requests.len(), 1);+ assert_merge_patch_request(&requests[0], &other_item, Some(&json_bytes(&other)));}#[tokio::test]@@ -508,7 +496,7 @@ async fn maps_invalid_json_and_non_success_responses() {]));let invalid_json_client = client(Arc::clone(&invalid_json_http));assert!(matches!(- invalid_json_client.get_pool(pool()).await,+ invalid_json_client.get_pool(NAMESPACE.into()).await,Err(SdkError::Body { .. })));@@ -562,17 +550,7 @@ async fn rejects_invalid_dns_labels_without_http_requests() {] {let http = Arc::new(ScriptedHttpClient::new([]));let client = client(Arc::clone(&http));- let error = client- .get_pool(Pool {- metadata: ResourceMetadata {- namespace: NAMESPACE.into(),- name: value.into(),- labels: None,- },- ..pool()- })- .await- .unwrap_err();+ let error = client.get_pool(value.into()).await.unwrap_err();assert!(matches!(error,SdkError::InvalidResourceName {diff --git a/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.go b/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.goindex 9bf90f6f9a..5d9a9d40a7 100644--- a/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.go+++ b/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.go@@ -65,7 +65,7 @@ func (r *poolResource) Create(ctx context.Context, req resource.CreateRequest, rresp.Diagnostics.AddError("Unable to create Cyclops pool", err.Error())return}- created, err = r.client.GetPool(created)+ created, err = r.client.GetPool(created.Metadata.Name)if err != nil {resp.Diagnostics.AddError("Pool created but could not be read", err.Error())return@@ -80,7 +80,7 @@ func (r *poolResource) Read(ctx context.Context, req resource.ReadRequest, respif resp.Diagnostics.HasError() {return}- pool, err := r.client.GetPool(poolIdentity(state.Namespace.ValueString(), state.Name.ValueString()))+ pool, err := r.client.GetPool(state.Name.ValueString())if isNotFound(err) {resp.State.RemoveResource(ctx)return@@ -108,7 +108,7 @@ func (r *poolResource) Update(ctx context.Context, req resource.UpdateRequest, rresp.Diagnostics.AddError("Unable to update Cyclops pool", err.Error())return}- updated, err = r.client.GetPool(updated)+ updated, err = r.client.GetPool(updated.Metadata.Name)if err != nil {resp.Diagnostics.AddError("Pool updated but could not be read", err.Error())return