@amerged/ohmyhost-mcp 0.1.42 → 0.1.44

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.
@@ -116,96 +116,6 @@ export function assertOrganizationCreditUsage(
116
116
  }
117
117
  }
118
118
 
119
- export interface PublishedCreditRateCard {
120
- readonly id: string;
121
- readonly currency: "USD";
122
- readonly published_at: string;
123
- readonly effective_from: string;
124
- readonly rates: readonly {
125
- readonly meter: string;
126
- readonly unit: string;
127
- readonly units_per_charge: string;
128
- readonly provider_cost_micros: string | null;
129
- readonly credit_micros: string;
130
- }[];
131
- }
132
-
133
- /** Shared wire validation only; clients never recompute accounting decisions. */
134
- export function assertPublishedCreditRateCards(
135
- value: unknown,
136
- ): asserts value is readonly PublishedCreditRateCard[] {
137
- if (!Array.isArray(value) || value.length > 4) throw new TypeError("Invalid published prices");
138
- const ids = new Set<string>();
139
- for (const input of value) {
140
- if (
141
- !input ||
142
- typeof input !== "object" ||
143
- Array.isArray(input) ||
144
- Object.keys(input).sort().join() !== "currency,effective_from,id,published_at,rates"
145
- )
146
- throw new TypeError("Invalid published price fields");
147
- const card = input as Record<string, unknown>;
148
- if (
149
- typeof card["id"] !== "string" ||
150
- !/^[a-z0-9_.-]{1,128}$/u.test(card["id"]) ||
151
- ids.has(card["id"]) ||
152
- card["currency"] !== "USD"
153
- )
154
- throw new TypeError("Invalid price identity");
155
- ids.add(card["id"]);
156
- for (const key of ["published_at", "effective_from"]) {
157
- const date = card[key];
158
- if (
159
- typeof date !== "string" ||
160
- !Number.isFinite(Date.parse(date)) ||
161
- new Date(date).toISOString() !== date
162
- )
163
- throw new TypeError("Invalid price dates");
164
- }
165
- if (
166
- String(card["published_at"]) > String(card["effective_from"]) ||
167
- !Array.isArray(card["rates"]) ||
168
- card["rates"].length < 1 ||
169
- card["rates"].length > 32
170
- )
171
- throw new TypeError("Invalid price publication");
172
- const meters = new Set<string>();
173
- for (const item of card["rates"]) {
174
- if (
175
- !item ||
176
- typeof item !== "object" ||
177
- Array.isArray(item) ||
178
- Object.keys(item).sort().join() !==
179
- "credit_micros,meter,provider_cost_micros,unit,units_per_charge"
180
- )
181
- throw new TypeError("Invalid rate fields");
182
- const rate = item as Record<string, unknown>;
183
- for (const key of ["meter", "unit"])
184
- if (typeof rate[key] !== "string" || !/^[a-z0-9_.-]{1,128}$/u.test(String(rate[key])))
185
- throw new TypeError("Invalid rate unit");
186
- const identity = String(rate["meter"]) + "/" + String(rate["unit"]);
187
- if (meters.has(identity)) throw new TypeError("Duplicate rate");
188
- meters.add(identity);
189
- for (const key of ["units_per_charge", "provider_cost_micros", "credit_micros"]) {
190
- const amount = rate[key];
191
- if (
192
- key === "provider_cost_micros" &&
193
- amount === null &&
194
- rate["meter"] === "pgcf.memory.active"
195
- )
196
- continue;
197
- if (
198
- typeof amount !== "string" ||
199
- !/^(0|[1-9][0-9]{0,18})$/u.test(amount) ||
200
- BigInt(amount) > 9223372036854775807n ||
201
- (key === "units_per_charge" && amount === "0")
202
- )
203
- throw new TypeError("Invalid rate amount");
204
- }
205
- }
206
- }
207
- }
208
-
209
119
  /** Effective feature access and the credit account: the monthly and one-time credit and what the open reservations hold. */
210
120
  export function assertOrganizationAccount(value: unknown): void {
211
121
  if (
@@ -34,12 +34,12 @@ const failures = {
34
34
  "Do not repeat the write with a new key. Inspect the target data with a read query and retain this operation ID. The same key only reads this receipt.",
35
35
  ],
36
36
  database_compute_failed: [
37
- "The database size change failed at the provider.",
38
- "Read the current database compute and report this operation ID through feedback. Preserve data; do not reset or redeploy the database to repair its size.",
37
+ "The database provider refused the size change or had no room for it. The database keeps its previous size and keeps running, and no credits are charged for the failed change.",
38
+ "Read the current size with 'ohmyhost database compute get --project PROJECT_ULID --environment dev|prod --json' or MCP database_compute_get, then repeat the change with a new idempotency key; the old key only returns this failure. If it fails again after a few minutes, start a new deployment of the project, repeat the change and report this operation ID through feedback. Never reset the database to change its size.",
39
39
  ],
40
40
  database_compute_plan_changed: [
41
- "Paid access ended before the database size change started.",
42
- "Read the organization's plan and current database compute, then confirm a new standard-size request. This operation did not resize the database.",
41
+ "Paid access ended before the database size change started, so it was not sent to the database provider. The database keeps its previous size and keeps running, and no credits are charged for the change.",
42
+ "Read the organization's plan with 'ohmyhost credits account --organization ORGANIZATION_ULID --json' or MCP organization_account_get. Sizes above 256 MiB need active Paid: ask the organization Owner to activate Paid through billing checkout, then read the current size with database compute get and repeat the change with a new idempotency key.",
43
43
  ],
44
44
  database_compute_rejected: [
45
45
  "The database size change could not be started.",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmyhost/sdk-ts",
3
- "version": "0.1.42",
3
+ "version": "0.1.44",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -829,7 +829,6 @@ export type {
829
829
  PromoteDeploymentResponse,
830
830
  PromoteDeploymentResponses,
831
831
  ProviderReconciliationAttempt,
832
- PublishedCreditRateCard,
833
832
  PutEnvironmentSecretData,
834
833
  PutEnvironmentSecretError,
835
834
  PutEnvironmentSecretErrors,
@@ -2192,7 +2192,7 @@ export const configureBillingRecharge = <ThrowOnError extends boolean = true>(
2192
2192
  /**
2193
2193
  * Read the owner's shared organization credit pool
2194
2194
  *
2195
- * Returns the spendable credit and the open reservations, in microcredits (one credit is 1000000 microcredits). available_micros is the monthly credit plus the one-time credit minus the reservations, never below zero. Only the organization Owner may read this balance. active_meters names the currently billed sources; usage that is not billed yet is not included. When the credit is used up, grace_started_at and grace_expires_at name the seven days that keep existing services running. Remains available at zero credit.
2195
+ * Returns the spendable credit and the open reservations, in microcredits (one credit is 1000000 microcredits). available_micros is the monthly credit plus the one-time credit minus the reservations, never below zero. Only the organization Owner may read this balance. It states what is left and never what the credit was spent on; read the recent usage from getOrganizationCreditUsage. When the credit is used up, grace_started_at and grace_expires_at name the seven days that keep existing services running. Remains available at zero credit.
2196
2196
  */
2197
2197
  export const getOrganizationCredits = <ThrowOnError extends boolean = true>(
2198
2198
  parameters: {
@@ -5227,7 +5227,7 @@ export const getProjectDatabaseSchedule = <ThrowOnError extends boolean = true>(
5227
5227
  /**
5228
5228
  * Create or replace one database schedule
5229
5229
  *
5230
- * Creates the named schedule or replaces it. Each run executes the statements as the application's own runtime role, so row-level security applies as for the application. A run that does not finish within timeout_ms is cancelled.
5230
+ * Creates the named schedule or replaces it. Each run executes the statements as the application's own runtime role, so row-level security applies as for the application. A run that does not finish within timeout_ms is cancelled. A reached Stop budget (or exhausted credit past its grace) refuses an enabled schedule with project_budget_exceeded (402); disabling the schedule is never refused.
5231
5231
  */
5232
5232
  export const setProjectDatabaseSchedule = <ThrowOnError extends boolean = true>(
5233
5233
  parameters: {
@@ -5328,7 +5328,7 @@ export const listProjectDatabaseScheduleRuns = <ThrowOnError extends boolean = t
5328
5328
  /**
5329
5329
  * Queue one immediate run of a database schedule
5330
5330
  *
5331
- * Queues one manual run. The run is refused while the schedule is disabled or while a run is already queued.
5331
+ * Queues one manual run. The run is refused while the schedule is disabled or while a run is already queued. A reached Stop budget (or exhausted credit past its grace) refuses the run with project_budget_exceeded (402).
5332
5332
  */
5333
5333
  export const runProjectDatabaseSchedule = <ThrowOnError extends boolean = true>(
5334
5334
  parameters: {
@@ -5374,7 +5374,7 @@ export const runProjectDatabaseSchedule = <ThrowOnError extends boolean = true>(
5374
5374
  /**
5375
5375
  * Read metered database execution usage
5376
5376
  *
5377
- * Returns schedule runs and webhook attempts per time window. Only completed windows are final; the current window may still change. Windows are UTC and at most 31 days long. Rejected, skipped, event and delivery counts are reported but not billed.
5377
+ * Returns schedule runs and webhook attempts per time window. Only completed windows are final; the current window may still change. Windows are UTC and at most 31 days long. The counts are counters only; executions have no price of their own, and the awake compute time of the database is what is billed.
5378
5378
  */
5379
5379
  export const getProjectDatabaseExecutionUsage = <ThrowOnError extends boolean = true>(
5380
5380
  parameters: {
@@ -329,11 +329,6 @@ export type OrganizationCredits = {
329
329
  * Seven days after the credit was used up. Existing services and domains are retained during this grace; no automatic data deletion. Explicit project stop budgets are separate.
330
330
  */
331
331
  grace_expires_at: string | null;
332
- active_meters: Array<string>;
333
- /**
334
- * Published integer prices, newest first. A published rate is not proof of enabled billing; only active_meters names currently billed sources. Builds retain their accepted quote. Provider cost is a list-price basis before platform allowances, not an invoice.
335
- */
336
- rate_cards: Array<PublishedCreditRateCard>;
337
332
  };
338
333
 
339
334
  /**
@@ -379,23 +374,6 @@ export type OrganizationCreditUsage = {
379
374
  }>;
380
375
  };
381
376
 
382
- export type PublishedCreditRateCard = {
383
- id: string;
384
- currency: "USD";
385
- published_at: string;
386
- effective_from: string;
387
- rates: Array<{
388
- meter: string;
389
- unit: string;
390
- units_per_charge: string;
391
- /**
392
- * Provider list-cost basis for units_per_charge, in USD micro-units (1000000 equals 1 USD), before shared allowances and discounts. Null for the PGCF RAM tariff means node infrastructure costs are tracked separately and are not allocated to this customer rate; null never means zero cost.
393
- */
394
- provider_cost_micros: string | null;
395
- credit_micros: CreditMicros;
396
- }>;
397
- };
398
-
399
377
  export type SetProjectCreditBudgetRequest = {
400
378
  /**
401
379
  * The monthly budget, at most 9007199254740991 microcredits (about 9 billion credits); null removes it.
@@ -8812,6 +8790,10 @@ export type SetProjectDatabaseScheduleErrors = {
8812
8790
  * The request failed.
8813
8791
  */
8814
8792
  401: ProblemDetails;
8793
+ /**
8794
+ * The request failed.
8795
+ */
8796
+ 402: ProblemDetails;
8815
8797
  /**
8816
8798
  * The resource does not exist or is not visible to the authenticated principal.
8817
8799
  */
@@ -8946,6 +8928,10 @@ export type RunProjectDatabaseScheduleErrors = {
8946
8928
  * The request failed.
8947
8929
  */
8948
8930
  401: ProblemDetails;
8931
+ /**
8932
+ * The request failed.
8933
+ */
8934
+ 402: ProblemDetails;
8949
8935
  /**
8950
8936
  * The resource does not exist or is not visible to the authenticated principal.
8951
8937
  */