import type { Currency, Money } from './money.js'; import type { Iso8601 } from './time.js'; import type { EntitlementScope } from './scope.js'; export interface AccountInput { readonly agentId: string; readonly principalId: string; readonly metadata?: Readonly>; } export interface Account { readonly id: string; readonly agentId: string; readonly principalId: string; readonly createdAt: Iso8601; readonly updatedAt: Iso8601; readonly metadata: Readonly>; } export type EntitlementType = 'one_time' | 'balance' | 'subscription' | 'quota'; export type EntitlementStatus = 'active' | 'consumed' | 'expired' | 'revoked'; export type QuotaResetPeriod = 'daily' | 'weekly' | 'monthly' | 'never'; interface EntitlementCommon { readonly id: string; readonly accountId: string; readonly scope: EntitlementScope; readonly status: EntitlementStatus; readonly grantedAt: Iso8601; readonly grantedByPaymentId?: string; readonly metadata: Readonly>; readonly version: number; } export interface OneTimeEntitlement extends EntitlementCommon { readonly type: 'one_time'; } export interface BalanceEntitlement extends EntitlementCommon { readonly type: 'balance'; readonly balance: Money; } export interface SubscriptionEntitlement extends EntitlementCommon { readonly type: 'subscription'; readonly validFrom: Iso8601; readonly validUntil: Iso8601; } export interface QuotaEntitlement extends EntitlementCommon { readonly type: 'quota'; readonly limit: number; readonly remaining: number; readonly resetAt?: Iso8601; readonly resetPeriod: QuotaResetPeriod; } export type Entitlement = OneTimeEntitlement | BalanceEntitlement | SubscriptionEntitlement | QuotaEntitlement; interface EntitlementGrantCommon { readonly accountId: string; readonly scope: EntitlementScope; readonly grantedByPaymentId?: string; readonly metadata?: Readonly>; } export type EntitlementGrant = (EntitlementGrantCommon & { readonly type: 'one_time'; }) | (EntitlementGrantCommon & { readonly type: 'balance'; readonly balance: Money; }) | (EntitlementGrantCommon & { readonly type: 'subscription'; readonly validFrom: Iso8601; readonly validUntil: Iso8601; }) | (EntitlementGrantCommon & { readonly type: 'quota'; readonly limit: number; readonly remaining?: number; readonly resetPeriod: QuotaResetPeriod; readonly resetAt?: Iso8601; }); export type PaymentStatus = 'pending' | 'approved' | 'succeeded' | 'failed' | 'refunded'; export interface PaymentInput { readonly accountId: string; readonly idempotencyKey: string; readonly amount: Money; readonly description: string; readonly provider: string; readonly grantsSpec: unknown; readonly metadata?: Readonly>; } export interface Payment { readonly id: string; readonly accountId: string; readonly idempotencyKey: string; readonly amount: Money; readonly description: string; readonly status: PaymentStatus; readonly provider: string; readonly providerIntentId?: string; readonly providerRef?: string; readonly grantsSpec: unknown; readonly approvedAt?: Iso8601; readonly completedAt?: Iso8601; readonly createdAt: Iso8601; readonly metadata: Readonly>; } export type ReceiptStatus = 'succeeded' | 'failed' | 'refunded'; export interface ReceiptSignedPayload { readonly id: string; readonly paymentId: string; readonly accountId: string; readonly status: ReceiptStatus; readonly amountCents: bigint; readonly currency: Currency; readonly providerRef: string | null; readonly entitlementsGranted: readonly string[]; readonly signedAt: Iso8601; } export interface Receipt { readonly id: string; readonly paymentId: string; readonly accountId: string; readonly status: ReceiptStatus; readonly amount: Money; readonly providerRef: string | null; readonly entitlementsGranted: readonly string[]; readonly signature: string; readonly signatureVersion: number; readonly signingKeyId: string; readonly signedAt: Iso8601; readonly metadata: Readonly>; } export type ConsumptionAmount = { readonly kind: 'balance'; readonly amount: Money; } | { readonly kind: 'quota'; readonly count: number; } | { readonly kind: 'subscription'; } | { readonly kind: 'one_time'; }; export interface Consumption { readonly id: string; readonly entitlementId: string; readonly accountId: string; readonly toolCallIdempotencyKey: string; readonly toolName: string; readonly service: string; readonly amountConsumed: ConsumptionAmount; readonly occurredAt: Iso8601; } export {}; //# sourceMappingURL=domain.d.ts.map