wip(confidence-engine): checkpoint open-question presentation work
This commit is contained in:
@@ -144,6 +144,21 @@ const reconstructionRelationshipSchema = z.object({
|
||||
confidence: confidenceEnum,
|
||||
});
|
||||
|
||||
const importantUnknownSchema = itemSchemaV1.extend({
|
||||
// Canonical uncertainty meaning remains in description. question is an
|
||||
// optional, model-authored user-facing interrogative for the Open Questions UI.
|
||||
// Keep this tolerant for historical data and nonfatal presentation validation.
|
||||
question: z.string().optional(),
|
||||
});
|
||||
|
||||
const generatedImportantUnknownSchema = itemSchemaV1.extend({
|
||||
// New generation requests require a distinct presentation candidate. More
|
||||
// nuanced interrogative validation is intentionally performed locally after
|
||||
// canonical reconstruction validation rather than encoded as provider-specific
|
||||
// JSON Schema grammar.
|
||||
question: z.string().trim().min(1),
|
||||
});
|
||||
|
||||
const reconstructionSchemaV2 = z.object({
|
||||
summary: z.string().min(1),
|
||||
actors: z.array(itemSchemaV1),
|
||||
@@ -167,7 +182,7 @@ const reconstructionSchemaV2 = z.object({
|
||||
}),
|
||||
),
|
||||
contradictions: z.array(itemSchemaV1),
|
||||
importantUnknowns: z.array(itemSchemaV1),
|
||||
importantUnknowns: z.array(importantUnknownSchema),
|
||||
plausibleInterpretations: z.array(
|
||||
z.object({
|
||||
id: z.string().min(1),
|
||||
@@ -205,6 +220,19 @@ export const reconstructionV2Schema = z.object({
|
||||
nextQuestion: nextQuestionSchema,
|
||||
});
|
||||
|
||||
// Generation-only contract. Durable reconstruction parsing remains tolerant so
|
||||
// historical snapshots and otherwise valid canonical reconstructions do not fail
|
||||
// solely because presentation wording is absent or malformed.
|
||||
export const reconstructionGenerationSchema = reconstructionV2Schema.extend({
|
||||
reconstruction: reconstructionSchemaV2.extend({
|
||||
importantUnknowns: z.array(generatedImportantUnknownSchema),
|
||||
}),
|
||||
});
|
||||
|
||||
export const reconstructionGenerationJsonSchema = z.toJSONSchema(
|
||||
reconstructionGenerationSchema,
|
||||
);
|
||||
|
||||
// Outer wrapper for API return (includes diagnostics + v0.2 data)
|
||||
export const analyseResponseV2Schema = z.object({
|
||||
inputClassification: inputClassificationSchema.optional(),
|
||||
|
||||
Reference in New Issue
Block a user