@highflame/policy 2.2.7 → 2.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -265,6 +265,12 @@ namespace AgentOps {
265
265
  "budget_exceeded_daily"?: Boolean,
266
266
  "budget_exceeded_monthly"?: Boolean,
267
267
 
268
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
269
+ "rpm_remaining_pct"?: Long,
270
+ "rpm_exceeded"?: Boolean,
271
+ "tpm_remaining_pct"?: Long,
272
+ "tpm_exceeded"?: Boolean,
273
+
268
274
  // Agent Identity — authenticated agent principal metadata (optional)
269
275
  "agent_id"?: String,
270
276
  "agent_type"?: String, // "orchestrator" | "autonomous" | "tool_agent" | "human_proxy"
@@ -423,6 +429,12 @@ namespace AgentOps {
423
429
  "budget_exceeded_daily"?: Boolean,
424
430
  "budget_exceeded_monthly"?: Boolean,
425
431
 
432
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
433
+ "rpm_remaining_pct"?: Long,
434
+ "rpm_exceeded"?: Boolean,
435
+ "tpm_remaining_pct"?: Long,
436
+ "tpm_exceeded"?: Boolean,
437
+
426
438
  // Aggregated threat summary (optional)
427
439
  "highest_severity"?: String,
428
440
  "threat_count"?: Long,
@@ -509,6 +521,12 @@ namespace AgentOps {
509
521
  "budget_exceeded_daily"?: Boolean,
510
522
  "budget_exceeded_monthly"?: Boolean,
511
523
 
524
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
525
+ "rpm_remaining_pct"?: Long,
526
+ "rpm_exceeded"?: Boolean,
527
+ "tpm_remaining_pct"?: Long,
528
+ "tpm_exceeded"?: Boolean,
529
+
512
530
  // Agent Identity (optional)
513
531
  "agent_id"?: String,
514
532
  "agent_type"?: String,
@@ -591,6 +609,12 @@ namespace AgentOps {
591
609
  "budget_exceeded_daily"?: Boolean,
592
610
  "budget_exceeded_monthly"?: Boolean,
593
611
 
612
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
613
+ "rpm_remaining_pct"?: Long,
614
+ "rpm_exceeded"?: Boolean,
615
+ "tpm_remaining_pct"?: Long,
616
+ "tpm_exceeded"?: Boolean,
617
+
594
618
  // Agent Identity (optional)
595
619
  "agent_id"?: String,
596
620
  "agent_type"?: String,
@@ -673,6 +697,12 @@ namespace AgentOps {
673
697
  "budget_exceeded_daily"?: Boolean,
674
698
  "budget_exceeded_monthly"?: Boolean,
675
699
 
700
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
701
+ "rpm_remaining_pct"?: Long,
702
+ "rpm_exceeded"?: Boolean,
703
+ "tpm_remaining_pct"?: Long,
704
+ "tpm_exceeded"?: Boolean,
705
+
676
706
  // Agent Identity (optional)
677
707
  "agent_id"?: String,
678
708
  "agent_type"?: String,
@@ -863,6 +893,12 @@ action call_tool appliesTo {
863
893
  budget_exceeded_session?: Bool,
864
894
  budget_exceeded_daily?: Bool,
865
895
  budget_exceeded_monthly?: Bool,
896
+
897
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
898
+ rpm_remaining_pct?: Long,
899
+ rpm_exceeded?: Bool,
900
+ tpm_remaining_pct?: Long,
901
+ tpm_exceeded?: Bool,
866
902
  },
867
903
  };
868
904
 
@@ -935,6 +971,12 @@ action connect_server appliesTo {
935
971
  budget_exceeded_session?: Bool,
936
972
  budget_exceeded_daily?: Bool,
937
973
  budget_exceeded_monthly?: Bool,
974
+
975
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
976
+ rpm_remaining_pct?: Long,
977
+ rpm_exceeded?: Bool,
978
+ tpm_remaining_pct?: Long,
979
+ tpm_exceeded?: Bool,
938
980
  },
939
981
  };
940
982
 
@@ -1016,6 +1058,12 @@ action process_prompt appliesTo {
1016
1058
  budget_exceeded_session?: Bool,
1017
1059
  budget_exceeded_daily?: Bool,
1018
1060
  budget_exceeded_monthly?: Bool,
1061
+
1062
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
1063
+ rpm_remaining_pct?: Long,
1064
+ rpm_exceeded?: Bool,
1065
+ tpm_remaining_pct?: Long,
1066
+ tpm_exceeded?: Bool,
1019
1067
  },
1020
1068
  };
1021
1069
 
@@ -1077,6 +1125,12 @@ action read_file appliesTo {
1077
1125
  budget_exceeded_session?: Bool,
1078
1126
  budget_exceeded_daily?: Bool,
1079
1127
  budget_exceeded_monthly?: Bool,
1128
+
1129
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
1130
+ rpm_remaining_pct?: Long,
1131
+ rpm_exceeded?: Bool,
1132
+ tpm_remaining_pct?: Long,
1133
+ tpm_exceeded?: Bool,
1080
1134
  },
1081
1135
  };
1082
1136
 
@@ -1138,6 +1192,12 @@ action write_file appliesTo {
1138
1192
  budget_exceeded_session?: Bool,
1139
1193
  budget_exceeded_daily?: Bool,
1140
1194
  budget_exceeded_monthly?: Bool,
1195
+
1196
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
1197
+ rpm_remaining_pct?: Long,
1198
+ rpm_exceeded?: Bool,
1199
+ tpm_remaining_pct?: Long,
1200
+ tpm_exceeded?: Bool,
1141
1201
  },
1142
1202
  };
1143
1203
 
@@ -1379,6 +1439,12 @@ namespace Guardrails {
1379
1439
  "budget_exceeded_daily"?: Bool, // Any daily-scoped budget exceeded
1380
1440
  "budget_exceeded_monthly"?: Bool, // Any monthly-scoped budget exceeded
1381
1441
 
1442
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
1443
+ "rpm_remaining_pct"?: Long,
1444
+ "rpm_exceeded"?: Bool,
1445
+ "tpm_remaining_pct"?: Long,
1446
+ "tpm_exceeded"?: Bool,
1447
+
1382
1448
  // Agent Identity — authenticated agent principal metadata (optional)
1383
1449
  // Present when the request is made by an AI agent (API key or JWT with agent claims).
1384
1450
  // Empty strings for human user requests. Use these to write agent-specific policies.
@@ -1465,6 +1531,12 @@ namespace Guardrails {
1465
1531
  "budget_exceeded_daily"?: Bool,
1466
1532
  "budget_exceeded_monthly"?: Bool,
1467
1533
 
1534
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
1535
+ "rpm_remaining_pct"?: Long,
1536
+ "rpm_exceeded"?: Bool,
1537
+ "tpm_remaining_pct"?: Long,
1538
+ "tpm_exceeded"?: Bool,
1539
+
1468
1540
  // Semantic - Topic Classification (optional)
1469
1541
  "content_topics"?: Set<String>, // ["controlled_substances", "weapons_manufacturing", ...]
1470
1542
  "topic_confidence"?: Long, // 0-100
@@ -1618,6 +1690,12 @@ namespace Guardrails {
1618
1690
  "budget_exceeded_daily"?: Bool,
1619
1691
  "budget_exceeded_monthly"?: Bool,
1620
1692
 
1693
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
1694
+ "rpm_remaining_pct"?: Long,
1695
+ "rpm_exceeded"?: Bool,
1696
+ "tpm_remaining_pct"?: Long,
1697
+ "tpm_exceeded"?: Bool,
1698
+
1621
1699
  // Agent Identity — authenticated agent principal metadata (optional)
1622
1700
  "agent_id"?: String,
1623
1701
  "agent_type"?: String,
@@ -1689,6 +1767,12 @@ namespace Guardrails {
1689
1767
  "budget_exceeded_daily"?: Bool,
1690
1768
  "budget_exceeded_monthly"?: Bool,
1691
1769
 
1770
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
1771
+ "rpm_remaining_pct"?: Long,
1772
+ "rpm_exceeded"?: Bool,
1773
+ "tpm_remaining_pct"?: Long,
1774
+ "tpm_exceeded"?: Bool,
1775
+
1692
1776
  // Agent Identity — authenticated agent principal metadata (optional)
1693
1777
  "agent_id"?: String,
1694
1778
  "agent_type"?: String,
@@ -1760,6 +1844,12 @@ namespace Guardrails {
1760
1844
  "budget_exceeded_daily"?: Bool,
1761
1845
  "budget_exceeded_monthly"?: Bool,
1762
1846
 
1847
+ // Rate Limiting — gateway-metered, Shield-decided (ADR 0014)
1848
+ "rpm_remaining_pct"?: Long,
1849
+ "rpm_exceeded"?: Bool,
1850
+ "tpm_remaining_pct"?: Long,
1851
+ "tpm_exceeded"?: Bool,
1852
+
1763
1853
  // Agent Identity — authenticated agent principal metadata (optional)
1764
1854
  "agent_id"?: String,
1765
1855
  "agent_type"?: String,
@@ -2880,6 +2970,10 @@ export const AGENT_OPS_CONTEXT = {
2880
2970
  { "key": "multi_turn_detection", "type": "boolean", "required": false, "description": "Whether multi-turn injection patterns were detected" },
2881
2971
  { "key": "budget_remaining_pct", "type": "number", "required": false, "description": "Remaining token budget as percentage (0-100)." },
2882
2972
  { "key": "budget_exceeded", "type": "boolean", "required": false, "description": "Whether the token budget has been exceeded" },
2973
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)." },
2974
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded" },
2975
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)." },
2976
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded" },
2883
2977
  { "key": "session_pii_detected", "type": "boolean", "required": false, "description": "Whether PII was detected in any previous turn of the session" },
2884
2978
  { "key": "session_pii_types", "type": "array", "required": false, "description": "PII types detected across the session (accumulated)" },
2885
2979
  { "key": "session_secrets_detected", "type": "boolean", "required": false, "description": "Whether secrets were detected in any previous turn of the session" },
@@ -2980,6 +3074,10 @@ export const AGENT_OPS_CONTEXT = {
2980
3074
  { "key": "multi_turn_detection", "type": "boolean", "required": false, "description": "Whether multi-turn injection patterns were detected across tool calls" },
2981
3075
  { "key": "budget_remaining_pct", "type": "number", "required": false, "description": "Remaining token budget as percentage (0-100)." },
2982
3076
  { "key": "budget_exceeded", "type": "boolean", "required": false, "description": "Whether the token budget has been exceeded" },
3077
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)." },
3078
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded" },
3079
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)." },
3080
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded" },
2983
3081
  { "key": "highest_severity", "type": "string", "required": false, "description": "Highest severity level across all detection engines" },
2984
3082
  { "key": "threat_count", "type": "number", "required": false, "description": "Total number of threats detected" },
2985
3083
  { "key": "detected_threats", "type": "array", "required": false, "description": "Array of specific threat names detected" },
@@ -3034,6 +3132,10 @@ export const AGENT_OPS_CONTEXT = {
3034
3132
  { "key": "detected_threats", "type": "array", "required": false, "description": "Array of specific threat names detected" },
3035
3133
  { "key": "budget_remaining_pct", "type": "number", "required": false, "description": "Remaining token budget as percentage (0-100)." },
3036
3134
  { "key": "budget_exceeded", "type": "boolean", "required": false, "description": "Whether the token budget has been exceeded" },
3135
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)." },
3136
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded" },
3137
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)." },
3138
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded" },
3037
3139
  { "key": "session_pii_detected", "type": "boolean", "required": false, "description": "Whether PII was detected in any previous turn of the session" },
3038
3140
  { "key": "session_pii_types", "type": "array", "required": false, "description": "PII types detected across the session (accumulated)" },
3039
3141
  { "key": "session_secrets_detected", "type": "boolean", "required": false, "description": "Whether secrets were detected in any previous turn of the session" },
@@ -3087,6 +3189,10 @@ export const AGENT_OPS_CONTEXT = {
3087
3189
  { "key": "detected_threats", "type": "array", "required": false, "description": "Array of specific threat names detected" },
3088
3190
  { "key": "budget_remaining_pct", "type": "number", "required": false, "description": "Remaining token budget as percentage (0-100)." },
3089
3191
  { "key": "budget_exceeded", "type": "boolean", "required": false, "description": "Whether the token budget has been exceeded" },
3192
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)." },
3193
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded" },
3194
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)." },
3195
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded" },
3090
3196
  { "key": "session_pii_detected", "type": "boolean", "required": false, "description": "Whether PII was detected in any previous turn of the session" },
3091
3197
  { "key": "session_pii_types", "type": "array", "required": false, "description": "PII types detected across the session (accumulated)" },
3092
3198
  { "key": "session_secrets_detected", "type": "boolean", "required": false, "description": "Whether secrets were detected in any previous turn of the session" },
@@ -3140,6 +3246,10 @@ export const AGENT_OPS_CONTEXT = {
3140
3246
  { "key": "detected_threats", "type": "array", "required": false, "description": "Array of specific threat names detected" },
3141
3247
  { "key": "budget_remaining_pct", "type": "number", "required": false, "description": "Remaining token budget as percentage (0-100)." },
3142
3248
  { "key": "budget_exceeded", "type": "boolean", "required": false, "description": "Whether the token budget has been exceeded" },
3249
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)." },
3250
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded" },
3251
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)." },
3252
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded" },
3143
3253
  { "key": "session_pii_detected", "type": "boolean", "required": false, "description": "Whether PII was detected in any previous turn of the session" },
3144
3254
  { "key": "session_pii_types", "type": "array", "required": false, "description": "PII types detected across the session (accumulated)" },
3145
3255
  { "key": "session_secrets_detected", "type": "boolean", "required": false, "description": "Whether secrets were detected in any previous turn of the session" },
@@ -3232,7 +3342,11 @@ export const AI_GATEWAY_CONTEXT = {
3232
3342
  { "key": "session_max_jailbreak_score", "type": "number", "required": false, "description": "Max jailbreak score across session turns" },
3233
3343
  { "key": "session_max_command_injection_score", "type": "number", "required": false, "description": "Max command-injection score across session turns" },
3234
3344
  { "key": "session_max_pii_score", "type": "number", "required": false, "description": "Max pii score across session turns" },
3235
- { "key": "session_max_secret_score", "type": "number", "required": false, "description": "Max secret score across session turns" }
3345
+ { "key": "session_max_secret_score", "type": "number", "required": false, "description": "Max secret score across session turns" },
3346
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3347
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded. Use this to enforce rate limits via Cedar policy" },
3348
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3349
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy" }
3236
3350
  ]
3237
3351
  },
3238
3352
  {
@@ -3274,7 +3388,11 @@ export const AI_GATEWAY_CONTEXT = {
3274
3388
  { "key": "session_max_jailbreak_score", "type": "number", "required": false, "description": "Max jailbreak score across session turns" },
3275
3389
  { "key": "session_max_command_injection_score", "type": "number", "required": false, "description": "Max command-injection score across session turns" },
3276
3390
  { "key": "session_max_pii_score", "type": "number", "required": false, "description": "Max pii score across session turns" },
3277
- { "key": "session_max_secret_score", "type": "number", "required": false, "description": "Max secret score across session turns" }
3391
+ { "key": "session_max_secret_score", "type": "number", "required": false, "description": "Max secret score across session turns" },
3392
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3393
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded. Use this to enforce rate limits via Cedar policy" },
3394
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3395
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy" }
3278
3396
  ]
3279
3397
  },
3280
3398
  {
@@ -3321,7 +3439,11 @@ export const AI_GATEWAY_CONTEXT = {
3321
3439
  { "key": "session_max_jailbreak_score", "type": "number", "required": false, "description": "Max jailbreak score across session turns" },
3322
3440
  { "key": "session_max_command_injection_score", "type": "number", "required": false, "description": "Max command-injection score across session turns" },
3323
3441
  { "key": "session_max_pii_score", "type": "number", "required": false, "description": "Max pii score across session turns" },
3324
- { "key": "session_max_secret_score", "type": "number", "required": false, "description": "Max secret score across session turns" }
3442
+ { "key": "session_max_secret_score", "type": "number", "required": false, "description": "Max secret score across session turns" },
3443
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3444
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded. Use this to enforce rate limits via Cedar policy" },
3445
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3446
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy" }
3325
3447
  ]
3326
3448
  },
3327
3449
  {
@@ -3356,7 +3478,11 @@ export const AI_GATEWAY_CONTEXT = {
3356
3478
  { "key": "session_max_jailbreak_score", "type": "number", "required": false, "description": "Max jailbreak score across session turns" },
3357
3479
  { "key": "session_max_command_injection_score", "type": "number", "required": false, "description": "Max command-injection score across session turns" },
3358
3480
  { "key": "session_max_pii_score", "type": "number", "required": false, "description": "Max pii score across session turns" },
3359
- { "key": "session_max_secret_score", "type": "number", "required": false, "description": "Max secret score across session turns" }
3481
+ { "key": "session_max_secret_score", "type": "number", "required": false, "description": "Max secret score across session turns" },
3482
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3483
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded. Use this to enforce rate limits via Cedar policy" },
3484
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3485
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy" }
3360
3486
  ]
3361
3487
  },
3362
3488
  {
@@ -3391,7 +3517,11 @@ export const AI_GATEWAY_CONTEXT = {
3391
3517
  { "key": "session_max_jailbreak_score", "type": "number", "required": false, "description": "Max jailbreak score across session turns" },
3392
3518
  { "key": "session_max_command_injection_score", "type": "number", "required": false, "description": "Max command-injection score across session turns" },
3393
3519
  { "key": "session_max_pii_score", "type": "number", "required": false, "description": "Max pii score across session turns" },
3394
- { "key": "session_max_secret_score", "type": "number", "required": false, "description": "Max secret score across session turns" }
3520
+ { "key": "session_max_secret_score", "type": "number", "required": false, "description": "Max secret score across session turns" },
3521
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3522
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded. Use this to enforce rate limits via Cedar policy" },
3523
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3524
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy" }
3395
3525
  ]
3396
3526
  }
3397
3527
  ]
@@ -3479,6 +3609,10 @@ export const GUARDRAILS_CONTEXT = {
3479
3609
  { "key": "content_safety_blocked", "type": "boolean", "required": false, "description": "Whether content was flagged for blocking by the content safety system" },
3480
3610
  { "key": "conversation_turn", "type": "number", "required": false, "description": "Current conversation turn number. Use for policies that escalate strictness over long conversations" },
3481
3611
  { "key": "multi_turn_detection", "type": "boolean", "required": false, "description": "Whether multi-turn injection patterns were detected (attack spread across multiple conversation turns)" },
3612
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3613
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded. Use this to enforce rate limits via Cedar policy" },
3614
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3615
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy" },
3482
3616
  { "key": "session_pii_detected", "type": "boolean", "required": false, "description": "Whether PII was detected in any previous turn of the session" },
3483
3617
  { "key": "session_pii_types", "type": "array", "required": false, "description": "PII types detected across the session (accumulated)" },
3484
3618
  { "key": "session_secrets_detected", "type": "boolean", "required": false, "description": "Whether secrets were detected in any previous turn of the session" },
@@ -3529,6 +3663,10 @@ export const GUARDRAILS_CONTEXT = {
3529
3663
  { "key": "loop_tool", "type": "string", "required": false, "description": "Name of the tool involved in the loop" },
3530
3664
  { "key": "budget_remaining_pct", "type": "number", "required": false, "description": "Remaining token budget as percentage (0-100). Use this to warn or block when budget is low. Requires session with token budget configuration" },
3531
3665
  { "key": "budget_exceeded", "type": "boolean", "required": false, "description": "Whether the token budget has been exceeded. Use this to enforce cost controls on agentic sessions" },
3666
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3667
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded. Use this to enforce rate limits via Cedar policy" },
3668
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3669
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy" },
3532
3670
  { "key": "content_topics", "type": "array", "required": false, "description": "Semantic topics detected in tool arguments or content (e.g., [\'controlled_substances\']). Use .contains() to restrict tool calls involving specific topics" },
3533
3671
  { "key": "topic_confidence", "type": "number", "required": false, "description": "Confidence score from topic classifier for tool content (0-100)" },
3534
3672
  { "key": "secrets_detected", "type": "boolean", "required": false, "description": "Whether secrets were detected in tool arguments or content" },
@@ -3574,6 +3712,10 @@ export const GUARDRAILS_CONTEXT = {
3574
3712
  { "key": "rug_pull_type", "type": "string", "required": false, "description": "Type of rug pull detected: \'risk_spike\' (sudden risk increase), \'pattern_change\' (behavioral shift), \'combined\', or \'none\'" },
3575
3713
  { "key": "conversation_turn", "type": "number", "required": false, "description": "Current conversation turn number for the agentic session" },
3576
3714
  { "key": "multi_turn_detection", "type": "boolean", "required": false, "description": "Whether multi-turn injection patterns were detected across tool calls in the session" },
3715
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3716
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded. Use this to enforce rate limits via Cedar policy" },
3717
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3718
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy" },
3577
3719
  { "key": "session_pii_detected", "type": "boolean", "required": false, "description": "Whether PII was detected in any previous turn of the session" },
3578
3720
  { "key": "session_pii_types", "type": "array", "required": false, "description": "PII types detected across the session (accumulated)" },
3579
3721
  { "key": "session_secrets_detected", "type": "boolean", "required": false, "description": "Whether secrets were detected in any previous turn of the session" },
@@ -3615,6 +3757,10 @@ export const GUARDRAILS_CONTEXT = {
3615
3757
  { "key": "path_traversal_detected", "type": "boolean", "required": false, "description": "Whether path traversal patterns were detected in the file path being read" },
3616
3758
  { "key": "path_traversal_severity", "type": "string", "required": false, "description": "Severity of path traversal in the file read path" },
3617
3759
  { "key": "path_traversal_type", "type": "string", "required": false, "description": "Type of path traversal detected in the file read path" },
3760
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3761
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded. Use this to enforce rate limits via Cedar policy" },
3762
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3763
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy" },
3618
3764
  { "key": "session_pii_detected", "type": "boolean", "required": false, "description": "Whether PII was detected in any previous turn of the session" },
3619
3765
  { "key": "session_pii_types", "type": "array", "required": false, "description": "PII types detected across the session (accumulated)" },
3620
3766
  { "key": "session_secrets_detected", "type": "boolean", "required": false, "description": "Whether secrets were detected in any previous turn of the session" },
@@ -3658,6 +3804,10 @@ export const GUARDRAILS_CONTEXT = {
3658
3804
  { "key": "path_traversal_detected", "type": "boolean", "required": false, "description": "Whether path traversal patterns were detected in the file path being written" },
3659
3805
  { "key": "path_traversal_severity", "type": "string", "required": false, "description": "Severity of path traversal in the file write path" },
3660
3806
  { "key": "path_traversal_type", "type": "string", "required": false, "description": "Type of path traversal detected in the file write path" },
3807
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3808
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded. Use this to enforce rate limits via Cedar policy" },
3809
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3810
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy" },
3661
3811
  { "key": "session_pii_detected", "type": "boolean", "required": false, "description": "Whether PII was detected in any previous turn of the session" },
3662
3812
  { "key": "session_pii_types", "type": "array", "required": false, "description": "PII types detected across the session (accumulated)" },
3663
3813
  { "key": "session_secrets_detected", "type": "boolean", "required": false, "description": "Whether secrets were detected in any previous turn of the session" },
@@ -3701,6 +3851,10 @@ export const GUARDRAILS_CONTEXT = {
3701
3851
  { "key": "cross_origin_detected", "type": "boolean", "required": false, "description": "Whether cross-origin escalation patterns were detected in the MCP server connection" },
3702
3852
  { "key": "cross_origin_type", "type": "string", "required": false, "description": "Type of cross-origin escalation detected in server connection" },
3703
3853
  { "key": "cross_origin_score", "type": "number", "required": false, "description": "Risk score for cross-origin escalation in server connection (0-100)" },
3854
+ { "key": "rpm_remaining_pct", "type": "number", "required": false, "description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3855
+ { "key": "rpm_exceeded", "type": "boolean", "required": false, "description": "Whether the RPM limit has been exceeded. Use this to enforce rate limits via Cedar policy" },
3856
+ { "key": "tpm_remaining_pct", "type": "number", "required": false, "description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)" },
3857
+ { "key": "tpm_exceeded", "type": "boolean", "required": false, "description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy" },
3704
3858
  { "key": "session_pii_detected", "type": "boolean", "required": false, "description": "Whether PII was detected in any previous turn of the session" },
3705
3859
  { "key": "session_pii_types", "type": "array", "required": false, "description": "PII types detected across the session (accumulated)" },
3706
3860
  { "key": "session_secrets_detected", "type": "boolean", "required": false, "description": "Whether secrets were detected in any previous turn of the session" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highflame/policy",
3
- "version": "2.2.7",
3
+ "version": "2.2.9",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },