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.
Files changed (112) hide show
  1. package/README.md +1 -0
  2. package/dist/access.d.ts +79 -0
  3. package/dist/access.d.ts.map +1 -0
  4. package/dist/access.js +42 -0
  5. package/dist/access.js.map +1 -0
  6. package/dist/billing.d.ts +19 -10
  7. package/dist/billing.d.ts.map +1 -1
  8. package/dist/billing.js +22 -9
  9. package/dist/billing.js.map +1 -1
  10. package/dist/cli/commands/desktop.d.ts.map +1 -1
  11. package/dist/cli/commands/desktop.js +6 -2
  12. package/dist/cli/commands/desktop.js.map +1 -1
  13. package/dist/cli/commands/lifecycle.d.ts.map +1 -1
  14. package/dist/cli/commands/lifecycle.js +22 -0
  15. package/dist/cli/commands/lifecycle.js.map +1 -1
  16. package/dist/cli/commands/scp.js +9 -2
  17. package/dist/cli/commands/scp.js.map +1 -1
  18. package/dist/cli/commands/ssh.d.ts.map +1 -1
  19. package/dist/cli/commands/ssh.js +12 -0
  20. package/dist/cli/commands/ssh.js.map +1 -1
  21. package/dist/cli/commands/workloads.d.ts.map +1 -1
  22. package/dist/cli/commands/workloads.js +26 -2
  23. package/dist/cli/commands/workloads.js.map +1 -1
  24. package/dist/cli/commands/workspaces.d.ts.map +1 -1
  25. package/dist/cli/commands/workspaces.js +11 -0
  26. package/dist/cli/commands/workspaces.js.map +1 -1
  27. package/dist/client.d.ts +8 -0
  28. package/dist/client.d.ts.map +1 -1
  29. package/dist/client.js +12 -0
  30. package/dist/client.js.map +1 -1
  31. package/dist/disks.d.ts +49 -0
  32. package/dist/disks.d.ts.map +1 -0
  33. package/dist/disks.js +143 -0
  34. package/dist/disks.js.map +1 -0
  35. package/dist/http.d.ts +2 -0
  36. package/dist/http.d.ts.map +1 -1
  37. package/dist/http.js +12 -0
  38. package/dist/http.js.map +1 -1
  39. package/dist/index.d.ts +7 -2
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +2 -0
  42. package/dist/index.js.map +1 -1
  43. package/dist/namespace.d.ts +14 -11
  44. package/dist/namespace.d.ts.map +1 -1
  45. package/dist/namespace.js +10 -9
  46. package/dist/namespace.js.map +1 -1
  47. package/dist/resources/desktop.d.ts +27 -1
  48. package/dist/resources/desktop.d.ts.map +1 -1
  49. package/dist/resources/desktop.js +22 -1
  50. package/dist/resources/desktop.js.map +1 -1
  51. package/dist/resources/images.d.ts +70 -1
  52. package/dist/resources/images.d.ts.map +1 -1
  53. package/dist/resources/images.js.map +1 -1
  54. package/dist/resources/lifecycle.d.ts +11 -2
  55. package/dist/resources/lifecycle.d.ts.map +1 -1
  56. package/dist/resources/lifecycle.js +7 -2
  57. package/dist/resources/lifecycle.js.map +1 -1
  58. package/dist/resources/ssh.d.ts +3 -0
  59. package/dist/resources/ssh.d.ts.map +1 -1
  60. package/dist/resources/ssh.js +4 -0
  61. package/dist/resources/ssh.js.map +1 -1
  62. package/dist/resources/workloads.d.ts +8 -2
  63. package/dist/resources/workloads.d.ts.map +1 -1
  64. package/dist/resources/workloads.js +13 -2
  65. package/dist/resources/workloads.js.map +1 -1
  66. package/dist/runtime/terminal.d.ts +10 -0
  67. package/dist/runtime/terminal.d.ts.map +1 -1
  68. package/dist/runtime/terminal.js +19 -0
  69. package/dist/runtime/terminal.js.map +1 -1
  70. package/dist/runtime/ws.d.ts.map +1 -1
  71. package/dist/runtime/ws.js +6 -2
  72. package/dist/runtime/ws.js.map +1 -1
  73. package/dist/types/access.d.ts +65 -0
  74. package/dist/types/access.d.ts.map +1 -0
  75. package/dist/types/access.js +2 -0
  76. package/dist/types/access.js.map +1 -0
  77. package/dist/types/billing.d.ts +96 -10
  78. package/dist/types/billing.d.ts.map +1 -1
  79. package/dist/types/billing.js +0 -8
  80. package/dist/types/billing.js.map +1 -1
  81. package/dist/types/client.d.ts +4 -0
  82. package/dist/types/client.d.ts.map +1 -1
  83. package/dist/types/disks.d.ts +153 -0
  84. package/dist/types/disks.d.ts.map +1 -0
  85. package/dist/types/disks.js +2 -0
  86. package/dist/types/disks.js.map +1 -0
  87. package/dist/types/index.d.ts +7 -4
  88. package/dist/types/index.d.ts.map +1 -1
  89. package/dist/types/namespace.d.ts +31 -3
  90. package/dist/types/namespace.d.ts.map +1 -1
  91. package/dist/types/runtime.d.ts +3 -1
  92. package/dist/types/runtime.d.ts.map +1 -1
  93. package/dist/types/workspace-resources.d.ts +33 -0
  94. package/dist/types/workspace-resources.d.ts.map +1 -1
  95. package/dist/types/workspace.d.ts +41 -3
  96. package/dist/types/workspace.d.ts.map +1 -1
  97. package/dist/workspace-handle.d.ts +2 -0
  98. package/dist/workspace-handle.d.ts.map +1 -1
  99. package/dist/workspace-handle.js +2 -0
  100. package/dist/workspace-handle.js.map +1 -1
  101. package/dist/workspace.d.ts +2 -0
  102. package/dist/workspace.d.ts.map +1 -1
  103. package/dist/workspace.js +23 -7
  104. package/dist/workspace.js.map +1 -1
  105. package/docs/billing.md +241 -5
  106. package/docs/desktop.md +32 -0
  107. package/docs/namespaces.md +62 -1
  108. package/docs/on-demand.md +43 -0
  109. package/docs/runtime.md +2 -0
  110. package/docs/webhooks.md +42 -0
  111. package/docs/workspace-limit-report.md +6 -0
  112. package/package.json +1 -1
package/docs/webhooks.md CHANGED
@@ -40,3 +40,45 @@ await wh.delete(webhook.id);
40
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
41
 
42
42
  **Full reference:** [Webhooks concept](https://oblien.com/docs/concepts/webhooks)
43
+
44
+
45
+ ## Namespace credit alerts and customer recovery
46
+
47
+ Oblien computes the warning state from the same quota row that enforces spending.
48
+ Read `quota.alert` from `GET /billing/entitlement?namespace=...`, or `alert` from
49
+ `GET /billing/balance?namespace=...`. Namespace quota rows also include `alert`.
50
+ Its `state` is `ok`, `low`, `grace`, `depleted`, `unlimited`, or `disabled`.
51
+ `percent` uses **included allowance + purchased top-ups**, excluding grace.
52
+ `remaining` is paid allowance left; `balance` also includes configured grace.
53
+ All amounts are JSON numbers in Oblien credits. Never add grace to `balance` again.
54
+
55
+ Subscribe to `namespace.quota.threshold`, `credits.low`, and `credits.depleted`:
56
+
57
+ - Warning percentages default to **80% and 95%** and can be configured per service.
58
+ `notificationThresholds: []` disables percentage warnings, not enforcement or
59
+ exhaustion alerts. A large usage window reports the most urgent crossed state.
60
+ - `credits.low` reports entry into configured grace. Zero grace remains the default.
61
+ `credits.depleted` reports exhaustion at `balance <= 0`.
62
+ - The usage debit, threshold marker and outgoing alert commit in **one payments
63
+ transaction**. Delivery retries after failures and API restarts, retaining its
64
+ signed body and event ID. Metering does not wait for your webhook or email server.
65
+ - Each event identifies `data.namespace`, `data.service`, `data.transaction_id`
66
+ and a numeric `data.alert` snapshot. Resolve the customer from your saved namespace
67
+ mapping, verify the signature, and durably save the event and notification job
68
+ before acknowledging. Deduplicate event IDs, then re-read current entitlement;
69
+ an old alert may arrive after a top-up or renewal. Do not use event amounts to
70
+ grant credits or override the current quota.
71
+ - Show a warning banner and a billing action. Use your server-defined top-up offer
72
+ to create a namespace-bound checkout after the customer chooses to buy. Payment
73
+ fulfillment increases purchased allowance once; your next entitlement read
74
+ clears the warning when funded. Workspaces stopped for billing can then be
75
+ restarted. A top-up does not change the plan's resource caps or grace policy.
76
+ - Paid renewals re-arm warnings and preserve custom notification percentages.
77
+ A top-up or usage refund that lowers usage below a warning band re-arms that
78
+ band for the larger remaining budget. Mode A cycles must still be reset by
79
+ your backend; Mode B cycles renew after verified paid invoices.
80
+
81
+ External email delivery is asynchronous and can repeat after a lost acknowledgment.
82
+ Use a durable notification queue, honor verified recipient preferences, recheck
83
+ organization membership before delivery, and bind billing links to the intended
84
+ organization. Keep a read-only dashboard warning while email is unavailable.
@@ -29,6 +29,12 @@ Verification: `npm test` passes all 19 SDK tests, including
29
29
  `tests/http-errors.test.mjs` for legacy 200, current 409, uppercase error-only codes,
30
30
  403/500 JSON responses, and successful asynchronous creation.
31
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
+
32
38
  This report and patch are recorded in the SDK repository for maintainers. No external
33
39
  issue or team message has been sent from this environment. The public npm version
34
40
  checked during this work is 2.3.0; these SDK changes require the next SDK release.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oblien",
3
- "version": "2.3.2",
3
+ "version": "2.5.0",
4
4
  "description": "Official TypeScript SDK for the Oblien Workspace API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",