npm.io
0.5.3 • Published 3d ago

@stellar-agent/policy

Licence
MIT
Version
0.5.3
Deps
3
Size
75 kB
Vulns
0
Weekly
0

@stellar-agent/policy

Deterministic policy parsing and decision logic for Stellar Agent workflows.

This package evaluates payment requests, Blend DeFi requests, Aquarius AMM preflight requests, and core Stellar liquidity-pool requests against explicit policy controls.

Install

npm install @stellar-agent/policy

Example

import { defaultPolicyForNetwork, evaluatePaymentRequest } from "@stellar-agent/policy";

const policy = defaultPolicyForNetwork("testnet");
const decision = evaluatePaymentRequest(policy, {
  network: "testnet",
  destination: "G...",
  amount: "1",
  asset: "XLM",
  spendHistory: { dailyTotal: "0", monthlyTotal: "0", knownRecipients: [], knownDomains: [] }
});

defaultPolicyForNetwork("local") returns a local-network policy derived from the Testnet-safe limits so local payment evaluation does not reuse a Testnet-labeled policy.

Policy Areas

  • Payment limits, allowed assets, recipients, and domains.
  • Blend pool, request-type, borrow, exposure, health-factor, and simulation rules.
  • Aquarius pool, asset, action, exposure, and slippage-bound rules.
  • Core liquidity-pool asset, action, exposure, and price-bound rules.

Safety

Policy evaluation is prompt-independent and should run before signing or submission. Mainnet decisions are approval-gated by default.