rl-rock 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -490,18 +490,6 @@ declare const RunMode: {
490
490
  NORMAL: "normal";
491
491
  NOHUP: "nohup";
492
492
  };
493
- /**
494
- * Constants class (deprecated, use envs module instead)
495
- * @deprecated Use envs module instead
496
- */
497
- declare class Constants {
498
- static readonly BASE_URL_PRODUCT = "";
499
- static readonly BASE_URL_ALIYUN = "";
500
- static readonly BASE_URL_INNER = "";
501
- static readonly BASE_URL_PRE = "";
502
- static readonly BASE_URL_LOCAL = "";
503
- static readonly REQUEST_TIMEOUT_SECONDS = 180;
504
- }
505
493
  /**
506
494
  * PID prefix and suffix for nohup output parsing
507
495
  */
@@ -554,6 +542,10 @@ declare function raiseForCode(code: Codes | null | undefined, message: string):
554
542
  */
555
543
  declare function fromRockException(e: RockException): SandboxResponse;
556
544
 
545
+ /**
546
+ * HTTP utilities using axios
547
+ */
548
+
557
549
  /**
558
550
  * HTTP response with headers
559
551
  */
@@ -633,9 +625,6 @@ declare function sleep(ms: number): Promise<void>;
633
625
  */
634
626
  declare function withRetry<T extends (...args: unknown[]) => Promise<unknown>>(fn: T, options?: RetryOptions): T;
635
627
 
636
- /**
637
- * Deprecated decorator utilities
638
- */
639
628
  /**
640
629
  * Mark a function as deprecated
641
630
  */
@@ -647,17 +636,17 @@ declare function deprecatedClass(reason?: string): <T extends new (...args: any[
647
636
 
648
637
  /**
649
638
  * System utilities
639
+ *
640
+ * Note: This SDK requires Node.js environment (v20.8.0+).
641
+ * It cannot run in browsers due to dependencies on Node.js modules.
650
642
  */
651
643
  /**
652
644
  * Check if running in Node.js environment
653
645
  */
654
646
  declare function isNode(): boolean;
655
- /**
656
- * Check if running in browser environment
657
- */
658
- declare function isBrowser(): boolean;
659
647
  /**
660
648
  * Get environment variable
649
+ * Directly accesses process.env since this SDK requires Node.js
661
650
  */
662
651
  declare function getEnv(key: string, defaultValue?: string): string | undefined;
663
652
  /**
@@ -666,6 +655,7 @@ declare function getEnv(key: string, defaultValue?: string): string | undefined;
666
655
  declare function getRequiredEnv(key: string): string;
667
656
  /**
668
657
  * Check if environment variable is set
658
+ * Directly checks process.env since this SDK requires Node.js
669
659
  */
670
660
  declare function isEnvSet(key: string): boolean;
671
661
 
@@ -801,8 +791,18 @@ declare class RockEnv {
801
791
  private readonly envId;
802
792
  private sandboxId;
803
793
  private isClosed;
804
- private client;
805
- constructor(config: RockEnvConfig);
794
+ private constructor();
795
+ /**
796
+ * Create and initialize a RockEnv instance
797
+ *
798
+ * @param config - Environment configuration
799
+ * @returns Initialized RockEnv instance
800
+ */
801
+ static create(config: RockEnvConfig): Promise<RockEnv>;
802
+ /**
803
+ * Get the sandbox ID
804
+ */
805
+ getSandboxId(): string | null;
806
806
  /**
807
807
  * Initialize environment instance
808
808
  */
@@ -848,9 +848,9 @@ declare class RockEnv {
848
848
  *
849
849
  * @param envId - Environment ID
850
850
  * @param options - Environment options
851
- * @returns RockEnv instance
851
+ * @returns Promise resolving to RockEnv instance
852
852
  */
853
- declare function make(envId: string, options?: Record<string, unknown>): RockEnv;
853
+ declare function make(envId: string, options?: Record<string, unknown>): Promise<RockEnv>;
854
854
 
855
855
  /**
856
856
  * Sandbox configuration
@@ -1058,7 +1058,7 @@ declare class LinuxFileSystem extends FileSystem {
1058
1058
  }
1059
1059
 
1060
1060
  /**
1061
- * Sandbox types
1061
+ * Network - Network management for sandbox
1062
1062
  */
1063
1063
 
1064
1064
  /**
@@ -1069,11 +1069,6 @@ declare enum SpeedupType {
1069
1069
  PIP = "pip",
1070
1070
  GITHUB = "github"
1071
1071
  }
1072
-
1073
- /**
1074
- * Network - Network management for sandbox
1075
- */
1076
-
1077
1072
  /**
1078
1073
  * Network management for sandbox
1079
1074
  */
@@ -2361,4 +2356,4 @@ declare class DefaultAgent extends Agent {
2361
2356
  */
2362
2357
  declare const VERSION: string;
2363
2358
 
2364
- export { Agent, type AgentBashCommand, AgentBashCommandSchema, type AgentConfig, AgentConfigSchema, BadRequestRockError, type BaseConfig, type BashAction, BashActionSchema, type ChmodRequest, ChmodRequestSchema, type ChmodResponse, ChmodResponseSchema, type ChownRequest, ChownRequestSchema, type ChownResponse, ChownResponseSchema, type CloseResponse, CloseResponseSchema, type CloseSessionRequest, CloseSessionRequestSchema, type CloseSessionResponse, CloseSessionResponseSchema, Codes, type Command, type CommandResponse, CommandResponseSchema, CommandRockError, CommandSchema, Constants, type CreateBashSessionRequest, CreateBashSessionRequestSchema, type CreateSessionResponse, CreateSessionResponseSchema, DefaultAgent, type DefaultAgentConfig, DefaultAgentConfigSchema, Deploy, EnvHubClient, type EnvHubClientConfig, EnvHubClientConfigSchema, EnvHubError, type ExecuteBashSessionResponse, ExecuteBashSessionResponseSchema, HttpUtils, InternalServerRockError, InvalidParameterRockException, type IsAliveResponse, IsAliveResponseSchema, LinuxFileSystem, LinuxRemoteUser, ModelClient, type ModelClientConfig, ModelService, type ModelServiceConfig, ModelServiceConfigSchema, NODE_DEFAULT_VERSION, Network, NodeRuntimeEnv, type NodeRuntimeEnvConfig, NodeRuntimeEnvConfigSchema, type Observation, ObservationSchema, type OssSetupResponse, OssSetupResponseSchema, PID_PREFIX, PID_SUFFIX, type PollOptions, Process, PythonRuntimeEnv, type PythonRuntimeEnvConfig, PythonRuntimeEnvConfigSchema, type ReadFileRequest, ReadFileRequestSchema, type ReadFileResponse, ReadFileResponseSchema, ReasonPhrases, type ResetResult, type RockAgentConfig, RockAgentConfigSchema, RockEnv, type RockEnvConfig, type RockEnvInfo, RockEnvInfoSchema, RockException, RunMode, type RunModeType, RuntimeEnv, type RuntimeEnvConfig, RuntimeEnvConfigSchema, type RuntimeEnvId, Sandbox, type SandboxConfig, SandboxConfigSchema, SandboxGroup, type SandboxGroupConfig, SandboxGroupConfigSchema, type SandboxLike, type SandboxResponse, SandboxResponseSchema, type RunModeType as SandboxRunModeType, type SandboxStatusResponse, SandboxStatusResponseSchema, SpeedupType, type StepResult, type UploadRequest, UploadRequestSchema, type UploadResponse, UploadResponseSchema, VERSION, type WriteFileRequest, WriteFileRequestSchema, type WriteFileResponse, WriteFileResponseSchema, arunWithRetry, createRockEnvInfo, createRuntimeEnvId, createSandboxConfig, createSandboxGroupConfig, deprecated, deprecatedClass, extractNohupPid as extractNohupPidFromSandbox, fromRockException, getDefaultPipIndexUrl, getEnv, getReasonPhrase, getRequiredEnv, isBrowser, isClientError, isCommandError, isEnvSet, isError, isNode, isServerError, isSuccess, make, raiseForCode, retryAsync, sleep, withRetry, withTimeLogging };
2359
+ export { Agent, type AgentBashCommand, AgentBashCommandSchema, type AgentConfig, AgentConfigSchema, BadRequestRockError, type BaseConfig, type BashAction, BashActionSchema, type ChmodRequest, ChmodRequestSchema, type ChmodResponse, ChmodResponseSchema, type ChownRequest, ChownRequestSchema, type ChownResponse, ChownResponseSchema, type CloseResponse, CloseResponseSchema, type CloseSessionRequest, CloseSessionRequestSchema, type CloseSessionResponse, CloseSessionResponseSchema, Codes, type Command, type CommandResponse, CommandResponseSchema, CommandRockError, CommandSchema, type CreateBashSessionRequest, CreateBashSessionRequestSchema, type CreateSessionResponse, CreateSessionResponseSchema, DefaultAgent, type DefaultAgentConfig, DefaultAgentConfigSchema, Deploy, EnvHubClient, type EnvHubClientConfig, EnvHubClientConfigSchema, EnvHubError, type ExecuteBashSessionResponse, ExecuteBashSessionResponseSchema, HttpUtils, InternalServerRockError, InvalidParameterRockException, type IsAliveResponse, IsAliveResponseSchema, LinuxFileSystem, LinuxRemoteUser, ModelClient, type ModelClientConfig, ModelService, type ModelServiceConfig, ModelServiceConfigSchema, NODE_DEFAULT_VERSION, Network, NodeRuntimeEnv, type NodeRuntimeEnvConfig, NodeRuntimeEnvConfigSchema, type Observation, ObservationSchema, type OssSetupResponse, OssSetupResponseSchema, PID_PREFIX, PID_SUFFIX, type PollOptions, Process, PythonRuntimeEnv, type PythonRuntimeEnvConfig, PythonRuntimeEnvConfigSchema, type ReadFileRequest, ReadFileRequestSchema, type ReadFileResponse, ReadFileResponseSchema, ReasonPhrases, type ResetResult, type RockAgentConfig, RockAgentConfigSchema, RockEnv, type RockEnvConfig, type RockEnvInfo, RockEnvInfoSchema, RockException, RunMode, type RunModeType, RuntimeEnv, type RuntimeEnvConfig, RuntimeEnvConfigSchema, type RuntimeEnvId, Sandbox, type SandboxConfig, SandboxConfigSchema, SandboxGroup, type SandboxGroupConfig, SandboxGroupConfigSchema, type SandboxLike, type SandboxResponse, SandboxResponseSchema, type RunModeType as SandboxRunModeType, type SandboxStatusResponse, SandboxStatusResponseSchema, SpeedupType, type StepResult, type UploadRequest, UploadRequestSchema, type UploadResponse, UploadResponseSchema, VERSION, type WriteFileRequest, WriteFileRequestSchema, type WriteFileResponse, WriteFileResponseSchema, arunWithRetry, createRockEnvInfo, createRuntimeEnvId, createSandboxConfig, createSandboxGroupConfig, deprecated, deprecatedClass, extractNohupPid as extractNohupPidFromSandbox, fromRockException, getDefaultPipIndexUrl, getEnv, getReasonPhrase, getRequiredEnv, isClientError, isCommandError, isEnvSet, isError, isNode, isServerError, isSuccess, make, raiseForCode, retryAsync, sleep, withRetry, withTimeLogging };
package/dist/index.d.ts CHANGED
@@ -490,18 +490,6 @@ declare const RunMode: {
490
490
  NORMAL: "normal";
491
491
  NOHUP: "nohup";
492
492
  };
493
- /**
494
- * Constants class (deprecated, use envs module instead)
495
- * @deprecated Use envs module instead
496
- */
497
- declare class Constants {
498
- static readonly BASE_URL_PRODUCT = "";
499
- static readonly BASE_URL_ALIYUN = "";
500
- static readonly BASE_URL_INNER = "";
501
- static readonly BASE_URL_PRE = "";
502
- static readonly BASE_URL_LOCAL = "";
503
- static readonly REQUEST_TIMEOUT_SECONDS = 180;
504
- }
505
493
  /**
506
494
  * PID prefix and suffix for nohup output parsing
507
495
  */
@@ -554,6 +542,10 @@ declare function raiseForCode(code: Codes | null | undefined, message: string):
554
542
  */
555
543
  declare function fromRockException(e: RockException): SandboxResponse;
556
544
 
545
+ /**
546
+ * HTTP utilities using axios
547
+ */
548
+
557
549
  /**
558
550
  * HTTP response with headers
559
551
  */
@@ -633,9 +625,6 @@ declare function sleep(ms: number): Promise<void>;
633
625
  */
634
626
  declare function withRetry<T extends (...args: unknown[]) => Promise<unknown>>(fn: T, options?: RetryOptions): T;
635
627
 
636
- /**
637
- * Deprecated decorator utilities
638
- */
639
628
  /**
640
629
  * Mark a function as deprecated
641
630
  */
@@ -647,17 +636,17 @@ declare function deprecatedClass(reason?: string): <T extends new (...args: any[
647
636
 
648
637
  /**
649
638
  * System utilities
639
+ *
640
+ * Note: This SDK requires Node.js environment (v20.8.0+).
641
+ * It cannot run in browsers due to dependencies on Node.js modules.
650
642
  */
651
643
  /**
652
644
  * Check if running in Node.js environment
653
645
  */
654
646
  declare function isNode(): boolean;
655
- /**
656
- * Check if running in browser environment
657
- */
658
- declare function isBrowser(): boolean;
659
647
  /**
660
648
  * Get environment variable
649
+ * Directly accesses process.env since this SDK requires Node.js
661
650
  */
662
651
  declare function getEnv(key: string, defaultValue?: string): string | undefined;
663
652
  /**
@@ -666,6 +655,7 @@ declare function getEnv(key: string, defaultValue?: string): string | undefined;
666
655
  declare function getRequiredEnv(key: string): string;
667
656
  /**
668
657
  * Check if environment variable is set
658
+ * Directly checks process.env since this SDK requires Node.js
669
659
  */
670
660
  declare function isEnvSet(key: string): boolean;
671
661
 
@@ -801,8 +791,18 @@ declare class RockEnv {
801
791
  private readonly envId;
802
792
  private sandboxId;
803
793
  private isClosed;
804
- private client;
805
- constructor(config: RockEnvConfig);
794
+ private constructor();
795
+ /**
796
+ * Create and initialize a RockEnv instance
797
+ *
798
+ * @param config - Environment configuration
799
+ * @returns Initialized RockEnv instance
800
+ */
801
+ static create(config: RockEnvConfig): Promise<RockEnv>;
802
+ /**
803
+ * Get the sandbox ID
804
+ */
805
+ getSandboxId(): string | null;
806
806
  /**
807
807
  * Initialize environment instance
808
808
  */
@@ -848,9 +848,9 @@ declare class RockEnv {
848
848
  *
849
849
  * @param envId - Environment ID
850
850
  * @param options - Environment options
851
- * @returns RockEnv instance
851
+ * @returns Promise resolving to RockEnv instance
852
852
  */
853
- declare function make(envId: string, options?: Record<string, unknown>): RockEnv;
853
+ declare function make(envId: string, options?: Record<string, unknown>): Promise<RockEnv>;
854
854
 
855
855
  /**
856
856
  * Sandbox configuration
@@ -1058,7 +1058,7 @@ declare class LinuxFileSystem extends FileSystem {
1058
1058
  }
1059
1059
 
1060
1060
  /**
1061
- * Sandbox types
1061
+ * Network - Network management for sandbox
1062
1062
  */
1063
1063
 
1064
1064
  /**
@@ -1069,11 +1069,6 @@ declare enum SpeedupType {
1069
1069
  PIP = "pip",
1070
1070
  GITHUB = "github"
1071
1071
  }
1072
-
1073
- /**
1074
- * Network - Network management for sandbox
1075
- */
1076
-
1077
1072
  /**
1078
1073
  * Network management for sandbox
1079
1074
  */
@@ -2361,4 +2356,4 @@ declare class DefaultAgent extends Agent {
2361
2356
  */
2362
2357
  declare const VERSION: string;
2363
2358
 
2364
- export { Agent, type AgentBashCommand, AgentBashCommandSchema, type AgentConfig, AgentConfigSchema, BadRequestRockError, type BaseConfig, type BashAction, BashActionSchema, type ChmodRequest, ChmodRequestSchema, type ChmodResponse, ChmodResponseSchema, type ChownRequest, ChownRequestSchema, type ChownResponse, ChownResponseSchema, type CloseResponse, CloseResponseSchema, type CloseSessionRequest, CloseSessionRequestSchema, type CloseSessionResponse, CloseSessionResponseSchema, Codes, type Command, type CommandResponse, CommandResponseSchema, CommandRockError, CommandSchema, Constants, type CreateBashSessionRequest, CreateBashSessionRequestSchema, type CreateSessionResponse, CreateSessionResponseSchema, DefaultAgent, type DefaultAgentConfig, DefaultAgentConfigSchema, Deploy, EnvHubClient, type EnvHubClientConfig, EnvHubClientConfigSchema, EnvHubError, type ExecuteBashSessionResponse, ExecuteBashSessionResponseSchema, HttpUtils, InternalServerRockError, InvalidParameterRockException, type IsAliveResponse, IsAliveResponseSchema, LinuxFileSystem, LinuxRemoteUser, ModelClient, type ModelClientConfig, ModelService, type ModelServiceConfig, ModelServiceConfigSchema, NODE_DEFAULT_VERSION, Network, NodeRuntimeEnv, type NodeRuntimeEnvConfig, NodeRuntimeEnvConfigSchema, type Observation, ObservationSchema, type OssSetupResponse, OssSetupResponseSchema, PID_PREFIX, PID_SUFFIX, type PollOptions, Process, PythonRuntimeEnv, type PythonRuntimeEnvConfig, PythonRuntimeEnvConfigSchema, type ReadFileRequest, ReadFileRequestSchema, type ReadFileResponse, ReadFileResponseSchema, ReasonPhrases, type ResetResult, type RockAgentConfig, RockAgentConfigSchema, RockEnv, type RockEnvConfig, type RockEnvInfo, RockEnvInfoSchema, RockException, RunMode, type RunModeType, RuntimeEnv, type RuntimeEnvConfig, RuntimeEnvConfigSchema, type RuntimeEnvId, Sandbox, type SandboxConfig, SandboxConfigSchema, SandboxGroup, type SandboxGroupConfig, SandboxGroupConfigSchema, type SandboxLike, type SandboxResponse, SandboxResponseSchema, type RunModeType as SandboxRunModeType, type SandboxStatusResponse, SandboxStatusResponseSchema, SpeedupType, type StepResult, type UploadRequest, UploadRequestSchema, type UploadResponse, UploadResponseSchema, VERSION, type WriteFileRequest, WriteFileRequestSchema, type WriteFileResponse, WriteFileResponseSchema, arunWithRetry, createRockEnvInfo, createRuntimeEnvId, createSandboxConfig, createSandboxGroupConfig, deprecated, deprecatedClass, extractNohupPid as extractNohupPidFromSandbox, fromRockException, getDefaultPipIndexUrl, getEnv, getReasonPhrase, getRequiredEnv, isBrowser, isClientError, isCommandError, isEnvSet, isError, isNode, isServerError, isSuccess, make, raiseForCode, retryAsync, sleep, withRetry, withTimeLogging };
2359
+ export { Agent, type AgentBashCommand, AgentBashCommandSchema, type AgentConfig, AgentConfigSchema, BadRequestRockError, type BaseConfig, type BashAction, BashActionSchema, type ChmodRequest, ChmodRequestSchema, type ChmodResponse, ChmodResponseSchema, type ChownRequest, ChownRequestSchema, type ChownResponse, ChownResponseSchema, type CloseResponse, CloseResponseSchema, type CloseSessionRequest, CloseSessionRequestSchema, type CloseSessionResponse, CloseSessionResponseSchema, Codes, type Command, type CommandResponse, CommandResponseSchema, CommandRockError, CommandSchema, type CreateBashSessionRequest, CreateBashSessionRequestSchema, type CreateSessionResponse, CreateSessionResponseSchema, DefaultAgent, type DefaultAgentConfig, DefaultAgentConfigSchema, Deploy, EnvHubClient, type EnvHubClientConfig, EnvHubClientConfigSchema, EnvHubError, type ExecuteBashSessionResponse, ExecuteBashSessionResponseSchema, HttpUtils, InternalServerRockError, InvalidParameterRockException, type IsAliveResponse, IsAliveResponseSchema, LinuxFileSystem, LinuxRemoteUser, ModelClient, type ModelClientConfig, ModelService, type ModelServiceConfig, ModelServiceConfigSchema, NODE_DEFAULT_VERSION, Network, NodeRuntimeEnv, type NodeRuntimeEnvConfig, NodeRuntimeEnvConfigSchema, type Observation, ObservationSchema, type OssSetupResponse, OssSetupResponseSchema, PID_PREFIX, PID_SUFFIX, type PollOptions, Process, PythonRuntimeEnv, type PythonRuntimeEnvConfig, PythonRuntimeEnvConfigSchema, type ReadFileRequest, ReadFileRequestSchema, type ReadFileResponse, ReadFileResponseSchema, ReasonPhrases, type ResetResult, type RockAgentConfig, RockAgentConfigSchema, RockEnv, type RockEnvConfig, type RockEnvInfo, RockEnvInfoSchema, RockException, RunMode, type RunModeType, RuntimeEnv, type RuntimeEnvConfig, RuntimeEnvConfigSchema, type RuntimeEnvId, Sandbox, type SandboxConfig, SandboxConfigSchema, SandboxGroup, type SandboxGroupConfig, SandboxGroupConfigSchema, type SandboxLike, type SandboxResponse, SandboxResponseSchema, type RunModeType as SandboxRunModeType, type SandboxStatusResponse, SandboxStatusResponseSchema, SpeedupType, type StepResult, type UploadRequest, UploadRequestSchema, type UploadResponse, UploadResponseSchema, VERSION, type WriteFileRequest, WriteFileRequestSchema, type WriteFileResponse, WriteFileResponseSchema, arunWithRetry, createRockEnvInfo, createRuntimeEnvId, createSandboxConfig, createSandboxGroupConfig, deprecated, deprecatedClass, extractNohupPid as extractNohupPidFromSandbox, fromRockException, getDefaultPipIndexUrl, getEnv, getReasonPhrase, getRequiredEnv, isClientError, isCommandError, isEnvSet, isError, isNode, isServerError, isSuccess, make, raiseForCode, retryAsync, sleep, withRetry, withTimeLogging };