Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | import { GenerationModelInfo } from "@/objects/AgentSetup";
import {
Rule,
RuleAction,
RuleCondition,
RuleLayer,
RuleScope,
} from "@/objects/Rule";
/** Types for the generative governance flow (POST /app/rules/generate, then
* /app/rules/create-from-config).
*
* Everything here has already been validated against svc-core's rule
* registries before it arrives: a proposed rule whose condition field,
* operator, action or scope the engine does not carry is dropped there, with
* the reason in `warnings`. That is why the proposal is in the same shape as
* a stored rule rather than a looser "suggestion" — what comes back is
* exactly what will be written, and the review step edits it in place. */
export interface GenerateRulesRequest {
problem_description: string;
ai_model_id?: string | null;
}
/** One validated rule, in the shape the review step edits and posts back. */
export interface ProposedRule {
name: string;
description: string;
layer: RuleLayer;
scope_type: RuleScope;
scope_id?: string | null;
/** What the scope resolves to, in words. Approving "applies to 7f3c…"
* tells a reviewer nothing, so the backend resolves the pin for display. */
scope_label: string;
conditions: RuleCondition[];
actions: RuleAction[];
priority: number;
is_active: boolean;
}
export interface RulesGenerationProposal {
reasoning: string;
proposed_rules: ProposedRule[];
/** Why a rule the model proposed is not in the list. */
warnings: string[];
model: GenerationModelInfo;
/** Echoed back on create so the rules resolve to this invocation. */
generation_id: string;
}
export interface CreateRulesFromConfigRequest {
rules: ProposedRule[];
generation_id?: string | null;
}
export interface CreateRulesFromConfigResponse {
rules: Rule[];
}
|