@hypercli.com/sdk 2026.4.13 → 2026.4.18-1

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
@@ -124,11 +124,14 @@ OpenClaw uses the generic deployment launch surface. `registryUrl`, `registryAut
124
124
  const agent = await client.deployments.createOpenClaw({
125
125
  name: 'docs-demo',
126
126
  start: true,
127
+ heartbeat: { every: '0m' }, // disable upstream OpenClaw heartbeat runs
127
128
  registryUrl: 'git.nedos.co',
128
129
  registryAuth: { username: 'ci', password: 'token' },
129
130
  });
130
131
  ```
131
132
 
133
+ `heartbeat` maps directly to upstream OpenClaw config at `config.agents.defaults.heartbeat`. Omit it to keep upstream defaults, or pass values such as `heartbeat: { every: '1h', target: 'last' }`.
134
+
132
135
  ### OpenClaw Gateway Chat Attachments
133
136
 
134
137
  ```typescript
package/dist/agent.d.ts CHANGED
@@ -100,6 +100,18 @@ export interface HyperAgentEntitlements {
100
100
  activeEntitlementCount: number;
101
101
  billingResetAt: Date | null;
102
102
  }
103
+ export interface HyperAgentEntitlements {
104
+ effectivePlanId: string;
105
+ pooledTpmLimit: number;
106
+ pooledRpmLimit: number;
107
+ pooledTpd: number;
108
+ slotInventory: Record<string, {
109
+ granted: number;
110
+ used: number;
111
+ available: number;
112
+ }>;
113
+ activeEntitlementCount: number;
114
+ }
103
115
  export interface HyperAgentSubscriptionSummary {
104
116
  effectivePlanId: string;
105
117
  currentSubscriptionId: string | null;
@@ -116,7 +128,6 @@ export interface HyperAgentSubscriptionSummary {
116
128
  activeSubscriptionCount: number;
117
129
  activeEntitlementCount: number;
118
130
  entitlements: HyperAgentEntitlements;
119
- entitlementItems: HyperAgentEntitlement[];
120
131
  activeSubscriptions: HyperAgentSubscription[];
121
132
  subscriptions: HyperAgentSubscription[];
122
133
  user: Record<string, any>;
@@ -127,8 +138,8 @@ export interface HyperAgentSubscriptionMutationResult {
127
138
  message: string;
128
139
  subscription?: HyperAgentSubscription;
129
140
  }
130
- export interface HyperAgentSubscriptionUpdateRequest {
131
- bundle?: Record<string, number>;
141
+ export interface HyperAgentUpdateSubscriptionRequest {
142
+ bundle?: Record<string, number> | null;
132
143
  }
133
144
  export interface HyperAgentModel {
134
145
  id: string;
@@ -138,6 +149,162 @@ export interface HyperAgentModel {
138
149
  supportsFunctionCalling: boolean;
139
150
  supportsToolChoice: boolean;
140
151
  }
152
+ export interface HyperAgentUsageSummary {
153
+ totalTokens: number;
154
+ promptTokens: number;
155
+ completionTokens: number;
156
+ requestCount: number;
157
+ activeKeys: number;
158
+ currentTpm: number;
159
+ currentRpm: number;
160
+ period: string;
161
+ }
162
+ export interface HyperAgentUsageHistoryEntry {
163
+ date: string;
164
+ totalTokens: number;
165
+ promptTokens: number;
166
+ completionTokens: number;
167
+ requests: number;
168
+ }
169
+ export interface HyperAgentUsageHistory {
170
+ history: HyperAgentUsageHistoryEntry[];
171
+ days: number;
172
+ }
173
+ export interface HyperAgentKeyUsageEntry {
174
+ keyHash: string;
175
+ name: string;
176
+ totalTokens: number;
177
+ promptTokens: number;
178
+ completionTokens: number;
179
+ requests: number;
180
+ }
181
+ export interface HyperAgentKeyUsage {
182
+ keys: HyperAgentKeyUsageEntry[];
183
+ days: number;
184
+ }
185
+ export interface HyperAgentTypePreset {
186
+ id: string;
187
+ name: string;
188
+ cpu: number;
189
+ memory: number;
190
+ cpuLimit: number;
191
+ memoryLimit: number;
192
+ }
193
+ export interface HyperAgentTypePlan {
194
+ id: string;
195
+ name: string;
196
+ price: number;
197
+ agents: number;
198
+ agentType: string;
199
+ highlighted: boolean;
200
+ }
201
+ export interface HyperAgentTypeCatalog {
202
+ types: HyperAgentTypePreset[];
203
+ plans: HyperAgentTypePlan[];
204
+ }
205
+ export interface HyperAgentBillingProfileFields {
206
+ billingName: string | null;
207
+ billingCompany: string | null;
208
+ billingTaxId: string | null;
209
+ billingLine1: string | null;
210
+ billingLine2: string | null;
211
+ billingCity: string | null;
212
+ billingState: string | null;
213
+ billingPostalCode: string | null;
214
+ billingCountry: string | null;
215
+ }
216
+ export interface HyperAgentBillingInfo {
217
+ address: string[];
218
+ email: string;
219
+ }
220
+ export interface HyperAgentBillingProfileResponse {
221
+ companyBilling: HyperAgentBillingInfo;
222
+ profile: HyperAgentBillingProfileFields | null;
223
+ syncedStripeCustomerIds?: string[];
224
+ }
225
+ export interface HyperAgentBillingUser {
226
+ id: string;
227
+ email: string | null;
228
+ walletAddress: string | null;
229
+ teamId: string | null;
230
+ planId: string | null;
231
+ billingName?: string | null;
232
+ billingCompany?: string | null;
233
+ billingTaxId?: string | null;
234
+ billingLine1?: string | null;
235
+ billingLine2?: string | null;
236
+ billingCity?: string | null;
237
+ billingState?: string | null;
238
+ billingPostalCode?: string | null;
239
+ billingCountry?: string | null;
240
+ }
241
+ export interface HyperAgentPaymentSubscription {
242
+ id: string;
243
+ planId: string;
244
+ provider: string;
245
+ status: string;
246
+ currentPeriodEnd: Date | null;
247
+ stripeSubscriptionId: string | null;
248
+ }
249
+ export interface HyperAgentPaymentEntitlement {
250
+ id: string;
251
+ planId: string;
252
+ provider: string;
253
+ status: string;
254
+ expiresAt: Date | null;
255
+ agentTier: string | null;
256
+ features: Record<string, boolean>;
257
+ tags: string[];
258
+ }
259
+ export interface HyperAgentPayment {
260
+ id: string;
261
+ userId: string;
262
+ subscriptionId: string | null;
263
+ entitlementId: string | null;
264
+ provider: string;
265
+ status: string;
266
+ amount: string;
267
+ currency: string;
268
+ externalPaymentId: string | null;
269
+ createdAt: Date | null;
270
+ updatedAt: Date | null;
271
+ user: HyperAgentBillingUser | null;
272
+ subscription: HyperAgentPaymentSubscription | null;
273
+ entitlement: HyperAgentPaymentEntitlement | null;
274
+ }
275
+ export interface HyperAgentPaymentsResponse {
276
+ items: HyperAgentPayment[];
277
+ }
278
+ export interface HyperAgentPaymentsOptions {
279
+ limit?: number;
280
+ provider?: string;
281
+ status?: string;
282
+ }
283
+ export interface HyperAgentStripeCheckoutRequest {
284
+ successUrl?: string;
285
+ cancelUrl?: string;
286
+ quantity?: number;
287
+ bundle?: Record<string, number>;
288
+ }
289
+ export interface HyperAgentStripeCheckoutResponse {
290
+ checkoutUrl: string;
291
+ }
292
+ export interface HyperAgentX402CheckoutRequest {
293
+ quantity?: number;
294
+ bundle?: Record<string, number>;
295
+ }
296
+ export interface HyperAgentX402CheckoutResponse {
297
+ ok: boolean;
298
+ key: string;
299
+ planId: string;
300
+ quantity: number;
301
+ bundle: Record<string, number>;
302
+ amountPaid: string;
303
+ durationDays: number;
304
+ expiresAt: Date | null;
305
+ tpmLimit: number;
306
+ rpmLimit: number;
307
+ }
141
308
  /**
142
309
  * HyperAgent API Client
143
310
  *
@@ -161,14 +328,16 @@ export declare class HyperAgent {
161
328
  readonly controlBaseUrl: string;
162
329
  constructor(http: HTTPClient, agentApiKey?: string, dev?: boolean, agentsApiBaseUrl?: string);
163
330
  private get baseUrlWithoutV1();
331
+ private controlGet;
332
+ private controlPost;
333
+ private controlPut;
164
334
  plans(): Promise<HyperAgentPlan[]>;
165
335
  currentPlan(): Promise<HyperAgentCurrentPlan>;
166
336
  subscriptions(): Promise<HyperAgentSubscription[]>;
167
337
  subscriptionSummary(): Promise<HyperAgentSubscriptionSummary>;
168
338
  entitlements(): Promise<HyperAgentEntitlementsSummary>;
169
- entitlementInstances(): Promise<HyperAgentEntitlement[]>;
170
- updateSubscription(subscriptionId: string, request: HyperAgentSubscriptionUpdateRequest): Promise<HyperAgentSubscriptionMutationResult>;
171
339
  cancelSubscription(subscriptionId: string): Promise<HyperAgentSubscriptionMutationResult>;
340
+ updateSubscription(subscriptionId: string, request: HyperAgentUpdateSubscriptionRequest): Promise<HyperAgentSubscriptionMutationResult>;
172
341
  models(): Promise<HyperAgentModel[]>;
173
342
  discoveryHealth(): Promise<{
174
343
  hostsTotal: number;
@@ -176,5 +345,16 @@ export declare class HyperAgent {
176
345
  fallbacksActive: number;
177
346
  }>;
178
347
  discoveryConfig(apiKey?: string): Promise<any>;
348
+ usageSummary(): Promise<HyperAgentUsageSummary>;
349
+ usageHistory(days?: number): Promise<HyperAgentUsageHistory>;
350
+ keyUsage(days?: number): Promise<HyperAgentKeyUsage>;
351
+ agentTypes(): Promise<HyperAgentTypeCatalog>;
352
+ billingInfo(): Promise<HyperAgentBillingInfo>;
353
+ billingProfile(): Promise<HyperAgentBillingProfileResponse>;
354
+ updateBillingProfile(profile: HyperAgentBillingProfileFields): Promise<HyperAgentBillingProfileResponse>;
355
+ payments(options?: HyperAgentPaymentsOptions): Promise<HyperAgentPaymentsResponse>;
356
+ payment(paymentId: string): Promise<HyperAgentPayment>;
357
+ createStripeCheckout(request?: HyperAgentStripeCheckoutRequest, planId?: string): Promise<HyperAgentStripeCheckoutResponse>;
358
+ createX402Checkout(request?: HyperAgentX402CheckoutRequest): Promise<HyperAgentX402CheckoutResponse>;
179
359
  }
180
360
  //# sourceMappingURL=agent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA6D5C,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,QAAQ,E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qB,CAAC;IAI5C,WAAW,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAK7C,cAAc,IAAI,OAAO,CAAC,gCAAgC,CAAC;IAI3D,oBAAoB,CAAC,OAAO,EAAE,8BAA8B,GAAG,OAAO,CAAC,gCAAgC,CAAC;IAMxG,QAAQ,CAAC,OAAO,GAAE,yBAA8B,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAQtF,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAItD,oBAAoB,CACxB,OAAO,GAAE,+BAAoC,EAC7C,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,gCAAgC,CAAC;IAWtC,kBAAkB,CAAC,OAAO,GAAE,6BAAkC,GAAG,OAAO,CAAC,8BAA8B,CAAC;CAO/G"}
package/dist/agent.js CHANGED
@@ -159,7 +159,6 @@ function hyperAgentSubscriptionSummaryFromDict(data) {
159
159
  activeSubscriptionCount: data.active_subscription_count || 0,
160
160
  activeEntitlementCount: data.active_entitlement_count || data.active_subscription_count || 0,
161
161
  entitlements: hyperAgentEntitlementsFromDict(data),
162
- entitlementItems: (data.entitlement_items || []).map(hyperAgentEntitlementFromDict),
163
162
  activeSubscriptions: (data.active_subscriptions || []).map(hyperAgentSubscriptionFromDict),
164
163
  subscriptions: (data.subscriptions || []).map(hyperAgentSubscriptionFromDict),
165
164
  user: data.user || {},
@@ -176,6 +175,184 @@ function hyperAgentModelFromDict(data) {
176
175
  supportsToolChoice: caps.supports_tool_choice || false,
177
176
  };
178
177
  }
178
+ function dateFromDict(value) {
179
+ return value ? new Date(String(value).replace('Z', '+00:00')) : null;
180
+ }
181
+ function hyperAgentUsageSummaryFromDict(data) {
182
+ return {
183
+ totalTokens: Number(data?.total_tokens || 0),
184
+ promptTokens: Number(data?.prompt_tokens || 0),
185
+ completionTokens: Number(data?.completion_tokens || 0),
186
+ requestCount: Number(data?.request_count || 0),
187
+ activeKeys: Number(data?.active_keys || 0),
188
+ currentTpm: Number(data?.current_tpm || 0),
189
+ currentRpm: Number(data?.current_rpm || 0),
190
+ period: String(data?.period || ''),
191
+ };
192
+ }
193
+ function hyperAgentUsageHistoryEntryFromDict(data) {
194
+ return {
195
+ date: String(data?.date || ''),
196
+ totalTokens: Number(data?.total_tokens || 0),
197
+ promptTokens: Number(data?.prompt_tokens || 0),
198
+ completionTokens: Number(data?.completion_tokens || 0),
199
+ requests: Number(data?.requests || 0),
200
+ };
201
+ }
202
+ function hyperAgentUsageHistoryFromDict(data) {
203
+ return {
204
+ history: (data?.history || []).map(hyperAgentUsageHistoryEntryFromDict),
205
+ days: Number(data?.days || 0),
206
+ };
207
+ }
208
+ function hyperAgentKeyUsageEntryFromDict(data) {
209
+ return {
210
+ keyHash: String(data?.key_hash || ''),
211
+ name: String(data?.name || ''),
212
+ totalTokens: Number(data?.total_tokens || 0),
213
+ promptTokens: Number(data?.prompt_tokens || 0),
214
+ completionTokens: Number(data?.completion_tokens || 0),
215
+ requests: Number(data?.requests || 0),
216
+ };
217
+ }
218
+ function hyperAgentKeyUsageFromDict(data) {
219
+ return {
220
+ keys: (data?.keys || []).map(hyperAgentKeyUsageEntryFromDict),
221
+ days: Number(data?.days || 0),
222
+ };
223
+ }
224
+ function hyperAgentTypeCatalogFromDict(data) {
225
+ return {
226
+ types: (data?.types || []).map((item) => ({
227
+ id: String(item?.id || ''),
228
+ name: String(item?.name || ''),
229
+ cpu: Number(item?.cpu || 0),
230
+ memory: Number(item?.memory || 0),
231
+ cpuLimit: Number(item?.cpu_limit || 0),
232
+ memoryLimit: Number(item?.memory_limit || 0),
233
+ })),
234
+ plans: (data?.plans || []).map((item) => ({
235
+ id: String(item?.id || ''),
236
+ name: String(item?.name || ''),
237
+ price: Number(item?.price || 0),
238
+ agents: Number(item?.agents || 0),
239
+ agentType: String(item?.agent_type || ''),
240
+ highlighted: Boolean(item?.highlighted),
241
+ })),
242
+ };
243
+ }
244
+ function hyperAgentBillingProfileFieldsFromDict(data) {
245
+ return {
246
+ billingName: data?.billing_name ?? null,
247
+ billingCompany: data?.billing_company ?? null,
248
+ billingTaxId: data?.billing_tax_id ?? null,
249
+ billingLine1: data?.billing_line1 ?? null,
250
+ billingLine2: data?.billing_line2 ?? null,
251
+ billingCity: data?.billing_city ?? null,
252
+ billingState: data?.billing_state ?? null,
253
+ billingPostalCode: data?.billing_postal_code ?? null,
254
+ billingCountry: data?.billing_country ?? null,
255
+ };
256
+ }
257
+ function hyperAgentBillingProfileFieldsToDict(data) {
258
+ return {
259
+ billing_name: data.billingName,
260
+ billing_company: data.billingCompany,
261
+ billing_tax_id: data.billingTaxId,
262
+ billing_line1: data.billingLine1,
263
+ billing_line2: data.billingLine2,
264
+ billing_city: data.billingCity,
265
+ billing_state: data.billingState,
266
+ billing_postal_code: data.billingPostalCode,
267
+ billing_country: data.billingCountry,
268
+ };
269
+ }
270
+ function hyperAgentBillingInfoFromDict(data) {
271
+ return {
272
+ address: Array.isArray(data?.address) ? data.address.map(String) : [],
273
+ email: String(data?.email || ''),
274
+ };
275
+ }
276
+ function hyperAgentBillingProfileResponseFromDict(data) {
277
+ return {
278
+ companyBilling: hyperAgentBillingInfoFromDict(data?.company_billing || {}),
279
+ profile: data?.profile ? hyperAgentBillingProfileFieldsFromDict(data.profile) : null,
280
+ syncedStripeCustomerIds: Array.isArray(data?.synced_stripe_customer_ids) ? data.synced_stripe_customer_ids.map(String) : undefined,
281
+ };
282
+ }
283
+ function hyperAgentPaymentFromDict(data) {
284
+ return {
285
+ id: String(data?.id || ''),
286
+ userId: String(data?.user_id || ''),
287
+ subscriptionId: data?.subscription_id ?? null,
288
+ entitlementId: data?.entitlement_id ?? null,
289
+ provider: String(data?.provider || ''),
290
+ status: String(data?.status || ''),
291
+ amount: String(data?.amount || ''),
292
+ currency: String(data?.currency || ''),
293
+ externalPaymentId: data?.external_payment_id ?? null,
294
+ createdAt: dateFromDict(data?.created_at),
295
+ updatedAt: dateFromDict(data?.updated_at),
296
+ user: data?.user ? {
297
+ id: String(data.user.id || ''),
298
+ email: data.user.email ?? null,
299
+ walletAddress: data.user.wallet_address ?? null,
300
+ teamId: data.user.team_id ?? null,
301
+ planId: data.user.plan_id ?? null,
302
+ billingName: data.user.billing_name ?? null,
303
+ billingCompany: data.user.billing_company ?? null,
304
+ billingTaxId: data.user.billing_tax_id ?? null,
305
+ billingLine1: data.user.billing_line1 ?? null,
306
+ billingLine2: data.user.billing_line2 ?? null,
307
+ billingCity: data.user.billing_city ?? null,
308
+ billingState: data.user.billing_state ?? null,
309
+ billingPostalCode: data.user.billing_postal_code ?? null,
310
+ billingCountry: data.user.billing_country ?? null,
311
+ } : null,
312
+ subscription: data?.subscription ? {
313
+ id: String(data.subscription.id || ''),
314
+ planId: String(data.subscription.plan_id || ''),
315
+ provider: String(data.subscription.provider || ''),
316
+ status: String(data.subscription.status || ''),
317
+ currentPeriodEnd: dateFromDict(data.subscription.current_period_end),
318
+ stripeSubscriptionId: data.subscription.stripe_subscription_id ?? null,
319
+ } : null,
320
+ entitlement: data?.entitlement ? {
321
+ id: String(data.entitlement.id || ''),
322
+ planId: String(data.entitlement.plan_id || ''),
323
+ provider: String(data.entitlement.provider || ''),
324
+ status: String(data.entitlement.status || ''),
325
+ expiresAt: dateFromDict(data.entitlement.expires_at),
326
+ agentTier: data.entitlement.agent_tier ?? null,
327
+ features: data.entitlement.features || {},
328
+ tags: Array.isArray(data.entitlement.tags) ? data.entitlement.tags.map(String) : [],
329
+ } : null,
330
+ };
331
+ }
332
+ function hyperAgentPaymentsResponseFromDict(data) {
333
+ return {
334
+ items: (data?.items || []).map(hyperAgentPaymentFromDict),
335
+ };
336
+ }
337
+ function hyperAgentStripeCheckoutResponseFromDict(data) {
338
+ return {
339
+ checkoutUrl: String(data?.checkout_url || ''),
340
+ };
341
+ }
342
+ function hyperAgentX402CheckoutResponseFromDict(data) {
343
+ return {
344
+ ok: Boolean(data?.ok),
345
+ key: String(data?.key || ''),
346
+ planId: String(data?.plan_id || ''),
347
+ quantity: Number(data?.quantity || 0),
348
+ bundle: data?.bundle || {},
349
+ amountPaid: String(data?.amount_paid || ''),
350
+ durationDays: Number(data?.duration_days || 0),
351
+ expiresAt: dateFromDict(data?.expires_at),
352
+ tpmLimit: Number(data?.tpm_limit || 0),
353
+ rpmLimit: Number(data?.rpm_limit || 0),
354
+ };
355
+ }
179
356
  /**
180
357
  * HyperAgent API Client
181
358
  *
@@ -208,6 +385,53 @@ export class HyperAgent {
208
385
  get baseUrlWithoutV1() {
209
386
  return this.baseUrl.replace(/\/v1$/, '');
210
387
  }
388
+ async controlGet(path, params) {
389
+ const url = new URL(`${this.controlBaseUrl}${path}`);
390
+ if (params) {
391
+ for (const [key, value] of Object.entries(params)) {
392
+ if (value !== undefined && value !== null) {
393
+ url.searchParams.set(key, String(value));
394
+ }
395
+ }
396
+ }
397
+ const response = await fetch(url.toString(), {
398
+ headers: {
399
+ Authorization: `Bearer ${this.apiKey}`,
400
+ },
401
+ });
402
+ if (!response.ok) {
403
+ throw new Error(`Failed to GET ${path}: ${response.statusText}`);
404
+ }
405
+ return response.json();
406
+ }
407
+ async controlPost(path, body) {
408
+ const response = await fetch(`${this.controlBaseUrl}${path}`, {
409
+ method: 'POST',
410
+ headers: {
411
+ Authorization: `Bearer ${this.apiKey}`,
412
+ 'Content-Type': 'application/json',
413
+ },
414
+ body: JSON.stringify(body ?? {}),
415
+ });
416
+ if (!response.ok) {
417
+ throw new Error(`Failed to POST ${path}: ${response.statusText}`);
418
+ }
419
+ return response.json();
420
+ }
421
+ async controlPut(path, body) {
422
+ const response = await fetch(`${this.controlBaseUrl}${path}`, {
423
+ method: 'PUT',
424
+ headers: {
425
+ Authorization: `Bearer ${this.apiKey}`,
426
+ 'Content-Type': 'application/json',
427
+ },
428
+ body: JSON.stringify(body ?? {}),
429
+ });
430
+ if (!response.ok) {
431
+ throw new Error(`Failed to PUT ${path}: ${response.statusText}`);
432
+ }
433
+ return response.json();
434
+ }
211
435
  async plans() {
212
436
  const response = await fetch(`${this.controlBaseUrl}/plans`, {
213
437
  headers: {
@@ -268,17 +492,22 @@ export class HyperAgent {
268
492
  const data = await response.json();
269
493
  return hyperAgentSubscriptionSummaryFromDict(data);
270
494
  }
271
- async entitlementInstances() {
272
- const response = await fetch(`${this.controlBaseUrl}/entitlements/instances`, {
495
+ async cancelSubscription(subscriptionId) {
496
+ const response = await fetch(`${this.controlBaseUrl}/subscriptions/${subscriptionId}/cancel`, {
497
+ method: 'POST',
273
498
  headers: {
274
499
  Authorization: `Bearer ${this.apiKey}`,
275
500
  },
276
501
  });
277
502
  if (!response.ok) {
278
- throw new Error(`Failed to get entitlement instances: ${response.statusText}`);
503
+ throw new Error(`Failed to get entitlements: ${response.statusText}`);
279
504
  }
280
505
  const data = await response.json();
281
- return (data.items || []).map(hyperAgentEntitlementFromDict);
506
+ return {
507
+ ok: Boolean(data.ok),
508
+ message: data.message || '',
509
+ subscription: data.subscription ? hyperAgentSubscriptionFromDict(data.subscription) : undefined,
510
+ };
282
511
  }
283
512
  async updateSubscription(subscriptionId, request) {
284
513
  const response = await fetch(`${this.controlBaseUrl}/subscriptions/${subscriptionId}/update`, {
@@ -287,7 +516,9 @@ export class HyperAgent {
287
516
  Authorization: `Bearer ${this.apiKey}`,
288
517
  'Content-Type': 'application/json',
289
518
  },
290
- body: JSON.stringify({ bundle: request.bundle || {} }),
519
+ body: JSON.stringify({
520
+ bundle: request.bundle ?? null,
521
+ }),
291
522
  });
292
523
  if (!response.ok) {
293
524
  throw new Error(`Failed to update subscription: ${response.statusText}`);
@@ -299,9 +530,6 @@ export class HyperAgent {
299
530
  subscription: data.subscription ? hyperAgentSubscriptionFromDict(data.subscription) : undefined,
300
531
  };
301
532
  }
302
- async cancelSubscription(subscriptionId) {
303
- return this.updateSubscription(subscriptionId, { bundle: {} });
304
- }
305
533
  async models() {
306
534
  const response = await fetch(`${this.baseUrl}/models`, {
307
535
  headers: {
@@ -339,5 +567,57 @@ export class HyperAgent {
339
567
  }
340
568
  return await response.json();
341
569
  }
570
+ async usageSummary() {
571
+ return hyperAgentUsageSummaryFromDict(await this.controlGet('/usage'));
572
+ }
573
+ async usageHistory(days = 7) {
574
+ return hyperAgentUsageHistoryFromDict(await this.controlGet('/usage/history', { days }));
575
+ }
576
+ async keyUsage(days = 7) {
577
+ return hyperAgentKeyUsageFromDict(await this.controlGet('/usage/keys', { days }));
578
+ }
579
+ async agentTypes() {
580
+ return hyperAgentTypeCatalogFromDict(await this.controlGet('/types'));
581
+ }
582
+ async billingInfo() {
583
+ const data = await this.controlGet('/billing/info');
584
+ return hyperAgentBillingInfoFromDict(data?.company_billing || {});
585
+ }
586
+ async billingProfile() {
587
+ return hyperAgentBillingProfileResponseFromDict(await this.controlGet('/billing/profile'));
588
+ }
589
+ async updateBillingProfile(profile) {
590
+ return hyperAgentBillingProfileResponseFromDict(await this.controlPut('/billing/profile', hyperAgentBillingProfileFieldsToDict(profile)));
591
+ }
592
+ async payments(options = {}) {
593
+ const params = {};
594
+ if (options.limit !== undefined)
595
+ params.limit = options.limit;
596
+ if (options.provider)
597
+ params.provider = options.provider;
598
+ if (options.status)
599
+ params.status = options.status;
600
+ return hyperAgentPaymentsResponseFromDict(await this.controlGet('/billing/payments', params));
601
+ }
602
+ async payment(paymentId) {
603
+ return hyperAgentPaymentFromDict(await this.controlGet(`/billing/payments/${encodeURIComponent(paymentId)}`));
604
+ }
605
+ async createStripeCheckout(request = {}, planId) {
606
+ const payload = {
607
+ ...(request.successUrl ? { success_url: request.successUrl } : {}),
608
+ ...(request.cancelUrl ? { cancel_url: request.cancelUrl } : {}),
609
+ ...(request.quantity !== undefined ? { quantity: request.quantity } : {}),
610
+ ...(request.bundle ? { bundle: request.bundle } : {}),
611
+ };
612
+ const path = planId ? `/stripe/${encodeURIComponent(planId)}` : '/stripe/checkout';
613
+ return hyperAgentStripeCheckoutResponseFromDict(await this.controlPost(path, payload));
614
+ }
615
+ async createX402Checkout(request = {}) {
616
+ const payload = {
617
+ ...(request.quantity !== undefined ? { quantity: request.quantity } : {}),
618
+ ...(request.bundle ? { bundle: request.bundle } : {}),
619
+ };
620
+ return hyperAgentX402CheckoutResponseFromDict(await this.controlPost('/x402/checkout', payload));
621
+ }
342
622
  }
343
623
  //# sourceMappingURL=agent.js.map