Skip to content

Releases: Amara-ops/policy-runtime-ts

Fixed human caps bug

06 Nov 12:11

Choose a tag to compare

v0.3.6

schema: require per-symbol maps for caps; tests: use USDC/ETH and gua…

v0.3.5 - token symbol registry

05 Nov 15:04

Choose a tag to compare

Highlights

  • Symbol-based denominations (USDC, ETH). Decimals resolved via token registry (meta.tokens_registry_path or env TOKENS_CONFIG_PATH; fallback to config/tokens.json).
  • Backward compatible with legacy meta.denominations and BASE_USDC; defaultDenomination still honored.
  • Per-target headroom returns the more specific to|selector key when both to and to|selector caps exist.
  • Policy normalization: if legacy decimals exist, human caps are converted at load; otherwise they’re resolved at evaluation using the registry.
  • Examples updated to symbols + tokens_registry_path.

Migration (no breaking changes)

  • Add meta.tokens_registry_path to policy.json.
  • Switch cap maps and intents to symbol keys (e.g., USDC) and set defaultDenomination to a symbol.
  • Keep legacy meta.denominations during transition if needed.

v0.3.4 - support for human-amount caps, improved runtime process management

24 Oct 17:59

Choose a tag to compare

Human-amount caps with per‑denomination normalization at load time; top‑level strings remain base units for backward compat.
Added max_calls_per_function_h1 (alias for max_per_function_h1) and new max_calls_per_function_d1 for daily call caps.
Per‑target caps accept both to and to|selector keys; selector takes precedence.
Policy hash computation updated to ignore undefined keys (aligns with JSON stringify) to avoid spurious hash diffs.
Runtime process management: restart now replaces stale instance; clean handoff on start/stop; logs reopen on SIGHUP and /reopen_logs.
Examples and README updated to v0.3.4 conventions; samples now use human amounts by default.

v0.3.0

13 Oct 19:06

Choose a tag to compare

Policy Runtime TS v0.3.0

Highlights

  • Per‑denomination caps and defaultDenomination (BASE_USDC by default)
  • Per‑target caps (to or to|selector) with decision target_headroom
  • Intent filters: deadline_ms, nonce_max_gap (with intent.nonce/prev_nonce), slippage_max_bps (with intent.slippage_bps)
  • Operational controls: POST /reload for hot policy swap, SIGHUP to reopen logs, GET /metrics for basic Prometheus counters
  • CLI: policy-status shows global usage and per-target headroom

Changes

  • Multi‑denomination scaffolding via meta.denominations and meta.defaultDenomination; backward‑compatible defaults preserved
  • Optional per‑target caps via caps.per_target.{h1,d1}; headroom included in Decision.target_headroom
  • /execute endpoint (from v0.2) retained; Decision.headroom exposes global remaining h1/d1 and per‑function headroom (if configured)
  • HTTP: POST /reload validates and swaps policy atomically with new hash; server handles SIGHUP to reopen JSONL logs for logrotate
  • GET /metrics exposes minimal counters (policy_runtime_decisions_total, by action)
  • Filters: deadline_ms; nonce gap guard via meta.nonce_max_gap + intent.nonce/prev_nonce; slippage guard via meta.slippage_max_bps + intent.slippage_bps
  • CLI status reports per‑target remaining headroom for any configured per_target caps

Upgrade notes

  • No breaking changes expected for v0.2 users. Existing policies work unchanged.
  • To use new features:
    • Add meta.defaultDenomination and optionally meta.denominations
    • Add caps.per_target.{h1,d1} entries keyed by to or to|selector
    • Optionally set meta.nonce_max_gap and/or meta.slippage_max_bps; callers may pass intent.nonce/prev_nonce and intent.slippage_bps

References

  • Base USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
  • Sample policy: examples/policy.v0_3.sample.json

Compare