oblien 2.3.2 → 2.5.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 +1 -0
- package/dist/access.d.ts +79 -0
- package/dist/access.d.ts.map +1 -0
- package/dist/access.js +42 -0
- package/dist/access.js.map +1 -0
- package/dist/billing.d.ts +19 -10
- package/dist/billing.d.ts.map +1 -1
- package/dist/billing.js +22 -9
- package/dist/billing.js.map +1 -1
- package/dist/cli/commands/desktop.d.ts.map +1 -1
- package/dist/cli/commands/desktop.js +6 -2
- package/dist/cli/commands/desktop.js.map +1 -1
- 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/scp.js +9 -2
- package/dist/cli/commands/scp.js.map +1 -1
- package/dist/cli/commands/ssh.d.ts.map +1 -1
- package/dist/cli/commands/ssh.js +12 -0
- package/dist/cli/commands/ssh.js.map +1 -1
- package/dist/cli/commands/workloads.d.ts.map +1 -1
- package/dist/cli/commands/workloads.js +26 -2
- package/dist/cli/commands/workloads.js.map +1 -1
- package/dist/cli/commands/workspaces.d.ts.map +1 -1
- package/dist/cli/commands/workspaces.js +11 -0
- package/dist/cli/commands/workspaces.js.map +1 -1
- package/dist/client.d.ts +8 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +12 -0
- package/dist/client.js.map +1 -1
- package/dist/disks.d.ts +49 -0
- package/dist/disks.d.ts.map +1 -0
- package/dist/disks.js +143 -0
- package/dist/disks.js.map +1 -0
- package/dist/http.d.ts +2 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +12 -0
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/namespace.d.ts +14 -11
- package/dist/namespace.d.ts.map +1 -1
- package/dist/namespace.js +10 -9
- package/dist/namespace.js.map +1 -1
- package/dist/resources/desktop.d.ts +27 -1
- package/dist/resources/desktop.d.ts.map +1 -1
- package/dist/resources/desktop.js +22 -1
- package/dist/resources/desktop.js.map +1 -1
- package/dist/resources/images.d.ts +70 -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/resources/ssh.d.ts +3 -0
- package/dist/resources/ssh.d.ts.map +1 -1
- package/dist/resources/ssh.js +4 -0
- package/dist/resources/ssh.js.map +1 -1
- package/dist/resources/workloads.d.ts +8 -2
- package/dist/resources/workloads.d.ts.map +1 -1
- package/dist/resources/workloads.js +13 -2
- package/dist/resources/workloads.js.map +1 -1
- package/dist/runtime/terminal.d.ts +10 -0
- package/dist/runtime/terminal.d.ts.map +1 -1
- package/dist/runtime/terminal.js +19 -0
- package/dist/runtime/terminal.js.map +1 -1
- package/dist/runtime/ws.d.ts.map +1 -1
- package/dist/runtime/ws.js +6 -2
- package/dist/runtime/ws.js.map +1 -1
- package/dist/types/access.d.ts +65 -0
- package/dist/types/access.d.ts.map +1 -0
- package/dist/types/access.js +2 -0
- package/dist/types/access.js.map +1 -0
- package/dist/types/billing.d.ts +96 -10
- package/dist/types/billing.d.ts.map +1 -1
- package/dist/types/billing.js +0 -8
- package/dist/types/billing.js.map +1 -1
- package/dist/types/client.d.ts +4 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/disks.d.ts +153 -0
- package/dist/types/disks.d.ts.map +1 -0
- package/dist/types/disks.js +2 -0
- package/dist/types/disks.js.map +1 -0
- package/dist/types/index.d.ts +7 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/namespace.d.ts +31 -3
- package/dist/types/namespace.d.ts.map +1 -1
- package/dist/types/runtime.d.ts +3 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/workspace-resources.d.ts +33 -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 +2 -0
- package/dist/workspace-handle.d.ts.map +1 -1
- package/dist/workspace-handle.js +2 -0
- package/dist/workspace-handle.js.map +1 -1
- package/dist/workspace.d.ts +2 -0
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +23 -7
- package/dist/workspace.js.map +1 -1
- package/docs/billing.md +241 -5
- package/docs/desktop.md +32 -0
- package/docs/namespaces.md +62 -1
- package/docs/on-demand.md +43 -0
- package/docs/runtime.md +2 -0
- package/docs/webhooks.md +42 -0
- package/docs/workspace-limit-report.md +6 -0
- package/package.json +1 -1
package/dist/workspace.js
CHANGED
|
@@ -15,6 +15,7 @@ import { ApiAccessResource } from './resources/api-access.js';
|
|
|
15
15
|
import { LogsResource } from './resources/logs.js';
|
|
16
16
|
import { ImagesResource } from './resources/images.js';
|
|
17
17
|
import { DomainsResource } from './resources/domains.js';
|
|
18
|
+
import { WorkspaceDisksResource } from './disks.js';
|
|
18
19
|
/**
|
|
19
20
|
* Default token TTL - 55 minutes.
|
|
20
21
|
* Gateway JWTs typically expire in 60 min; we refresh a bit early.
|
|
@@ -53,6 +54,7 @@ export class Workspace {
|
|
|
53
54
|
/** SSH access - enable, disable, set password/key. */
|
|
54
55
|
ssh;
|
|
55
56
|
desktop;
|
|
57
|
+
disks;
|
|
56
58
|
/** Public port access - expose and revoke ports. */
|
|
57
59
|
publicAccess;
|
|
58
60
|
/** Resources - CPU, memory, disk allocation. */
|
|
@@ -83,7 +85,8 @@ export class Workspace {
|
|
|
83
85
|
this.lifecycle = new LifecycleResource(this._http);
|
|
84
86
|
this.network = new NetworkResource(this._http);
|
|
85
87
|
this.ssh = new SshResource(this._http);
|
|
86
|
-
this.desktop = new DesktopResource(this._http);
|
|
88
|
+
this.desktop = new DesktopResource(this._http, id => this.invalidateRuntime(id));
|
|
89
|
+
this.disks = new WorkspaceDisksResource(this._http);
|
|
87
90
|
this.publicAccess = new PublicAccessResource(this._http);
|
|
88
91
|
this.resources = new ResourcesResource(this._http);
|
|
89
92
|
this.snapshots = new SnapshotsResource(this._http);
|
|
@@ -101,7 +104,7 @@ export class Workspace {
|
|
|
101
104
|
async create(params = {}, options = {}) {
|
|
102
105
|
// Flatten convenience resource fields into config so the backend sees them.
|
|
103
106
|
// Backend extracts cpus/memory_mb/disk_size_mb from config.
|
|
104
|
-
const { cpus, memory_mb, disk_size_mb, wait_ready = true, ready_timeout_seconds = 600, ...rest } = params;
|
|
107
|
+
const { cpus, memory_mb, disk_size_mb, root_disk_id, disks, wait_ready = true, ready_timeout_seconds = 600, ...rest } = params;
|
|
105
108
|
const timeoutMs = options.timeoutMs ?? ready_timeout_seconds * 1000;
|
|
106
109
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0)
|
|
107
110
|
throw new RangeError('Readiness timeout must be positive');
|
|
@@ -112,6 +115,10 @@ export class Workspace {
|
|
|
112
115
|
config.memory_mb = memory_mb;
|
|
113
116
|
if (disk_size_mb !== undefined)
|
|
114
117
|
config.disk_size_mb = disk_size_mb;
|
|
118
|
+
if (root_disk_id !== undefined)
|
|
119
|
+
config.root_disk_id = root_disk_id;
|
|
120
|
+
if (disks !== undefined)
|
|
121
|
+
config.disks = disks;
|
|
115
122
|
const body = { ...rest, config, wait_ready: false };
|
|
116
123
|
const res = await this._http.request({ method: 'POST', path: this._base, body, signal: options.signal });
|
|
117
124
|
if (!wait_ready)
|
|
@@ -208,7 +215,8 @@ export class Workspace {
|
|
|
208
215
|
}
|
|
209
216
|
/** Permanently delete a workspace. */
|
|
210
217
|
async delete(workspaceId) {
|
|
211
|
-
|
|
218
|
+
this.invalidateRuntime(workspaceId);
|
|
219
|
+
return this._http.request({ method: 'DELETE', path: `${this._base}/${workspaceId}` }).finally(() => this.invalidateRuntime(workspaceId));
|
|
212
220
|
}
|
|
213
221
|
/** Get aggregated workspace details. */
|
|
214
222
|
async getDetails(workspaceId) {
|
|
@@ -217,15 +225,21 @@ export class Workspace {
|
|
|
217
225
|
// ── Power / lifecycle shortcuts ───────────────────────────────────
|
|
218
226
|
/** Start a workspace. */
|
|
219
227
|
async start(workspaceId, params) {
|
|
220
|
-
|
|
228
|
+
this.invalidateRuntime(workspaceId);
|
|
229
|
+
return this._http.request({ method: 'POST', path: `${this._base}/${workspaceId}/start`, body: params })
|
|
230
|
+
.finally(() => this.invalidateRuntime(workspaceId));
|
|
221
231
|
}
|
|
222
232
|
/** Stop a workspace. */
|
|
223
233
|
async stop(workspaceId) {
|
|
224
|
-
|
|
234
|
+
this.invalidateRuntime(workspaceId);
|
|
235
|
+
return this._http.request({ method: 'POST', path: `${this._base}/${workspaceId}/stop` })
|
|
236
|
+
.finally(() => this.invalidateRuntime(workspaceId));
|
|
225
237
|
}
|
|
226
238
|
/** Restart a workspace. */
|
|
227
239
|
async restart(workspaceId) {
|
|
228
|
-
|
|
240
|
+
this.invalidateRuntime(workspaceId);
|
|
241
|
+
return this._http.request({ method: 'POST', path: `${this._base}/${workspaceId}/restart` })
|
|
242
|
+
.finally(() => this.invalidateRuntime(workspaceId));
|
|
229
243
|
}
|
|
230
244
|
/** Pause a workspace (preserves memory state). */
|
|
231
245
|
async pause(workspaceId) {
|
|
@@ -233,7 +247,9 @@ export class Workspace {
|
|
|
233
247
|
}
|
|
234
248
|
/** Resume a paused workspace. */
|
|
235
249
|
async resume(workspaceId) {
|
|
236
|
-
|
|
250
|
+
this.invalidateRuntime(workspaceId);
|
|
251
|
+
return this._http.request({ method: 'POST', path: `${this._base}/${workspaceId}/resume` })
|
|
252
|
+
.finally(() => this.invalidateRuntime(workspaceId));
|
|
237
253
|
}
|
|
238
254
|
/** Keep-alive ping - renews TTL for temporary workspaces. */
|
|
239
255
|
async ping(workspaceId, params) {
|
package/dist/workspace.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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AC,CAAC;IACrC,CAAC;IAED,0CAA0C;IAC1C,qBAAqB;QACnB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF"}
|
package/docs/billing.md
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
# Namespace billing
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Namespace management is available from `oblien@2.3.0`; reseller checkout and
|
|
4
|
+
status reads from `2.4.0`. The `2.5.0` source adds typed offer policy/resource
|
|
5
|
+
caps and exported reseller types, with the matching API deployment.
|
|
4
6
|
Each customer uses a namespace with its own subscription, Stripe customer, quota,
|
|
5
7
|
and billing portal. Keep your `admin` or `billing` API key on your server. Resolve
|
|
6
8
|
the namespace from the authenticated customer's record before calling these methods.
|
|
7
9
|
Namespace/workspace tokens cannot access billing.
|
|
10
|
+
New namespace checkouts (custom offers, catalog subscriptions and top-ups) require
|
|
11
|
+
an Enterprise owner account or platform-admin Enterprise grant, in both test and
|
|
12
|
+
live mode. Customer plans do not qualify the owner. Ineligible attempts return
|
|
13
|
+
`403 reseller_enterprise_required` before creating a payment session. The catalog
|
|
14
|
+
advertises `reseller.requiredAccountTier`. Existing customer management, renewals
|
|
15
|
+
and refunds remain processable after an owner downgrade.
|
|
8
16
|
Do not reassign a customer's namespace slug to someone else: its billing history
|
|
9
17
|
stays attached to that owner/namespace identity.
|
|
10
18
|
|
|
19
|
+
Omit `namespace` when creating a personal workspace. Its response has
|
|
20
|
+
`namespace: null`, and billing uses the owner's account wallet and account plan.
|
|
21
|
+
Namespace defaults do not apply to personal workspaces. A namespace literally named
|
|
22
|
+
`default` or `null` is a separate customer budget. An enabled namespace policy,
|
|
23
|
+
including an unlimited one, governs that namespace independently of the owner's
|
|
24
|
+
wallet balance; the wallet still records the charges.
|
|
25
|
+
|
|
11
26
|
```typescript
|
|
12
27
|
import Oblien from 'oblien';
|
|
13
28
|
|
|
@@ -45,13 +60,15 @@ const topup = await client.billing.checkout({
|
|
|
45
60
|
});
|
|
46
61
|
```
|
|
47
62
|
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
For catalog products, use catalog IDs and prices. To own your prices, credits and
|
|
64
|
+
limits, use a [reseller offer](#reseller-offers-price-allowance-and-product-text).
|
|
65
|
+
Return URLs must be host-allowlisted by the operator;
|
|
66
|
+
an unapproved host returns `billing_redirect_not_allowed`. Supplied URLs require HTTPS. Optional `customer` details apply
|
|
50
67
|
to the first namespace checkout, without copying the API-key owner's details.
|
|
51
68
|
Reuse an idempotency key only when retrying the identical request.
|
|
52
69
|
|
|
53
70
|
Paid subscriptions provision the namespace and set its quota. Renewals reset usage
|
|
54
|
-
once per cycle; purchased top-ups increase the ceiling and
|
|
71
|
+
once per cycle; purchased top-ups increase the ceiling and carry only their unused remainder into renewal.
|
|
55
72
|
Top-ups, renewals, and funded policy changes clear suspensions caused by billing;
|
|
56
73
|
manual suspensions stay in place. Workspaces can then be started explicitly.
|
|
57
74
|
|
|
@@ -131,7 +148,226 @@ Subscribe to `payment.succeeded`, `entitlement.changed`, `subscription.renewed`,
|
|
|
131
148
|
`subscription.updated`, `subscription.past_due`, `subscription.canceled`,
|
|
132
149
|
`subscription.tier_changed`, `namespace.suspended`, and `namespace.restored` using
|
|
133
150
|
`client.webhooks`. Verify the signature on raw bytes and deduplicate event IDs.
|
|
134
|
-
|
|
151
|
+
Billing events use a durable outbox with retry. Reconcile with `entitlement()` and
|
|
135
152
|
`subscription()` when the customer returns to billing or an event is missed.
|
|
136
153
|
|
|
137
154
|
[Full API contract](https://oblien.com/docs/api/billing)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
## Reseller offers: price, allowance and product text
|
|
158
|
+
|
|
159
|
+
`POST /billing/checkout` also accepts a server-defined `offer` instead of a catalog `planTierId` or `packId`. Keep this request behind your authenticated backend and resolve the customer's namespace from your own database.
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"namespace": "tenant-a",
|
|
164
|
+
"kind": "subscription",
|
|
165
|
+
"billingInterval": "monthly",
|
|
166
|
+
"offer": {
|
|
167
|
+
"reference": "compute-starter-v1",
|
|
168
|
+
"name": "Compute Starter",
|
|
169
|
+
"description": "Your hosted application compute plan",
|
|
170
|
+
"unitAmount": 1000,
|
|
171
|
+
"currency": "usd",
|
|
172
|
+
"credits": 100,
|
|
173
|
+
"policy": { "overdraft": 0, "suspendThreshold": 0, "onOverdraftAction": "stop_workspaces" },
|
|
174
|
+
"resourceLimits": { "max_workspaces": 2, "max_vcpus": 2, "max_ram_mb": 4096, "max_disk_gb": 32 }
|
|
175
|
+
},
|
|
176
|
+
"metadata": { "appOrderId": "order-123", "planVersion": "1" },
|
|
177
|
+
"idempotencyKey": "order-123",
|
|
178
|
+
"customer": { "email": "customer@example.com" },
|
|
179
|
+
"successUrl": "https://app.example.com/billing/return",
|
|
180
|
+
"cancelUrl": "https://app.example.com/billing"
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
This charges **$10**, funds the **owner's Oblien wallet** at the standard rate (currently **1,000 platform credits**), and grants **100 namespace credits**. It does not pay out to the reseller. Checkout and invoices use the chosen product name/description. Those display fields do not grant CPU minutes or increase account resource capacity. `kind: 'topup'` adds the allowance as purchased credits; `subscription` sets the included allowance for each paid monthly/yearly cycle. Unused purchased credits carry across renewals; spent top-ups do not replenish.
|
|
185
|
+
|
|
186
|
+
| Field | Contract |
|
|
187
|
+
| --- | --- |
|
|
188
|
+
| `offer.reference` | Optional application catalog reference, at most 100 characters |
|
|
189
|
+
| `offer.name` | Required customer-facing name, at most 120 characters |
|
|
190
|
+
| `offer.description` | Optional customer-facing text, at most 500 characters |
|
|
191
|
+
| `offer.unitAmount` | Required integer USD cents, 100–1,000,000 ($1–$10,000) |
|
|
192
|
+
| `offer.currency` | `usd` only; defaults to `usd` |
|
|
193
|
+
| `offer.credits` | Required integer namespace allowance, 1–1,000,000,000; independent of wallet funding |
|
|
194
|
+
| `offer.policy` | Subscription only: optional `overdraft`, `suspendThreshold`, `onOverdraftAction`; defaults to zero grace and `stop_workspaces` |
|
|
195
|
+
| `offer.resourceLimits` | Subscription only: nonempty subset of `max_workspaces`, `max_vcpus`, `max_ram_mb`, `max_disk_gb`; values are integers 0–1,000,000,000 or `null` |
|
|
196
|
+
| `metadata` | Optional, only with `offer`: at most 35 string entries; key `[A-Za-z0-9_]`, length 1–40; value at most 500 characters without control characters |
|
|
197
|
+
| `idempotencyKey` | Required with `offer`, nonempty string up to 200 characters; reuse only for an identical request |
|
|
198
|
+
|
|
199
|
+
Metadata may not override `service`, `user_id`, `client_id`, `namespace`, `billing_order_id`, `kind`, `credits`, `amount`, `credits_per_cycle`, `plan_family`, `billing_interval`, prototype keys, or any `oblien_` or `promotion_` prefix. Unknown offer fields are rejected. Customer accepts only `email` and/or `name`; provider customer IDs are never accepted. Custom offers support Oblien-admin promotions when `allowPromotionCodes: true` is supplied. Trials, proration, direct Stripe code entry, and portal price changes remain unsupported.
|
|
200
|
+
|
|
201
|
+
The contract is saved before contacting the provider. It binds owner, namespace, amount, allowance, metadata, provider customer and checkout mode. Reusing a key with a changed request returns `409 billing_idempotency_conflict`. An interrupted checkout older than the provider's safe idempotency window returns `409 billing_checkout_reconciliation_required`; do not create another payment blindly.
|
|
202
|
+
|
|
203
|
+
### Saved policy and resource caps
|
|
204
|
+
|
|
205
|
+
Check `billing.catalog().reseller` before enabling offers with policy or limits:
|
|
206
|
+
`contractVersion >= 2`, `offerPolicy: true`, `resourceLimits: true`, and
|
|
207
|
+
`effectiveResourceLimits: true` identify support in the deployed API. A dashboard-only deployment does not add this API
|
|
208
|
+
capability. SDK 2.4.0 already transports reseller offers; the 2.5.0 source adds
|
|
209
|
+
these TypeScript fields and public reseller type exports.
|
|
210
|
+
|
|
211
|
+
Grace is zero by default. To permit 60 extra namespace credits, save
|
|
212
|
+
`policy: { overdraft: 60, suspendThreshold: 60, onOverdraftAction: 'stop_workspaces' }`
|
|
213
|
+
on the subscription offer. `suspendThreshold` must be at least `overdraft`.
|
|
214
|
+
`quota.balance` already includes grace (`limit + overdraft - used`); never add it
|
|
215
|
+
again on the client. A top-up adds purchased allowance and cannot change policy
|
|
216
|
+
or resource caps.
|
|
217
|
+
|
|
218
|
+
The saved price, allowance, metadata, grace and resource caps are reused for
|
|
219
|
+
renewals. Editing your catalog does not alter existing subscriptions. The cycle
|
|
220
|
+
checkpoint, allowance reset, grace and receipt allocation commit in one database
|
|
221
|
+
transaction. VM admission reads caps from that committed cycle, so a missed
|
|
222
|
+
reseller webhook cannot leave a larger namespace mirror as a bypass. A full
|
|
223
|
+
refund of the current cycle removes its remaining allowance and grace; an old
|
|
224
|
+
invoice refund cannot erase a newer cycle.
|
|
225
|
+
|
|
226
|
+
`max_workspaces` counts allocated workspaces in this namespace. CPU, RAM and disk
|
|
227
|
+
are per-workspace caps. Oblien resolves the strictest cap from the saved offer,
|
|
228
|
+
configured namespace policy, owner account and platform. `null` inherits capacity;
|
|
229
|
+
it never removes another layer's restriction. Clients submit policy directly
|
|
230
|
+
without fetching account quota or calculating capacity. Namespace detail and
|
|
231
|
+
mutation responses expose `effective_resource_limits` separately from the saved
|
|
232
|
+
`resource_limits`; these are ceilings, not capacity reservations. Concurrent
|
|
233
|
+
creates reserve slots under a namespace lock. Create, resize and subsequent VM
|
|
234
|
+
start/resume/wake/snapshot-resume check the caps. Lowering limits does not delete
|
|
235
|
+
existing workspaces or resize running machines; arrange any necessary cleanup
|
|
236
|
+
or stop/resize before moving customers to a smaller plan. Service, project,
|
|
237
|
+
seat and other application limits belong to your application and can be saved
|
|
238
|
+
as versioned metadata; Oblien does not interpret those metadata fields.
|
|
239
|
+
|
|
240
|
+
Only the namespace receives this subscription. Owner plan reads, owner portal
|
|
241
|
+
customer lookup and owner plan replacement exclude namespace subscriptions.
|
|
242
|
+
The owner's wallet receives payment funding, and that wallet entry does not
|
|
243
|
+
change the owner's platform plan.
|
|
244
|
+
|
|
245
|
+
Stripe, the payment database, namespace storage and VM hosts are separate
|
|
246
|
+
systems. The whole network operation is not one distributed transaction:
|
|
247
|
+
receipts and cycle checkpoints make retries safe, and fresh entitlement/status
|
|
248
|
+
reads prevent a checkout redirect from granting access before fulfillment.
|
|
249
|
+
|
|
250
|
+
### Inspect a reseller checkout
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
GET /billing/checkout/:checkoutId?namespace=tenant-a
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Requires an `admin` or `billing` credential. Looks up both owner and namespace before contacting Stripe. Returns `404 no_checkout` for an unknown or differently scoped session. This lookup supports saved reseller offers; catalog payments use entitlement/subscription and payment events.
|
|
257
|
+
|
|
258
|
+
```json
|
|
259
|
+
{
|
|
260
|
+
"success": true,
|
|
261
|
+
"namespace": "tenant-a",
|
|
262
|
+
"checkout": {
|
|
263
|
+
"id": "cs_...",
|
|
264
|
+
"kind": "subscription",
|
|
265
|
+
"status": "complete",
|
|
266
|
+
"paymentStatus": "paid",
|
|
267
|
+
"fulfilled": true,
|
|
268
|
+
"fulfillmentStatus": "completed",
|
|
269
|
+
"walletCreditsGranted": 1000,
|
|
270
|
+
"namespaceCreditsGranted": 100,
|
|
271
|
+
"billingInterval": "monthly",
|
|
272
|
+
"subscriptionId": "sub_...",
|
|
273
|
+
"offer": {
|
|
274
|
+
"reference": "compute-starter-v1",
|
|
275
|
+
"name": "Compute Starter",
|
|
276
|
+
"unitAmount": 1000,
|
|
277
|
+
"currency": "usd",
|
|
278
|
+
"credits": 100
|
|
279
|
+
},
|
|
280
|
+
"metadata": { "appOrderId": "order-123", "planVersion": "1" }
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
`fulfilled` means initial processing finished; always inspect the net credit fields and `fulfillmentStatus` for `partially_refunded`, `refunded` or `disputed`. Use `GET /billing/entitlement` and `/billing/balance` for current access. The lookup describes the checkout's initial payment, not its later renewal invoices. Reseller subscriptions also expose `offer` and `metadata` through `GET /billing/subscription`; their `tierId` is `reseller` and does not upgrade owner capacity.
|
|
286
|
+
|
|
287
|
+
Custom `payment.succeeded`, `subscription.renewed` and `entitlement.changed` events include `orgRef`, `namespace`, `kind`, `checkoutId`, `paymentId`, saved `offer`, application `metadata`, `amount: { unitAmount, currency }`, net `walletCredits` and `namespaceCredits`. Fulfillment uses stable receipt-based event IDs. Verify the raw-body HMAC, deduplicate by event ID, then re-read entitlement to handle reordering. Financial billing events are committed to a durable outbox with retries. Keep reconciliation polling to handle delayed or exhausted delivery and event reordering.
|
|
288
|
+
|
|
289
|
+
### Useful checkout and portal errors
|
|
290
|
+
|
|
291
|
+
Billing responses include a safe diagnostic code and message. Internal failures include a `details.reference` correlated with backend logs; SQL and raw provider requests are not returned.
|
|
292
|
+
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"success": false,
|
|
296
|
+
"error": "billing_database_collation_error",
|
|
297
|
+
"code": "billing_database_collation_error",
|
|
298
|
+
"message": "Oblien billing storage is misconfigured. Contact Oblien support with the reference below.",
|
|
299
|
+
"details": {
|
|
300
|
+
"cause": "ER_CANT_AGGREGATE_NCOLLATIONS",
|
|
301
|
+
"retryable": false,
|
|
302
|
+
"reference": "support-reference"
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
| HTTP | Code | Action |
|
|
308
|
+
| --- | --- | --- |
|
|
309
|
+
| 400 | `invalid_offer`, `invalid_billing_metadata`, `ambiguous_checkout_offer` | Correct the backend request |
|
|
310
|
+
| 400 | `billing_redirect_not_allowed` | Ask the operator to allowlist the browser return host in `REDIRECT_ALLOWED_HOSTS` |
|
|
311
|
+
| 401 / 403 | authentication or scope error | Use deployed routes and server-side `admin`/`billing` credentials |
|
|
312
|
+
| 404 | `no_customer`, `no_subscription`, `no_checkout` | No matching record in this owner/namespace; never fall back to another customer |
|
|
313
|
+
| 409 | `billing_customer_conflict`, `billing_identity_conflict` | Reconcile an isolated customer binding; do not bypass the check |
|
|
314
|
+
| 409 | `billing_idempotency_conflict`, `billing_checkout_reconciliation_required` | Reconcile the existing application order |
|
|
315
|
+
| 502 / 503 | `billing_provider_configuration_error`, `billing_provider_unavailable`, `billing_provider_rejected`, `billing_storage_unavailable`, `billing_database_collation_error` | Display the safe message/reference and fix the provider or backend configuration |
|
|
316
|
+
|
|
317
|
+
Supplied checkout and portal return URLs must be HTTPS and allowlisted. An invalid host returns an error; it is not silently replaced. Omitted URLs use the platform default. Retrying payment creation must reuse the original idempotency key.
|
|
318
|
+
|
|
319
|
+
SDK 2.4.0 adds typed `offer`/`metadata` and `client.billing.checkoutStatus(namespace, checkoutId)`. For a complete customer onboarding, resource-limit, VM creation and signed webhook walkthrough, see [Build a SaaS or VM reseller](https://oblien.com/docs/saas-reselling).
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
## Promotion codes
|
|
323
|
+
|
|
324
|
+
Oblien uses Stripe for collection and validates its own administrator-issued codes before creating the Stripe Checkout Session. Native Stripe metadata does not restrict a code to an Oblien owner or namespace, and a native percentage coupon has no dollar cap. Do not enable unrestricted Stripe code entry or use metadata as authorization.
|
|
325
|
+
|
|
326
|
+
Enable the promotion step for a namespace checkout on your server:
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
const { url, checkoutId } = await client.billing.checkout({
|
|
330
|
+
namespace: customer.namespace, // Resolve from your authenticated customer.
|
|
331
|
+
kind: 'subscription',
|
|
332
|
+
billingInterval: 'monthly',
|
|
333
|
+
offer: {
|
|
334
|
+
reference: 'starter-v1', name: 'Starter', description: 'Your chosen CPU-minute allowance',
|
|
335
|
+
unitAmount: 1000, currency: 'usd', credits: 100,
|
|
336
|
+
policy: { overdraft: 0, suspendThreshold: 0, onOverdraftAction: 'stop_workspaces' },
|
|
337
|
+
resourceLimits: { max_workspaces: 3 },
|
|
338
|
+
},
|
|
339
|
+
allowPromotionCodes: true,
|
|
340
|
+
successUrl: 'https://your-app.com/billing?checkout={CHECKOUT_SESSION_ID}',
|
|
341
|
+
cancelUrl: 'https://your-app.com/billing',
|
|
342
|
+
idempotencyKey: `checkout-${order.id}`,
|
|
343
|
+
});
|
|
344
|
+
// Save checkoutId with the customer/order and redirect to url unchanged.
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
`allowPromotionCodes` is a strict boolean. For `POST /billing/checkout`, omit it or set it to `false` for direct Stripe checkout without code entry. `true` enables Oblien's payment page. A reseller cannot issue codes, override eligibility, choose a coupon, or supply a discount amount. Its authenticated owner ID and saved namespace determine eligibility. Enterprise reseller eligibility and saved quotas/resource caps still apply.
|
|
348
|
+
|
|
349
|
+
For Oblien's own `POST /credits/purchase` and `POST /credits/subscribe`, code entry is enabled by default and can be disabled with the same flag. `GET /billing/catalog` advertises `promotions.enabled`, `customerEntry: "oblien_hosted"`, `firstPaymentOnly`, `preservesCredits`, `canDisable`, and `namespaceOptIn`.
|
|
350
|
+
|
|
351
|
+
The enabled response may contain `https://api.oblien.com/billing/pay#<capability>` and an ID starting with `bco_`. Treat both checkout IDs and returned URLs as opaque; do not require a Stripe `cs_` ID. If enforcing a redirect allowlist, allow HTTPS on `api.oblien.com` with exactly `/billing/pay`, no query, credentials or custom port, and a 43-character base64url fragment, as well as your existing Stripe checkout host. Never log the capability or put it in analytics. It grants access to one checkout, not a billing portal or account. The page removes the fragment from the address bar and uses no login-cookie authority.
|
|
352
|
+
|
|
353
|
+
The `{CHECKOUT_SESSION_ID}` return placeholder is replaced with the same public checkout ID that was saved with the order. `billing.checkoutStatus(namespace, checkoutId)` and signed billing events retain that ID. A browser return is not payment proof: use the verified payment event and re-read status/entitlement.
|
|
354
|
+
|
|
355
|
+
### Administrator rules and financial treatment
|
|
356
|
+
|
|
357
|
+
Create, inspect usage, or disable a promotion at **https://admin.oblien.com/promotions**. Only platform operators with `promotions.manage` can create or disable codes, using the existing MFA, idempotent operation queue and audit trail.
|
|
358
|
+
|
|
359
|
+
Rules include fixed USD amount or percentage plus a required USD cap; minimum purchase; start and expiry; finite total uses; optional uses per owner and per namespace; eligible owner IDs or all owners; account/namespace/both scope; and top-up/subscription checkout kinds. A code for owner `80` in namespace scope can be used only for namespaces under owner `80`. To allow multiple reseller customers, avoid a per-owner limit of one; use per-namespace limits and a bounded total. Rules are immutable; disable a campaign and create a new code to change them. Test and live campaigns are isolated, including queued admin creation.
|
|
360
|
+
|
|
361
|
+
Promotions apply to the **first payment only**. They do not stack. A $10 offer with a 50% promotion charges $5, funds the full 1,000 Oblien wallet credits at the current standard rate, and grants the offer's independently declared 100 namespace credits. Oblien funds the $5 discount; the receipt and ledger retain list price, cash paid, discount and campaign. Subsequent renewals charge $10 and grant the normal credits/quotas. Any admin-approved plan change uses its separately saved renewal price and credit terms. A namespace payment never subscribes the reseller's owner account to the namespace plan.
|
|
362
|
+
|
|
363
|
+
The discount cannot exceed the price. A resulting USD total must be zero or at least $0.50. A zero total requires a verified completed Stripe checkout marked paid or no-payment-required; an unpaid or open session never grants credits. This is a promotional subsidy, not test credit.
|
|
364
|
+
|
|
365
|
+
### Retries, expiry and refunds
|
|
366
|
+
|
|
367
|
+
Previewing a code consumes no use. Confirming locks the campaign and reserves one use with an immutable checkout selection. The reservation counts against all applicable limits immediately, including concurrent checkouts. The payment session lasts 45 minutes; disabling or expiring a code stops new reservations but honors already reserved payments until their payment session expires. Unstarted links expire after 24 hours. The recovery worker releases abandoned reservations only after confirming that payment is no longer possible.
|
|
368
|
+
|
|
369
|
+
The verified payment receipt, promotion redemption, wallet credit, namespace allowance/cycle, saved resource policy and billing-event outbox commit in the financial transaction. Replayed provider events cannot grant twice. External Stripe calls are recovered with stable idempotency keys and provider reads; they do not form a distributed SQL transaction.
|
|
370
|
+
|
|
371
|
+
Refund only the cash actually collected through Stripe's authorized refund controls. Credits, including the funded discount, are reversed proportionally: refunding all $5 above reverses the full 1,000 wallet credits and the corresponding 100 namespace credits. Reversing an old subscription payment cannot reduce a later cycle's allowance. Refunds and disputes retain the original code use. Oblien's admin promotion page does not initiate cash refunds.
|
|
372
|
+
|
|
373
|
+
Errors use `{ success:false, code, message, requestId }`, with safe diagnostic details when available. Codes include `promotion_unavailable`, `promotion_expired`, `promotion_limit_reached`, `promotion_minimum_amount`, `promotion_payment_too_small`, `checkout_already_started`, `checkout_expired`, and `checkout_rate_limit`. Do not retry a changed selection under the same checkout ID: continue the saved payment or start a new checkout with a new idempotency key.
|
package/docs/desktop.md
CHANGED
|
@@ -26,6 +26,38 @@ Creation accepts `config.desktop: { enabled: true }`. Live changes use these
|
|
|
26
26
|
methods without changing CPU, RAM or boot settings. `forTarget()` changes command
|
|
27
27
|
and file targets, while desktop continues to address the workspace image.
|
|
28
28
|
|
|
29
|
+
## Add desktop
|
|
30
|
+
|
|
31
|
+
Ubuntu 24.04/26.04 and Debian 13 offer prepared Cinnamon layers. Discover choices
|
|
32
|
+
from the owned workspace, then add the selected desktop:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const desktop = client.workspace(workspaceId).desktop;
|
|
36
|
+
const installation = await desktop.installation();
|
|
37
|
+
if (installation.choices?.length) {
|
|
38
|
+
await desktop.install({ desktop: installation.choices[0].id, restart: true });
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`restart: true` explicitly permits restarting a running workspace. Stopped
|
|
43
|
+
workspaces stay stopped. Poll `installation()` while `phase === 'installing'`;
|
|
44
|
+
`stage` describes progress. Completion is `ready`, or `stopped` with
|
|
45
|
+
`installed: true`. Failures include `error`; retry after fixing the cause.
|
|
46
|
+
An explicit Stop cancels the preparer's deferred restart.
|
|
47
|
+
|
|
48
|
+
After preparation, obtain the current connection with
|
|
49
|
+
`await client.workspace(workspaceId).runtime()`. Recreate any Runtime object or
|
|
50
|
+
stream held across the restart, as with an ordinary workspace restart.
|
|
51
|
+
|
|
52
|
+
Prepared programs are shared read-only with private profiles and writes. There
|
|
53
|
+
are no per-workspace downloads, public desktop disk IDs or extra image names.
|
|
54
|
+
Creation with `config.desktop.enabled: true` attaches before first boot and
|
|
55
|
+
honors normal `wait_ready`. Compatible custom/application images without a
|
|
56
|
+
prepared choice still support `install()` using the download-based recipe.
|
|
57
|
+
|
|
58
|
+
Use `client.disks.listSoftware({ workspace_id: workspaceId })` to browse software
|
|
59
|
+
compatible with a workspace's base OS. Desktop artifacts remain internal.
|
|
60
|
+
|
|
29
61
|
## CLI
|
|
30
62
|
|
|
31
63
|
The desktop-enabled 2.3.2 build is an official downloadable package:
|
package/docs/namespaces.md
CHANGED
|
@@ -6,6 +6,13 @@ Group workspaces into isolated namespaces with **resource limits**, **spending q
|
|
|
6
6
|
const ns = client.namespaces;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
Account namespace counts are enforced atomically by both `create` and `ensure`:
|
|
10
|
+
the owner row is locked and the count and namespace insert share a transaction.
|
|
11
|
+
At the account limit a new namespace returns `409 namespace_limit_exceeded`;
|
|
12
|
+
ensuring an existing namespace remains idempotent. The owner's paid or
|
|
13
|
+
admin-granted Enterprise tier has no namespace-count cap. A customer namespace
|
|
14
|
+
subscription cannot raise it.
|
|
15
|
+
|
|
9
16
|
## Create + resource limits
|
|
10
17
|
|
|
11
18
|
```typescript
|
|
@@ -20,7 +27,19 @@ const { data } = await ns.create({
|
|
|
20
27
|
});
|
|
21
28
|
```
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
Workspace count is reserved **atomically at workspace create**; effective resource caps are checked at create, resize and start/resume/restart/wake/snapshot-resume — over-limit returns `409 NAMESPACE_LIMIT_REACHED`. `max_workspaces` is race-proof (the namespace row is locked + the count re-checked inside the insert transaction). Update them with `ns.update(id, { resource_limits })`.
|
|
31
|
+
|
|
32
|
+
Declare policy directly. `null` inherits Oblien capacity; zero denies that
|
|
33
|
+
allocation. VM policy integers may exceed current capacity: Oblien applies the
|
|
34
|
+
strictest declared, committed paid-offer, account and platform cap. Clients do
|
|
35
|
+
not calculate or copy the account's machine ceiling into customer contracts.
|
|
36
|
+
Invalid numbers and unknown keys return `invalid_resource_limits`.
|
|
37
|
+
|
|
38
|
+
`create`, `ensure`, `get` and `update` expose both `data.resource_limits` (saved
|
|
39
|
+
policy) and `data.effective_resource_limits` (current enforced ceilings). The
|
|
40
|
+
latter can change with account capacity while saved customer terms stay intact.
|
|
41
|
+
These limits do not reserve host capacity or funds. Account pool usage and
|
|
42
|
+
credits are checked independently at allocation time.
|
|
24
43
|
|
|
25
44
|
## Lifecycle
|
|
26
45
|
|
|
@@ -67,3 +86,45 @@ data.totals.vcpu_hours; // cpu_time_minutes/60, gb_hours, network_gb, disk_io_
|
|
|
67
86
|
A namespace-scoped key is pinned to its namespace: list/get/usage/webhooks all auto-filter to it, and it can't widen scope. `user_id` is always the tenant gate.
|
|
68
87
|
|
|
69
88
|
**Full reference:** [Namespaces API](https://oblien.com/docs/api/namespaces)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## Namespace credit alerts and customer recovery
|
|
92
|
+
|
|
93
|
+
Oblien computes the warning state from the same quota row that enforces spending.
|
|
94
|
+
Read `quota.alert` from `GET /billing/entitlement?namespace=...`, or `alert` from
|
|
95
|
+
`GET /billing/balance?namespace=...`. Namespace quota rows also include `alert`.
|
|
96
|
+
Its `state` is `ok`, `low`, `grace`, `depleted`, `unlimited`, or `disabled`.
|
|
97
|
+
`percent` uses **included allowance + purchased top-ups**, excluding grace.
|
|
98
|
+
`remaining` is paid allowance left; `balance` also includes configured grace.
|
|
99
|
+
All amounts are JSON numbers in Oblien credits. Never add grace to `balance` again.
|
|
100
|
+
|
|
101
|
+
Subscribe to `namespace.quota.threshold`, `credits.low`, and `credits.depleted`:
|
|
102
|
+
|
|
103
|
+
- Warning percentages default to **80% and 95%** and can be configured per service.
|
|
104
|
+
`notificationThresholds: []` disables percentage warnings, not enforcement or
|
|
105
|
+
exhaustion alerts. A large usage window reports the most urgent crossed state.
|
|
106
|
+
- `credits.low` reports entry into configured grace. Zero grace remains the default.
|
|
107
|
+
`credits.depleted` reports exhaustion at `balance <= 0`.
|
|
108
|
+
- The usage debit, threshold marker and outgoing alert commit in **one payments
|
|
109
|
+
transaction**. Delivery retries after failures and API restarts, retaining its
|
|
110
|
+
signed body and event ID. Metering does not wait for your webhook or email server.
|
|
111
|
+
- Each event identifies `data.namespace`, `data.service`, `data.transaction_id`
|
|
112
|
+
and a numeric `data.alert` snapshot. Resolve the customer from your saved namespace
|
|
113
|
+
mapping, verify the signature, and durably save the event and notification job
|
|
114
|
+
before acknowledging. Deduplicate event IDs, then re-read current entitlement;
|
|
115
|
+
an old alert may arrive after a top-up or renewal. Do not use event amounts to
|
|
116
|
+
grant credits or override the current quota.
|
|
117
|
+
- Show a warning banner and a billing action. Use your server-defined top-up offer
|
|
118
|
+
to create a namespace-bound checkout after the customer chooses to buy. Payment
|
|
119
|
+
fulfillment increases purchased allowance once; your next entitlement read
|
|
120
|
+
clears the warning when funded. Workspaces stopped for billing can then be
|
|
121
|
+
restarted. A top-up does not change the plan's resource caps or grace policy.
|
|
122
|
+
- Paid renewals re-arm warnings and preserve custom notification percentages.
|
|
123
|
+
A top-up or usage refund that lowers usage below a warning band re-arms that
|
|
124
|
+
band for the larger remaining budget. Mode A cycles must still be reset by
|
|
125
|
+
your backend; Mode B cycles renew after verified paid invoices.
|
|
126
|
+
|
|
127
|
+
External email delivery is asynchronous and can repeat after a lost acknowledgment.
|
|
128
|
+
Use a durable notification queue, honor verified recipient preferences, recheck
|
|
129
|
+
organization membership before delivery, and bind billing links to the intended
|
|
130
|
+
organization. Keep a read-only dashboard warning while email is unavailable.
|
|
@@ -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.
|
package/docs/runtime.md
CHANGED
|
@@ -10,6 +10,8 @@ const rt = await client.workspace('ws_abc').runtime();
|
|
|
10
10
|
|
|
11
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
12
|
|
|
13
|
+
After starting, stopping, restarting or resuming a workspace, call `workspace.runtime()` again. These lifecycle calls invalidate its cached connection; an already-held `Runtime` object is not rewritten. Use `runtime({ force: true })` when the workspace was restarted outside this client.
|
|
14
|
+
|
|
13
15
|
## Namespaces
|
|
14
16
|
|
|
15
17
|
| Namespace | What it does |
|