oblien 2.3.0 → 2.4.0
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 +2 -0
- package/dist/billing.d.ts +14 -10
- package/dist/billing.d.ts.map +1 -1
- package/dist/billing.js +17 -9
- package/dist/billing.js.map +1 -1
- package/dist/cli/commands/desktop.d.ts +3 -0
- package/dist/cli/commands/desktop.d.ts.map +1 -0
- package/dist/cli/commands/desktop.js +45 -0
- package/dist/cli/commands/desktop.js.map +1 -0
- package/dist/cli/commands/lifecycle.d.ts.map +1 -1
- package/dist/cli/commands/lifecycle.js +22 -0
- package/dist/cli/commands/lifecycle.js.map +1 -1
- package/dist/cli/commands/workspaces.d.ts.map +1 -1
- package/dist/cli/commands/workspaces.js +12 -1
- package/dist/cli/commands/workspaces.js.map +1 -1
- package/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/http-error.d.ts.map +1 -1
- package/dist/http-error.js +4 -1
- package/dist/http-error.js.map +1 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +4 -7
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +2 -0
- package/dist/mcp/tools.js.map +1 -1
- package/dist/namespace.d.ts +6 -6
- package/dist/namespace.js +6 -6
- package/dist/resources/desktop.d.ts +35 -0
- package/dist/resources/desktop.d.ts.map +1 -0
- package/dist/resources/desktop.js +20 -0
- package/dist/resources/desktop.js.map +1 -0
- package/dist/resources/images.d.ts +44 -1
- package/dist/resources/images.d.ts.map +1 -1
- package/dist/resources/images.js.map +1 -1
- package/dist/resources/lifecycle.d.ts +11 -2
- package/dist/resources/lifecycle.d.ts.map +1 -1
- package/dist/resources/lifecycle.js +7 -2
- package/dist/resources/lifecycle.js.map +1 -1
- package/dist/runtime/desktop-tunnel.d.ts +7 -0
- package/dist/runtime/desktop-tunnel.d.ts.map +1 -0
- package/dist/runtime/desktop-tunnel.js +56 -0
- package/dist/runtime/desktop-tunnel.js.map +1 -0
- package/dist/runtime/desktop.d.ts +37 -0
- package/dist/runtime/desktop.d.ts.map +1 -0
- package/dist/runtime/desktop.js +41 -0
- package/dist/runtime/desktop.js.map +1 -0
- package/dist/runtime.d.ts +4 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +4 -0
- package/dist/runtime.js.map +1 -1
- package/dist/types/billing.d.ts +48 -9
- package/dist/types/billing.d.ts.map +1 -1
- package/dist/types/billing.js +2 -2
- package/dist/types/common.d.ts +1 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/runtime.d.ts +2 -0
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/workspace-resources.d.ts +23 -0
- package/dist/types/workspace-resources.d.ts.map +1 -1
- package/dist/types/workspace.d.ts +41 -3
- package/dist/types/workspace.d.ts.map +1 -1
- package/dist/workspace-handle.d.ts +5 -1
- package/dist/workspace-handle.d.ts.map +1 -1
- package/dist/workspace-handle.js +8 -0
- package/dist/workspace-handle.js.map +1 -1
- package/dist/workspace.d.ts +10 -3
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +84 -5
- package/dist/workspace.js.map +1 -1
- package/docs/billing.md +130 -2
- package/docs/desktop.md +83 -0
- package/docs/errors.md +7 -1
- package/docs/on-demand.md +43 -0
- package/docs/workspace-limit-report.md +40 -0
- package/docs/workspaces.md +30 -0
- package/package.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Sleep and wake on request
|
|
2
|
+
|
|
3
|
+
Automatic sleep is opt-in for permanent workspaces with memory snapshot support. It covers every exposed HTTP port URL and connected custom domain for that workspace.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import Oblien from 'oblien';
|
|
7
|
+
|
|
8
|
+
const client = new Oblien({
|
|
9
|
+
clientId: process.env.OBLIEN_CLIENT_ID,
|
|
10
|
+
clientSecret: process.env.OBLIEN_CLIENT_SECRET,
|
|
11
|
+
});
|
|
12
|
+
const ws = client.workspace('YOUR_WORKSPACE_ID');
|
|
13
|
+
|
|
14
|
+
// Start your app on 0.0.0.0:3000, then publish it.
|
|
15
|
+
const port = await ws.publicAccess.expose({ port: 3000 });
|
|
16
|
+
await ws.lifecycle.setIdle({ suspend_after: '15m' });
|
|
17
|
+
console.log(port);
|
|
18
|
+
|
|
19
|
+
// Read the policy/capability or disable automatic sleep.
|
|
20
|
+
console.log(await ws.lifecycle.get());
|
|
21
|
+
await ws.lifecycle.setIdle(null);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Creation accepts the same policy under `config.idle`:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
const workspace = await client.workspaces.create({
|
|
28
|
+
image: 'oblien/node:24', mode: 'permanent',
|
|
29
|
+
config: { idle: { suspend_after: '15m' } },
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`suspend_after` accepts seconds or a duration string, with a minimum of 120 seconds. The default `stop_after: 0` keeps saved RAM until wake. An optional retention time of at least one hour discards saved RAM after that long asleep; files remain, but the next wake cold-boots. For example `{ suspend_after: '15m', stop_after: '72h' }` requires an app that starts at boot.
|
|
34
|
+
|
|
35
|
+
The API coalesces concurrent wake/restore attempts across workers, ports and aliases. The edge waits for the requested application port and forwards each request after readiness. If startup exceeds its wait budget, it returns 503 with `Retry-After: 1`; wake continues. Retry with a deadline/backoff and use application idempotency keys for writes.
|
|
36
|
+
|
|
37
|
+
Requests and streams through the HTTP edge keep the workspace awake. For background jobs, direct TCP, SSH or runtime work, call `ws.lifecycle.ping()` periodically within the idle timeout or disable automatic sleep. External connections can expire during hibernation and need application-level reconnection.
|
|
38
|
+
|
|
39
|
+
While this policy is enabled, an existing public route can wake a stopped workspace too. `ws.lifecycle.setIdle(null)` disables automatic sleep and public wake; explicit Restore/Resume remains available. Revoke public ports/disconnect domains to remove public access entirely. Nested KVM workspaces currently reject automatic sleep because Firecracker cannot preserve their nested VM state.
|
|
40
|
+
|
|
41
|
+
CLI: `oblien lifecycle idle WORKSPACE_ID --after 15m`, optionally `--stop-after 72h`; disable with `--disable`.
|
|
42
|
+
|
|
43
|
+
See [the hosted guide](https://oblien.com/docs/workspace/on-demand) for dashboard setup and operational details.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Openship workspace-limit HTTP status report
|
|
2
|
+
|
|
3
|
+
Reported 2026-09-17. Openship already rejects this response safely; it is not an
|
|
4
|
+
independent release blocker for Openship.
|
|
5
|
+
|
|
6
|
+
Some API deployments returned HTTP 200 when workspace creation failed:
|
|
7
|
+
|
|
8
|
+
```json
|
|
9
|
+
{
|
|
10
|
+
"success": false,
|
|
11
|
+
"error": "SANDBOX_LIMIT_REACHED",
|
|
12
|
+
"code": "SANDBOX_LIMIT_REACHED",
|
|
13
|
+
"message": "Workspace count limit reached.",
|
|
14
|
+
"current": 3,
|
|
15
|
+
"max": 3
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Expected behavior is HTTP 409 with the failure code and quota details. The API now
|
|
20
|
+
maps workspace, namespace, and owned-pool limits to 409. A namespace admission
|
|
21
|
+
failure also now sets `success: false`, so the response cannot take the success path.
|
|
22
|
+
|
|
23
|
+
The SDK patch retains compatibility with legacy HTTP 200 failure envelopes, maps
|
|
24
|
+
these limit codes to `ConflictError`, and preserves the actual response status.
|
|
25
|
+
It also rejects non-2xx JSON responses that omit `success: false`. Creation failures
|
|
26
|
+
do not enter readiness polling or issue a second create request.
|
|
27
|
+
|
|
28
|
+
Verification: `npm test` passes all 19 SDK tests, including
|
|
29
|
+
`tests/http-errors.test.mjs` for legacy 200, current 409, uppercase error-only codes,
|
|
30
|
+
403/500 JSON responses, and successful asynchronous creation.
|
|
31
|
+
|
|
32
|
+
The 2026-09-17 live account/namespace billing canary also verified that a second
|
|
33
|
+
workspace in a namespace capped at one workspace returns HTTP 409 with
|
|
34
|
+
`NAMESPACE_LIMIT_REACHED`, through the SDK. See the API repository's
|
|
35
|
+
`docs/ACCOUNT_WORKSPACE_BILLING_FIX_20260917.md` for that run and the broader
|
|
36
|
+
190-check API regression suite.
|
|
37
|
+
|
|
38
|
+
This report and patch are recorded in the SDK repository for maintainers. No external
|
|
39
|
+
issue or team message has been sent from this environment. The public npm version
|
|
40
|
+
checked during this work is 2.3.0; these SDK changes require the next SDK release.
|
package/docs/workspaces.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Workspaces
|
|
2
2
|
|
|
3
|
+
`create()` waits for the workspace's default runtime. To return its ID immediately:
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
const pending = await client.workspaces.create({
|
|
7
|
+
image: 'oblien/ubuntu:24.04',
|
|
8
|
+
wait_ready: false,
|
|
9
|
+
idempotency_key: 'my-create-request',
|
|
10
|
+
});
|
|
11
|
+
const ready = await client.workspaces.waitUntilReady(pending.id, { timeoutMs: 300_000 });
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read `workspace.provisioning` for progress and failure details, and `workspace.ready` for readiness. `waitUntilReady` supports `signal`; a timeout or abort stops waiting while creation continues. Errors include `details.workspace_id`. Reuse the same `idempotency_key` if a create response is lost. Failed creation can be retried with `retryCreation(id)` or deleted with `delete(id)`. A deletion accepted with `accepted: true` completes in the background.
|
|
15
|
+
|
|
3
16
|
A workspace is a hardware-isolated microVM that boots in under a second from any Docker image. It's the only primitive in Oblien — everything else (pages, proxies, domains) hangs off a workspace or the account.
|
|
4
17
|
|
|
5
18
|
`client.workspaces` is the control-plane resource: create, configure, power, and destroy workspaces, plus a tree of sub-resources. To interact with a *running* workspace's filesystem/exec/terminal, see **[Runtime](./runtime.md)**.
|
|
@@ -27,6 +40,12 @@ await ws.delete(workspace.id);
|
|
|
27
40
|
|
|
28
41
|
Creating in a namespace enforces that namespace's **resource limits** (max workspaces, per-workspace vCPU/RAM/disk) atomically, and **status** (a suspended/over-quota namespace rejects new workspaces). See **[Namespaces](./namespaces.md)**.
|
|
29
42
|
|
|
43
|
+
Workspace count, namespace, and owned resource pool limits return HTTP 409 with
|
|
44
|
+
`SANDBOX_LIMIT_REACHED`, `NAMESPACE_LIMIT_REACHED`, or `POOL_LIMIT_REACHED`. The SDK
|
|
45
|
+
throws `ConflictError` for these codes, including older API responses that incorrectly
|
|
46
|
+
used HTTP 200 with `success: false`. It preserves the actual HTTP status in
|
|
47
|
+
`error.status` and rejects before polling for readiness.
|
|
48
|
+
|
|
30
49
|
## Power
|
|
31
50
|
|
|
32
51
|
```typescript
|
|
@@ -37,6 +56,15 @@ await ws.pause(id); // freeze to disk
|
|
|
37
56
|
await ws.resume(id); // thaw
|
|
38
57
|
```
|
|
39
58
|
|
|
59
|
+
During billing or manual namespace suspension, scoped credentials can still inspect,
|
|
60
|
+
stop, and delete their own workspaces. Create, start, restart, resume, and other
|
|
61
|
+
mutations return `403 namespace_suspended`. Funding can restore a billing suspension;
|
|
62
|
+
manual suspension requires explicit namespace activation. Restoration leaves
|
|
63
|
+
workspaces stopped until the customer starts them.
|
|
64
|
+
|
|
65
|
+
Stop is safe to retry when automatic exhaustion or an earlier request has already
|
|
66
|
+
stopped the VM. The API returns success only after the VM node confirms that state.
|
|
67
|
+
|
|
40
68
|
## Scoped handle
|
|
41
69
|
|
|
42
70
|
Bind to one workspace so you never pass the ID again:
|
|
@@ -79,4 +107,6 @@ Accessed as namespaces on `client.workspaces`:
|
|
|
79
107
|
| `logs` | Boot and command logs |
|
|
80
108
|
| `images` | Available base images |
|
|
81
109
|
|
|
110
|
+
Native macOS SSH uses public-key authentication and the `oblien` login account. Save a public key with `client.workspaces.ssh.setKey(id, { public_key })`, then call `client.workspaces.ssh.enable(id)`. SSH status includes `auth_methods` and the SSH/SCP connection commands. Public SSH can be disabled without affecting the Mac runtime or its private boot connection.
|
|
111
|
+
|
|
82
112
|
**Full reference:** [API docs](https://oblien.com/docs/api/workspaces)
|