@flashbacktech/tsclient 0.4.54 → 0.4.56

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;
@@ -750,6 +762,20 @@ declare class CredentialsClient {
750
762
  create(body: CreateCredentialRequest): Promise<Credential>;
751
763
  update(credentialId: string, body: UpdateCredentialRequest): Promise<Credential>;
752
764
  delete(credentialId: string): Promise<SimpleKeysResponse>;
765
+ /**
766
+ * listOrgNotify returns the org-scoped notification credentials (Slack /
767
+ * Teams / PagerDuty / SMTP, workspaceId NULL) — the channels the org owns
768
+ * for platform-event notifications, managed on Settings → System
769
+ * notifications. Distinct from project-scoped notify credentials.
770
+ */
771
+ listOrgNotify(): Promise<Credential[]>;
772
+ /**
773
+ * createOrgNotify creates an org-scoped notification credential. The body is
774
+ * the universal credential shape minus projectId/workspaceId (the server
775
+ * pins workspaceId to NULL); provider must be a notify transport.
776
+ */
777
+ createOrgNotify(body: Omit<CreateCredentialRequest, 'projectId' | 'workspaceId'>): Promise<Credential>;
778
+ deleteOrgNotify(credentialId: string): Promise<SimpleKeysResponse>;
753
779
  /**
754
780
  * providers fetches the server-side catalog. The tsclient ships its
755
781
  * own catalog mirror in ./providers.ts that the frontend can use
@@ -2294,6 +2320,182 @@ declare class BudgetsClient {
2294
2320
  updateScheduleCostLimit(scheduleId: string, body: UpdateCostLimitRequest): Promise<unknown>;
2295
2321
  }
2296
2322
 
2323
+ /** A redeemable referral code minted by an org (multiple, named per campaign). */
2324
+ interface ReferralCode {
2325
+ id: string;
2326
+ orgId: string;
2327
+ code: string;
2328
+ label?: string | null;
2329
+ isActive: boolean;
2330
+ createdAt: string;
2331
+ deletedAt?: string | null;
2332
+ /** Per-code stats (populated by listCodes). */
2333
+ redeemedCount: number;
2334
+ qualifiedCount: number;
2335
+ }
2336
+ /** Attribution row + snapshotted terms for a referred org. */
2337
+ interface ReferralRedemption {
2338
+ id: string;
2339
+ codeId: string;
2340
+ referrerOrgId: string;
2341
+ referredOrgId: string;
2342
+ configId?: string | null;
2343
+ isResellerCode: boolean;
2344
+ lockedReferrerRewardMicros: number;
2345
+ lockedReferredWelcomeMicros: number;
2346
+ lockedThresholdMicros: number;
2347
+ status: 'pending' | 'paid' | 'void';
2348
+ qualifiedAt?: string | null;
2349
+ referrerGrantTxId?: string | null;
2350
+ referredGrantTxId?: string | null;
2351
+ redeemedAt: string;
2352
+ }
2353
+ /** Caller org's referral summary as referrer. */
2354
+ interface ReferralStats {
2355
+ redeemedCount: number;
2356
+ qualifiedCount: number;
2357
+ totalCreditsEarnedMicros: number;
2358
+ }
2359
+ interface MintReferralCodeRequest {
2360
+ label?: string;
2361
+ }
2362
+ interface RedeemReferralCodeRequest {
2363
+ code: string;
2364
+ }
2365
+
2366
+ /**
2367
+ * Org self-service referrals. Any org can mint codes and redeem one (subject
2368
+ * to server-side guards: never-attributed, not reseller-associated, and
2369
+ * pre-first-purchase). Two-sided credits fire once the referred org's
2370
+ * cumulative spend reaches the snapshotted threshold.
2371
+ */
2372
+ declare class ReferralsClient {
2373
+ private readonly http;
2374
+ constructor(http: BaseClient);
2375
+ /** Mint a new referral code for the caller's org. */
2376
+ mintCode(body?: MintReferralCodeRequest): Promise<ReferralCode>;
2377
+ /** List the caller org's codes with per-code redeemed/qualified counts. */
2378
+ listCodes(): Promise<ReferralCode[]>;
2379
+ /** Activate or deactivate one of the caller org's codes. */
2380
+ setCodeActive(codeId: string, isActive: boolean): Promise<ReferralCode>;
2381
+ /** Caller org's referral summary as referrer (redemptions, qualified, credits earned). */
2382
+ stats(): Promise<ReferralStats>;
2383
+ /**
2384
+ * Redeem a referral code for the caller's org. Fails (4xx with an
2385
+ * `error_code`) when a guard rejects it: `code_inactive`, `self_referral`,
2386
+ * `already_redeemed`, `already_associated`, or `has_purchases`.
2387
+ */
2388
+ redeem(body: RedeemReferralCodeRequest): Promise<ReferralRedemption>;
2389
+ }
2390
+
2391
+ /** One org associated to a reseller, with gross + commission rollups. */
2392
+ interface AssociatedOrg {
2393
+ orgId: string;
2394
+ orgName: string;
2395
+ associatedAt?: string | null;
2396
+ detachedAt?: string | null;
2397
+ grossPurchasedMicros: number;
2398
+ commissionAccruedMicros: number;
2399
+ commissionPaidMicros: number;
2400
+ }
2401
+ /** One cash-commission accrual row. */
2402
+ interface ResellerCommission {
2403
+ id: string;
2404
+ resellerOrgId: string;
2405
+ associatedOrgId: string;
2406
+ paymentId: string;
2407
+ grossAmountMicros: number;
2408
+ commissionBps: number;
2409
+ commissionAmountMicros: number;
2410
+ status: 'accrued' | 'paid' | 'void';
2411
+ payoutId?: string | null;
2412
+ accruedAt: string;
2413
+ }
2414
+ /** One monthly payout (batch computes; money movement is ops). */
2415
+ interface ResellerPayout {
2416
+ id: string;
2417
+ resellerOrgId: string;
2418
+ periodStart: string;
2419
+ periodEnd: string;
2420
+ totalAmountMicros: number;
2421
+ status: 'draft' | 'approved' | 'paid';
2422
+ externalRef?: string | null;
2423
+ createdAt: string;
2424
+ paidAt?: string | null;
2425
+ }
2426
+ /** A reseller org plus aggregate performance (admin list). */
2427
+ interface ResellerPerformance extends Organization {
2428
+ associatedOrgCount: number;
2429
+ commissionAccruedMicros: number;
2430
+ commissionPaidMicros: number;
2431
+ }
2432
+ /** One row of the time-journaled billing-program parameters. */
2433
+ interface BillingProgramConfig {
2434
+ id: string;
2435
+ validFrom: string;
2436
+ validTo?: string | null;
2437
+ referrerRewardMicros: number;
2438
+ referredWelcomeMicros: number;
2439
+ referralThresholdMicros: number;
2440
+ defaultResellerCommissionBps: number;
2441
+ createdAt: string;
2442
+ createdBy?: string | null;
2443
+ note?: string | null;
2444
+ }
2445
+ interface SetResellerRequest {
2446
+ /** Per-reseller commission override in bps; omit to use the global default. */
2447
+ commissionBps?: number;
2448
+ }
2449
+ interface AppendProgramConfigRequest {
2450
+ referrerRewardMicros: number;
2451
+ referredWelcomeMicros: number;
2452
+ referralThresholdMicros: number;
2453
+ defaultResellerCommissionBps: number;
2454
+ note?: string;
2455
+ }
2456
+ interface GeneratePayoutsRequest {
2457
+ /** Inclusive period start, YYYY-MM-DD. */
2458
+ periodStart: string;
2459
+ /** Exclusive period end, YYYY-MM-DD. */
2460
+ periodEnd: string;
2461
+ }
2462
+ interface UpdatePayoutRequest {
2463
+ status: 'draft' | 'approved' | 'paid';
2464
+ externalRef?: string;
2465
+ }
2466
+
2467
+ /**
2468
+ * Reseller surface. The first three methods are self-service for an org with
2469
+ * `isReseller === true` (the server gates on it). The remaining methods are
2470
+ * platform-admin only (gated on the caller's home org being the admin org).
2471
+ */
2472
+ declare class ResellerClient {
2473
+ private readonly http;
2474
+ constructor(http: BaseClient);
2475
+ /** Orgs associated to the caller reseller, with gross + commission rollups. */
2476
+ listAssociatedOrgs(): Promise<AssociatedOrg[]>;
2477
+ /** The caller reseller's commission ledger. */
2478
+ listCommissions(): Promise<ResellerCommission[]>;
2479
+ /** The caller reseller's payout history. */
2480
+ listPayouts(): Promise<ResellerPayout[]>;
2481
+ /** List all reseller orgs with aggregate performance. */
2482
+ listResellers(): Promise<ResellerPerformance[]>;
2483
+ /** Designate an org as a reseller (optionally with a per-reseller bps override). */
2484
+ setReseller(orgId: string, body?: SetResellerRequest): Promise<Organization>;
2485
+ /** Revoke an org's reseller status. */
2486
+ revokeReseller(orgId: string): Promise<Organization>;
2487
+ /** End an org's reseller association (stamps resellerDetachedAt). */
2488
+ detachAssociation(orgId: string): Promise<Organization>;
2489
+ /** The billing-program-config journal, newest first. */
2490
+ getProgramConfig(): Promise<BillingProgramConfig[]>;
2491
+ /** Append a new program-config period (closes the prior open row). */
2492
+ appendProgramConfig(body: AppendProgramConfigRequest): Promise<BillingProgramConfig>;
2493
+ /** Draft payouts from accrued commissions in the given period. */
2494
+ generatePayouts(body: GeneratePayoutsRequest): Promise<ResellerPayout[]>;
2495
+ /** Approve or mark-paid a payout (and optionally record an external ref). */
2496
+ updatePayout(payoutId: string, body: UpdatePayoutRequest): Promise<ResellerPayout>;
2497
+ }
2498
+
2297
2499
  type CloudAgentClientOptions = BaseClientOptions;
2298
2500
  declare class AgentEngineFacade {
2299
2501
  readonly templates: TemplatesClient;
@@ -2321,6 +2523,8 @@ declare class CloudAgentClient {
2321
2523
  readonly billing: BillingFacade;
2322
2524
  readonly usage: UsageClient;
2323
2525
  readonly budgets: BudgetsClient;
2526
+ readonly referrals: ReferralsClient;
2527
+ readonly reseller: ResellerClient;
2324
2528
  constructor(options: CloudAgentClientOptions);
2325
2529
  }
2326
2530
 
@@ -2335,4 +2539,4 @@ declare class NotImplementedError extends Error {
2335
2539
  constructor(method: string);
2336
2540
  }
2337
2541
 
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 };
2542
+ 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;
@@ -750,6 +762,20 @@ declare class CredentialsClient {
750
762
  create(body: CreateCredentialRequest): Promise<Credential>;
751
763
  update(credentialId: string, body: UpdateCredentialRequest): Promise<Credential>;
752
764
  delete(credentialId: string): Promise<SimpleKeysResponse>;
765
+ /**
766
+ * listOrgNotify returns the org-scoped notification credentials (Slack /
767
+ * Teams / PagerDuty / SMTP, workspaceId NULL) — the channels the org owns
768
+ * for platform-event notifications, managed on Settings → System
769
+ * notifications. Distinct from project-scoped notify credentials.
770
+ */
771
+ listOrgNotify(): Promise<Credential[]>;
772
+ /**
773
+ * createOrgNotify creates an org-scoped notification credential. The body is
774
+ * the universal credential shape minus projectId/workspaceId (the server
775
+ * pins workspaceId to NULL); provider must be a notify transport.
776
+ */
777
+ createOrgNotify(body: Omit<CreateCredentialRequest, 'projectId' | 'workspaceId'>): Promise<Credential>;
778
+ deleteOrgNotify(credentialId: string): Promise<SimpleKeysResponse>;
753
779
  /**
754
780
  * providers fetches the server-side catalog. The tsclient ships its
755
781
  * own catalog mirror in ./providers.ts that the frontend can use
@@ -2294,6 +2320,182 @@ declare class BudgetsClient {
2294
2320
  updateScheduleCostLimit(scheduleId: string, body: UpdateCostLimitRequest): Promise<unknown>;
2295
2321
  }
2296
2322
 
2323
+ /** A redeemable referral code minted by an org (multiple, named per campaign). */
2324
+ interface ReferralCode {
2325
+ id: string;
2326
+ orgId: string;
2327
+ code: string;
2328
+ label?: string | null;
2329
+ isActive: boolean;
2330
+ createdAt: string;
2331
+ deletedAt?: string | null;
2332
+ /** Per-code stats (populated by listCodes). */
2333
+ redeemedCount: number;
2334
+ qualifiedCount: number;
2335
+ }
2336
+ /** Attribution row + snapshotted terms for a referred org. */
2337
+ interface ReferralRedemption {
2338
+ id: string;
2339
+ codeId: string;
2340
+ referrerOrgId: string;
2341
+ referredOrgId: string;
2342
+ configId?: string | null;
2343
+ isResellerCode: boolean;
2344
+ lockedReferrerRewardMicros: number;
2345
+ lockedReferredWelcomeMicros: number;
2346
+ lockedThresholdMicros: number;
2347
+ status: 'pending' | 'paid' | 'void';
2348
+ qualifiedAt?: string | null;
2349
+ referrerGrantTxId?: string | null;
2350
+ referredGrantTxId?: string | null;
2351
+ redeemedAt: string;
2352
+ }
2353
+ /** Caller org's referral summary as referrer. */
2354
+ interface ReferralStats {
2355
+ redeemedCount: number;
2356
+ qualifiedCount: number;
2357
+ totalCreditsEarnedMicros: number;
2358
+ }
2359
+ interface MintReferralCodeRequest {
2360
+ label?: string;
2361
+ }
2362
+ interface RedeemReferralCodeRequest {
2363
+ code: string;
2364
+ }
2365
+
2366
+ /**
2367
+ * Org self-service referrals. Any org can mint codes and redeem one (subject
2368
+ * to server-side guards: never-attributed, not reseller-associated, and
2369
+ * pre-first-purchase). Two-sided credits fire once the referred org's
2370
+ * cumulative spend reaches the snapshotted threshold.
2371
+ */
2372
+ declare class ReferralsClient {
2373
+ private readonly http;
2374
+ constructor(http: BaseClient);
2375
+ /** Mint a new referral code for the caller's org. */
2376
+ mintCode(body?: MintReferralCodeRequest): Promise<ReferralCode>;
2377
+ /** List the caller org's codes with per-code redeemed/qualified counts. */
2378
+ listCodes(): Promise<ReferralCode[]>;
2379
+ /** Activate or deactivate one of the caller org's codes. */
2380
+ setCodeActive(codeId: string, isActive: boolean): Promise<ReferralCode>;
2381
+ /** Caller org's referral summary as referrer (redemptions, qualified, credits earned). */
2382
+ stats(): Promise<ReferralStats>;
2383
+ /**
2384
+ * Redeem a referral code for the caller's org. Fails (4xx with an
2385
+ * `error_code`) when a guard rejects it: `code_inactive`, `self_referral`,
2386
+ * `already_redeemed`, `already_associated`, or `has_purchases`.
2387
+ */
2388
+ redeem(body: RedeemReferralCodeRequest): Promise<ReferralRedemption>;
2389
+ }
2390
+
2391
+ /** One org associated to a reseller, with gross + commission rollups. */
2392
+ interface AssociatedOrg {
2393
+ orgId: string;
2394
+ orgName: string;
2395
+ associatedAt?: string | null;
2396
+ detachedAt?: string | null;
2397
+ grossPurchasedMicros: number;
2398
+ commissionAccruedMicros: number;
2399
+ commissionPaidMicros: number;
2400
+ }
2401
+ /** One cash-commission accrual row. */
2402
+ interface ResellerCommission {
2403
+ id: string;
2404
+ resellerOrgId: string;
2405
+ associatedOrgId: string;
2406
+ paymentId: string;
2407
+ grossAmountMicros: number;
2408
+ commissionBps: number;
2409
+ commissionAmountMicros: number;
2410
+ status: 'accrued' | 'paid' | 'void';
2411
+ payoutId?: string | null;
2412
+ accruedAt: string;
2413
+ }
2414
+ /** One monthly payout (batch computes; money movement is ops). */
2415
+ interface ResellerPayout {
2416
+ id: string;
2417
+ resellerOrgId: string;
2418
+ periodStart: string;
2419
+ periodEnd: string;
2420
+ totalAmountMicros: number;
2421
+ status: 'draft' | 'approved' | 'paid';
2422
+ externalRef?: string | null;
2423
+ createdAt: string;
2424
+ paidAt?: string | null;
2425
+ }
2426
+ /** A reseller org plus aggregate performance (admin list). */
2427
+ interface ResellerPerformance extends Organization {
2428
+ associatedOrgCount: number;
2429
+ commissionAccruedMicros: number;
2430
+ commissionPaidMicros: number;
2431
+ }
2432
+ /** One row of the time-journaled billing-program parameters. */
2433
+ interface BillingProgramConfig {
2434
+ id: string;
2435
+ validFrom: string;
2436
+ validTo?: string | null;
2437
+ referrerRewardMicros: number;
2438
+ referredWelcomeMicros: number;
2439
+ referralThresholdMicros: number;
2440
+ defaultResellerCommissionBps: number;
2441
+ createdAt: string;
2442
+ createdBy?: string | null;
2443
+ note?: string | null;
2444
+ }
2445
+ interface SetResellerRequest {
2446
+ /** Per-reseller commission override in bps; omit to use the global default. */
2447
+ commissionBps?: number;
2448
+ }
2449
+ interface AppendProgramConfigRequest {
2450
+ referrerRewardMicros: number;
2451
+ referredWelcomeMicros: number;
2452
+ referralThresholdMicros: number;
2453
+ defaultResellerCommissionBps: number;
2454
+ note?: string;
2455
+ }
2456
+ interface GeneratePayoutsRequest {
2457
+ /** Inclusive period start, YYYY-MM-DD. */
2458
+ periodStart: string;
2459
+ /** Exclusive period end, YYYY-MM-DD. */
2460
+ periodEnd: string;
2461
+ }
2462
+ interface UpdatePayoutRequest {
2463
+ status: 'draft' | 'approved' | 'paid';
2464
+ externalRef?: string;
2465
+ }
2466
+
2467
+ /**
2468
+ * Reseller surface. The first three methods are self-service for an org with
2469
+ * `isReseller === true` (the server gates on it). The remaining methods are
2470
+ * platform-admin only (gated on the caller's home org being the admin org).
2471
+ */
2472
+ declare class ResellerClient {
2473
+ private readonly http;
2474
+ constructor(http: BaseClient);
2475
+ /** Orgs associated to the caller reseller, with gross + commission rollups. */
2476
+ listAssociatedOrgs(): Promise<AssociatedOrg[]>;
2477
+ /** The caller reseller's commission ledger. */
2478
+ listCommissions(): Promise<ResellerCommission[]>;
2479
+ /** The caller reseller's payout history. */
2480
+ listPayouts(): Promise<ResellerPayout[]>;
2481
+ /** List all reseller orgs with aggregate performance. */
2482
+ listResellers(): Promise<ResellerPerformance[]>;
2483
+ /** Designate an org as a reseller (optionally with a per-reseller bps override). */
2484
+ setReseller(orgId: string, body?: SetResellerRequest): Promise<Organization>;
2485
+ /** Revoke an org's reseller status. */
2486
+ revokeReseller(orgId: string): Promise<Organization>;
2487
+ /** End an org's reseller association (stamps resellerDetachedAt). */
2488
+ detachAssociation(orgId: string): Promise<Organization>;
2489
+ /** The billing-program-config journal, newest first. */
2490
+ getProgramConfig(): Promise<BillingProgramConfig[]>;
2491
+ /** Append a new program-config period (closes the prior open row). */
2492
+ appendProgramConfig(body: AppendProgramConfigRequest): Promise<BillingProgramConfig>;
2493
+ /** Draft payouts from accrued commissions in the given period. */
2494
+ generatePayouts(body: GeneratePayoutsRequest): Promise<ResellerPayout[]>;
2495
+ /** Approve or mark-paid a payout (and optionally record an external ref). */
2496
+ updatePayout(payoutId: string, body: UpdatePayoutRequest): Promise<ResellerPayout>;
2497
+ }
2498
+
2297
2499
  type CloudAgentClientOptions = BaseClientOptions;
2298
2500
  declare class AgentEngineFacade {
2299
2501
  readonly templates: TemplatesClient;
@@ -2321,6 +2523,8 @@ declare class CloudAgentClient {
2321
2523
  readonly billing: BillingFacade;
2322
2524
  readonly usage: UsageClient;
2323
2525
  readonly budgets: BudgetsClient;
2526
+ readonly referrals: ReferralsClient;
2527
+ readonly reseller: ResellerClient;
2324
2528
  constructor(options: CloudAgentClientOptions);
2325
2529
  }
2326
2530
 
@@ -2335,4 +2539,4 @@ declare class NotImplementedError extends Error {
2335
2539
  constructor(method: string);
2336
2540
  }
2337
2541
 
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 };
2542
+ 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 };