alibaba / alibaba/ROCK

[Feature] feat(ts-sdk): add restart() method and autoDeleteSeconds parameter

Open
#1,121 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
485
Forks
81
Avg merge
16h 12m
Merged PRs (30d)
8

Description

**Feature Category**
- [ ] Sandbox
- [ ] Actions
- [ ] Deployments
- [x] SDK & API
- [ ] Envhub
- [ ] CLI
- [ ] Performance & Optimization
- [ ] Documentation & Examples

## Summary

The TypeScript SDK (`rock/ts-sdk`) is missing two features that the Python SDK already supports:

1. **`restart()` method** — Python SDK (`rock/sdk/sandbox/client.py`) supports `restart()` to restart a stopped sandbox by reusing the existing Docker container (`docker start`). The TS SDK has no
equivalent.

2. **`autoDeleteSeconds` parameter** — Python SDK sends `auto_delete_seconds` in the `start_async` request body, allowing users to configure automatic deletion after sandbox stop. The TS SDK does not
include this parameter.

## Expected Behavior

- `Sandbox.restart()` should POST to `/restart` with `sandbox_id`, poll `getStatus()` until the sandbox is alive, and detect error stages during polling (matching Python SDK behavior).
- `SandboxConfig.autoDeleteSeconds` should be an optional numeric field (>= 0), passed in the `start_async` request body.

## Scope

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing rock/sdk/sandbox/client.py with rock/ts-sdk/src/sandbox/client.ts, then inspect rock/ts-sdk/src/sandbox/config.ts and the existing tests in rock/ts-sdk/src/sandbox/client.test.ts. Run the TypeScript SDK tests before making changes. Done means restart polling and error-stage behavior are covered, and autoDeleteSeconds is accepted and included in start_async requests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.