Skip to content

Commit 7588b77

Browse files
committed
refactor(ts-sdk): consolidate types - remove sandbox/types.ts
- Move SpeedupType to network.ts where it's used - Update all RunMode/RunModeType imports to use common/constants.ts - Remove unused RuntimeEnvId and AgentType from types.ts - Delete sandbox/types.ts and types.test.ts This addresses the PR review feedback about duplicated type definitions.
1 parent b9a7cc4 commit 7588b77

File tree

10 files changed

+21
-75
lines changed

10 files changed

+21
-75
lines changed

rock/ts-sdk/src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export * from './envs/index.js';
4444

4545
// Sandbox - selective exports
4646
export { Sandbox, SandboxGroup } from './sandbox/client.js';
47-
export type { RunModeType as SandboxRunModeType } from './sandbox/types.js';
47+
export type { RunModeType as SandboxRunModeType } from './common/constants.js';
4848
export {
4949
SandboxConfigSchema,
5050
SandboxGroupConfigSchema,
@@ -54,11 +54,10 @@ export {
5454
export type { SandboxConfig, SandboxGroupConfig, BaseConfig } from './sandbox/config.js';
5555
export { Deploy } from './sandbox/deploy.js';
5656
export { LinuxFileSystem } from './sandbox/file_system.js';
57-
export { Network } from './sandbox/network.js';
57+
export { Network, SpeedupType } from './sandbox/network.js';
5858
export { Process } from './sandbox/process.js';
5959
export { LinuxRemoteUser } from './sandbox/remote_user.js';
6060
export { withTimeLogging, arunWithRetry, extractNohupPid as extractNohupPidFromSandbox } from './sandbox/utils.js';
61-
export { SpeedupType } from './sandbox/types.js';
6261

6362
// Model
6463
export * from './model/index.js';

rock/ts-sdk/src/sandbox/client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import axios from 'axios';
66
import { Sandbox } from './client.js';
7-
import { RunMode } from './types.js';
7+
import { RunMode } from '../common/constants.js';
88
import {
99
BadRequestRockError,
1010
InternalServerRockError,

rock/ts-sdk/src/sandbox/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { Network } from './network.js';
1919
import { Process } from './process.js';
2020
import { LinuxRemoteUser } from './remote_user.js';
2121
import { extractNohupPid } from './utils.js';
22-
import { RunModeType, RunMode as RunModeEnum } from './types.js';
22+
import { RunModeType, RunMode as RunModeEnum } from '../common/constants.js';
2323
export type { RunModeType };
2424
export { RunModeEnum as RunMode };
2525
import {

rock/ts-sdk/src/sandbox/file_system.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { initLogger } from '../logger.js';
99
import type { Observation, CommandResponse } from '../types/responses.js';
1010
import type { ChownRequest, ChmodRequest } from '../types/requests.js';
1111
import type { AbstractSandbox } from './client.js';
12-
import { RunMode } from './types.js';
12+
import { RunMode } from '../common/constants.js';
1313
import { validatePath, validateUsername, validateChmodMode, shellQuote } from '../utils/shell.js';
1414

1515
const logger = initLogger('rock.sandbox.fs');

rock/ts-sdk/src/sandbox/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ export * from './network.js';
1010
export * from './process.js';
1111
export * from './remote_user.js';
1212
export * from './utils.js';
13-
export * from './types.js';
13+
14+
// Re-export types from their new locations
15+
export { SpeedupType } from './network.js';
16+
export type { RunModeType } from '../common/constants.js';
17+
export { RunMode } from '../common/constants.js';

rock/ts-sdk/src/sandbox/network.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
* Tests for Network - Network management for sandbox
33
*/
44

5-
import { Network } from './network.js';
6-
import { SpeedupType } from './types.js';
5+
import { Network, SpeedupType } from './network.js';
76
import type { Observation } from '../types/responses.js';
87

98
/**

rock/ts-sdk/src/sandbox/network.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@
55
import { initLogger } from '../logger.js';
66
import type { Observation } from '../types/responses.js';
77
import type { Sandbox } from './client.js';
8-
import { SpeedupType } from './types.js';
98
import { validateUrl, validateIpAddress, shellQuote } from '../utils/shell.js';
109

1110
const logger = initLogger('rock.sandbox.network');
1211

12+
/**
13+
* Speedup type enum
14+
*/
15+
export enum SpeedupType {
16+
APT = 'apt',
17+
PIP = 'pip',
18+
GITHUB = 'github',
19+
}
20+
1321
/**
1422
* Network management for sandbox
1523
*/

rock/ts-sdk/src/sandbox/types.test.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

rock/ts-sdk/src/sandbox/types.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

rock/ts-sdk/src/sandbox/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { initLogger } from '../logger.js';
66
import { sleep } from '../utils/retry.js';
77
import type { Sandbox } from './client.js';
8-
import type { RunModeType } from './types.js';
8+
import type { RunModeType } from '../common/constants.js';
99
import type { Observation } from '../types/responses.js';
1010

1111
const logger = initLogger('rock.sandbox.utils');

0 commit comments

Comments
 (0)