Add Scene 7 claim report workflow

This commit is contained in:
2026-08-22 17:02:30 +02:00
parent a7f99a2a39
commit cea0d56cb9
23 changed files with 638 additions and 82 deletions
+8 -2
View File
@@ -2,7 +2,7 @@ import { randomUUID } from 'node:crypto'
import { readFile } from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import type { CaseDocument, CaseState, PartyKind, SourceFileType } from '../src/types.js'
import type { CaseDocument, CaseState, ClaimExhibit, PartyKind, SourceFileType } from '../src/types.js'
type MysteryDocument = {
key: string
@@ -45,6 +45,8 @@ type MysteryManifest = {
brief: { body: string; concepts: { label: string; context: string; expectedPartyKind: PartyKind }[] }
documents: MysteryDocument[]
folders: { key: string; title: string; content: string; x: number; y: number; width: number; members: string[] }[]
claims?: { key:string;statement:string;x:number;y:number;width?:number;height?:number }[]
report?: { title?:string;requiredForCompletion?:boolean }
goals?: MysteryGoal[]
evidenceMatchRules?: MysteryEvidenceMatchRule[]
evidenceSemanticRules?: MysterySemanticRule[]
@@ -107,7 +109,9 @@ export async function importMysteryTemplate(manifestPath: string, baseUrl = 'htt
id: folderIds.get(folder.key)!, type: 'folder', title: folder.title, content: folder.content,
x: folder.x, y: folder.y, width: folder.width, height: 166, rotation: 0, zIndex: 1, hidden: false, isOpen: false,
} as const))
state.exhibits = [...documents.values(), ...folders]
const claims:ClaimExhibit[]=(manifest.claims || []).map(claim => ({ id:randomUUID(),type:'claim',title:claim.statement,statement:claim.statement,
x:claim.x,y:claim.y,width:claim.width || 310,height:claim.height || 180,rotation:0,zIndex:2,hidden:false }))
state.exhibits = [...documents.values(), ...folders,...claims]
state.relations = manifest.folders.flatMap(folder => folder.members.map((key, memberIndex) => {
const document = documents.get(key)
if (!document) throw new Error(`Folder ${folder.key} refers to unknown document ${key}`)
@@ -117,6 +121,8 @@ export async function importMysteryTemplate(manifestPath: string, baseUrl = 'htt
}
}))
state.connections = []
state.report=manifest.report ? { title:manifest.report.title || 'Case Report',investigatorName:'',requiredForCompletion:manifest.report.requiredForCompletion !== false,
status:'draft',issues:[],claims:[] } : undefined
state.viewport = { x: 0, y: 28, zoom: 0.7 }
await requireOk(await fetch(`${baseUrl}/api/levels/${state.id}?edit=1`, {