qati-sdk 1.0.2 → 1.0.3

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.
package/dist/index.cjs CHANGED
@@ -903,20 +903,26 @@ var HTTP_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
903
903
 
904
904
  // src/v1/schemas/api-call.ts
905
905
  var ApiCallSignalPayloadSchema = zod.z.object({
906
- service_id: nonEmptyString(),
907
- endpoint: nonEmptyString(),
908
- method: zod.z.enum(HTTP_METHODS),
909
- status_code: zod.z.number().int().min(100).max(599),
910
- authorized: zod.z.boolean().nullable(),
911
- authentication_present: zod.z.boolean().nullable().optional(),
912
- rate_limited: zod.z.boolean().nullable().optional(),
913
- external_side_effect: zod.z.boolean().nullable().optional(),
914
- records_returned: zod.z.number().int().nonnegative().nullable().optional(),
915
- records_modified: zod.z.number().int().nonnegative().nullable().optional(),
916
- contains_sensitive_data: zod.z.boolean().nullable().optional(),
917
- latency_ms: zod.z.number().nonnegative().nullable().optional(),
918
- retry_count: zod.z.number().int().nonnegative().nullable().optional(),
919
- api_key_id: zod.z.string().nullable().optional()
906
+ service_id: nonEmptyString().describe("Target service identifier."),
907
+ endpoint: nonEmptyString().describe("API route path."),
908
+ method: zod.z.enum(HTTP_METHODS).describe("HTTP method: GET, POST, PUT, PATCH, or DELETE."),
909
+ status_code: zod.z.number().int().min(100).max(599).describe("HTTP response status code."),
910
+ authorized: zod.z.boolean().nullable().describe(
911
+ "Whether the call was authorized; null means authorization is unknown."
912
+ ),
913
+ authentication_present: zod.z.boolean().nullable().optional().describe(
914
+ "Whether authentication credentials were present when known."
915
+ ),
916
+ rate_limited: zod.z.boolean().nullable().optional().describe("Whether the call was rate limited when known."),
917
+ external_side_effect: zod.z.boolean().nullable().optional().describe(
918
+ "Whether the call modifies state outside the caller context when known."
919
+ ),
920
+ records_returned: zod.z.number().int().nonnegative().nullable().optional().describe("Number of records returned when available."),
921
+ records_modified: zod.z.number().int().nonnegative().nullable().optional().describe("Number of records modified when available."),
922
+ contains_sensitive_data: zod.z.boolean().nullable().optional().describe("Whether sensitive data was involved when known."),
923
+ latency_ms: zod.z.number().nonnegative().nullable().optional().describe("API latency in milliseconds when available."),
924
+ retry_count: zod.z.number().int().nonnegative().nullable().optional().describe("Number of retry attempts when available."),
925
+ api_key_id: zod.z.string().nullable().optional().describe("API key identifier used for the call when applicable.")
920
926
  });
921
927
  BaseEventSchema.extend({
922
928
  signal_payload: ApiCallSignalPayloadSchema
@@ -928,16 +934,16 @@ var createApiCallEvent = (event) => {
928
934
  return buildRawEventRequest(event, signalPayload, "API_CALL");
929
935
  };
930
936
  var AuthSignalPayloadSchema = zod.z.object({
931
- result: zod.z.string().nullable().optional(),
932
- auth_method: zod.z.string().nullable().optional(),
933
- mfa_used: zod.z.boolean().nullable().optional(),
937
+ result: zod.z.string().nullable().optional().describe("Auth result (SUCCESS, FAILURE)"),
938
+ auth_method: zod.z.string().nullable().optional().describe("Auth method (PASSWORD, MFA_TOTP, etc.)"),
939
+ mfa_used: zod.z.boolean().nullable().optional().describe("Whether MFA was used"),
934
940
  mfa_bypassed: zod.z.boolean().optional().default(false),
935
941
  failed_attempts: zod.z.number().int().nonnegative().optional().default(0),
936
942
  ip: zod.z.string().nullable().optional(),
937
- country: zod.z.string().nullable().optional(),
943
+ country: zod.z.string().nullable().optional().describe("ISO 3166-1 alpha-2 country code"),
938
944
  user_agent: zod.z.string().nullable().optional(),
939
945
  unusual_location: zod.z.boolean().optional().default(false),
940
- after_hours_login: zod.z.boolean().optional().default(false)
946
+ after_hours_login: zod.z.boolean().optional().default(false).describe("Login outside normal business hours")
941
947
  });
942
948
  BaseEventSchema.extend({
943
949
  signal_payload: AuthSignalPayloadSchema
@@ -973,24 +979,50 @@ var CONTEXT_SOURCES = [
973
979
 
974
980
  // src/v1/schemas/context-integrity.ts
975
981
  var ContextIntegritySignalPayloadSchema = zod.z.object({
976
- context_source: zod.z.enum(CONTEXT_SOURCES),
977
- instruction_conflict_detected: zod.z.boolean(),
978
- untrusted_instruction_detected: zod.z.boolean(),
979
- context_priority_violation: zod.z.boolean(),
980
- recursive_instruction_pattern: zod.z.boolean().optional().default(false),
981
- context_drift_score: fraction01Nullable(),
982
- system_prompt_conflict_score: fraction01Nullable(),
983
- developer_prompt_conflict_score: fraction01Nullable(),
984
- retrieved_instruction_count: zod.z.number().int().nonnegative().optional().default(0),
985
- hidden_instruction_score: fraction01Nullable(),
986
- source_document_id: zod.z.string().nullable().optional(),
987
- untrusted_source_count: zod.z.number().int().nonnegative().optional().default(0),
988
- source_trust_score: fraction01Nullable(),
989
- lowest_source_trust_score: fraction01Nullable(),
990
- recursive_pattern_score: fraction01Nullable(),
991
- prompt_injection_score: fraction01Nullable(),
992
- contains_instruction_override: zod.z.boolean().optional().default(false),
993
- context_injection_score: fraction01Nullable()
982
+ context_source: zod.z.enum(CONTEXT_SOURCES).describe(
983
+ "Origin of the evaluated context: CONVERSATION_HISTORY, RETRIEVED_DOCUMENT, TOOL_OUTPUT, SYSTEM, DEVELOPER, or USER."
984
+ ),
985
+ instruction_conflict_detected: zod.z.boolean().describe("Whether conflicting instructions were detected in context."),
986
+ untrusted_instruction_detected: zod.z.boolean().describe(
987
+ "Whether an untrusted source contains instruction-like text."
988
+ ),
989
+ context_priority_violation: zod.z.boolean().describe(
990
+ "Whether lower-priority context attempts to override higher-priority context."
991
+ ),
992
+ recursive_instruction_pattern: zod.z.boolean().optional().default(false).describe("Whether the context contains a loop or recursive instruction."),
993
+ context_drift_score: fraction01Nullable().describe(
994
+ "0\u20131 context drift score when available."
995
+ ),
996
+ system_prompt_conflict_score: fraction01Nullable().describe(
997
+ "0\u20131 conflict with system prompt intent when available."
998
+ ),
999
+ developer_prompt_conflict_score: fraction01Nullable().describe(
1000
+ "0\u20131 conflict with developer prompt intent when available."
1001
+ ),
1002
+ retrieved_instruction_count: zod.z.number().int().nonnegative().optional().default(0).describe("Count of instruction-like snippets in retrieved context."),
1003
+ hidden_instruction_score: fraction01Nullable().describe(
1004
+ "0\u20131 likelihood of hidden instructions when available."
1005
+ ),
1006
+ source_document_id: zod.z.string().nullable().optional().describe("Related document identifier when applicable."),
1007
+ untrusted_source_count: zod.z.number().int().nonnegative().optional().default(0).describe(
1008
+ "Count of untrusted sources; contributes to untrusted-instruction detection."
1009
+ ),
1010
+ source_trust_score: fraction01Nullable().describe(
1011
+ "0\u20131 trust score for the context source when available."
1012
+ ),
1013
+ lowest_source_trust_score: fraction01Nullable().describe(
1014
+ "0\u20131 lowest trust score among sources when available."
1015
+ ),
1016
+ recursive_pattern_score: fraction01Nullable().describe(
1017
+ "0\u20131 recursive pattern score when available."
1018
+ ),
1019
+ prompt_injection_score: fraction01Nullable().describe(
1020
+ "0\u20131 prompt injection score when available; omit if unknown."
1021
+ ),
1022
+ contains_instruction_override: zod.z.boolean().optional().default(false).describe("Whether the context contains an instruction override."),
1023
+ context_injection_score: fraction01Nullable().describe(
1024
+ "0\u20131 context injection score when available; omit if unknown."
1025
+ )
994
1026
  });
995
1027
  BaseEventSchema.extend({
996
1028
  signal_payload: ContextIntegritySignalPayloadSchema
@@ -1006,17 +1038,29 @@ var createContextIntegrityEvent = (event) => {
1006
1038
  var ModelOutputSignalPayloadSchema = zod.z.object({
1007
1039
  missing_citations_rate: fraction01Nullable(),
1008
1040
  citation_rate: fraction01Nullable(),
1009
- expected_citation_rate: fraction01Nullable(),
1010
- policy_violations: zod.z.number().int().nonnegative().optional().default(0),
1041
+ expected_citation_rate: fraction01Nullable().describe(
1042
+ "Baseline or policy-expected citation rate (use with citation_rate)"
1043
+ ),
1044
+ policy_violations: zod.z.number().int().nonnegative().optional().default(0).describe("Count of policy violations when available."),
1011
1045
  policy_violation_rate: fraction01Nullable(),
1012
1046
  tool_call_inconsistency: fraction01().optional().default(0),
1013
- tool_inconsistency_rate: fraction01Nullable(),
1047
+ tool_inconsistency_rate: fraction01Nullable().describe(
1048
+ "Rate of inconsistent tool calls in the eval window"
1049
+ ),
1014
1050
  tool_miss_rate: fraction01Nullable(),
1015
- eval_window_n: zod.z.number().int().min(1).nullable().optional(),
1016
- hallucination_risk_score: fraction01Nullable(),
1017
- self_contradiction_score: fraction01Nullable(),
1018
- grounding_score: fraction01Nullable(),
1019
- contains_unsupported_claims: zod.z.boolean().optional().default(false)
1051
+ eval_window_n: zod.z.number().int().min(1).nullable().optional().describe("Evaluation window size"),
1052
+ hallucination_risk_score: fraction01Nullable().describe(
1053
+ "0\u20131 hallucination risk when available; omit if unknown."
1054
+ ),
1055
+ self_contradiction_score: fraction01Nullable().describe(
1056
+ "0\u20131 self-contradiction score when available; omit if unknown."
1057
+ ),
1058
+ grounding_score: fraction01Nullable().describe(
1059
+ "0\u20131 grounding score when available; omit if unknown."
1060
+ ),
1061
+ contains_unsupported_claims: zod.z.boolean().optional().default(false).describe(
1062
+ "Whether the output contains unsupported claims; confirm with clients."
1063
+ )
1020
1064
  });
1021
1065
  BaseEventSchema.extend({
1022
1066
  signal_payload: ModelOutputSignalPayloadSchema
@@ -1035,8 +1079,10 @@ var NetworkSignalPayloadSchema = zod.z.object({
1035
1079
  reputation_score: fraction01Nullable(),
1036
1080
  threat_score: fraction01Nullable(),
1037
1081
  is_datacenter: zod.z.boolean().nullable().optional(),
1038
- is_untrusted_segment: zod.z.boolean().optional().default(false),
1039
- asn_reputation: fraction01Nullable()
1082
+ is_untrusted_segment: zod.z.boolean().optional().default(false).describe("Traffic originated from an untrusted network segment"),
1083
+ asn_reputation: fraction01Nullable().describe(
1084
+ "Reputation score for the origin ASN (0\u20131, higher is more trusted)"
1085
+ )
1040
1086
  });
1041
1087
  BaseEventSchema.extend({
1042
1088
  signal_payload: NetworkSignalPayloadSchema
@@ -1061,14 +1107,18 @@ var POLICY_RESULTS = ["PASS", "WARN", "FAIL", "BLOCKED"];
1061
1107
 
1062
1108
  // src/v1/schemas/policy-event.ts
1063
1109
  var PolicyEventSignalPayloadSchema = zod.z.object({
1064
- policy_check_name: nonEmptyString(),
1065
- policy_category: zod.z.enum(POLICY_CATEGORIES),
1066
- policy_result: zod.z.enum(POLICY_RESULTS),
1067
- severity: fraction01(),
1068
- blocked: zod.z.boolean().optional().default(false),
1069
- violation_count: zod.z.number().int().nonnegative().optional().default(0),
1070
- policy_confidence: fraction01Nullable(),
1071
- redaction_applied: zod.z.boolean().optional().default(false)
1110
+ policy_check_name: nonEmptyString().describe("Name of the policy check."),
1111
+ policy_category: zod.z.enum(POLICY_CATEGORIES).describe(
1112
+ "Policy domain: SAFETY, PRIVACY, SECURITY, COMPLIANCE, CONTENT, or OTHER."
1113
+ ),
1114
+ policy_result: zod.z.enum(POLICY_RESULTS).describe("Policy check result: PASS, WARN, FAIL, or BLOCKED."),
1115
+ severity: fraction01().describe("0\u20131 policy event severity."),
1116
+ blocked: zod.z.boolean().optional().default(false).describe("Whether the action or output was blocked."),
1117
+ violation_count: zod.z.number().int().nonnegative().optional().default(0).describe("Count of policy violations when available."),
1118
+ policy_confidence: fraction01Nullable().describe(
1119
+ "0\u20131 policy classifier confidence when available."
1120
+ ),
1121
+ redaction_applied: zod.z.boolean().optional().default(false).describe("Whether content was redacted.")
1072
1122
  });
1073
1123
  BaseEventSchema.extend({
1074
1124
  signal_payload: PolicyEventSignalPayloadSchema
@@ -1081,18 +1131,30 @@ var createPolicyEvent = (event) => {
1081
1131
  );
1082
1132
  return buildRawEventRequest(event, signalPayload, "POLICY_EVENT");
1083
1133
  };
1084
- var promptHashSchema = zod.z.string().regex(/^[a-fA-F0-9]{64}$/).optional();
1134
+ var promptHashSchema = zod.z.string().regex(/^[a-fA-F0-9]{64}$/).optional().describe("Optional SHA-256 hash of prompt text (64 hex characters).");
1085
1135
  var PromptInputSignalPayloadSchema = zod.z.object({
1086
- prompt_length_chars: zod.z.number().int().nonnegative(),
1087
- conversation_turn_index: zod.z.number().int().nonnegative(),
1088
- contains_instruction_override: zod.z.boolean(),
1089
- contains_tool_request: zod.z.boolean().optional().default(false),
1090
- contains_secret_request: zod.z.boolean().optional().default(false),
1091
- contains_policy_challenge: zod.z.boolean().optional().default(false),
1092
- recursive_pattern_score: fraction01Nullable(),
1093
- prompt_injection_score: fraction01Nullable(),
1094
- sensitive_domain: zod.z.boolean().optional().default(false),
1095
- complexity_score: fraction01Nullable(),
1136
+ prompt_length_chars: zod.z.number().int().nonnegative().describe("Prompt size in characters."),
1137
+ conversation_turn_index: zod.z.number().int().nonnegative().describe("Turn number in the conversation."),
1138
+ contains_instruction_override: zod.z.boolean().describe(
1139
+ "Whether the prompt tries to override prior rules or instructions."
1140
+ ),
1141
+ contains_tool_request: zod.z.boolean().optional().default(false).describe("Whether the prompt requests tool or API execution."),
1142
+ contains_secret_request: zod.z.boolean().optional().default(false).describe(
1143
+ "Whether the prompt requests hidden or confidential information."
1144
+ ),
1145
+ contains_policy_challenge: zod.z.boolean().optional().default(false).describe("Whether the prompt challenges rules, safety, or policy."),
1146
+ recursive_pattern_score: fraction01Nullable().describe(
1147
+ "0\u20131 recursive or looping structure score; omit or null to treat as 0.0."
1148
+ ),
1149
+ prompt_injection_score: fraction01Nullable().describe(
1150
+ "0\u20131 prompt-injection likelihood score; omit or null to treat as 0.0."
1151
+ ),
1152
+ sensitive_domain: zod.z.boolean().optional().default(false).describe(
1153
+ "Whether the prompt targets a sensitive domain (finance, health, legal, cybersecurity, etc.)."
1154
+ ),
1155
+ complexity_score: fraction01Nullable().describe(
1156
+ "0\u20131 prompt complexity or ambiguity score; omit or null to treat as 0.0."
1157
+ ),
1096
1158
  prompt_hash: promptHashSchema
1097
1159
  });
1098
1160
  BaseEventSchema.extend({
@@ -1107,17 +1169,25 @@ var createPromptInputEvent = (event) => {
1107
1169
  return buildRawEventRequest(event, signalPayload, "PROMPT_INPUT");
1108
1170
  };
1109
1171
  var RagRetrievalSignalPayloadSchema = zod.z.object({
1110
- retriever_id: nonEmptyString(),
1111
- query_hash: zod.z.string().nullable().optional(),
1112
- documents_retrieved: zod.z.number().int().nonnegative(),
1113
- top_k: zod.z.number().int().min(1),
1114
- average_relevance_score: fraction01(),
1115
- source_trust_score: fraction01(),
1116
- lowest_source_trust_score: fraction01Nullable(),
1117
- untrusted_source_count: zod.z.number().int().nonnegative().optional().default(0),
1118
- retrieved_context_tokens: zod.z.number().int().nonnegative().optional().default(0),
1119
- context_injection_score: fraction01().optional().default(0),
1120
- document_ids: zod.z.array(zod.z.string()).optional().default([])
1172
+ retriever_id: nonEmptyString().describe("Retriever service identifier."),
1173
+ query_hash: zod.z.string().nullable().optional().describe("Hash of the retrieval query when available."),
1174
+ documents_retrieved: zod.z.number().int().nonnegative().describe("Number of documents retrieved."),
1175
+ top_k: zod.z.number().int().min(1).describe("Requested top-k document count."),
1176
+ average_relevance_score: fraction01().describe(
1177
+ "0\u20131 average relevance score across retrieved documents."
1178
+ ),
1179
+ source_trust_score: fraction01().describe(
1180
+ "0\u20131 average trust score across retrieved sources."
1181
+ ),
1182
+ lowest_source_trust_score: fraction01Nullable().describe(
1183
+ "0\u20131 weakest source trust score when available."
1184
+ ),
1185
+ untrusted_source_count: zod.z.number().int().nonnegative().optional().default(0).describe("Count of low-trust or untrusted retrieved sources."),
1186
+ retrieved_context_tokens: zod.z.number().int().nonnegative().optional().default(0).describe("Total retrieved context token count when available."),
1187
+ context_injection_score: fraction01().optional().default(0).describe(
1188
+ "0\u20131 context injection risk score; use 0.0 when unavailable."
1189
+ ),
1190
+ document_ids: zod.z.array(zod.z.string()).optional().default([]).describe("Identifiers for retrieved documents when available.")
1121
1191
  });
1122
1192
  BaseEventSchema.extend({
1123
1193
  signal_payload: RagRetrievalSignalPayloadSchema
@@ -1142,16 +1212,18 @@ var SESSION_STATUSES = [
1142
1212
 
1143
1213
  // src/v1/schemas/session.ts
1144
1214
  var SessionSignalPayloadSchema = zod.z.object({
1145
- session_status: zod.z.enum(SESSION_STATUSES),
1146
- session_age_seconds: zod.z.number().nonnegative().optional().default(0),
1147
- turn_count: zod.z.number().int().nonnegative().optional().default(0),
1148
- messages_last_minute: zod.z.number().nonnegative().optional().default(0),
1149
- avg_seconds_between_turns: zod.z.number().nonnegative().nullable().optional(),
1150
- restart_count_10m: zod.z.number().int().nonnegative().optional().default(0),
1151
- session_timeout: zod.z.boolean().optional().default(false),
1152
- abandoned: zod.z.boolean().optional().default(false),
1153
- conversation_id: zod.z.string().nullable().optional(),
1154
- user_id: zod.z.string().nullable().optional()
1215
+ session_status: zod.z.enum(SESSION_STATUSES).describe(
1216
+ "Session lifecycle status: STARTED, ACTIVE, ENDED, TIMEOUT, or ABANDONED."
1217
+ ),
1218
+ session_age_seconds: zod.z.number().nonnegative().optional().default(0).describe("Current duration of the session in seconds."),
1219
+ turn_count: zod.z.number().int().nonnegative().optional().default(0).describe("Number of user/model turns in the session."),
1220
+ messages_last_minute: zod.z.number().nonnegative().optional().default(0).describe("Prompt or message rate over the last minute."),
1221
+ avg_seconds_between_turns: zod.z.number().nonnegative().nullable().optional().describe("Average interaction cadence between turns in seconds."),
1222
+ restart_count_10m: zod.z.number().int().nonnegative().optional().default(0).describe("How often the user restarted sessions in the last 10 minutes."),
1223
+ session_timeout: zod.z.boolean().optional().default(false).describe("Whether the session ended due to a timeout."),
1224
+ abandoned: zod.z.boolean().optional().default(false).describe("Whether the session ended abruptly without a clean close."),
1225
+ conversation_id: zod.z.string().nullable().optional().describe("Related conversation identifier when available."),
1226
+ user_id: zod.z.string().nullable().optional().describe("Related user identifier when available.")
1155
1227
  });
1156
1228
  BaseEventSchema.extend({
1157
1229
  signal_payload: SessionSignalPayloadSchema
@@ -1168,11 +1240,19 @@ var SystemTelemetrySignalPayloadSchema = zod.z.object({
1168
1240
  baseline: zod.z.number().nullable().optional(),
1169
1241
  window_seconds: zod.z.number().int().min(1).nullable().optional(),
1170
1242
  error_rate: fraction01().optional().default(0),
1171
- baseline_error_rate: fraction01Nullable(),
1243
+ baseline_error_rate: fraction01Nullable().describe(
1244
+ "Expected or steady-state error rate (excess over this drives impact)"
1245
+ ),
1172
1246
  unusual_auth_rate: fraction01().optional().default(0),
1173
- firmware_hash_changed: zod.z.boolean().optional().default(false),
1174
- expected_hash_match: zod.z.boolean().nullable().optional(),
1175
- sensor_deviation_score: fraction01Nullable()
1247
+ firmware_hash_changed: zod.z.boolean().optional().default(false).describe(
1248
+ "Device or component firmware hash differs from prior observation"
1249
+ ),
1250
+ expected_hash_match: zod.z.boolean().nullable().optional().describe(
1251
+ "True if hash matched expected; False if mismatch; omit if unknown"
1252
+ ),
1253
+ sensor_deviation_score: fraction01Nullable().describe(
1254
+ "Normalized deviation of sensor readings from baseline"
1255
+ )
1176
1256
  });
1177
1257
  BaseEventSchema.extend({
1178
1258
  signal_payload: SystemTelemetrySignalPayloadSchema
@@ -1200,24 +1280,38 @@ var TOOL_CATEGORIES = [
1200
1280
 
1201
1281
  // src/v1/schemas/tool-call.ts
1202
1282
  var ToolCallSignalPayloadSchema = zod.z.object({
1203
- tool_name: nonEmptyString(),
1204
- tool_category: zod.z.enum(TOOL_CATEGORIES),
1205
- action: nonEmptyString(),
1206
- authorized: zod.z.boolean().nullable(),
1207
- safety_critical: zod.z.boolean(),
1208
- external_side_effect: zod.z.boolean(),
1209
- tool_call_success: zod.z.boolean().nullable().optional(),
1210
- latency_ms: zod.z.number().nonnegative().nullable().optional(),
1211
- error_code: zod.z.string().nullable().optional(),
1212
- argument_risk_score: fraction01Nullable(),
1213
- result_size_bytes: zod.z.number().int().nonnegative().nullable().optional(),
1214
- records_accessed: zod.z.number().int().nonnegative().optional().default(0),
1215
- contains_sensitive_data: zod.z.boolean().optional().default(false),
1216
- action_category: zod.z.string().nullable().optional(),
1217
- method: zod.z.string().nullable().optional(),
1218
- sensitive_data_involved: zod.z.boolean().optional().default(false),
1219
- contains_phi: zod.z.boolean().optional().default(false),
1220
- sensitive_domain: zod.z.boolean().optional().default(false)
1283
+ tool_name: nonEmptyString().describe("Tool identifier."),
1284
+ tool_category: zod.z.enum(TOOL_CATEGORIES).describe(
1285
+ "Tool category: RETRIEVAL, DATABASE, PAYMENT, MESSAGING, CODE_EXECUTION, FILE, EXTERNAL_API, or OTHER."
1286
+ ),
1287
+ action: nonEmptyString().describe("Action attempted by the tool call."),
1288
+ authorized: zod.z.boolean().nullable().describe(
1289
+ "Whether policy allowed the tool call; null means authorization is unknown."
1290
+ ),
1291
+ safety_critical: zod.z.boolean().describe("Whether the call can create serious consequences."),
1292
+ external_side_effect: zod.z.boolean().describe(
1293
+ "Whether the action changes state outside the model context."
1294
+ ),
1295
+ tool_call_success: zod.z.boolean().nullable().optional().describe("Whether the tool call succeeded when known."),
1296
+ latency_ms: zod.z.number().nonnegative().nullable().optional().describe("Tool latency in milliseconds when available."),
1297
+ error_code: zod.z.string().nullable().optional().describe("Error code when the tool call failed."),
1298
+ argument_risk_score: fraction01Nullable().describe(
1299
+ "0\u20131 risk score for tool call arguments when available."
1300
+ ),
1301
+ result_size_bytes: zod.z.number().int().nonnegative().nullable().optional().describe("Size of returned data in bytes when available."),
1302
+ records_accessed: zod.z.number().int().nonnegative().optional().default(0).describe("Number of records touched by the call when available."),
1303
+ contains_sensitive_data: zod.z.boolean().optional().default(false).describe("Whether sensitive data was returned or touched."),
1304
+ action_category: zod.z.string().nullable().optional().describe(
1305
+ "Risk category for the attempted action (e.g. SECURITY, CODE, FINANCIAL, ADMIN) when available."
1306
+ ),
1307
+ method: zod.z.string().nullable().optional().describe("HTTP or RPC method for the tool call when applicable."),
1308
+ sensitive_data_involved: zod.z.boolean().optional().default(false).describe(
1309
+ "Whether sensitive data was involved in the request or result."
1310
+ ),
1311
+ contains_phi: zod.z.boolean().optional().default(false).describe(
1312
+ "Whether protected health information was returned or touched."
1313
+ ),
1314
+ sensitive_domain: zod.z.boolean().optional().default(false).describe("Whether the tool call applies to a sensitive domain.")
1221
1315
  });
1222
1316
  BaseEventSchema.extend({
1223
1317
  signal_payload: ToolCallSignalPayloadSchema
@@ -1229,27 +1323,29 @@ var createToolCallEvent = (event) => {
1229
1323
  return buildRawEventRequest(event, signalPayload, "TOOL_CALL");
1230
1324
  };
1231
1325
  var TransactionSignalPayloadSchema = zod.z.object({
1232
- amount: zod.z.number().nonnegative().default(0),
1233
- amount_minor: zod.z.number().int().nonnegative().nullable().optional(),
1234
- amount_usd: zod.z.number().nonnegative().nullable().optional(),
1235
- currency: zod.z.string().nullable().optional(),
1326
+ amount: zod.z.number().nonnegative().default(0).describe("Transaction amount in base currency"),
1327
+ amount_minor: zod.z.number().int().nonnegative().nullable().optional().describe("Transaction amount in minor units (e.g. cents)"),
1328
+ amount_usd: zod.z.number().nonnegative().nullable().optional().describe("Transaction amount normalized to USD"),
1329
+ currency: zod.z.string().nullable().optional().describe("ISO 4217 currency code"),
1236
1330
  merchant_category: zod.z.string().nullable().optional(),
1237
1331
  merchant_id: zod.z.string().nullable().optional(),
1238
- channel: zod.z.string().nullable().optional(),
1239
- country: zod.z.string().nullable().optional(),
1240
- velocity: zod.z.number().nonnegative().nullable().optional(),
1241
- external_anomaly_score: zod.z.number().nullable().optional(),
1242
- geo_distance: zod.z.number().nonnegative().nullable().optional(),
1243
- geo_distance_km: zod.z.number().nonnegative().nullable().optional(),
1244
- records_accessed: zod.z.number().int().nonnegative().nullable().optional(),
1245
- baseline_records_accessed: zod.z.number().int().nonnegative().nullable().optional(),
1246
- sensitivity_level: zod.z.string().nullable().optional(),
1247
- export_count: zod.z.number().int().nonnegative().nullable().optional(),
1248
- bulk_export: zod.z.boolean().optional().default(false),
1249
- contains_phi: zod.z.boolean().optional().default(false),
1250
- control_command: zod.z.string().nullable().optional(),
1251
- authorized: zod.z.boolean().nullable().optional(),
1252
- safety_critical: zod.z.boolean().optional().default(false)
1332
+ channel: zod.z.string().nullable().optional().describe("Transaction channel (WEB, MOBILE, ECOM)"),
1333
+ country: zod.z.string().nullable().optional().describe("ISO 3166-1 alpha-2 country code"),
1334
+ velocity: zod.z.number().nonnegative().nullable().optional().describe("Transactions per minute"),
1335
+ external_anomaly_score: zod.z.number().nullable().optional().describe(
1336
+ "Externally supplied anomaly score. When present, bypasses the internal extraction formula and is used directly as raw_value."
1337
+ ),
1338
+ geo_distance: zod.z.number().nonnegative().nullable().optional().describe("Distance in km from usual location"),
1339
+ geo_distance_km: zod.z.number().nonnegative().nullable().optional().describe("Distance in km from usual location"),
1340
+ records_accessed: zod.z.number().int().nonnegative().nullable().optional().describe("Count of records touched in this transaction"),
1341
+ baseline_records_accessed: zod.z.number().int().nonnegative().nullable().optional().describe("Typical or policy baseline record count for comparison"),
1342
+ sensitivity_level: zod.z.string().nullable().optional().describe("Data sensitivity (e.g. LOW, MEDIUM, HIGH)"),
1343
+ export_count: zod.z.number().int().nonnegative().nullable().optional().describe("Number of export operations"),
1344
+ bulk_export: zod.z.boolean().optional().default(false).describe("Whether this is a bulk export"),
1345
+ contains_phi: zod.z.boolean().optional().default(false).describe("Whether exported or accessed data includes PHI"),
1346
+ control_command: zod.z.string().nullable().optional().describe("Issued control or OT command (e.g. VALVE_OPEN)"),
1347
+ authorized: zod.z.boolean().nullable().optional().describe("Whether the action was authorized; omit if unknown"),
1348
+ safety_critical: zod.z.boolean().optional().default(false).describe("Whether the transaction affects safety-critical systems")
1253
1349
  });
1254
1350
  BaseEventSchema.extend({
1255
1351
  signal_payload: TransactionSignalPayloadSchema
@@ -1282,13 +1378,19 @@ var FEEDBACK_ISSUE_TYPES = [
1282
1378
 
1283
1379
  // src/v1/schemas/user-feedback.ts
1284
1380
  var UserFeedbackSignalPayloadSchema = zod.z.object({
1285
- feedback_type: zod.z.enum(FEEDBACK_TYPES),
1286
- rating: zod.z.number().nullable().optional(),
1287
- reported_issue: zod.z.boolean().optional().default(false),
1288
- issue_type: zod.z.enum(FEEDBACK_ISSUE_TYPES).nullable().optional(),
1289
- severity: fraction01Nullable(),
1290
- response_id: zod.z.string().nullable().optional(),
1291
- user_comment_hash: zod.z.string().nullable().optional()
1381
+ feedback_type: zod.z.enum(FEEDBACK_TYPES).describe(
1382
+ "User feedback category: THUMBS_UP, THUMBS_DOWN, REPORT, CORRECTION, or RATING."
1383
+ ),
1384
+ rating: zod.z.number().nullable().optional().describe("Optional rating in [-1, 1] or on a 1\u20135 scale."),
1385
+ reported_issue: zod.z.boolean().optional().default(false).describe("Whether the user reported a problem."),
1386
+ issue_type: zod.z.enum(FEEDBACK_ISSUE_TYPES).nullable().optional().describe(
1387
+ "Category of the reported issue: hallucination, unsafe, irrelevant, privacy, offensive, or other."
1388
+ ),
1389
+ severity: fraction01Nullable().describe(
1390
+ "0\u20131 user-reported severity when available."
1391
+ ),
1392
+ response_id: zod.z.string().nullable().optional().describe("Identifier of the response being evaluated."),
1393
+ user_comment_hash: zod.z.string().nullable().optional().describe("Hash of optional user comment when available.")
1292
1394
  });
1293
1395
  BaseEventSchema.extend({
1294
1396
  signal_payload: UserFeedbackSignalPayloadSchema
@@ -1323,22 +1425,28 @@ var WORKFLOW_ACTOR_TYPES = ["USER", "AI_AGENT", "SYSTEM"];
1323
1425
 
1324
1426
  // src/v1/schemas/workflow-action.ts
1325
1427
  var WorkflowActionSignalPayloadSchema = zod.z.object({
1326
- workflow_id: nonEmptyString(),
1327
- workflow_type: nonEmptyString(),
1328
- action_name: nonEmptyString(),
1329
- action_category: zod.z.enum(WORKFLOW_ACTION_CATEGORIES),
1330
- action_stage: zod.z.enum(WORKFLOW_ACTION_STAGES),
1331
- actor_type: zod.z.enum(WORKFLOW_ACTOR_TYPES),
1332
- requires_approval: zod.z.boolean().optional().default(false),
1333
- approval_present: zod.z.boolean().optional().default(false),
1334
- external_side_effect: zod.z.boolean().nullable().optional(),
1335
- safety_critical: zod.z.boolean().nullable().optional(),
1336
- amount_usd: zod.z.number().nonnegative().nullable().optional(),
1337
- sensitive_data_involved: zod.z.boolean().optional().default(false),
1338
- new_counterparty: zod.z.boolean().optional().default(false),
1339
- is_new_vendor: zod.z.boolean().optional().default(false),
1340
- is_new_recipient: zod.z.boolean().optional().default(false),
1341
- is_new_endpoint: zod.z.boolean().optional().default(false)
1428
+ workflow_id: nonEmptyString().describe("Workflow identifier."),
1429
+ workflow_type: nonEmptyString().describe("Type of workflow."),
1430
+ action_name: nonEmptyString().describe("Workflow action attempted."),
1431
+ action_category: zod.z.enum(WORKFLOW_ACTION_CATEGORIES).describe(
1432
+ "Risk category: FINANCIAL, DATA_ACCESS, COMMUNICATION, ADMIN, SECURITY, CODE, or OTHER."
1433
+ ),
1434
+ action_stage: zod.z.enum(WORKFLOW_ACTION_STAGES).describe(
1435
+ "Lifecycle stage: PROPOSED, PRE_EXECUTION, EXECUTED, FAILED, or ROLLED_BACK."
1436
+ ),
1437
+ actor_type: zod.z.enum(WORKFLOW_ACTOR_TYPES).describe("Who initiated the action: USER, AI_AGENT, or SYSTEM."),
1438
+ requires_approval: zod.z.boolean().optional().default(false).describe("Whether approval is required before execution."),
1439
+ approval_present: zod.z.boolean().optional().default(false).describe("Whether required approval is present."),
1440
+ external_side_effect: zod.z.boolean().nullable().optional().describe("Whether the action changes external state when known."),
1441
+ safety_critical: zod.z.boolean().nullable().optional().describe(
1442
+ "Whether the action is safety, security, or business critical when known."
1443
+ ),
1444
+ amount_usd: zod.z.number().nonnegative().nullable().optional().describe("Financial magnitude in USD when applicable."),
1445
+ sensitive_data_involved: zod.z.boolean().optional().default(false).describe("Whether sensitive data was touched."),
1446
+ new_counterparty: zod.z.boolean().optional().default(false).describe("Whether a new vendor, customer, or recipient is involved."),
1447
+ is_new_vendor: zod.z.boolean().optional().default(false).describe("Whether the action involves a new vendor."),
1448
+ is_new_recipient: zod.z.boolean().optional().default(false).describe("Whether the action involves a new recipient."),
1449
+ is_new_endpoint: zod.z.boolean().optional().default(false).describe("Whether the action targets a new endpoint.")
1342
1450
  });
1343
1451
  BaseEventSchema.extend({
1344
1452
  signal_payload: WorkflowActionSignalPayloadSchema