// Annotation — pure model. Trajectory-level scoring + per-turn 5-dim scoring // + task-category tagging + JSONL export projection. Renderer (annotation- // panel.js) drives the DOM around this; the model owns the shape math so // tests catch drifts before they land in the export contract. // // Shape lock (per docs/design-refs/rl-workflow-needs.md §6 G13/G16, memory // rl-rubric-annotation-plan §2): // // sessionAnnotation = { // sessionId, updatedAt, // annotator?: string, // who wrote this record; // // demo tier defaults to // // 'local-user' at write time, // // G16 wire will replace w/ // // real identity // overall: 'bad'|'ok'|'good'|null, // required for export // taskGroup: |null, // taskSubtask: |null, // turnScores: [ // per-assistant-turn // { turnIndex, updatedAt, // per-turn stamp — feeds // // #205 Feedback tab "time" // // column with per-turn // // precision (session-level // // updatedAt is a rollup) // dims: {feedback-understanding:1-5, fix-effectiveness:1-5, // no-regression:1-5, over-correction:1-5, // convergence:1-5}, // note?: string, priorFeedback?: string } // ], // notes?: string, // } // // Consumer contract note (#205 Feedback tab, lane-trace-triview): read the // stored record via `window.__dshAnnotation.read(sessionId)` (never touch // `_state`). Push updates arrive via `dsh:annotation-updated` CustomEvent // on document with detail `{sessionId, ann}`. Dim ids stay kebab-case at // the model layer — triview adapts on its side if wire wants snake_case. // // Export shape (jsonl-to-html compatible — one JSONL row per session): // { // messages: [{role, content}, ...], // reasoning_content?: string, // tool_calls?: [...], // annotation-fields: { // overall: 'bad'|'ok'|'good', // task_group: , // task_subtask: , // turn_scores: [{turn_index, ...dims, note?, prior_feedback?}], // annotator?: , // exported_at: // } // } // // Second format = triple projection (state, action, reward): // { state: , action: , reward: <0-1>, // turn_index, session_id } // One row per assistant turn; reward is the mean of the 5 dims scaled to 0-1. 'use strict' // Load the shared rubrics model — under `