@flashbacktech/tsclient 0.4.35 → 0.4.36

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
@@ -1535,8 +1535,8 @@ interface SubscriptionPeriod {
1535
1535
  currency: string;
1536
1536
  interval: string;
1537
1537
  intervalCount?: number;
1538
- /** Per-period grant in USD-cents. 0 means no grant attached. */
1539
- creditsGrantedCents: number;
1538
+ /** Per-period grant in USD micros. 0 means no grant attached. */
1539
+ creditsGrantedMicros: number;
1540
1540
  }
1541
1541
  interface SubscriptionCapability {
1542
1542
  key: string;
@@ -1549,8 +1549,8 @@ interface Subscription {
1549
1549
  description?: string;
1550
1550
  periods: SubscriptionPeriod[];
1551
1551
  capabilities: SubscriptionCapability[];
1552
- /** Plan-level 24h rolling debit cap in USD-cents. null = no cap. */
1553
- dailyCreditCapCents?: number | null;
1552
+ /** Plan-level 24h rolling debit cap in USD micros. null = no cap. */
1553
+ dailyCreditCapMicros?: number | null;
1554
1554
  }
1555
1555
  interface OrgSubscription {
1556
1556
  id: string;
@@ -1596,28 +1596,24 @@ interface ListPaymentsResponse {
1596
1596
  /**
1597
1597
  * Org credit balance — two-bucket forfeit model (billing-v1).
1598
1598
  *
1599
- * - permanentCreditCents: PAYG (credit-pack) bucket. Never expires.
1600
- * - subscriptionCreditCents: Current subscription cycle. Forfeit on
1601
- * renewal; expires at subscriptionCreditExpiresAt.
1602
- * - subscriptionCreditExpiresAt: ISO-8601; null when no subscription is active.
1603
- * - totalActiveCents: Pre-computed sum = permanent +
1604
- * (subscription if not expired). Use this
1605
- * to drive the daily-cap progress bar
1606
- * and "out of credits" check.
1599
+ * - permanentCreditMicros: PAYG (credit-pack) bucket. Never expires.
1600
+ * - subscriptionCreditMicros: Current subscription cycle. Forfeit on
1601
+ * renewal; expires at subscriptionCreditExpiresAt.
1602
+ * - subscriptionCreditExpiresAt: ISO-8601; null when no subscription is active.
1603
+ * - totalActiveMicros: Pre-computed sum = permanent +
1604
+ * (subscription if not expired). Use this
1605
+ * to drive the daily-cap progress bar
1606
+ * and "out of credits" check.
1607
1607
  *
1608
- * Format `(value / 100).toFixed(2)` for display. Drain order is
1609
- * subscription bucket first, then permanent — visualise as a single
1610
- * pool with a small "expires soon" tag for the subscription slice.
1611
- *
1612
- * Legacy `realtimeBalance` / `pendingConsumption` / `breakdown` /
1613
- * `dateBalance` fields were dropped: the chat-loop debits in real-time
1614
- * so there is no notion of "pending".
1608
+ * Format `(value / 1_000_000).toFixed(2)` for dollar layouts. Drain
1609
+ * order is subscription bucket first, then permanent — visualise as a
1610
+ * single pool with a small "expires soon" tag for the subscription slice.
1615
1611
  */
1616
1612
  interface CreditBalance {
1617
- permanentCreditCents: number;
1618
- subscriptionCreditCents: number;
1613
+ permanentCreditMicros: number;
1614
+ subscriptionCreditMicros: number;
1619
1615
  subscriptionCreditExpiresAt: string | null;
1620
- totalActiveCents: number;
1616
+ totalActiveMicros: number;
1621
1617
  }
1622
1618
  /** Source of a credit ledger row. Matches the kind enum from migration 0017. */
1623
1619
  type CreditTransactionKind = 'grant_initial' | 'grant_renewal' | 'grant_pack' | 'debit_llm' | 'debit_sandbox' | 'admin_adjust';
@@ -1625,8 +1621,8 @@ type CreditTransactionKind = 'grant_initial' | 'grant_renewal' | 'grant_pack' |
1625
1621
  type CreditTransactionType = 'consumption' | 'purchase' | 'grant';
1626
1622
  interface CreditTransaction {
1627
1623
  id: string;
1628
- /** Signed amount in USD-cents. Negative = debit. */
1629
- creditAmountCents: number;
1624
+ /** Signed amount in USD micros. Negative = debit. */
1625
+ creditAmountMicros: number;
1630
1626
  kind: CreditTransactionKind;
1631
1627
  type: CreditTransactionType;
1632
1628
  description?: string;
@@ -1653,36 +1649,39 @@ interface ListCreditsTransactionsResponse {
1653
1649
  limit: number;
1654
1650
  };
1655
1651
  }
1656
- /** One month's bucket of credit activity. All money values in USD-cents. */
1652
+ /** One month's bucket of credit activity. All money values in USD micros. */
1657
1653
  interface MonthlyCreditStats {
1658
1654
  month: string;
1659
- consumptionCents: number;
1660
- purchasesCents: number;
1661
- grantsCents: number;
1662
- balanceCents: number;
1655
+ consumptionMicros: number;
1656
+ purchasesMicros: number;
1657
+ grantsMicros: number;
1658
+ balanceMicros: number;
1663
1659
  }
1664
1660
  /**
1665
1661
  * "Other amount" PAYG purchase config, served by
1666
1662
  * GET /credits/packs/custom-config. Disabled =>
1667
- * `{ enabled: false, minCents: 0, maxCents: 0, presetCents: [] }` so
1663
+ * `{ enabled: false, minMicros: 0, maxMicros: 0, presetMicros: [] }` so
1668
1664
  * the frontend can hide the tile cleanly without nil checks.
1669
1665
  */
1670
1666
  interface CustomCreditPurchaseConfig {
1671
1667
  enabled: boolean;
1672
- minCents: number;
1673
- maxCents: number;
1674
- /** Suggested one-click amounts (in cents) for the "Other" tile. */
1675
- presetCents: number[];
1668
+ minMicros: number;
1669
+ maxMicros: number;
1670
+ /** Suggested one-click amounts (in USD micros) for the "Other" tile. */
1671
+ presetMicros: number[];
1676
1672
  }
1677
1673
  /**
1678
- * Body for POST /credits/packs/buy-custom. `amountCents` is the
1679
- * arbitrary dollar amount the user typed, converted to USD-cents
1674
+ * Body for POST /credits/packs/buy-custom. `amountMicros` is the
1675
+ * arbitrary dollar amount the user typed, converted to USD micros
1680
1676
  * before the API call. Server enforces `min <= amount <= max`.
1681
1677
  * Credit ratio is 1:1 (pay $X, get $X of credits in the permanent
1682
- * bucket).
1678
+ * bucket). Stripe charges in cents — the backend divides by 10000 at
1679
+ * the API boundary, so amounts that aren't multiples of 10000 micros
1680
+ * incur tiny rounding loss at the Stripe step (presetMicros + minMicros
1681
+ * should be 10000-aligned).
1683
1682
  */
1684
1683
  interface BuyCustomCreditRequest {
1685
- amountCents: number;
1684
+ amountMicros: number;
1686
1685
  }
1687
1686
  /** Response from POST /credits/packs/buy-custom. Mirrors the fixed-pack response. */
1688
1687
  interface BuyCustomCreditResponse {
@@ -1701,12 +1700,12 @@ type ChatBillingRefuseCode = 'out_of_credits' | 'daily_cap_reached' | 'no_subscr
1701
1700
  interface ChatBillingRefuseError {
1702
1701
  message: string;
1703
1702
  code: ChatBillingRefuseCode;
1704
- permanentCreditCents: number;
1705
- subscriptionCreditCents: number;
1703
+ permanentCreditMicros: number;
1704
+ subscriptionCreditMicros: number;
1706
1705
  subscriptionCreditExpiresAt: string | null;
1707
- totalActiveCents: number;
1708
- dailyCapCents: number;
1709
- debitedLast24hCents: number;
1706
+ totalActiveMicros: number;
1707
+ dailyCapMicros: number;
1708
+ debitedLast24hMicros: number;
1710
1709
  }
1711
1710
 
1712
1711
  declare class SubscriptionsClient {
package/dist/index.d.ts CHANGED
@@ -1535,8 +1535,8 @@ interface SubscriptionPeriod {
1535
1535
  currency: string;
1536
1536
  interval: string;
1537
1537
  intervalCount?: number;
1538
- /** Per-period grant in USD-cents. 0 means no grant attached. */
1539
- creditsGrantedCents: number;
1538
+ /** Per-period grant in USD micros. 0 means no grant attached. */
1539
+ creditsGrantedMicros: number;
1540
1540
  }
1541
1541
  interface SubscriptionCapability {
1542
1542
  key: string;
@@ -1549,8 +1549,8 @@ interface Subscription {
1549
1549
  description?: string;
1550
1550
  periods: SubscriptionPeriod[];
1551
1551
  capabilities: SubscriptionCapability[];
1552
- /** Plan-level 24h rolling debit cap in USD-cents. null = no cap. */
1553
- dailyCreditCapCents?: number | null;
1552
+ /** Plan-level 24h rolling debit cap in USD micros. null = no cap. */
1553
+ dailyCreditCapMicros?: number | null;
1554
1554
  }
1555
1555
  interface OrgSubscription {
1556
1556
  id: string;
@@ -1596,28 +1596,24 @@ interface ListPaymentsResponse {
1596
1596
  /**
1597
1597
  * Org credit balance — two-bucket forfeit model (billing-v1).
1598
1598
  *
1599
- * - permanentCreditCents: PAYG (credit-pack) bucket. Never expires.
1600
- * - subscriptionCreditCents: Current subscription cycle. Forfeit on
1601
- * renewal; expires at subscriptionCreditExpiresAt.
1602
- * - subscriptionCreditExpiresAt: ISO-8601; null when no subscription is active.
1603
- * - totalActiveCents: Pre-computed sum = permanent +
1604
- * (subscription if not expired). Use this
1605
- * to drive the daily-cap progress bar
1606
- * and "out of credits" check.
1599
+ * - permanentCreditMicros: PAYG (credit-pack) bucket. Never expires.
1600
+ * - subscriptionCreditMicros: Current subscription cycle. Forfeit on
1601
+ * renewal; expires at subscriptionCreditExpiresAt.
1602
+ * - subscriptionCreditExpiresAt: ISO-8601; null when no subscription is active.
1603
+ * - totalActiveMicros: Pre-computed sum = permanent +
1604
+ * (subscription if not expired). Use this
1605
+ * to drive the daily-cap progress bar
1606
+ * and "out of credits" check.
1607
1607
  *
1608
- * Format `(value / 100).toFixed(2)` for display. Drain order is
1609
- * subscription bucket first, then permanent — visualise as a single
1610
- * pool with a small "expires soon" tag for the subscription slice.
1611
- *
1612
- * Legacy `realtimeBalance` / `pendingConsumption` / `breakdown` /
1613
- * `dateBalance` fields were dropped: the chat-loop debits in real-time
1614
- * so there is no notion of "pending".
1608
+ * Format `(value / 1_000_000).toFixed(2)` for dollar layouts. Drain
1609
+ * order is subscription bucket first, then permanent — visualise as a
1610
+ * single pool with a small "expires soon" tag for the subscription slice.
1615
1611
  */
1616
1612
  interface CreditBalance {
1617
- permanentCreditCents: number;
1618
- subscriptionCreditCents: number;
1613
+ permanentCreditMicros: number;
1614
+ subscriptionCreditMicros: number;
1619
1615
  subscriptionCreditExpiresAt: string | null;
1620
- totalActiveCents: number;
1616
+ totalActiveMicros: number;
1621
1617
  }
1622
1618
  /** Source of a credit ledger row. Matches the kind enum from migration 0017. */
1623
1619
  type CreditTransactionKind = 'grant_initial' | 'grant_renewal' | 'grant_pack' | 'debit_llm' | 'debit_sandbox' | 'admin_adjust';
@@ -1625,8 +1621,8 @@ type CreditTransactionKind = 'grant_initial' | 'grant_renewal' | 'grant_pack' |
1625
1621
  type CreditTransactionType = 'consumption' | 'purchase' | 'grant';
1626
1622
  interface CreditTransaction {
1627
1623
  id: string;
1628
- /** Signed amount in USD-cents. Negative = debit. */
1629
- creditAmountCents: number;
1624
+ /** Signed amount in USD micros. Negative = debit. */
1625
+ creditAmountMicros: number;
1630
1626
  kind: CreditTransactionKind;
1631
1627
  type: CreditTransactionType;
1632
1628
  description?: string;
@@ -1653,36 +1649,39 @@ interface ListCreditsTransactionsResponse {
1653
1649
  limit: number;
1654
1650
  };
1655
1651
  }
1656
- /** One month's bucket of credit activity. All money values in USD-cents. */
1652
+ /** One month's bucket of credit activity. All money values in USD micros. */
1657
1653
  interface MonthlyCreditStats {
1658
1654
  month: string;
1659
- consumptionCents: number;
1660
- purchasesCents: number;
1661
- grantsCents: number;
1662
- balanceCents: number;
1655
+ consumptionMicros: number;
1656
+ purchasesMicros: number;
1657
+ grantsMicros: number;
1658
+ balanceMicros: number;
1663
1659
  }
1664
1660
  /**
1665
1661
  * "Other amount" PAYG purchase config, served by
1666
1662
  * GET /credits/packs/custom-config. Disabled =>
1667
- * `{ enabled: false, minCents: 0, maxCents: 0, presetCents: [] }` so
1663
+ * `{ enabled: false, minMicros: 0, maxMicros: 0, presetMicros: [] }` so
1668
1664
  * the frontend can hide the tile cleanly without nil checks.
1669
1665
  */
1670
1666
  interface CustomCreditPurchaseConfig {
1671
1667
  enabled: boolean;
1672
- minCents: number;
1673
- maxCents: number;
1674
- /** Suggested one-click amounts (in cents) for the "Other" tile. */
1675
- presetCents: number[];
1668
+ minMicros: number;
1669
+ maxMicros: number;
1670
+ /** Suggested one-click amounts (in USD micros) for the "Other" tile. */
1671
+ presetMicros: number[];
1676
1672
  }
1677
1673
  /**
1678
- * Body for POST /credits/packs/buy-custom. `amountCents` is the
1679
- * arbitrary dollar amount the user typed, converted to USD-cents
1674
+ * Body for POST /credits/packs/buy-custom. `amountMicros` is the
1675
+ * arbitrary dollar amount the user typed, converted to USD micros
1680
1676
  * before the API call. Server enforces `min <= amount <= max`.
1681
1677
  * Credit ratio is 1:1 (pay $X, get $X of credits in the permanent
1682
- * bucket).
1678
+ * bucket). Stripe charges in cents — the backend divides by 10000 at
1679
+ * the API boundary, so amounts that aren't multiples of 10000 micros
1680
+ * incur tiny rounding loss at the Stripe step (presetMicros + minMicros
1681
+ * should be 10000-aligned).
1683
1682
  */
1684
1683
  interface BuyCustomCreditRequest {
1685
- amountCents: number;
1684
+ amountMicros: number;
1686
1685
  }
1687
1686
  /** Response from POST /credits/packs/buy-custom. Mirrors the fixed-pack response. */
1688
1687
  interface BuyCustomCreditResponse {
@@ -1701,12 +1700,12 @@ type ChatBillingRefuseCode = 'out_of_credits' | 'daily_cap_reached' | 'no_subscr
1701
1700
  interface ChatBillingRefuseError {
1702
1701
  message: string;
1703
1702
  code: ChatBillingRefuseCode;
1704
- permanentCreditCents: number;
1705
- subscriptionCreditCents: number;
1703
+ permanentCreditMicros: number;
1704
+ subscriptionCreditMicros: number;
1706
1705
  subscriptionCreditExpiresAt: string | null;
1707
- totalActiveCents: number;
1708
- dailyCapCents: number;
1709
- debitedLast24hCents: number;
1706
+ totalActiveMicros: number;
1707
+ dailyCapMicros: number;
1708
+ debitedLast24hMicros: number;
1710
1709
  }
1711
1710
 
1712
1711
  declare class SubscriptionsClient {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/tsclient",
3
- "version": "0.4.35",
3
+ "version": "0.4.36",
4
4
  "description": "TypeScript client for the cloud-agent platform API.",
5
5
  "type": "module",
6
6
  "sideEffects": false,