@highflame/sdk 0.3.0 → 0.3.2
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/README.md +53 -14
- package/dist/index.d.cts +316 -208
- package/dist/index.d.ts +316 -208
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated types from spec/shield-v1.
|
|
2
|
+
* Generated types from spec/shield-v1.json — DO NOT EDIT.
|
|
3
3
|
*
|
|
4
|
-
* Regenerate: python codegen/generate.py --spec spec/shield-v1.
|
|
4
|
+
* Regenerate: python codegen/generate.py --spec spec/shield-v1.json
|
|
5
5
|
*/
|
|
6
6
|
/** Type of content being evaluated. */
|
|
7
7
|
type ContentType = "prompt" | "response" | "tool_call" | "file";
|
|
@@ -9,106 +9,136 @@ type ContentType = "prompt" | "response" | "tool_call" | "file";
|
|
|
9
9
|
type Decision = "allow" | "deny";
|
|
10
10
|
/** enforce: block on deny. monitor: allow + log. alert: allow + signal. */
|
|
11
11
|
type Mode = "enforce" | "monitor" | "alert";
|
|
12
|
-
/**
|
|
12
|
+
/** */
|
|
13
13
|
interface AgentIdentityTrace {
|
|
14
14
|
/** Agent identifier. */
|
|
15
15
|
agent_id: string;
|
|
16
16
|
/** Type of agent (e.g. claude, cursor, custom). */
|
|
17
17
|
agent_type: string;
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/** Authentication method: api_key or jwt. */
|
|
19
|
+
auth_method: string;
|
|
20
20
|
/** Agent framework (e.g. Python SDK, Node SDK). */
|
|
21
21
|
framework?: string;
|
|
22
22
|
/** Publisher/organization. */
|
|
23
23
|
publisher?: string;
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/** Trust level (verified, unverified, etc.). */
|
|
25
|
+
trust_level: string;
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
27
|
+
/** */
|
|
28
|
+
interface EvidenceSource {
|
|
29
|
+
/** Detector name (e.g. injection, secrets, tool_validator). */
|
|
30
|
+
detector: string;
|
|
31
|
+
/** Producer-specific metadata (e.g. tier, phase, priority). */
|
|
32
|
+
labels?: Record<string, string>;
|
|
33
|
+
/** Detector execution latency in milliseconds. */
|
|
34
|
+
latency_ms?: number;
|
|
35
|
+
}
|
|
36
|
+
/** */
|
|
37
|
+
interface ConditionResult {
|
|
38
|
+
/** Actual value from the context (null if field was missing). */
|
|
39
|
+
actual: Record<string, unknown>;
|
|
40
|
+
/** Expected value (threshold from the rule). */
|
|
41
|
+
expected: Record<string, unknown>;
|
|
42
|
+
/** Context field name. */
|
|
43
|
+
field: string;
|
|
44
|
+
/** Whether this condition matched. */
|
|
45
|
+
matched: boolean;
|
|
46
|
+
/** Comparison operator. */
|
|
47
|
+
operator: string;
|
|
48
|
+
/** Detector that produced this context value (when available). */
|
|
49
|
+
source?: EvidenceSource;
|
|
50
|
+
}
|
|
51
|
+
/** */
|
|
28
52
|
interface ContextKeySpec {
|
|
29
|
-
/** Context key name (e.g. injection_score). */
|
|
30
|
-
key: string;
|
|
31
|
-
/** Cedar type: long, bool, string, or set. */
|
|
32
|
-
type: string;
|
|
33
53
|
/** Human-readable description. */
|
|
34
54
|
description: string;
|
|
55
|
+
/** Context key name (e.g. injection_score). */
|
|
56
|
+
key: string;
|
|
35
57
|
/** Value range (e.g. 0-100). */
|
|
36
58
|
range?: string;
|
|
59
|
+
/** Cedar type: long, bool, string, or set. */
|
|
60
|
+
type: string;
|
|
37
61
|
}
|
|
38
|
-
/**
|
|
62
|
+
/** */
|
|
39
63
|
interface EntityDebug {
|
|
40
|
-
/** Entity type. */
|
|
41
|
-
type: string;
|
|
42
64
|
/** Entity ID. */
|
|
43
65
|
id: string;
|
|
44
66
|
/** Parent entity UIDs. */
|
|
45
67
|
parents?: string[];
|
|
68
|
+
/** Entity type. */
|
|
69
|
+
type: string;
|
|
46
70
|
}
|
|
47
|
-
/**
|
|
71
|
+
/** */
|
|
48
72
|
interface TenantDebug {
|
|
73
|
+
/** Account ID. */
|
|
49
74
|
account_id: string;
|
|
50
|
-
|
|
75
|
+
/** Application ID. */
|
|
51
76
|
application_id: string;
|
|
77
|
+
/** Project ID. */
|
|
78
|
+
project_id: string;
|
|
52
79
|
}
|
|
53
|
-
/**
|
|
80
|
+
/** */
|
|
54
81
|
interface DebugInfo {
|
|
55
|
-
/** Product namespace. */
|
|
56
|
-
product: string;
|
|
57
|
-
/** Cedar namespace (e.g. Guardrails). */
|
|
58
|
-
namespace: string;
|
|
59
|
-
/** Principal entity type. */
|
|
60
|
-
principal_type: string;
|
|
61
|
-
/** Principal entity ID. */
|
|
62
|
-
principal_id: string;
|
|
63
82
|
/** Cedar action. */
|
|
64
83
|
action: string;
|
|
65
|
-
/** Resource entity type. */
|
|
66
|
-
resource_type: string;
|
|
67
|
-
/** Resource entity ID. */
|
|
68
|
-
resource_id: string;
|
|
69
84
|
/** Entity hierarchy. */
|
|
70
85
|
entities: EntityDebug[];
|
|
71
86
|
/** Number of loaded policies. */
|
|
72
87
|
loaded_policy_count: number;
|
|
88
|
+
/** Cedar namespace. */
|
|
89
|
+
namespace: string;
|
|
90
|
+
/** Principal entity ID. */
|
|
91
|
+
principal_id: string;
|
|
92
|
+
/** Principal entity type. */
|
|
93
|
+
principal_type: string;
|
|
94
|
+
/** Product namespace. */
|
|
95
|
+
product: string;
|
|
96
|
+
/** Resource entity ID. */
|
|
97
|
+
resource_id: string;
|
|
98
|
+
/** Resource entity type. */
|
|
99
|
+
resource_type: string;
|
|
100
|
+
/** Resolved tenant identity. */
|
|
73
101
|
tenant: TenantDebug;
|
|
74
102
|
}
|
|
75
|
-
/**
|
|
103
|
+
/** */
|
|
76
104
|
interface PolicySummary {
|
|
105
|
+
/** Policy domain category. */
|
|
106
|
+
category?: string;
|
|
107
|
+
/** Policy mode: enforce, monitor, or alert. */
|
|
108
|
+
mode: string;
|
|
77
109
|
/** Database UUID. */
|
|
78
110
|
policy_id: string;
|
|
79
111
|
/** Human-readable name. */
|
|
80
112
|
policy_name: string;
|
|
81
|
-
/** Policy mode: enforce, monitor, or alert. */
|
|
82
|
-
mode: string;
|
|
83
|
-
/** Policy domain category. */
|
|
84
|
-
category?: string;
|
|
85
113
|
/** Cedar @id annotations from this policy. */
|
|
86
114
|
rule_ids: string[];
|
|
87
115
|
}
|
|
88
|
-
/**
|
|
116
|
+
/** */
|
|
89
117
|
interface DebugPoliciesResponse {
|
|
90
|
-
/** Product namespace inspected. */
|
|
91
|
-
product: string;
|
|
92
118
|
/** Whether the evaluator has loaded policies. */
|
|
93
119
|
has_policies: boolean;
|
|
120
|
+
/** Loaded policies with IDs, names, modes, and Cedar rule IDs. */
|
|
121
|
+
policies: PolicySummary[];
|
|
94
122
|
/** Number of distinct DB policies loaded. */
|
|
95
123
|
policy_count: number;
|
|
96
|
-
/**
|
|
97
|
-
|
|
124
|
+
/** Product namespace inspected. */
|
|
125
|
+
product: string;
|
|
98
126
|
}
|
|
99
|
-
/**
|
|
127
|
+
/** */
|
|
100
128
|
interface FileContext {
|
|
101
|
-
/** File
|
|
102
|
-
|
|
129
|
+
/** File MIME type. */
|
|
130
|
+
mime_type?: string;
|
|
103
131
|
/** File operation: read, write, delete, append, etc. */
|
|
104
132
|
operation: string;
|
|
133
|
+
/** File path. */
|
|
134
|
+
path: string;
|
|
105
135
|
/** File size in bytes. */
|
|
106
136
|
size?: number;
|
|
107
|
-
/** File MIME type. */
|
|
108
|
-
mime_type?: string;
|
|
109
137
|
}
|
|
110
|
-
/**
|
|
138
|
+
/** */
|
|
111
139
|
interface MCPContext {
|
|
140
|
+
/** Advertised MCP capabilities from server manifest. */
|
|
141
|
+
capabilities?: string[];
|
|
112
142
|
/** MCP server name. */
|
|
113
143
|
server_name: string;
|
|
114
144
|
/** MCP server URL. */
|
|
@@ -117,304 +147,382 @@ interface MCPContext {
|
|
|
117
147
|
transport?: string;
|
|
118
148
|
/** Whether the server passed trust/signature verification. */
|
|
119
149
|
verified?: boolean;
|
|
120
|
-
/** Advertised MCP capabilities from server manifest. */
|
|
121
|
-
capabilities?: string[];
|
|
122
150
|
}
|
|
123
|
-
/**
|
|
151
|
+
/** */
|
|
124
152
|
interface ModelContext {
|
|
125
|
-
/**
|
|
126
|
-
|
|
153
|
+
/** Max token limit for the session. */
|
|
154
|
+
max_tokens?: number;
|
|
127
155
|
/** Model name (e.g. gpt-4, claude-3). */
|
|
128
156
|
model?: string;
|
|
157
|
+
/** LLM provider (e.g. openai, anthropic). */
|
|
158
|
+
provider?: string;
|
|
129
159
|
/** Temperature setting. */
|
|
130
160
|
temperature?: number;
|
|
131
161
|
/** Tokens consumed so far in the session. */
|
|
132
162
|
tokens_used?: number;
|
|
133
|
-
/** Max token limit for the session. */
|
|
134
|
-
max_tokens?: number;
|
|
135
163
|
}
|
|
136
|
-
/**
|
|
164
|
+
/** */
|
|
137
165
|
interface ToolContext {
|
|
138
|
-
/** Tool name. */
|
|
139
|
-
name: string;
|
|
140
|
-
/** Whether the tool is built-in to the LLM or externally registered. */
|
|
141
|
-
is_builtin: boolean;
|
|
142
166
|
/** Tool arguments as a JSON object. */
|
|
143
167
|
arguments?: Record<string, unknown>;
|
|
144
|
-
/** MCP server ID (for externally-registered tools). */
|
|
145
|
-
server_id?: string;
|
|
146
168
|
/** Tool description from MCP manifest, for tool-poisoning analysis. */
|
|
147
169
|
description?: string;
|
|
170
|
+
/** Whether the tool is built-in to the LLM or externally registered. */
|
|
171
|
+
is_builtin: boolean;
|
|
172
|
+
/** Tool name. */
|
|
173
|
+
name: string;
|
|
174
|
+
/** MCP server ID (for externally-registered tools). */
|
|
175
|
+
server_id?: string;
|
|
148
176
|
}
|
|
149
|
-
/**
|
|
177
|
+
/** */
|
|
150
178
|
interface DetectRequest {
|
|
151
|
-
/** Content to analyze
|
|
179
|
+
/** Content to analyze */
|
|
152
180
|
content: string;
|
|
181
|
+
/** Type of content being analyzed */
|
|
153
182
|
content_type: ContentType;
|
|
183
|
+
/** Reference material for context-aware detection (hallucination, groundedness). For response evaluation, include the original prompt and any RAG context. */
|
|
184
|
+
contexts?: string[];
|
|
154
185
|
/** Specific detectors to run. Empty runs all enabled detectors. */
|
|
155
186
|
detectors?: string[];
|
|
156
|
-
/**
|
|
187
|
+
/** File operation context */
|
|
188
|
+
file?: FileContext;
|
|
189
|
+
/** MCP server context */
|
|
190
|
+
mcp?: MCPContext;
|
|
191
|
+
/** Caller-provided metadata passed through to detectors */
|
|
157
192
|
metadata?: Record<string, unknown>;
|
|
158
|
-
/**
|
|
159
|
-
|
|
160
|
-
/** Session ID for cross-turn state tracking
|
|
193
|
+
/** LLM model context */
|
|
194
|
+
model?: ModelContext;
|
|
195
|
+
/** Session ID for cross-turn state tracking */
|
|
161
196
|
session_id?: string;
|
|
197
|
+
/** Tool call context */
|
|
162
198
|
tool?: ToolContext;
|
|
163
|
-
model?: ModelContext;
|
|
164
|
-
file?: FileContext;
|
|
165
|
-
mcp?: MCPContext;
|
|
166
199
|
}
|
|
167
|
-
/**
|
|
200
|
+
/** */
|
|
168
201
|
interface DetectorResult {
|
|
169
|
-
/**
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
|
|
202
|
+
/** Emitted context attributes (e.g. injection_score). */
|
|
203
|
+
context: Record<string, unknown>;
|
|
204
|
+
/** Error message (when status is error or timeout). */
|
|
205
|
+
error?: string;
|
|
173
206
|
/** Detector execution latency in milliseconds. */
|
|
174
207
|
latency_ms: number;
|
|
175
|
-
/**
|
|
176
|
-
|
|
208
|
+
/** Detector name (e.g. injection, secrets, toxicity). */
|
|
209
|
+
name: string;
|
|
177
210
|
/** Detector status: healthy, degraded, error, or timeout. */
|
|
178
211
|
status: string;
|
|
179
|
-
/**
|
|
180
|
-
|
|
212
|
+
/** Detector tier: fast, standard, or slow. */
|
|
213
|
+
tier: string;
|
|
181
214
|
}
|
|
182
|
-
/**
|
|
215
|
+
/** */
|
|
183
216
|
interface DetectResponse {
|
|
184
|
-
/** Per-detector results. */
|
|
185
|
-
detectors: DetectorResult[];
|
|
186
217
|
/** Merged context from all detectors. */
|
|
187
218
|
context: Record<string, unknown>;
|
|
219
|
+
/** Per-detector results. */
|
|
220
|
+
detectors: DetectorResult[];
|
|
188
221
|
/** Total detection latency in milliseconds. */
|
|
189
222
|
latency_ms: number;
|
|
190
223
|
/** Detector tiers that ran. */
|
|
191
224
|
tiers_evaluated: string[];
|
|
192
225
|
}
|
|
193
|
-
/**
|
|
226
|
+
/** */
|
|
194
227
|
interface DetectorInfo {
|
|
195
|
-
/**
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
|
|
228
|
+
/** Detection category (e.g. semantic, tools, pii). */
|
|
229
|
+
category?: string;
|
|
230
|
+
/** Configuration schema type (if configurable). */
|
|
231
|
+
config_type?: string;
|
|
232
|
+
/** Whether the detector accepts configuration. */
|
|
233
|
+
configurable?: boolean;
|
|
201
234
|
/** Keys this detector may emit. */
|
|
202
235
|
context_keys: ContextKeySpec[];
|
|
203
|
-
/** Detector status: healthy, degraded, or disabled. */
|
|
204
|
-
status: string;
|
|
205
|
-
/** Human-readable display name. */
|
|
206
|
-
display_name?: string;
|
|
207
236
|
/** What the detector detects. */
|
|
208
237
|
description?: string;
|
|
209
|
-
/**
|
|
210
|
-
|
|
211
|
-
/** Whether the detector accepts configuration. */
|
|
212
|
-
configurable?: boolean;
|
|
213
|
-
/** Configuration schema type (if configurable). */
|
|
214
|
-
config_type?: string;
|
|
215
|
-
/** Tags for filtering. */
|
|
216
|
-
tags?: string[];
|
|
238
|
+
/** Human-readable display name. */
|
|
239
|
+
display_name?: string;
|
|
217
240
|
/** Typical latency estimate. */
|
|
218
241
|
latency?: string;
|
|
242
|
+
/** Detector name. */
|
|
243
|
+
name: string;
|
|
244
|
+
/** Detector status: healthy, degraded, or disabled. */
|
|
245
|
+
status: string;
|
|
246
|
+
/** Tags for filtering. */
|
|
247
|
+
tags?: string[];
|
|
248
|
+
/** Detector tier: fast, standard, or slow. */
|
|
249
|
+
tier: string;
|
|
250
|
+
/** Detector version. */
|
|
251
|
+
version: string;
|
|
219
252
|
}
|
|
220
|
-
/**
|
|
253
|
+
/** */
|
|
221
254
|
interface DetectorPlanEntry {
|
|
255
|
+
/** Full scoped config (dry run only). */
|
|
256
|
+
config?: Record<string, unknown>;
|
|
222
257
|
/** Detector name. */
|
|
223
258
|
name: string;
|
|
224
|
-
/** Detector tier. */
|
|
225
|
-
tier: string;
|
|
226
259
|
/** Why included/excluded: policy_required, always_run, not_required. */
|
|
227
260
|
reason: string;
|
|
228
|
-
/**
|
|
229
|
-
|
|
261
|
+
/** Detector tier. */
|
|
262
|
+
tier: string;
|
|
230
263
|
}
|
|
231
|
-
/**
|
|
264
|
+
/** */
|
|
232
265
|
interface DeterminingPolicy {
|
|
233
|
-
/** Cedar
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
|
|
237
|
-
/** Human-readable policy name. */
|
|
238
|
-
policy_name?: string;
|
|
266
|
+
/** Custom Cedar annotations. */
|
|
267
|
+
annotations?: Record<string, string>;
|
|
268
|
+
/** Policy domain (e.g. secrets, pii, injection). */
|
|
269
|
+
category?: string;
|
|
239
270
|
/** Cedar effect: permit or forbid. */
|
|
240
271
|
effect?: string;
|
|
241
272
|
/** Policy mode: enforce, monitor, or alert. */
|
|
242
273
|
mode?: string;
|
|
243
|
-
/**
|
|
244
|
-
|
|
274
|
+
/** Database UUID (for dashboard linking). */
|
|
275
|
+
policy_id?: string;
|
|
276
|
+
/** Human-readable policy name. */
|
|
277
|
+
policy_name?: string;
|
|
278
|
+
/** Cedar @id annotation (e.g. secrets-block-prompts). */
|
|
279
|
+
rule_id: string;
|
|
245
280
|
/** From Cedar @severity annotation. */
|
|
246
281
|
severity?: string;
|
|
247
282
|
/** From Cedar @tags annotation. */
|
|
248
283
|
tags?: string[];
|
|
249
|
-
/** Custom Cedar annotations. */
|
|
250
|
-
annotations?: Record<string, string>;
|
|
251
284
|
}
|
|
252
|
-
/**
|
|
285
|
+
/** */
|
|
286
|
+
interface EvaluatedExpression {
|
|
287
|
+
/** Actual value from the context. */
|
|
288
|
+
actual?: Record<string, unknown>;
|
|
289
|
+
/** Child expression (for not nodes). */
|
|
290
|
+
child?: EvaluatedExpression;
|
|
291
|
+
/** Child expressions (for and/or nodes). */
|
|
292
|
+
children?: EvaluatedExpression[];
|
|
293
|
+
/** Expected value (threshold from the rule). */
|
|
294
|
+
expected?: Record<string, unknown>;
|
|
295
|
+
/** Context field name. */
|
|
296
|
+
field?: string;
|
|
297
|
+
/** Expression kind: comparison, contains, like, has, and, or, not, raw. */
|
|
298
|
+
kind: string;
|
|
299
|
+
/** Whether this expression matched. */
|
|
300
|
+
matched: boolean;
|
|
301
|
+
/** Comparison operator. */
|
|
302
|
+
operator?: string;
|
|
303
|
+
/** Like pattern (for like expressions). */
|
|
304
|
+
pattern?: string;
|
|
305
|
+
/** Detector that produced this context value (leaf nodes only). */
|
|
306
|
+
source?: EvidenceSource;
|
|
307
|
+
/** Raw text (for raw expressions). */
|
|
308
|
+
text?: string;
|
|
309
|
+
}
|
|
310
|
+
/** */
|
|
311
|
+
interface PolicyExplanation {
|
|
312
|
+
/** Per-condition match results (flat list from conditions or tree). */
|
|
313
|
+
condition_results: ConditionResult[];
|
|
314
|
+
/** Policy effect: permit or forbid. */
|
|
315
|
+
effect: string;
|
|
316
|
+
/** Recursive evaluated condition tree with actual values. */
|
|
317
|
+
evaluated_expression?: EvaluatedExpression;
|
|
318
|
+
/** Policy ID. */
|
|
319
|
+
policy_id: string;
|
|
320
|
+
/** Raw Cedar condition text (when no structured conditions). */
|
|
321
|
+
raw_condition?: string;
|
|
322
|
+
/** Human-readable explanation summary. */
|
|
323
|
+
summary: string;
|
|
324
|
+
}
|
|
325
|
+
/** */
|
|
326
|
+
interface ExplainedDecision {
|
|
327
|
+
/** Decision effect: Allow or Deny. */
|
|
328
|
+
effect: string;
|
|
329
|
+
/** Enriched explanations for each determining policy. */
|
|
330
|
+
explanations: PolicyExplanation[];
|
|
331
|
+
/** Determining policy IDs with no matching rule in the provided rules. */
|
|
332
|
+
unmatched_policies: string[];
|
|
333
|
+
}
|
|
334
|
+
/** */
|
|
253
335
|
interface GuardRequest {
|
|
254
|
-
/**
|
|
336
|
+
/** Cedar action to authorize (e.g. process_prompt, call_tool, read_file, write_file, connect_server) */
|
|
337
|
+
action: string;
|
|
338
|
+
/** Content to evaluate (prompt text, tool call arguments, file content, etc.) */
|
|
255
339
|
content: string;
|
|
340
|
+
/** Type of content being evaluated */
|
|
256
341
|
content_type: ContentType;
|
|
257
|
-
/**
|
|
258
|
-
|
|
342
|
+
/** Reference material for context-aware detection (hallucination, groundedness). For response evaluation, include the original prompt and any RAG context. */
|
|
343
|
+
contexts?: string[];
|
|
344
|
+
/** Include debug-tier fields: detectors[] (per-detector breakdown), context (raw merged output), debug_info (Cedar eval inputs). Implies explain=true. */
|
|
345
|
+
debug?: boolean;
|
|
259
346
|
/** Specific detectors to run. Empty runs all enabled detectors. */
|
|
260
347
|
detectors?: string[];
|
|
261
|
-
|
|
262
|
-
|
|
348
|
+
/** When true and optimize is true, return the optimization plan without executing detectors or Cedar evaluation. */
|
|
349
|
+
dryrun?: boolean;
|
|
350
|
+
/** Enable early exit on deny after each tier (skips slower tiers) */
|
|
263
351
|
early_exit?: boolean;
|
|
264
|
-
/** Include
|
|
352
|
+
/** Include explain-tier fields: projected_context, eval_latency_ms, tiers_evaluated, tiers_skipped, explanation, root_causes. */
|
|
265
353
|
explain?: boolean;
|
|
266
|
-
/**
|
|
267
|
-
metadata?: Record<string, unknown>;
|
|
268
|
-
/** Reference material for context-aware detection (hallucination, groundedness). */
|
|
269
|
-
contexts?: string[];
|
|
270
|
-
/** Session ID for cross-turn state tracking. */
|
|
271
|
-
session_id?: string;
|
|
272
|
-
tool?: ToolContext;
|
|
273
|
-
model?: ModelContext;
|
|
354
|
+
/** File operation context (path, operation, size) */
|
|
274
355
|
file?: FileContext;
|
|
356
|
+
/** MCP server interaction context */
|
|
275
357
|
mcp?: MCPContext;
|
|
276
|
-
/**
|
|
358
|
+
/** Caller-provided metadata passed through to detectors */
|
|
359
|
+
metadata?: Record<string, unknown>;
|
|
360
|
+
/** enforce: block on deny. monitor: allow + log actual_decision. alert: allow + signal alerting pipeline. */
|
|
361
|
+
mode?: Mode;
|
|
362
|
+
/** LLM model context (provider, temperature, token usage) */
|
|
363
|
+
model?: ModelContext;
|
|
364
|
+
/** When true, only run detectors whose outputs are referenced by active policies for this scope. */
|
|
277
365
|
optimize?: boolean;
|
|
278
|
-
/**
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
|
|
366
|
+
/** Session ID for cross-turn state tracking (enables cumulative risk, action sequences, token budgets) */
|
|
367
|
+
session_id?: string;
|
|
368
|
+
/** Tool call context for agentic evaluation */
|
|
369
|
+
tool?: ToolContext;
|
|
282
370
|
}
|
|
283
|
-
/**
|
|
371
|
+
/** */
|
|
284
372
|
interface OptimizationReport {
|
|
373
|
+
/** Policies matching this action/product scope. */
|
|
374
|
+
active_policies: string[];
|
|
375
|
+
/** True if fell back to running all detectors. */
|
|
376
|
+
fallback_to_all: boolean;
|
|
377
|
+
/** Why this optimization plan was chosen. */
|
|
378
|
+
reason: string;
|
|
285
379
|
/** Context keys required by active policies. */
|
|
286
380
|
required_context_keys: string[];
|
|
287
381
|
/** Detectors required by policies. */
|
|
288
382
|
required_detectors: DetectorPlanEntry[];
|
|
289
383
|
/** Detectors skipped (not required by policies). */
|
|
290
384
|
skipped_detectors: DetectorPlanEntry[];
|
|
291
|
-
/** Policies matching this action/product scope. */
|
|
292
|
-
active_policies: string[];
|
|
293
|
-
/** Why this optimization plan was chosen. */
|
|
294
|
-
reason: string;
|
|
295
|
-
/** True if fell back to running all detectors. */
|
|
296
|
-
fallback_to_all: boolean;
|
|
297
385
|
}
|
|
298
|
-
/**
|
|
386
|
+
/** */
|
|
299
387
|
interface RootCause {
|
|
300
|
-
/** Human-readable summary of the root cause. */
|
|
301
|
-
summary: string;
|
|
302
388
|
/** Detector that triggered. */
|
|
303
389
|
detector: string;
|
|
304
|
-
/** Key-value pairs explaining the threat. */
|
|
305
|
-
labels?: Record<string, string>;
|
|
306
|
-
/** Context values that caused the trigger. */
|
|
307
|
-
triggering_context: Record<string, unknown>;
|
|
308
390
|
/** Supporting evidence. */
|
|
309
391
|
evidence?: Record<string, unknown>;
|
|
392
|
+
/** Key-value pairs explaining the threat. */
|
|
393
|
+
labels?: Record<string, string>;
|
|
394
|
+
/** Human-readable summary of the root cause. */
|
|
395
|
+
summary: string;
|
|
310
396
|
/** Policy IDs triggered by this root cause. */
|
|
311
397
|
triggered_policies: string[];
|
|
398
|
+
/** Context values that caused the trigger. */
|
|
399
|
+
triggering_context: Record<string, unknown>;
|
|
312
400
|
}
|
|
313
|
-
/**
|
|
401
|
+
/** */
|
|
314
402
|
interface SessionDelta {
|
|
315
|
-
/** Updated turn count. */
|
|
316
|
-
turn_count: number;
|
|
317
403
|
/** Updated cumulative risk score (0-100). */
|
|
318
404
|
cumulative_risk: number;
|
|
319
|
-
/** Tokens used in this turn. */
|
|
320
|
-
tokens_used_delta?: number;
|
|
321
405
|
/** Action performed in this turn. */
|
|
322
406
|
new_action?: string;
|
|
407
|
+
/** Tokens used in this turn. */
|
|
408
|
+
tokens_used_delta?: number;
|
|
409
|
+
/** Updated turn count. */
|
|
410
|
+
turn_count: number;
|
|
323
411
|
}
|
|
324
|
-
/**
|
|
412
|
+
/** */
|
|
413
|
+
interface Signal {
|
|
414
|
+
/** Taxonomy domain (e.g. semantic, tools, agent_security). */
|
|
415
|
+
category: string;
|
|
416
|
+
/** Projected context key that triggered this signal. */
|
|
417
|
+
context_key: string;
|
|
418
|
+
/** Human-readable signal name from taxonomy. */
|
|
419
|
+
name: string;
|
|
420
|
+
/** Normalized detection score (0-100). Boolean detectors default to 100. */
|
|
421
|
+
score: number;
|
|
422
|
+
/** Severity from taxonomy: low, medium, high, or critical. */
|
|
423
|
+
severity: string;
|
|
424
|
+
/** Taxonomy vulnerability ID (e.g. prompt_injection, credential_leakage). */
|
|
425
|
+
vulnerability_id: string;
|
|
426
|
+
}
|
|
427
|
+
/** */
|
|
325
428
|
interface GuardResponse {
|
|
326
|
-
decision: Decision;
|
|
327
429
|
/** Cedar decision before mode override. */
|
|
328
430
|
actual_decision?: string;
|
|
329
|
-
/**
|
|
330
|
-
|
|
331
|
-
/** Strictest mode among determining policies. */
|
|
332
|
-
effective_mode?: string;
|
|
431
|
+
/** Authenticated agent identity (when agent request). */
|
|
432
|
+
agent_identity?: AgentIdentityTrace;
|
|
333
433
|
/** True when alert-mode policy fired. */
|
|
334
434
|
alerted?: boolean;
|
|
335
|
-
/**
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
|
|
343
|
-
/** Request trace ID. */
|
|
344
|
-
request_id?: string;
|
|
345
|
-
/** Response timestamp (RFC 3339). */
|
|
346
|
-
timestamp: string;
|
|
435
|
+
/** Merged detector context (when debug=true). */
|
|
436
|
+
context?: Record<string, unknown>;
|
|
437
|
+
/** Cedar evaluation debug info (when debug=true). */
|
|
438
|
+
debug_info?: DebugInfo;
|
|
439
|
+
/** Guard decision: allow or deny. */
|
|
440
|
+
decision: Decision;
|
|
441
|
+
/** Per-detector results (when debug=true). */
|
|
442
|
+
detectors?: DetectorResult[];
|
|
347
443
|
/** Policies that determined the decision. */
|
|
348
444
|
determining_policies?: DeterminingPolicy[];
|
|
349
|
-
/**
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
|
|
353
|
-
/** Total evaluation latency in milliseconds. */
|
|
354
|
-
latency_ms: number;
|
|
445
|
+
/** Strictest mode among determining policies. */
|
|
446
|
+
effective_mode?: string;
|
|
447
|
+
/** Cedar diagnostic errors (rare). */
|
|
448
|
+
eval_errors?: string;
|
|
355
449
|
/** Cedar evaluation latency in milliseconds. */
|
|
356
450
|
eval_latency_ms?: number;
|
|
357
|
-
/** Detector tiers that ran (fast, standard, slow). */
|
|
358
|
-
tiers_evaluated: string[];
|
|
359
|
-
/** Detector tiers skipped due to early exit. */
|
|
360
|
-
tiers_skipped?: string[];
|
|
361
|
-
session_delta?: SessionDelta;
|
|
362
|
-
agent_identity?: AgentIdentityTrace;
|
|
363
451
|
/** Structured policy explanation (when explain=true). */
|
|
364
|
-
explanation?:
|
|
452
|
+
explanation?: ExplainedDecision;
|
|
453
|
+
/** Total evaluation latency in milliseconds. */
|
|
454
|
+
latency_ms: number;
|
|
455
|
+
/** True if decision was changed by per-policy mode. */
|
|
456
|
+
mode_overridden?: boolean;
|
|
457
|
+
/** Mode override explanation (monitor/alert). */
|
|
458
|
+
mode_reason?: string;
|
|
459
|
+
/** Detector optimization plan (when optimize=true). */
|
|
460
|
+
optimization?: OptimizationReport;
|
|
461
|
+
/** Human-readable policy decision reasoning. */
|
|
462
|
+
policy_reason?: string;
|
|
463
|
+
/** Cedar-normalized context sent to the evaluator (when explain=true). */
|
|
464
|
+
projected_context?: Record<string, unknown>;
|
|
465
|
+
/** Request trace ID. */
|
|
466
|
+
request_id: string;
|
|
365
467
|
/** Root cause analysis for triggered detections. */
|
|
366
468
|
root_causes?: RootCause[];
|
|
367
|
-
/**
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
469
|
+
/** Session state changes after evaluation. */
|
|
470
|
+
session_delta?: SessionDelta;
|
|
471
|
+
/** Taxonomy-aligned detection signals. Always populated when detectors fire above threshold, sorted by severity. */
|
|
472
|
+
signals: Signal[];
|
|
473
|
+
/** Detector tiers that ran (fast, standard, slow). */
|
|
474
|
+
tiers_evaluated?: string[];
|
|
475
|
+
/** Detector tiers skipped due to early exit. */
|
|
476
|
+
tiers_skipped?: string[];
|
|
477
|
+
/** Response timestamp (RFC 3339). */
|
|
478
|
+
timestamp: string;
|
|
371
479
|
}
|
|
372
|
-
/**
|
|
480
|
+
/** */
|
|
373
481
|
interface HealthResponse {
|
|
374
|
-
/**
|
|
375
|
-
status: "healthy" | "degraded";
|
|
376
|
-
/** Per-detector health status. */
|
|
482
|
+
/** Per-detector health status (healthy, degraded, or error) */
|
|
377
483
|
detectors?: Record<string, string>;
|
|
378
|
-
/** Cedar evaluator status
|
|
484
|
+
/** Cedar evaluator status */
|
|
379
485
|
evaluator?: "ready" | "no_policies";
|
|
486
|
+
/** Overall health status */
|
|
487
|
+
status: "healthy" | "degraded";
|
|
380
488
|
}
|
|
381
|
-
/**
|
|
489
|
+
/** */
|
|
382
490
|
interface ListDetectorsResponse {
|
|
383
|
-
/**
|
|
384
|
-
detectors: DetectorInfo[];
|
|
385
|
-
/** Total number of registered detectors. */
|
|
491
|
+
/** Total number of registered detectors */
|
|
386
492
|
count: number;
|
|
493
|
+
/** Available detectors with name, version, tier, context keys, and health status */
|
|
494
|
+
detectors: DetectorInfo[];
|
|
387
495
|
}
|
|
388
496
|
/** RFC 9457 Problem Details error format. */
|
|
389
497
|
interface ProblemDetails {
|
|
498
|
+
/** Detailed error message. */
|
|
499
|
+
detail?: string;
|
|
390
500
|
/** HTTP status code. */
|
|
391
501
|
status: number;
|
|
392
502
|
/** Short error title. */
|
|
393
503
|
title: string;
|
|
394
|
-
/** Detailed error message. */
|
|
395
|
-
detail?: string;
|
|
396
504
|
}
|
|
397
505
|
/** A Server-Sent Event from the guard stream. */
|
|
398
506
|
interface StreamEvent {
|
|
399
|
-
/** Event type: detector_result (per-detector), decision (final), or error. */
|
|
400
|
-
type: "detector_result" | "decision" | "error";
|
|
401
507
|
/** Event payload (DetectorResult for detector_result, GuardResponse for decision). */
|
|
402
508
|
data: Record<string, unknown>;
|
|
509
|
+
/** Event type: detector_result (per-detector), decision (final), or error. */
|
|
510
|
+
type: "detector_result" | "decision" | "error";
|
|
403
511
|
}
|
|
404
512
|
/** Response from the token exchange endpoint (used by SDK auth). */
|
|
405
513
|
interface TokenResponse {
|
|
406
514
|
/** RS256 JWT token. */
|
|
407
515
|
access_token: string;
|
|
408
|
-
/** Token type (always Bearer). */
|
|
409
|
-
token_type?: string;
|
|
410
|
-
/** Token lifetime in seconds. */
|
|
411
|
-
expires_in: number;
|
|
412
516
|
/** Account ID from token claims. */
|
|
413
517
|
account_id?: string;
|
|
518
|
+
/** Token lifetime in seconds. */
|
|
519
|
+
expires_in: number;
|
|
414
520
|
/** Gateway ID from token claims. */
|
|
415
521
|
gateway_id?: string;
|
|
416
522
|
/** Project ID from token claims. */
|
|
417
523
|
project_id?: string;
|
|
524
|
+
/** Token type (always Bearer). */
|
|
525
|
+
token_type?: string;
|
|
418
526
|
}
|
|
419
527
|
|
|
420
528
|
/**
|
|
@@ -641,4 +749,4 @@ declare class Shield {
|
|
|
641
749
|
wrap(options: WrapOptions): <TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => TReturn | Promise<TReturn>) => (...args: TArgs) => Promise<Awaited<TReturn>>;
|
|
642
750
|
}
|
|
643
751
|
|
|
644
|
-
export { APIConnectionError, APIError, type AgentIdentityTrace, AuthenticationError, BlockedError, type ContentType, type ContextKeySpec, type DebugInfo, type DebugPoliciesResponse, DebugResource, type Decision, type DetectRequest, DetectResource, type DetectResponse, type DetectorInfo, type DetectorResult, DetectorsResource, type DeterminingPolicy, type FileContext, type GuardRequest, GuardResource, type GuardResponse, type HealthResponse, Highflame, HighflameError, type HighflameOptions, type ListDetectorsResponse, type Logger, type MCPContext, type Mode, type ModelContext, type ModelResponseOptions, type OptimizationReport, type PolicySummary, type ProblemDetails, type PromptOptions, RateLimitError, type RequestOptions, type RootCause, type SessionDelta, Shield, type StreamEvent, type TokenResponse, type ToolContext, type ToolOptions, type ToolResponseOptions, VERSION, type WrapOptions };
|
|
752
|
+
export { APIConnectionError, APIError, type AgentIdentityTrace, AuthenticationError, BlockedError, type ContentType, type ContextKeySpec, type DebugInfo, type DebugPoliciesResponse, DebugResource, type Decision, type DetectRequest, DetectResource, type DetectResponse, type DetectorInfo, type DetectorResult, DetectorsResource, type DeterminingPolicy, type FileContext, type GuardRequest, GuardResource, type GuardResponse, type HealthResponse, Highflame, HighflameError, type HighflameOptions, type ListDetectorsResponse, type Logger, type MCPContext, type Mode, type ModelContext, type ModelResponseOptions, type OptimizationReport, type PolicySummary, type ProblemDetails, type PromptOptions, RateLimitError, type RequestOptions, type RootCause, type SessionDelta, Shield, type Signal, type StreamEvent, type TokenResponse, type ToolContext, type ToolOptions, type ToolResponseOptions, VERSION, type WrapOptions };
|