agent-contracts 0.30.4 → 0.31.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/README.md +10 -0
- package/dist/cli.js +75 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +99 -16
- package/dist/index.js +78 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -401,6 +401,7 @@ declare const DslSchema: z.ZodObject<{
|
|
|
401
401
|
}>>;
|
|
402
402
|
}, z.core.$loose>>>;
|
|
403
403
|
context_loading: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
404
|
+
states: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
404
405
|
}, z.core.$loose>;
|
|
405
406
|
agents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
406
407
|
role_name: z.ZodString;
|
|
@@ -736,16 +737,29 @@ declare const DslSchema: z.ZodObject<{
|
|
|
736
737
|
guardrail: z.ZodString;
|
|
737
738
|
severity: z.ZodEnum<{
|
|
738
739
|
mandatory: "mandatory";
|
|
740
|
+
info: "info";
|
|
739
741
|
critical: "critical";
|
|
740
742
|
warning: "warning";
|
|
741
|
-
info: "info";
|
|
742
743
|
}>;
|
|
743
|
-
action: z.ZodEnum<{
|
|
744
|
-
info: "info";
|
|
744
|
+
action: z.ZodUnion<readonly [z.ZodEnum<{
|
|
745
745
|
block: "block";
|
|
746
746
|
warn: "warn";
|
|
747
747
|
shadow: "shadow";
|
|
748
|
-
|
|
748
|
+
info: "info";
|
|
749
|
+
}>, z.ZodObject<{
|
|
750
|
+
default: z.ZodEnum<{
|
|
751
|
+
block: "block";
|
|
752
|
+
warn: "warn";
|
|
753
|
+
shadow: "shadow";
|
|
754
|
+
info: "info";
|
|
755
|
+
}>;
|
|
756
|
+
when: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
757
|
+
block: "block";
|
|
758
|
+
warn: "warn";
|
|
759
|
+
shadow: "shadow";
|
|
760
|
+
info: "info";
|
|
761
|
+
}>>;
|
|
762
|
+
}, z.core.$strip>]>;
|
|
749
763
|
allow_override: z.ZodDefault<z.ZodBoolean>;
|
|
750
764
|
override_requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
751
765
|
escalation: z.ZodOptional<z.ZodObject<{
|
|
@@ -830,20 +844,75 @@ declare const GuardrailPolicyRuleEscalationSchema: z.ZodObject<{
|
|
|
830
844
|
condition: z.ZodOptional<z.ZodString>;
|
|
831
845
|
}, z.core.$loose>;
|
|
832
846
|
type GuardrailPolicyRuleEscalation = z.infer<typeof GuardrailPolicyRuleEscalationSchema>;
|
|
847
|
+
declare const ActionEnum: z.ZodEnum<{
|
|
848
|
+
block: "block";
|
|
849
|
+
warn: "warn";
|
|
850
|
+
shadow: "shadow";
|
|
851
|
+
info: "info";
|
|
852
|
+
}>;
|
|
853
|
+
type ActionValue = z.infer<typeof ActionEnum>;
|
|
854
|
+
declare const ConditionalActionSchema: z.ZodObject<{
|
|
855
|
+
default: z.ZodEnum<{
|
|
856
|
+
block: "block";
|
|
857
|
+
warn: "warn";
|
|
858
|
+
shadow: "shadow";
|
|
859
|
+
info: "info";
|
|
860
|
+
}>;
|
|
861
|
+
when: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
862
|
+
block: "block";
|
|
863
|
+
warn: "warn";
|
|
864
|
+
shadow: "shadow";
|
|
865
|
+
info: "info";
|
|
866
|
+
}>>;
|
|
867
|
+
}, z.core.$strip>;
|
|
868
|
+
type ConditionalAction = z.infer<typeof ConditionalActionSchema>;
|
|
869
|
+
declare const ActionSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
870
|
+
block: "block";
|
|
871
|
+
warn: "warn";
|
|
872
|
+
shadow: "shadow";
|
|
873
|
+
info: "info";
|
|
874
|
+
}>, z.ZodObject<{
|
|
875
|
+
default: z.ZodEnum<{
|
|
876
|
+
block: "block";
|
|
877
|
+
warn: "warn";
|
|
878
|
+
shadow: "shadow";
|
|
879
|
+
info: "info";
|
|
880
|
+
}>;
|
|
881
|
+
when: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
882
|
+
block: "block";
|
|
883
|
+
warn: "warn";
|
|
884
|
+
shadow: "shadow";
|
|
885
|
+
info: "info";
|
|
886
|
+
}>>;
|
|
887
|
+
}, z.core.$strip>]>;
|
|
888
|
+
type Action = z.infer<typeof ActionSchema>;
|
|
833
889
|
declare const GuardrailPolicyRuleSchema: z.ZodObject<{
|
|
834
890
|
guardrail: z.ZodString;
|
|
835
891
|
severity: z.ZodEnum<{
|
|
836
892
|
mandatory: "mandatory";
|
|
893
|
+
info: "info";
|
|
837
894
|
critical: "critical";
|
|
838
895
|
warning: "warning";
|
|
839
|
-
info: "info";
|
|
840
896
|
}>;
|
|
841
|
-
action: z.ZodEnum<{
|
|
842
|
-
info: "info";
|
|
897
|
+
action: z.ZodUnion<readonly [z.ZodEnum<{
|
|
843
898
|
block: "block";
|
|
844
899
|
warn: "warn";
|
|
845
900
|
shadow: "shadow";
|
|
846
|
-
|
|
901
|
+
info: "info";
|
|
902
|
+
}>, z.ZodObject<{
|
|
903
|
+
default: z.ZodEnum<{
|
|
904
|
+
block: "block";
|
|
905
|
+
warn: "warn";
|
|
906
|
+
shadow: "shadow";
|
|
907
|
+
info: "info";
|
|
908
|
+
}>;
|
|
909
|
+
when: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
910
|
+
block: "block";
|
|
911
|
+
warn: "warn";
|
|
912
|
+
shadow: "shadow";
|
|
913
|
+
info: "info";
|
|
914
|
+
}>>;
|
|
915
|
+
}, z.core.$strip>]>;
|
|
847
916
|
allow_override: z.ZodDefault<z.ZodBoolean>;
|
|
848
917
|
override_requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
849
918
|
escalation: z.ZodOptional<z.ZodObject<{
|
|
@@ -858,16 +927,29 @@ declare const GuardrailPolicySchema: z.ZodObject<{
|
|
|
858
927
|
guardrail: z.ZodString;
|
|
859
928
|
severity: z.ZodEnum<{
|
|
860
929
|
mandatory: "mandatory";
|
|
930
|
+
info: "info";
|
|
861
931
|
critical: "critical";
|
|
862
932
|
warning: "warning";
|
|
863
|
-
info: "info";
|
|
864
933
|
}>;
|
|
865
|
-
action: z.ZodEnum<{
|
|
866
|
-
info: "info";
|
|
934
|
+
action: z.ZodUnion<readonly [z.ZodEnum<{
|
|
867
935
|
block: "block";
|
|
868
936
|
warn: "warn";
|
|
869
937
|
shadow: "shadow";
|
|
870
|
-
|
|
938
|
+
info: "info";
|
|
939
|
+
}>, z.ZodObject<{
|
|
940
|
+
default: z.ZodEnum<{
|
|
941
|
+
block: "block";
|
|
942
|
+
warn: "warn";
|
|
943
|
+
shadow: "shadow";
|
|
944
|
+
info: "info";
|
|
945
|
+
}>;
|
|
946
|
+
when: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
947
|
+
block: "block";
|
|
948
|
+
warn: "warn";
|
|
949
|
+
shadow: "shadow";
|
|
950
|
+
info: "info";
|
|
951
|
+
}>>;
|
|
952
|
+
}, z.core.$strip>]>;
|
|
871
953
|
allow_override: z.ZodDefault<z.ZodBoolean>;
|
|
872
954
|
override_requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
873
955
|
escalation: z.ZodOptional<z.ZodObject<{
|
|
@@ -967,6 +1049,7 @@ declare const SystemSchema: z.ZodObject<{
|
|
|
967
1049
|
}>>;
|
|
968
1050
|
}, z.core.$loose>>>;
|
|
969
1051
|
context_loading: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
1052
|
+
states: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
970
1053
|
}, z.core.$loose>;
|
|
971
1054
|
type System = z.infer<typeof SystemSchema>;
|
|
972
1055
|
|
|
@@ -1536,7 +1619,7 @@ interface GuardrailEnforcementEntry {
|
|
|
1536
1619
|
guardrail_id: string;
|
|
1537
1620
|
description: string;
|
|
1538
1621
|
severity: string;
|
|
1539
|
-
action:
|
|
1622
|
+
action: Action;
|
|
1540
1623
|
scoped_agents: string[];
|
|
1541
1624
|
scoped_tasks: string[];
|
|
1542
1625
|
scoped_workflows: string[];
|
|
@@ -1564,7 +1647,7 @@ interface EntityGuardrailEntry {
|
|
|
1564
1647
|
tags: string[];
|
|
1565
1648
|
source: "entity" | "scope" | "both";
|
|
1566
1649
|
severity?: string;
|
|
1567
|
-
action?:
|
|
1650
|
+
action?: Action;
|
|
1568
1651
|
}
|
|
1569
1652
|
interface EntityValidationEntry {
|
|
1570
1653
|
validation_id: string;
|
|
@@ -1868,9 +1951,9 @@ declare const DslAuditResultSchema: z.ZodObject<{
|
|
|
1868
1951
|
dsl_gap: "dsl_gap";
|
|
1869
1952
|
}>>;
|
|
1870
1953
|
severity: z.ZodOptional<z.ZodEnum<{
|
|
1954
|
+
info: "info";
|
|
1871
1955
|
critical: "critical";
|
|
1872
1956
|
warning: "warning";
|
|
1873
|
-
info: "info";
|
|
1874
1957
|
}>>;
|
|
1875
1958
|
}, z.core.$strip>>>;
|
|
1876
1959
|
recommendations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -2029,4 +2112,4 @@ declare function matchFileToArtifacts(filePath: string, artifacts: Record<string
|
|
|
2029
2112
|
declare function buildCoverageReport(files: string[], artifacts: Record<string, ArtifactFileInfo>): ArtifactCoverageReport;
|
|
2030
2113
|
declare function formatCoverageText(report: ArtifactCoverageReport): string;
|
|
2031
2114
|
|
|
2032
|
-
export { type Agent, type AgentContractsConfig, AgentContractsConfigSchema, AgentSchema, type AppendOperator, AppendOperatorSchema, type Artifact, type ArtifactCoverageReport, type ArtifactCoverageSummary, type ArtifactFileInfo, type ArtifactOperation, type ArtifactRoute, type ArtifactRouteStep, ArtifactSchema, type AuditOptions, type OutputFormat as AuditOutputFormat, type AuditConfig as AuditRunConfig, type AuditRunResult, type AuditType, BaseResolveError, type BindingGenerationContext, type BindingOutput, BindingOutputSchema, type BindingRenderTarget, BindingRenderTargetSchema, CONTEXT_TYPES, type Check, CheckSchema, type Command, CommandSchema, type CompiledArtifactNode, type Components, ComponentsSchema, ConfigLoadError, type ContextLoading, ContextLoadingSchema, type ContextType, ContextTypeSchema, type DelegatableTaskView, type DiagnosticMessage, type DimensionResult, type Dsl, DslLoadError, DslSchema, type EntityGuardrailEntry, type EntityValidationEntry, type EscalationCriterion, EscalationCriterionSchema, type ExecutionStep, ExecutionStepSchema, type Extends, ExtendsSchema, type ExternalParticipant, type GenerateDiagnostic, type GenerateGuardrailsOptions, type GenerateResult, type GlobalContext, type Guardrail, type GuardrailGenerationContext, type GuardrailPolicy, type GuardrailPolicyRule, type GuardrailPolicyRuleEscalation, GuardrailPolicyRuleEscalationSchema, GuardrailPolicyRuleSchema, GuardrailPolicySchema, GuardrailSchema, type GuardrailScope, GuardrailScopeSchema, type HandoffType, HandoffTypeSchema, ITERABLE_CONTEXT_TYPES, type InsertAfterOperator, InsertAfterOperatorSchema, type LintDiagnostic, type LintRule, type LoadResult, type LoadedBinding, type Matcher, MatcherSchema, MergeError, type MergeableRecord, type MergedBehavioralSpec, type OverlappingFile, type PathResolveResult, type PerAgentContext, type PerArtifactContext, type PerArtifactEntry, type PerGuardrailContext, type PerGuardrailPolicyContext, type PerHandoffTypeContext, type PerPolicyContext, type PerTaskContext, type PerToolContext, type PerValidationContext, type PerWorkflowContext, type Policy, PolicySchema, type PolicyWhen, PolicyWhenSchema, type PrependOperator, PrependOperatorSchema, type Prerequisite, PrerequisiteSchema, type ProjectNavigationIndex, type ReferenceDiagnostic, type RemoveOperator, RemoveOperatorSchema, type RenderTarget, RenderTargetSchema, type ReplaceOperator, ReplaceOperatorSchema, type Reporting, ReportingSchema, type ResolveChecksResult, type ResolveResult, type ResolvedCheck, type ResolvedConfig, type ResolvedRenderTarget, type Retry, type Rule, RuleSchema, SCOPE_NODE_TYPES, type SchemaValidationResult, type ScopeNodeType, ScopeNodeTypeSchema, type ScoreResult, type Section, SectionSchema, type Severity, type SoftwareBinding, SoftwareBindingSchema, type System, type SystemContext, SystemSchema, type Task, TaskSchema, type TeamImport, TeamImportSchema, type TeamInterface, type TeamInterfaceAcceptWorkflow, TeamInterfaceAcceptWorkflowSchema, TeamInterfaceSchema, type Tool, ToolSchema, type Validation, ValidationSchema, type VersionLiteral, VersionLiteralSchema, type Workflow, WorkflowSchema, type WorkflowStep, WorkflowStepSchema, type XExtensionDecl, XExtensionDeclSchema, buildArtifactContext, buildAuditContext, buildCoverageReport, buildGlobalContext, buildGuardrailContext, buildGuardrailPolicyContext, buildHandoffTypeContext, buildNavigationIndex, buildPerAgentContext, buildPolicyContext, buildSystemContext, buildTaskContext, buildToolContext, buildValidationContext, buildWorkflowContext, builtinRules, checkDriftFromConfig, checkReferences, computeExitCode, enumerateProjectFiles, expandDefaults, formatAuditResult, formatAuditResults, formatCoverageText, generateGuardrails, lint, loadBindings, loadConfig, loadDsl, matchFileToArtifacts, mergeDsl, renderFromConfig, resolve, resolveAllOf, resolveBase, resolveBindingTargetPath, resolveChecks, resolveDslPath, resolveEffectiveGuardrails, resolveEntityValidations, runAllAudits, runAudit, score, spectralLint, validateHandoffSchemas, validateSchema, yamlReservedKeySafetyRule };
|
|
2115
|
+
export { type Action, ActionEnum, ActionSchema, type ActionValue, type Agent, type AgentContractsConfig, AgentContractsConfigSchema, AgentSchema, type AppendOperator, AppendOperatorSchema, type Artifact, type ArtifactCoverageReport, type ArtifactCoverageSummary, type ArtifactFileInfo, type ArtifactOperation, type ArtifactRoute, type ArtifactRouteStep, ArtifactSchema, type AuditOptions, type OutputFormat as AuditOutputFormat, type AuditConfig as AuditRunConfig, type AuditRunResult, type AuditType, BaseResolveError, type BindingGenerationContext, type BindingOutput, BindingOutputSchema, type BindingRenderTarget, BindingRenderTargetSchema, CONTEXT_TYPES, type Check, CheckSchema, type Command, CommandSchema, type CompiledArtifactNode, type Components, ComponentsSchema, type ConditionalAction, ConditionalActionSchema, ConfigLoadError, type ContextLoading, ContextLoadingSchema, type ContextType, ContextTypeSchema, type DelegatableTaskView, type DiagnosticMessage, type DimensionResult, type Dsl, DslLoadError, DslSchema, type EntityGuardrailEntry, type EntityValidationEntry, type EscalationCriterion, EscalationCriterionSchema, type ExecutionStep, ExecutionStepSchema, type Extends, ExtendsSchema, type ExternalParticipant, type GenerateDiagnostic, type GenerateGuardrailsOptions, type GenerateResult, type GlobalContext, type Guardrail, type GuardrailGenerationContext, type GuardrailPolicy, type GuardrailPolicyRule, type GuardrailPolicyRuleEscalation, GuardrailPolicyRuleEscalationSchema, GuardrailPolicyRuleSchema, GuardrailPolicySchema, GuardrailSchema, type GuardrailScope, GuardrailScopeSchema, type HandoffType, HandoffTypeSchema, ITERABLE_CONTEXT_TYPES, type InsertAfterOperator, InsertAfterOperatorSchema, type LintDiagnostic, type LintRule, type LoadResult, type LoadedBinding, type Matcher, MatcherSchema, MergeError, type MergeableRecord, type MergedBehavioralSpec, type OverlappingFile, type PathResolveResult, type PerAgentContext, type PerArtifactContext, type PerArtifactEntry, type PerGuardrailContext, type PerGuardrailPolicyContext, type PerHandoffTypeContext, type PerPolicyContext, type PerTaskContext, type PerToolContext, type PerValidationContext, type PerWorkflowContext, type Policy, PolicySchema, type PolicyWhen, PolicyWhenSchema, type PrependOperator, PrependOperatorSchema, type Prerequisite, PrerequisiteSchema, type ProjectNavigationIndex, type ReferenceDiagnostic, type RemoveOperator, RemoveOperatorSchema, type RenderTarget, RenderTargetSchema, type ReplaceOperator, ReplaceOperatorSchema, type Reporting, ReportingSchema, type ResolveChecksResult, type ResolveResult, type ResolvedCheck, type ResolvedConfig, type ResolvedRenderTarget, type Retry, type Rule, RuleSchema, SCOPE_NODE_TYPES, type SchemaValidationResult, type ScopeNodeType, ScopeNodeTypeSchema, type ScoreResult, type Section, SectionSchema, type Severity, type SoftwareBinding, SoftwareBindingSchema, type System, type SystemContext, SystemSchema, type Task, TaskSchema, type TeamImport, TeamImportSchema, type TeamInterface, type TeamInterfaceAcceptWorkflow, TeamInterfaceAcceptWorkflowSchema, TeamInterfaceSchema, type Tool, ToolSchema, type Validation, ValidationSchema, type VersionLiteral, VersionLiteralSchema, type Workflow, WorkflowSchema, type WorkflowStep, WorkflowStepSchema, type XExtensionDecl, XExtensionDeclSchema, buildArtifactContext, buildAuditContext, buildCoverageReport, buildGlobalContext, buildGuardrailContext, buildGuardrailPolicyContext, buildHandoffTypeContext, buildNavigationIndex, buildPerAgentContext, buildPolicyContext, buildSystemContext, buildTaskContext, buildToolContext, buildValidationContext, buildWorkflowContext, builtinRules, checkDriftFromConfig, checkReferences, computeExitCode, enumerateProjectFiles, expandDefaults, formatAuditResult, formatAuditResults, formatCoverageText, generateGuardrails, lint, loadBindings, loadConfig, loadDsl, matchFileToArtifacts, mergeDsl, renderFromConfig, resolve, resolveAllOf, resolveBase, resolveBindingTargetPath, resolveChecks, resolveDslPath, resolveEffectiveGuardrails, resolveEntityValidations, runAllAudits, runAudit, score, spectralLint, validateHandoffSchemas, validateSchema, yamlReservedKeySafetyRule };
|
package/dist/index.js
CHANGED
|
@@ -48228,10 +48228,16 @@ var GuardrailPolicyRuleEscalationSchema = z6.object({
|
|
|
48228
48228
|
target: z6.string(),
|
|
48229
48229
|
condition: z6.string().optional()
|
|
48230
48230
|
}).passthrough();
|
|
48231
|
+
var ActionEnum = z6.enum(["block", "warn", "shadow", "info"]);
|
|
48232
|
+
var ConditionalActionSchema = z6.object({
|
|
48233
|
+
default: ActionEnum,
|
|
48234
|
+
when: z6.record(z6.string(), ActionEnum)
|
|
48235
|
+
});
|
|
48236
|
+
var ActionSchema = z6.union([ActionEnum, ConditionalActionSchema]);
|
|
48231
48237
|
var GuardrailPolicyRuleSchema = z6.object({
|
|
48232
48238
|
guardrail: z6.string(),
|
|
48233
48239
|
severity: z6.enum(["critical", "mandatory", "warning", "info"]),
|
|
48234
|
-
action:
|
|
48240
|
+
action: ActionSchema,
|
|
48235
48241
|
allow_override: z6.boolean().default(false),
|
|
48236
48242
|
override_requires: z6.array(z6.string()).optional(),
|
|
48237
48243
|
escalation: GuardrailPolicyRuleEscalationSchema.optional()
|
|
@@ -48263,7 +48269,8 @@ var SystemSchema = z8.object({
|
|
|
48263
48269
|
name: z8.string(),
|
|
48264
48270
|
default_workflow_order: z8.array(z8.string()),
|
|
48265
48271
|
sections: z8.array(SectionSchema).optional(),
|
|
48266
|
-
context_loading: ContextLoadingSchema
|
|
48272
|
+
context_loading: ContextLoadingSchema,
|
|
48273
|
+
states: z8.array(z8.string()).default([])
|
|
48267
48274
|
}).passthrough();
|
|
48268
48275
|
|
|
48269
48276
|
// src/schema/task.ts
|
|
@@ -50996,6 +51003,70 @@ var guardrailPolicyCoverageRule = {
|
|
|
50996
51003
|
}
|
|
50997
51004
|
};
|
|
50998
51005
|
|
|
51006
|
+
// src/linter/rules/guardrail-policy-action-state.ts
|
|
51007
|
+
function isConditionalAction(action) {
|
|
51008
|
+
return typeof action === "object" && action !== null && "default" in action;
|
|
51009
|
+
}
|
|
51010
|
+
function collectReferencedWhenStates(dsl) {
|
|
51011
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
51012
|
+
for (const policy of Object.values(dsl.guardrail_policies)) {
|
|
51013
|
+
for (const rule of policy.rules) {
|
|
51014
|
+
if (isConditionalAction(rule.action)) {
|
|
51015
|
+
for (const state of Object.keys(rule.action.when)) {
|
|
51016
|
+
referenced.add(state);
|
|
51017
|
+
}
|
|
51018
|
+
}
|
|
51019
|
+
}
|
|
51020
|
+
}
|
|
51021
|
+
return referenced;
|
|
51022
|
+
}
|
|
51023
|
+
var guardrailPolicyActionStateUndefinedRule = {
|
|
51024
|
+
id: "guardrail-policy-action-state-undefined",
|
|
51025
|
+
description: "Policy rule action.when keys must reference states declared in system.states",
|
|
51026
|
+
run(dsl) {
|
|
51027
|
+
const diagnostics = [];
|
|
51028
|
+
const systemStates = new Set(dsl.system.states ?? []);
|
|
51029
|
+
for (const [policyId, policy] of Object.entries(dsl.guardrail_policies)) {
|
|
51030
|
+
for (let ruleIndex = 0; ruleIndex < policy.rules.length; ruleIndex++) {
|
|
51031
|
+
const rule = policy.rules[ruleIndex];
|
|
51032
|
+
if (!isConditionalAction(rule.action)) continue;
|
|
51033
|
+
for (const state of Object.keys(rule.action.when)) {
|
|
51034
|
+
if (!systemStates.has(state)) {
|
|
51035
|
+
diagnostics.push({
|
|
51036
|
+
ruleId: "guardrail-policy-action-state-undefined",
|
|
51037
|
+
severity: "error",
|
|
51038
|
+
path: `guardrail_policies.${policyId}.rules[${ruleIndex}].action.when.${state}`,
|
|
51039
|
+
message: `Policy rule references state "${state}" in action.when, but it is not declared in system.states`
|
|
51040
|
+
});
|
|
51041
|
+
}
|
|
51042
|
+
}
|
|
51043
|
+
}
|
|
51044
|
+
}
|
|
51045
|
+
return diagnostics;
|
|
51046
|
+
}
|
|
51047
|
+
};
|
|
51048
|
+
var systemStatesUnusedRule = {
|
|
51049
|
+
id: "system-states-unused",
|
|
51050
|
+
description: "Each state in system.states should be referenced by at least one policy rule action.when",
|
|
51051
|
+
run(dsl) {
|
|
51052
|
+
const diagnostics = [];
|
|
51053
|
+
const states = dsl.system.states ?? [];
|
|
51054
|
+
if (states.length === 0) return diagnostics;
|
|
51055
|
+
const referenced = collectReferencedWhenStates(dsl);
|
|
51056
|
+
for (const state of states) {
|
|
51057
|
+
if (!referenced.has(state)) {
|
|
51058
|
+
diagnostics.push({
|
|
51059
|
+
ruleId: "system-states-unused",
|
|
51060
|
+
severity: "info",
|
|
51061
|
+
path: `system.states`,
|
|
51062
|
+
message: `State "${state}" is declared in system.states but not referenced by any policy rule action.when`
|
|
51063
|
+
});
|
|
51064
|
+
}
|
|
51065
|
+
}
|
|
51066
|
+
return diagnostics;
|
|
51067
|
+
}
|
|
51068
|
+
};
|
|
51069
|
+
|
|
50999
51070
|
// src/linter/rules/yaml-reserved-key-safety.ts
|
|
51000
51071
|
var YAML_11_RESERVED_KEYS = /* @__PURE__ */ new Set([
|
|
51001
51072
|
"on",
|
|
@@ -51805,6 +51876,8 @@ var builtinRules = [
|
|
|
51805
51876
|
artifactOwnershipRule,
|
|
51806
51877
|
toolCommandsRule,
|
|
51807
51878
|
guardrailPolicyCoverageRule,
|
|
51879
|
+
guardrailPolicyActionStateUndefinedRule,
|
|
51880
|
+
systemStatesUnusedRule,
|
|
51808
51881
|
yamlReservedKeySafetyRule,
|
|
51809
51882
|
artifactRequiredValidationWiringRule,
|
|
51810
51883
|
taskOutputValidationCompletenessRule,
|
|
@@ -56434,6 +56507,8 @@ function groupByDirectory(files) {
|
|
|
56434
56507
|
return Object.entries(dirs).sort((a3, b3) => b3[1] - a3[1]);
|
|
56435
56508
|
}
|
|
56436
56509
|
export {
|
|
56510
|
+
ActionEnum,
|
|
56511
|
+
ActionSchema,
|
|
56437
56512
|
AgentContractsConfigSchema,
|
|
56438
56513
|
AgentSchema,
|
|
56439
56514
|
AppendOperatorSchema,
|
|
@@ -56445,6 +56520,7 @@ export {
|
|
|
56445
56520
|
CheckSchema,
|
|
56446
56521
|
CommandSchema,
|
|
56447
56522
|
ComponentsSchema,
|
|
56523
|
+
ConditionalActionSchema,
|
|
56448
56524
|
ConfigLoadError,
|
|
56449
56525
|
ContextLoadingSchema,
|
|
56450
56526
|
ContextTypeSchema,
|