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(cyclops-cs): add namespace CRUD (#6623)
r33drichards4ffa1616dd3e
diff --git a/libs/fleet/backend/handlers/namespaces.go b/libs/fleet/backend/handlers/namespaces.goindex 0eaa8fa2e4..ae4c1e2570 100644--- a/libs/fleet/backend/handlers/namespaces.go+++ b/libs/fleet/backend/handlers/namespaces.go@@ -290,6 +290,91 @@ func (h Handlers) ListNamespaces(w http.ResponseWriter, r *http.Request) {writeJSON(w, http.StatusOK, out)}+// GetNamespace godoc+//+// @Summary Get a namespace owned by the calling user+// @Description Gets a K8s namespace via impersonation. Capsule restricts access to the caller's Tenant.+// @Tags namespaces+// @Produce json+// @Param name path string true "Namespace name"+// @Success 200 {object} NamespaceResponse+// @Failure 400 {object} ErrorResponse+// @Failure 401 {object} ErrorResponse+// @Failure 403 {object} ErrorResponse+// @Failure 404 {object} ErrorResponse+// @Failure 502 {object} ErrorResponse+// @Security BearerAuth+// @Router /api/namespaces/{name} [get]+func (h Handlers) GetNamespace(w http.ResponseWriter, r *http.Request) {+ user := currentUser(r)+ if user == nil || user.ID == "" {+ writeErr(w, http.StatusUnauthorized, "missing user")+ return+ }++ name := r.PathValue("name")+ if !dnsLabel.MatchString(name) || len(name) > 63 {+ writeErr(w, http.StatusBadRequest, "invalid namespace name")+ return+ }++ resp, err := h.k8sImpersonate(+ r.Context(),+ http.MethodGet,+ "/api/v1/namespaces/"+url.PathEscape(name),+ nil,+ user.ID,+ )+ if err != nil {+ writeErr(w, http.StatusBadGateway, "kubectl-proxy unavailable")+ return+ }+ defer resp.Body.Close()++ body, err := readBoundedK8sBody(resp.Body)+ if err != nil {+ writeErr(w, http.StatusBadGateway, "bad response from k8s")+ return+ }+ if resp.StatusCode != http.StatusOK {+ slog.Warn("namespace get: k8s error", "status", resp.StatusCode, "body", string(body))+ switch resp.StatusCode {+ case http.StatusForbidden:+ writeErr(w, http.StatusForbidden, "namespace access denied")+ case http.StatusNotFound:+ writeErr(w, http.StatusNotFound, "namespace not found")+ default:+ writeErr(w, resp.StatusCode, "k8s request failed")+ }+ return+ }++ if !h.requireNamespaceAccess(w, r, user, name) {+ return+ }++ var namespace struct {+ Metadata struct {+ Name string `json:"name"`+ Labels map[string]string `json:"labels"`+ CreationTimestamp string `json:"creationTimestamp"`+ } `json:"metadata"`+ Status struct {+ Phase string `json:"phase"`+ } `json:"status"`+ }+ if err := json.Unmarshal(body, &namespace); err != nil {+ writeErr(w, http.StatusBadGateway, "bad response from k8s")+ return+ }+ writeJSON(w, http.StatusOK, NamespaceResponse{+ Name: namespace.Metadata.Name,+ Status: namespace.Status.Phase,+ CreatedAt: namespace.Metadata.CreationTimestamp,+ Labels: namespace.Metadata.Labels,+ })+}+// CreateNamespace godoc//// @Summary Create a namespace for the calling userdiff --git a/libs/fleet/backend/handlers/namespaces_test.go b/libs/fleet/backend/handlers/namespaces_test.goindex 6e5ff444ac..06324ab5cd 100644--- a/libs/fleet/backend/handlers/namespaces_test.go+++ b/libs/fleet/backend/handlers/namespaces_test.go@@ -49,8 +49,22 @@ type fakeK8s struct {requests []recordedReq}+type fakeK8sResponse struct {+ status int+ body string+}+func newFakeK8s(status int, respBody string) *fakeK8s {+ return newFakeK8sSequence(fakeK8sResponse{status: status, body: respBody})+}++func newFakeK8sSequence(responses ...fakeK8sResponse) *fakeK8s {+ if len(responses) == 0 {+ panic("fake K8s requires at least one response")+ }+fk := &fakeK8s{}+ requestIndex := 0fk.server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {fk.method = r.Methodfk.path = r.URL.Path@@ -64,8 +78,13 @@ func newFakeK8s(status int, respBody string) *fakeK8s {headers: fk.headers,body: fk.body,})- w.WriteHeader(status)- _, _ = w.Write([]byte(respBody))+ responseIndex := requestIndex+ if responseIndex >= len(responses) {+ responseIndex = len(responses) - 1+ }+ requestIndex+++ w.WriteHeader(responses[responseIndex].status)+ _, _ = w.Write([]byte(responses[responseIndex].body))}))return fk}@@ -108,6 +127,129 @@ func nsCreatedResponse(name string) string {return string(b)}+func TestGetNamespace_Success(t *testing.T) {+ resetOwnershipCache()+ fk := newFakeK8s(http.StatusOK, nsCreatedResponse("demo"))+ defer fk.server.Close()+ overrideK8sClient(fk.server.Client(), fk.server.URL, "fake-sa-token")++ r := httptest.NewRequest(http.MethodGet, "/api/namespaces/demo", nil)+ r.SetPathValue("name", "demo")+ r = withUser(r, &auth.User{ID: "test-uuid"})+ w := httptest.NewRecorder()++ Handlers{}.GetNamespace(w, r)++ if w.Code != http.StatusOK {+ t.Fatalf("status = %d, want 200; body = %s", w.Code, w.Body.String())+ }+ if len(fk.requests) != 2 {+ t.Fatalf("request count = %d, want 2", len(fk.requests))+ }+ namespaceGet := fk.requests[0]+ if namespaceGet.method != http.MethodGet || namespaceGet.path != "/api/v1/namespaces/demo" {+ t.Fatalf("namespace GET = %s %s", namespaceGet.method, namespaceGet.path)+ }+ probe := fk.requests[1]+ if probe.method != http.MethodGet || probe.path != "/apis/rbac.authorization.k8s.io/v1/namespaces/demo/rolebindings" {+ t.Fatalf("ownership probe = %s %s", probe.method, probe.path)+ }+ var got NamespaceResponse+ if err := json.NewDecoder(w.Body).Decode(&got); err != nil {+ t.Fatal(err)+ }+ if got.Name != "demo" || got.Status != "Active" {+ t.Fatalf("namespace = %#v", got)+ }+}++func TestGetNamespace_InvalidNameDoesNotCallK8s(t *testing.T) {+ fk := newFakeK8s(http.StatusOK, nsCreatedResponse("ignored"))+ defer fk.server.Close()+ overrideK8sClient(fk.server.Client(), fk.server.URL, "fake-sa-token")++ r := httptest.NewRequest(http.MethodGet, "/api/namespaces/INVALID", nil)+ r.SetPathValue("name", "INVALID")+ r = withUser(r, &auth.User{ID: "test-uuid"})+ w := httptest.NewRecorder()++ Handlers{}.GetNamespace(w, r)++ if w.Code != http.StatusBadRequest || len(fk.requests) != 0 {+ t.Fatalf("status=%d requests=%d", w.Code, len(fk.requests))+ }+}++func TestGetNamespace_PreservesForbiddenAndNotFound(t *testing.T) {+ for _, tc := range []struct {+ status int+ want string+ }{+ {status: http.StatusForbidden, want: "namespace access denied"},+ {status: http.StatusNotFound, want: "namespace not found"},+ } {+ t.Run(http.StatusText(tc.status), func(t *testing.T) {+ const upstreamBody = `{"kind":"Status","message":"sensitive upstream detail"}`+ fk := newFakeK8s(tc.status, upstreamBody)+ defer fk.server.Close()+ overrideK8sClient(fk.server.Client(), fk.server.URL, "fake-sa-token")++ r := httptest.NewRequest(http.MethodGet, "/api/namespaces/demo", nil)+ r.SetPathValue("name", "demo")+ r = withUser(r, &auth.User{ID: "test-uuid"})+ w := httptest.NewRecorder()++ Handlers{}.GetNamespace(w, r)+ if w.Code != tc.status {+ t.Fatalf("status = %d, want %d", w.Code, tc.status)+ }+ if len(fk.requests) != 1 {+ t.Fatalf("request count = %d, want 1", len(fk.requests))+ }+ var response ErrorResponse+ if err := json.NewDecoder(w.Body).Decode(&response); err != nil {+ t.Fatalf("decode response: %v", err)+ }+ if response.Error != tc.want {+ t.Fatalf("error = %q, want %q", response.Error, tc.want)+ }+ if strings.Contains(w.Body.String(), upstreamBody) {+ t.Fatalf("response exposed upstream body: %s", w.Body.String())+ }+ })+ }+}++func TestGetNamespace_ExistingNamespaceWithoutOwnership_Forbidden(t *testing.T) {+ resetOwnershipCache()+ fk := newFakeK8sSequence(+ fakeK8sResponse{status: http.StatusOK, body: nsCreatedResponse("other-tenant")},+ fakeK8sResponse{status: http.StatusForbidden, body: `{"kind":"Status"}`},+ )+ defer fk.server.Close()+ overrideK8sClient(fk.server.Client(), fk.server.URL, "fake-sa-token")++ r := httptest.NewRequest(http.MethodGet, "/api/namespaces/other-tenant", nil)+ r.SetPathValue("name", "other-tenant")+ r = withUser(r, &auth.User{ID: "test-uuid"})+ w := httptest.NewRecorder()++ Handlers{}.GetNamespace(w, r)++ if w.Code != http.StatusForbidden {+ t.Fatalf("status = %d, want %d; body = %s", w.Code, http.StatusForbidden, w.Body.String())+ }+ if len(fk.requests) != 2 {+ t.Fatalf("request count = %d, want 2", len(fk.requests))+ }+ if got := fk.requests[0].path; got != "/api/v1/namespaces/other-tenant" {+ t.Fatalf("namespace GET path = %q", got)+ }+ if got := fk.requests[1].path; got != "/apis/rbac.authorization.k8s.io/v1/namespaces/other-tenant/rolebindings" {+ t.Fatalf("ownership probe path = %q", got)+ }+}+func TestCreateNamespace_ValidName(t *testing.T) {fk := newFakeK8s(http.StatusCreated, nsCreatedResponse("my-workspace"))defer fk.server.Close()diff --git a/libs/fleet/backend/main.go b/libs/fleet/backend/main.goindex e1a623784a..a539e9d8c5 100644--- a/libs/fleet/backend/main.go+++ b/libs/fleet/backend/main.go@@ -129,6 +129,8 @@ func setupRouter(c handlers.Handlers) http.Handler {withMiddlewares("/api/namespaces", nil, c.ListNamespaces))r.Handle("POST /api/namespaces",withMiddlewares("/api/namespaces", nil, c.CreateNamespace))+ r.Handle("GET /api/namespaces/{name}",+ withMiddlewares("/api/namespaces/{name}", []string{"name"}, c.GetNamespace))r.Handle("DELETE /api/namespaces/{name}",withMiddlewares("/api/namespaces/{name}", []string{"name"}, c.DeleteNamespace))diff --git a/libs/fleet/scripts/check_sdk_binding_contract_sources.py b/libs/fleet/scripts/check_sdk_binding_contract_sources.pyindex 2fa7016107..e1b24c9084 100755--- a/libs/fleet/scripts/check_sdk_binding_contract_sources.py+++ b/libs/fleet/scripts/check_sdk_binding_contract_sources.py@@ -4,6 +4,7 @@from __future__ import annotationsimport argparse+import astimport ioimport reimport sys@@ -164,6 +165,84 @@ def require_lifecycle(source: str, path: Path, label: str, queue_marker: str, carequire_all(source, path, checks)+def require_python_namespace_lifecycle_contract(path: Path) -> None:+ tree = ast.parse(path.read_text(encoding="utf-8"), filename=path)+ functions = {+ node.name: node+ for node in tree.body+ if isinstance(node, (ast.AsyncFunctionDef, ast.FunctionDef))+ }++ expected_lifecycle = functions.get("expected_lifecycle")+ run_lifecycle = functions.get("run_lifecycle")+ if expected_lifecycle is None or run_lifecycle is None:+ raise ContractFailure(f"binding contract check failed: Python namespace lifecycle functions ({path})")++ return_statement = next(+ (node for node in expected_lifecycle.body if isinstance(node, ast.Return)),+ None,+ )+ if not isinstance(return_statement, ast.Return) or not isinstance(return_statement.value, ast.List):+ raise ContractFailure(f"binding contract check failed: Python namespace lifecycle request queue ({path})")++ requests = []+ for item in return_statement.value.elts:+ if not isinstance(item, ast.Call) or not isinstance(item.func, ast.Name) or item.func.id != "Expected":+ continue+ if len(item.args) < 5:+ raise ContractFailure(f"binding contract check failed: Python lifecycle Expected fields ({path})")+ method = item.args[0].value if isinstance(item.args[0], ast.Constant) else None+ status = item.args[4].value if isinstance(item.args[4], ast.Constant) else None+ requests.append((method, ast.unparse(item.args[1]), status))++ required_requests = [+ ("namespace create", "POST", "f'{BASE}/api/namespaces'", 201),+ ("namespace get", "GET", "f'{BASE}/api/namespaces/default'", 200),+ ("pool namespace compatibility create", "POST", "f'{BASE}/api/namespaces'", 409),+ ("pool create", "POST", "pool_url.removesuffix('/default')", 201),+ ("pool delete", "DELETE", "pool_url", 204),+ ("pool namespace cleanup", "DELETE", "f'{BASE}/api/namespaces/default'", 204),+ ("explicit namespace delete", "DELETE", "f'{BASE}/api/namespaces/default'", 404),+ ]+ request_index = -1+ for label, method, url, status in required_requests:+ request_index = next(+ (+ index+ for index in range(request_index + 1, len(requests))+ if requests[index] == (method, url, status)+ ),+ None,+ )+ if request_index is None:+ raise ContractFailure(f"binding contract check failed: Python {label} request ordering/status ({path})")++ lifecycle_calls = [+ node.value.func.attr+ for node in sorted(ast.walk(run_lifecycle), key=lambda node: (getattr(node, "lineno", 0), getattr(node, "col_offset", 0)))+ if isinstance(node, ast.Await)+ and isinstance(node.value, ast.Call)+ and isinstance(node.value.func, ast.Attribute)+ and isinstance(node.value.func.value, ast.Name)+ and node.value.func.value.id == "sdk"+ ]+ required_calls = [+ "create_namespace",+ "get_namespace",+ "create_pool",+ "delete_pool",+ "delete_namespace",+ ]+ call_index = -1+ for call in required_calls:+ call_index = next(+ (index for index in range(call_index + 1, len(lifecycle_calls)) if lifecycle_calls[index] == call),+ None,+ )+ if call_index is None:+ raise ContractFailure(f"binding contract check failed: Python lifecycle {call} ordering ({path})")++def check(root: Path) -> None:bindings = root / "cyclops-cs/sdk-bindings"files = {@@ -180,6 +259,10 @@ def check(root: Path) -> None:"python_fixture": bindings / "python/contract_fixture.py","python_example": bindings / "examples/python/app_controlled.py","python_live": bindings / "examples/python/live_app_controlled.py",+ "python_sdk": bindings / "python/fleet_sdk/_sdk.py",+ "kotlin_sdk": bindings / "kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt",+ "swift_sdk": bindings / "swift/CyclopsSdk.swift",+ "ruby_sdk": bindings / "ruby/cyclops_sdk/sdk.rb","kotlin_build": bindings / "kotlin/build.gradle.kts","swift_runner": root / "cyclops-cs/scripts/run-swift-sdk-binding.sh","ruby_runner": root / "cyclops-cs/scripts/run-ruby-sdk-binding.sh",@@ -276,6 +359,30 @@ def check(root: Path) -> None:("Python exact headers and body comparison", r"actual_headers.*request\.body.*item\.headers.*item\.body"),("Python service call queue", r"def\s+expected_service_calls\("),("Python absent optional body helper", r"def\s+service_request\(body\)"),+ ("Python namespace create", r"await\s+sdk\.create_namespace\("),+ ("Python namespace get", r"await\s+sdk\.get_namespace\("),+ ("Python namespace delete", r"await\s+sdk\.delete_namespace\("),+ ])+ require_python_namespace_lifecycle_contract(files["python_fixture"])+ require_all(source["python_sdk"], files["python_sdk"], [+ ("Python create namespace binding", r"async def create_namespace\(self, name: str\) -> Namespace"),+ ("Python get namespace binding", r"async def get_namespace\(self, name: str\) -> Namespace"),+ ("Python delete namespace binding", r"async def delete_namespace\(self, name: str\) -> None"),+ ])+ require_all(source["kotlin_sdk"], files["kotlin_sdk"], [+ ("Kotlin create namespace binding", r"suspend\s+fun\s+`createNamespace`\(`name`:\s*kotlin\.String\):\s*Namespace"),+ ("Kotlin get namespace binding", r"suspend\s+fun\s+`getNamespace`\(`name`:\s*kotlin\.String\):\s*Namespace"),+ ("Kotlin delete namespace binding", r"suspend\s+fun\s+`deleteNamespace`\(`name`:\s*kotlin\.String\)"),+ ])+ require_all(source["swift_sdk"], files["swift_sdk"], [+ ("Swift create namespace binding", r"func\s+createNamespace\(name:\s*String\)\s+async\s+throws\s*->\s*Namespace"),+ ("Swift get namespace binding", r"func\s+getNamespace\(name:\s*String\)\s+async\s+throws\s*->\s*Namespace"),+ ("Swift delete namespace binding", r"func\s+deleteNamespace\(name:\s*String\)\s+async\s+throws"),+ ])+ require_all(source["ruby_sdk"], files["ruby_sdk"], [+ ("Ruby create namespace binding", r"def\s+create_namespace\(name\)"),+ ("Ruby get namespace binding", r"def\s+get_namespace\(name\)"),+ ("Ruby delete namespace binding", r"def\s+delete_namespace\(name\)"),])require(files["python_live"].read_text(encoding="utf-8"), "Python live environment", r"os\.environ\[\"CUA_CLIENT_ID\"\].*os\.environ\[\"CUA_IMAGE\"\]", files["python_live"])require_all(source["python_live"], files["python_live"], [diff --git a/libs/fleet/scripts/generate-sdk-bindings.sh b/libs/fleet/scripts/generate-sdk-bindings.shindex 1dc67ab141..39b98681e5 100755--- a/libs/fleet/scripts/generate-sdk-bindings.sh+++ b/libs/fleet/scripts/generate-sdk-bindings.sh@@ -842,8 +842,8 @@ def replace_buffer(match):f"{indent})")text, buffer_replacements = re.subn(buffer_pattern, replace_buffer, text)-if buffer_replacements != 21:- raise SystemExit(f"expected 21 Ruby Rust-buffer future wrappers, found {buffer_replacements}")+if buffer_replacements != 23:+ raise SystemExit(f"expected 23 Ruby Rust-buffer future wrappers, found {buffer_replacements}")if len(re.findall(r"result = FleetSdk\.rust_call_with_error\(SdkBuildError,:uniffi_[a-z0-9_]*builder_build,", text)) != 6:raise SystemExit("expected six synchronous Ruby SDK builder build calls")@@ -858,8 +858,8 @@ def replace_void(match):f"{indent})")text, void_replacements = re.subn(void_pattern, replace_void, text)-if void_replacements != 4:- raise SystemExit(f"expected 4 Ruby void future wrappers, found {void_replacements}")+if void_replacements != 5:+ raise SystemExit(f"expected 5 Ruby void future wrappers, found {void_replacements}")handle_map_anchor = """def self.uniffi_bytes(v)raise TypeError, \"no implicit conversion of #{v} into String\" unless v.respond_to?(:to_str)diff --git a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/fleet_sdk.ktindex c7499c61c0..47350ea44c 100644--- a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt+++ b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt@@ -714,6 +714,12 @@ internal object IntegrityCheckingUniffiLib {): Shortexternal fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim(): Short+ external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace(+ ): Short+ external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace(+ ): Short+ external fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace(+ ): Shortexternal fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_namespaces(): Shortexternal fun uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool(@@ -881,6 +887,12 @@ external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_renew_claim(`ptr`: Long,): Longexternal fun uniffi_cyclops_sdk_fn_method_cyclopsclient_wait_claim(`ptr`: Long,`claim`: RustBuffer.ByValue,): Long+external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace(`ptr`: Long,`name`: RustBuffer.ByValue,+): Long+external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_namespace(`ptr`: Long,`name`: RustBuffer.ByValue,+): Long+external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace(`ptr`: Long,`name`: RustBuffer.ByValue,+): Longexternal fun uniffi_cyclops_sdk_fn_method_cyclopsclient_list_namespaces(`ptr`: Long,): Longexternal fun uniffi_cyclops_sdk_fn_method_cyclopsclient_create_pool(`ptr`: Long,`request`: RustBuffer.ByValue,@@ -1160,6 +1172,15 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim() != 18984.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace() != 38049.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace() != 4545.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace() != 184.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_namespaces() != 65288.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}@@ -3459,6 +3480,12 @@ public interface CyclopsClientInterface {suspend fun `waitClaim`(`claim`: Claim): Sandbox+ suspend fun `createNamespace`(`name`: kotlin.String): Namespace++ suspend fun `deleteNamespace`(`name`: kotlin.String)++ suspend fun `getNamespace`(`name`: kotlin.String): Namespace+suspend fun `listNamespaces`(): List<Namespace>suspend fun `createPool`(`request`: CreatePoolRequest): Pool@@ -3728,6 +3755,70 @@ open class CyclopsClient: Disposable, AutoCloseable, CyclopsClientInterface}+ @Throws(SdkException::class)+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")+ override suspend fun `createNamespace`(`name`: kotlin.String) : Namespace {+ return uniffiRustCallAsync(+ callWithHandle { uniffiHandle ->+ UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace(+ uniffiHandle,+ FfiConverterString.lower(`name`),+ )+ },+ { future, callback, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },+ { future, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer(future, continuation) },+ { future -> UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer(future) },+ // lift function+ { FfiConverterTypeNamespace.lift(it) },+ // Error FFI converter+ SdkException.ErrorHandler,+ )+ }+++ @Throws(SdkException::class)+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")+ override suspend fun `deleteNamespace`(`name`: kotlin.String) {+ return uniffiRustCallAsync(+ callWithHandle { uniffiHandle ->+ UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_namespace(+ uniffiHandle,+ FfiConverterString.lower(`name`),+ )+ },+ { future, callback, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_poll_void(future, callback, continuation) },+ { future, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_complete_void(future, continuation) },+ { future -> UniffiLib.ffi_cyclops_sdk_rust_future_free_void(future) },+ // lift function+ { Unit },++ // Error FFI converter+ SdkException.ErrorHandler,+ )+ }+++ @Throws(SdkException::class)+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")+ override suspend fun `getNamespace`(`name`: kotlin.String) : Namespace {+ return uniffiRustCallAsync(+ callWithHandle { uniffiHandle ->+ UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace(+ uniffiHandle,+ FfiConverterString.lower(`name`),+ )+ },+ { future, callback, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },+ { future, continuation -> UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer(future, continuation) },+ { future -> UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer(future) },+ // lift function+ { FfiConverterTypeNamespace.lift(it) },+ // Error FFI converter+ SdkException.ErrorHandler,+ )+ }++@Throws(SdkException::class)@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")override suspend fun `listNamespaces`() : List<Namespace> {diff --git a/libs/fleet/sdk-bindings/python/contract_fixture.py b/libs/fleet/sdk-bindings/python/contract_fixture.pyindex 61f1c477d5..8f35a752a8 100644--- a/libs/fleet/sdk-bindings/python/contract_fixture.py+++ b/libs/fleet/sdk-bindings/python/contract_fixture.py@@ -77,6 +77,9 @@ def pool_spec():def pool_response():return {'apiVersion': 'osgym.cua.ai/v1alpha1', 'kind': 'OSGymSandboxWarmPool', 'metadata': {'namespace': 'default', 'name': 'default', 'labels': None}, 'spec': {'replicas': 1, 'sandboxTemplateRef': {'name': 'default'}}, 'status': None}+def namespace_response():+ return {'name': 'default', 'status': 'Active', 'createdAt': '2026-08-08T00:00:00Z', 'labels': {}}+def template_response():return {'apiVersion': 'osgym.cua.ai/v1alpha1', 'kind': 'OSGymSandboxTemplate', 'metadata': {'namespace': 'default', 'name': 'default', 'labels': None}, 'spec': {'vmTemplate': {'containerDiskImage': 'registry.example/desktop:offline', 'services': [{'name': 'mcp', 'targetPort': 8080}]}}}@@ -94,7 +97,9 @@ def expected_lifecycle():template_url = f'{BASE}/api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/default/osgymsandboxtemplates/default'return [token_expected(),- Expected('POST', f'{BASE}/api/namespaces', JSON_HEADERS, b'{"name":"default"}', 201, {}),+ Expected('POST', f'{BASE}/api/namespaces', JSON_HEADERS, b'{"name":"default"}', 201, namespace_response()),+ Expected('GET', f'{BASE}/api/namespaces/default', JSON_HEADERS, None, 200, namespace_response()),+ Expected('POST', f'{BASE}/api/namespaces', JSON_HEADERS, b'{"name":"default"}', 409, b''),Expected('POST', pool_url.removesuffix('/default'), JSON_HEADERS, pool_body, 201, pool_response()),Expected('POST', claim_url.removesuffix('/default'), JSON_HEADERS, claim_body, 201, claim_response()),Expected('GET', claim_url, JSON_HEADERS, None, 200, claim_response(True)),@@ -103,6 +108,7 @@ def expected_lifecycle():Expected('DELETE', claim_url, JSON_HEADERS, None, 204, b''),Expected('DELETE', pool_url, JSON_HEADERS, None, 204, b''),Expected('DELETE', f'{BASE}/api/namespaces/default', JSON_HEADERS, None, 204, b''),+ Expected('DELETE', f'{BASE}/api/namespaces/default', JSON_HEADERS, None, 404, b''),]def client(transport):@@ -112,11 +118,14 @@ async def run_lifecycle(transport):vm = VmTemplate(container_disk_image='registry.example/desktop:offline', command=None, runtime=None, runtime_class_name=None, node_selector=None, tolerations=None, image_pull_policy=None, image_pull_secret=None, cpu_cores=None, memory=None, firmware=None, probes=None, services=None, oidc=None)assert vm.container_disk_imagesdk = client(transport)+ namespace = await sdk.create_namespace('default')+ assert await sdk.get_namespace('default') == namespacepool = await sdk.create_pool(CreatePoolRequest(namespace='default', spec=pool_spec()))claim = await sdk.create_claim(CreateClaimRequest(pool=pool, spec=ClaimSpec(sandbox_template_ref=SandboxTemplateRef(name=pool.metadata.name), warmpool=None, bind_deadline=None, lifecycle=None)))sandbox = await sdk.wait_claim(claim)service = await sdk.service_request(sandbox, 'mcp', '/mcp', service_request(b'{"offline":true}'))await sdk.delete_claim(claim)await sdk.delete_pool(pool)+ await sdk.delete_namespace('default')transport.assert_exhausted()return pool, claim, sandbox, servicediff --git a/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py b/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.pyindex f8bb3d5ee4..5e51b03e2f 100644--- a/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py+++ b/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py@@ -534,6 +534,8 @@ 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_create_claim() != 23330:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace() != 38049:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool() != 48557:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_template() != 13689:@@ -542,6 +544,8 @@ 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_delete_claim() != 20460:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace() != 4545:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool() != 31235:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_template() != 54852:@@ -550,6 +554,8 @@ 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_namespace() != 184:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")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_get_template() != 8909:@@ -1159,6 +1165,11 @@ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_claim.argtypes = (_UniffiRustBuffer,)_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_claim.restype = ctypes.c_uint64+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace.argtypes = (+ ctypes.c_uint64,+ _UniffiRustBuffer,+)+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace.restype = ctypes.c_uint64_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_pool.argtypes = (ctypes.c_uint64,_UniffiRustBuffer,@@ -1179,6 +1190,11 @@ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_claim.argtypes = (_UniffiRustBuffer,)_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_claim.restype = ctypes.c_uint64+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_namespace.argtypes = (+ ctypes.c_uint64,+ _UniffiRustBuffer,+)+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_namespace.restype = ctypes.c_uint64_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_pool.argtypes = (ctypes.c_uint64,_UniffiRustBuffer,@@ -1199,6 +1215,11 @@ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_claim.argtypes = (_UniffiRustBuffer,)_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_claim.restype = ctypes.c_uint64+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace.argtypes = (+ ctypes.c_uint64,+ _UniffiRustBuffer,+)+_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace.restype = ctypes.c_uint64_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_pool.argtypes = (ctypes.c_uint64,_UniffiRustBuffer,@@ -1439,6 +1460,9 @@ _UniffiLib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_na_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim.argtypes = ()_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim.restype = ctypes.c_uint16+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace.argtypes = (+)+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace.restype = ctypes.c_uint16_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool.argtypes = ()_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool.restype = ctypes.c_uint16@@ -1451,6 +1475,9 @@ _UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_user_api_key._UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim.argtypes = ()_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim.restype = ctypes.c_uint16+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace.argtypes = (+)+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace.restype = ctypes.c_uint16_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool.argtypes = ()_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_pool.restype = ctypes.c_uint16@@ -1463,6 +1490,9 @@ _UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_user_api_key._UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim.argtypes = ()_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim.restype = ctypes.c_uint16+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace.argtypes = (+)+_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace.restype = ctypes.c_uint16_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool.argtypes = ()_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_pool.restype = ctypes.c_uint16@@ -4115,6 +4145,8 @@ class CyclopsClientProtocol(typing.Protocol):async def create_claim(self, request: CreateClaimRequest) -> Claim:raise NotImplementedError+ async def create_namespace(self, name: str) -> Namespace:+ raise NotImplementedErrorasync def create_pool(self, request: CreatePoolRequest) -> Pool:raise NotImplementedErrorasync def create_template(self, request: CreateTemplateRequest) -> Template:@@ -4123,6 +4155,8 @@ class CyclopsClientProtocol(typing.Protocol):raise NotImplementedErrorasync def delete_claim(self, claim: Claim) -> None:raise NotImplementedError+ async def delete_namespace(self, name: str) -> None:+ raise NotImplementedErrorasync def delete_pool(self, pool: Pool) -> None:raise NotImplementedErrorasync def delete_template(self, template: Template) -> None:@@ -4131,6 +4165,8 @@ class CyclopsClientProtocol(typing.Protocol):raise NotImplementedErrorasync def get_claim(self, claim: Claim) -> Claim:raise NotImplementedError+ async def get_namespace(self, name: str) -> Namespace:+ raise NotImplementedErrorasync def get_pool(self, name: str) -> Pool:raise NotImplementedErrorasync def get_template(self, namespace: str,name: str) -> Template:@@ -4338,6 +4374,23 @@ class CyclopsClient(CyclopsClientProtocol):_uniffi_lift_return,_uniffi_error_converter,)+ async def create_namespace(self, name: str) -> Namespace:++ _UniffiFfiConverterString.check_lower(name)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ _UniffiFfiConverterString.lower(name),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeNamespace.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace(*_uniffi_lowered_args),+ _UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )async def create_pool(self, request: CreatePoolRequest) -> Pool:_UniffiFfiConverterTypeCreatePoolRequest.check_lower(request)@@ -4406,6 +4459,23 @@ class CyclopsClient(CyclopsClientProtocol):_uniffi_lift_return,_uniffi_error_converter,)+ async def delete_namespace(self, name: str) -> None:++ _UniffiFfiConverterString.check_lower(name)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ _UniffiFfiConverterString.lower(name),+ )+ _uniffi_lift_return = lambda val: None+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_namespace(*_uniffi_lowered_args),+ _UniffiLib.ffi_cyclops_sdk_rust_future_poll_void,+ _UniffiLib.ffi_cyclops_sdk_rust_future_complete_void,+ _UniffiLib.ffi_cyclops_sdk_rust_future_free_void,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )async def delete_pool(self, pool: Pool) -> None:_UniffiFfiConverterTypePool.check_lower(pool)@@ -4474,6 +4544,23 @@ class CyclopsClient(CyclopsClientProtocol):_uniffi_lift_return,_uniffi_error_converter,)+ async def get_namespace(self, name: str) -> Namespace:++ _UniffiFfiConverterString.check_lower(name)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ _UniffiFfiConverterString.lower(name),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeNamespace.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace(*_uniffi_lowered_args),+ _UniffiLib.ffi_cyclops_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cyclops_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cyclops_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )async def get_pool(self, name: str) -> Pool:_UniffiFfiConverterString.check_lower(name)diff --git a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rbindex 9ea28681cf..669703ddf2 100644--- a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb+++ b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb@@ -2475,6 +2475,15 @@ module UniFFILibattach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_wait_claim,[:uint64, RustBuffer.by_value, RustCallStatus.by_ref],:uint64+ attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace,+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],+ :uint64+ attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_namespace,+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],+ :uint64+ attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace,+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],+ :uint64attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_list_namespaces,[:uint64, RustCallStatus.by_ref],:uint64@@ -2746,6 +2755,15 @@ module UniFFILibattach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim,[RustCallStatus.by_ref],:uint16+ attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace,+ [RustCallStatus.by_ref],+ :uint16+ attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace,+ [RustCallStatus.by_ref],+ :uint16+ attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace,+ [RustCallStatus.by_ref],+ :uint16attach_function :uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_namespaces,[RustCallStatus.by_ref],:uint16@@ -3601,6 +3619,42 @@ end)return result.consumeIntoTypeSandboxend+ def create_namespace(name)+ name = FleetSdk::uniffi_utf8(name)++ result = FleetSdk.uniffi_rust_future_rust_buffer(++ SdkError,++ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace(uniffi_clone_handle(),RustBuffer.allocFromString(name),RustCallStatus.new),++ )+ return result.consumeIntoTypeNamespace+ end+ def delete_namespace(name)+ name = FleetSdk::uniffi_utf8(name)++ FleetSdk.uniffi_rust_future_void(++ SdkError,++ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_namespace(uniffi_clone_handle(),RustBuffer.allocFromString(name),RustCallStatus.new),++ )+ end++ def get_namespace(name)+ name = FleetSdk::uniffi_utf8(name)++ result = FleetSdk.uniffi_rust_future_rust_buffer(++ SdkError,++ UniFFILib.uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace(uniffi_clone_handle(),RustBuffer.allocFromString(name),RustCallStatus.new),++ )+ return result.consumeIntoTypeNamespace+ enddef list_namespaces()result = FleetSdk.uniffi_rust_future_rust_buffer(SdkError,diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swiftindex 3ecbc01f69..e2039323ad 100644--- a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift@@ -1394,6 +1394,12 @@ public protocol CyclopsClientProtocol: AnyObject, Sendable {func waitClaim(claim: Claim) async throws -> Sandbox+ func createNamespace(name: String) async throws -> Namespace++ func deleteNamespace(name: String) async throws++ func getNamespace(name: String) async throws -> Namespace+func listNamespaces() async throws -> [Namespace]func createPool(request: CreatePoolRequest) async throws -> Pool@@ -1656,6 +1662,57 @@ open func waitClaim(claim: Claim)async throws -> Sandbox {)}+open func createNamespace(name: String)async throws -> Namespace {+ return+ try await uniffiRustCallAsync(+ rustFutureFunc: {+ uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace(+ self.uniffiCloneHandle(),+ FfiConverterString.lower(name)+ )+ },+ pollFunc: ffi_cyclops_sdk_rust_future_poll_rust_buffer,+ completeFunc: ffi_cyclops_sdk_rust_future_complete_rust_buffer,+ freeFunc: ffi_cyclops_sdk_rust_future_free_rust_buffer,+ liftFunc: FfiConverterTypeNamespace_lift,+ errorHandler: FfiConverterTypeSdkError_lift+ )+}++open func deleteNamespace(name: String)async throws {+ return+ try await uniffiRustCallAsync(+ rustFutureFunc: {+ uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_namespace(+ self.uniffiCloneHandle(),+ FfiConverterString.lower(name)+ )+ },+ pollFunc: ffi_cyclops_sdk_rust_future_poll_void,+ completeFunc: ffi_cyclops_sdk_rust_future_complete_void,+ freeFunc: ffi_cyclops_sdk_rust_future_free_void,+ liftFunc: { $0 },+ errorHandler: FfiConverterTypeSdkError_lift+ )+}++open func getNamespace(name: String)async throws -> Namespace {+ return+ try await uniffiRustCallAsync(+ rustFutureFunc: {+ uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace(+ self.uniffiCloneHandle(),+ FfiConverterString.lower(name)+ )+ },+ pollFunc: ffi_cyclops_sdk_rust_future_poll_rust_buffer,+ completeFunc: ffi_cyclops_sdk_rust_future_complete_rust_buffer,+ freeFunc: ffi_cyclops_sdk_rust_future_free_rust_buffer,+ liftFunc: FfiConverterTypeNamespace_lift,+ errorHandler: FfiConverterTypeSdkError_lift+ )+}+open func listNamespaces()async throws -> [Namespace] {returntry await uniffiRustCallAsync(@@ -4647,6 +4704,15 @@ private let initializationResult: InitializationResult = {if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim() != 18984) {return InitializationResult.apiChecksumMismatch}+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace() != 38049) {+ return InitializationResult.apiChecksumMismatch+ }+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace() != 4545) {+ return InitializationResult.apiChecksumMismatch+ }+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace() != 184) {+ return InitializationResult.apiChecksumMismatch+ }if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_list_namespaces() != 65288) {return InitializationResult.apiChecksumMismatch}diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h b/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.hindex ed59a62d35..d3a84fd998 100644--- a/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h@@ -348,6 +348,21 @@ uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_renew_claim(uint64_t ptr, Ruuint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_wait_claim(uint64_t ptr, RustBuffer claim);#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_NAMESPACE+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_NAMESPACE+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_create_namespace(uint64_t ptr, RustBuffer name+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_DELETE_NAMESPACE+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_DELETE_NAMESPACE+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_namespace(uint64_t ptr, RustBuffer name+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_GET_NAMESPACE+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_GET_NAMESPACE+uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_get_namespace(uint64_t ptr, RustBuffer name+);+#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_NAMESPACES#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_LIST_NAMESPACESuint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_list_namespaces(uint64_t ptr@@ -1003,6 +1018,24 @@ uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_renew_claim(void#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_WAIT_CLAIMuint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_wait_claim(void+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_NAMESPACE+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_CREATE_NAMESPACE+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_namespace(void++);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_DELETE_NAMESPACE+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_DELETE_NAMESPACE+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_namespace(void++);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_GET_NAMESPACE+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_GET_NAMESPACE+uint16_t uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_namespace(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CYCLOPSCLIENT_LIST_NAMESPACESdiff --git a/libs/fleet/sdk/src/namespaces.rs b/libs/fleet/sdk/src/namespaces.rsindex 2b831a3bce..7b5f2c6088 100644--- a/libs/fleet/sdk/src/namespaces.rs+++ b/libs/fleet/sdk/src/namespaces.rs@@ -1,28 +1,107 @@use crate::{CyclopsClient, HttpHeader, HttpRequest, Namespace, SdkError, routes};+use serde::Serialize;use std::sync::Arc;const JSON_CONTENT_TYPE: &str = "application/json";+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub(crate) enum NamespaceOwnership {+ Created,+ Existing,+}+#[uniffi::export]impl CyclopsClient {pub async fn list_namespaces(self: Arc<Self>) -> Result<Vec<Namespace>, SdkError> {self.send_json_crud("list namespaces",- json_request("GET", routes::namespace_collection(self.base_url())?),+ json_request("GET", routes::namespace_collection(self.base_url())?, None),&[200],).await}++ pub async fn create_namespace(self: Arc<Self>, name: String) -> Result<Namespace, SdkError> {+ routes::namespace_item(self.base_url(), &name)?;+ self.send_json_crud(+ "create namespace",+ json_request(+ "POST",+ routes::namespace_collection(self.base_url())?,+ Some(to_json(&serde_json::json!({ "name": name }))?),+ ),+ &[201],+ )+ .await+ }++ pub async fn get_namespace(self: Arc<Self>, name: String) -> Result<Namespace, SdkError> {+ self.send_json_crud(+ "get namespace",+ json_request("GET", routes::namespace_item(self.base_url(), &name)?, None),+ &[200],+ )+ .await+ }++ pub async fn delete_namespace(self: Arc<Self>, name: String) -> Result<(), SdkError> {+ self.send_unit_crud(+ "delete namespace",+ json_request(+ "DELETE",+ routes::namespace_item(self.base_url(), &name)?,+ None,+ ),+ &[200, 202, 204, 404],+ )+ .await+ }}-fn json_request(method: &str, url: url::Url) -> HttpRequest {+impl CyclopsClient {+ pub(crate) async fn create_namespace_if_missing(+ &self,+ name: &str,+ ) -> Result<NamespaceOwnership, SdkError> {+ let response = self+ .send_allowed(+ "create namespace",+ json_request(+ "POST",+ routes::namespace_collection(self.base_url())?,+ Some(to_json(&serde_json::json!({ "name": name }))?),+ ),+ &[201, 409],+ )+ .await?;+ Ok(if response.status == 201 {+ NamespaceOwnership::Created+ } else {+ NamespaceOwnership::Existing+ })+ }+}++fn json_request(method: &str, url: url::Url, body: Option<Vec<u8>>) -> HttpRequest {HttpRequest {method: method.into(),url: url.into(),- headers: vec![HttpHeader {- name: "accept".into(),- value: JSON_CONTENT_TYPE.into(),- }],- body: None,+ headers: vec![+ HttpHeader {+ name: "accept".into(),+ value: JSON_CONTENT_TYPE.into(),+ },+ HttpHeader {+ name: "content-type".into(),+ value: JSON_CONTENT_TYPE.into(),+ },+ ],+ body,}}++fn to_json<T: Serialize>(value: &T) -> Result<Vec<u8>, SdkError> {+ serde_json::to_vec(value).map_err(|error| SdkError::Body {+ reason: error.to_string(),+ })+}diff --git a/libs/fleet/sdk/src/pools.rs b/libs/fleet/sdk/src/pools.rsindex 481b2ba22e..873471db14 100644--- a/libs/fleet/sdk/src/pools.rs+++ b/libs/fleet/sdk/src/pools.rs@@ -1,6 +1,6 @@use crate::{CreatePoolRequest, CyclopsClient, HttpHeader, HttpRequest, HttpResponse, Pool,- ResourceMetadata, SdkError, routes,+ ResourceMetadata, SdkError, namespaces::NamespaceOwnership, routes,};use serde::{Deserialize, Serialize, de::DeserializeOwned};use std::sync::Arc;@@ -13,19 +13,12 @@ struct ResourceList<T> {items: Vec<T>,}-enum NamespaceOwnership {- Created,- Existing,-}-#[uniffi::export]impl CyclopsClient {pub async fn create_pool(self: Arc<Self>,request: CreatePoolRequest,) -> Result<Pool, SdkError> {- let namespace_collection_url = routes::namespace_collection(self.base_url())?;- let namespace_item_url = routes::namespace_item(self.base_url(), &request.namespace)?;let collection_url = routes::pool_collection(self.base_url(), &request.namespace)?;let pool = Pool {api_version: "osgym.cua.ai/v1alpha1".into(),@@ -50,7 +43,7 @@ impl CyclopsClient {.namespace_lifecycle_guard(&pool.metadata.namespace).await;let namespace_created = matches!(- self.ensure_namespace(&namespace_collection_url, &pool.metadata.namespace)+ self.create_namespace_if_missing(&pool.metadata.namespace).await?,NamespaceOwnership::Created);@@ -66,7 +59,9 @@ impl CyclopsClient {Ok(pool) => Ok(pool),Err(error) => {if namespace_created {- let _ = self.delete_namespace(&namespace_item_url).await;+ let _ = Arc::clone(&self)+ .delete_namespace(pool.metadata.namespace.clone())+ .await;}Err(error)}@@ -121,7 +116,6 @@ impl CyclopsClient {pub async fn delete_pool(self: Arc<Self>, pool: Pool) -> Result<(), SdkError> {self.ensure_lifecycle_pool_identity(&pool)?;let item_url = self.pool_item_url(&pool)?;- let namespace_url = routes::namespace_item(self.base_url(), &pool.metadata.namespace)?;let _lifecycle_guard = self.namespace_lifecycle_guard(&pool.metadata.namespace).await;@@ -131,43 +125,13 @@ impl CyclopsClient {&[200, 202, 204, 404],).await?;- self.delete_namespace(&namespace_url).await+ Arc::clone(&self)+ .delete_namespace(pool.metadata.namespace.clone())+ .await}}impl CyclopsClient {- async fn ensure_namespace(- &self,- namespace_url: &Url,- namespace: &str,- ) -> Result<NamespaceOwnership, SdkError> {- let response = self- .send_allowed(- "create namespace",- json_request(- "POST",- namespace_url.clone(),- Some(to_json(&serde_json::json!({ "name": namespace }))?),- ),- &[201, 409],- )- .await?;- match response.status {- 201 => Ok(NamespaceOwnership::Created),- 409 => Ok(NamespaceOwnership::Existing),- status => Err(SdkError::status("create namespace", status, &response.body)),- }- }-- async fn delete_namespace(&self, namespace_url: &Url) -> Result<(), SdkError> {- self.send_unit_crud(- "delete namespace",- json_request("DELETE", namespace_url.clone(), None),- &[200, 202, 204, 404],- )- .await- }-fn ensure_lifecycle_pool_identity(&self, pool: &Pool) -> Result<(), SdkError> {if pool.metadata.namespace != pool.metadata.name {return Err(SdkError::Configuration {@@ -209,7 +173,7 @@ impl CyclopsClient {Ok(())}- async fn send_allowed(+ pub(crate) async fn send_allowed(&self,operation: &str,request: HttpRequest,diff --git a/libs/fleet/sdk/tests/account_flow.rs b/libs/fleet/sdk/tests/account_flow.rsindex 0be66017c2..54d4f78ee9 100644--- a/libs/fleet/sdk/tests/account_flow.rs+++ b/libs/fleet/sdk/tests/account_flow.rs@@ -16,6 +16,15 @@ async fn typed_account_apis_use_authenticated_backend_contracts() {200,br#"[{"name":"demo","status":"Active","createdAt":"2026-08-04T12:00:00Z","labels":{"team":"sdk"}}]"#,)),+ Ok(response(+ 201,+ br#"{"name":"new-demo","status":"Active","createdAt":"2026-08-08T00:00:00Z","labels":{}}"#,+ )),+ Ok(response(+ 200,+ br#"{"name":"new-demo","status":"Active","createdAt":"2026-08-08T00:00:00Z","labels":{}}"#,+ )),+ Ok(response(204, b"")),Ok(response(200,br#"{"keys":[{"id":"key-id","client_id":"ukey-demo","name":"demo key","scope":["demo"]}]}"#,@@ -37,6 +46,23 @@ async fn typed_account_apis_use_authenticated_backend_contracts() {labels: Some(HashMap::from([("team".into(), "sdk".into())])),}]);+ let created = Arc::clone(&client)+ .create_namespace("new-demo".into())+ .await+ .unwrap();+ assert_eq!(created.name, "new-demo");++ let fetched = Arc::clone(&client)+ .get_namespace("new-demo".into())+ .await+ .unwrap();+ assert_eq!(fetched, created);++ Arc::clone(&client)+ .delete_namespace("new-demo".into())+ .await+ .unwrap();+assert_eq!(Arc::clone(&client).list_user_api_keys().await.unwrap(),vec![UserApiKey {@@ -65,7 +91,7 @@ async fn typed_account_apis_use_authenticated_backend_contracts() {client.delete_user_api_key("key/id".into()).await.unwrap();let requests = http.requests().await;- assert_eq!(requests.len(), 4);+ assert_eq!(requests.len(), 7);assert_request(&requests[0],"GET",@@ -74,18 +100,36 @@ async fn typed_account_apis_use_authenticated_backend_contracts() {);assert_request(&requests[1],+ "POST",+ "https://cyclops.example:8443/root/api/namespaces",+ Some(br#"{"name":"new-demo"}"#),+ );+ assert_request(+ &requests[2],+ "GET",+ "https://cyclops.example:8443/root/api/namespaces/new-demo",+ None,+ );+ assert_request(+ &requests[3],+ "DELETE",+ "https://cyclops.example:8443/root/api/namespaces/new-demo",+ None,+ );+ assert_request(+ &requests[4],"GET","https://cyclops.example:8443/root/api/user-keys",None,);assert_request(- &requests[2],+ &requests[5],"POST","https://cyclops.example:8443/root/api/user-keys",Some(br#"{"name":"ci-key","scope":["demo"]}"#),);assert_request(- &requests[3],+ &requests[6],"DELETE","https://cyclops.example:8443/root/api/user-keys/key%2Fid",None,@@ -111,6 +155,72 @@ async fn list_user_api_keys_treats_null_scope_as_unrestricted() {);}+#[tokio::test]+async fn namespace_crud_preserves_conflict_forbidden_and_not_found_contracts() {+ let http = Arc::new(ScriptedHttpClient::new([+ Ok(response(409, br#"{"error":"namespace already exists"}"#)),+ Ok(response(403, br#"{"error":"namespace access denied"}"#)),+ Ok(response(404, br#"{"error":"namespace not found"}"#)),+ Ok(response(404, br#"{"error":"namespace not found"}"#)),+ ]));+ let client = client(Arc::clone(&http));++ assert!(matches!(+ Arc::clone(&client)+ .create_namespace("demo".into())+ .await+ .unwrap_err(),+ SdkError::Status { status: 409, .. }+ ));+ assert!(matches!(+ Arc::clone(&client)+ .get_namespace("demo".into())+ .await+ .unwrap_err(),+ SdkError::Status { status: 403, .. }+ ));+ assert!(matches!(+ Arc::clone(&client)+ .get_namespace("demo".into())+ .await+ .unwrap_err(),+ SdkError::Status { status: 404, .. }+ ));+ Arc::clone(&client)+ .delete_namespace("demo".into())+ .await+ .unwrap();+}++#[tokio::test]+async fn namespace_crud_rejects_invalid_names_without_http_requests() {+ let http = Arc::new(ScriptedHttpClient::new([]));+ let client = client(Arc::clone(&http));++ assert!(matches!(+ Arc::clone(&client)+ .create_namespace("Invalid".into())+ .await+ .unwrap_err(),+ SdkError::InvalidResourceName { ref field, .. } if field == "namespace"+ ));+ assert!(matches!(+ Arc::clone(&client)+ .get_namespace("Invalid".into())+ .await+ .unwrap_err(),+ SdkError::InvalidResourceName { ref field, .. } if field == "namespace"+ ));+ assert!(matches!(+ Arc::clone(&client)+ .delete_namespace("Invalid".into())+ .await+ .unwrap_err(),+ SdkError::InvalidResourceName { ref field, .. } if field == "namespace"+ ));+ assert_eq!(http.request_count().await, 0);+}+#[tokio::test]async fn typed_account_apis_validate_ids_statuses_and_json() {let http = Arc::new(ScriptedHttpClient::new([@@ -166,7 +276,7 @@ fn assert_request(request: &HttpRequest, method: &str, url: &str, body: Option<&assert_eq!(request.url, url);assert_eq!(request.body.as_deref(), body);let mut expected_headers = vec![header("accept", "application/json")];- if body.is_some() {+ if body.is_some() || request.url.contains("/api/namespaces") {expected_headers.push(header("content-type", "application/json"));}expected_headers.push(header("authorization", "Bearer offline-token"));diff --git a/libs/fleet/sdk/tests/binding_generation.rs b/libs/fleet/sdk/tests/binding_generation.rsindex 2d03f709b8..b48ffd653d 100644--- a/libs/fleet/sdk/tests/binding_generation.rs+++ b/libs/fleet/sdk/tests/binding_generation.rs@@ -58,6 +58,9 @@ fn generated_bindings_hide_raw_credentials_and_claim_update() {assert!(!python.contains("async def execute_authenticated"));assert!(!kotlin.contains("suspend fun `executeAuthenticated`"));assert!(python.contains("async def list_namespaces"));+ assert!(python.contains("async def create_namespace"));+ assert!(python.contains("async def get_namespace"));+ assert!(python.contains("async def delete_namespace"));assert!(python.contains("async def list_user_api_keys"));assert!(python.contains("async def create_user_api_key"));assert!(python.contains("async def delete_user_api_key"));