Skip to content

Type Alias: DraftRulesResponse

@kortexya/reasoninglayer


@kortexya/reasoninglayer / DraftRulesResponse

DraftRulesResponse = { questions: RuleDraftClarificationQuestionDto[]; sessionId: string; status: "needs_clarification"; understood: object; } | { explanation?: string | null; generationTimeMs: number; rules: RuleDraftDto[]; status: "complete"; warnings: string[]; }

Defined in: src/types/inference.ts:2025

Response for a rules draft.

{ questions: RuleDraftClarificationQuestionDto[]; sessionId: string; status: "needs_clarification"; understood: object; }

questions: RuleDraftClarificationQuestionDto[]

Clarification questions the user must answer.

sessionId: string

Session ID to echo back on the follow-up request.

status: "needs_clarification"

Discriminator: clarification is needed.

understood: object

What the model already understood from the description.


{ explanation?: string | null; generationTimeMs: number; rules: RuleDraftDto[]; status: "complete"; warnings: string[]; }

optional explanation?: string | null

Plain-language summary of what the drafted rules mean.

generationTimeMs: number

Time taken to generate the drafts, in milliseconds.

rules: RuleDraftDto[]

The drafted rules, validated but NOT written to the knowledge base.

status: "complete"

Discriminator: drafting is complete.

warnings: string[]

Non-fatal issues (e.g. sorts that do not exist in this tenant yet).

Discriminated union by the status field:

  • "needs_clarification" — the model needs more information before drafting.
  • "complete" — validated drafts are ready for human review.

Serialization format: Untagged (RuleDraftFeatureValue) — see RuleTermDraftDto.

Drafting never writes to the knowledge base. Nothing is persisted until the caller submits an approved draft through addRule / bulkAddRules.