rl-rock 1.2.4 → 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/README.md +80 -2
- package/dist/index.d.mts +1082 -73
- package/dist/index.d.ts +1082 -73
- package/dist/index.js +1616 -448
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1602 -444
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -14
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ChildProcess } from 'child_process';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* ROCK status codes enumeration
|
|
@@ -483,7 +482,7 @@ type OssSetupResponse = z.infer<typeof OssSetupResponseSchema>;
|
|
|
483
482
|
/**
|
|
484
483
|
* Run mode type
|
|
485
484
|
*/
|
|
486
|
-
type RunModeType
|
|
485
|
+
type RunModeType = 'normal' | 'nohup';
|
|
487
486
|
/**
|
|
488
487
|
* Run mode enum
|
|
489
488
|
*/
|
|
@@ -491,18 +490,6 @@ declare const RunMode: {
|
|
|
491
490
|
NORMAL: "normal";
|
|
492
491
|
NOHUP: "nohup";
|
|
493
492
|
};
|
|
494
|
-
/**
|
|
495
|
-
* Constants class (deprecated, use envs module instead)
|
|
496
|
-
* @deprecated Use envs module instead
|
|
497
|
-
*/
|
|
498
|
-
declare class Constants {
|
|
499
|
-
static readonly BASE_URL_PRODUCT = "";
|
|
500
|
-
static readonly BASE_URL_ALIYUN = "";
|
|
501
|
-
static readonly BASE_URL_INNER = "";
|
|
502
|
-
static readonly BASE_URL_PRE = "";
|
|
503
|
-
static readonly BASE_URL_LOCAL = "";
|
|
504
|
-
static readonly REQUEST_TIMEOUT_SECONDS = 180;
|
|
505
|
-
}
|
|
506
493
|
/**
|
|
507
494
|
* PID prefix and suffix for nohup output parsing
|
|
508
495
|
*/
|
|
@@ -555,6 +542,10 @@ declare function raiseForCode(code: Codes | null | undefined, message: string):
|
|
|
555
542
|
*/
|
|
556
543
|
declare function fromRockException(e: RockException): SandboxResponse;
|
|
557
544
|
|
|
545
|
+
/**
|
|
546
|
+
* HTTP utilities using axios
|
|
547
|
+
*/
|
|
548
|
+
|
|
558
549
|
/**
|
|
559
550
|
* HTTP response with headers
|
|
560
551
|
*/
|
|
@@ -604,6 +595,10 @@ declare class HttpUtils {
|
|
|
604
595
|
*/
|
|
605
596
|
static guessContentType(filename: string): string;
|
|
606
597
|
}
|
|
598
|
+
/**
|
|
599
|
+
* Extract nohup PID from output
|
|
600
|
+
*/
|
|
601
|
+
declare function extractNohupPid(output: string): number | null;
|
|
607
602
|
|
|
608
603
|
/**
|
|
609
604
|
* Retry utilities
|
|
@@ -630,9 +625,6 @@ declare function sleep(ms: number): Promise<void>;
|
|
|
630
625
|
*/
|
|
631
626
|
declare function withRetry<T extends (...args: unknown[]) => Promise<unknown>>(fn: T, options?: RetryOptions): T;
|
|
632
627
|
|
|
633
|
-
/**
|
|
634
|
-
* Deprecated decorator utilities
|
|
635
|
-
*/
|
|
636
628
|
/**
|
|
637
629
|
* Mark a function as deprecated
|
|
638
630
|
*/
|
|
@@ -644,17 +636,17 @@ declare function deprecatedClass(reason?: string): <T extends new (...args: any[
|
|
|
644
636
|
|
|
645
637
|
/**
|
|
646
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.
|
|
647
642
|
*/
|
|
648
643
|
/**
|
|
649
644
|
* Check if running in Node.js environment
|
|
650
645
|
*/
|
|
651
646
|
declare function isNode(): boolean;
|
|
652
|
-
/**
|
|
653
|
-
* Check if running in browser environment
|
|
654
|
-
*/
|
|
655
|
-
declare function isBrowser(): boolean;
|
|
656
647
|
/**
|
|
657
648
|
* Get environment variable
|
|
649
|
+
* Directly accesses process.env since this SDK requires Node.js
|
|
658
650
|
*/
|
|
659
651
|
declare function getEnv(key: string, defaultValue?: string): string | undefined;
|
|
660
652
|
/**
|
|
@@ -663,6 +655,7 @@ declare function getEnv(key: string, defaultValue?: string): string | undefined;
|
|
|
663
655
|
declare function getRequiredEnv(key: string): string;
|
|
664
656
|
/**
|
|
665
657
|
* Check if environment variable is set
|
|
658
|
+
* Directly checks process.env since this SDK requires Node.js
|
|
666
659
|
*/
|
|
667
660
|
declare function isEnvSet(key: string): boolean;
|
|
668
661
|
|
|
@@ -798,8 +791,18 @@ declare class RockEnv {
|
|
|
798
791
|
private readonly envId;
|
|
799
792
|
private sandboxId;
|
|
800
793
|
private isClosed;
|
|
801
|
-
private
|
|
802
|
-
|
|
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;
|
|
803
806
|
/**
|
|
804
807
|
* Initialize environment instance
|
|
805
808
|
*/
|
|
@@ -845,9 +848,9 @@ declare class RockEnv {
|
|
|
845
848
|
*
|
|
846
849
|
* @param envId - Environment ID
|
|
847
850
|
* @param options - Environment options
|
|
848
|
-
* @returns RockEnv instance
|
|
851
|
+
* @returns Promise resolving to RockEnv instance
|
|
849
852
|
*/
|
|
850
|
-
declare function make(envId: string, options?: Record<string, unknown>): RockEnv
|
|
853
|
+
declare function make(envId: string, options?: Record<string, unknown>): Promise<RockEnv>;
|
|
851
854
|
|
|
852
855
|
/**
|
|
853
856
|
* Sandbox configuration
|
|
@@ -1051,16 +1054,13 @@ declare class LinuxFileSystem extends FileSystem {
|
|
|
1051
1054
|
success: boolean;
|
|
1052
1055
|
message: string;
|
|
1053
1056
|
}>;
|
|
1054
|
-
uploadDir(sourceDir: string, targetDir: string,
|
|
1057
|
+
uploadDir(sourceDir: string, targetDir: string, extractTimeout?: number): Promise<Observation>;
|
|
1055
1058
|
}
|
|
1056
1059
|
|
|
1057
1060
|
/**
|
|
1058
|
-
*
|
|
1059
|
-
*/
|
|
1060
|
-
/**
|
|
1061
|
-
* Run mode type
|
|
1061
|
+
* Network - Network management for sandbox
|
|
1062
1062
|
*/
|
|
1063
|
-
|
|
1063
|
+
|
|
1064
1064
|
/**
|
|
1065
1065
|
* Speedup type enum
|
|
1066
1066
|
*/
|
|
@@ -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
|
*/
|
|
@@ -1089,9 +1084,25 @@ declare class Network {
|
|
|
1089
1084
|
* @returns Observation with execution result
|
|
1090
1085
|
*/
|
|
1091
1086
|
speedup(speedupType: SpeedupType, speedupValue: string, timeout?: number): Promise<Observation>;
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1087
|
+
/**
|
|
1088
|
+
* Generate speedup script content based on type
|
|
1089
|
+
*/
|
|
1090
|
+
private generateSpeedupScript;
|
|
1091
|
+
/**
|
|
1092
|
+
* Build APT speedup script
|
|
1093
|
+
* Uses script file approach for safety
|
|
1094
|
+
*/
|
|
1095
|
+
private buildAptSpeedupScript;
|
|
1096
|
+
/**
|
|
1097
|
+
* Build PIP speedup script
|
|
1098
|
+
* Uses script file approach for safety
|
|
1099
|
+
*/
|
|
1100
|
+
private buildPipSpeedupScript;
|
|
1101
|
+
/**
|
|
1102
|
+
* Build GitHub speedup script
|
|
1103
|
+
* Uses script file approach for safety
|
|
1104
|
+
*/
|
|
1105
|
+
private buildGithubSpeedupScript;
|
|
1095
1106
|
}
|
|
1096
1107
|
|
|
1097
1108
|
/**
|
|
@@ -1162,6 +1173,16 @@ declare abstract class AbstractSandbox {
|
|
|
1162
1173
|
abstract writeFile(request: WriteFileRequest): Promise<WriteFileResponse>;
|
|
1163
1174
|
abstract upload(request: UploadRequest): Promise<UploadResponse>;
|
|
1164
1175
|
abstract closeSession(request: CloseSessionRequest): Promise<CloseSessionResponse>;
|
|
1176
|
+
abstract arun(cmd: string, options?: {
|
|
1177
|
+
session?: string;
|
|
1178
|
+
mode?: RunModeType;
|
|
1179
|
+
timeout?: number;
|
|
1180
|
+
waitTimeout?: number;
|
|
1181
|
+
waitInterval?: number;
|
|
1182
|
+
responseLimitedBytesInNohup?: number;
|
|
1183
|
+
ignoreOutput?: boolean;
|
|
1184
|
+
outputFile?: string;
|
|
1185
|
+
}): Promise<Observation>;
|
|
1165
1186
|
abstract close(): Promise<void>;
|
|
1166
1187
|
}
|
|
1167
1188
|
/**
|
|
@@ -1250,10 +1271,6 @@ declare function arunWithRetry(sandbox: Sandbox, cmd: string, session: string, m
|
|
|
1250
1271
|
maxAttempts?: number;
|
|
1251
1272
|
errorMsg?: string;
|
|
1252
1273
|
}): Promise<Observation>;
|
|
1253
|
-
/**
|
|
1254
|
-
* Extract nohup PID from output
|
|
1255
|
-
*/
|
|
1256
|
-
declare function extractNohupPid(output: string): number | null;
|
|
1257
1274
|
|
|
1258
1275
|
/**
|
|
1259
1276
|
* Model client for LLM interaction
|
|
@@ -1264,6 +1281,15 @@ declare function extractNohupPid(output: string): number | null;
|
|
|
1264
1281
|
interface ModelClientConfig {
|
|
1265
1282
|
logFileName?: string;
|
|
1266
1283
|
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Options for polling operations (popRequest, waitForFirstRequest)
|
|
1286
|
+
*/
|
|
1287
|
+
interface PollOptions {
|
|
1288
|
+
/** Maximum time to wait in seconds. Defaults to DEFAULT_POLL_TIMEOUT */
|
|
1289
|
+
timeout?: number;
|
|
1290
|
+
/** AbortSignal for cancellation support */
|
|
1291
|
+
signal?: AbortSignal;
|
|
1292
|
+
}
|
|
1267
1293
|
/**
|
|
1268
1294
|
* Model client for LLM interaction
|
|
1269
1295
|
*/
|
|
@@ -1280,71 +1306,1054 @@ declare class ModelClient {
|
|
|
1280
1306
|
pushResponse(index: number, lastResponse: string): Promise<void>;
|
|
1281
1307
|
/**
|
|
1282
1308
|
* Pop request from log file
|
|
1309
|
+
*
|
|
1310
|
+
* @param index - The index of the request to pop
|
|
1311
|
+
* @param options - Optional configuration for timeout and cancellation
|
|
1312
|
+
* @returns The request JSON string or SESSION_END_MARKER
|
|
1313
|
+
* @throws Error if timeout expires or operation is aborted
|
|
1283
1314
|
*/
|
|
1284
|
-
popRequest(index: number): Promise<string>;
|
|
1315
|
+
popRequest(index: number, options?: PollOptions): Promise<string>;
|
|
1285
1316
|
/**
|
|
1286
1317
|
* Wait for first request
|
|
1318
|
+
*
|
|
1319
|
+
* @param options - Optional configuration for timeout and cancellation
|
|
1320
|
+
* @throws Error if timeout expires or operation is aborted
|
|
1287
1321
|
*/
|
|
1288
|
-
waitForFirstRequest(): Promise<void>;
|
|
1322
|
+
waitForFirstRequest(options?: PollOptions): Promise<void>;
|
|
1289
1323
|
private parseRequestLine;
|
|
1290
1324
|
private parseResponseLine;
|
|
1291
1325
|
private readLastRequestLine;
|
|
1292
1326
|
private readLastResponseLine;
|
|
1293
1327
|
private appendResponse;
|
|
1294
1328
|
private constructResponse;
|
|
1295
|
-
private sleep;
|
|
1296
1329
|
}
|
|
1297
1330
|
|
|
1298
1331
|
/**
|
|
1299
|
-
*
|
|
1332
|
+
* Base configuration for runtime environments.
|
|
1333
|
+
*/
|
|
1334
|
+
declare const RuntimeEnvConfigSchema: z.ZodObject<{
|
|
1335
|
+
/** Runtime type discriminator. */
|
|
1336
|
+
type: z.ZodString;
|
|
1337
|
+
/** Runtime version. Use 'default' for the default version of each runtime. */
|
|
1338
|
+
version: z.ZodDefault<z.ZodString>;
|
|
1339
|
+
/** Environment variables for the runtime session. */
|
|
1340
|
+
env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1341
|
+
/** Timeout in seconds for installation commands. */
|
|
1342
|
+
installTimeout: z.ZodDefault<z.ZodNumber>;
|
|
1343
|
+
/** Custom install command to run after init. */
|
|
1344
|
+
customInstallCmd: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1345
|
+
/** Directory to create symlinks of executables. If null, no symlinks are created. */
|
|
1346
|
+
extraSymlinkDir: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1347
|
+
/** List of executable names to symlink. Empty list means no symlinks. */
|
|
1348
|
+
extraSymlinkExecutables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1349
|
+
}, "strip", z.ZodTypeAny, {
|
|
1350
|
+
type: string;
|
|
1351
|
+
env: Record<string, string>;
|
|
1352
|
+
version: string;
|
|
1353
|
+
installTimeout: number;
|
|
1354
|
+
customInstallCmd: string | null;
|
|
1355
|
+
extraSymlinkDir: string | null;
|
|
1356
|
+
extraSymlinkExecutables: string[];
|
|
1357
|
+
}, {
|
|
1358
|
+
type: string;
|
|
1359
|
+
env?: Record<string, string> | undefined;
|
|
1360
|
+
version?: string | undefined;
|
|
1361
|
+
installTimeout?: number | undefined;
|
|
1362
|
+
customInstallCmd?: string | null | undefined;
|
|
1363
|
+
extraSymlinkDir?: string | null | undefined;
|
|
1364
|
+
extraSymlinkExecutables?: string[] | undefined;
|
|
1365
|
+
}>;
|
|
1366
|
+
type RuntimeEnvConfig = z.infer<typeof RuntimeEnvConfigSchema>;
|
|
1367
|
+
|
|
1368
|
+
/** Unique identifier for a RuntimeEnv instance */
|
|
1369
|
+
type RuntimeEnvId = string;
|
|
1370
|
+
/** Create a new unique RuntimeEnvId */
|
|
1371
|
+
declare function createRuntimeEnvId(): RuntimeEnvId;
|
|
1372
|
+
/**
|
|
1373
|
+
* Interface for Sandbox with methods needed by RuntimeEnv
|
|
1374
|
+
*/
|
|
1375
|
+
interface SandboxLike {
|
|
1376
|
+
sandboxId: string;
|
|
1377
|
+
runtimeEnvs: Record<RuntimeEnvId, RuntimeEnv>;
|
|
1378
|
+
createSession(request: {
|
|
1379
|
+
session: string;
|
|
1380
|
+
envEnable: boolean;
|
|
1381
|
+
env?: Record<string, string>;
|
|
1382
|
+
}): Promise<unknown>;
|
|
1383
|
+
arun(cmd: string, options?: {
|
|
1384
|
+
session?: string;
|
|
1385
|
+
mode?: 'normal' | 'nohup' | 'NOHUP';
|
|
1386
|
+
waitTimeout?: number;
|
|
1387
|
+
waitInterval?: number;
|
|
1388
|
+
}): Promise<Observation>;
|
|
1389
|
+
startNohupProcess?(cmd: string, tmpFile: string, session: string): Promise<{
|
|
1390
|
+
pid: number | null;
|
|
1391
|
+
errorResponse: Observation | null;
|
|
1392
|
+
}>;
|
|
1393
|
+
waitForProcessCompletion?(pid: number, session: string, waitTimeout: number, waitInterval: number): Promise<{
|
|
1394
|
+
success: boolean;
|
|
1395
|
+
message: string;
|
|
1396
|
+
}>;
|
|
1397
|
+
handleNohupOutput?(tmpFile: string, session: string, success: boolean, message: string, ignoreOutput: boolean, responseLimitedBytes: number | null): Promise<Observation>;
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Runtime environment (e.g., Python/Node).
|
|
1401
|
+
*
|
|
1402
|
+
* Each RuntimeEnv is identified by (type, version) tuple and is managed by Sandbox.runtimeEnvs.
|
|
1403
|
+
* workdir is auto-generated as: /tmp/rock-runtime-envs/{type}/{version}/{runtimeEnvId}
|
|
1404
|
+
* session is auto-generated as: runtime-env-{type}-{version}-{runtimeEnvId}
|
|
1405
|
+
*
|
|
1406
|
+
* @example
|
|
1407
|
+
* ```typescript
|
|
1408
|
+
* const env = await RuntimeEnv.create(sandbox, config);
|
|
1409
|
+
* await env.run("python --version");
|
|
1410
|
+
* ```
|
|
1411
|
+
*/
|
|
1412
|
+
declare abstract class RuntimeEnv {
|
|
1413
|
+
/** Registry for subclasses */
|
|
1414
|
+
protected static registry: Record<string, typeof RuntimeEnv>;
|
|
1415
|
+
/** Runtime type discriminator - must be defined by subclass */
|
|
1416
|
+
abstract readonly runtimeEnvType: string;
|
|
1417
|
+
/** Sandbox instance */
|
|
1418
|
+
protected _sandbox: SandboxLike;
|
|
1419
|
+
/** Configuration */
|
|
1420
|
+
protected _config: RuntimeEnvConfig;
|
|
1421
|
+
/** Version */
|
|
1422
|
+
protected _version: string;
|
|
1423
|
+
/** Environment variables */
|
|
1424
|
+
protected _env: Record<string, string>;
|
|
1425
|
+
/** Install timeout in seconds */
|
|
1426
|
+
protected _installTimeout: number;
|
|
1427
|
+
/** Custom install command */
|
|
1428
|
+
protected _customInstallCmd: string | null;
|
|
1429
|
+
/** Extra symlink directory */
|
|
1430
|
+
protected _extraSymlinkDir: string | null;
|
|
1431
|
+
/** Extra symlink executables */
|
|
1432
|
+
protected _extraSymlinkExecutables: string[];
|
|
1433
|
+
/** Unique ID for this runtime env instance */
|
|
1434
|
+
protected _runtimeEnvId: RuntimeEnvId;
|
|
1435
|
+
/** Working directory */
|
|
1436
|
+
protected _workdir: string;
|
|
1437
|
+
/** Session name */
|
|
1438
|
+
protected _session: string;
|
|
1439
|
+
/** Whether the runtime has been initialized */
|
|
1440
|
+
protected _initialized: boolean;
|
|
1441
|
+
/** Whether the session is ready */
|
|
1442
|
+
protected _sessionReady: boolean;
|
|
1443
|
+
constructor(sandbox: SandboxLike, config: RuntimeEnvConfig);
|
|
1444
|
+
/** Whether the runtime has been initialized */
|
|
1445
|
+
get initialized(): boolean;
|
|
1446
|
+
/** Unique ID for this runtime env instance */
|
|
1447
|
+
get runtimeEnvId(): RuntimeEnvId;
|
|
1448
|
+
/** Working directory for this runtime env instance */
|
|
1449
|
+
get workdir(): string;
|
|
1450
|
+
/** Binary directory for this runtime env instance */
|
|
1451
|
+
get binDir(): string;
|
|
1452
|
+
/**
|
|
1453
|
+
* Initialize the runtime environment.
|
|
1454
|
+
* This method performs installation and validation.
|
|
1455
|
+
* It is idempotent: calling multiple times only initializes once.
|
|
1456
|
+
*/
|
|
1457
|
+
init(): Promise<void>;
|
|
1458
|
+
/**
|
|
1459
|
+
* Run a command under this runtime
|
|
1460
|
+
*/
|
|
1461
|
+
run(cmd: string, options?: {
|
|
1462
|
+
mode?: 'normal' | 'nohup';
|
|
1463
|
+
waitTimeout?: number;
|
|
1464
|
+
errorMsg?: string;
|
|
1465
|
+
}): Promise<Observation>;
|
|
1466
|
+
/**
|
|
1467
|
+
* Wrap command with PATH export.
|
|
1468
|
+
* Always wrap with bash -c to ensure it only affects current cmd.
|
|
1469
|
+
* Default prepend=true to give current runtime_env highest priority.
|
|
1470
|
+
*/
|
|
1471
|
+
wrappedCmd(cmd: string, prepend?: boolean): string;
|
|
1472
|
+
/**
|
|
1473
|
+
* Ensure runtime env session exists. Safe to call multiple times.
|
|
1474
|
+
*/
|
|
1475
|
+
protected _ensureSession(): Promise<void>;
|
|
1476
|
+
/**
|
|
1477
|
+
* Create workdir for runtime environment.
|
|
1478
|
+
*/
|
|
1479
|
+
protected _ensureWorkdir(): Promise<void>;
|
|
1480
|
+
/**
|
|
1481
|
+
* Get installation command for this runtime environment.
|
|
1482
|
+
*/
|
|
1483
|
+
protected abstract _getInstallCmd(): string;
|
|
1484
|
+
/**
|
|
1485
|
+
* Install the runtime environment.
|
|
1486
|
+
*/
|
|
1487
|
+
protected _installRuntime(): Promise<void>;
|
|
1488
|
+
/**
|
|
1489
|
+
* Additional initialization after runtime installation.
|
|
1490
|
+
* Override in subclasses.
|
|
1491
|
+
*/
|
|
1492
|
+
protected _postInit(): Promise<void>;
|
|
1493
|
+
/**
|
|
1494
|
+
* Execute custom install command after _postInit.
|
|
1495
|
+
*/
|
|
1496
|
+
protected _doCustomInstall(): Promise<void>;
|
|
1497
|
+
/**
|
|
1498
|
+
* Create symlinks in target directory for executables.
|
|
1499
|
+
*/
|
|
1500
|
+
protected _createSysPathLinks(): Promise<void>;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
/**
|
|
1504
|
+
* Python runtime environment configuration and implementation
|
|
1300
1505
|
*/
|
|
1301
1506
|
|
|
1302
1507
|
/**
|
|
1303
|
-
*
|
|
1508
|
+
* Python runtime environment configuration schema
|
|
1509
|
+
*/
|
|
1510
|
+
declare const PythonRuntimeEnvConfigSchema: z.ZodObject<{
|
|
1511
|
+
env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1512
|
+
installTimeout: z.ZodDefault<z.ZodNumber>;
|
|
1513
|
+
customInstallCmd: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1514
|
+
extraSymlinkDir: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1515
|
+
} & {
|
|
1516
|
+
type: z.ZodDefault<z.ZodLiteral<"python">>;
|
|
1517
|
+
version: z.ZodDefault<z.ZodEnum<["3.11", "3.12", "default"]>>;
|
|
1518
|
+
pip: z.ZodDefault<z.ZodNullable<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString]>>>;
|
|
1519
|
+
pipIndexUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1520
|
+
extraSymlinkExecutables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1521
|
+
}, "strip", z.ZodTypeAny, {
|
|
1522
|
+
type: "python";
|
|
1523
|
+
env: Record<string, string>;
|
|
1524
|
+
pip: string | string[] | null;
|
|
1525
|
+
version: "default" | "3.11" | "3.12";
|
|
1526
|
+
installTimeout: number;
|
|
1527
|
+
customInstallCmd: string | null;
|
|
1528
|
+
extraSymlinkDir: string | null;
|
|
1529
|
+
extraSymlinkExecutables: string[];
|
|
1530
|
+
pipIndexUrl: string | null;
|
|
1531
|
+
}, {
|
|
1532
|
+
type?: "python" | undefined;
|
|
1533
|
+
env?: Record<string, string> | undefined;
|
|
1534
|
+
pip?: string | string[] | null | undefined;
|
|
1535
|
+
version?: "default" | "3.11" | "3.12" | undefined;
|
|
1536
|
+
installTimeout?: number | undefined;
|
|
1537
|
+
customInstallCmd?: string | null | undefined;
|
|
1538
|
+
extraSymlinkDir?: string | null | undefined;
|
|
1539
|
+
extraSymlinkExecutables?: string[] | undefined;
|
|
1540
|
+
pipIndexUrl?: string | null | undefined;
|
|
1541
|
+
}>;
|
|
1542
|
+
/**
|
|
1543
|
+
* Python runtime environment configuration type
|
|
1544
|
+
*/
|
|
1545
|
+
type PythonRuntimeEnvConfig = z.infer<typeof PythonRuntimeEnvConfigSchema>;
|
|
1546
|
+
/**
|
|
1547
|
+
* Get default pip index URL from environment variable.
|
|
1304
1548
|
*/
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1549
|
+
declare function getDefaultPipIndexUrl(): string;
|
|
1550
|
+
/**
|
|
1551
|
+
* Python runtime environment
|
|
1552
|
+
*
|
|
1553
|
+
* Provides Python runtime with pip package management.
|
|
1554
|
+
* Supports Python 3.11 and 3.12 versions.
|
|
1555
|
+
*
|
|
1556
|
+
* @example
|
|
1557
|
+
* ```typescript
|
|
1558
|
+
* const config: PythonRuntimeEnvConfig = {
|
|
1559
|
+
* version: 'default',
|
|
1560
|
+
* pip: ['langchain', 'langchain-openai'],
|
|
1561
|
+
* pipIndexUrl: 'https://mirrors.aliyun.com/pypi/simple/',
|
|
1562
|
+
* };
|
|
1563
|
+
* const env = new PythonRuntimeEnv(sandbox, config);
|
|
1564
|
+
* await env.init();
|
|
1565
|
+
* await env.run('python --version');
|
|
1566
|
+
* ```
|
|
1567
|
+
*/
|
|
1568
|
+
declare class PythonRuntimeEnv extends RuntimeEnv {
|
|
1569
|
+
readonly runtimeEnvType = "python";
|
|
1570
|
+
private _pip;
|
|
1571
|
+
private _pipIndexUrl;
|
|
1572
|
+
constructor(sandbox: SandboxLike & {
|
|
1573
|
+
runtimeEnvs: Record<RuntimeEnvId, RuntimeEnv>;
|
|
1574
|
+
}, config: PythonRuntimeEnvConfig);
|
|
1575
|
+
protected _getInstallCmd(): string;
|
|
1576
|
+
protected _postInit(): Promise<void>;
|
|
1577
|
+
private _validatePython;
|
|
1578
|
+
private _configurePip;
|
|
1579
|
+
private _installPip;
|
|
1313
1580
|
}
|
|
1581
|
+
|
|
1582
|
+
/**
|
|
1583
|
+
* Node.js runtime environment configuration and implementation
|
|
1584
|
+
*/
|
|
1585
|
+
|
|
1586
|
+
/** Default Node.js version */
|
|
1587
|
+
declare const NODE_DEFAULT_VERSION = "22.18.0";
|
|
1314
1588
|
/**
|
|
1315
|
-
*
|
|
1589
|
+
* Configuration for Node.js runtime environment.
|
|
1590
|
+
*/
|
|
1591
|
+
declare const NodeRuntimeEnvConfigSchema: z.ZodObject<{
|
|
1592
|
+
env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1593
|
+
installTimeout: z.ZodDefault<z.ZodNumber>;
|
|
1594
|
+
customInstallCmd: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1595
|
+
extraSymlinkDir: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1596
|
+
} & {
|
|
1597
|
+
type: z.ZodDefault<z.ZodLiteral<"node">>;
|
|
1598
|
+
version: z.ZodDefault<z.ZodEnum<["22.18.0", "default"]>>;
|
|
1599
|
+
npmRegistry: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1600
|
+
extraSymlinkExecutables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1601
|
+
}, "strip", z.ZodTypeAny, {
|
|
1602
|
+
type: "node";
|
|
1603
|
+
env: Record<string, string>;
|
|
1604
|
+
version: "default" | "22.18.0";
|
|
1605
|
+
installTimeout: number;
|
|
1606
|
+
customInstallCmd: string | null;
|
|
1607
|
+
extraSymlinkDir: string | null;
|
|
1608
|
+
extraSymlinkExecutables: string[];
|
|
1609
|
+
npmRegistry: string | null;
|
|
1610
|
+
}, {
|
|
1611
|
+
type?: "node" | undefined;
|
|
1612
|
+
env?: Record<string, string> | undefined;
|
|
1613
|
+
version?: "default" | "22.18.0" | undefined;
|
|
1614
|
+
installTimeout?: number | undefined;
|
|
1615
|
+
customInstallCmd?: string | null | undefined;
|
|
1616
|
+
extraSymlinkDir?: string | null | undefined;
|
|
1617
|
+
extraSymlinkExecutables?: string[] | undefined;
|
|
1618
|
+
npmRegistry?: string | null | undefined;
|
|
1619
|
+
}>;
|
|
1620
|
+
/**
|
|
1621
|
+
* Node runtime environment configuration type
|
|
1622
|
+
*/
|
|
1623
|
+
type NodeRuntimeEnvConfig = z.infer<typeof NodeRuntimeEnvConfigSchema>;
|
|
1624
|
+
/**
|
|
1625
|
+
* Node runtime environment
|
|
1626
|
+
*
|
|
1627
|
+
* Provides Node.js runtime with npm package management.
|
|
1628
|
+
* Supports Node.js 22.18.0.
|
|
1629
|
+
*
|
|
1630
|
+
* @example
|
|
1631
|
+
* ```typescript
|
|
1632
|
+
* const config: NodeRuntimeEnvConfig = {
|
|
1633
|
+
* version: 'default',
|
|
1634
|
+
* npmRegistry: 'https://registry.npmmirror.com',
|
|
1635
|
+
* };
|
|
1636
|
+
* const env = new NodeRuntimeEnv(sandbox, config);
|
|
1637
|
+
* await env.init();
|
|
1638
|
+
* await env.run('node --version');
|
|
1639
|
+
* ```
|
|
1640
|
+
*/
|
|
1641
|
+
declare class NodeRuntimeEnv extends RuntimeEnv {
|
|
1642
|
+
readonly runtimeEnvType = "node";
|
|
1643
|
+
private _npmRegistry;
|
|
1644
|
+
constructor(sandbox: SandboxLike & {
|
|
1645
|
+
runtimeEnvs: Record<RuntimeEnvId, RuntimeEnv>;
|
|
1646
|
+
}, config: NodeRuntimeEnvConfig);
|
|
1647
|
+
protected _getInstallCmd(): string;
|
|
1648
|
+
protected _postInit(): Promise<void>;
|
|
1649
|
+
private _validateNode;
|
|
1650
|
+
private _configureNpmRegistry;
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
/**
|
|
1654
|
+
* ModelService - manages model service installation and lifecycle in sandbox
|
|
1655
|
+
*
|
|
1656
|
+
* This module provides functionality to install, start, stop, and manage
|
|
1657
|
+
* the model service within a sandboxed environment.
|
|
1658
|
+
*/
|
|
1659
|
+
|
|
1660
|
+
/**
|
|
1661
|
+
* ModelService configuration schema
|
|
1662
|
+
*/
|
|
1663
|
+
declare const ModelServiceConfigSchema: z.ZodObject<{
|
|
1664
|
+
/** Whether to enable model service */
|
|
1665
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1666
|
+
/** Type of model service to start */
|
|
1667
|
+
type: z.ZodDefault<z.ZodString>;
|
|
1668
|
+
/** Command to install model service package */
|
|
1669
|
+
installCmd: z.ZodDefault<z.ZodString>;
|
|
1670
|
+
/** Timeout for model service installation in seconds */
|
|
1671
|
+
installTimeout: z.ZodDefault<z.ZodNumber>;
|
|
1672
|
+
/** Runtime environment configuration for the model service */
|
|
1673
|
+
runtimeEnvConfig: z.ZodDefault<z.ZodObject<{
|
|
1674
|
+
env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1675
|
+
installTimeout: z.ZodDefault<z.ZodNumber>;
|
|
1676
|
+
customInstallCmd: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1677
|
+
extraSymlinkDir: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1678
|
+
} & {
|
|
1679
|
+
type: z.ZodDefault<z.ZodLiteral<"python">>;
|
|
1680
|
+
version: z.ZodDefault<z.ZodEnum<["3.11", "3.12", "default"]>>;
|
|
1681
|
+
pip: z.ZodDefault<z.ZodNullable<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString]>>>;
|
|
1682
|
+
pipIndexUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1683
|
+
extraSymlinkExecutables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1684
|
+
}, "strip", z.ZodTypeAny, {
|
|
1685
|
+
type: "python";
|
|
1686
|
+
env: Record<string, string>;
|
|
1687
|
+
pip: string | string[] | null;
|
|
1688
|
+
version: "default" | "3.11" | "3.12";
|
|
1689
|
+
installTimeout: number;
|
|
1690
|
+
customInstallCmd: string | null;
|
|
1691
|
+
extraSymlinkDir: string | null;
|
|
1692
|
+
extraSymlinkExecutables: string[];
|
|
1693
|
+
pipIndexUrl: string | null;
|
|
1694
|
+
}, {
|
|
1695
|
+
type?: "python" | undefined;
|
|
1696
|
+
env?: Record<string, string> | undefined;
|
|
1697
|
+
pip?: string | string[] | null | undefined;
|
|
1698
|
+
version?: "default" | "3.11" | "3.12" | undefined;
|
|
1699
|
+
installTimeout?: number | undefined;
|
|
1700
|
+
customInstallCmd?: string | null | undefined;
|
|
1701
|
+
extraSymlinkDir?: string | null | undefined;
|
|
1702
|
+
extraSymlinkExecutables?: string[] | undefined;
|
|
1703
|
+
pipIndexUrl?: string | null | undefined;
|
|
1704
|
+
}>>;
|
|
1705
|
+
/** Command to start model service with type placeholder */
|
|
1706
|
+
startCmd: z.ZodDefault<z.ZodString>;
|
|
1707
|
+
/** Command to stop model service */
|
|
1708
|
+
stopCmd: z.ZodDefault<z.ZodString>;
|
|
1709
|
+
/** Command to create Rock config file */
|
|
1710
|
+
configIniCmd: z.ZodDefault<z.ZodString>;
|
|
1711
|
+
/** Command to watch agent with pid placeholder */
|
|
1712
|
+
watchAgentCmd: z.ZodDefault<z.ZodString>;
|
|
1713
|
+
/** Command to anti-call LLM with index and response_payload placeholders */
|
|
1714
|
+
antiCallLlmCmd: z.ZodDefault<z.ZodString>;
|
|
1715
|
+
/** Command to anti-call LLM with only index placeholder */
|
|
1716
|
+
antiCallLlmCmdNoResponse: z.ZodDefault<z.ZodString>;
|
|
1717
|
+
/** Path for logging directory */
|
|
1718
|
+
loggingPath: z.ZodDefault<z.ZodString>;
|
|
1719
|
+
/** Name of the log file */
|
|
1720
|
+
loggingFileName: z.ZodDefault<z.ZodString>;
|
|
1721
|
+
}, "strip", z.ZodTypeAny, {
|
|
1722
|
+
type: string;
|
|
1723
|
+
installTimeout: number;
|
|
1724
|
+
enabled: boolean;
|
|
1725
|
+
installCmd: string;
|
|
1726
|
+
runtimeEnvConfig: {
|
|
1727
|
+
type: "python";
|
|
1728
|
+
env: Record<string, string>;
|
|
1729
|
+
pip: string | string[] | null;
|
|
1730
|
+
version: "default" | "3.11" | "3.12";
|
|
1731
|
+
installTimeout: number;
|
|
1732
|
+
customInstallCmd: string | null;
|
|
1733
|
+
extraSymlinkDir: string | null;
|
|
1734
|
+
extraSymlinkExecutables: string[];
|
|
1735
|
+
pipIndexUrl: string | null;
|
|
1736
|
+
};
|
|
1737
|
+
startCmd: string;
|
|
1738
|
+
stopCmd: string;
|
|
1739
|
+
configIniCmd: string;
|
|
1740
|
+
watchAgentCmd: string;
|
|
1741
|
+
antiCallLlmCmd: string;
|
|
1742
|
+
antiCallLlmCmdNoResponse: string;
|
|
1743
|
+
loggingPath: string;
|
|
1744
|
+
loggingFileName: string;
|
|
1745
|
+
}, {
|
|
1746
|
+
type?: string | undefined;
|
|
1747
|
+
installTimeout?: number | undefined;
|
|
1748
|
+
enabled?: boolean | undefined;
|
|
1749
|
+
installCmd?: string | undefined;
|
|
1750
|
+
runtimeEnvConfig?: {
|
|
1751
|
+
type?: "python" | undefined;
|
|
1752
|
+
env?: Record<string, string> | undefined;
|
|
1753
|
+
pip?: string | string[] | null | undefined;
|
|
1754
|
+
version?: "default" | "3.11" | "3.12" | undefined;
|
|
1755
|
+
installTimeout?: number | undefined;
|
|
1756
|
+
customInstallCmd?: string | null | undefined;
|
|
1757
|
+
extraSymlinkDir?: string | null | undefined;
|
|
1758
|
+
extraSymlinkExecutables?: string[] | undefined;
|
|
1759
|
+
pipIndexUrl?: string | null | undefined;
|
|
1760
|
+
} | undefined;
|
|
1761
|
+
startCmd?: string | undefined;
|
|
1762
|
+
stopCmd?: string | undefined;
|
|
1763
|
+
configIniCmd?: string | undefined;
|
|
1764
|
+
watchAgentCmd?: string | undefined;
|
|
1765
|
+
antiCallLlmCmd?: string | undefined;
|
|
1766
|
+
antiCallLlmCmdNoResponse?: string | undefined;
|
|
1767
|
+
loggingPath?: string | undefined;
|
|
1768
|
+
loggingFileName?: string | undefined;
|
|
1769
|
+
}>;
|
|
1770
|
+
/**
|
|
1771
|
+
* ModelService configuration type
|
|
1772
|
+
*/
|
|
1773
|
+
type ModelServiceConfig = z.infer<typeof ModelServiceConfigSchema>;
|
|
1774
|
+
/**
|
|
1775
|
+
* ModelService - manages model service installation and lifecycle in sandbox
|
|
1776
|
+
*
|
|
1777
|
+
* This class handles model service installation, startup, and agent management
|
|
1778
|
+
* within a sandboxed environment.
|
|
1779
|
+
*
|
|
1780
|
+
* Note:
|
|
1781
|
+
* Caller is responsible for ensuring proper sequencing of install/start/stop operations.
|
|
1316
1782
|
*/
|
|
1317
1783
|
declare class ModelService {
|
|
1318
|
-
private
|
|
1784
|
+
private _sandbox;
|
|
1785
|
+
private _config;
|
|
1786
|
+
private _runtimeEnv;
|
|
1787
|
+
private _isInstalled;
|
|
1788
|
+
private _isStarted;
|
|
1789
|
+
constructor(sandbox: SandboxLike & {
|
|
1790
|
+
runtimeEnvs: Record<RuntimeEnvId, RuntimeEnvLike>;
|
|
1791
|
+
}, config: ModelServiceConfig);
|
|
1792
|
+
/** Whether the model service has been installed */
|
|
1793
|
+
get isInstalled(): boolean;
|
|
1794
|
+
/** Whether the model service has been started */
|
|
1795
|
+
get isStarted(): boolean;
|
|
1319
1796
|
/**
|
|
1320
|
-
*
|
|
1797
|
+
* Install model service in the sandbox.
|
|
1798
|
+
*
|
|
1799
|
+
* Performs the following installation steps:
|
|
1800
|
+
* 1. Create and initialize Python runtime environment (via RuntimeEnv).
|
|
1801
|
+
* 2. Install model service package.
|
|
1321
1802
|
*/
|
|
1322
|
-
|
|
1803
|
+
install(): Promise<void>;
|
|
1804
|
+
private _createRockConfig;
|
|
1805
|
+
private _installModelService;
|
|
1323
1806
|
/**
|
|
1324
|
-
* Start
|
|
1807
|
+
* Start the model service in the sandbox.
|
|
1808
|
+
*
|
|
1809
|
+
* Starts the service with configured logging settings.
|
|
1325
1810
|
*/
|
|
1326
|
-
start(
|
|
1327
|
-
timeoutSeconds?: number;
|
|
1328
|
-
}): Promise<string>;
|
|
1811
|
+
start(): Promise<void>;
|
|
1329
1812
|
/**
|
|
1330
|
-
*
|
|
1813
|
+
* Stop the model service.
|
|
1331
1814
|
*/
|
|
1332
|
-
|
|
1815
|
+
stop(): Promise<void>;
|
|
1333
1816
|
/**
|
|
1334
|
-
*
|
|
1817
|
+
* Watch agent process with the specified PID.
|
|
1335
1818
|
*/
|
|
1336
|
-
|
|
1819
|
+
watchAgent(pid: string): Promise<void>;
|
|
1337
1820
|
/**
|
|
1338
|
-
*
|
|
1821
|
+
* Execute anti-call LLM command.
|
|
1339
1822
|
*/
|
|
1340
|
-
|
|
1341
|
-
|
|
1823
|
+
antiCallLlm(index: number, responsePayload?: string, callTimeout?: number): Promise<string>;
|
|
1824
|
+
}
|
|
1825
|
+
/**
|
|
1826
|
+
* Minimal RuntimeEnv interface for type checking
|
|
1827
|
+
*/
|
|
1828
|
+
interface RuntimeEnvLike {
|
|
1829
|
+
init(): Promise<void>;
|
|
1830
|
+
run(cmd: string, mode?: string, waitTimeout?: number, errorMsg?: string): Promise<{
|
|
1831
|
+
output: string;
|
|
1832
|
+
exitCode?: number;
|
|
1833
|
+
}>;
|
|
1834
|
+
workdir: string;
|
|
1835
|
+
wrappedCmd(cmd: string): string;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* Agent configuration schemas
|
|
1840
|
+
*/
|
|
1841
|
+
|
|
1842
|
+
/**
|
|
1843
|
+
* Base agent configuration schema
|
|
1844
|
+
*/
|
|
1845
|
+
declare const AgentConfigSchema: z.ZodObject<{
|
|
1846
|
+
agentType: z.ZodString;
|
|
1847
|
+
version: z.ZodDefault<z.ZodString>;
|
|
1848
|
+
}, "strip", z.ZodTypeAny, {
|
|
1849
|
+
version: string;
|
|
1850
|
+
agentType: string;
|
|
1851
|
+
}, {
|
|
1852
|
+
agentType: string;
|
|
1853
|
+
version?: string | undefined;
|
|
1854
|
+
}>;
|
|
1855
|
+
type AgentConfig = z.infer<typeof AgentConfigSchema>;
|
|
1856
|
+
/**
|
|
1857
|
+
* Configuration for a command execution with timeout control
|
|
1858
|
+
*/
|
|
1859
|
+
declare const AgentBashCommandSchema: z.ZodObject<{
|
|
1860
|
+
command: z.ZodString;
|
|
1861
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
1862
|
+
}, "strip", z.ZodTypeAny, {
|
|
1863
|
+
command: string;
|
|
1864
|
+
timeoutSeconds: number;
|
|
1865
|
+
}, {
|
|
1866
|
+
command: string;
|
|
1867
|
+
timeoutSeconds?: number | undefined;
|
|
1868
|
+
}>;
|
|
1869
|
+
type AgentBashCommand = z.infer<typeof AgentBashCommandSchema>;
|
|
1870
|
+
/**
|
|
1871
|
+
* Default agent configuration schema
|
|
1872
|
+
*/
|
|
1873
|
+
declare const DefaultAgentConfigSchema: z.ZodObject<{
|
|
1874
|
+
agentType: z.ZodString;
|
|
1875
|
+
version: z.ZodDefault<z.ZodString>;
|
|
1876
|
+
agentSession: z.ZodDefault<z.ZodString>;
|
|
1877
|
+
preInitBashCmdList: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1878
|
+
command: z.ZodString;
|
|
1879
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
1880
|
+
}, "strip", z.ZodTypeAny, {
|
|
1881
|
+
command: string;
|
|
1882
|
+
timeoutSeconds: number;
|
|
1883
|
+
}, {
|
|
1884
|
+
command: string;
|
|
1885
|
+
timeoutSeconds?: number | undefined;
|
|
1886
|
+
}>, "many">>;
|
|
1887
|
+
postInitBashCmdList: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1888
|
+
command: z.ZodString;
|
|
1889
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
1890
|
+
}, "strip", z.ZodTypeAny, {
|
|
1891
|
+
command: string;
|
|
1892
|
+
timeoutSeconds: number;
|
|
1893
|
+
}, {
|
|
1894
|
+
command: string;
|
|
1895
|
+
timeoutSeconds?: number | undefined;
|
|
1896
|
+
}>, "many">>;
|
|
1897
|
+
sessionEnvs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1898
|
+
modelServiceConfig: z.ZodDefault<z.ZodNullable<z.ZodType<{
|
|
1899
|
+
type: string;
|
|
1900
|
+
installTimeout: number;
|
|
1901
|
+
enabled: boolean;
|
|
1902
|
+
installCmd: string;
|
|
1903
|
+
runtimeEnvConfig: {
|
|
1904
|
+
type: "python";
|
|
1905
|
+
env: Record<string, string>;
|
|
1906
|
+
pip: string | string[] | null;
|
|
1907
|
+
version: "default" | "3.11" | "3.12";
|
|
1908
|
+
installTimeout: number;
|
|
1909
|
+
customInstallCmd: string | null;
|
|
1910
|
+
extraSymlinkDir: string | null;
|
|
1911
|
+
extraSymlinkExecutables: string[];
|
|
1912
|
+
pipIndexUrl: string | null;
|
|
1913
|
+
};
|
|
1914
|
+
startCmd: string;
|
|
1915
|
+
stopCmd: string;
|
|
1916
|
+
configIniCmd: string;
|
|
1917
|
+
watchAgentCmd: string;
|
|
1918
|
+
antiCallLlmCmd: string;
|
|
1919
|
+
antiCallLlmCmdNoResponse: string;
|
|
1920
|
+
loggingPath: string;
|
|
1921
|
+
loggingFileName: string;
|
|
1922
|
+
}, z.ZodTypeDef, {
|
|
1923
|
+
type: string;
|
|
1924
|
+
installTimeout: number;
|
|
1925
|
+
enabled: boolean;
|
|
1926
|
+
installCmd: string;
|
|
1927
|
+
runtimeEnvConfig: {
|
|
1928
|
+
type: "python";
|
|
1929
|
+
env: Record<string, string>;
|
|
1930
|
+
pip: string | string[] | null;
|
|
1931
|
+
version: "default" | "3.11" | "3.12";
|
|
1932
|
+
installTimeout: number;
|
|
1933
|
+
customInstallCmd: string | null;
|
|
1934
|
+
extraSymlinkDir: string | null;
|
|
1935
|
+
extraSymlinkExecutables: string[];
|
|
1936
|
+
pipIndexUrl: string | null;
|
|
1937
|
+
};
|
|
1938
|
+
startCmd: string;
|
|
1939
|
+
stopCmd: string;
|
|
1940
|
+
configIniCmd: string;
|
|
1941
|
+
watchAgentCmd: string;
|
|
1942
|
+
antiCallLlmCmd: string;
|
|
1943
|
+
antiCallLlmCmdNoResponse: string;
|
|
1944
|
+
loggingPath: string;
|
|
1945
|
+
loggingFileName: string;
|
|
1946
|
+
}>>>;
|
|
1947
|
+
}, "strip", z.ZodTypeAny, {
|
|
1948
|
+
version: string;
|
|
1949
|
+
agentType: string;
|
|
1950
|
+
agentSession: string;
|
|
1951
|
+
preInitBashCmdList: {
|
|
1952
|
+
command: string;
|
|
1953
|
+
timeoutSeconds: number;
|
|
1954
|
+
}[];
|
|
1955
|
+
postInitBashCmdList: {
|
|
1956
|
+
command: string;
|
|
1957
|
+
timeoutSeconds: number;
|
|
1958
|
+
}[];
|
|
1959
|
+
sessionEnvs: Record<string, string>;
|
|
1960
|
+
modelServiceConfig: {
|
|
1961
|
+
type: string;
|
|
1962
|
+
installTimeout: number;
|
|
1963
|
+
enabled: boolean;
|
|
1964
|
+
installCmd: string;
|
|
1965
|
+
runtimeEnvConfig: {
|
|
1966
|
+
type: "python";
|
|
1967
|
+
env: Record<string, string>;
|
|
1968
|
+
pip: string | string[] | null;
|
|
1969
|
+
version: "default" | "3.11" | "3.12";
|
|
1970
|
+
installTimeout: number;
|
|
1971
|
+
customInstallCmd: string | null;
|
|
1972
|
+
extraSymlinkDir: string | null;
|
|
1973
|
+
extraSymlinkExecutables: string[];
|
|
1974
|
+
pipIndexUrl: string | null;
|
|
1975
|
+
};
|
|
1976
|
+
startCmd: string;
|
|
1977
|
+
stopCmd: string;
|
|
1978
|
+
configIniCmd: string;
|
|
1979
|
+
watchAgentCmd: string;
|
|
1980
|
+
antiCallLlmCmd: string;
|
|
1981
|
+
antiCallLlmCmdNoResponse: string;
|
|
1982
|
+
loggingPath: string;
|
|
1983
|
+
loggingFileName: string;
|
|
1984
|
+
} | null;
|
|
1985
|
+
}, {
|
|
1986
|
+
agentType: string;
|
|
1987
|
+
version?: string | undefined;
|
|
1988
|
+
agentSession?: string | undefined;
|
|
1989
|
+
preInitBashCmdList?: {
|
|
1990
|
+
command: string;
|
|
1991
|
+
timeoutSeconds?: number | undefined;
|
|
1992
|
+
}[] | undefined;
|
|
1993
|
+
postInitBashCmdList?: {
|
|
1994
|
+
command: string;
|
|
1995
|
+
timeoutSeconds?: number | undefined;
|
|
1996
|
+
}[] | undefined;
|
|
1997
|
+
sessionEnvs?: Record<string, string> | undefined;
|
|
1998
|
+
modelServiceConfig?: {
|
|
1999
|
+
type: string;
|
|
2000
|
+
installTimeout: number;
|
|
2001
|
+
enabled: boolean;
|
|
2002
|
+
installCmd: string;
|
|
2003
|
+
runtimeEnvConfig: {
|
|
2004
|
+
type: "python";
|
|
2005
|
+
env: Record<string, string>;
|
|
2006
|
+
pip: string | string[] | null;
|
|
2007
|
+
version: "default" | "3.11" | "3.12";
|
|
2008
|
+
installTimeout: number;
|
|
2009
|
+
customInstallCmd: string | null;
|
|
2010
|
+
extraSymlinkDir: string | null;
|
|
2011
|
+
extraSymlinkExecutables: string[];
|
|
2012
|
+
pipIndexUrl: string | null;
|
|
2013
|
+
};
|
|
2014
|
+
startCmd: string;
|
|
2015
|
+
stopCmd: string;
|
|
2016
|
+
configIniCmd: string;
|
|
2017
|
+
watchAgentCmd: string;
|
|
2018
|
+
antiCallLlmCmd: string;
|
|
2019
|
+
antiCallLlmCmdNoResponse: string;
|
|
2020
|
+
loggingPath: string;
|
|
2021
|
+
loggingFileName: string;
|
|
2022
|
+
} | null | undefined;
|
|
2023
|
+
}>;
|
|
2024
|
+
type DefaultAgentConfig = z.infer<typeof DefaultAgentConfigSchema>;
|
|
2025
|
+
/**
|
|
2026
|
+
* RockAgent configuration schema with validation
|
|
2027
|
+
*/
|
|
2028
|
+
declare const RockAgentConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
2029
|
+
agentType: z.ZodDefault<z.ZodString>;
|
|
2030
|
+
agentName: z.ZodDefault<z.ZodString>;
|
|
2031
|
+
version: z.ZodDefault<z.ZodString>;
|
|
2032
|
+
agentInstalledDir: z.ZodDefault<z.ZodString>;
|
|
2033
|
+
instanceId: z.ZodDefault<z.ZodString>;
|
|
2034
|
+
projectPath: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
2035
|
+
useDeployWorkingDirAsFallback: z.ZodDefault<z.ZodBoolean>;
|
|
2036
|
+
agentSession: z.ZodDefault<z.ZodString>;
|
|
2037
|
+
env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2038
|
+
preInitCmds: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2039
|
+
command: z.ZodString;
|
|
2040
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
2041
|
+
}, "strip", z.ZodTypeAny, {
|
|
2042
|
+
command: string;
|
|
2043
|
+
timeoutSeconds: number;
|
|
2044
|
+
}, {
|
|
2045
|
+
command: string;
|
|
2046
|
+
timeoutSeconds?: number | undefined;
|
|
2047
|
+
}>, "many">>;
|
|
2048
|
+
postInitCmds: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2049
|
+
command: z.ZodString;
|
|
2050
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
2051
|
+
}, "strip", z.ZodTypeAny, {
|
|
2052
|
+
command: string;
|
|
2053
|
+
timeoutSeconds: number;
|
|
2054
|
+
}, {
|
|
2055
|
+
command: string;
|
|
2056
|
+
timeoutSeconds?: number | undefined;
|
|
2057
|
+
}>, "many">>;
|
|
2058
|
+
agentInstallTimeout: z.ZodDefault<z.ZodNumber>;
|
|
2059
|
+
agentRunTimeout: z.ZodDefault<z.ZodNumber>;
|
|
2060
|
+
agentRunCheckInterval: z.ZodDefault<z.ZodNumber>;
|
|
2061
|
+
workingDir: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
2062
|
+
runCmd: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
2063
|
+
skipWrapRunCmd: z.ZodDefault<z.ZodBoolean>;
|
|
2064
|
+
runtimeEnvConfig: z.ZodDefault<z.ZodNullable<z.ZodAny>>;
|
|
2065
|
+
modelServiceConfig: z.ZodDefault<z.ZodNullable<z.ZodType<{
|
|
2066
|
+
type: string;
|
|
2067
|
+
installTimeout: number;
|
|
2068
|
+
enabled: boolean;
|
|
2069
|
+
installCmd: string;
|
|
2070
|
+
runtimeEnvConfig: {
|
|
2071
|
+
type: "python";
|
|
2072
|
+
env: Record<string, string>;
|
|
2073
|
+
pip: string | string[] | null;
|
|
2074
|
+
version: "default" | "3.11" | "3.12";
|
|
2075
|
+
installTimeout: number;
|
|
2076
|
+
customInstallCmd: string | null;
|
|
2077
|
+
extraSymlinkDir: string | null;
|
|
2078
|
+
extraSymlinkExecutables: string[];
|
|
2079
|
+
pipIndexUrl: string | null;
|
|
2080
|
+
};
|
|
2081
|
+
startCmd: string;
|
|
2082
|
+
stopCmd: string;
|
|
2083
|
+
configIniCmd: string;
|
|
2084
|
+
watchAgentCmd: string;
|
|
2085
|
+
antiCallLlmCmd: string;
|
|
2086
|
+
antiCallLlmCmdNoResponse: string;
|
|
2087
|
+
loggingPath: string;
|
|
2088
|
+
loggingFileName: string;
|
|
2089
|
+
}, z.ZodTypeDef, {
|
|
2090
|
+
type: string;
|
|
2091
|
+
installTimeout: number;
|
|
2092
|
+
enabled: boolean;
|
|
2093
|
+
installCmd: string;
|
|
2094
|
+
runtimeEnvConfig: {
|
|
2095
|
+
type: "python";
|
|
2096
|
+
env: Record<string, string>;
|
|
2097
|
+
pip: string | string[] | null;
|
|
2098
|
+
version: "default" | "3.11" | "3.12";
|
|
2099
|
+
installTimeout: number;
|
|
2100
|
+
customInstallCmd: string | null;
|
|
2101
|
+
extraSymlinkDir: string | null;
|
|
2102
|
+
extraSymlinkExecutables: string[];
|
|
2103
|
+
pipIndexUrl: string | null;
|
|
2104
|
+
};
|
|
2105
|
+
startCmd: string;
|
|
2106
|
+
stopCmd: string;
|
|
2107
|
+
configIniCmd: string;
|
|
2108
|
+
watchAgentCmd: string;
|
|
2109
|
+
antiCallLlmCmd: string;
|
|
2110
|
+
antiCallLlmCmdNoResponse: string;
|
|
2111
|
+
loggingPath: string;
|
|
2112
|
+
loggingFileName: string;
|
|
2113
|
+
}>>>;
|
|
2114
|
+
}, "strip", z.ZodTypeAny, {
|
|
2115
|
+
env: Record<string, string>;
|
|
2116
|
+
version: string;
|
|
2117
|
+
agentType: string;
|
|
2118
|
+
agentSession: string;
|
|
2119
|
+
modelServiceConfig: {
|
|
2120
|
+
type: string;
|
|
2121
|
+
installTimeout: number;
|
|
2122
|
+
enabled: boolean;
|
|
2123
|
+
installCmd: string;
|
|
2124
|
+
runtimeEnvConfig: {
|
|
2125
|
+
type: "python";
|
|
2126
|
+
env: Record<string, string>;
|
|
2127
|
+
pip: string | string[] | null;
|
|
2128
|
+
version: "default" | "3.11" | "3.12";
|
|
2129
|
+
installTimeout: number;
|
|
2130
|
+
customInstallCmd: string | null;
|
|
2131
|
+
extraSymlinkDir: string | null;
|
|
2132
|
+
extraSymlinkExecutables: string[];
|
|
2133
|
+
pipIndexUrl: string | null;
|
|
2134
|
+
};
|
|
2135
|
+
startCmd: string;
|
|
2136
|
+
stopCmd: string;
|
|
2137
|
+
configIniCmd: string;
|
|
2138
|
+
watchAgentCmd: string;
|
|
2139
|
+
antiCallLlmCmd: string;
|
|
2140
|
+
antiCallLlmCmdNoResponse: string;
|
|
2141
|
+
loggingPath: string;
|
|
2142
|
+
loggingFileName: string;
|
|
2143
|
+
} | null;
|
|
2144
|
+
agentName: string;
|
|
2145
|
+
agentInstalledDir: string;
|
|
2146
|
+
instanceId: string;
|
|
2147
|
+
projectPath: string | null;
|
|
2148
|
+
useDeployWorkingDirAsFallback: boolean;
|
|
2149
|
+
preInitCmds: {
|
|
2150
|
+
command: string;
|
|
2151
|
+
timeoutSeconds: number;
|
|
2152
|
+
}[];
|
|
2153
|
+
postInitCmds: {
|
|
2154
|
+
command: string;
|
|
2155
|
+
timeoutSeconds: number;
|
|
2156
|
+
}[];
|
|
2157
|
+
agentInstallTimeout: number;
|
|
2158
|
+
agentRunTimeout: number;
|
|
2159
|
+
agentRunCheckInterval: number;
|
|
2160
|
+
workingDir: string | null;
|
|
2161
|
+
runCmd: string | null;
|
|
2162
|
+
skipWrapRunCmd: boolean;
|
|
2163
|
+
runtimeEnvConfig?: any;
|
|
2164
|
+
}, {
|
|
2165
|
+
env?: Record<string, string> | undefined;
|
|
2166
|
+
version?: string | undefined;
|
|
2167
|
+
runtimeEnvConfig?: any;
|
|
2168
|
+
agentType?: string | undefined;
|
|
2169
|
+
agentSession?: string | undefined;
|
|
2170
|
+
modelServiceConfig?: {
|
|
2171
|
+
type: string;
|
|
2172
|
+
installTimeout: number;
|
|
2173
|
+
enabled: boolean;
|
|
2174
|
+
installCmd: string;
|
|
2175
|
+
runtimeEnvConfig: {
|
|
2176
|
+
type: "python";
|
|
2177
|
+
env: Record<string, string>;
|
|
2178
|
+
pip: string | string[] | null;
|
|
2179
|
+
version: "default" | "3.11" | "3.12";
|
|
2180
|
+
installTimeout: number;
|
|
2181
|
+
customInstallCmd: string | null;
|
|
2182
|
+
extraSymlinkDir: string | null;
|
|
2183
|
+
extraSymlinkExecutables: string[];
|
|
2184
|
+
pipIndexUrl: string | null;
|
|
2185
|
+
};
|
|
2186
|
+
startCmd: string;
|
|
2187
|
+
stopCmd: string;
|
|
2188
|
+
configIniCmd: string;
|
|
2189
|
+
watchAgentCmd: string;
|
|
2190
|
+
antiCallLlmCmd: string;
|
|
2191
|
+
antiCallLlmCmdNoResponse: string;
|
|
2192
|
+
loggingPath: string;
|
|
2193
|
+
loggingFileName: string;
|
|
2194
|
+
} | null | undefined;
|
|
2195
|
+
agentName?: string | undefined;
|
|
2196
|
+
agentInstalledDir?: string | undefined;
|
|
2197
|
+
instanceId?: string | undefined;
|
|
2198
|
+
projectPath?: string | null | undefined;
|
|
2199
|
+
useDeployWorkingDirAsFallback?: boolean | undefined;
|
|
2200
|
+
preInitCmds?: {
|
|
2201
|
+
command: string;
|
|
2202
|
+
timeoutSeconds?: number | undefined;
|
|
2203
|
+
}[] | undefined;
|
|
2204
|
+
postInitCmds?: {
|
|
2205
|
+
command: string;
|
|
2206
|
+
timeoutSeconds?: number | undefined;
|
|
2207
|
+
}[] | undefined;
|
|
2208
|
+
agentInstallTimeout?: number | undefined;
|
|
2209
|
+
agentRunTimeout?: number | undefined;
|
|
2210
|
+
agentRunCheckInterval?: number | undefined;
|
|
2211
|
+
workingDir?: string | null | undefined;
|
|
2212
|
+
runCmd?: string | null | undefined;
|
|
2213
|
+
skipWrapRunCmd?: boolean | undefined;
|
|
2214
|
+
}>, {
|
|
2215
|
+
env: Record<string, string>;
|
|
2216
|
+
version: string;
|
|
2217
|
+
agentType: string;
|
|
2218
|
+
agentSession: string;
|
|
2219
|
+
modelServiceConfig: {
|
|
2220
|
+
type: string;
|
|
2221
|
+
installTimeout: number;
|
|
2222
|
+
enabled: boolean;
|
|
2223
|
+
installCmd: string;
|
|
2224
|
+
runtimeEnvConfig: {
|
|
2225
|
+
type: "python";
|
|
2226
|
+
env: Record<string, string>;
|
|
2227
|
+
pip: string | string[] | null;
|
|
2228
|
+
version: "default" | "3.11" | "3.12";
|
|
2229
|
+
installTimeout: number;
|
|
2230
|
+
customInstallCmd: string | null;
|
|
2231
|
+
extraSymlinkDir: string | null;
|
|
2232
|
+
extraSymlinkExecutables: string[];
|
|
2233
|
+
pipIndexUrl: string | null;
|
|
2234
|
+
};
|
|
2235
|
+
startCmd: string;
|
|
2236
|
+
stopCmd: string;
|
|
2237
|
+
configIniCmd: string;
|
|
2238
|
+
watchAgentCmd: string;
|
|
2239
|
+
antiCallLlmCmd: string;
|
|
2240
|
+
antiCallLlmCmdNoResponse: string;
|
|
2241
|
+
loggingPath: string;
|
|
2242
|
+
loggingFileName: string;
|
|
2243
|
+
} | null;
|
|
2244
|
+
agentName: string;
|
|
2245
|
+
agentInstalledDir: string;
|
|
2246
|
+
instanceId: string;
|
|
2247
|
+
projectPath: string | null;
|
|
2248
|
+
useDeployWorkingDirAsFallback: boolean;
|
|
2249
|
+
preInitCmds: {
|
|
2250
|
+
command: string;
|
|
2251
|
+
timeoutSeconds: number;
|
|
2252
|
+
}[];
|
|
2253
|
+
postInitCmds: {
|
|
2254
|
+
command: string;
|
|
2255
|
+
timeoutSeconds: number;
|
|
2256
|
+
}[];
|
|
2257
|
+
agentInstallTimeout: number;
|
|
2258
|
+
agentRunTimeout: number;
|
|
2259
|
+
agentRunCheckInterval: number;
|
|
2260
|
+
workingDir: string | null;
|
|
2261
|
+
runCmd: string | null;
|
|
2262
|
+
skipWrapRunCmd: boolean;
|
|
2263
|
+
runtimeEnvConfig?: any;
|
|
2264
|
+
}, {
|
|
2265
|
+
env?: Record<string, string> | undefined;
|
|
2266
|
+
version?: string | undefined;
|
|
2267
|
+
runtimeEnvConfig?: any;
|
|
2268
|
+
agentType?: string | undefined;
|
|
2269
|
+
agentSession?: string | undefined;
|
|
2270
|
+
modelServiceConfig?: {
|
|
2271
|
+
type: string;
|
|
2272
|
+
installTimeout: number;
|
|
2273
|
+
enabled: boolean;
|
|
2274
|
+
installCmd: string;
|
|
2275
|
+
runtimeEnvConfig: {
|
|
2276
|
+
type: "python";
|
|
2277
|
+
env: Record<string, string>;
|
|
2278
|
+
pip: string | string[] | null;
|
|
2279
|
+
version: "default" | "3.11" | "3.12";
|
|
2280
|
+
installTimeout: number;
|
|
2281
|
+
customInstallCmd: string | null;
|
|
2282
|
+
extraSymlinkDir: string | null;
|
|
2283
|
+
extraSymlinkExecutables: string[];
|
|
2284
|
+
pipIndexUrl: string | null;
|
|
2285
|
+
};
|
|
2286
|
+
startCmd: string;
|
|
2287
|
+
stopCmd: string;
|
|
2288
|
+
configIniCmd: string;
|
|
2289
|
+
watchAgentCmd: string;
|
|
2290
|
+
antiCallLlmCmd: string;
|
|
2291
|
+
antiCallLlmCmdNoResponse: string;
|
|
2292
|
+
loggingPath: string;
|
|
2293
|
+
loggingFileName: string;
|
|
2294
|
+
} | null | undefined;
|
|
2295
|
+
agentName?: string | undefined;
|
|
2296
|
+
agentInstalledDir?: string | undefined;
|
|
2297
|
+
instanceId?: string | undefined;
|
|
2298
|
+
projectPath?: string | null | undefined;
|
|
2299
|
+
useDeployWorkingDirAsFallback?: boolean | undefined;
|
|
2300
|
+
preInitCmds?: {
|
|
2301
|
+
command: string;
|
|
2302
|
+
timeoutSeconds?: number | undefined;
|
|
2303
|
+
}[] | undefined;
|
|
2304
|
+
postInitCmds?: {
|
|
2305
|
+
command: string;
|
|
2306
|
+
timeoutSeconds?: number | undefined;
|
|
2307
|
+
}[] | undefined;
|
|
2308
|
+
agentInstallTimeout?: number | undefined;
|
|
2309
|
+
agentRunTimeout?: number | undefined;
|
|
2310
|
+
agentRunCheckInterval?: number | undefined;
|
|
2311
|
+
workingDir?: string | null | undefined;
|
|
2312
|
+
runCmd?: string | null | undefined;
|
|
2313
|
+
skipWrapRunCmd?: boolean | undefined;
|
|
2314
|
+
}>;
|
|
2315
|
+
type RockAgentConfig = z.infer<typeof RockAgentConfigSchema>;
|
|
2316
|
+
|
|
2317
|
+
/**
|
|
2318
|
+
* Agent base classes
|
|
2319
|
+
*/
|
|
2320
|
+
|
|
2321
|
+
/**
|
|
2322
|
+
* Abstract Agent base class
|
|
2323
|
+
*/
|
|
2324
|
+
declare abstract class Agent {
|
|
2325
|
+
protected _sandbox: SandboxLike;
|
|
2326
|
+
protected _modelService: ModelService | null;
|
|
2327
|
+
constructor(sandbox: SandboxLike);
|
|
2328
|
+
get sandbox(): SandboxLike;
|
|
2329
|
+
get modelService(): ModelService | null;
|
|
2330
|
+
abstract install(config: RockAgentConfig): Promise<void>;
|
|
2331
|
+
abstract run(prompt: string): Promise<Observation>;
|
|
2332
|
+
}
|
|
2333
|
+
/**
|
|
2334
|
+
* DefaultAgent with common initialization and execution logic
|
|
2335
|
+
*/
|
|
2336
|
+
declare class DefaultAgent extends Agent {
|
|
2337
|
+
protected _config: RockAgentConfig | null;
|
|
2338
|
+
protected _agentSession: string | null;
|
|
2339
|
+
get config(): RockAgentConfig | null;
|
|
2340
|
+
get agentSession(): string | null;
|
|
2341
|
+
get modelService(): ModelService | null;
|
|
2342
|
+
install(config: RockAgentConfig): Promise<void>;
|
|
2343
|
+
run(prompt: string): Promise<Observation>;
|
|
2344
|
+
protected _setupSession(): Promise<void>;
|
|
2345
|
+
protected _executeInitCommands(cmdList: Array<{
|
|
2346
|
+
command: string;
|
|
2347
|
+
timeoutSeconds: number;
|
|
2348
|
+
}>, stepName: string): Promise<void>;
|
|
2349
|
+
protected _createAgentRunCmd(prompt: string): Promise<string>;
|
|
2350
|
+
protected _agentRun(cmd: string): Promise<Observation>;
|
|
1342
2351
|
}
|
|
1343
2352
|
|
|
1344
2353
|
/**
|
|
1345
2354
|
* ROCK TypeScript SDK
|
|
1346
2355
|
* Main entry point
|
|
1347
2356
|
*/
|
|
1348
|
-
declare const VERSION
|
|
2357
|
+
declare const VERSION: string;
|
|
1349
2358
|
|
|
1350
|
-
export { 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,
|
|
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 };
|