@handlebar/governance-schema 0.1.0 → 0.1.1-beta.0
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/audit/events.base.d.ts +2 -0
- package/dist/audit/events.d.ts +74 -0
- package/dist/audit/events.llm.d.ts +4 -0
- package/dist/audit/events.tools.d.ts +32 -0
- package/dist/audit/governance-actions.d.ts +63 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +55 -5
- package/dist/rules/rule.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,8 @@ export declare const AuditEnvelopeSchema: z.ZodObject<{
|
|
|
6
6
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
7
7
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
8
8
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
9
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
9
11
|
otel: z.ZodOptional<z.ZodObject<{
|
|
10
12
|
traceId: z.ZodOptional<z.ZodString>;
|
|
11
13
|
spanId: z.ZodOptional<z.ZodString>;
|
package/dist/audit/events.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export declare const RunStartedEventSchema: z.ZodObject<{
|
|
|
6
6
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
7
7
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
8
8
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
9
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
9
11
|
otel: z.ZodOptional<z.ZodObject<{
|
|
10
12
|
traceId: z.ZodOptional<z.ZodString>;
|
|
11
13
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -44,6 +46,16 @@ export declare const RunStartedEventSchema: z.ZodObject<{
|
|
|
44
46
|
name: z.ZodOptional<z.ZodString>;
|
|
45
47
|
}, z.core.$strip>>;
|
|
46
48
|
}, z.core.$strip>>;
|
|
49
|
+
actor: z.ZodOptional<z.ZodObject<{
|
|
50
|
+
externalId: z.ZodString;
|
|
51
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
52
|
+
name: z.ZodOptional<z.ZodString>;
|
|
53
|
+
group: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
externalId: z.ZodString;
|
|
55
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
56
|
+
name: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
47
59
|
model: z.ZodOptional<z.ZodObject<{
|
|
48
60
|
provider: z.ZodOptional<z.ZodString>;
|
|
49
61
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -70,6 +82,8 @@ export declare const RunEndedEventSchema: z.ZodObject<{
|
|
|
70
82
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
71
83
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
72
84
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
85
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
86
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
73
87
|
otel: z.ZodOptional<z.ZodObject<{
|
|
74
88
|
traceId: z.ZodOptional<z.ZodString>;
|
|
75
89
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -88,9 +102,12 @@ export declare const RunEndedEventSchema: z.ZodObject<{
|
|
|
88
102
|
kind: z.ZodLiteral<"run.ended">;
|
|
89
103
|
data: z.ZodObject<{
|
|
90
104
|
status: z.ZodEnum<{
|
|
105
|
+
success: "success";
|
|
91
106
|
error: "error";
|
|
92
107
|
ok: "ok";
|
|
93
108
|
blocked: "blocked";
|
|
109
|
+
timeout: "timeout";
|
|
110
|
+
interrupted: "interrupted";
|
|
94
111
|
}>;
|
|
95
112
|
totalSteps: z.ZodNumber;
|
|
96
113
|
firstErrorDecisionId: z.ZodOptional<z.ZodString>;
|
|
@@ -104,6 +121,8 @@ export declare const ErrorEventSchema: z.ZodObject<{
|
|
|
104
121
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
105
122
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
106
123
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
124
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
125
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
107
126
|
otel: z.ZodOptional<z.ZodObject<{
|
|
108
127
|
traceId: z.ZodOptional<z.ZodString>;
|
|
109
128
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -139,6 +158,8 @@ export declare const AuditEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
139
158
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
140
159
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
141
160
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
161
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
162
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
142
163
|
otel: z.ZodOptional<z.ZodObject<{
|
|
143
164
|
traceId: z.ZodOptional<z.ZodString>;
|
|
144
165
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -177,6 +198,16 @@ export declare const AuditEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
177
198
|
name: z.ZodOptional<z.ZodString>;
|
|
178
199
|
}, z.core.$strip>>;
|
|
179
200
|
}, z.core.$strip>>;
|
|
201
|
+
actor: z.ZodOptional<z.ZodObject<{
|
|
202
|
+
externalId: z.ZodString;
|
|
203
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
204
|
+
name: z.ZodOptional<z.ZodString>;
|
|
205
|
+
group: z.ZodOptional<z.ZodObject<{
|
|
206
|
+
externalId: z.ZodString;
|
|
207
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
208
|
+
name: z.ZodOptional<z.ZodString>;
|
|
209
|
+
}, z.core.$strip>>;
|
|
210
|
+
}, z.core.$strip>>;
|
|
180
211
|
model: z.ZodOptional<z.ZodObject<{
|
|
181
212
|
provider: z.ZodOptional<z.ZodString>;
|
|
182
213
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -202,6 +233,8 @@ export declare const AuditEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
202
233
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
203
234
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
204
235
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
236
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
237
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
205
238
|
otel: z.ZodOptional<z.ZodObject<{
|
|
206
239
|
traceId: z.ZodOptional<z.ZodString>;
|
|
207
240
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -266,6 +299,34 @@ export declare const AuditEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
266
299
|
}, z.core.$strip>>>;
|
|
267
300
|
counters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
268
301
|
latencyMs: z.ZodOptional<z.ZodNumber>;
|
|
302
|
+
verdict: z.ZodOptional<z.ZodEnum<{
|
|
303
|
+
ALLOW: "ALLOW";
|
|
304
|
+
BLOCK: "BLOCK";
|
|
305
|
+
}>>;
|
|
306
|
+
control: z.ZodOptional<z.ZodEnum<{
|
|
307
|
+
CONTINUE: "CONTINUE";
|
|
308
|
+
TERMINATE: "TERMINATE";
|
|
309
|
+
}>>;
|
|
310
|
+
cause: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
311
|
+
kind: z.ZodLiteral<"ALLOW">;
|
|
312
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
313
|
+
kind: z.ZodLiteral<"RULE_VIOLATION">;
|
|
314
|
+
ruleId: z.ZodString;
|
|
315
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
316
|
+
kind: z.ZodLiteral<"HITL_PENDING">;
|
|
317
|
+
approvalId: z.ZodString;
|
|
318
|
+
ruleId: z.ZodOptional<z.ZodString>;
|
|
319
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
320
|
+
kind: z.ZodLiteral<"LOCKDOWN">;
|
|
321
|
+
lockdownId: z.ZodOptional<z.ZodString>;
|
|
322
|
+
}, z.core.$strip>], "kind">>;
|
|
323
|
+
evaluatedRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
324
|
+
ruleId: z.ZodString;
|
|
325
|
+
enabled: z.ZodBoolean;
|
|
326
|
+
matched: z.ZodBoolean;
|
|
327
|
+
violated: z.ZodBoolean;
|
|
328
|
+
}, z.core.$strip>>>;
|
|
329
|
+
finalRuleId: z.ZodOptional<z.ZodString>;
|
|
269
330
|
}, z.core.$strip>;
|
|
270
331
|
}, z.core.$strip>, z.ZodObject<{
|
|
271
332
|
schema: z.ZodLiteral<"handlebar.audit.v1">;
|
|
@@ -274,6 +335,8 @@ export declare const AuditEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
274
335
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
275
336
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
276
337
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
338
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
339
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
277
340
|
otel: z.ZodOptional<z.ZodObject<{
|
|
278
341
|
traceId: z.ZodOptional<z.ZodString>;
|
|
279
342
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -353,6 +416,8 @@ export declare const AuditEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
353
416
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
354
417
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
355
418
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
419
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
420
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
356
421
|
otel: z.ZodOptional<z.ZodObject<{
|
|
357
422
|
traceId: z.ZodOptional<z.ZodString>;
|
|
358
423
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -371,9 +436,12 @@ export declare const AuditEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
371
436
|
kind: z.ZodLiteral<"run.ended">;
|
|
372
437
|
data: z.ZodObject<{
|
|
373
438
|
status: z.ZodEnum<{
|
|
439
|
+
success: "success";
|
|
374
440
|
error: "error";
|
|
375
441
|
ok: "ok";
|
|
376
442
|
blocked: "blocked";
|
|
443
|
+
timeout: "timeout";
|
|
444
|
+
interrupted: "interrupted";
|
|
377
445
|
}>;
|
|
378
446
|
totalSteps: z.ZodNumber;
|
|
379
447
|
firstErrorDecisionId: z.ZodOptional<z.ZodString>;
|
|
@@ -386,6 +454,8 @@ export declare const AuditEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
386
454
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
387
455
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
388
456
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
457
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
458
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
389
459
|
otel: z.ZodOptional<z.ZodObject<{
|
|
390
460
|
traceId: z.ZodOptional<z.ZodString>;
|
|
391
461
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -420,6 +490,8 @@ export declare const AuditEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
420
490
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
421
491
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
422
492
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
493
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
494
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
423
495
|
otel: z.ZodOptional<z.ZodObject<{
|
|
424
496
|
traceId: z.ZodOptional<z.ZodString>;
|
|
425
497
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -473,6 +545,8 @@ export declare const AuditEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
473
545
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
474
546
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
475
547
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
548
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
549
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
476
550
|
otel: z.ZodOptional<z.ZodObject<{
|
|
477
551
|
traceId: z.ZodOptional<z.ZodString>;
|
|
478
552
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -58,6 +58,8 @@ export declare const MessageEventSchema: z.ZodObject<{
|
|
|
58
58
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
59
59
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
60
60
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
61
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
62
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
61
63
|
otel: z.ZodOptional<z.ZodObject<{
|
|
62
64
|
traceId: z.ZodOptional<z.ZodString>;
|
|
63
65
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -112,6 +114,8 @@ export declare const LLMResultEventSchema: z.ZodObject<{
|
|
|
112
114
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
113
115
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
114
116
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
117
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
118
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
115
119
|
otel: z.ZodOptional<z.ZodObject<{
|
|
116
120
|
traceId: z.ZodOptional<z.ZodString>;
|
|
117
121
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -22,6 +22,8 @@ export declare const ToolDecisionEventSchema: z.ZodObject<{
|
|
|
22
22
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
23
23
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
24
24
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
25
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
26
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
25
27
|
otel: z.ZodOptional<z.ZodObject<{
|
|
26
28
|
traceId: z.ZodOptional<z.ZodString>;
|
|
27
29
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -86,6 +88,34 @@ export declare const ToolDecisionEventSchema: z.ZodObject<{
|
|
|
86
88
|
}, z.core.$strip>>>;
|
|
87
89
|
counters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
88
90
|
latencyMs: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
verdict: z.ZodOptional<z.ZodEnum<{
|
|
92
|
+
ALLOW: "ALLOW";
|
|
93
|
+
BLOCK: "BLOCK";
|
|
94
|
+
}>>;
|
|
95
|
+
control: z.ZodOptional<z.ZodEnum<{
|
|
96
|
+
CONTINUE: "CONTINUE";
|
|
97
|
+
TERMINATE: "TERMINATE";
|
|
98
|
+
}>>;
|
|
99
|
+
cause: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
100
|
+
kind: z.ZodLiteral<"ALLOW">;
|
|
101
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
102
|
+
kind: z.ZodLiteral<"RULE_VIOLATION">;
|
|
103
|
+
ruleId: z.ZodString;
|
|
104
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
105
|
+
kind: z.ZodLiteral<"HITL_PENDING">;
|
|
106
|
+
approvalId: z.ZodString;
|
|
107
|
+
ruleId: z.ZodOptional<z.ZodString>;
|
|
108
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
109
|
+
kind: z.ZodLiteral<"LOCKDOWN">;
|
|
110
|
+
lockdownId: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strip>], "kind">>;
|
|
112
|
+
evaluatedRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
113
|
+
ruleId: z.ZodString;
|
|
114
|
+
enabled: z.ZodBoolean;
|
|
115
|
+
matched: z.ZodBoolean;
|
|
116
|
+
violated: z.ZodBoolean;
|
|
117
|
+
}, z.core.$strip>>>;
|
|
118
|
+
finalRuleId: z.ZodOptional<z.ZodString>;
|
|
89
119
|
}, z.core.$strip>;
|
|
90
120
|
}, z.core.$strip>;
|
|
91
121
|
export declare const ToolResultEventSchema: z.ZodObject<{
|
|
@@ -95,6 +125,8 @@ export declare const ToolResultEventSchema: z.ZodObject<{
|
|
|
95
125
|
stepIndex: z.ZodOptional<z.ZodNumber>;
|
|
96
126
|
decisionId: z.ZodOptional<z.ZodString>;
|
|
97
127
|
enduserExternalId: z.ZodOptional<z.ZodString>;
|
|
128
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
129
|
+
actorExternalId: z.ZodOptional<z.ZodString>;
|
|
98
130
|
otel: z.ZodOptional<z.ZodObject<{
|
|
99
131
|
traceId: z.ZodOptional<z.ZodString>;
|
|
100
132
|
spanId: z.ZodOptional<z.ZodString>;
|
|
@@ -1,4 +1,67 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const VerdictSchema: z.ZodEnum<{
|
|
3
|
+
ALLOW: "ALLOW";
|
|
4
|
+
BLOCK: "BLOCK";
|
|
5
|
+
}>;
|
|
6
|
+
export type Verdict = z.infer<typeof VerdictSchema>;
|
|
7
|
+
export declare const RunControlSchema: z.ZodEnum<{
|
|
8
|
+
CONTINUE: "CONTINUE";
|
|
9
|
+
TERMINATE: "TERMINATE";
|
|
10
|
+
}>;
|
|
11
|
+
export type RunControl = z.infer<typeof RunControlSchema>;
|
|
12
|
+
export declare const DecisionCauseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
13
|
+
kind: z.ZodLiteral<"ALLOW">;
|
|
14
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
15
|
+
kind: z.ZodLiteral<"RULE_VIOLATION">;
|
|
16
|
+
ruleId: z.ZodString;
|
|
17
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
18
|
+
kind: z.ZodLiteral<"HITL_PENDING">;
|
|
19
|
+
approvalId: z.ZodString;
|
|
20
|
+
ruleId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
22
|
+
kind: z.ZodLiteral<"LOCKDOWN">;
|
|
23
|
+
lockdownId: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>], "kind">;
|
|
25
|
+
export type DecisionCause = z.infer<typeof DecisionCauseSchema>;
|
|
26
|
+
export declare const RuleEvalSchema: z.ZodObject<{
|
|
27
|
+
ruleId: z.ZodString;
|
|
28
|
+
enabled: z.ZodBoolean;
|
|
29
|
+
matched: z.ZodBoolean;
|
|
30
|
+
violated: z.ZodBoolean;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export type RuleEval = z.infer<typeof RuleEvalSchema>;
|
|
33
|
+
export declare const DecisionSchema: z.ZodObject<{
|
|
34
|
+
verdict: z.ZodEnum<{
|
|
35
|
+
ALLOW: "ALLOW";
|
|
36
|
+
BLOCK: "BLOCK";
|
|
37
|
+
}>;
|
|
38
|
+
control: z.ZodEnum<{
|
|
39
|
+
CONTINUE: "CONTINUE";
|
|
40
|
+
TERMINATE: "TERMINATE";
|
|
41
|
+
}>;
|
|
42
|
+
cause: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
43
|
+
kind: z.ZodLiteral<"ALLOW">;
|
|
44
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
45
|
+
kind: z.ZodLiteral<"RULE_VIOLATION">;
|
|
46
|
+
ruleId: z.ZodString;
|
|
47
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
48
|
+
kind: z.ZodLiteral<"HITL_PENDING">;
|
|
49
|
+
approvalId: z.ZodString;
|
|
50
|
+
ruleId: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
52
|
+
kind: z.ZodLiteral<"LOCKDOWN">;
|
|
53
|
+
lockdownId: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, z.core.$strip>], "kind">;
|
|
55
|
+
message: z.ZodString;
|
|
56
|
+
evaluatedRules: z.ZodArray<z.ZodObject<{
|
|
57
|
+
ruleId: z.ZodString;
|
|
58
|
+
enabled: z.ZodBoolean;
|
|
59
|
+
matched: z.ZodBoolean;
|
|
60
|
+
violated: z.ZodBoolean;
|
|
61
|
+
}, z.core.$strip>>;
|
|
62
|
+
finalRuleId: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export type Decision = z.infer<typeof DecisionSchema>;
|
|
2
65
|
export declare const SignalSchema: z.ZodObject<{
|
|
3
66
|
key: z.ZodString;
|
|
4
67
|
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./audit/events.base";
|
|
|
3
3
|
export * from "./audit/events.llm";
|
|
4
4
|
export * from "./audit/events.tools";
|
|
5
5
|
export * from "./audit/governance-actions";
|
|
6
|
+
export type { Decision, DecisionCause, RuleEval, RunControl, Verdict, } from "./audit/governance-actions";
|
|
6
7
|
export * from "./audit/run-metrics";
|
|
7
8
|
export type { EndUserConfig, EndUserGroupConfig } from "./enduser.types";
|
|
8
9
|
export { AgentSelectorSchema, PolicySpecSchema } from "./policies";
|
package/dist/index.js
CHANGED
|
@@ -13568,6 +13568,8 @@ var AuditEnvelopeSchema = exports_external.object({
|
|
|
13568
13568
|
stepIndex: exports_external.number().min(0).optional(),
|
|
13569
13569
|
decisionId: exports_external.string().optional(),
|
|
13570
13570
|
enduserExternalId: exports_external.string().optional(),
|
|
13571
|
+
sessionId: exports_external.string().optional(),
|
|
13572
|
+
actorExternalId: exports_external.string().optional(),
|
|
13571
13573
|
otel: exports_external.object({
|
|
13572
13574
|
traceId: exports_external.string().optional(),
|
|
13573
13575
|
spanId: exports_external.string().optional()
|
|
@@ -13638,6 +13640,35 @@ var LLMResultEventSchema = AuditEnvelopeSchema.extend({
|
|
|
13638
13640
|
});
|
|
13639
13641
|
|
|
13640
13642
|
// src/audit/governance-actions.ts
|
|
13643
|
+
var VerdictSchema = exports_external.enum(["ALLOW", "BLOCK"]);
|
|
13644
|
+
var RunControlSchema = exports_external.enum(["CONTINUE", "TERMINATE"]);
|
|
13645
|
+
var DecisionCauseSchema = exports_external.discriminatedUnion("kind", [
|
|
13646
|
+
exports_external.object({ kind: exports_external.literal("ALLOW") }),
|
|
13647
|
+
exports_external.object({ kind: exports_external.literal("RULE_VIOLATION"), ruleId: exports_external.string() }),
|
|
13648
|
+
exports_external.object({
|
|
13649
|
+
kind: exports_external.literal("HITL_PENDING"),
|
|
13650
|
+
approvalId: exports_external.string(),
|
|
13651
|
+
ruleId: exports_external.string().optional()
|
|
13652
|
+
}),
|
|
13653
|
+
exports_external.object({
|
|
13654
|
+
kind: exports_external.literal("LOCKDOWN"),
|
|
13655
|
+
lockdownId: exports_external.string().optional()
|
|
13656
|
+
})
|
|
13657
|
+
]);
|
|
13658
|
+
var RuleEvalSchema = exports_external.object({
|
|
13659
|
+
ruleId: exports_external.string(),
|
|
13660
|
+
enabled: exports_external.boolean(),
|
|
13661
|
+
matched: exports_external.boolean(),
|
|
13662
|
+
violated: exports_external.boolean()
|
|
13663
|
+
});
|
|
13664
|
+
var DecisionSchema = exports_external.object({
|
|
13665
|
+
verdict: VerdictSchema,
|
|
13666
|
+
control: RunControlSchema,
|
|
13667
|
+
cause: DecisionCauseSchema,
|
|
13668
|
+
message: exports_external.string(),
|
|
13669
|
+
evaluatedRules: exports_external.array(RuleEvalSchema),
|
|
13670
|
+
finalRuleId: exports_external.string().optional()
|
|
13671
|
+
});
|
|
13641
13672
|
var SignalSchema = exports_external.object({
|
|
13642
13673
|
key: exports_external.string().max(256),
|
|
13643
13674
|
args: exports_external.array(exports_external.string().max(256)).max(100).optional(),
|
|
@@ -13715,7 +13746,12 @@ var ToolDecisionEventSchema = AuditEnvelopeSchema.extend({
|
|
|
13715
13746
|
subjects: zod_default.array(SubjectSchema).max(100).optional(),
|
|
13716
13747
|
signals: zod_default.array(SignalSchema).max(100).optional(),
|
|
13717
13748
|
counters: CountersSchema.optional(),
|
|
13718
|
-
latencyMs: zod_default.number().min(0).optional()
|
|
13749
|
+
latencyMs: zod_default.number().min(0).optional(),
|
|
13750
|
+
verdict: VerdictSchema.optional(),
|
|
13751
|
+
control: RunControlSchema.optional(),
|
|
13752
|
+
cause: DecisionCauseSchema.optional(),
|
|
13753
|
+
evaluatedRules: zod_default.array(RuleEvalSchema).optional(),
|
|
13754
|
+
finalRuleId: zod_default.string().optional()
|
|
13719
13755
|
})
|
|
13720
13756
|
});
|
|
13721
13757
|
var ToolResultEventSchema = AuditEnvelopeSchema.extend({
|
|
@@ -13742,6 +13778,9 @@ var ToolResultEventSchema = AuditEnvelopeSchema.extend({
|
|
|
13742
13778
|
});
|
|
13743
13779
|
|
|
13744
13780
|
// src/audit/events.ts
|
|
13781
|
+
var ActorSchema = EndUserConfigSchema.extend({
|
|
13782
|
+
group: EndUserGroupConfigSchema.optional()
|
|
13783
|
+
});
|
|
13745
13784
|
var RunStartedEventSchema = AuditEnvelopeSchema.extend({
|
|
13746
13785
|
kind: exports_external.literal("run.started"),
|
|
13747
13786
|
data: exports_external.object({
|
|
@@ -13752,9 +13791,8 @@ var RunStartedEventSchema = AuditEnvelopeSchema.extend({
|
|
|
13752
13791
|
id: exports_external.string().optional(),
|
|
13753
13792
|
name: exports_external.string().optional()
|
|
13754
13793
|
}),
|
|
13755
|
-
enduser:
|
|
13756
|
-
|
|
13757
|
-
}).optional(),
|
|
13794
|
+
enduser: ActorSchema.optional(),
|
|
13795
|
+
actor: ActorSchema.optional(),
|
|
13758
13796
|
model: exports_external.object({
|
|
13759
13797
|
provider: exports_external.string().optional(),
|
|
13760
13798
|
name: exports_external.string().optional()
|
|
@@ -13777,7 +13815,14 @@ var RunStartedEventSchema = AuditEnvelopeSchema.extend({
|
|
|
13777
13815
|
var RunEndedEventSchema = AuditEnvelopeSchema.extend({
|
|
13778
13816
|
kind: exports_external.literal("run.ended"),
|
|
13779
13817
|
data: exports_external.object({
|
|
13780
|
-
status: exports_external.enum([
|
|
13818
|
+
status: exports_external.enum([
|
|
13819
|
+
"ok",
|
|
13820
|
+
"error",
|
|
13821
|
+
"blocked",
|
|
13822
|
+
"success",
|
|
13823
|
+
"timeout",
|
|
13824
|
+
"interrupted"
|
|
13825
|
+
]),
|
|
13781
13826
|
totalSteps: exports_external.number().min(0),
|
|
13782
13827
|
firstErrorDecisionId: exports_external.string().optional(),
|
|
13783
13828
|
summary: exports_external.string().optional()
|
|
@@ -14068,14 +14113,17 @@ var RuleSpecSchema = RuleSchema.omit({
|
|
|
14068
14113
|
policyId: true
|
|
14069
14114
|
}).describe("Definable Rule spec that can be inserted into Handlebar API");
|
|
14070
14115
|
export {
|
|
14116
|
+
VerdictSchema,
|
|
14071
14117
|
ToolResultEventSchema,
|
|
14072
14118
|
ToolDecisionEventSchema,
|
|
14073
14119
|
SubjectSchema,
|
|
14074
14120
|
SignalSchema,
|
|
14075
14121
|
RunStartedEventSchema,
|
|
14076
14122
|
RunEndedEventSchema,
|
|
14123
|
+
RunControlSchema,
|
|
14077
14124
|
RuleSpecSchema,
|
|
14078
14125
|
RuleSchema,
|
|
14126
|
+
RuleEvalSchema,
|
|
14079
14127
|
PolicySpecSchema,
|
|
14080
14128
|
MessageSchema,
|
|
14081
14129
|
MessageRoleSchema,
|
|
@@ -14086,6 +14134,8 @@ export {
|
|
|
14086
14134
|
HitlMetaSchema,
|
|
14087
14135
|
GovernanceDecisionSchema,
|
|
14088
14136
|
ErrorEventSchema,
|
|
14137
|
+
DecisionSchema,
|
|
14138
|
+
DecisionCauseSchema,
|
|
14089
14139
|
CustomAgentMetricKind,
|
|
14090
14140
|
AuditEventSchema,
|
|
14091
14141
|
AuditEnvelopeSchema,
|
package/dist/rules/rule.d.ts
CHANGED
|
@@ -950,6 +950,7 @@ export declare const RuleSchema: z.ZodObject<{
|
|
|
950
950
|
export type Rule = z.infer<typeof RuleSchema>;
|
|
951
951
|
export declare const RuleSpecSchema: z.ZodObject<{
|
|
952
952
|
name: z.ZodString;
|
|
953
|
+
enabled: z.ZodBoolean;
|
|
953
954
|
effect: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
954
955
|
type: z.ZodLiteral<"allow">;
|
|
955
956
|
reason: z.ZodOptional<z.ZodString>;
|
|
@@ -960,7 +961,6 @@ export declare const RuleSpecSchema: z.ZodObject<{
|
|
|
960
961
|
type: z.ZodLiteral<"block">;
|
|
961
962
|
reason: z.ZodOptional<z.ZodString>;
|
|
962
963
|
}, z.core.$strict>], "type">;
|
|
963
|
-
enabled: z.ZodBoolean;
|
|
964
964
|
onMissing: z.ZodOptional<z.ZodEnum<{
|
|
965
965
|
allow: "allow";
|
|
966
966
|
block: "block";
|