@flashbacktech/tsclient 0.4.46 → 0.4.48

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
@@ -295,6 +295,12 @@ interface Organization {
295
295
  mfaEnforced: boolean;
296
296
  reposDisabled?: boolean;
297
297
  allowDebug: boolean;
298
+ /**
299
+ * Platform-admin org. Members are platform admins; the org's reference
300
+ * project holds the global AI-key pool. Server-asserted (replaces the old
301
+ * ADMIN_ORGANIZATION env var).
302
+ */
303
+ isAdmin?: boolean;
298
304
  }
299
305
  interface UpdateOrganizationRequest {
300
306
  name?: string;
@@ -473,11 +479,24 @@ interface ProjectMember {
473
479
  role: string;
474
480
  user: UserSummary;
475
481
  }
482
+ /** AI providers eligible for the per-project platform-keys opt-in. */
483
+ type PreferredAiProvider = 'OPENAI' | 'ANTHROPIC' | 'GEMINI' | 'BEDROCK';
476
484
  interface Project {
477
485
  id: string;
478
486
  name: string;
479
487
  orgId: string;
480
488
  default: boolean;
489
+ /**
490
+ * Marks the admin org's global-AI-key project (its AI credentials form the
491
+ * platform-wide pool). Meaningful only for the platform-admin org.
492
+ */
493
+ isReferenceProject?: boolean;
494
+ /**
495
+ * When set on a project with no BYOK AI credentials, routes that project's
496
+ * LLM calls to the platform ("global") keys for this provider. Mutually
497
+ * exclusive with BYOK AI keys. Null/absent = BYOK.
498
+ */
499
+ preferredAiProvider?: PreferredAiProvider | null;
481
500
  users: ProjectMember[];
482
501
  }
483
502
  interface CreateProjectRequest {
@@ -485,6 +504,9 @@ interface CreateProjectRequest {
485
504
  }
486
505
  interface UpdateProjectRequest {
487
506
  name?: string;
507
+ isReferenceProject?: boolean;
508
+ /** Empty string clears the platform-keys opt-in (back to BYOK). */
509
+ preferredAiProvider?: PreferredAiProvider | '' | null;
488
510
  }
489
511
  interface AddMemberRequest {
490
512
  userId: string;
@@ -1726,18 +1748,22 @@ declare class SystemEventsClient {
1726
1748
 
1727
1749
  interface SubscriptionPeriod {
1728
1750
  id: string;
1729
- name: string;
1730
- amount: number;
1731
- currency: string;
1732
- interval: string;
1733
- intervalCount?: number;
1751
+ subscriptionId: string;
1752
+ /** Billing interval: MONTHLY | YEARLY | WEEKLY | DAILY | ALL_TIME. */
1753
+ periodType: string;
1754
+ /** Price in USD (dollars). */
1755
+ price: number;
1734
1756
  /** Per-period grant in USD micros. 0 means no grant attached. */
1735
1757
  creditsGrantedMicros: number;
1736
1758
  }
1737
1759
  interface SubscriptionCapability {
1738
- key: string;
1739
- label?: string;
1740
- limit?: number | null;
1760
+ id: string;
1761
+ code: string;
1762
+ description: string;
1763
+ type: string;
1764
+ price: number;
1765
+ periodType: string;
1766
+ value: number;
1741
1767
  }
1742
1768
  interface Subscription {
1743
1769
  id: string;
@@ -1745,18 +1771,20 @@ interface Subscription {
1745
1771
  description?: string;
1746
1772
  periods: SubscriptionPeriod[];
1747
1773
  capabilities: SubscriptionCapability[];
1748
- /** Plan-level 24h rolling debit cap in USD micros. null = no cap. */
1749
- dailyCreditCapMicros?: number | null;
1750
1774
  }
1775
+ /** The org's currently active subscription (GET /subscriptions/my). */
1751
1776
  interface OrgSubscription {
1752
1777
  id: string;
1753
- subscriptionId: string;
1754
- subscriptionName: string;
1778
+ name: string;
1779
+ description?: string;
1780
+ periodId: string;
1781
+ periodType: string;
1782
+ /** Price in USD (dollars). */
1783
+ price: number;
1784
+ dateFrom: string;
1785
+ dateTo: string | null;
1755
1786
  status: string;
1756
- currentPeriodStart?: string;
1757
- currentPeriodEnd?: string;
1758
- cancelAt?: string | null;
1759
- capabilities: SubscriptionCapability[];
1787
+ autoRenew: boolean;
1760
1788
  }
1761
1789
  interface BuySubscriptionRequest {
1762
1790
  subscriptionPeriodId: string;
@@ -1779,11 +1807,11 @@ interface CancelSubscriptionResponse {
1779
1807
  }
1780
1808
  interface Payment {
1781
1809
  id: string;
1782
- status: string;
1783
1810
  amount: number;
1784
1811
  currency: string;
1785
- createdAt: string;
1786
- description?: string;
1812
+ status: string;
1813
+ /** ISO-8601; paidAt when available, else createdAt. */
1814
+ timestamp: string;
1787
1815
  }
1788
1816
  interface ListPaymentsResponse {
1789
1817
  success: boolean;
@@ -1812,7 +1840,7 @@ interface CreditBalance {
1812
1840
  totalActiveMicros: number;
1813
1841
  }
1814
1842
  /** Source of a credit ledger row. Matches the kind enum from migration 0017. */
1815
- type CreditTransactionKind = 'grant_initial' | 'grant_renewal' | 'grant_pack' | 'debit_llm' | 'debit_sandbox' | 'admin_adjust';
1843
+ type CreditTransactionKind = 'grant_initial' | 'grant_renewal' | 'grant_pack' | 'debit_llm' | 'debit_sandbox' | 'debit_llm_platform' | 'meter_llm_byok' | 'admin_adjust';
1816
1844
  /** Display category for the transactions list. */
1817
1845
  type CreditTransactionType = 'consumption' | 'purchase' | 'grant';
1818
1846
  interface CreditTransaction {
@@ -1887,6 +1915,33 @@ interface BuyCustomCreditResponse {
1887
1915
  error_code?: string;
1888
1916
  message?: string;
1889
1917
  }
1918
+ /**
1919
+ * A fixed credit pack from the catalog, served by GET /credits/packs.
1920
+ * `creditsMicros` is what lands in the permanent bucket on purchase;
1921
+ * `price` is the dollar amount Stripe charges (may differ — e.g. a pack
1922
+ * can grant a bonus, $50 → 55 of credits).
1923
+ */
1924
+ interface CreditPack {
1925
+ id: string;
1926
+ name: string;
1927
+ code: string;
1928
+ creditsMicros: number;
1929
+ price: number;
1930
+ }
1931
+ /** Body for POST /credits/packs/buy. */
1932
+ interface BuyCreditPackRequest {
1933
+ packId: string;
1934
+ }
1935
+ /** Response from POST /credits/packs/buy. */
1936
+ interface BuyCreditPackResponse {
1937
+ success: boolean;
1938
+ checkoutUrl?: string;
1939
+ sessionId?: string;
1940
+ error_code?: string;
1941
+ message?: string;
1942
+ /** ISO-8601; set when error_code = PACK_LIMIT_REACHED. */
1943
+ nextAvailableAt?: string;
1944
+ }
1890
1945
  /**
1891
1946
  * Refusal reasons from POST /v1/agent/chat/sessions/:id/messages when
1892
1947
  * the billing preflight rejects a turn (HTTP 402). Frontend maps these
@@ -1923,8 +1978,17 @@ declare class CreditsClient {
1923
1978
  constructor(http: BaseClient);
1924
1979
  getBalance(): Promise<CreditBalance>;
1925
1980
  listTransactions(query?: ListCreditsTransactionsQuery): Promise<ListCreditsTransactionsResponse>;
1926
- /** Backend currently returns 501. Surfaced for forward-compat. */
1981
+ /** Per-month credit activity (consumption / purchases / grants). */
1927
1982
  getMonthlyStats(): Promise<MonthlyCreditStats[]>;
1983
+ /** Fixed credit-pack catalog. Public endpoint. */
1984
+ listPacks(): Promise<CreditPack[]>;
1985
+ /**
1986
+ * Buy a fixed credit pack. Requires an active paid subscription
1987
+ * (the backend 403s free-tier orgs with SUBSCRIPTION_REQUIRED) and
1988
+ * caps purchases per pack per billing cycle. Returns a Stripe
1989
+ * Checkout URL to redirect to.
1990
+ */
1991
+ buyPack(body: BuyCreditPackRequest): Promise<BuyCreditPackResponse>;
1928
1992
  /**
1929
1993
  * "Other amount" PAYG config — bounds + presets for the
1930
1994
  * arbitrary-dollar tile. Public endpoint; returns a disabled
@@ -2215,4 +2279,4 @@ declare class NotImplementedError extends Error {
2215
2279
  constructor(method: string);
2216
2280
  }
2217
2281
 
2218
- 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 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 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 OpenChatStreamOptions, type OrgBudget, type OrgCreditBalance, 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 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 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 };
2282
+ 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 OpenChatStreamOptions, type OrgBudget, type OrgCreditBalance, 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 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 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
@@ -295,6 +295,12 @@ interface Organization {
295
295
  mfaEnforced: boolean;
296
296
  reposDisabled?: boolean;
297
297
  allowDebug: boolean;
298
+ /**
299
+ * Platform-admin org. Members are platform admins; the org's reference
300
+ * project holds the global AI-key pool. Server-asserted (replaces the old
301
+ * ADMIN_ORGANIZATION env var).
302
+ */
303
+ isAdmin?: boolean;
298
304
  }
299
305
  interface UpdateOrganizationRequest {
300
306
  name?: string;
@@ -473,11 +479,24 @@ interface ProjectMember {
473
479
  role: string;
474
480
  user: UserSummary;
475
481
  }
482
+ /** AI providers eligible for the per-project platform-keys opt-in. */
483
+ type PreferredAiProvider = 'OPENAI' | 'ANTHROPIC' | 'GEMINI' | 'BEDROCK';
476
484
  interface Project {
477
485
  id: string;
478
486
  name: string;
479
487
  orgId: string;
480
488
  default: boolean;
489
+ /**
490
+ * Marks the admin org's global-AI-key project (its AI credentials form the
491
+ * platform-wide pool). Meaningful only for the platform-admin org.
492
+ */
493
+ isReferenceProject?: boolean;
494
+ /**
495
+ * When set on a project with no BYOK AI credentials, routes that project's
496
+ * LLM calls to the platform ("global") keys for this provider. Mutually
497
+ * exclusive with BYOK AI keys. Null/absent = BYOK.
498
+ */
499
+ preferredAiProvider?: PreferredAiProvider | null;
481
500
  users: ProjectMember[];
482
501
  }
483
502
  interface CreateProjectRequest {
@@ -485,6 +504,9 @@ interface CreateProjectRequest {
485
504
  }
486
505
  interface UpdateProjectRequest {
487
506
  name?: string;
507
+ isReferenceProject?: boolean;
508
+ /** Empty string clears the platform-keys opt-in (back to BYOK). */
509
+ preferredAiProvider?: PreferredAiProvider | '' | null;
488
510
  }
489
511
  interface AddMemberRequest {
490
512
  userId: string;
@@ -1726,18 +1748,22 @@ declare class SystemEventsClient {
1726
1748
 
1727
1749
  interface SubscriptionPeriod {
1728
1750
  id: string;
1729
- name: string;
1730
- amount: number;
1731
- currency: string;
1732
- interval: string;
1733
- intervalCount?: number;
1751
+ subscriptionId: string;
1752
+ /** Billing interval: MONTHLY | YEARLY | WEEKLY | DAILY | ALL_TIME. */
1753
+ periodType: string;
1754
+ /** Price in USD (dollars). */
1755
+ price: number;
1734
1756
  /** Per-period grant in USD micros. 0 means no grant attached. */
1735
1757
  creditsGrantedMicros: number;
1736
1758
  }
1737
1759
  interface SubscriptionCapability {
1738
- key: string;
1739
- label?: string;
1740
- limit?: number | null;
1760
+ id: string;
1761
+ code: string;
1762
+ description: string;
1763
+ type: string;
1764
+ price: number;
1765
+ periodType: string;
1766
+ value: number;
1741
1767
  }
1742
1768
  interface Subscription {
1743
1769
  id: string;
@@ -1745,18 +1771,20 @@ interface Subscription {
1745
1771
  description?: string;
1746
1772
  periods: SubscriptionPeriod[];
1747
1773
  capabilities: SubscriptionCapability[];
1748
- /** Plan-level 24h rolling debit cap in USD micros. null = no cap. */
1749
- dailyCreditCapMicros?: number | null;
1750
1774
  }
1775
+ /** The org's currently active subscription (GET /subscriptions/my). */
1751
1776
  interface OrgSubscription {
1752
1777
  id: string;
1753
- subscriptionId: string;
1754
- subscriptionName: string;
1778
+ name: string;
1779
+ description?: string;
1780
+ periodId: string;
1781
+ periodType: string;
1782
+ /** Price in USD (dollars). */
1783
+ price: number;
1784
+ dateFrom: string;
1785
+ dateTo: string | null;
1755
1786
  status: string;
1756
- currentPeriodStart?: string;
1757
- currentPeriodEnd?: string;
1758
- cancelAt?: string | null;
1759
- capabilities: SubscriptionCapability[];
1787
+ autoRenew: boolean;
1760
1788
  }
1761
1789
  interface BuySubscriptionRequest {
1762
1790
  subscriptionPeriodId: string;
@@ -1779,11 +1807,11 @@ interface CancelSubscriptionResponse {
1779
1807
  }
1780
1808
  interface Payment {
1781
1809
  id: string;
1782
- status: string;
1783
1810
  amount: number;
1784
1811
  currency: string;
1785
- createdAt: string;
1786
- description?: string;
1812
+ status: string;
1813
+ /** ISO-8601; paidAt when available, else createdAt. */
1814
+ timestamp: string;
1787
1815
  }
1788
1816
  interface ListPaymentsResponse {
1789
1817
  success: boolean;
@@ -1812,7 +1840,7 @@ interface CreditBalance {
1812
1840
  totalActiveMicros: number;
1813
1841
  }
1814
1842
  /** Source of a credit ledger row. Matches the kind enum from migration 0017. */
1815
- type CreditTransactionKind = 'grant_initial' | 'grant_renewal' | 'grant_pack' | 'debit_llm' | 'debit_sandbox' | 'admin_adjust';
1843
+ type CreditTransactionKind = 'grant_initial' | 'grant_renewal' | 'grant_pack' | 'debit_llm' | 'debit_sandbox' | 'debit_llm_platform' | 'meter_llm_byok' | 'admin_adjust';
1816
1844
  /** Display category for the transactions list. */
1817
1845
  type CreditTransactionType = 'consumption' | 'purchase' | 'grant';
1818
1846
  interface CreditTransaction {
@@ -1887,6 +1915,33 @@ interface BuyCustomCreditResponse {
1887
1915
  error_code?: string;
1888
1916
  message?: string;
1889
1917
  }
1918
+ /**
1919
+ * A fixed credit pack from the catalog, served by GET /credits/packs.
1920
+ * `creditsMicros` is what lands in the permanent bucket on purchase;
1921
+ * `price` is the dollar amount Stripe charges (may differ — e.g. a pack
1922
+ * can grant a bonus, $50 → 55 of credits).
1923
+ */
1924
+ interface CreditPack {
1925
+ id: string;
1926
+ name: string;
1927
+ code: string;
1928
+ creditsMicros: number;
1929
+ price: number;
1930
+ }
1931
+ /** Body for POST /credits/packs/buy. */
1932
+ interface BuyCreditPackRequest {
1933
+ packId: string;
1934
+ }
1935
+ /** Response from POST /credits/packs/buy. */
1936
+ interface BuyCreditPackResponse {
1937
+ success: boolean;
1938
+ checkoutUrl?: string;
1939
+ sessionId?: string;
1940
+ error_code?: string;
1941
+ message?: string;
1942
+ /** ISO-8601; set when error_code = PACK_LIMIT_REACHED. */
1943
+ nextAvailableAt?: string;
1944
+ }
1890
1945
  /**
1891
1946
  * Refusal reasons from POST /v1/agent/chat/sessions/:id/messages when
1892
1947
  * the billing preflight rejects a turn (HTTP 402). Frontend maps these
@@ -1923,8 +1978,17 @@ declare class CreditsClient {
1923
1978
  constructor(http: BaseClient);
1924
1979
  getBalance(): Promise<CreditBalance>;
1925
1980
  listTransactions(query?: ListCreditsTransactionsQuery): Promise<ListCreditsTransactionsResponse>;
1926
- /** Backend currently returns 501. Surfaced for forward-compat. */
1981
+ /** Per-month credit activity (consumption / purchases / grants). */
1927
1982
  getMonthlyStats(): Promise<MonthlyCreditStats[]>;
1983
+ /** Fixed credit-pack catalog. Public endpoint. */
1984
+ listPacks(): Promise<CreditPack[]>;
1985
+ /**
1986
+ * Buy a fixed credit pack. Requires an active paid subscription
1987
+ * (the backend 403s free-tier orgs with SUBSCRIPTION_REQUIRED) and
1988
+ * caps purchases per pack per billing cycle. Returns a Stripe
1989
+ * Checkout URL to redirect to.
1990
+ */
1991
+ buyPack(body: BuyCreditPackRequest): Promise<BuyCreditPackResponse>;
1928
1992
  /**
1929
1993
  * "Other amount" PAYG config — bounds + presets for the
1930
1994
  * arbitrary-dollar tile. Public endpoint; returns a disabled
@@ -2215,4 +2279,4 @@ declare class NotImplementedError extends Error {
2215
2279
  constructor(method: string);
2216
2280
  }
2217
2281
 
2218
- 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 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 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 OpenChatStreamOptions, type OrgBudget, type OrgCreditBalance, 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 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 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 };
2282
+ 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 OpenChatStreamOptions, type OrgBudget, type OrgCreditBalance, 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 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 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
@@ -1033,11 +1033,25 @@ var CreditsClient = class {
1033
1033
  listTransactions(query = {}) {
1034
1034
  return this.http.get("/credits/transactions", { query });
1035
1035
  }
1036
- /** Backend currently returns 501. Surfaced for forward-compat. */
1036
+ /** Per-month credit activity (consumption / purchases / grants). */
1037
1037
  async getMonthlyStats() {
1038
1038
  const res = await this.http.get("/credits/stats/monthly");
1039
1039
  return res.data ?? [];
1040
1040
  }
1041
+ /** Fixed credit-pack catalog. Public endpoint. */
1042
+ async listPacks() {
1043
+ const res = await this.http.get("/credits/packs", { skipAuth: true });
1044
+ return res.data ?? [];
1045
+ }
1046
+ /**
1047
+ * Buy a fixed credit pack. Requires an active paid subscription
1048
+ * (the backend 403s free-tier orgs with SUBSCRIPTION_REQUIRED) and
1049
+ * caps purchases per pack per billing cycle. Returns a Stripe
1050
+ * Checkout URL to redirect to.
1051
+ */
1052
+ buyPack(body) {
1053
+ return this.http.post("/credits/packs/buy", { body });
1054
+ }
1041
1055
  /**
1042
1056
  * "Other amount" PAYG config — bounds + presets for the
1043
1057
  * arbitrary-dollar tile. Public endpoint; returns a disabled