From 55704bb5981529e4baa05011c31dd73300e38a6b Mon Sep 17 00:00:00 2001 From: perhapzz Date: Fri, 20 Mar 2026 12:04:48 +0000 Subject: [PATCH] feat(sdk/js): add OSSFS volume backend support Add Alibaba Cloud OSSFS mount backend to the JavaScript/TypeScript sandbox SDK, aligning it with the Python SDK implementation. Changes: - Add OSSFS interface to models/sandboxes.ts with full type definitions (bucket, endpoint, version, options, accessKeyId, accessKeySecret) - Update Volume interface to include ossfs as a third backend option - Update volume validation in sandbox.ts to check [host, pvc, ossfs] - Export OSSFS type from index.ts - Add 3 tests: OSSFS volume creation, no-backend rejection, multi-backend rejection Partially addresses #476 (SDK parity gaps - OSSFS support) --- sdks/sandbox/javascript/src/index.ts | 1 + .../javascript/src/models/sandboxes.ts | 49 ++++++++++++- sdks/sandbox/javascript/src/sandbox.ts | 6 +- .../javascript/tests/sandbox.create.test.mjs | 73 +++++++++++++++++++ 4 files changed, 123 insertions(+), 6 deletions(-) diff --git a/sdks/sandbox/javascript/src/index.ts b/sdks/sandbox/javascript/src/index.ts index e0f98223..185e0bf5 100644 --- a/sdks/sandbox/javascript/src/index.ts +++ b/sdks/sandbox/javascript/src/index.ts @@ -39,6 +39,7 @@ export type { NetworkPolicy, NetworkRule, NetworkRuleAction, + OSSFS, PVC, RenewSandboxExpirationRequest, RenewSandboxExpirationResponse, diff --git a/sdks/sandbox/javascript/src/models/sandboxes.ts b/sdks/sandbox/javascript/src/models/sandboxes.ts index 52c74cbb..a8b80b49 100644 --- a/sdks/sandbox/javascript/src/models/sandboxes.ts +++ b/sdks/sandbox/javascript/src/models/sandboxes.ts @@ -92,12 +92,51 @@ export interface PVC extends Record { claimName: string; } +/** + * Alibaba Cloud OSS mount backend via ossfs. + * + * The runtime mounts a host-side OSS path under `storage.ossfs_mount_root` + * so the container sees the bucket contents at the specified mount path. + * + * In Docker runtime, OSSFS backend requires OpenSandbox Server to run on a Linux host with FUSE support. + */ +export interface OSSFS extends Record { + /** + * OSS bucket name. + */ + bucket: string; + /** + * OSS endpoint (e.g., "oss-cn-hangzhou.aliyuncs.com"). + */ + endpoint: string; + /** + * ossfs major version used by runtime mount integration. + * @default "2.0" + */ + version?: "1.0" | "2.0"; + /** + * Additional ossfs mount options. + * + * - `1.0`: mounts with `ossfs ... -o