agent-contracts 0.18.0 → 0.19.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/index.d.ts CHANGED
@@ -1343,6 +1343,12 @@ declare const AgentContractsConfigSchema: z.ZodObject<{
1343
1343
  active_guardrail_policy: z.ZodOptional<z.ZodString>;
1344
1344
  interface_output: z.ZodOptional<z.ZodString>;
1345
1345
  }, z.core.$strip>>>;
1346
+ audit: z.ZodOptional<z.ZodObject<{
1347
+ adapter: z.ZodOptional<z.ZodString>;
1348
+ model: z.ZodOptional<z.ZodString>;
1349
+ temperature: z.ZodOptional<z.ZodNumber>;
1350
+ cache_dir: z.ZodOptional<z.ZodString>;
1351
+ }, z.core.$strip>>;
1346
1352
  }, z.core.$strip>;
1347
1353
  type AgentContractsConfig = z.infer<typeof AgentContractsConfigSchema>;
1348
1354
  interface ResolvedRenderTarget {
@@ -1622,6 +1628,119 @@ interface ScoreResult {
1622
1628
 
1623
1629
  declare function score(dsl: Dsl): ScoreResult;
1624
1630
 
1631
+ type AuditType = "render" | "dsl" | "prompt";
1632
+ type OutputFormat = "text" | "json" | "markdown";
1633
+ interface AuditOptions {
1634
+ auditType: AuditType;
1635
+ format: OutputFormat;
1636
+ scope?: string;
1637
+ dryRun: boolean;
1638
+ adapter?: string;
1639
+ model?: string;
1640
+ team?: string;
1641
+ }
1642
+ interface AuditConfig {
1643
+ adapter?: string;
1644
+ model?: string;
1645
+ temperature?: number;
1646
+ cache_dir?: string;
1647
+ }
1648
+
1649
+ /**
1650
+ * AUTO-GENERATED by agent-contracts-runtime. DO NOT EDIT.
1651
+ *
1652
+ * Regenerate via: npx agent-runtime generate
1653
+ */
1654
+
1655
+ declare const DslAuditResultSchema: z.ZodObject<{
1656
+ audit_type: z.ZodEnum<{
1657
+ semantic: "semantic";
1658
+ prompt: "prompt";
1659
+ completeness: "completeness";
1660
+ }>;
1661
+ total_dimensions: z.ZodNumber;
1662
+ pass_count: z.ZodNumber;
1663
+ miss_count: z.ZodNumber;
1664
+ partial_count: z.ZodOptional<z.ZodNumber>;
1665
+ agents_reviewed: z.ZodOptional<z.ZodNumber>;
1666
+ prompts_reviewed: z.ZodOptional<z.ZodNumber>;
1667
+ gate_analysis_complete: z.ZodOptional<z.ZodBoolean>;
1668
+ guardrail_enforcement_verified: z.ZodOptional<z.ZodBoolean>;
1669
+ critical_gaps: z.ZodOptional<z.ZodArray<z.ZodObject<{
1670
+ dimension: z.ZodOptional<z.ZodString>;
1671
+ agent: z.ZodOptional<z.ZodString>;
1672
+ gap_type: z.ZodOptional<z.ZodEnum<{
1673
+ template_gap: "template_gap";
1674
+ data_gap: "data_gap";
1675
+ dsl_gap: "dsl_gap";
1676
+ }>>;
1677
+ severity: z.ZodOptional<z.ZodEnum<{
1678
+ critical: "critical";
1679
+ warning: "warning";
1680
+ info: "info";
1681
+ }>>;
1682
+ }, z.core.$strip>>>;
1683
+ recommendations: z.ZodOptional<z.ZodArray<z.ZodObject<{
1684
+ priority: z.ZodOptional<z.ZodEnum<{
1685
+ P0: "P0";
1686
+ P1: "P1";
1687
+ P2: "P2";
1688
+ }>>;
1689
+ description: z.ZodOptional<z.ZodString>;
1690
+ fix_type: z.ZodOptional<z.ZodEnum<{
1691
+ template_fix: "template_fix";
1692
+ dsl_fix: "dsl_fix";
1693
+ regeneration: "regeneration";
1694
+ }>>;
1695
+ }, z.core.$strip>>>;
1696
+ }, z.core.$strip>;
1697
+ type DslAuditResult = z.infer<typeof DslAuditResultSchema>;
1698
+
1699
+ /**
1700
+ * Audit orchestrator — runs LLM-based semantic audits via agent-contracts-runtime.
1701
+ *
1702
+ * Uses the auto-generated contracts from dsl_base/ (agentRegistry, taskRegistry,
1703
+ * handoffSchemas) and the runtime's runTask() for execution, follow-up recovery,
1704
+ * and handoff schema validation.
1705
+ *
1706
+ * agent-contracts-runtime is an optional peer dependency — it is loaded
1707
+ * dynamically at audit invocation time so that users who don't use audit
1708
+ * have zero additional overhead.
1709
+ */
1710
+
1711
+ interface AuditRunResult {
1712
+ taskId: string;
1713
+ auditType: AuditType;
1714
+ data: DslAuditResult | null;
1715
+ raw: string;
1716
+ prompt: string;
1717
+ dryRun: boolean;
1718
+ status: "success" | "validation_error" | "escalation" | "error";
1719
+ errorMessage?: string;
1720
+ followUpsUsed: number;
1721
+ retriesUsed: number;
1722
+ }
1723
+ declare function runAudit(dsl: Dsl, config: ResolvedConfig, auditConfig: AuditConfig, options: AuditOptions): Promise<AuditRunResult>;
1724
+ declare function runAllAudits(dsl: Dsl, config: ResolvedConfig, auditConfig: AuditConfig, options: Omit<AuditOptions, "auditType">): Promise<AuditRunResult[]>;
1725
+
1726
+ /**
1727
+ * Build the audit context string that becomes the user_request for runTask().
1728
+ *
1729
+ * Each audit type collects the relevant DSL data and rendered files,
1730
+ * then formats them into a structured prompt that the dsl-auditor agent
1731
+ * can analyze via LLM.
1732
+ */
1733
+
1734
+ declare function buildAuditContext(auditType: AuditType, dsl: Dsl, config: ResolvedConfig): Promise<string>;
1735
+
1736
+ /**
1737
+ * Format audit results for CLI output.
1738
+ */
1739
+
1740
+ declare function formatAuditResult(r: AuditRunResult, format: OutputFormat): string;
1741
+ declare function formatAuditResults(results: AuditRunResult[], format: OutputFormat): string;
1742
+ declare function computeExitCode(results: AuditRunResult[]): number;
1743
+
1625
1744
  interface ResolvedCheck {
1626
1745
  guardrail_id: string;
1627
1746
  guardrail: Guardrail;
@@ -1684,4 +1803,4 @@ interface PathResolveResult {
1684
1803
  }
1685
1804
  declare function resolveBindingTargetPath(target: string, paths: Record<string, string>, bindingSoftware: string): PathResolveResult;
1686
1805
 
1687
- export { type Agent, type AgentContractsConfig, AgentContractsConfigSchema, AgentSchema, type AppendOperator, AppendOperatorSchema, type Artifact, ArtifactSchema, BaseResolveError, type BindingGenerationContext, type BindingOutput, BindingOutputSchema, type BindingRenderTarget, BindingRenderTargetSchema, CONTEXT_TYPES, type Check, CheckSchema, type Command, CommandSchema, 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 PathResolveResult, type PerAgentContext, type PerArtifactContext, 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 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, buildGlobalContext, buildGuardrailContext, buildGuardrailPolicyContext, buildHandoffTypeContext, buildPerAgentContext, buildPolicyContext, buildSystemContext, buildTaskContext, buildToolContext, buildValidationContext, buildWorkflowContext, builtinRules, checkDriftFromConfig, checkReferences, expandDefaults, generateGuardrails, lint, loadBindings, loadConfig, loadDsl, mergeDsl, renderFromConfig, resolve, resolveAllOf, resolveBase, resolveBindingTargetPath, resolveChecks, resolveDslPath, resolveEffectiveGuardrails, resolveEntityValidations, score, spectralLint, validateHandoffSchemas, validateSchema, yamlReservedKeySafetyRule };
1806
+ export { type Agent, type AgentContractsConfig, AgentContractsConfigSchema, AgentSchema, type AppendOperator, AppendOperatorSchema, type Artifact, 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 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 PathResolveResult, type PerAgentContext, type PerArtifactContext, 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 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, buildGlobalContext, buildGuardrailContext, buildGuardrailPolicyContext, buildHandoffTypeContext, buildPerAgentContext, buildPolicyContext, buildSystemContext, buildTaskContext, buildToolContext, buildValidationContext, buildWorkflowContext, builtinRules, checkDriftFromConfig, checkReferences, computeExitCode, expandDefaults, formatAuditResult, formatAuditResults, generateGuardrails, lint, loadBindings, loadConfig, loadDsl, mergeDsl, renderFromConfig, resolve, resolveAllOf, resolveBase, resolveBindingTargetPath, resolveChecks, resolveDslPath, resolveEffectiveGuardrails, resolveEntityValidations, runAllAudits, runAudit, score, spectralLint, validateHandoffSchemas, validateSchema, yamlReservedKeySafetyRule };