@handlebar/governance-schema 0.0.6-dev.9 → 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 +92 -1521
- package/dist/audit/events.llm.d.ts +18 -1521
- package/dist/audit/events.tools.d.ts +36 -0
- package/dist/audit/governance-actions.d.ts +63 -0
- package/dist/audit/run-metrics.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +64 -16
- package/dist/rules/condition.d.ts +21 -0
- package/dist/rules/metrics.d.ts +6 -0
- package/dist/rules/rule.d.ts +25 -1
- package/package.json +1 -1
|
@@ -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>;
|
|
@@ -139,6 +171,9 @@ export declare const ToolResultEventSchema: z.ZodObject<{
|
|
|
139
171
|
duration_ms: "duration_ms";
|
|
140
172
|
records_in: "records_in";
|
|
141
173
|
records_out: "records_out";
|
|
174
|
+
llm_tokens_in: "llm_tokens_in";
|
|
175
|
+
llm_tokens_out: "llm_tokens_out";
|
|
176
|
+
llm_cost_usd: "llm_cost_usd";
|
|
142
177
|
}> & z.core.$partial, z.ZodObject<{
|
|
143
178
|
value: z.ZodNumber;
|
|
144
179
|
unit: z.ZodOptional<z.ZodString>;
|
|
@@ -161,6 +196,7 @@ export declare const ToolResultEventSchema: z.ZodObject<{
|
|
|
161
196
|
debug: z.ZodOptional<z.ZodObject<{
|
|
162
197
|
approxTokens: z.ZodOptional<z.ZodNumber>;
|
|
163
198
|
chars: z.ZodOptional<z.ZodNumber>;
|
|
199
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
164
200
|
}, z.core.$strip>>;
|
|
165
201
|
}, z.core.$strip>;
|
|
166
202
|
}, z.core.$strip>;
|
|
@@ -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>>;
|
|
@@ -5,6 +5,9 @@ export declare const InbuiltAgentMetricKind: z.ZodEnum<{
|
|
|
5
5
|
duration_ms: "duration_ms";
|
|
6
6
|
records_in: "records_in";
|
|
7
7
|
records_out: "records_out";
|
|
8
|
+
llm_tokens_in: "llm_tokens_in";
|
|
9
|
+
llm_tokens_out: "llm_tokens_out";
|
|
10
|
+
llm_cost_usd: "llm_cost_usd";
|
|
8
11
|
}>;
|
|
9
12
|
export declare const CustomAgentMetricKind: z.ZodString;
|
|
10
13
|
export declare const AgentMetrics: z.ZodObject<{
|
|
@@ -14,6 +17,9 @@ export declare const AgentMetrics: z.ZodObject<{
|
|
|
14
17
|
duration_ms: "duration_ms";
|
|
15
18
|
records_in: "records_in";
|
|
16
19
|
records_out: "records_out";
|
|
20
|
+
llm_tokens_in: "llm_tokens_in";
|
|
21
|
+
llm_tokens_out: "llm_tokens_out";
|
|
22
|
+
llm_cost_usd: "llm_cost_usd";
|
|
17
23
|
}> & z.core.$partial, z.ZodObject<{
|
|
18
24
|
value: z.ZodNumber;
|
|
19
25
|
unit: z.ZodOptional<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()
|
|
@@ -13611,7 +13613,7 @@ var MessageSchema = exports_external.object({
|
|
|
13611
13613
|
});
|
|
13612
13614
|
var MessageEventSchema = AuditEnvelopeSchema.extend({
|
|
13613
13615
|
kind: exports_external.literal("message.raw.created"),
|
|
13614
|
-
data: MessageSchema.
|
|
13616
|
+
data: MessageSchema.and(exports_external.object({
|
|
13615
13617
|
debug: exports_external.object({
|
|
13616
13618
|
approxTokens: exports_external.number().min(0).optional(),
|
|
13617
13619
|
chars: exports_external.number().min(0).optional()
|
|
@@ -13622,7 +13624,7 @@ var LLMResultEventSchema = AuditEnvelopeSchema.extend({
|
|
|
13622
13624
|
kind: exports_external.literal("llm.result"),
|
|
13623
13625
|
data: exports_external.object({
|
|
13624
13626
|
model: exports_external.object({
|
|
13625
|
-
|
|
13627
|
+
name: exports_external.string(),
|
|
13626
13628
|
provider: exports_external.string().optional()
|
|
13627
13629
|
}),
|
|
13628
13630
|
tokens: exports_external.object({
|
|
@@ -13630,13 +13632,7 @@ var LLMResultEventSchema = AuditEnvelopeSchema.extend({
|
|
|
13630
13632
|
out: exports_external.number().min(0)
|
|
13631
13633
|
}),
|
|
13632
13634
|
debug: exports_external.object({
|
|
13633
|
-
inTokenAttribution: exports_external.
|
|
13634
|
-
system: exports_external.number().min(0).optional(),
|
|
13635
|
-
user: exports_external.number().min(0).optional(),
|
|
13636
|
-
assistant: exports_external.number().min(0).optional(),
|
|
13637
|
-
tool: exports_external.number().min(0).optional(),
|
|
13638
|
-
other: exports_external.number().min(0).optional()
|
|
13639
|
-
})
|
|
13635
|
+
inTokenAttribution: exports_external.partialRecord(MessageRoleSchema, exports_external.number().min(0))
|
|
13640
13636
|
}).optional(),
|
|
13641
13637
|
messageCount: exports_external.number().min(0),
|
|
13642
13638
|
durationMs: exports_external.number().min(0).optional()
|
|
@@ -13644,6 +13640,35 @@ var LLMResultEventSchema = AuditEnvelopeSchema.extend({
|
|
|
13644
13640
|
});
|
|
13645
13641
|
|
|
13646
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
|
+
});
|
|
13647
13672
|
var SignalSchema = exports_external.object({
|
|
13648
13673
|
key: exports_external.string().max(256),
|
|
13649
13674
|
args: exports_external.array(exports_external.string().max(256)).max(100).optional(),
|
|
@@ -13671,7 +13696,10 @@ var InbuiltAgentMetricKind = exports_external.enum([
|
|
|
13671
13696
|
"bytes_out",
|
|
13672
13697
|
"duration_ms",
|
|
13673
13698
|
"records_in",
|
|
13674
|
-
"records_out"
|
|
13699
|
+
"records_out",
|
|
13700
|
+
"llm_tokens_in",
|
|
13701
|
+
"llm_tokens_out",
|
|
13702
|
+
"llm_cost_usd"
|
|
13675
13703
|
]);
|
|
13676
13704
|
var CustomAgentMetricKind = exports_external.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/);
|
|
13677
13705
|
var AgentMetricInfo = exports_external.object({
|
|
@@ -13718,7 +13746,12 @@ var ToolDecisionEventSchema = AuditEnvelopeSchema.extend({
|
|
|
13718
13746
|
subjects: zod_default.array(SubjectSchema).max(100).optional(),
|
|
13719
13747
|
signals: zod_default.array(SignalSchema).max(100).optional(),
|
|
13720
13748
|
counters: CountersSchema.optional(),
|
|
13721
|
-
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()
|
|
13722
13755
|
})
|
|
13723
13756
|
});
|
|
13724
13757
|
var ToolResultEventSchema = AuditEnvelopeSchema.extend({
|
|
@@ -13738,12 +13771,16 @@ var ToolResultEventSchema = AuditEnvelopeSchema.extend({
|
|
|
13738
13771
|
resultMeta: ToolMetaSchema.optional(),
|
|
13739
13772
|
debug: zod_default.object({
|
|
13740
13773
|
approxTokens: zod_default.number().min(0).optional(),
|
|
13741
|
-
chars: zod_default.number().min(0).optional()
|
|
13774
|
+
chars: zod_default.number().min(0).optional(),
|
|
13775
|
+
bytes: zod_default.number().min(0).optional()
|
|
13742
13776
|
}).optional()
|
|
13743
13777
|
})
|
|
13744
13778
|
});
|
|
13745
13779
|
|
|
13746
13780
|
// src/audit/events.ts
|
|
13781
|
+
var ActorSchema = EndUserConfigSchema.extend({
|
|
13782
|
+
group: EndUserGroupConfigSchema.optional()
|
|
13783
|
+
});
|
|
13747
13784
|
var RunStartedEventSchema = AuditEnvelopeSchema.extend({
|
|
13748
13785
|
kind: exports_external.literal("run.started"),
|
|
13749
13786
|
data: exports_external.object({
|
|
@@ -13754,9 +13791,8 @@ var RunStartedEventSchema = AuditEnvelopeSchema.extend({
|
|
|
13754
13791
|
id: exports_external.string().optional(),
|
|
13755
13792
|
name: exports_external.string().optional()
|
|
13756
13793
|
}),
|
|
13757
|
-
enduser:
|
|
13758
|
-
|
|
13759
|
-
}).optional(),
|
|
13794
|
+
enduser: ActorSchema.optional(),
|
|
13795
|
+
actor: ActorSchema.optional(),
|
|
13760
13796
|
model: exports_external.object({
|
|
13761
13797
|
provider: exports_external.string().optional(),
|
|
13762
13798
|
name: exports_external.string().optional()
|
|
@@ -13779,7 +13815,14 @@ var RunStartedEventSchema = AuditEnvelopeSchema.extend({
|
|
|
13779
13815
|
var RunEndedEventSchema = AuditEnvelopeSchema.extend({
|
|
13780
13816
|
kind: exports_external.literal("run.ended"),
|
|
13781
13817
|
data: exports_external.object({
|
|
13782
|
-
status: exports_external.enum([
|
|
13818
|
+
status: exports_external.enum([
|
|
13819
|
+
"ok",
|
|
13820
|
+
"error",
|
|
13821
|
+
"blocked",
|
|
13822
|
+
"success",
|
|
13823
|
+
"timeout",
|
|
13824
|
+
"interrupted"
|
|
13825
|
+
]),
|
|
13783
13826
|
totalSteps: exports_external.number().min(0),
|
|
13784
13827
|
firstErrorDecisionId: exports_external.string().optional(),
|
|
13785
13828
|
summary: exports_external.string().optional()
|
|
@@ -14070,14 +14113,17 @@ var RuleSpecSchema = RuleSchema.omit({
|
|
|
14070
14113
|
policyId: true
|
|
14071
14114
|
}).describe("Definable Rule spec that can be inserted into Handlebar API");
|
|
14072
14115
|
export {
|
|
14116
|
+
VerdictSchema,
|
|
14073
14117
|
ToolResultEventSchema,
|
|
14074
14118
|
ToolDecisionEventSchema,
|
|
14075
14119
|
SubjectSchema,
|
|
14076
14120
|
SignalSchema,
|
|
14077
14121
|
RunStartedEventSchema,
|
|
14078
14122
|
RunEndedEventSchema,
|
|
14123
|
+
RunControlSchema,
|
|
14079
14124
|
RuleSpecSchema,
|
|
14080
14125
|
RuleSchema,
|
|
14126
|
+
RuleEvalSchema,
|
|
14081
14127
|
PolicySpecSchema,
|
|
14082
14128
|
MessageSchema,
|
|
14083
14129
|
MessageRoleSchema,
|
|
@@ -14088,6 +14134,8 @@ export {
|
|
|
14088
14134
|
HitlMetaSchema,
|
|
14089
14135
|
GovernanceDecisionSchema,
|
|
14090
14136
|
ErrorEventSchema,
|
|
14137
|
+
DecisionSchema,
|
|
14138
|
+
DecisionCauseSchema,
|
|
14091
14139
|
CustomAgentMetricKind,
|
|
14092
14140
|
AuditEventSchema,
|
|
14093
14141
|
AuditEnvelopeSchema,
|
|
@@ -121,6 +121,9 @@ declare const AndConditionSchema: z.ZodObject<{
|
|
|
121
121
|
duration_ms: "duration_ms";
|
|
122
122
|
records_in: "records_in";
|
|
123
123
|
records_out: "records_out";
|
|
124
|
+
llm_tokens_in: "llm_tokens_in";
|
|
125
|
+
llm_tokens_out: "llm_tokens_out";
|
|
126
|
+
llm_cost_usd: "llm_cost_usd";
|
|
124
127
|
}>;
|
|
125
128
|
}, z.core.$strict>, z.ZodObject<{
|
|
126
129
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -344,6 +347,9 @@ declare const OrConditionSchema: z.ZodObject<{
|
|
|
344
347
|
duration_ms: "duration_ms";
|
|
345
348
|
records_in: "records_in";
|
|
346
349
|
records_out: "records_out";
|
|
350
|
+
llm_tokens_in: "llm_tokens_in";
|
|
351
|
+
llm_tokens_out: "llm_tokens_out";
|
|
352
|
+
llm_cost_usd: "llm_cost_usd";
|
|
347
353
|
}>;
|
|
348
354
|
}, z.core.$strict>, z.ZodObject<{
|
|
349
355
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -567,6 +573,9 @@ declare const NotConditionSchema: z.ZodObject<{
|
|
|
567
573
|
duration_ms: "duration_ms";
|
|
568
574
|
records_in: "records_in";
|
|
569
575
|
records_out: "records_out";
|
|
576
|
+
llm_tokens_in: "llm_tokens_in";
|
|
577
|
+
llm_tokens_out: "llm_tokens_out";
|
|
578
|
+
llm_cost_usd: "llm_cost_usd";
|
|
570
579
|
}>;
|
|
571
580
|
}, z.core.$strict>, z.ZodObject<{
|
|
572
581
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -791,6 +800,9 @@ export declare const RuleConditionSchema: z.ZodUnion<readonly [z.ZodUnion<readon
|
|
|
791
800
|
duration_ms: "duration_ms";
|
|
792
801
|
records_in: "records_in";
|
|
793
802
|
records_out: "records_out";
|
|
803
|
+
llm_tokens_in: "llm_tokens_in";
|
|
804
|
+
llm_tokens_out: "llm_tokens_out";
|
|
805
|
+
llm_cost_usd: "llm_cost_usd";
|
|
794
806
|
}>;
|
|
795
807
|
}, z.core.$strict>, z.ZodObject<{
|
|
796
808
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -1012,6 +1024,9 @@ export declare const RuleConditionSchema: z.ZodUnion<readonly [z.ZodUnion<readon
|
|
|
1012
1024
|
duration_ms: "duration_ms";
|
|
1013
1025
|
records_in: "records_in";
|
|
1014
1026
|
records_out: "records_out";
|
|
1027
|
+
llm_tokens_in: "llm_tokens_in";
|
|
1028
|
+
llm_tokens_out: "llm_tokens_out";
|
|
1029
|
+
llm_cost_usd: "llm_cost_usd";
|
|
1015
1030
|
}>;
|
|
1016
1031
|
}, z.core.$strict>, z.ZodObject<{
|
|
1017
1032
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -1234,6 +1249,9 @@ export declare const RuleConditionSchema: z.ZodUnion<readonly [z.ZodUnion<readon
|
|
|
1234
1249
|
duration_ms: "duration_ms";
|
|
1235
1250
|
records_in: "records_in";
|
|
1236
1251
|
records_out: "records_out";
|
|
1252
|
+
llm_tokens_in: "llm_tokens_in";
|
|
1253
|
+
llm_tokens_out: "llm_tokens_out";
|
|
1254
|
+
llm_cost_usd: "llm_cost_usd";
|
|
1237
1255
|
}>;
|
|
1238
1256
|
}, z.core.$strict>, z.ZodObject<{
|
|
1239
1257
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -1456,6 +1474,9 @@ export declare const RuleConditionSchema: z.ZodUnion<readonly [z.ZodUnion<readon
|
|
|
1456
1474
|
duration_ms: "duration_ms";
|
|
1457
1475
|
records_in: "records_in";
|
|
1458
1476
|
records_out: "records_out";
|
|
1477
|
+
llm_tokens_in: "llm_tokens_in";
|
|
1478
|
+
llm_tokens_out: "llm_tokens_out";
|
|
1479
|
+
llm_cost_usd: "llm_cost_usd";
|
|
1459
1480
|
}>;
|
|
1460
1481
|
}, z.core.$strict>, z.ZodObject<{
|
|
1461
1482
|
kind: z.ZodLiteral<"custom">;
|
package/dist/rules/metrics.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export declare const MetricRefSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7
7
|
duration_ms: "duration_ms";
|
|
8
8
|
records_in: "records_in";
|
|
9
9
|
records_out: "records_out";
|
|
10
|
+
llm_tokens_in: "llm_tokens_in";
|
|
11
|
+
llm_tokens_out: "llm_tokens_out";
|
|
12
|
+
llm_cost_usd: "llm_cost_usd";
|
|
10
13
|
}>;
|
|
11
14
|
}, z.core.$strict>, z.ZodObject<{
|
|
12
15
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -27,6 +30,9 @@ export declare const MetricWindowConditionSchema: z.ZodObject<{
|
|
|
27
30
|
duration_ms: "duration_ms";
|
|
28
31
|
records_in: "records_in";
|
|
29
32
|
records_out: "records_out";
|
|
33
|
+
llm_tokens_in: "llm_tokens_in";
|
|
34
|
+
llm_tokens_out: "llm_tokens_out";
|
|
35
|
+
llm_cost_usd: "llm_cost_usd";
|
|
30
36
|
}>;
|
|
31
37
|
}, z.core.$strict>, z.ZodObject<{
|
|
32
38
|
kind: z.ZodLiteral<"custom">;
|
package/dist/rules/rule.d.ts
CHANGED
|
@@ -153,6 +153,9 @@ export declare const RuleSchema: z.ZodObject<{
|
|
|
153
153
|
duration_ms: "duration_ms";
|
|
154
154
|
records_in: "records_in";
|
|
155
155
|
records_out: "records_out";
|
|
156
|
+
llm_tokens_in: "llm_tokens_in";
|
|
157
|
+
llm_tokens_out: "llm_tokens_out";
|
|
158
|
+
llm_cost_usd: "llm_cost_usd";
|
|
156
159
|
}>;
|
|
157
160
|
}, z.core.$strict>, z.ZodObject<{
|
|
158
161
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -374,6 +377,9 @@ export declare const RuleSchema: z.ZodObject<{
|
|
|
374
377
|
duration_ms: "duration_ms";
|
|
375
378
|
records_in: "records_in";
|
|
376
379
|
records_out: "records_out";
|
|
380
|
+
llm_tokens_in: "llm_tokens_in";
|
|
381
|
+
llm_tokens_out: "llm_tokens_out";
|
|
382
|
+
llm_cost_usd: "llm_cost_usd";
|
|
377
383
|
}>;
|
|
378
384
|
}, z.core.$strict>, z.ZodObject<{
|
|
379
385
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -596,6 +602,9 @@ export declare const RuleSchema: z.ZodObject<{
|
|
|
596
602
|
duration_ms: "duration_ms";
|
|
597
603
|
records_in: "records_in";
|
|
598
604
|
records_out: "records_out";
|
|
605
|
+
llm_tokens_in: "llm_tokens_in";
|
|
606
|
+
llm_tokens_out: "llm_tokens_out";
|
|
607
|
+
llm_cost_usd: "llm_cost_usd";
|
|
599
608
|
}>;
|
|
600
609
|
}, z.core.$strict>, z.ZodObject<{
|
|
601
610
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -818,6 +827,9 @@ export declare const RuleSchema: z.ZodObject<{
|
|
|
818
827
|
duration_ms: "duration_ms";
|
|
819
828
|
records_in: "records_in";
|
|
820
829
|
records_out: "records_out";
|
|
830
|
+
llm_tokens_in: "llm_tokens_in";
|
|
831
|
+
llm_tokens_out: "llm_tokens_out";
|
|
832
|
+
llm_cost_usd: "llm_cost_usd";
|
|
821
833
|
}>;
|
|
822
834
|
}, z.core.$strict>, z.ZodObject<{
|
|
823
835
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -938,6 +950,7 @@ export declare const RuleSchema: z.ZodObject<{
|
|
|
938
950
|
export type Rule = z.infer<typeof RuleSchema>;
|
|
939
951
|
export declare const RuleSpecSchema: z.ZodObject<{
|
|
940
952
|
name: z.ZodString;
|
|
953
|
+
enabled: z.ZodBoolean;
|
|
941
954
|
effect: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
942
955
|
type: z.ZodLiteral<"allow">;
|
|
943
956
|
reason: z.ZodOptional<z.ZodString>;
|
|
@@ -948,7 +961,6 @@ export declare const RuleSpecSchema: z.ZodObject<{
|
|
|
948
961
|
type: z.ZodLiteral<"block">;
|
|
949
962
|
reason: z.ZodOptional<z.ZodString>;
|
|
950
963
|
}, z.core.$strict>], "type">;
|
|
951
|
-
enabled: z.ZodBoolean;
|
|
952
964
|
onMissing: z.ZodOptional<z.ZodEnum<{
|
|
953
965
|
allow: "allow";
|
|
954
966
|
block: "block";
|
|
@@ -1085,6 +1097,9 @@ export declare const RuleSpecSchema: z.ZodObject<{
|
|
|
1085
1097
|
duration_ms: "duration_ms";
|
|
1086
1098
|
records_in: "records_in";
|
|
1087
1099
|
records_out: "records_out";
|
|
1100
|
+
llm_tokens_in: "llm_tokens_in";
|
|
1101
|
+
llm_tokens_out: "llm_tokens_out";
|
|
1102
|
+
llm_cost_usd: "llm_cost_usd";
|
|
1088
1103
|
}>;
|
|
1089
1104
|
}, z.core.$strict>, z.ZodObject<{
|
|
1090
1105
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -1306,6 +1321,9 @@ export declare const RuleSpecSchema: z.ZodObject<{
|
|
|
1306
1321
|
duration_ms: "duration_ms";
|
|
1307
1322
|
records_in: "records_in";
|
|
1308
1323
|
records_out: "records_out";
|
|
1324
|
+
llm_tokens_in: "llm_tokens_in";
|
|
1325
|
+
llm_tokens_out: "llm_tokens_out";
|
|
1326
|
+
llm_cost_usd: "llm_cost_usd";
|
|
1309
1327
|
}>;
|
|
1310
1328
|
}, z.core.$strict>, z.ZodObject<{
|
|
1311
1329
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -1528,6 +1546,9 @@ export declare const RuleSpecSchema: z.ZodObject<{
|
|
|
1528
1546
|
duration_ms: "duration_ms";
|
|
1529
1547
|
records_in: "records_in";
|
|
1530
1548
|
records_out: "records_out";
|
|
1549
|
+
llm_tokens_in: "llm_tokens_in";
|
|
1550
|
+
llm_tokens_out: "llm_tokens_out";
|
|
1551
|
+
llm_cost_usd: "llm_cost_usd";
|
|
1531
1552
|
}>;
|
|
1532
1553
|
}, z.core.$strict>, z.ZodObject<{
|
|
1533
1554
|
kind: z.ZodLiteral<"custom">;
|
|
@@ -1750,6 +1771,9 @@ export declare const RuleSpecSchema: z.ZodObject<{
|
|
|
1750
1771
|
duration_ms: "duration_ms";
|
|
1751
1772
|
records_in: "records_in";
|
|
1752
1773
|
records_out: "records_out";
|
|
1774
|
+
llm_tokens_in: "llm_tokens_in";
|
|
1775
|
+
llm_tokens_out: "llm_tokens_out";
|
|
1776
|
+
llm_cost_usd: "llm_cost_usd";
|
|
1753
1777
|
}>;
|
|
1754
1778
|
}, z.core.$strict>, z.ZodObject<{
|
|
1755
1779
|
kind: z.ZodLiteral<"custom">;
|