@handlebar/governance-schema 0.0.6-dev.1 → 0.0.6-dev.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/audit/events.d.ts +32 -0
- package/dist/audit/run-metrics.d.ts +25 -0
- package/dist/index.js +15 -0
- package/dist/rules/condition.types.d.ts +22 -1
- package/package.json +1 -1
package/dist/audit/events.d.ts
CHANGED
|
@@ -185,6 +185,22 @@ export declare const ToolResultEventSchema: z.ZodObject<{
|
|
|
185
185
|
}>;
|
|
186
186
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
187
187
|
counters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
188
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
189
|
+
inbuilt: z.ZodRecord<z.ZodEnum<{
|
|
190
|
+
bytes_in: "bytes_in";
|
|
191
|
+
bytes_out: "bytes_out";
|
|
192
|
+
duration_ms: "duration_ms";
|
|
193
|
+
records_in: "records_in";
|
|
194
|
+
records_out: "records_out";
|
|
195
|
+
}>, z.ZodObject<{
|
|
196
|
+
value: z.ZodNumber;
|
|
197
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
198
|
+
}, z.core.$strip>>;
|
|
199
|
+
custom: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
200
|
+
value: z.ZodNumber;
|
|
201
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
202
|
+
}, z.core.$strip>>;
|
|
203
|
+
}, z.core.$strip>>;
|
|
188
204
|
error: z.ZodOptional<z.ZodObject<{
|
|
189
205
|
name: z.ZodOptional<z.ZodString>;
|
|
190
206
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -448,6 +464,22 @@ export declare const AuditEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
448
464
|
}>;
|
|
449
465
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
450
466
|
counters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
467
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
468
|
+
inbuilt: z.ZodRecord<z.ZodEnum<{
|
|
469
|
+
bytes_in: "bytes_in";
|
|
470
|
+
bytes_out: "bytes_out";
|
|
471
|
+
duration_ms: "duration_ms";
|
|
472
|
+
records_in: "records_in";
|
|
473
|
+
records_out: "records_out";
|
|
474
|
+
}>, z.ZodObject<{
|
|
475
|
+
value: z.ZodNumber;
|
|
476
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
477
|
+
}, z.core.$strip>>;
|
|
478
|
+
custom: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
479
|
+
value: z.ZodNumber;
|
|
480
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
481
|
+
}, z.core.$strip>>;
|
|
482
|
+
}, z.core.$strip>>;
|
|
451
483
|
error: z.ZodOptional<z.ZodObject<{
|
|
452
484
|
name: z.ZodOptional<z.ZodString>;
|
|
453
485
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const InbuiltAgentMetricKind: z.ZodEnum<{
|
|
3
|
+
bytes_in: "bytes_in";
|
|
4
|
+
bytes_out: "bytes_out";
|
|
5
|
+
duration_ms: "duration_ms";
|
|
6
|
+
records_in: "records_in";
|
|
7
|
+
records_out: "records_out";
|
|
8
|
+
}>;
|
|
9
|
+
export declare const CustomAgentMetricKind: z.ZodString;
|
|
10
|
+
export declare const AgentMetrics: z.ZodObject<{
|
|
11
|
+
inbuilt: z.ZodRecord<z.ZodEnum<{
|
|
12
|
+
bytes_in: "bytes_in";
|
|
13
|
+
bytes_out: "bytes_out";
|
|
14
|
+
duration_ms: "duration_ms";
|
|
15
|
+
records_in: "records_in";
|
|
16
|
+
records_out: "records_out";
|
|
17
|
+
}>, z.ZodObject<{
|
|
18
|
+
value: z.ZodNumber;
|
|
19
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
custom: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
22
|
+
value: z.ZodNumber;
|
|
23
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
}, z.core.$strip>;
|
package/dist/index.js
CHANGED
|
@@ -12661,6 +12661,20 @@ var GovernanceDecisionSchema = exports_external.object({
|
|
|
12661
12661
|
reason: exports_external.optional(exports_external.string())
|
|
12662
12662
|
});
|
|
12663
12663
|
|
|
12664
|
+
// src/audit/run-metrics.ts
|
|
12665
|
+
var InbuiltAgentMetricKind = exports_external.enum(["bytes_in", "bytes_out", "duration_ms", "records_in", "records_out"]);
|
|
12666
|
+
var CustomAgentMetricKind = exports_external.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/);
|
|
12667
|
+
var AgentMetricInfo = exports_external.object({
|
|
12668
|
+
value: exports_external.number(),
|
|
12669
|
+
unit: exports_external.string().min(1).max(64).optional()
|
|
12670
|
+
});
|
|
12671
|
+
var InbuiltAgentMetrics = exports_external.record(InbuiltAgentMetricKind, AgentMetricInfo);
|
|
12672
|
+
var CustomAgentMetrics = exports_external.record(CustomAgentMetricKind, AgentMetricInfo);
|
|
12673
|
+
var AgentMetrics = exports_external.object({
|
|
12674
|
+
inbuilt: InbuiltAgentMetrics,
|
|
12675
|
+
custom: CustomAgentMetrics
|
|
12676
|
+
});
|
|
12677
|
+
|
|
12664
12678
|
// src/audit/events.ts
|
|
12665
12679
|
var CountersSchema = exports_external.record(exports_external.string(), exports_external.union([exports_external.string(), exports_external.number()]));
|
|
12666
12680
|
var ToolMetaSchema = exports_external.object({
|
|
@@ -12729,6 +12743,7 @@ var ToolResultEventSchema = AuditEnvelopeSchema.extend({
|
|
|
12729
12743
|
outcome: exports_external.enum(["success", "error"]),
|
|
12730
12744
|
durationMs: exports_external.number().min(0).optional(),
|
|
12731
12745
|
counters: CountersSchema.optional(),
|
|
12746
|
+
metrics: AgentMetrics.optional(),
|
|
12732
12747
|
error: exports_external.object({
|
|
12733
12748
|
name: exports_external.string().optional(),
|
|
12734
12749
|
message: exports_external.string().optional(),
|
|
@@ -48,6 +48,27 @@ export type ToolTagCondition = {
|
|
|
48
48
|
op: "allOf";
|
|
49
49
|
tags: string[];
|
|
50
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Match on arbitrary tags assigned to the enduser.
|
|
53
|
+
* "enduser" in this context means the users of a Handlebar user.
|
|
54
|
+
* - has: existence AND truthiness of the tag. E.g. "has:tier" would be false if "tier=0", "tier=false", or no "tier" tag exists.
|
|
55
|
+
* - hasValue: tag exists and has an exact given value
|
|
56
|
+
*/
|
|
57
|
+
export type EndUserTagCondition = {
|
|
58
|
+
kind: "enduserTag";
|
|
59
|
+
op: "has";
|
|
60
|
+
tag: string;
|
|
61
|
+
} | {
|
|
62
|
+
kind: "enduserTag";
|
|
63
|
+
op: "hasValue";
|
|
64
|
+
tag: string;
|
|
65
|
+
value: string;
|
|
66
|
+
} | {
|
|
67
|
+
kind: "enduserTag";
|
|
68
|
+
op: "hasValueAny";
|
|
69
|
+
tag: string;
|
|
70
|
+
values: string[];
|
|
71
|
+
};
|
|
51
72
|
/**
|
|
52
73
|
* Scope for execution time measurement.
|
|
53
74
|
* - "tool": the single tool call duration
|
|
@@ -118,4 +139,4 @@ export type NotCondition = {
|
|
|
118
139
|
/**
|
|
119
140
|
* The full condition algebra supported by the rule engine.
|
|
120
141
|
*/
|
|
121
|
-
export type RuleCondition = ToolNameCondition | ToolTagCondition | ExecutionTimeCondition | SequenceCondition | MaxCallsCondition | CustomFunctionCondition | AndCondition | OrCondition | NotCondition;
|
|
142
|
+
export type RuleCondition = ToolNameCondition | ToolTagCondition | EndUserTagCondition | ExecutionTimeCondition | SequenceCondition | MaxCallsCondition | CustomFunctionCondition | AndCondition | OrCondition | NotCondition;
|