oblien 2.2.36 → 2.2.37
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 +51 -274
- package/dist/cli/commands/namespaces.js +19 -6
- package/dist/cli/commands/namespaces.js.map +1 -1
- package/dist/client.d.ts +7 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +9 -1
- package/dist/client.js.map +1 -1
- package/dist/domain.d.ts +20 -1
- package/dist/domain.d.ts.map +1 -1
- package/dist/domain.js +37 -0
- package/dist/domain.js.map +1 -1
- package/dist/edge-proxy.d.ts +50 -11
- package/dist/edge-proxy.d.ts.map +1 -1
- package/dist/edge-proxy.js +55 -10
- package/dist/edge-proxy.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +97 -7
- package/dist/mcp/tools.js.map +1 -1
- package/dist/namespace.d.ts +27 -5
- package/dist/namespace.d.ts.map +1 -1
- package/dist/namespace.js +30 -4
- package/dist/namespace.js.map +1 -1
- package/dist/notifications.d.ts +72 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +93 -0
- package/dist/notifications.js.map +1 -0
- package/dist/types/edge-proxy.d.ts +50 -1
- package/dist/types/edge-proxy.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/namespace.d.ts +55 -9
- package/dist/types/namespace.d.ts.map +1 -1
- package/dist/types/notifications.d.ts +77 -0
- package/dist/types/notifications.d.ts.map +1 -0
- package/dist/types/notifications.js +3 -0
- package/dist/types/notifications.js.map +1 -0
- package/dist/types/webhooks.d.ts +52 -0
- package/dist/types/webhooks.d.ts.map +1 -0
- package/dist/types/webhooks.js +3 -0
- package/dist/types/webhooks.js.map +1 -0
- package/dist/types/workspace-resources.d.ts +48 -0
- package/dist/types/workspace-resources.d.ts.map +1 -1
- package/dist/webhooks.d.ts +53 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +60 -0
- package/dist/webhooks.js.map +1 -0
- package/docs/analytics.md +36 -0
- package/docs/domains.md +47 -0
- package/docs/edge-proxy.md +44 -0
- package/docs/edge-tunnel.md +42 -0
- package/docs/errors.md +34 -0
- package/docs/namespaces.md +69 -0
- package/docs/notifications.md +40 -0
- package/docs/pages.md +26 -0
- package/docs/runtime.md +53 -0
- package/docs/tokens.md +24 -0
- package/docs/webhooks.md +42 -0
- package/docs/workspaces.md +82 -0
- package/package.json +5 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Notifications
|
|
2
|
+
|
|
3
|
+
Push notifications to the Oblien mobile app. Flow: **inside a workspace ▶ Oblien ▶ FCM ▶ device**. The app registers a device; you mint **virtual** send tokens scoped to a workspace; code inside that workspace sends with a token. The real device FCM token never leaves Oblien, and a virtual token can be revoked independently.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
const nt = client.notifications;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Devices
|
|
10
|
+
|
|
11
|
+
The mobile app registers itself. Keyed by a stable `device_id` (the FCM token rotates under it); the token is **validated with FCM before storage**.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
await nt.registerDevice({ device_id: 'dev_abc', fcm_token: '<fcm>', platform: 'ios' });
|
|
15
|
+
await nt.listDevices();
|
|
16
|
+
await nt.removeDevice(deviceId);
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Send tokens (per workspace)
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// Plaintext token returned ONCE — store it.
|
|
23
|
+
const { token } = await nt.createToken({ workspace_id: 'ws_123', name: 'agent' });
|
|
24
|
+
|
|
25
|
+
await nt.listTokens('ws_123');
|
|
26
|
+
await nt.revokeToken(token.id); // soft — stops routing
|
|
27
|
+
await nt.deleteToken(token.id); // permanent
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Send
|
|
31
|
+
|
|
32
|
+
Authenticated by the virtual token itself (not client credentials) — callable from inside a workspace. Fans out to the token owner's active devices.
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
await nt.send(token.token, { title: 'Build done', body: 'Agent finished', data: { run_id: 'abc' } });
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Dead device tokens (app uninstalled) are auto-pruned on send.
|
|
39
|
+
|
|
40
|
+
**Full reference:** [Notifications concept](https://oblien.com/docs/concepts/notifications) · [API](https://oblien.com/docs/api/notifications)
|
package/docs/pages.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Pages
|
|
2
|
+
|
|
3
|
+
Deploy static files from a workspace to the edge CDN. The workspace can stop or be deleted after export — the page stays live with automatic TLS. No running VM required.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
// Deploy build output from a workspace
|
|
7
|
+
const { page } = await client.pages.create({
|
|
8
|
+
workspace_id: 'ws_abc',
|
|
9
|
+
path: '/app/dist',
|
|
10
|
+
name: 'my-app',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// Re-deploy with fresh files
|
|
14
|
+
await client.pages.deploy(page.slug, { workspace_id: 'ws_abc', path: '/app/dist' });
|
|
15
|
+
|
|
16
|
+
// Custom domain (automatic SSL)
|
|
17
|
+
await client.pages.connectDomain(page.slug, { domain: 'app.example.com' });
|
|
18
|
+
|
|
19
|
+
// Toggle
|
|
20
|
+
await client.pages.disable(page.slug);
|
|
21
|
+
await client.pages.enable(page.slug);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Pages are namespace-aware — pass `namespace` on create to group them and apply namespace scoping.
|
|
25
|
+
|
|
26
|
+
**Full reference:** [Pages concept](https://oblien.com/docs/concepts/pages) · [Pages API](https://oblien.com/docs/api/pages)
|
package/docs/runtime.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Runtime (data plane)
|
|
2
|
+
|
|
3
|
+
The runtime connects to a **running** workspace and gives direct access to its filesystem, command execution, terminal sessions, code search, and file watchers — over the data plane (`workspace.oblien.com`).
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
const rt = await client.workspaces.runtime('ws_abc');
|
|
7
|
+
// or from a scoped handle:
|
|
8
|
+
const rt = await client.workspace('ws_abc').runtime();
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This enables the Runtime API server (if needed), fetches a gateway JWT, and returns a `Runtime` instance. The token is cached — subsequent calls for the same workspace return instantly.
|
|
12
|
+
|
|
13
|
+
## Namespaces
|
|
14
|
+
|
|
15
|
+
| Namespace | What it does |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `rt.files` | List, read, write, stat, mkdir, delete, stream directory trees |
|
|
18
|
+
| `rt.transfer` | Download/upload `tar.gz` archives, with optional progress callbacks |
|
|
19
|
+
| `rt.exec` | Run commands, stream output, list/kill tasks, send stdin |
|
|
20
|
+
| `rt.terminal` | Create PTY sessions, get scrollback, close sessions |
|
|
21
|
+
| `rt.search` | Content search (ripgrep) + filename search |
|
|
22
|
+
| `rt.watcher` | Watch directories for real-time file-change events |
|
|
23
|
+
| `rt.ws()` | WebSocket — persistent connection for terminal I/O and watcher events |
|
|
24
|
+
|
|
25
|
+
## Files
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
const { entries } = await rt.files.list({ dirPath: '/app/src' });
|
|
29
|
+
const file = await rt.files.read({ filePath: '/app/index.js' });
|
|
30
|
+
await rt.files.write({ fullPath: '/app/hello.txt', content: 'hi', createDirs: true });
|
|
31
|
+
await rt.files.delete({ path: '/app/tmp' });
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Exec
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const result = await rt.exec.run(['node', '--version']);
|
|
38
|
+
console.log(result.stdout);
|
|
39
|
+
|
|
40
|
+
// Stream long-running output
|
|
41
|
+
for await (const event of rt.exec.stream(['npm', 'install'])) {
|
|
42
|
+
process.stdout.write(event.chunk ?? '');
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Search
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
const matches = await rt.search.content({ query: 'handleRequest', path: '/app' });
|
|
50
|
+
const files = await rt.search.files({ query: 'controller' });
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Full reference:** [Runtime API docs](https://oblien.com/docs/runtime-api)
|
package/docs/tokens.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Scoped Tokens
|
|
2
|
+
|
|
3
|
+
Issue short-lived, scoped JWTs for your end-users instead of sharing long-lived `clientId`/`clientSecret`. Ideal for SaaS: hand each tenant a token bound to their namespace (or a single workspace) that expires on its own.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
const { token, expiresAt, scope } = await client.tokens.create({
|
|
7
|
+
scope: 'namespace', // 'namespace' | 'workspace'
|
|
8
|
+
namespace: 'team-a', // required for namespace scope
|
|
9
|
+
ttl: 900, // seconds (max 3600, default 900)
|
|
10
|
+
label: 'tenant-team-a',
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Use the returned token as the `token` option on a new client:
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
const scoped = new Oblien({ token });
|
|
18
|
+
// scoped is pinned to team-a — list/get/usage/webhooks auto-filter to it,
|
|
19
|
+
// and it can't widen scope.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The token is self-contained (signature + expiry) — no DB lookup. Revoke early by blacklisting its `jti` server-side if needed.
|
|
23
|
+
|
|
24
|
+
**Full reference:** [Scoped tokens API](https://oblien.com/docs/api/scoped-tokens)
|
package/docs/webhooks.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Webhooks
|
|
2
|
+
|
|
3
|
+
Subscribe an HTTPS endpoint to platform events (vm/workload lifecycle, credit usage, namespace quota thresholds), signed with HMAC-SHA256 (`X-Webhook-Signature`). A webhook can be **scoped to a namespace** so it only receives that namespace's events — or left account-wide.
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
const wh = client.webhooks;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Event types
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
const { events } = await wh.events();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Includes: `vm.stopped`, `vm.archived`, `workload.started|exited|failed|stopped|restart_loop`, `credits.usage`, `credits.low`, `credits.depleted`, `namespace.quota.threshold`.
|
|
16
|
+
|
|
17
|
+
## Create (namespace-scoped or account-wide)
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
const { webhook } = await wh.create({
|
|
21
|
+
url: 'https://example.com/hooks/oblien',
|
|
22
|
+
events: ['credits.usage', 'namespace.quota.threshold', 'credits.depleted'],
|
|
23
|
+
namespace: 'team-a', // ← only team-a's events; omit for account-wide
|
|
24
|
+
secret: process.env.WH_SECRET, // signs deliveries
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
A namespace-bound webhook receives only events that carry that namespace; account-wide webhooks receive everything. Namespace-scoped API keys are auto-pinned to their namespace.
|
|
29
|
+
|
|
30
|
+
## Manage
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
const { webhooks } = await wh.list({ namespace: 'team-a' });
|
|
34
|
+
await wh.update(webhook.id, { active: false });
|
|
35
|
+
await wh.delete(webhook.id);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage metering via webhook
|
|
39
|
+
|
|
40
|
+
`credits.usage` is emitted per billing cycle with `{ namespace, workspace_id, usage: { cpu_time_minutes, memory_gb_minutes, disk_io_gb, network_gb } }` — a push alternative to polling [`namespaces.usageUnits`](./namespaces.md). Idempotent per event.
|
|
41
|
+
|
|
42
|
+
**Full reference:** [Webhooks concept](https://oblien.com/docs/concepts/webhooks)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Workspaces
|
|
2
|
+
|
|
3
|
+
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
|
+
|
|
5
|
+
`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)**.
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
const ws = client.workspaces;
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## CRUD
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
const workspace = await ws.create({
|
|
15
|
+
image: 'node-20', // any Docker image
|
|
16
|
+
mode: 'permanent', // 'permanent' | 'temporary'
|
|
17
|
+
cpus: 2,
|
|
18
|
+
memory_mb: 4096,
|
|
19
|
+
namespace: 'team-a', // optional — groups + applies namespace limits/quotas
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const { workspaces } = await ws.list();
|
|
23
|
+
const data = await ws.get(workspace.id);
|
|
24
|
+
await ws.update(workspace.id, { name: 'my-api' });
|
|
25
|
+
await ws.delete(workspace.id);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
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
|
+
|
|
30
|
+
## Power
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
await ws.start(id);
|
|
34
|
+
await ws.stop(id);
|
|
35
|
+
await ws.restart(id);
|
|
36
|
+
await ws.pause(id); // freeze to disk
|
|
37
|
+
await ws.resume(id); // thaw
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Scoped handle
|
|
41
|
+
|
|
42
|
+
Bind to one workspace so you never pass the ID again:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
const handle = client.workspace('ws_abc');
|
|
46
|
+
|
|
47
|
+
await handle.start();
|
|
48
|
+
const rt = await handle.runtime();
|
|
49
|
+
await rt.exec.run(['npm', 'test']);
|
|
50
|
+
await handle.stop();
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Runtime
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
const rt = await client.workspaces.runtime('ws_abc');
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Enables the Runtime API server, fetches + caches a gateway JWT, and returns a `Runtime` instance for the data plane (files, exec, terminal, search, watcher, transfer, WebSocket). → **[Runtime](./runtime.md)**.
|
|
60
|
+
|
|
61
|
+
## Sub-resources
|
|
62
|
+
|
|
63
|
+
Accessed as namespaces on `client.workspaces`:
|
|
64
|
+
|
|
65
|
+
| Sub-resource | What it does |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `lifecycle` | Permanent/temporary mode, TTL, ping |
|
|
68
|
+
| `network` | Firewall, private links, outbound IP |
|
|
69
|
+
| `ssh` | SSH enable/disable, password/key |
|
|
70
|
+
| `publicAccess` | Expose ports with public URLs + automatic TLS |
|
|
71
|
+
| `domains` | Custom domains with automatic SSL ([Domains](./domains.md)) |
|
|
72
|
+
| `resources` | CPU / memory / disk allocation (upgrade — namespace caps enforced) |
|
|
73
|
+
| `snapshots` | Snapshots and versioned archives |
|
|
74
|
+
| `workloads` | Managed background processes |
|
|
75
|
+
| `metrics` | Live stats, VM info/config |
|
|
76
|
+
| `usage` | Credit usage + activity tracking |
|
|
77
|
+
| `metadata` | Key-value metadata store |
|
|
78
|
+
| `apiAccess` | Runtime API tokens (gateway JWT / raw) |
|
|
79
|
+
| `logs` | Boot and command logs |
|
|
80
|
+
| `images` | Available base images |
|
|
81
|
+
|
|
82
|
+
**Full reference:** [API docs](https://oblien.com/docs/api/workspaces)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oblien",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.37",
|
|
4
4
|
"description": "Official TypeScript SDK for the Oblien Workspace API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
|
-
"dist"
|
|
27
|
+
"dist",
|
|
28
|
+
"docs",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
28
31
|
],
|
|
29
32
|
"scripts": {
|
|
30
33
|
"build": "tsc",
|