@flashbacktech/tsclient 0.4.35 → 0.4.37
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 +46 -43
- package/dist/index.d.ts +46 -43
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -668,6 +668,10 @@ interface ListChatSessionsResponse {
|
|
|
668
668
|
interface ListChatSessionsQuery {
|
|
669
669
|
cursor?: string;
|
|
670
670
|
limit?: number;
|
|
671
|
+
/** Inclusive lower bound on `created_at`, RFC3339 timestamp. */
|
|
672
|
+
from?: string;
|
|
673
|
+
/** Exclusive upper bound on `created_at`, RFC3339 timestamp. */
|
|
674
|
+
to?: string;
|
|
671
675
|
}
|
|
672
676
|
interface GetChatSessionResponse {
|
|
673
677
|
session: ChatSession;
|
|
@@ -1535,8 +1539,8 @@ interface SubscriptionPeriod {
|
|
|
1535
1539
|
currency: string;
|
|
1536
1540
|
interval: string;
|
|
1537
1541
|
intervalCount?: number;
|
|
1538
|
-
/** Per-period grant in USD
|
|
1539
|
-
|
|
1542
|
+
/** Per-period grant in USD micros. 0 means no grant attached. */
|
|
1543
|
+
creditsGrantedMicros: number;
|
|
1540
1544
|
}
|
|
1541
1545
|
interface SubscriptionCapability {
|
|
1542
1546
|
key: string;
|
|
@@ -1549,8 +1553,8 @@ interface Subscription {
|
|
|
1549
1553
|
description?: string;
|
|
1550
1554
|
periods: SubscriptionPeriod[];
|
|
1551
1555
|
capabilities: SubscriptionCapability[];
|
|
1552
|
-
/** Plan-level 24h rolling debit cap in USD
|
|
1553
|
-
|
|
1556
|
+
/** Plan-level 24h rolling debit cap in USD micros. null = no cap. */
|
|
1557
|
+
dailyCreditCapMicros?: number | null;
|
|
1554
1558
|
}
|
|
1555
1559
|
interface OrgSubscription {
|
|
1556
1560
|
id: string;
|
|
@@ -1596,28 +1600,24 @@ interface ListPaymentsResponse {
|
|
|
1596
1600
|
/**
|
|
1597
1601
|
* Org credit balance — two-bucket forfeit model (billing-v1).
|
|
1598
1602
|
*
|
|
1599
|
-
* -
|
|
1600
|
-
* -
|
|
1601
|
-
*
|
|
1602
|
-
* - subscriptionCreditExpiresAt:
|
|
1603
|
-
* -
|
|
1604
|
-
*
|
|
1605
|
-
*
|
|
1606
|
-
*
|
|
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.
|
|
1603
|
+
* - permanentCreditMicros: PAYG (credit-pack) bucket. Never expires.
|
|
1604
|
+
* - subscriptionCreditMicros: Current subscription cycle. Forfeit on
|
|
1605
|
+
* renewal; expires at subscriptionCreditExpiresAt.
|
|
1606
|
+
* - subscriptionCreditExpiresAt: ISO-8601; null when no subscription is active.
|
|
1607
|
+
* - totalActiveMicros: Pre-computed sum = permanent +
|
|
1608
|
+
* (subscription if not expired). Use this
|
|
1609
|
+
* to drive the daily-cap progress bar
|
|
1610
|
+
* and "out of credits" check.
|
|
1611
1611
|
*
|
|
1612
|
-
*
|
|
1613
|
-
*
|
|
1614
|
-
*
|
|
1612
|
+
* Format `(value / 1_000_000).toFixed(2)` for dollar layouts. Drain
|
|
1613
|
+
* order is subscription bucket first, then permanent — visualise as a
|
|
1614
|
+
* single pool with a small "expires soon" tag for the subscription slice.
|
|
1615
1615
|
*/
|
|
1616
1616
|
interface CreditBalance {
|
|
1617
|
-
|
|
1618
|
-
|
|
1617
|
+
permanentCreditMicros: number;
|
|
1618
|
+
subscriptionCreditMicros: number;
|
|
1619
1619
|
subscriptionCreditExpiresAt: string | null;
|
|
1620
|
-
|
|
1620
|
+
totalActiveMicros: number;
|
|
1621
1621
|
}
|
|
1622
1622
|
/** Source of a credit ledger row. Matches the kind enum from migration 0017. */
|
|
1623
1623
|
type CreditTransactionKind = 'grant_initial' | 'grant_renewal' | 'grant_pack' | 'debit_llm' | 'debit_sandbox' | 'admin_adjust';
|
|
@@ -1625,8 +1625,8 @@ type CreditTransactionKind = 'grant_initial' | 'grant_renewal' | 'grant_pack' |
|
|
|
1625
1625
|
type CreditTransactionType = 'consumption' | 'purchase' | 'grant';
|
|
1626
1626
|
interface CreditTransaction {
|
|
1627
1627
|
id: string;
|
|
1628
|
-
/** Signed amount in USD
|
|
1629
|
-
|
|
1628
|
+
/** Signed amount in USD micros. Negative = debit. */
|
|
1629
|
+
creditAmountMicros: number;
|
|
1630
1630
|
kind: CreditTransactionKind;
|
|
1631
1631
|
type: CreditTransactionType;
|
|
1632
1632
|
description?: string;
|
|
@@ -1653,36 +1653,39 @@ interface ListCreditsTransactionsResponse {
|
|
|
1653
1653
|
limit: number;
|
|
1654
1654
|
};
|
|
1655
1655
|
}
|
|
1656
|
-
/** One month's bucket of credit activity. All money values in USD
|
|
1656
|
+
/** One month's bucket of credit activity. All money values in USD micros. */
|
|
1657
1657
|
interface MonthlyCreditStats {
|
|
1658
1658
|
month: string;
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1659
|
+
consumptionMicros: number;
|
|
1660
|
+
purchasesMicros: number;
|
|
1661
|
+
grantsMicros: number;
|
|
1662
|
+
balanceMicros: number;
|
|
1663
1663
|
}
|
|
1664
1664
|
/**
|
|
1665
1665
|
* "Other amount" PAYG purchase config, served by
|
|
1666
1666
|
* GET /credits/packs/custom-config. Disabled =>
|
|
1667
|
-
* `{ enabled: false,
|
|
1667
|
+
* `{ enabled: false, minMicros: 0, maxMicros: 0, presetMicros: [] }` so
|
|
1668
1668
|
* the frontend can hide the tile cleanly without nil checks.
|
|
1669
1669
|
*/
|
|
1670
1670
|
interface CustomCreditPurchaseConfig {
|
|
1671
1671
|
enabled: boolean;
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
/** Suggested one-click amounts (in
|
|
1675
|
-
|
|
1672
|
+
minMicros: number;
|
|
1673
|
+
maxMicros: number;
|
|
1674
|
+
/** Suggested one-click amounts (in USD micros) for the "Other" tile. */
|
|
1675
|
+
presetMicros: number[];
|
|
1676
1676
|
}
|
|
1677
1677
|
/**
|
|
1678
|
-
* Body for POST /credits/packs/buy-custom. `
|
|
1679
|
-
* arbitrary dollar amount the user typed, converted to USD
|
|
1678
|
+
* Body for POST /credits/packs/buy-custom. `amountMicros` is the
|
|
1679
|
+
* arbitrary dollar amount the user typed, converted to USD micros
|
|
1680
1680
|
* before the API call. Server enforces `min <= amount <= max`.
|
|
1681
1681
|
* Credit ratio is 1:1 (pay $X, get $X of credits in the permanent
|
|
1682
|
-
* bucket).
|
|
1682
|
+
* bucket). Stripe charges in cents — the backend divides by 10000 at
|
|
1683
|
+
* the API boundary, so amounts that aren't multiples of 10000 micros
|
|
1684
|
+
* incur tiny rounding loss at the Stripe step (presetMicros + minMicros
|
|
1685
|
+
* should be 10000-aligned).
|
|
1683
1686
|
*/
|
|
1684
1687
|
interface BuyCustomCreditRequest {
|
|
1685
|
-
|
|
1688
|
+
amountMicros: number;
|
|
1686
1689
|
}
|
|
1687
1690
|
/** Response from POST /credits/packs/buy-custom. Mirrors the fixed-pack response. */
|
|
1688
1691
|
interface BuyCustomCreditResponse {
|
|
@@ -1701,12 +1704,12 @@ type ChatBillingRefuseCode = 'out_of_credits' | 'daily_cap_reached' | 'no_subscr
|
|
|
1701
1704
|
interface ChatBillingRefuseError {
|
|
1702
1705
|
message: string;
|
|
1703
1706
|
code: ChatBillingRefuseCode;
|
|
1704
|
-
|
|
1705
|
-
|
|
1707
|
+
permanentCreditMicros: number;
|
|
1708
|
+
subscriptionCreditMicros: number;
|
|
1706
1709
|
subscriptionCreditExpiresAt: string | null;
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
+
totalActiveMicros: number;
|
|
1711
|
+
dailyCapMicros: number;
|
|
1712
|
+
debitedLast24hMicros: number;
|
|
1710
1713
|
}
|
|
1711
1714
|
|
|
1712
1715
|
declare class SubscriptionsClient {
|
package/dist/index.d.ts
CHANGED
|
@@ -668,6 +668,10 @@ interface ListChatSessionsResponse {
|
|
|
668
668
|
interface ListChatSessionsQuery {
|
|
669
669
|
cursor?: string;
|
|
670
670
|
limit?: number;
|
|
671
|
+
/** Inclusive lower bound on `created_at`, RFC3339 timestamp. */
|
|
672
|
+
from?: string;
|
|
673
|
+
/** Exclusive upper bound on `created_at`, RFC3339 timestamp. */
|
|
674
|
+
to?: string;
|
|
671
675
|
}
|
|
672
676
|
interface GetChatSessionResponse {
|
|
673
677
|
session: ChatSession;
|
|
@@ -1535,8 +1539,8 @@ interface SubscriptionPeriod {
|
|
|
1535
1539
|
currency: string;
|
|
1536
1540
|
interval: string;
|
|
1537
1541
|
intervalCount?: number;
|
|
1538
|
-
/** Per-period grant in USD
|
|
1539
|
-
|
|
1542
|
+
/** Per-period grant in USD micros. 0 means no grant attached. */
|
|
1543
|
+
creditsGrantedMicros: number;
|
|
1540
1544
|
}
|
|
1541
1545
|
interface SubscriptionCapability {
|
|
1542
1546
|
key: string;
|
|
@@ -1549,8 +1553,8 @@ interface Subscription {
|
|
|
1549
1553
|
description?: string;
|
|
1550
1554
|
periods: SubscriptionPeriod[];
|
|
1551
1555
|
capabilities: SubscriptionCapability[];
|
|
1552
|
-
/** Plan-level 24h rolling debit cap in USD
|
|
1553
|
-
|
|
1556
|
+
/** Plan-level 24h rolling debit cap in USD micros. null = no cap. */
|
|
1557
|
+
dailyCreditCapMicros?: number | null;
|
|
1554
1558
|
}
|
|
1555
1559
|
interface OrgSubscription {
|
|
1556
1560
|
id: string;
|
|
@@ -1596,28 +1600,24 @@ interface ListPaymentsResponse {
|
|
|
1596
1600
|
/**
|
|
1597
1601
|
* Org credit balance — two-bucket forfeit model (billing-v1).
|
|
1598
1602
|
*
|
|
1599
|
-
* -
|
|
1600
|
-
* -
|
|
1601
|
-
*
|
|
1602
|
-
* - subscriptionCreditExpiresAt:
|
|
1603
|
-
* -
|
|
1604
|
-
*
|
|
1605
|
-
*
|
|
1606
|
-
*
|
|
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.
|
|
1603
|
+
* - permanentCreditMicros: PAYG (credit-pack) bucket. Never expires.
|
|
1604
|
+
* - subscriptionCreditMicros: Current subscription cycle. Forfeit on
|
|
1605
|
+
* renewal; expires at subscriptionCreditExpiresAt.
|
|
1606
|
+
* - subscriptionCreditExpiresAt: ISO-8601; null when no subscription is active.
|
|
1607
|
+
* - totalActiveMicros: Pre-computed sum = permanent +
|
|
1608
|
+
* (subscription if not expired). Use this
|
|
1609
|
+
* to drive the daily-cap progress bar
|
|
1610
|
+
* and "out of credits" check.
|
|
1611
1611
|
*
|
|
1612
|
-
*
|
|
1613
|
-
*
|
|
1614
|
-
*
|
|
1612
|
+
* Format `(value / 1_000_000).toFixed(2)` for dollar layouts. Drain
|
|
1613
|
+
* order is subscription bucket first, then permanent — visualise as a
|
|
1614
|
+
* single pool with a small "expires soon" tag for the subscription slice.
|
|
1615
1615
|
*/
|
|
1616
1616
|
interface CreditBalance {
|
|
1617
|
-
|
|
1618
|
-
|
|
1617
|
+
permanentCreditMicros: number;
|
|
1618
|
+
subscriptionCreditMicros: number;
|
|
1619
1619
|
subscriptionCreditExpiresAt: string | null;
|
|
1620
|
-
|
|
1620
|
+
totalActiveMicros: number;
|
|
1621
1621
|
}
|
|
1622
1622
|
/** Source of a credit ledger row. Matches the kind enum from migration 0017. */
|
|
1623
1623
|
type CreditTransactionKind = 'grant_initial' | 'grant_renewal' | 'grant_pack' | 'debit_llm' | 'debit_sandbox' | 'admin_adjust';
|
|
@@ -1625,8 +1625,8 @@ type CreditTransactionKind = 'grant_initial' | 'grant_renewal' | 'grant_pack' |
|
|
|
1625
1625
|
type CreditTransactionType = 'consumption' | 'purchase' | 'grant';
|
|
1626
1626
|
interface CreditTransaction {
|
|
1627
1627
|
id: string;
|
|
1628
|
-
/** Signed amount in USD
|
|
1629
|
-
|
|
1628
|
+
/** Signed amount in USD micros. Negative = debit. */
|
|
1629
|
+
creditAmountMicros: number;
|
|
1630
1630
|
kind: CreditTransactionKind;
|
|
1631
1631
|
type: CreditTransactionType;
|
|
1632
1632
|
description?: string;
|
|
@@ -1653,36 +1653,39 @@ interface ListCreditsTransactionsResponse {
|
|
|
1653
1653
|
limit: number;
|
|
1654
1654
|
};
|
|
1655
1655
|
}
|
|
1656
|
-
/** One month's bucket of credit activity. All money values in USD
|
|
1656
|
+
/** One month's bucket of credit activity. All money values in USD micros. */
|
|
1657
1657
|
interface MonthlyCreditStats {
|
|
1658
1658
|
month: string;
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1659
|
+
consumptionMicros: number;
|
|
1660
|
+
purchasesMicros: number;
|
|
1661
|
+
grantsMicros: number;
|
|
1662
|
+
balanceMicros: number;
|
|
1663
1663
|
}
|
|
1664
1664
|
/**
|
|
1665
1665
|
* "Other amount" PAYG purchase config, served by
|
|
1666
1666
|
* GET /credits/packs/custom-config. Disabled =>
|
|
1667
|
-
* `{ enabled: false,
|
|
1667
|
+
* `{ enabled: false, minMicros: 0, maxMicros: 0, presetMicros: [] }` so
|
|
1668
1668
|
* the frontend can hide the tile cleanly without nil checks.
|
|
1669
1669
|
*/
|
|
1670
1670
|
interface CustomCreditPurchaseConfig {
|
|
1671
1671
|
enabled: boolean;
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
/** Suggested one-click amounts (in
|
|
1675
|
-
|
|
1672
|
+
minMicros: number;
|
|
1673
|
+
maxMicros: number;
|
|
1674
|
+
/** Suggested one-click amounts (in USD micros) for the "Other" tile. */
|
|
1675
|
+
presetMicros: number[];
|
|
1676
1676
|
}
|
|
1677
1677
|
/**
|
|
1678
|
-
* Body for POST /credits/packs/buy-custom. `
|
|
1679
|
-
* arbitrary dollar amount the user typed, converted to USD
|
|
1678
|
+
* Body for POST /credits/packs/buy-custom. `amountMicros` is the
|
|
1679
|
+
* arbitrary dollar amount the user typed, converted to USD micros
|
|
1680
1680
|
* before the API call. Server enforces `min <= amount <= max`.
|
|
1681
1681
|
* Credit ratio is 1:1 (pay $X, get $X of credits in the permanent
|
|
1682
|
-
* bucket).
|
|
1682
|
+
* bucket). Stripe charges in cents — the backend divides by 10000 at
|
|
1683
|
+
* the API boundary, so amounts that aren't multiples of 10000 micros
|
|
1684
|
+
* incur tiny rounding loss at the Stripe step (presetMicros + minMicros
|
|
1685
|
+
* should be 10000-aligned).
|
|
1683
1686
|
*/
|
|
1684
1687
|
interface BuyCustomCreditRequest {
|
|
1685
|
-
|
|
1688
|
+
amountMicros: number;
|
|
1686
1689
|
}
|
|
1687
1690
|
/** Response from POST /credits/packs/buy-custom. Mirrors the fixed-pack response. */
|
|
1688
1691
|
interface BuyCustomCreditResponse {
|
|
@@ -1701,12 +1704,12 @@ type ChatBillingRefuseCode = 'out_of_credits' | 'daily_cap_reached' | 'no_subscr
|
|
|
1701
1704
|
interface ChatBillingRefuseError {
|
|
1702
1705
|
message: string;
|
|
1703
1706
|
code: ChatBillingRefuseCode;
|
|
1704
|
-
|
|
1705
|
-
|
|
1707
|
+
permanentCreditMicros: number;
|
|
1708
|
+
subscriptionCreditMicros: number;
|
|
1706
1709
|
subscriptionCreditExpiresAt: string | null;
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
+
totalActiveMicros: number;
|
|
1711
|
+
dailyCapMicros: number;
|
|
1712
|
+
debitedLast24hMicros: number;
|
|
1710
1713
|
}
|
|
1711
1714
|
|
|
1712
1715
|
declare class SubscriptionsClient {
|