import { P as PaymentIntent, D as Decision, A as AgentStats } from './types-BlBVH5_n.js'; export { StripeAdapterOptions, StripePaymentParams, fromStripe } from './adapters/stripe.js'; export { X402AdapterOptions, X402PaymentRequired, fromX402 } from './adapters/x402.js'; /** 安全底线配置(可在 YAML 中调整阈值,但不可关闭规则) */ interface SafetyConfig { /** 单笔金额绝对上限(最小货币单位)。默认 10000 = $100 */ maxTransactionHardCap: number; /** 每分钟每 Agent 最大请求数。默认 60 */ rateLimit: number; } /** 预算控制 */ interface BudgetConfig { /** 单笔上限(最小货币单位) */ perTransaction?: number; /** 日累计上限 */ daily?: number; /** 月累计上限 */ monthly?: number; } /** 白名单/黑名单控制 */ interface ListConfig { mode: 'allow' | 'deny'; list: string[]; } /** 时间控制 */ interface ScheduleConfig { timezone?: string; allowedHours?: string; allowedDays?: string[]; } /** 人工审批 */ interface HumanApprovalConfig { /** 超过此金额触发人工审批(最小货币单位) */ above: number; } /** 单个 Agent 的规则配置 */ interface AgentRuleConfig { budget?: BudgetConfig; merchants?: ListConfig; categories?: ListConfig; protocols?: Array<'stripe' | 'x402'>; schedule?: ScheduleConfig; humanApproval?: HumanApprovalConfig; } /** guard.yaml 顶层配置结构 */ interface GuardConfig { safety?: Partial; agents?: Record; default?: AgentRuleConfig; } declare class Guard { private readonly safetyConfig; private readonly config; private readonly tracker; private readonly logger; private constructor(); /** * 从 YAML 配置文件创建实例 * @param configPath guard.yaml 路径,默认当前目录下 guard.yaml */ static fromConfig(configPath?: string): Guard; /** * 使用编程方式创建实例(不依赖文件) * @param config 配置对象 * @param baseDir 存储目录(context.json / logs),默认 cwd */ static create(config?: GuardConfig, baseDir?: string): Guard; /** 获取指定 agentId 对应的规则(优先 agents[id],否则 default) */ private getRule; /** * 检查一笔支付意图是否应该放行 */ check(intent: PaymentIntent): Decision; /** * 支付失败时回退消费计数 */ rollback(intent: PaymentIntent): void; /** * 获取指定 Agent 的累计消费统计 */ getStats(agentId: string): AgentStats; } export { type AgentRuleConfig, AgentStats, type BudgetConfig, Decision, Guard, type GuardConfig, type HumanApprovalConfig, type ListConfig, PaymentIntent, type SafetyConfig, type ScheduleConfig };