@flashbacktech/tsclient 0.4.54 → 0.4.55

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/dist/index.d.cts CHANGED
@@ -120,6 +120,8 @@ interface RegisterRequest {
120
120
  isBusiness?: boolean;
121
121
  activationUid?: string;
122
122
  activationToken?: string;
123
+ /** Optional referral/reseller code applied to the new org at signup. */
124
+ referralCode?: string;
123
125
  }
124
126
  interface ActivateRequest {
125
127
  uid: string;
@@ -301,6 +303,16 @@ interface Organization {
301
303
  * ADMIN_ORGANIZATION env var).
302
304
  */
303
305
  isAdmin?: boolean;
306
+ /** Admin-designated reseller. Unlocks the /reseller surface. */
307
+ isReseller?: boolean;
308
+ /** Per-reseller commission override in bps; null => global default. */
309
+ resellerCommissionBps?: number | null;
310
+ /** Set when this org redeemed a reseller's code; null => not from a reseller. */
311
+ resellerOrgId?: string | null;
312
+ /** ISO 8601 timestamp the reseller association was established. */
313
+ resellerAssociatedAt?: string | null;
314
+ /** ISO 8601 timestamp an admin ended the association; null => active. */
315
+ resellerDetachedAt?: string | null;
304
316
  }
305
317
  interface UpdateOrganizationRequest {
306
318
  name?: string;
@@ -2294,6 +2306,182 @@ declare class BudgetsClient {
2294
2306
  updateScheduleCostLimit(scheduleId: string, body: UpdateCostLimitRequest): Promise<unknown>;
2295
2307
  }
2296
2308
 
2309
+ /** A redeemable referral code minted by an org (multiple, named per campaign). */
2310
+ interface ReferralCode {
2311
+ id: string;
2312
+ orgId: string;
2313
+ code: string;
2314
+ label?: string | null;
2315
+ isActive: boolean;
2316
+ createdAt: string;
2317
+ deletedAt?: string | null;
2318
+ /** Per-code stats (populated by listCodes). */
2319
+ redeemedCount: number;
2320
+ qualifiedCount: number;
2321
+ }
2322
+ /** Attribution row + snapshotted terms for a referred org. */
2323
+ interface ReferralRedemption {
2324
+ id: string;
2325
+ codeId: string;
2326
+ referrerOrgId: string;
2327
+ referredOrgId: string;
2328
+ configId?: string | null;
2329
+ isResellerCode: boolean;
2330
+ lockedReferrerRewardMicros: number;
2331
+ lockedReferredWelcomeMicros: number;
2332
+ lockedThresholdMicros: number;
2333
+ status: 'pending' | 'paid' | 'void';
2334
+ qualifiedAt?: string | null;
2335
+ referrerGrantTxId?: string | null;
2336
+ referredGrantTxId?: string | null;
2337
+ redeemedAt: string;
2338
+ }
2339
+ /** Caller org's referral summary as referrer. */
2340
+ interface ReferralStats {
2341
+ redeemedCount: number;
2342
+ qualifiedCount: number;
2343
+ totalCreditsEarnedMicros: number;
2344
+ }
2345
+ interface MintReferralCodeRequest {
2346
+ label?: string;
2347
+ }
2348
+ interface RedeemReferralCodeRequest {
2349
+ code: string;
2350
+ }
2351
+
2352
+ /**
2353
+ * Org self-service referrals. Any org can mint codes and redeem one (subject
2354
+ * to server-side guards: never-attributed, not reseller-associated, and
2355
+ * pre-first-purchase). Two-sided credits fire once the referred org's
2356
+ * cumulative spend reaches the snapshotted threshold.
2357
+ */
2358
+ declare class ReferralsClient {
2359
+ private readonly http;
2360
+ constructor(http: BaseClient);
2361
+ /** Mint a new referral code for the caller's org. */
2362
+ mintCode(body?: MintReferralCodeRequest): Promise<ReferralCode>;
2363
+ /** List the caller org's codes with per-code redeemed/qualified counts. */
2364
+ listCodes(): Promise<ReferralCode[]>;
2365
+ /** Activate or deactivate one of the caller org's codes. */
2366
+ setCodeActive(codeId: string, isActive: boolean): Promise<ReferralCode>;
2367
+ /** Caller org's referral summary as referrer (redemptions, qualified, credits earned). */
2368
+ stats(): Promise<ReferralStats>;
2369
+ /**
2370
+ * Redeem a referral code for the caller's org. Fails (4xx with an
2371
+ * `error_code`) when a guard rejects it: `code_inactive`, `self_referral`,
2372
+ * `already_redeemed`, `already_associated`, or `has_purchases`.
2373
+ */
2374
+ redeem(body: RedeemReferralCodeRequest): Promise<ReferralRedemption>;
2375
+ }
2376
+
2377
+ /** One org associated to a reseller, with gross + commission rollups. */
2378
+ interface AssociatedOrg {
2379
+ orgId: string;
2380
+ orgName: string;
2381
+ associatedAt?: string | null;
2382
+ detachedAt?: string | null;
2383
+ grossPurchasedMicros: number;
2384
+ commissionAccruedMicros: number;
2385
+ commissionPaidMicros: number;
2386
+ }
2387
+ /** One cash-commission accrual row. */
2388
+ interface ResellerCommission {
2389
+ id: string;
2390
+ resellerOrgId: string;
2391
+ associatedOrgId: string;
2392
+ paymentId: string;
2393
+ grossAmountMicros: number;
2394
+ commissionBps: number;
2395
+ commissionAmountMicros: number;
2396
+ status: 'accrued' | 'paid' | 'void';
2397
+ payoutId?: string | null;
2398
+ accruedAt: string;
2399
+ }
2400
+ /** One monthly payout (batch computes; money movement is ops). */
2401
+ interface ResellerPayout {
2402
+ id: string;
2403
+ resellerOrgId: string;
2404
+ periodStart: string;
2405
+ periodEnd: string;
2406
+ totalAmountMicros: number;
2407
+ status: 'draft' | 'approved' | 'paid';
2408
+ externalRef?: string | null;
2409
+ createdAt: string;
2410
+ paidAt?: string | null;
2411
+ }
2412
+ /** A reseller org plus aggregate performance (admin list). */
2413
+ interface ResellerPerformance extends Organization {
2414
+ associatedOrgCount: number;
2415
+ commissionAccruedMicros: number;
2416
+ commissionPaidMicros: number;
2417
+ }
2418
+ /** One row of the time-journaled billing-program parameters. */
2419
+ interface BillingProgramConfig {
2420
+ id: string;
2421
+ validFrom: string;
2422
+ validTo?: string | null;
2423
+ referrerRewardMicros: number;
2424
+ referredWelcomeMicros: number;
2425
+ referralThresholdMicros: number;
2426
+ defaultResellerCommissionBps: number;
2427
+ createdAt: string;
2428
+ createdBy?: string | null;
2429
+ note?: string | null;
2430
+ }
2431
+ interface SetResellerRequest {
2432
+ /** Per-reseller commission override in bps; omit to use the global default. */
2433
+ commissionBps?: number;
2434
+ }
2435
+ interface AppendProgramConfigRequest {
2436
+ referrerRewardMicros: number;
2437
+ referredWelcomeMicros: number;
2438
+ referralThresholdMicros: number;
2439
+ defaultResellerCommissionBps: number;
2440
+ note?: string;
2441
+ }
2442
+ interface GeneratePayoutsRequest {
2443
+ /** Inclusive period start, YYYY-MM-DD. */
2444
+ periodStart: string;
2445
+ /** Exclusive period end, YYYY-MM-DD. */
2446
+ periodEnd: string;
2447
+ }
2448
+ interface UpdatePayoutRequest {
2449
+ status: 'draft' | 'approved' | 'paid';
2450
+ externalRef?: string;
2451
+ }
2452
+
2453
+ /**
2454
+ * Reseller surface. The first three methods are self-service for an org with
2455
+ * `isReseller === true` (the server gates on it). The remaining methods are
2456
+ * platform-admin only (gated on the caller's home org being the admin org).
2457
+ */
2458
+ declare class ResellerClient {
2459
+ private readonly http;
2460
+ constructor(http: BaseClient);
2461
+ /** Orgs associated to the caller reseller, with gross + commission rollups. */
2462
+ listAssociatedOrgs(): Promise<AssociatedOrg[]>;
2463
+ /** The caller reseller's commission ledger. */
2464
+ listCommissions(): Promise<ResellerCommission[]>;
2465
+ /** The caller reseller's payout history. */
2466
+ listPayouts(): Promise<ResellerPayout[]>;
2467
+ /** List all reseller orgs with aggregate performance. */
2468
+ listResellers(): Promise<ResellerPerformance[]>;
2469
+ /** Designate an org as a reseller (optionally with a per-reseller bps override). */
2470
+ setReseller(orgId: string, body?: SetResellerRequest): Promise<Organization>;
2471
+ /** Revoke an org's reseller status. */
2472
+ revokeReseller(orgId: string): Promise<Organization>;
2473
+ /** End an org's reseller association (stamps resellerDetachedAt). */
2474
+ detachAssociation(orgId: string): Promise<Organization>;
2475
+ /** The billing-program-config journal, newest first. */
2476
+ getProgramConfig(): Promise<BillingProgramConfig[]>;
2477
+ /** Append a new program-config period (closes the prior open row). */
2478
+ appendProgramConfig(body: AppendProgramConfigRequest): Promise<BillingProgramConfig>;
2479
+ /** Draft payouts from accrued commissions in the given period. */
2480
+ generatePayouts(body: GeneratePayoutsRequest): Promise<ResellerPayout[]>;
2481
+ /** Approve or mark-paid a payout (and optionally record an external ref). */
2482
+ updatePayout(payoutId: string, body: UpdatePayoutRequest): Promise<ResellerPayout>;
2483
+ }
2484
+
2297
2485
  type CloudAgentClientOptions = BaseClientOptions;
2298
2486
  declare class AgentEngineFacade {
2299
2487
  readonly templates: TemplatesClient;
@@ -2321,6 +2509,8 @@ declare class CloudAgentClient {
2321
2509
  readonly billing: BillingFacade;
2322
2510
  readonly usage: UsageClient;
2323
2511
  readonly budgets: BudgetsClient;
2512
+ readonly referrals: ReferralsClient;
2513
+ readonly reseller: ResellerClient;
2324
2514
  constructor(options: CloudAgentClientOptions);
2325
2515
  }
2326
2516
 
@@ -2335,4 +2525,4 @@ declare class NotImplementedError extends Error {
2335
2525
  constructor(method: string);
2336
2526
  }
2337
2527
 
2338
- export { type AcceptInviteRequest, AccessType, type AcquireScanLeaseRequest, type AcquireScanLeaseResponse, type ActionCategory, type ActivateRequest, type AddMemberRequest, type AddUserToOrgRequest, type AddUserToOrgResult, type AdjustOrgCreditsRequest, type AdjustOrgCreditsResult, type AnswerChatQuestionRequest, type AnswerChatQuestionResponse, type AuthUser, BaseClient, type BaseClientOptions, type BudgetScope, BudgetsClient, type BuyCreditPackRequest, type BuyCreditPackResponse, type BuyCustomCreditRequest, type BuyCustomCreditResponse, type BuySubscriptionRequest, type BuySubscriptionResponse, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_NOTIFY, CAP_STORAGE, CAP_VCS, type CancelChatTurnResponse, type CancelSubscriptionResponse, type ChatAssistantMessagePayload, type ChatBillingRefuseCode, type ChatBillingRefuseError, type ChatBudget, type ChatCheckpointedPayload, type ChatCompactionFiredPayload, type ChatDonePayload, type ChatEvent, type ChatEventType, type ChatFeedback, type ChatFeedbackEnvelope, type ChatMessage, type ChatMessageKind, type ChatMessageRole, type ChatNarrationPayload, type ChatPhase, type ChatPhasePayload, type ChatPlanDraftPayload, type ChatQuestionPayload, type ChatSchedule, type ChatScheduleEnvelope, type ChatScheduleNotifyOn, type ChatScheduleRunStatus, type ChatScope, type ChatSession, type ChatSessionSource, type ChatSessionTitlePayload, type ChatStepEventPayload, type ChatStepProgressPayload, type ChatStreamHandle, type ChatToolCallConfirmationRequiredPayload, type ChatToolCallFinishedPayload, type ChatToolCallStartedPayload, type ChatTurnStatus, type ClarificationOption, CloudAgentClient, type CloudAgentClientOptions, type CloudResource, type CloudResourceContainerRef, type CloudResourceEdge, type CloudScanHistory, type CloudScanLease, type ConfirmChatToolCallRequest, type ConfirmChatToolCallResponse, type CreateAgentTemplateRequest, type CreateChatScheduleRequest, type CreateChatSessionRequest, type CreateChatSessionResponse, type CreateCredentialRequest, type CreateGatewayTokenRequest, type CreateGatewayTokenResponse, type CreateOrganizationUserRequest, type CreateProjectRequest, type CreateSandboxRequest, type CreateScheduledTaskRequest, type Credential, type CreditBalance, type CreditPack, type CreditTransaction, type CreditTransactionKind, type CreditTransactionType, type CustomCreditPurchaseConfig, type DebugPayload, type DebugReceipt, type EffectiveChatBudget, type ExchangeCodeRequest, type FieldSpec, type FieldType, type FineTuneParams, type GatewayToken, type GetChatSessionResponse, type GetUsageSummaryQuery, type GetUsageSummaryResponse, HttpError, type ImpersonationProvider, type InviteOrgRequest, type InviteOrgResult, type ListAgentTemplatesQuery, type ListAgentTemplatesResponse, type ListChatFeedbackResponse, type ListChatScheduleRunsResponse, type ListChatSchedulesResponse, type ListChatSessionsQuery, type ListChatSessionsResponse, type ListCredentialsQuery, type ListCreditsTransactionsQuery, type ListCreditsTransactionsResponse, type ListPaymentsResponse, type ListSandboxesQuery, type ListScanHistoryQuery, type ListScanHistoryResponse, type ListScheduledTasksQuery, type ListScheduledTasksResponse, type LoginRequest, type MFASetupResponse, type MFASimpleResponse, type MFAStatus, MFAType, type MFAVerifyLoginRequest, type MFAVerifyLoginResponse, type MFAVerifySetupRequest, type MagicLinkActivateRequest, type MagicLinkSendResponse, type ModeType, type MonthlyCreditStats, NotImplementedError, type NotifyChannelOption, type NotifyEventType, type NotifySubscription, type OpenChatStreamOptions, type OrgBudget, type OrgCreditBalance, type OrgNotifySubscriptions, OrgRoles, type OrgSubscription, type Organization, type OrganizationUser, PROVIDER_CATALOG, type Payment, type PeekScanLeaseResponse, type PostChatMessageRequest, type PostChatMessageResponse, type Project, type ProjectMember, type ProviderID, type ProviderSpec, ProviderType, type PublicConfig, type Query, type ReconcileScope, type ReconcileTuple, type RefreshRequest, type RegisterRequest, type RequestOptions, type ResetPasswordRequest, type ResourceTreeCategory, type ResourceTreeCredential, type ResourceTreeGrouping, type ResourceTreeResource, type ResourceTreeResponse, ResourcesClient, type Sandbox, type SandboxCredential, type ScanInProgressError, type ScheduledTask, type ScopedBudget, type SessionResponse, type SessionTokens, type SetOrgNotifySubscriptionsRequest, type SimpleAgentResponse, type SimpleKeysResponse, type SimpleOrgResponse, type SimpleResponse$2 as SimpleResponse, type StorageType, type SubgraphDirection, type SubgraphRequest, type SubgraphResponse, type SubmitChatFeedbackRequest, type Subscription, type SubscriptionCapability, type SubscriptionPeriod, type SystemEvent, type SystemEventQuery, type SystemEventQueryResponse, type SystemEventReadResponse, type Template, type TokenProvider, type UnauthorizedHandler, type UpdateChatBudgetRequest, type UpdateChatScheduleRequest, type UpdateCostLimitRequest, type UpdateCredentialRequest, type UpdateMemberRoleRequest, type UpdateOrgBudgetRequest, type UpdateOrgUserRequest, type UpdateOrganizationRequest, type UpdateProjectRequest, type UpdateSandboxRequest, type UpdateScopedBudgetRequest, type UpdateUserRequest, type UpdateUserResponse, type UsageBucket, type UsageByModelQuery, type UsageByModelResponse, type UsageByModelRow, type UsageCostSplit, type UsageReportQuery, type UsageReportResponse, type UsageSummary, type UsageSummaryQuery, type UsageSummaryResponse, type UsageTotals, type UsageWindow, type UserProfile, type UserSummary, computeDisplayHint, getProvider, getValueAt, isMetadataPath, isSecretPath, listProviders, metadataKey, setValueAt, usdMicros, validate };
2528
+ export { type AcceptInviteRequest, AccessType, type AcquireScanLeaseRequest, type AcquireScanLeaseResponse, type ActionCategory, type ActivateRequest, type AddMemberRequest, type AddUserToOrgRequest, type AddUserToOrgResult, type AdjustOrgCreditsRequest, type AdjustOrgCreditsResult, type AnswerChatQuestionRequest, type AnswerChatQuestionResponse, type AppendProgramConfigRequest, type AssociatedOrg, type AuthUser, BaseClient, type BaseClientOptions, type BillingProgramConfig, type BudgetScope, BudgetsClient, type BuyCreditPackRequest, type BuyCreditPackResponse, type BuyCustomCreditRequest, type BuyCustomCreditResponse, type BuySubscriptionRequest, type BuySubscriptionResponse, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_NOTIFY, CAP_STORAGE, CAP_VCS, type CancelChatTurnResponse, type CancelSubscriptionResponse, type ChatAssistantMessagePayload, type ChatBillingRefuseCode, type ChatBillingRefuseError, type ChatBudget, type ChatCheckpointedPayload, type ChatCompactionFiredPayload, type ChatDonePayload, type ChatEvent, type ChatEventType, type ChatFeedback, type ChatFeedbackEnvelope, type ChatMessage, type ChatMessageKind, type ChatMessageRole, type ChatNarrationPayload, type ChatPhase, type ChatPhasePayload, type ChatPlanDraftPayload, type ChatQuestionPayload, type ChatSchedule, type ChatScheduleEnvelope, type ChatScheduleNotifyOn, type ChatScheduleRunStatus, type ChatScope, type ChatSession, type ChatSessionSource, type ChatSessionTitlePayload, type ChatStepEventPayload, type ChatStepProgressPayload, type ChatStreamHandle, type ChatToolCallConfirmationRequiredPayload, type ChatToolCallFinishedPayload, type ChatToolCallStartedPayload, type ChatTurnStatus, type ClarificationOption, CloudAgentClient, type CloudAgentClientOptions, type CloudResource, type CloudResourceContainerRef, type CloudResourceEdge, type CloudScanHistory, type CloudScanLease, type ConfirmChatToolCallRequest, type ConfirmChatToolCallResponse, type CreateAgentTemplateRequest, type CreateChatScheduleRequest, type CreateChatSessionRequest, type CreateChatSessionResponse, type CreateCredentialRequest, type CreateGatewayTokenRequest, type CreateGatewayTokenResponse, type CreateOrganizationUserRequest, type CreateProjectRequest, type CreateSandboxRequest, type CreateScheduledTaskRequest, type Credential, type CreditBalance, type CreditPack, type CreditTransaction, type CreditTransactionKind, type CreditTransactionType, type CustomCreditPurchaseConfig, type DebugPayload, type DebugReceipt, type EffectiveChatBudget, type ExchangeCodeRequest, type FieldSpec, type FieldType, type FineTuneParams, type GatewayToken, type GeneratePayoutsRequest, type GetChatSessionResponse, type GetUsageSummaryQuery, type GetUsageSummaryResponse, HttpError, type ImpersonationProvider, type InviteOrgRequest, type InviteOrgResult, type ListAgentTemplatesQuery, type ListAgentTemplatesResponse, type ListChatFeedbackResponse, type ListChatScheduleRunsResponse, type ListChatSchedulesResponse, type ListChatSessionsQuery, type ListChatSessionsResponse, type ListCredentialsQuery, type ListCreditsTransactionsQuery, type ListCreditsTransactionsResponse, type ListPaymentsResponse, type ListSandboxesQuery, type ListScanHistoryQuery, type ListScanHistoryResponse, type ListScheduledTasksQuery, type ListScheduledTasksResponse, type LoginRequest, type MFASetupResponse, type MFASimpleResponse, type MFAStatus, MFAType, type MFAVerifyLoginRequest, type MFAVerifyLoginResponse, type MFAVerifySetupRequest, type MagicLinkActivateRequest, type MagicLinkSendResponse, type MintReferralCodeRequest, type ModeType, type MonthlyCreditStats, NotImplementedError, type NotifyChannelOption, type NotifyEventType, type NotifySubscription, type OpenChatStreamOptions, type OrgBudget, type OrgCreditBalance, type OrgNotifySubscriptions, OrgRoles, type OrgSubscription, type Organization, type OrganizationUser, PROVIDER_CATALOG, type Payment, type PeekScanLeaseResponse, type PostChatMessageRequest, type PostChatMessageResponse, type Project, type ProjectMember, type ProviderID, type ProviderSpec, ProviderType, type PublicConfig, type Query, type ReconcileScope, type ReconcileTuple, type RedeemReferralCodeRequest, type ReferralCode, type ReferralRedemption, type ReferralStats, ReferralsClient, type RefreshRequest, type RegisterRequest, type RequestOptions, ResellerClient, type ResellerCommission, type ResellerPayout, type ResellerPerformance, type ResetPasswordRequest, type ResourceTreeCategory, type ResourceTreeCredential, type ResourceTreeGrouping, type ResourceTreeResource, type ResourceTreeResponse, ResourcesClient, type Sandbox, type SandboxCredential, type ScanInProgressError, type ScheduledTask, type ScopedBudget, type SessionResponse, type SessionTokens, type SetOrgNotifySubscriptionsRequest, type SetResellerRequest, type SimpleAgentResponse, type SimpleKeysResponse, type SimpleOrgResponse, type SimpleResponse$2 as SimpleResponse, type StorageType, type SubgraphDirection, type SubgraphRequest, type SubgraphResponse, type SubmitChatFeedbackRequest, type Subscription, type SubscriptionCapability, type SubscriptionPeriod, type SystemEvent, type SystemEventQuery, type SystemEventQueryResponse, type SystemEventReadResponse, type Template, type TokenProvider, type UnauthorizedHandler, type UpdateChatBudgetRequest, type UpdateChatScheduleRequest, type UpdateCostLimitRequest, type UpdateCredentialRequest, type UpdateMemberRoleRequest, type UpdateOrgBudgetRequest, type UpdateOrgUserRequest, type UpdateOrganizationRequest, type UpdatePayoutRequest, type UpdateProjectRequest, type UpdateSandboxRequest, type UpdateScopedBudgetRequest, type UpdateUserRequest, type UpdateUserResponse, type UsageBucket, type UsageByModelQuery, type UsageByModelResponse, type UsageByModelRow, type UsageCostSplit, type UsageReportQuery, type UsageReportResponse, type UsageSummary, type UsageSummaryQuery, type UsageSummaryResponse, type UsageTotals, type UsageWindow, type UserProfile, type UserSummary, computeDisplayHint, getProvider, getValueAt, isMetadataPath, isSecretPath, listProviders, metadataKey, setValueAt, usdMicros, validate };
package/dist/index.d.ts CHANGED
@@ -120,6 +120,8 @@ interface RegisterRequest {
120
120
  isBusiness?: boolean;
121
121
  activationUid?: string;
122
122
  activationToken?: string;
123
+ /** Optional referral/reseller code applied to the new org at signup. */
124
+ referralCode?: string;
123
125
  }
124
126
  interface ActivateRequest {
125
127
  uid: string;
@@ -301,6 +303,16 @@ interface Organization {
301
303
  * ADMIN_ORGANIZATION env var).
302
304
  */
303
305
  isAdmin?: boolean;
306
+ /** Admin-designated reseller. Unlocks the /reseller surface. */
307
+ isReseller?: boolean;
308
+ /** Per-reseller commission override in bps; null => global default. */
309
+ resellerCommissionBps?: number | null;
310
+ /** Set when this org redeemed a reseller's code; null => not from a reseller. */
311
+ resellerOrgId?: string | null;
312
+ /** ISO 8601 timestamp the reseller association was established. */
313
+ resellerAssociatedAt?: string | null;
314
+ /** ISO 8601 timestamp an admin ended the association; null => active. */
315
+ resellerDetachedAt?: string | null;
304
316
  }
305
317
  interface UpdateOrganizationRequest {
306
318
  name?: string;
@@ -2294,6 +2306,182 @@ declare class BudgetsClient {
2294
2306
  updateScheduleCostLimit(scheduleId: string, body: UpdateCostLimitRequest): Promise<unknown>;
2295
2307
  }
2296
2308
 
2309
+ /** A redeemable referral code minted by an org (multiple, named per campaign). */
2310
+ interface ReferralCode {
2311
+ id: string;
2312
+ orgId: string;
2313
+ code: string;
2314
+ label?: string | null;
2315
+ isActive: boolean;
2316
+ createdAt: string;
2317
+ deletedAt?: string | null;
2318
+ /** Per-code stats (populated by listCodes). */
2319
+ redeemedCount: number;
2320
+ qualifiedCount: number;
2321
+ }
2322
+ /** Attribution row + snapshotted terms for a referred org. */
2323
+ interface ReferralRedemption {
2324
+ id: string;
2325
+ codeId: string;
2326
+ referrerOrgId: string;
2327
+ referredOrgId: string;
2328
+ configId?: string | null;
2329
+ isResellerCode: boolean;
2330
+ lockedReferrerRewardMicros: number;
2331
+ lockedReferredWelcomeMicros: number;
2332
+ lockedThresholdMicros: number;
2333
+ status: 'pending' | 'paid' | 'void';
2334
+ qualifiedAt?: string | null;
2335
+ referrerGrantTxId?: string | null;
2336
+ referredGrantTxId?: string | null;
2337
+ redeemedAt: string;
2338
+ }
2339
+ /** Caller org's referral summary as referrer. */
2340
+ interface ReferralStats {
2341
+ redeemedCount: number;
2342
+ qualifiedCount: number;
2343
+ totalCreditsEarnedMicros: number;
2344
+ }
2345
+ interface MintReferralCodeRequest {
2346
+ label?: string;
2347
+ }
2348
+ interface RedeemReferralCodeRequest {
2349
+ code: string;
2350
+ }
2351
+
2352
+ /**
2353
+ * Org self-service referrals. Any org can mint codes and redeem one (subject
2354
+ * to server-side guards: never-attributed, not reseller-associated, and
2355
+ * pre-first-purchase). Two-sided credits fire once the referred org's
2356
+ * cumulative spend reaches the snapshotted threshold.
2357
+ */
2358
+ declare class ReferralsClient {
2359
+ private readonly http;
2360
+ constructor(http: BaseClient);
2361
+ /** Mint a new referral code for the caller's org. */
2362
+ mintCode(body?: MintReferralCodeRequest): Promise<ReferralCode>;
2363
+ /** List the caller org's codes with per-code redeemed/qualified counts. */
2364
+ listCodes(): Promise<ReferralCode[]>;
2365
+ /** Activate or deactivate one of the caller org's codes. */
2366
+ setCodeActive(codeId: string, isActive: boolean): Promise<ReferralCode>;
2367
+ /** Caller org's referral summary as referrer (redemptions, qualified, credits earned). */
2368
+ stats(): Promise<ReferralStats>;
2369
+ /**
2370
+ * Redeem a referral code for the caller's org. Fails (4xx with an
2371
+ * `error_code`) when a guard rejects it: `code_inactive`, `self_referral`,
2372
+ * `already_redeemed`, `already_associated`, or `has_purchases`.
2373
+ */
2374
+ redeem(body: RedeemReferralCodeRequest): Promise<ReferralRedemption>;
2375
+ }
2376
+
2377
+ /** One org associated to a reseller, with gross + commission rollups. */
2378
+ interface AssociatedOrg {
2379
+ orgId: string;
2380
+ orgName: string;
2381
+ associatedAt?: string | null;
2382
+ detachedAt?: string | null;
2383
+ grossPurchasedMicros: number;
2384
+ commissionAccruedMicros: number;
2385
+ commissionPaidMicros: number;
2386
+ }
2387
+ /** One cash-commission accrual row. */
2388
+ interface ResellerCommission {
2389
+ id: string;
2390
+ resellerOrgId: string;
2391
+ associatedOrgId: string;
2392
+ paymentId: string;
2393
+ grossAmountMicros: number;
2394
+ commissionBps: number;
2395
+ commissionAmountMicros: number;
2396
+ status: 'accrued' | 'paid' | 'void';
2397
+ payoutId?: string | null;
2398
+ accruedAt: string;
2399
+ }
2400
+ /** One monthly payout (batch computes; money movement is ops). */
2401
+ interface ResellerPayout {
2402
+ id: string;
2403
+ resellerOrgId: string;
2404
+ periodStart: string;
2405
+ periodEnd: string;
2406
+ totalAmountMicros: number;
2407
+ status: 'draft' | 'approved' | 'paid';
2408
+ externalRef?: string | null;
2409
+ createdAt: string;
2410
+ paidAt?: string | null;
2411
+ }
2412
+ /** A reseller org plus aggregate performance (admin list). */
2413
+ interface ResellerPerformance extends Organization {
2414
+ associatedOrgCount: number;
2415
+ commissionAccruedMicros: number;
2416
+ commissionPaidMicros: number;
2417
+ }
2418
+ /** One row of the time-journaled billing-program parameters. */
2419
+ interface BillingProgramConfig {
2420
+ id: string;
2421
+ validFrom: string;
2422
+ validTo?: string | null;
2423
+ referrerRewardMicros: number;
2424
+ referredWelcomeMicros: number;
2425
+ referralThresholdMicros: number;
2426
+ defaultResellerCommissionBps: number;
2427
+ createdAt: string;
2428
+ createdBy?: string | null;
2429
+ note?: string | null;
2430
+ }
2431
+ interface SetResellerRequest {
2432
+ /** Per-reseller commission override in bps; omit to use the global default. */
2433
+ commissionBps?: number;
2434
+ }
2435
+ interface AppendProgramConfigRequest {
2436
+ referrerRewardMicros: number;
2437
+ referredWelcomeMicros: number;
2438
+ referralThresholdMicros: number;
2439
+ defaultResellerCommissionBps: number;
2440
+ note?: string;
2441
+ }
2442
+ interface GeneratePayoutsRequest {
2443
+ /** Inclusive period start, YYYY-MM-DD. */
2444
+ periodStart: string;
2445
+ /** Exclusive period end, YYYY-MM-DD. */
2446
+ periodEnd: string;
2447
+ }
2448
+ interface UpdatePayoutRequest {
2449
+ status: 'draft' | 'approved' | 'paid';
2450
+ externalRef?: string;
2451
+ }
2452
+
2453
+ /**
2454
+ * Reseller surface. The first three methods are self-service for an org with
2455
+ * `isReseller === true` (the server gates on it). The remaining methods are
2456
+ * platform-admin only (gated on the caller's home org being the admin org).
2457
+ */
2458
+ declare class ResellerClient {
2459
+ private readonly http;
2460
+ constructor(http: BaseClient);
2461
+ /** Orgs associated to the caller reseller, with gross + commission rollups. */
2462
+ listAssociatedOrgs(): Promise<AssociatedOrg[]>;
2463
+ /** The caller reseller's commission ledger. */
2464
+ listCommissions(): Promise<ResellerCommission[]>;
2465
+ /** The caller reseller's payout history. */
2466
+ listPayouts(): Promise<ResellerPayout[]>;
2467
+ /** List all reseller orgs with aggregate performance. */
2468
+ listResellers(): Promise<ResellerPerformance[]>;
2469
+ /** Designate an org as a reseller (optionally with a per-reseller bps override). */
2470
+ setReseller(orgId: string, body?: SetResellerRequest): Promise<Organization>;
2471
+ /** Revoke an org's reseller status. */
2472
+ revokeReseller(orgId: string): Promise<Organization>;
2473
+ /** End an org's reseller association (stamps resellerDetachedAt). */
2474
+ detachAssociation(orgId: string): Promise<Organization>;
2475
+ /** The billing-program-config journal, newest first. */
2476
+ getProgramConfig(): Promise<BillingProgramConfig[]>;
2477
+ /** Append a new program-config period (closes the prior open row). */
2478
+ appendProgramConfig(body: AppendProgramConfigRequest): Promise<BillingProgramConfig>;
2479
+ /** Draft payouts from accrued commissions in the given period. */
2480
+ generatePayouts(body: GeneratePayoutsRequest): Promise<ResellerPayout[]>;
2481
+ /** Approve or mark-paid a payout (and optionally record an external ref). */
2482
+ updatePayout(payoutId: string, body: UpdatePayoutRequest): Promise<ResellerPayout>;
2483
+ }
2484
+
2297
2485
  type CloudAgentClientOptions = BaseClientOptions;
2298
2486
  declare class AgentEngineFacade {
2299
2487
  readonly templates: TemplatesClient;
@@ -2321,6 +2509,8 @@ declare class CloudAgentClient {
2321
2509
  readonly billing: BillingFacade;
2322
2510
  readonly usage: UsageClient;
2323
2511
  readonly budgets: BudgetsClient;
2512
+ readonly referrals: ReferralsClient;
2513
+ readonly reseller: ResellerClient;
2324
2514
  constructor(options: CloudAgentClientOptions);
2325
2515
  }
2326
2516
 
@@ -2335,4 +2525,4 @@ declare class NotImplementedError extends Error {
2335
2525
  constructor(method: string);
2336
2526
  }
2337
2527
 
2338
- export { type AcceptInviteRequest, AccessType, type AcquireScanLeaseRequest, type AcquireScanLeaseResponse, type ActionCategory, type ActivateRequest, type AddMemberRequest, type AddUserToOrgRequest, type AddUserToOrgResult, type AdjustOrgCreditsRequest, type AdjustOrgCreditsResult, type AnswerChatQuestionRequest, type AnswerChatQuestionResponse, type AuthUser, BaseClient, type BaseClientOptions, type BudgetScope, BudgetsClient, type BuyCreditPackRequest, type BuyCreditPackResponse, type BuyCustomCreditRequest, type BuyCustomCreditResponse, type BuySubscriptionRequest, type BuySubscriptionResponse, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_NOTIFY, CAP_STORAGE, CAP_VCS, type CancelChatTurnResponse, type CancelSubscriptionResponse, type ChatAssistantMessagePayload, type ChatBillingRefuseCode, type ChatBillingRefuseError, type ChatBudget, type ChatCheckpointedPayload, type ChatCompactionFiredPayload, type ChatDonePayload, type ChatEvent, type ChatEventType, type ChatFeedback, type ChatFeedbackEnvelope, type ChatMessage, type ChatMessageKind, type ChatMessageRole, type ChatNarrationPayload, type ChatPhase, type ChatPhasePayload, type ChatPlanDraftPayload, type ChatQuestionPayload, type ChatSchedule, type ChatScheduleEnvelope, type ChatScheduleNotifyOn, type ChatScheduleRunStatus, type ChatScope, type ChatSession, type ChatSessionSource, type ChatSessionTitlePayload, type ChatStepEventPayload, type ChatStepProgressPayload, type ChatStreamHandle, type ChatToolCallConfirmationRequiredPayload, type ChatToolCallFinishedPayload, type ChatToolCallStartedPayload, type ChatTurnStatus, type ClarificationOption, CloudAgentClient, type CloudAgentClientOptions, type CloudResource, type CloudResourceContainerRef, type CloudResourceEdge, type CloudScanHistory, type CloudScanLease, type ConfirmChatToolCallRequest, type ConfirmChatToolCallResponse, type CreateAgentTemplateRequest, type CreateChatScheduleRequest, type CreateChatSessionRequest, type CreateChatSessionResponse, type CreateCredentialRequest, type CreateGatewayTokenRequest, type CreateGatewayTokenResponse, type CreateOrganizationUserRequest, type CreateProjectRequest, type CreateSandboxRequest, type CreateScheduledTaskRequest, type Credential, type CreditBalance, type CreditPack, type CreditTransaction, type CreditTransactionKind, type CreditTransactionType, type CustomCreditPurchaseConfig, type DebugPayload, type DebugReceipt, type EffectiveChatBudget, type ExchangeCodeRequest, type FieldSpec, type FieldType, type FineTuneParams, type GatewayToken, type GetChatSessionResponse, type GetUsageSummaryQuery, type GetUsageSummaryResponse, HttpError, type ImpersonationProvider, type InviteOrgRequest, type InviteOrgResult, type ListAgentTemplatesQuery, type ListAgentTemplatesResponse, type ListChatFeedbackResponse, type ListChatScheduleRunsResponse, type ListChatSchedulesResponse, type ListChatSessionsQuery, type ListChatSessionsResponse, type ListCredentialsQuery, type ListCreditsTransactionsQuery, type ListCreditsTransactionsResponse, type ListPaymentsResponse, type ListSandboxesQuery, type ListScanHistoryQuery, type ListScanHistoryResponse, type ListScheduledTasksQuery, type ListScheduledTasksResponse, type LoginRequest, type MFASetupResponse, type MFASimpleResponse, type MFAStatus, MFAType, type MFAVerifyLoginRequest, type MFAVerifyLoginResponse, type MFAVerifySetupRequest, type MagicLinkActivateRequest, type MagicLinkSendResponse, type ModeType, type MonthlyCreditStats, NotImplementedError, type NotifyChannelOption, type NotifyEventType, type NotifySubscription, type OpenChatStreamOptions, type OrgBudget, type OrgCreditBalance, type OrgNotifySubscriptions, OrgRoles, type OrgSubscription, type Organization, type OrganizationUser, PROVIDER_CATALOG, type Payment, type PeekScanLeaseResponse, type PostChatMessageRequest, type PostChatMessageResponse, type Project, type ProjectMember, type ProviderID, type ProviderSpec, ProviderType, type PublicConfig, type Query, type ReconcileScope, type ReconcileTuple, type RefreshRequest, type RegisterRequest, type RequestOptions, type ResetPasswordRequest, type ResourceTreeCategory, type ResourceTreeCredential, type ResourceTreeGrouping, type ResourceTreeResource, type ResourceTreeResponse, ResourcesClient, type Sandbox, type SandboxCredential, type ScanInProgressError, type ScheduledTask, type ScopedBudget, type SessionResponse, type SessionTokens, type SetOrgNotifySubscriptionsRequest, type SimpleAgentResponse, type SimpleKeysResponse, type SimpleOrgResponse, type SimpleResponse$2 as SimpleResponse, type StorageType, type SubgraphDirection, type SubgraphRequest, type SubgraphResponse, type SubmitChatFeedbackRequest, type Subscription, type SubscriptionCapability, type SubscriptionPeriod, type SystemEvent, type SystemEventQuery, type SystemEventQueryResponse, type SystemEventReadResponse, type Template, type TokenProvider, type UnauthorizedHandler, type UpdateChatBudgetRequest, type UpdateChatScheduleRequest, type UpdateCostLimitRequest, type UpdateCredentialRequest, type UpdateMemberRoleRequest, type UpdateOrgBudgetRequest, type UpdateOrgUserRequest, type UpdateOrganizationRequest, type UpdateProjectRequest, type UpdateSandboxRequest, type UpdateScopedBudgetRequest, type UpdateUserRequest, type UpdateUserResponse, type UsageBucket, type UsageByModelQuery, type UsageByModelResponse, type UsageByModelRow, type UsageCostSplit, type UsageReportQuery, type UsageReportResponse, type UsageSummary, type UsageSummaryQuery, type UsageSummaryResponse, type UsageTotals, type UsageWindow, type UserProfile, type UserSummary, computeDisplayHint, getProvider, getValueAt, isMetadataPath, isSecretPath, listProviders, metadataKey, setValueAt, usdMicros, validate };
2528
+ export { type AcceptInviteRequest, AccessType, type AcquireScanLeaseRequest, type AcquireScanLeaseResponse, type ActionCategory, type ActivateRequest, type AddMemberRequest, type AddUserToOrgRequest, type AddUserToOrgResult, type AdjustOrgCreditsRequest, type AdjustOrgCreditsResult, type AnswerChatQuestionRequest, type AnswerChatQuestionResponse, type AppendProgramConfigRequest, type AssociatedOrg, type AuthUser, BaseClient, type BaseClientOptions, type BillingProgramConfig, type BudgetScope, BudgetsClient, type BuyCreditPackRequest, type BuyCreditPackResponse, type BuyCustomCreditRequest, type BuyCustomCreditResponse, type BuySubscriptionRequest, type BuySubscriptionResponse, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_NOTIFY, CAP_STORAGE, CAP_VCS, type CancelChatTurnResponse, type CancelSubscriptionResponse, type ChatAssistantMessagePayload, type ChatBillingRefuseCode, type ChatBillingRefuseError, type ChatBudget, type ChatCheckpointedPayload, type ChatCompactionFiredPayload, type ChatDonePayload, type ChatEvent, type ChatEventType, type ChatFeedback, type ChatFeedbackEnvelope, type ChatMessage, type ChatMessageKind, type ChatMessageRole, type ChatNarrationPayload, type ChatPhase, type ChatPhasePayload, type ChatPlanDraftPayload, type ChatQuestionPayload, type ChatSchedule, type ChatScheduleEnvelope, type ChatScheduleNotifyOn, type ChatScheduleRunStatus, type ChatScope, type ChatSession, type ChatSessionSource, type ChatSessionTitlePayload, type ChatStepEventPayload, type ChatStepProgressPayload, type ChatStreamHandle, type ChatToolCallConfirmationRequiredPayload, type ChatToolCallFinishedPayload, type ChatToolCallStartedPayload, type ChatTurnStatus, type ClarificationOption, CloudAgentClient, type CloudAgentClientOptions, type CloudResource, type CloudResourceContainerRef, type CloudResourceEdge, type CloudScanHistory, type CloudScanLease, type ConfirmChatToolCallRequest, type ConfirmChatToolCallResponse, type CreateAgentTemplateRequest, type CreateChatScheduleRequest, type CreateChatSessionRequest, type CreateChatSessionResponse, type CreateCredentialRequest, type CreateGatewayTokenRequest, type CreateGatewayTokenResponse, type CreateOrganizationUserRequest, type CreateProjectRequest, type CreateSandboxRequest, type CreateScheduledTaskRequest, type Credential, type CreditBalance, type CreditPack, type CreditTransaction, type CreditTransactionKind, type CreditTransactionType, type CustomCreditPurchaseConfig, type DebugPayload, type DebugReceipt, type EffectiveChatBudget, type ExchangeCodeRequest, type FieldSpec, type FieldType, type FineTuneParams, type GatewayToken, type GeneratePayoutsRequest, type GetChatSessionResponse, type GetUsageSummaryQuery, type GetUsageSummaryResponse, HttpError, type ImpersonationProvider, type InviteOrgRequest, type InviteOrgResult, type ListAgentTemplatesQuery, type ListAgentTemplatesResponse, type ListChatFeedbackResponse, type ListChatScheduleRunsResponse, type ListChatSchedulesResponse, type ListChatSessionsQuery, type ListChatSessionsResponse, type ListCredentialsQuery, type ListCreditsTransactionsQuery, type ListCreditsTransactionsResponse, type ListPaymentsResponse, type ListSandboxesQuery, type ListScanHistoryQuery, type ListScanHistoryResponse, type ListScheduledTasksQuery, type ListScheduledTasksResponse, type LoginRequest, type MFASetupResponse, type MFASimpleResponse, type MFAStatus, MFAType, type MFAVerifyLoginRequest, type MFAVerifyLoginResponse, type MFAVerifySetupRequest, type MagicLinkActivateRequest, type MagicLinkSendResponse, type MintReferralCodeRequest, type ModeType, type MonthlyCreditStats, NotImplementedError, type NotifyChannelOption, type NotifyEventType, type NotifySubscription, type OpenChatStreamOptions, type OrgBudget, type OrgCreditBalance, type OrgNotifySubscriptions, OrgRoles, type OrgSubscription, type Organization, type OrganizationUser, PROVIDER_CATALOG, type Payment, type PeekScanLeaseResponse, type PostChatMessageRequest, type PostChatMessageResponse, type Project, type ProjectMember, type ProviderID, type ProviderSpec, ProviderType, type PublicConfig, type Query, type ReconcileScope, type ReconcileTuple, type RedeemReferralCodeRequest, type ReferralCode, type ReferralRedemption, type ReferralStats, ReferralsClient, type RefreshRequest, type RegisterRequest, type RequestOptions, ResellerClient, type ResellerCommission, type ResellerPayout, type ResellerPerformance, type ResetPasswordRequest, type ResourceTreeCategory, type ResourceTreeCredential, type ResourceTreeGrouping, type ResourceTreeResource, type ResourceTreeResponse, ResourcesClient, type Sandbox, type SandboxCredential, type ScanInProgressError, type ScheduledTask, type ScopedBudget, type SessionResponse, type SessionTokens, type SetOrgNotifySubscriptionsRequest, type SetResellerRequest, type SimpleAgentResponse, type SimpleKeysResponse, type SimpleOrgResponse, type SimpleResponse$2 as SimpleResponse, type StorageType, type SubgraphDirection, type SubgraphRequest, type SubgraphResponse, type SubmitChatFeedbackRequest, type Subscription, type SubscriptionCapability, type SubscriptionPeriod, type SystemEvent, type SystemEventQuery, type SystemEventQueryResponse, type SystemEventReadResponse, type Template, type TokenProvider, type UnauthorizedHandler, type UpdateChatBudgetRequest, type UpdateChatScheduleRequest, type UpdateCostLimitRequest, type UpdateCredentialRequest, type UpdateMemberRoleRequest, type UpdateOrgBudgetRequest, type UpdateOrgUserRequest, type UpdateOrganizationRequest, type UpdatePayoutRequest, type UpdateProjectRequest, type UpdateSandboxRequest, type UpdateScopedBudgetRequest, type UpdateUserRequest, type UpdateUserResponse, type UsageBucket, type UsageByModelQuery, type UsageByModelResponse, type UsageByModelRow, type UsageCostSplit, type UsageReportQuery, type UsageReportResponse, type UsageSummary, type UsageSummaryQuery, type UsageSummaryResponse, type UsageTotals, type UsageWindow, type UserProfile, type UserSummary, computeDisplayHint, getProvider, getValueAt, isMetadataPath, isSecretPath, listProviders, metadataKey, setValueAt, usdMicros, validate };
package/dist/index.js CHANGED
@@ -1213,6 +1213,129 @@ var BudgetsClient = class {
1213
1213
  }
1214
1214
  };
1215
1215
 
1216
+ // src/modules/referrals/ReferralsClient.ts
1217
+ var ReferralsClient = class {
1218
+ constructor(http) {
1219
+ this.http = http;
1220
+ }
1221
+ /** Mint a new referral code for the caller's org. */
1222
+ async mintCode(body = {}) {
1223
+ const res = await this.http.post("/referrals/codes", { body });
1224
+ return unwrapData(res);
1225
+ }
1226
+ /** List the caller org's codes with per-code redeemed/qualified counts. */
1227
+ async listCodes() {
1228
+ const res = await this.http.get("/referrals/codes");
1229
+ return res.data ?? [];
1230
+ }
1231
+ /** Activate or deactivate one of the caller org's codes. */
1232
+ async setCodeActive(codeId, isActive) {
1233
+ const res = await this.http.patch(
1234
+ `/referrals/codes/${codeId}`,
1235
+ { body: { isActive } }
1236
+ );
1237
+ return unwrapData(res);
1238
+ }
1239
+ /** Caller org's referral summary as referrer (redemptions, qualified, credits earned). */
1240
+ async stats() {
1241
+ const res = await this.http.get("/referrals/stats");
1242
+ return unwrapData(res);
1243
+ }
1244
+ /**
1245
+ * Redeem a referral code for the caller's org. Fails (4xx with an
1246
+ * `error_code`) when a guard rejects it: `code_inactive`, `self_referral`,
1247
+ * `already_redeemed`, `already_associated`, or `has_purchases`.
1248
+ */
1249
+ async redeem(body) {
1250
+ const res = await this.http.post(
1251
+ "/referrals/redeem",
1252
+ { body }
1253
+ );
1254
+ return unwrapData(res);
1255
+ }
1256
+ };
1257
+
1258
+ // src/modules/reseller/ResellerClient.ts
1259
+ var ResellerClient = class {
1260
+ constructor(http) {
1261
+ this.http = http;
1262
+ }
1263
+ // --- Reseller self-service (org.isReseller) ---
1264
+ /** Orgs associated to the caller reseller, with gross + commission rollups. */
1265
+ async listAssociatedOrgs() {
1266
+ const res = await this.http.get("/reseller/associated-orgs");
1267
+ return res.data ?? [];
1268
+ }
1269
+ /** The caller reseller's commission ledger. */
1270
+ async listCommissions() {
1271
+ const res = await this.http.get("/reseller/commissions");
1272
+ return res.data ?? [];
1273
+ }
1274
+ /** The caller reseller's payout history. */
1275
+ async listPayouts() {
1276
+ const res = await this.http.get("/reseller/payouts");
1277
+ return res.data ?? [];
1278
+ }
1279
+ // --- Platform-admin only ---
1280
+ /** List all reseller orgs with aggregate performance. */
1281
+ async listResellers() {
1282
+ const res = await this.http.get("/admin/resellers");
1283
+ return res.data ?? [];
1284
+ }
1285
+ /** Designate an org as a reseller (optionally with a per-reseller bps override). */
1286
+ async setReseller(orgId, body = {}) {
1287
+ const res = await this.http.post(
1288
+ `/admin/orgs/${orgId}/reseller`,
1289
+ { body }
1290
+ );
1291
+ return unwrapData(res);
1292
+ }
1293
+ /** Revoke an org's reseller status. */
1294
+ async revokeReseller(orgId) {
1295
+ const res = await this.http.delete(`/admin/orgs/${orgId}/reseller`);
1296
+ return unwrapData(res);
1297
+ }
1298
+ /** End an org's reseller association (stamps resellerDetachedAt). */
1299
+ async detachAssociation(orgId) {
1300
+ const res = await this.http.post(
1301
+ `/admin/orgs/${orgId}/detach-reseller`,
1302
+ { body: {} }
1303
+ );
1304
+ return unwrapData(res);
1305
+ }
1306
+ /** The billing-program-config journal, newest first. */
1307
+ async getProgramConfig() {
1308
+ const res = await this.http.get(
1309
+ "/admin/billing-program-config"
1310
+ );
1311
+ return res.data ?? [];
1312
+ }
1313
+ /** Append a new program-config period (closes the prior open row). */
1314
+ async appendProgramConfig(body) {
1315
+ const res = await this.http.post(
1316
+ "/admin/billing-program-config",
1317
+ { body }
1318
+ );
1319
+ return unwrapData(res);
1320
+ }
1321
+ /** Draft payouts from accrued commissions in the given period. */
1322
+ async generatePayouts(body) {
1323
+ const res = await this.http.post(
1324
+ "/admin/reseller-payouts/generate",
1325
+ { body }
1326
+ );
1327
+ return res.data ?? [];
1328
+ }
1329
+ /** Approve or mark-paid a payout (and optionally record an external ref). */
1330
+ async updatePayout(payoutId, body) {
1331
+ const res = await this.http.patch(
1332
+ `/admin/reseller-payouts/${payoutId}`,
1333
+ { body }
1334
+ );
1335
+ return unwrapData(res);
1336
+ }
1337
+ };
1338
+
1216
1339
  // src/client.ts
1217
1340
  var AgentEngineFacade = class {
1218
1341
  constructor(templates, scheduledTasks) {
@@ -1246,6 +1369,8 @@ var CloudAgentClient = class {
1246
1369
  this.billing = new BillingFacade(new SubscriptionsClient(this.http), new CreditsClient(this.http));
1247
1370
  this.usage = new UsageClient(this.http);
1248
1371
  this.budgets = new BudgetsClient(this.http);
1372
+ this.referrals = new ReferralsClient(this.http);
1373
+ this.reseller = new ResellerClient(this.http);
1249
1374
  }
1250
1375
  };
1251
1376
 
@@ -2080,6 +2205,6 @@ var usdMicros = {
2080
2205
  fromDollars: (dollars) => Math.round(dollars * 1e6)
2081
2206
  };
2082
2207
 
2083
- export { AccessType, BaseClient, BudgetsClient, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_NOTIFY, CAP_STORAGE, CAP_VCS, CloudAgentClient, HttpError, MFAType, NotImplementedError, OrgRoles, PROVIDER_CATALOG, ProviderType, ResourcesClient, computeDisplayHint, getProvider, getValueAt, isMetadataPath, isSecretPath, listProviders, metadataKey, setValueAt, usdMicros, validate };
2208
+ export { AccessType, BaseClient, BudgetsClient, CAP_AI, CAP_COMPUTE, CAP_GENERAL, CAP_NOTIFY, CAP_STORAGE, CAP_VCS, CloudAgentClient, HttpError, MFAType, NotImplementedError, OrgRoles, PROVIDER_CATALOG, ProviderType, ReferralsClient, ResellerClient, ResourcesClient, computeDisplayHint, getProvider, getValueAt, isMetadataPath, isSecretPath, listProviders, metadataKey, setValueAt, usdMicros, validate };
2084
2209
  //# sourceMappingURL=index.js.map
2085
2210
  //# sourceMappingURL=index.js.map