Bounds Schema

FieldTypeRequiredDescription
profilestringYes-
spend_maxnumberYesMaximum spend per transaction in currency units
spend_daily_maxnumberYesMaximum cumulative spend per day in currency units
spend_monthly_maxnumberYesMaximum cumulative spend per month in currency units
transaction_count_daily_maxnumberYesMaximum number of purchase transactions per day

Key order: profile, spend_max, spend_daily_max, spend_monthly_max, transaction_count_daily_max

Context Schema (local only)

FieldTypeRequiredDescription
currencystringYesPermitted currency code
categorystringYesAuthorized purchase category
allowed_vendorsstringNoComma-separated list of approved vendor names

Key order: currency, category, allowed_vendors

Full Definition

{
  "id": "github.com/humanagencyprotocol/hap-profiles/purchase@0.4",
  "name": "Purchase",
  "version": "0.4",
  "description": "Purchase authority — governs spending company money: subscriptions, supplies, services, advertising",
  "boundsSchema": {
    "keyOrder": [
      "profile",
      "spend_max",
      "spend_daily_max",
      "spend_monthly_max",
      "transaction_count_daily_max"
    ],
    "fields": {
      "profile": {
        "type": "string",
        "required": true
      },
      "spend_max": {
        "type": "number",
        "required": true,
        "displayName": "Max per transaction",
        "description": "Maximum spend per transaction in currency units",
        "unit": "currency:EUR",
        "boundType": {
          "kind": "per_transaction",
          "of": "spend"
        }
      },
      "spend_daily_max": {
        "type": "number",
        "required": true,
        "displayName": "Daily spend limit",
        "description": "Maximum cumulative spend per day in currency units",
        "unit": "currency:EUR",
        "boundType": {
          "kind": "cumulative_sum",
          "of": "spend",
          "window": "daily"
        }
      },
      "spend_monthly_max": {
        "type": "number",
        "required": true,
        "displayName": "Monthly spend limit",
        "description": "Maximum cumulative spend per month in currency units",
        "unit": "currency:EUR",
        "boundType": {
          "kind": "cumulative_sum",
          "of": "spend",
          "window": "monthly"
        }
      },
      "transaction_count_daily_max": {
        "type": "number",
        "required": true,
        "displayName": "Daily transaction limit",
        "description": "Maximum number of purchase transactions per day",
        "unit": "count",
        "boundType": {
          "kind": "cumulative_count",
          "window": "daily"
        }
      }
    }
  },
  "contextSchema": {
    "keyOrder": [
      "currency",
      "category",
      "allowed_vendors"
    ],
    "fields": {
      "currency": {
        "type": "string",
        "required": true,
        "displayName": "Currency",
        "description": "Permitted currency code",
        "constraint": {
          "type": "string",
          "enforceable": [
            "enum"
          ]
        },
        "enum": [
          "USD",
          "EUR",
          "GBP",
          "CHF",
          "JPY",
          "CAD",
          "AUD"
        ]
      },
      "category": {
        "type": "string",
        "required": true,
        "displayName": "Purchase category",
        "description": "Authorized purchase category",
        "constraint": {
          "type": "string",
          "enforceable": [
            "enum"
          ]
        },
        "enum": [
          "subscription",
          "supply",
          "service",
          "advertising"
        ]
      },
      "allowed_vendors": {
        "type": "string",
        "required": false,
        "displayName": "Allowed vendors",
        "description": "Comma-separated list of approved vendor names",
        "constraint": {
          "type": "string",
          "enforceable": [
            "subset"
          ]
        }
      }
    }
  },
  "executionContextSchema": {
    "fields": {
      "spend": {
        "source": "declared",
        "description": "Purchase amount in currency units",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        }
      },
      "currency": {
        "source": "declared",
        "description": "Currency code",
        "required": true,
        "constraint": {
          "type": "string",
          "enforceable": [
            "enum"
          ]
        }
      },
      "category": {
        "source": "declared",
        "description": "Purchase category",
        "required": true,
        "constraint": {
          "type": "string",
          "enforceable": [
            "enum"
          ]
        }
      },
      "allowed_vendors": {
        "source": "declared",
        "description": "Vendor name for this purchase (checked against approved list)",
        "required": false,
        "constraint": {
          "type": "string",
          "enforceable": [
            "subset"
          ]
        }
      },
      "spend_daily": {
        "source": "cumulative",
        "cumulativeField": "spend",
        "window": "daily",
        "description": "Running daily spend total (resolved from execution log)",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        }
      },
      "spend_monthly": {
        "source": "cumulative",
        "cumulativeField": "spend",
        "window": "monthly",
        "description": "Running monthly spend total (resolved from execution log)",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        }
      },
      "transaction_count_daily": {
        "source": "cumulative",
        "cumulativeField": "_count",
        "window": "daily",
        "description": "Running daily transaction count (resolved from execution log)",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        }
      }
    }
  },
  "requiredGates": [
    "bounds",
    "intent",
    "commitment",
    "decision_owner"
  ],
  "ttl": {
    "default": 86400,
    "max": 2592000
  },
  "retention_minimum": 7776000
}