@chipi-stack/types 14.14.0 → 14.15.0

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.mts CHANGED
@@ -1149,6 +1149,7 @@ interface X402PaymentConfig {
1149
1149
  * `@chipi-stack/backend`. Every call is billed to the organization's credits
1150
1150
  * and needs a secret key (`sk_`), so these are server-side only.
1151
1151
  */
1152
+
1152
1153
  /** Actions `/v1/ai/think` may decide. */
1153
1154
  type ThinkAction = "swap" | "supply" | "withdraw" | "hold";
1154
1155
  /**
@@ -1219,6 +1220,38 @@ interface ThinkResponse {
1219
1220
  latencyMs: number;
1220
1221
  /** `true` only for `sk_dev_` keys: canned response, no model was called. */
1221
1222
  sandbox?: boolean;
1223
+ /** Present when the call was paid over x402 instead of credits (`cost.charged` is 0). */
1224
+ x402Payment?: ThinkX402Payment;
1225
+ }
1226
+ /** The x402 payment that paid a think call. */
1227
+ interface ThinkX402Payment {
1228
+ /** Hash of the USDC transfer that paid the call. */
1229
+ transactionHash: string;
1230
+ payer: string;
1231
+ /** USDC base units (6 decimals). */
1232
+ amount: string;
1233
+ asset: string;
1234
+ }
1235
+ /**
1236
+ * Pay a think call over x402 with a session key when the API asks for it
1237
+ * (402 with a `session-transfer` offer, e.g. when credits are short).
1238
+ */
1239
+ interface ThinkSessionPayment extends Omit<ExecuteWithSessionParams, "calls"> {
1240
+ /**
1241
+ * The most one call may cost, in USDC base units (6 decimals). A higher
1242
+ * price is refused before anything is paid. Also cap USDC in the session's
1243
+ * spending policy: this is a client-side guard, the policy is the on-chain one.
1244
+ */
1245
+ maxAmount: bigint | string;
1246
+ }
1247
+ interface ThinkOptions {
1248
+ /** Pay with this session key when the API answers 402 with an x402 offer. */
1249
+ payWithSession?: ThinkSessionPayment;
1250
+ /**
1251
+ * A ready `X-PAYMENT` header value, to retry a call with a payment that was
1252
+ * made but not served (the hash is in `error.details.x402PaymentHash`).
1253
+ */
1254
+ xPayment?: string;
1222
1255
  }
1223
1256
  interface AiChatMessage {
1224
1257
  role: "system" | "user" | "assistant";
@@ -1421,4 +1454,4 @@ interface PlanSnapshot {
1421
1454
  planPaymentProvider: PlanPaymentProvider | null;
1422
1455
  }
1423
1456
 
1424
- export { type AddSessionKeyParams, type AiChatMessage, type AiChatParams, type AiChatResponse, type AiCost, type AiExecuteCall, type AiExecuteParams, type AiExecuteResponse, type AiModel, type AiModelsResponse, type AiPrices, type AiPricesParams, type AiSignals, type AiSignalsParams, type AiSwapQuote, type AiTokenPrice, type AiTokenSignals, type AiUsage, type ApiError, type ApiKey, type ApiResponse, type ApproveHookInput, type ApproveParams, type AsyncReturnType, type AuthContext, type AuthMethod, type CallAnyContractParams, Chain, ChainToken, type ChipiBrowserSDKConfig, type ChipiSDKConfig, type ChipiServerSDKConfig, type Country, type CreateCustodialWalletParams, type CreateSessionKeyParams, type CreateSkuPurchaseBody, type CreateSkuPurchaseParams, type CreateUserParams, type CreateWalletParams, type CreateWalletResponse, Currency, type DeepPartial, type DeploymentData, type ErrorWithCode, type ExecuteSponsoredTransactionParams, type ExecuteSponsoredTransactionResponse, type ExecuteTransactionParams, type ExecuteWalletUpgradeParams, type ExecuteWalletUpgradeResponse, type ExecuteWithSessionParams, type GetMerchantWalletParams, type GetSessionDataParams, type GetSkuListQuery, type GetSpendingPolicyParams, type GetTokenBalanceParams, type GetTokenBalanceResponse, type GetTransactionListQuery, type GetTransactionParams, type GetTransactionStatusParams, type GetTransactionsParams, type GetUserParams, type GetWalletParams, type GetWalletResponse, type JwtPayload, type MaybePromise, type MigrateWalletToPasskeyParams, type NonEmptyArray, type NonceStore, OnChainTxStatus, type Optional, type PaginatedResponse, type PaginationQuery, type PasskeyMetadata, type PaymasterAccount, type PaymasterAdapter, type PaymentPayload, type PaymentRequirement, type Plan, type PlanPaymentProvider, type PlanSnapshot, type PrepareTypedDataParams, type PrepareTypedDataResponse, type PrepareWalletCreationParams, type PrepareWalletCreationResponse, type PrepareWalletUpgradeParams, type PrepareWalletUpgradeResponse, type Prettify, type RecordSendTransactionParams, type RemoveSpendingPolicyParams, type RequireAtLeastOne, type RevokeSessionKeyParams, STARKNET_CONTRACTS, type SessionConfig, type SessionDataResponse, type SessionKeyData, type SessionSpendingPolicy, type SessionWalletData, type SetSpendingPolicyParams, type SettleResponse, type SetupSessionParams, type ShhhPaymentExtension, type ShhhSignerKind, type SignTypedDataParams, type SignTypedDataResult, type Sku, type SkuCategory, type SkuProvider, type SpendingPolicyConfig, type SpendingPolicyData, type StakeVesuUsdcHookInputParams, type StakeVesuUsdcParams, type SyncOnChainTransfersParams, type SyncOnChainTransfersResponse, type ThinkAction, type ThinkDecision, type ThinkParams, type ThinkRawDecision, type ThinkResponse, type ThinkRiskParams, type Transaction, type TransactionStatusResponse, type TransferHookInput, type TransferParams, type TxStatus, type TxType, type UpdateWalletEncryptionParams, type UpdateWalletEncryptionResponse, type User, type ValueOrFunction, type VerifyResponse, type WalletData, type WalletType, type WithdrawVesuUsdcHookInputParams, type WithdrawVesuUsdcParams, type X402ClientConfig, type X402FacilitatorConfig, type X402PaymentConfig, type alphaUrl };
1457
+ export { type AddSessionKeyParams, type AiChatMessage, type AiChatParams, type AiChatResponse, type AiCost, type AiExecuteCall, type AiExecuteParams, type AiExecuteResponse, type AiModel, type AiModelsResponse, type AiPrices, type AiPricesParams, type AiSignals, type AiSignalsParams, type AiSwapQuote, type AiTokenPrice, type AiTokenSignals, type AiUsage, type ApiError, type ApiKey, type ApiResponse, type ApproveHookInput, type ApproveParams, type AsyncReturnType, type AuthContext, type AuthMethod, type CallAnyContractParams, Chain, ChainToken, type ChipiBrowserSDKConfig, type ChipiSDKConfig, type ChipiServerSDKConfig, type Country, type CreateCustodialWalletParams, type CreateSessionKeyParams, type CreateSkuPurchaseBody, type CreateSkuPurchaseParams, type CreateUserParams, type CreateWalletParams, type CreateWalletResponse, Currency, type DeepPartial, type DeploymentData, type ErrorWithCode, type ExecuteSponsoredTransactionParams, type ExecuteSponsoredTransactionResponse, type ExecuteTransactionParams, type ExecuteWalletUpgradeParams, type ExecuteWalletUpgradeResponse, type ExecuteWithSessionParams, type GetMerchantWalletParams, type GetSessionDataParams, type GetSkuListQuery, type GetSpendingPolicyParams, type GetTokenBalanceParams, type GetTokenBalanceResponse, type GetTransactionListQuery, type GetTransactionParams, type GetTransactionStatusParams, type GetTransactionsParams, type GetUserParams, type GetWalletParams, type GetWalletResponse, type JwtPayload, type MaybePromise, type MigrateWalletToPasskeyParams, type NonEmptyArray, type NonceStore, OnChainTxStatus, type Optional, type PaginatedResponse, type PaginationQuery, type PasskeyMetadata, type PaymasterAccount, type PaymasterAdapter, type PaymentPayload, type PaymentRequirement, type Plan, type PlanPaymentProvider, type PlanSnapshot, type PrepareTypedDataParams, type PrepareTypedDataResponse, type PrepareWalletCreationParams, type PrepareWalletCreationResponse, type PrepareWalletUpgradeParams, type PrepareWalletUpgradeResponse, type Prettify, type RecordSendTransactionParams, type RemoveSpendingPolicyParams, type RequireAtLeastOne, type RevokeSessionKeyParams, STARKNET_CONTRACTS, type SessionConfig, type SessionDataResponse, type SessionKeyData, type SessionSpendingPolicy, type SessionWalletData, type SetSpendingPolicyParams, type SettleResponse, type SetupSessionParams, type ShhhPaymentExtension, type ShhhSignerKind, type SignTypedDataParams, type SignTypedDataResult, type Sku, type SkuCategory, type SkuProvider, type SpendingPolicyConfig, type SpendingPolicyData, type StakeVesuUsdcHookInputParams, type StakeVesuUsdcParams, type SyncOnChainTransfersParams, type SyncOnChainTransfersResponse, type ThinkAction, type ThinkDecision, type ThinkOptions, type ThinkParams, type ThinkRawDecision, type ThinkResponse, type ThinkRiskParams, type ThinkSessionPayment, type ThinkX402Payment, type Transaction, type TransactionStatusResponse, type TransferHookInput, type TransferParams, type TxStatus, type TxType, type UpdateWalletEncryptionParams, type UpdateWalletEncryptionResponse, type User, type ValueOrFunction, type VerifyResponse, type WalletData, type WalletType, type WithdrawVesuUsdcHookInputParams, type WithdrawVesuUsdcParams, type X402ClientConfig, type X402FacilitatorConfig, type X402PaymentConfig, type alphaUrl };
package/dist/index.d.ts CHANGED
@@ -1149,6 +1149,7 @@ interface X402PaymentConfig {
1149
1149
  * `@chipi-stack/backend`. Every call is billed to the organization's credits
1150
1150
  * and needs a secret key (`sk_`), so these are server-side only.
1151
1151
  */
1152
+
1152
1153
  /** Actions `/v1/ai/think` may decide. */
1153
1154
  type ThinkAction = "swap" | "supply" | "withdraw" | "hold";
1154
1155
  /**
@@ -1219,6 +1220,38 @@ interface ThinkResponse {
1219
1220
  latencyMs: number;
1220
1221
  /** `true` only for `sk_dev_` keys: canned response, no model was called. */
1221
1222
  sandbox?: boolean;
1223
+ /** Present when the call was paid over x402 instead of credits (`cost.charged` is 0). */
1224
+ x402Payment?: ThinkX402Payment;
1225
+ }
1226
+ /** The x402 payment that paid a think call. */
1227
+ interface ThinkX402Payment {
1228
+ /** Hash of the USDC transfer that paid the call. */
1229
+ transactionHash: string;
1230
+ payer: string;
1231
+ /** USDC base units (6 decimals). */
1232
+ amount: string;
1233
+ asset: string;
1234
+ }
1235
+ /**
1236
+ * Pay a think call over x402 with a session key when the API asks for it
1237
+ * (402 with a `session-transfer` offer, e.g. when credits are short).
1238
+ */
1239
+ interface ThinkSessionPayment extends Omit<ExecuteWithSessionParams, "calls"> {
1240
+ /**
1241
+ * The most one call may cost, in USDC base units (6 decimals). A higher
1242
+ * price is refused before anything is paid. Also cap USDC in the session's
1243
+ * spending policy: this is a client-side guard, the policy is the on-chain one.
1244
+ */
1245
+ maxAmount: bigint | string;
1246
+ }
1247
+ interface ThinkOptions {
1248
+ /** Pay with this session key when the API answers 402 with an x402 offer. */
1249
+ payWithSession?: ThinkSessionPayment;
1250
+ /**
1251
+ * A ready `X-PAYMENT` header value, to retry a call with a payment that was
1252
+ * made but not served (the hash is in `error.details.x402PaymentHash`).
1253
+ */
1254
+ xPayment?: string;
1222
1255
  }
1223
1256
  interface AiChatMessage {
1224
1257
  role: "system" | "user" | "assistant";
@@ -1421,4 +1454,4 @@ interface PlanSnapshot {
1421
1454
  planPaymentProvider: PlanPaymentProvider | null;
1422
1455
  }
1423
1456
 
1424
- export { type AddSessionKeyParams, type AiChatMessage, type AiChatParams, type AiChatResponse, type AiCost, type AiExecuteCall, type AiExecuteParams, type AiExecuteResponse, type AiModel, type AiModelsResponse, type AiPrices, type AiPricesParams, type AiSignals, type AiSignalsParams, type AiSwapQuote, type AiTokenPrice, type AiTokenSignals, type AiUsage, type ApiError, type ApiKey, type ApiResponse, type ApproveHookInput, type ApproveParams, type AsyncReturnType, type AuthContext, type AuthMethod, type CallAnyContractParams, Chain, ChainToken, type ChipiBrowserSDKConfig, type ChipiSDKConfig, type ChipiServerSDKConfig, type Country, type CreateCustodialWalletParams, type CreateSessionKeyParams, type CreateSkuPurchaseBody, type CreateSkuPurchaseParams, type CreateUserParams, type CreateWalletParams, type CreateWalletResponse, Currency, type DeepPartial, type DeploymentData, type ErrorWithCode, type ExecuteSponsoredTransactionParams, type ExecuteSponsoredTransactionResponse, type ExecuteTransactionParams, type ExecuteWalletUpgradeParams, type ExecuteWalletUpgradeResponse, type ExecuteWithSessionParams, type GetMerchantWalletParams, type GetSessionDataParams, type GetSkuListQuery, type GetSpendingPolicyParams, type GetTokenBalanceParams, type GetTokenBalanceResponse, type GetTransactionListQuery, type GetTransactionParams, type GetTransactionStatusParams, type GetTransactionsParams, type GetUserParams, type GetWalletParams, type GetWalletResponse, type JwtPayload, type MaybePromise, type MigrateWalletToPasskeyParams, type NonEmptyArray, type NonceStore, OnChainTxStatus, type Optional, type PaginatedResponse, type PaginationQuery, type PasskeyMetadata, type PaymasterAccount, type PaymasterAdapter, type PaymentPayload, type PaymentRequirement, type Plan, type PlanPaymentProvider, type PlanSnapshot, type PrepareTypedDataParams, type PrepareTypedDataResponse, type PrepareWalletCreationParams, type PrepareWalletCreationResponse, type PrepareWalletUpgradeParams, type PrepareWalletUpgradeResponse, type Prettify, type RecordSendTransactionParams, type RemoveSpendingPolicyParams, type RequireAtLeastOne, type RevokeSessionKeyParams, STARKNET_CONTRACTS, type SessionConfig, type SessionDataResponse, type SessionKeyData, type SessionSpendingPolicy, type SessionWalletData, type SetSpendingPolicyParams, type SettleResponse, type SetupSessionParams, type ShhhPaymentExtension, type ShhhSignerKind, type SignTypedDataParams, type SignTypedDataResult, type Sku, type SkuCategory, type SkuProvider, type SpendingPolicyConfig, type SpendingPolicyData, type StakeVesuUsdcHookInputParams, type StakeVesuUsdcParams, type SyncOnChainTransfersParams, type SyncOnChainTransfersResponse, type ThinkAction, type ThinkDecision, type ThinkParams, type ThinkRawDecision, type ThinkResponse, type ThinkRiskParams, type Transaction, type TransactionStatusResponse, type TransferHookInput, type TransferParams, type TxStatus, type TxType, type UpdateWalletEncryptionParams, type UpdateWalletEncryptionResponse, type User, type ValueOrFunction, type VerifyResponse, type WalletData, type WalletType, type WithdrawVesuUsdcHookInputParams, type WithdrawVesuUsdcParams, type X402ClientConfig, type X402FacilitatorConfig, type X402PaymentConfig, type alphaUrl };
1457
+ export { type AddSessionKeyParams, type AiChatMessage, type AiChatParams, type AiChatResponse, type AiCost, type AiExecuteCall, type AiExecuteParams, type AiExecuteResponse, type AiModel, type AiModelsResponse, type AiPrices, type AiPricesParams, type AiSignals, type AiSignalsParams, type AiSwapQuote, type AiTokenPrice, type AiTokenSignals, type AiUsage, type ApiError, type ApiKey, type ApiResponse, type ApproveHookInput, type ApproveParams, type AsyncReturnType, type AuthContext, type AuthMethod, type CallAnyContractParams, Chain, ChainToken, type ChipiBrowserSDKConfig, type ChipiSDKConfig, type ChipiServerSDKConfig, type Country, type CreateCustodialWalletParams, type CreateSessionKeyParams, type CreateSkuPurchaseBody, type CreateSkuPurchaseParams, type CreateUserParams, type CreateWalletParams, type CreateWalletResponse, Currency, type DeepPartial, type DeploymentData, type ErrorWithCode, type ExecuteSponsoredTransactionParams, type ExecuteSponsoredTransactionResponse, type ExecuteTransactionParams, type ExecuteWalletUpgradeParams, type ExecuteWalletUpgradeResponse, type ExecuteWithSessionParams, type GetMerchantWalletParams, type GetSessionDataParams, type GetSkuListQuery, type GetSpendingPolicyParams, type GetTokenBalanceParams, type GetTokenBalanceResponse, type GetTransactionListQuery, type GetTransactionParams, type GetTransactionStatusParams, type GetTransactionsParams, type GetUserParams, type GetWalletParams, type GetWalletResponse, type JwtPayload, type MaybePromise, type MigrateWalletToPasskeyParams, type NonEmptyArray, type NonceStore, OnChainTxStatus, type Optional, type PaginatedResponse, type PaginationQuery, type PasskeyMetadata, type PaymasterAccount, type PaymasterAdapter, type PaymentPayload, type PaymentRequirement, type Plan, type PlanPaymentProvider, type PlanSnapshot, type PrepareTypedDataParams, type PrepareTypedDataResponse, type PrepareWalletCreationParams, type PrepareWalletCreationResponse, type PrepareWalletUpgradeParams, type PrepareWalletUpgradeResponse, type Prettify, type RecordSendTransactionParams, type RemoveSpendingPolicyParams, type RequireAtLeastOne, type RevokeSessionKeyParams, STARKNET_CONTRACTS, type SessionConfig, type SessionDataResponse, type SessionKeyData, type SessionSpendingPolicy, type SessionWalletData, type SetSpendingPolicyParams, type SettleResponse, type SetupSessionParams, type ShhhPaymentExtension, type ShhhSignerKind, type SignTypedDataParams, type SignTypedDataResult, type Sku, type SkuCategory, type SkuProvider, type SpendingPolicyConfig, type SpendingPolicyData, type StakeVesuUsdcHookInputParams, type StakeVesuUsdcParams, type SyncOnChainTransfersParams, type SyncOnChainTransfersResponse, type ThinkAction, type ThinkDecision, type ThinkOptions, type ThinkParams, type ThinkRawDecision, type ThinkResponse, type ThinkRiskParams, type ThinkSessionPayment, type ThinkX402Payment, type Transaction, type TransactionStatusResponse, type TransferHookInput, type TransferParams, type TxStatus, type TxType, type UpdateWalletEncryptionParams, type UpdateWalletEncryptionResponse, type User, type ValueOrFunction, type VerifyResponse, type WalletData, type WalletType, type WithdrawVesuUsdcHookInputParams, type WithdrawVesuUsdcParams, type X402ClientConfig, type X402FacilitatorConfig, type X402PaymentConfig, type alphaUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipi-stack/types",
3
- "version": "14.14.0",
3
+ "version": "14.15.0",
4
4
  "description": "Type definitions for Chipi SDK packages",
5
5
  "keywords": [
6
6
  "chipi",