@onesi/genesis 0.2.13 → 0.2.15

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  The TypeScript SDK for OneOS. One typed client for every Genesis service, through the Genesis API at `https://os.one.ml/api`.
4
4
 
5
5
  ```sh
6
- npm install @onesi/genesis@0.2.13
6
+ npm install @onesi/genesis@0.2.15
7
7
  ```
8
8
 
9
9
  ```ts
@@ -0,0 +1,39 @@
1
+ import type { GenesisClient } from './client.js';
2
+ /** One public agent in search results. Optional keys are present only when the owner disclosed them. */
3
+ export interface AgentSearchHit {
4
+ agentId: string;
5
+ did: string;
6
+ verified: true;
7
+ environment: 'live';
8
+ name?: string;
9
+ owner?: {
10
+ name: string;
11
+ };
12
+ description?: string;
13
+ createdAt?: number;
14
+ }
15
+ export interface AgentSitemapEntry {
16
+ agentId: string;
17
+ updatedAt: number;
18
+ }
19
+ export declare const AGENT_SEARCH_Q_MAX = 200;
20
+ export declare const AGENT_SEARCH_LIMIT_MAX = 20;
21
+ /**
22
+ * Public agent search: the Live agents whose owners made them public in IAM. No credential is needed or sent, and it is
23
+ * never metered. Each result has only what the owner disclosed; read an agent's own card with `iam.publicCard(agentId)`.
24
+ */
25
+ export declare function agentsModule(client: GenesisClient): {
26
+ /** Ranked search: `q` is 1 to 200 characters, `limit` 1 to 20 (default 20). */
27
+ search: (q: string, options?: {
28
+ limit?: number;
29
+ signal?: AbortSignal;
30
+ }) => Promise<{
31
+ results: AgentSearchHit[];
32
+ }>;
33
+ /** Every public Live agent id (at most 50,000) with when its public content last changed, for crawlers. */
34
+ sitemap: (options?: {
35
+ signal?: AbortSignal;
36
+ }) => Promise<{
37
+ agents: AgentSitemapEntry[];
38
+ }>;
39
+ };
package/dist/agents.js ADDED
@@ -0,0 +1,23 @@
1
+ import { GenesisError } from './errors.js';
2
+ export const AGENT_SEARCH_Q_MAX = 200;
3
+ export const AGENT_SEARCH_LIMIT_MAX = 20;
4
+ const refuse = (operationId, message) => new GenesisError({ status: 0, type: 'invalid_request', code: 'INVALID_QUERY', message, operationId });
5
+ /**
6
+ * Public agent search: the Live agents whose owners made them public in IAM. No credential is needed or sent, and it is
7
+ * never metered. Each result has only what the owner disclosed; read an agent's own card with `iam.publicCard(agentId)`.
8
+ */
9
+ export function agentsModule(client) {
10
+ return {
11
+ /** Ranked search: `q` is 1 to 200 characters, `limit` 1 to 20 (default 20). */
12
+ search: async (q, options = {}) => {
13
+ if (typeof q !== 'string' || q.trim() === '' || q.length > AGENT_SEARCH_Q_MAX)
14
+ throw refuse('agents_search', `q must be 1 to ${AGENT_SEARCH_Q_MAX} characters.`);
15
+ const { limit } = options;
16
+ if (limit !== undefined && (!Number.isInteger(limit) || limit < 1 || limit > AGENT_SEARCH_LIMIT_MAX))
17
+ throw refuse('agents_search', `limit must be an integer from 1 to ${AGENT_SEARCH_LIMIT_MAX}.`);
18
+ return client.request('agents_search', { q, ...(limit === undefined ? {} : { limit }) }, options.signal ? { signal: options.signal } : {});
19
+ },
20
+ /** Every public Live agent id (at most 50,000) with when its public content last changed, for crawlers. */
21
+ sitemap: (options = {}) => client.request('agents_sitemap', {}, options.signal ? { signal: options.signal } : {}),
22
+ };
23
+ }
package/dist/client.js CHANGED
@@ -266,7 +266,7 @@ export class GenesisClient {
266
266
  const url = this.url(operationId, input);
267
267
  const headers = {
268
268
  accept: 'application/json',
269
- 'user-agent': this.opts.userAgent ?? '@onesi/genesis/0.2.13',
269
+ 'user-agent': this.opts.userAgent ?? '@onesi/genesis/0.2.15',
270
270
  ...this.opts.headers, ...init.headers,
271
271
  };
272
272
  if (op.service === 'blinds' && !['GET', 'HEAD', 'OPTIONS'].includes(op.method))
package/dist/dials.d.ts CHANGED
@@ -15,6 +15,13 @@ export type DialsMessageTemplate = components['schemas']['Dials.MessageTemplate'
15
15
  export type DialsMessagingBrand = components['schemas']['Dials.MessagingBrand'];
16
16
  export type DialsMessagingCampaign = components['schemas']['Dials.MessagingCampaign'];
17
17
  export type DialsWorkflowDocument = components['schemas']['Dials.WorkflowDocument'];
18
+ export type DialsWorkflowDeleteReceipt = components['schemas']['Dials.DeleteWorkflowReceipt'];
19
+ export type DialsNumberVoiceHandlerReceipt = components['schemas']['Dials.NumberVoiceHandlerReceipt'];
20
+ export type DialsOneNumber = components['schemas']['Dials.OneNumber'];
21
+ export type DialsOneNumberSuggestions = components['schemas']['Dials.OneNumberSuggestions'];
22
+ export type DialsOneNumberChoice = components['schemas']['Dials.OneNumberChoice'];
23
+ export type DialsMyOneNumber = components['schemas']['Dials.MyOneNumber'];
24
+ export type DialsOneNumberRelease = components['schemas']['Dials.OneNumberRelease'];
18
25
  export type DialsRoutingAction = components['schemas']['Dials.RoutingAction'];
19
26
  export type DialsRoutingRule = components['schemas']['Dials.RoutingRule'];
20
27
  export type DialsRoutingRuleReceipt = components['schemas']['Dials.RoutingRuleReceipt'];
@@ -149,6 +156,48 @@ export declare function dialsModule(client: GenesisClient): {
149
156
  next: string;
150
157
  route: components["schemas"]["Dials.RoutingRule"];
151
158
  }>;
159
+ /** Deletes the workflow and its routing descriptor; 409 while a held number is assigned to it. */
160
+ delete: (workflowId: string, body: OperationInput<"dials_deleteWorkflow">["body"]) => Promise<{
161
+ ok: true;
162
+ deleted: true;
163
+ workflow: components["schemas"]["Dials.WorkflowDocument"];
164
+ routeIds: string[];
165
+ auditId: string;
166
+ next: "workflow_deleted";
167
+ }>;
168
+ };
169
+ /** A person's own One number (person token): suggestions, the person's choice, their number and its release. */
170
+ oneNumbers: {
171
+ /** POST with a JSON body `{areaCode?, text?, lat?, lng?}`; lat and lng travel in the body, never the URL, and a lone one is 400. */
172
+ suggestions: (body?: OperationInput<"dials_listOneNumberSuggestions">["body"]) => Promise<{
173
+ state: "suggestions" | "none_found";
174
+ source: "verified_phone" | "ip_city" | "device" | "search";
175
+ areaCode?: string | null;
176
+ city?: string | null;
177
+ numbers: components["schemas"]["Dials.OneNumberCandidate"][];
178
+ }>;
179
+ /** 202 `reserved_intent` while Dials provisioning is off; 409 taken, 429 provisioning_cap, 503 carrier_limit. Not retried automatically. */
180
+ choose: (body: OperationInput<"dials_chooseOneNumber">["body"]) => Promise<{
181
+ state: "chosen" | "reserved_intent";
182
+ number?: components["schemas"]["Dials.OneNumber"];
183
+ } & {
184
+ [key: string]: unknown;
185
+ }>;
186
+ mine: () => Promise<{
187
+ number: components["schemas"]["Dials.OneNumber"] | null;
188
+ plan?: string;
189
+ idleDays?: number | null;
190
+ releaseAt?: string | null;
191
+ } & {
192
+ [key: string]: unknown;
193
+ }>;
194
+ /** Releases the person's own One number at the carrier; it cannot be recovered. */
195
+ release: () => Promise<{
196
+ state: "releasing" | "released";
197
+ number?: components["schemas"]["Dials.OneNumber"] | null;
198
+ } & {
199
+ [key: string]: unknown;
200
+ }>;
152
201
  };
153
202
  overview: {
154
203
  summary: (scope: DialsScope) => Promise<{
@@ -220,6 +269,16 @@ export declare function dialsModule(client: GenesisClient): {
220
269
  auditId: string;
221
270
  next: string;
222
271
  }>;
272
+ /** Points an owned SignalWire number's inbound voice webhook at `one_phone` (the One phone line) or `default`; 409 for a non-SignalWire number. */
273
+ setVoiceHandler: (body: OperationInput<"dials_setNumberVoiceHandler">["body"]) => Promise<{
274
+ ok: true;
275
+ phoneNumberId: string;
276
+ handler: "one_phone" | "default";
277
+ auditId?: string;
278
+ next?: string;
279
+ } & {
280
+ [key: string]: unknown;
281
+ }>;
223
282
  reconcile: (body: OperationInput<"dials_reconcileNumberInventory">["body"]) => Promise<{
224
283
  ok: boolean;
225
284
  reconciliations: components["schemas"]["Dials.InventoryReconciliation"][];
package/dist/dials.js CHANGED
@@ -39,6 +39,18 @@ export function dialsModule(client) {
39
39
  workflows: {
40
40
  list: (scope) => client.request('dials_listWorkflows', scope),
41
41
  deploy: (body) => client.request('dials_deployWorkflow', { body }),
42
+ /** Deletes the workflow and its routing descriptor; 409 while a held number is assigned to it. */
43
+ delete: (workflowId, body) => client.request('dials_deleteWorkflow', { workflow_id: workflowId, body }),
44
+ },
45
+ /** A person's own One number (person token): suggestions, the person's choice, their number and its release. */
46
+ oneNumbers: {
47
+ /** POST with a JSON body `{areaCode?, text?, lat?, lng?}`; lat and lng travel in the body, never the URL, and a lone one is 400. */
48
+ suggestions: (body = {}) => client.request('dials_listOneNumberSuggestions', { body }),
49
+ /** 202 `reserved_intent` while Dials provisioning is off; 409 taken, 429 provisioning_cap, 503 carrier_limit. Not retried automatically. */
50
+ choose: (body) => client.request('dials_chooseOneNumber', { body }),
51
+ mine: () => client.request('dials_getMyOneNumber', {}),
52
+ /** Releases the person's own One number at the carrier; it cannot be recovered. */
53
+ release: () => client.request('dials_releaseMyOneNumber', {}),
42
54
  },
43
55
  overview: {
44
56
  summary: (scope) => client.request('dials_getConsoleSummary', scope),
@@ -48,6 +60,8 @@ export function dialsModule(client) {
48
60
  reconciliations: (scope) => client.request('dials_listNumberReconciliations', scope),
49
61
  drift: (scope) => client.request('dials_listNumberDrift', scope),
50
62
  updateCallerName: (body) => client.request('dials_updateNumberCallerName', { body }),
63
+ /** Points an owned SignalWire number's inbound voice webhook at `one_phone` (the One phone line) or `default`; 409 for a non-SignalWire number. */
64
+ setVoiceHandler: (body) => client.request('dials_setNumberVoiceHandler', { body }),
51
65
  reconcile: (body) => client.request('dials_reconcileNumberInventory', { body }),
52
66
  list: (scope) => client.request('dials_listNumbers', scope),
53
67
  search: (scope, query = {}) => client.request('dials_searchNumbers', { ...query, ...scope }),
package/dist/fleets.d.ts CHANGED
@@ -463,6 +463,24 @@ export declare function fleetsModule(client: GenesisClient): {
463
463
  updated_at?: number;
464
464
  }>;
465
465
  };
466
+ /** The key seat research tasks use to search and read the web through Traces (scopes exactly traces:read; its own slot, never the computer key); KMS-encrypted, never returned. */
467
+ webConnection: {
468
+ get: () => Promise<{
469
+ connected: boolean;
470
+ updated_at?: number;
471
+ scopes?: "traces:read"[];
472
+ }>;
473
+ set: (api_key: string) => Promise<{
474
+ connected: boolean;
475
+ updated_at?: number;
476
+ scopes?: "traces:read"[];
477
+ }>;
478
+ delete: () => Promise<{
479
+ connected: boolean;
480
+ updated_at?: number;
481
+ scopes?: "traces:read"[];
482
+ }>;
483
+ };
466
484
  usage: {
467
485
  /** Task lifecycle and execution-time usage events, paged by task like tasks.list. */
468
486
  events: (query?: OperationInput<"fleets_listUsageEvents">) => Promise<{
package/dist/fleets.js CHANGED
@@ -180,6 +180,11 @@ function validateComputerKey(apiKey) {
180
180
  throw invalid('fleets_putComputerConnection', 'Computer key must contain 1–4096 UTF-8 bytes without CR, LF or NUL.');
181
181
  }
182
182
  }
183
+ function validateWebKey(apiKey) {
184
+ if (typeof apiKey !== 'string' || !apiKey || byteLength(apiKey) > 4096 || /[\r\n\0]/.test(apiKey)) {
185
+ throw invalid('fleets_putWebConnection', 'Web key must contain 1–4096 UTF-8 bytes without CR, LF or NUL.');
186
+ }
187
+ }
183
188
  /** Managed Henry instances and tasks scoped to the credential's verified org. */
184
189
  export function fleetsModule(client) {
185
190
  return {
@@ -378,6 +383,15 @@ export function fleetsModule(client) {
378
383
  },
379
384
  delete: () => client.request('fleets_deleteComputerConnection', {}),
380
385
  },
386
+ /** The key seat research tasks use to search and read the web through Traces (scopes exactly traces:read; its own slot, never the computer key); KMS-encrypted, never returned. */
387
+ webConnection: {
388
+ get: () => client.request('fleets_getWebConnection', {}),
389
+ set: async (api_key) => {
390
+ validateWebKey(api_key);
391
+ return client.request('fleets_putWebConnection', { body: { api_key } });
392
+ },
393
+ delete: () => client.request('fleets_deleteWebConnection', {}),
394
+ },
381
395
  usage: {
382
396
  /** Task lifecycle and execution-time usage events, paged by task like tasks.list. */
383
397
  events: (query = {}) => client.request('fleets_listUsageEvents', query),
package/dist/gateway.d.ts CHANGED
@@ -112,7 +112,8 @@ export declare function orgsModule(client: GenesisClient): {
112
112
  * Your organization's billing: account, contacts, tax IDs, activity, quotas and quota requests, the Minds account,
113
113
  * invoices, the raw usage report and the public service catalog. A login session, or an org API key bound to `org`
114
114
  * holding genesis.billing.read (reads), genesis.billing.manage (writes) or genesis.usage.read (usage report).
115
- * Writes need a stable idempotency key; reuse it to replay instead of acting twice. Nothing here pays or charges.
115
+ * Writes need a stable idempotency key; reuse it to replay instead of acting twice. Only subscription.create can start a
116
+ * charge, and only in an environment where Genesis Pro is switched on (Sandbox is test money).
116
117
  */
117
118
  export declare function billingModule(client: GenesisClient): {
118
119
  account: {
@@ -131,7 +132,7 @@ export declare function billingModule(client: GenesisClient): {
131
132
  memo?: string | null;
132
133
  };
133
134
  stripe?: {
134
- account_id?: string;
135
+ account_id?: string | null;
135
136
  customer_id?: string | null;
136
137
  livemode?: boolean;
137
138
  };
@@ -153,7 +154,7 @@ export declare function billingModule(client: GenesisClient): {
153
154
  memo?: string | null;
154
155
  };
155
156
  stripe?: {
156
- account_id?: string;
157
+ account_id?: string | null;
157
158
  customer_id?: string | null;
158
159
  livemode?: boolean;
159
160
  };
@@ -216,6 +217,85 @@ export declare function billingModule(client: GenesisClient): {
216
217
  deleted: true;
217
218
  }>;
218
219
  };
220
+ card: {
221
+ /** Hosted Stripe Checkout (setup mode, off-session) for the org's billing account: send the customer to `url`; they come back to `return_url`. */
222
+ setup: (org: string, body: In<"gateway_createBillingCardSetupSession">["body"], idempotencyKey: string) => Promise<{
223
+ object: "billing_setup_session";
224
+ url: string;
225
+ expires_at: string;
226
+ }>;
227
+ /** After the return: verifies the completed session, then makes that card the default. */
228
+ setDefault: (org: string, body: In<"gateway_setBillingDefaultPaymentMethod">["body"], idempotencyKey: string) => Promise<{
229
+ object: "billing_payment_method";
230
+ brand?: string | null;
231
+ last4?: string | null;
232
+ exp_month?: number | null;
233
+ exp_year?: number | null;
234
+ default: true;
235
+ }>;
236
+ };
237
+ subscription: {
238
+ get: (org: string) => Promise<{
239
+ object: "genesis_pro_subscription";
240
+ org_id: string;
241
+ environment: "sandbox" | "live";
242
+ plan: "genesis_pro";
243
+ created?: boolean;
244
+ enabled?: boolean;
245
+ stripe?: {
246
+ account_id?: string | null;
247
+ mode?: string;
248
+ livemode?: boolean;
249
+ test_mode?: boolean;
250
+ };
251
+ subscription: {
252
+ id: string | null;
253
+ status: string;
254
+ prices: string[];
255
+ current_period_start?: string | null;
256
+ current_period_end?: string | null;
257
+ latest_invoice?: {
258
+ id?: string | null;
259
+ status?: string | null;
260
+ hosted_invoice_url?: string | null;
261
+ amount_due?: number | null;
262
+ } | null;
263
+ } | null;
264
+ entitlement: {
265
+ [key: string]: unknown;
266
+ };
267
+ }>;
268
+ create: (org: string, body: In<"gateway_createGenesisProSubscription">["body"], idempotencyKey: string) => Promise<{
269
+ object: "genesis_pro_subscription";
270
+ org_id: string;
271
+ environment: "sandbox" | "live";
272
+ plan: "genesis_pro";
273
+ created?: boolean;
274
+ enabled?: boolean;
275
+ stripe?: {
276
+ account_id?: string | null;
277
+ mode?: string;
278
+ livemode?: boolean;
279
+ test_mode?: boolean;
280
+ };
281
+ subscription: {
282
+ id: string | null;
283
+ status: string;
284
+ prices: string[];
285
+ current_period_start?: string | null;
286
+ current_period_end?: string | null;
287
+ latest_invoice?: {
288
+ id?: string | null;
289
+ status?: string | null;
290
+ hosted_invoice_url?: string | null;
291
+ amount_due?: number | null;
292
+ } | null;
293
+ } | null;
294
+ entitlement: {
295
+ [key: string]: unknown;
296
+ };
297
+ }>;
298
+ };
219
299
  quotas: {
220
300
  get: (org: string) => Promise<{
221
301
  object: "org_quotas";
@@ -362,6 +442,68 @@ export declare function billingModule(client: GenesisClient): {
362
442
  }[];
363
443
  }[];
364
444
  }>;
445
+ /**
446
+ * The OneOS Pro pricing catalog (public, no credential): plans, included usage and every meter's rate. Show a rate only
447
+ * when its `live_metered` is true.
448
+ */
449
+ pricing: () => Promise<{
450
+ object: "billing_pricing";
451
+ version: string;
452
+ generated_at: string;
453
+ source: {
454
+ service: string;
455
+ commit: string | null;
456
+ stripe_mode: "live" | "test" | "off";
457
+ };
458
+ currency: "usd";
459
+ plans: {
460
+ id: "hobby" | "genesis_pro" | "enterprise";
461
+ name: string;
462
+ price_usd_month: string | null;
463
+ included_usage_usd?: string;
464
+ card_required?: boolean;
465
+ stripe_lookup_key?: string;
466
+ live_priced?: boolean;
467
+ annual?: {
468
+ price_usd_year?: string;
469
+ stripe_lookup_key?: string;
470
+ live_priced?: boolean;
471
+ };
472
+ limits?: {
473
+ [key: string]: unknown;
474
+ };
475
+ contact?: string;
476
+ }[];
477
+ rates: {
478
+ service: string;
479
+ service_name: string;
480
+ category?: string | null;
481
+ meters: string[];
482
+ label: string;
483
+ unit?: string | null;
484
+ granularity?: string | null;
485
+ rate: {
486
+ kind?: "fixed" | "list_plus_bps";
487
+ currency?: "usd";
488
+ usd_per_unit?: string;
489
+ per?: string;
490
+ bps?: number;
491
+ base?: string;
492
+ } | null;
493
+ included?: {
494
+ [key: string]: unknown;
495
+ };
496
+ allowance?: {
497
+ [key: string]: unknown;
498
+ };
499
+ stripe_lookup_key?: string | null;
500
+ stripe_unit_amount_decimal?: string | null;
501
+ live_metered: boolean;
502
+ example?: {
503
+ [key: string]: unknown;
504
+ } | null;
505
+ }[];
506
+ }>;
365
507
  };
366
508
  /**
367
509
  * Your One credits (the organization's credit balance, ledger, usage, settings, checkout and subscription). A login
@@ -371,7 +513,7 @@ export declare function billingModule(client: GenesisClient): {
371
513
  * URL is always on checkout.stripe.com and nothing is charged until you pay on that page.
372
514
  */
373
515
  export declare function creditsModule(client: GenesisClient): {
374
- /** The balance: plan and period, buckets, this month's spend by source, borrow, auto-refill, subscription, pending seat fundings and the Foundry cap mirror. */
516
+ /** The balance: plan and period, buckets, this month's spend by source, borrow, auto-refill, subscription, pending seat fundings, the Foundry cap mirror and (with One plans on) `one_plan`. */
375
517
  get: () => Promise<{
376
518
  org: string;
377
519
  plan: string;
@@ -404,6 +546,7 @@ export declare function creditsModule(client: GenesisClient): {
404
546
  status: string;
405
547
  granted_micro_usd: number;
406
548
  };
549
+ one_plan?: import("./index.js").components["schemas"]["Gateway.CreditOnePlan"];
407
550
  }>;
408
551
  /** The catalog: every price with its credits and amount, the pack rate, the payment methods per mode and the wallet-payment terms. Needs no credits account. */
409
552
  catalog: () => Promise<{
@@ -450,11 +593,12 @@ export declare function creditsModule(client: GenesisClient): {
450
593
  ref: string | null;
451
594
  data: import("./index.js").components["schemas"]["Gateway.CreditUsageRow"][];
452
595
  }>;
453
- /** Change the borrow ceiling and/or auto-refill (pack 10, 25 or 50). */
596
+ /** Change the borrow ceiling and/or auto-refill (pack 10, 25 or 50); with One plans on, the daily limit (`daily_limit_credits`, null clears it) and `always_on_one`. */
454
597
  updateSettings: (body: In<"gateway_updateCreditSettings">["body"], idempotencyKey: string) => Promise<{
455
598
  org: string;
456
599
  borrow: import("./index.js").components["schemas"]["Gateway.CreditBorrow"];
457
600
  auto_refill: import("./index.js").components["schemas"]["Gateway.CreditAutoRefill"];
601
+ one_plan?: import("./index.js").components["schemas"]["Gateway.CreditOnePlan"];
458
602
  }>;
459
603
  /** A Stripe Checkout URL (checkout.stripe.com, test mode) for a plan, seats or a credit pack; `return_to` (https://chat.one.ml/pay or below) is where Checkout sends the person back. */
460
604
  checkout: (body: In<"gateway_createCreditCheckout">["body"], idempotencyKey: string) => Promise<{
package/dist/gateway.js CHANGED
@@ -37,7 +37,8 @@ export function orgsModule(client) {
37
37
  * Your organization's billing: account, contacts, tax IDs, activity, quotas and quota requests, the Minds account,
38
38
  * invoices, the raw usage report and the public service catalog. A login session, or an org API key bound to `org`
39
39
  * holding genesis.billing.read (reads), genesis.billing.manage (writes) or genesis.usage.read (usage report).
40
- * Writes need a stable idempotency key; reuse it to replay instead of acting twice. Nothing here pays or charges.
40
+ * Writes need a stable idempotency key; reuse it to replay instead of acting twice. Only subscription.create can start a
41
+ * charge, and only in an environment where Genesis Pro is switched on (Sandbox is test money).
41
42
  */
42
43
  export function billingModule(client) {
43
44
  const write = (id, input, idempotencyKey) => client.request(id, input, { headers: idempotencyHeaders(id, idempotencyKey) });
@@ -57,6 +58,16 @@ export function billingModule(client) {
57
58
  create: (org, body, idempotencyKey) => write('gateway_createBillingTaxId', { org, body }, idempotencyKey),
58
59
  delete: (org, taxId, idempotencyKey) => write('gateway_deleteBillingTaxId', { org, tax_id: taxId }, idempotencyKey),
59
60
  },
61
+ card: {
62
+ /** Hosted Stripe Checkout (setup mode, off-session) for the org's billing account: send the customer to `url`; they come back to `return_url`. */
63
+ setup: (org, body, idempotencyKey) => write('gateway_createBillingCardSetupSession', { org, body }, idempotencyKey),
64
+ /** After the return: verifies the completed session, then makes that card the default. */
65
+ setDefault: (org, body, idempotencyKey) => write('gateway_setBillingDefaultPaymentMethod', { org, body }, idempotencyKey),
66
+ },
67
+ subscription: {
68
+ get: (org) => client.request('gateway_getGenesisProSubscription', { org }),
69
+ create: (org, body, idempotencyKey) => write('gateway_createGenesisProSubscription', { org, body }, idempotencyKey),
70
+ },
60
71
  quotas: {
61
72
  get: (org) => client.request('gateway_getOrgQuotas', { org }),
62
73
  requests: {
@@ -78,6 +89,11 @@ export function billingModule(client) {
78
89
  service: (org, service) => client.request('gateway_getOrgServiceBilling', { org, service }),
79
90
  /** The metered service catalog (public, no credential). */
80
91
  catalog: () => client.request('gateway_listBillingServices'),
92
+ /**
93
+ * The OneOS Pro pricing catalog (public, no credential): plans, included usage and every meter's rate. Show a rate only
94
+ * when its `live_metered` is true.
95
+ */
96
+ pricing: () => client.request('gateway_getBillingPricing'),
81
97
  };
82
98
  }
83
99
  /**
@@ -90,7 +106,7 @@ export function billingModule(client) {
90
106
  export function creditsModule(client) {
91
107
  const write = (id, input, idempotencyKey) => client.request(id, input, { headers: idempotencyHeaders(id, idempotencyKey) });
92
108
  return {
93
- /** The balance: plan and period, buckets, this month's spend by source, borrow, auto-refill, subscription, pending seat fundings and the Foundry cap mirror. */
109
+ /** The balance: plan and period, buckets, this month's spend by source, borrow, auto-refill, subscription, pending seat fundings, the Foundry cap mirror and (with One plans on) `one_plan`. */
94
110
  get: () => client.request('gateway_getCredits'),
95
111
  /** The catalog: every price with its credits and amount, the pack rate, the payment methods per mode and the wallet-payment terms. Needs no credits account. */
96
112
  catalog: () => client.request('gateway_getCreditCatalog'),
@@ -98,7 +114,7 @@ export function creditsModule(client) {
98
114
  entries: (query = {}) => client.request('gateway_listCreditEntries', query),
99
115
  /** The usage rows behind a debit; `ref` is the Henry run id or receipt id of a ledger entry. */
100
116
  usage: (query = {}) => client.request('gateway_listCreditUsage', query),
101
- /** Change the borrow ceiling and/or auto-refill (pack 10, 25 or 50). */
117
+ /** Change the borrow ceiling and/or auto-refill (pack 10, 25 or 50); with One plans on, the daily limit (`daily_limit_credits`, null clears it) and `always_on_one`. */
102
118
  updateSettings: (body, idempotencyKey) => write('gateway_updateCreditSettings', { body }, idempotencyKey),
103
119
  /** A Stripe Checkout URL (checkout.stripe.com, test mode) for a plan, seats or a credit pack; `return_to` (https://chat.one.ml/pay or below) is where Checkout sends the person back. */
104
120
  checkout: (body, idempotencyKey) => write('gateway_createCreditCheckout', { body }, idempotencyKey),