@happyvertical/smrt-education 0.57.46 → 0.57.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +5 -0
- package/README.md +7 -1
- package/agents/learner-service.md +31 -2
- package/agents/question-extraction.md +108 -0
- package/agents/submission-service.md +15 -0
- package/dist/chunks/{workbook-photo-service-DKgoUHeb.js → workbook-photo-service-B7Tujv__.js} +6494 -1153
- package/dist/chunks/workbook-photo-service-B7Tujv__.js.map +1 -0
- package/dist/collections.d.ts +4 -1
- package/dist/collections.d.ts.map +1 -1
- package/dist/course-authoring-contracts.d.ts +1 -1
- package/dist/course-authoring-contracts.d.ts.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1049 -4628
- package/dist/index.js.map +1 -1
- package/dist/ingestion.d.ts +2 -0
- package/dist/ingestion.d.ts.map +1 -1
- package/dist/ingestion.js +197 -2
- package/dist/ingestion.js.map +1 -1
- package/dist/learner-history.d.ts +50 -0
- package/dist/learner-history.d.ts.map +1 -0
- package/dist/learner-service.d.ts +78 -2
- package/dist/learner-service.d.ts.map +1 -1
- package/dist/manifest.json +4255 -1444
- package/dist/question-extraction-contracts.d.ts +231 -0
- package/dist/question-extraction-contracts.d.ts.map +1 -0
- package/dist/question-extraction-ingestion.d.ts +44 -0
- package/dist/question-extraction-ingestion.d.ts.map +1 -0
- package/dist/question-extraction-models.d.ts +56 -0
- package/dist/question-extraction-models.d.ts.map +1 -0
- package/dist/question-extraction-service.d.ts +71 -0
- package/dist/question-extraction-service.d.ts.map +1 -0
- package/dist/question-extraction.d.ts +317 -0
- package/dist/question-extraction.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +961 -143
- package/dist/submission-service.d.ts +34 -1
- package/dist/submission-service.d.ts.map +1 -1
- package/dist/submissions.d.ts +25 -1
- package/dist/submissions.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/chunks/workbook-photo-service-DKgoUHeb.js.map +0 -1
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Closed contracts for extracting structured questions from scanned worksheets
|
|
3
|
+
* and imported course files (SMRT #4517). Pure types, limits and typed errors;
|
|
4
|
+
* no I/O. See `agents/question-extraction.md`.
|
|
5
|
+
*/
|
|
6
|
+
import { CourseAuthoringError } from './course-authoring-contracts.js';
|
|
7
|
+
import type { QuestionChoice, QuestionResponseType, QuestionRubric } from './question-contracts.js';
|
|
8
|
+
export declare const QUESTION_EXTRACTION_VERSION: 1;
|
|
9
|
+
export type QuestionExtractionSourceKind = 'worksheet_scan' | 'course_import';
|
|
10
|
+
export declare const QUESTION_EXTRACTION_SOURCE_KINDS: readonly QuestionExtractionSourceKind[];
|
|
11
|
+
/** What a source page is. Only `exercise`/`mixed` pages yield question records. */
|
|
12
|
+
export type ExtractedPageRole = 'exercise' | 'example' | 'instructions' | 'cover' | 'answer_key' | 'mixed' | 'unknown';
|
|
13
|
+
export declare const EXTRACTED_PAGE_ROLES: readonly ExtractedPageRole[];
|
|
14
|
+
export type ExtractedReadability = 'readable' | 'partial' | 'unreadable' | 'unsupported';
|
|
15
|
+
export declare const EXTRACTED_READABILITY: readonly ExtractedReadability[];
|
|
16
|
+
/** `complete` and `partial` items carry a printed prompt; the others do not. */
|
|
17
|
+
export type ExtractedQuestionStatus = 'complete' | 'partial' | 'unreadable' | 'unsupported';
|
|
18
|
+
export declare const EXTRACTED_QUESTION_STATUSES: readonly ExtractedQuestionStatus[];
|
|
19
|
+
/** Printed in the source, or inferred by the extractor. Never mixed up. */
|
|
20
|
+
export type ExtractedOrigin = 'source' | 'inferred';
|
|
21
|
+
export declare const EXTRACTED_ORIGINS: readonly ExtractedOrigin[];
|
|
22
|
+
export type ExtractedMediaKind = 'diagram' | 'image' | 'table' | 'graph' | 'other';
|
|
23
|
+
export declare const EXTRACTED_MEDIA_KINDS: readonly ExtractedMediaKind[];
|
|
24
|
+
export type ExtractedLegibility = 'legible' | 'partial' | 'illegible';
|
|
25
|
+
export declare const EXTRACTED_LEGIBILITY: readonly ExtractedLegibility[];
|
|
26
|
+
export type ExtractedOmissionReason = 'unreadable' | 'unsupported' | 'out_of_scope'
|
|
27
|
+
/** Ingestion did not extract it (truncated output or a failed page). */
|
|
28
|
+
| 'not_extracted';
|
|
29
|
+
export declare const EXTRACTED_OMISSION_REASONS: readonly ExtractedOmissionReason[];
|
|
30
|
+
/** Source anchor as cited by the extractor: evidence, physical page, region id. */
|
|
31
|
+
export interface ExtractedAnchorInput {
|
|
32
|
+
evidenceId: string;
|
|
33
|
+
/** Physical 1-based source page; null when unknown. Printed page numbers are not pages. */
|
|
34
|
+
page: number | null;
|
|
35
|
+
/** Id from the evidence's observedRegions catalog; never a coordinate. */
|
|
36
|
+
regionId: string | null;
|
|
37
|
+
}
|
|
38
|
+
/** A cited anchor resolved against retained evidence. `rect` only comes from the catalog. */
|
|
39
|
+
export interface ExtractedAnchor extends ExtractedAnchorInput {
|
|
40
|
+
sha256: string;
|
|
41
|
+
/** Normalized x, y, width, height from the provider's region catalog, else null. */
|
|
42
|
+
rect: [number, number, number, number] | null;
|
|
43
|
+
}
|
|
44
|
+
export interface ExtractedPage {
|
|
45
|
+
evidenceId: string;
|
|
46
|
+
page: number | null;
|
|
47
|
+
role: ExtractedPageRole;
|
|
48
|
+
readability: ExtractedReadability;
|
|
49
|
+
}
|
|
50
|
+
export interface ExtractedSection {
|
|
51
|
+
id: string;
|
|
52
|
+
label: string | null;
|
|
53
|
+
evidenceId: string;
|
|
54
|
+
page: number | null;
|
|
55
|
+
}
|
|
56
|
+
export interface ExtractedMediaRef<A = ExtractedAnchor> {
|
|
57
|
+
kind: ExtractedMediaKind;
|
|
58
|
+
description: string;
|
|
59
|
+
anchor: A | null;
|
|
60
|
+
}
|
|
61
|
+
export interface ExtractedAnswerKey {
|
|
62
|
+
acceptedAnswers?: string[];
|
|
63
|
+
correctChoiceIds?: string[];
|
|
64
|
+
numeric?: number;
|
|
65
|
+
origin: ExtractedOrigin;
|
|
66
|
+
}
|
|
67
|
+
export interface ExtractedQuestion<A = ExtractedAnchor> {
|
|
68
|
+
/** Stable per-source key: printed numbering path, or `u:<slug>:<occurrence>`. */
|
|
69
|
+
key: string;
|
|
70
|
+
/** Numbering exactly as printed (`3`, `3b`, `Q4`); null when unnumbered. */
|
|
71
|
+
numbering: string | null;
|
|
72
|
+
/** Worked examples are kept as extracted items but never become question records. */
|
|
73
|
+
role: 'exercise' | 'example';
|
|
74
|
+
sectionId: string | null;
|
|
75
|
+
status: ExtractedQuestionStatus;
|
|
76
|
+
/** Printed task text only; never learner handwriting. Null when unreadable. */
|
|
77
|
+
prompt: string | null;
|
|
78
|
+
responseType: QuestionResponseType | null;
|
|
79
|
+
responseTypeOrigin: ExtractedOrigin;
|
|
80
|
+
choices: QuestionChoice[];
|
|
81
|
+
subparts: Array<{
|
|
82
|
+
partKey: string;
|
|
83
|
+
prompt: string;
|
|
84
|
+
}>;
|
|
85
|
+
media: ExtractedMediaRef<A>[];
|
|
86
|
+
answerKey: ExtractedAnswerKey | null;
|
|
87
|
+
rubric: (QuestionRubric & {
|
|
88
|
+
origin: ExtractedOrigin;
|
|
89
|
+
}) | null;
|
|
90
|
+
pointsPossible: number | null;
|
|
91
|
+
pointsOrigin: ExtractedOrigin | null;
|
|
92
|
+
anchors: A[];
|
|
93
|
+
}
|
|
94
|
+
/** Observed learner work, kept apart from printed questions. */
|
|
95
|
+
export interface ExtractedStudentWork<A = ExtractedAnchor> {
|
|
96
|
+
/** The printed question this work answers, when visibly associated. */
|
|
97
|
+
questionKey: string | null;
|
|
98
|
+
/** Transcribed response; null when illegible. Never a solved or expected answer. */
|
|
99
|
+
observed: string | null;
|
|
100
|
+
legibility: ExtractedLegibility;
|
|
101
|
+
anchors: A[];
|
|
102
|
+
}
|
|
103
|
+
export interface ExtractedOmission {
|
|
104
|
+
evidenceId: string;
|
|
105
|
+
page: number | null;
|
|
106
|
+
reason: ExtractedOmissionReason;
|
|
107
|
+
description: string;
|
|
108
|
+
}
|
|
109
|
+
/** The handler arguments a proposal generator fills (closed; see the schema). */
|
|
110
|
+
export interface QuestionExtractionInput {
|
|
111
|
+
version: 1;
|
|
112
|
+
sourceKind: QuestionExtractionSourceKind;
|
|
113
|
+
/** Worksheet version id printed on the page (generated printables print it); else null. */
|
|
114
|
+
worksheetVersionId: string | null;
|
|
115
|
+
pages: ExtractedPage[];
|
|
116
|
+
sections: ExtractedSection[];
|
|
117
|
+
questions: ExtractedQuestion<ExtractedAnchorInput>[];
|
|
118
|
+
studentWork: ExtractedStudentWork<ExtractedAnchorInput>[];
|
|
119
|
+
omissions: ExtractedOmission[];
|
|
120
|
+
}
|
|
121
|
+
/** Validated extraction with anchors resolved against retained evidence. */
|
|
122
|
+
export interface QuestionExtraction extends Omit<QuestionExtractionInput, 'questions' | 'studentWork'> {
|
|
123
|
+
questions: ExtractedQuestion[];
|
|
124
|
+
studentWork: ExtractedStudentWork[];
|
|
125
|
+
/**
|
|
126
|
+
* Source completeness codes from ingestion (for example `source_incomplete`).
|
|
127
|
+
* Non-empty means the extraction was made from partial input: review it as such.
|
|
128
|
+
*/
|
|
129
|
+
sourceWarnings: string[];
|
|
130
|
+
}
|
|
131
|
+
/** Retained evidence an extraction may cite, from one completed ingestion analysis. */
|
|
132
|
+
export interface QuestionExtractionGrounding {
|
|
133
|
+
version: 1;
|
|
134
|
+
extractionAttemptId: string;
|
|
135
|
+
/** Bounded ingestion warning codes (`^[a-z][a-z0-9_.-]{0,47}$`), carried to the review. */
|
|
136
|
+
warnings?: string[];
|
|
137
|
+
sources: Array<{
|
|
138
|
+
evidenceId: string;
|
|
139
|
+
sha256: string;
|
|
140
|
+
mediaType: string;
|
|
141
|
+
/** Known physical pages (extracted and omitted); empty for single images and page-less sources. */
|
|
142
|
+
pages: number[];
|
|
143
|
+
/** Pages ingestion reported but did not extract (truncated or failed). */
|
|
144
|
+
omittedPages?: number[];
|
|
145
|
+
/** False when ingestion produced no result for this original at all. */
|
|
146
|
+
extracted?: boolean;
|
|
147
|
+
/** True when ingestion reported truncation or errors for this original. */
|
|
148
|
+
incomplete?: boolean;
|
|
149
|
+
observedRegions?: {
|
|
150
|
+
version: 1;
|
|
151
|
+
coordinateSpace: 'display-oriented';
|
|
152
|
+
regions: Array<{
|
|
153
|
+
id: string;
|
|
154
|
+
text: string;
|
|
155
|
+
rect: [number, number, number, number];
|
|
156
|
+
}>;
|
|
157
|
+
};
|
|
158
|
+
}>;
|
|
159
|
+
}
|
|
160
|
+
/** Extractor identity recorded with the preserved extraction. */
|
|
161
|
+
export interface QuestionExtractorIdentity {
|
|
162
|
+
provider: string;
|
|
163
|
+
model: string;
|
|
164
|
+
version: string;
|
|
165
|
+
/** Ingestion configuration/prompt versions that produced the proposal, when known. */
|
|
166
|
+
configurationVersion?: string;
|
|
167
|
+
promptVersion?: string;
|
|
168
|
+
}
|
|
169
|
+
export type QuestionMatchOutcome = 'matched' | 'ambiguous' | 'unmatched';
|
|
170
|
+
export type QuestionMatchReason = 'worksheet_position' | 'no_worksheet_identifier' | 'unknown_worksheet' | 'worksheet_conflict' | 'no_layout_position' | 'position_not_on_worksheet' | 'layout_conflict' | 'duplicate_position' | 'not_an_exercise';
|
|
171
|
+
export interface QuestionMatch {
|
|
172
|
+
key: string;
|
|
173
|
+
outcome: QuestionMatchOutcome;
|
|
174
|
+
reason: QuestionMatchReason;
|
|
175
|
+
/** Set only for `matched`; ambiguous matches are never attached. */
|
|
176
|
+
questionId: string | null;
|
|
177
|
+
questionRevisionId: string | null;
|
|
178
|
+
ordinal: number | null;
|
|
179
|
+
}
|
|
180
|
+
export interface QuestionExtractionMatch {
|
|
181
|
+
worksheetVersionId: string | null;
|
|
182
|
+
/** Where the worksheet identity came from; observed on the page or supplied by the host. */
|
|
183
|
+
worksheetSource: 'observed' | 'expected' | null;
|
|
184
|
+
worksheetKnown: boolean;
|
|
185
|
+
questions: QuestionMatch[];
|
|
186
|
+
}
|
|
187
|
+
export type ExtractedQuestionOutcome = 'created' | 'replayed' | 'matched' | 'needs_review' | 'source_changed' | 'invalid_content' | 'unreadable' | 'unsupported' | 'not_an_exercise';
|
|
188
|
+
export interface ExtractedQuestionResult {
|
|
189
|
+
key: string;
|
|
190
|
+
outcome: ExtractedQuestionOutcome;
|
|
191
|
+
questionId: string | null;
|
|
192
|
+
questionRevisionId: string | null;
|
|
193
|
+
}
|
|
194
|
+
export interface StudentWorkView extends ExtractedStudentWork {
|
|
195
|
+
/** The matched question revision this work belongs to; null unless matched. */
|
|
196
|
+
questionRevisionId: string | null;
|
|
197
|
+
}
|
|
198
|
+
export interface QuestionExtractionView {
|
|
199
|
+
extractionId: string;
|
|
200
|
+
intakeItemId: string;
|
|
201
|
+
analysisAttemptId: string;
|
|
202
|
+
/** Digest of source kind and retained evidence hashes: the idempotency identity. */
|
|
203
|
+
sourceIdentity: string;
|
|
204
|
+
extractor: QuestionExtractorIdentity;
|
|
205
|
+
extraction: QuestionExtraction;
|
|
206
|
+
match: QuestionExtractionMatch;
|
|
207
|
+
studentWork: StudentWorkView[];
|
|
208
|
+
/** Set once applied: the per-question outcome. Null while pending review. */
|
|
209
|
+
applied: ExtractedQuestionResult[] | null;
|
|
210
|
+
}
|
|
211
|
+
export declare const MAX_EXTRACTED_QUESTIONS = 200;
|
|
212
|
+
export declare const MAX_EXTRACTED_SECTIONS = 64;
|
|
213
|
+
export declare const MAX_EXTRACTED_PAGES = 1000;
|
|
214
|
+
export declare const MAX_EXTRACTED_STUDENT_WORK = 400;
|
|
215
|
+
export declare const MAX_EXTRACTED_OMISSIONS = 200;
|
|
216
|
+
export declare const MAX_EXTRACTED_ANCHORS = 8;
|
|
217
|
+
export declare const MAX_EXTRACTED_TEXT = 20000;
|
|
218
|
+
/** The extraction does not fit the closed contract or its retained evidence. */
|
|
219
|
+
export declare class QuestionExtractionValidationError extends CourseAuthoringError {
|
|
220
|
+
constructor(message: string);
|
|
221
|
+
}
|
|
222
|
+
/** No preserved extraction with this id in the tenant (foreign is alike). */
|
|
223
|
+
export declare class QuestionExtractionNotFoundError extends CourseAuthoringError {
|
|
224
|
+
constructor();
|
|
225
|
+
}
|
|
226
|
+
/** The ingestion analysis is not a completed question-extraction proposal yet. */
|
|
227
|
+
export declare class QuestionExtractionPendingError extends CourseAuthoringError {
|
|
228
|
+
readonly reason: 'pending' | 'no_proposal' | 'ambiguous';
|
|
229
|
+
constructor(reason: 'pending' | 'no_proposal' | 'ambiguous');
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=question-extraction-contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-extraction-contracts.d.ts","sourceRoot":"","sources":["../src/question-extraction-contracts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,eAAO,MAAM,2BAA2B,EAAG,CAAU,CAAC;AACtD,MAAM,MAAM,4BAA4B,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAC9E,eAAO,MAAM,gCAAgC,EAAE,SAAS,4BAA4B,EAC/C,CAAC;AACtC,mFAAmF;AACnF,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,SAAS,GACT,cAAc,GACd,OAAO,GACP,YAAY,GACZ,OAAO,GACP,SAAS,CAAC;AACd,eAAO,MAAM,oBAAoB,EAAE,SAAS,iBAAiB,EAQ5D,CAAC;AACF,MAAM,MAAM,oBAAoB,GAC5B,UAAU,GACV,SAAS,GACT,YAAY,GACZ,aAAa,CAAC;AAClB,eAAO,MAAM,qBAAqB,EAAE,SAAS,oBAAoB,EAKhE,CAAC;AACF,gFAAgF;AAChF,MAAM,MAAM,uBAAuB,GAC/B,UAAU,GACV,SAAS,GACT,YAAY,GACZ,aAAa,CAAC;AAClB,eAAO,MAAM,2BAA2B,EAAE,SAAS,uBAAu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,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAIzC,gFAAgF;AAChF,qBAAa,iCAAkC,SAAQ,oBAAoB;gBAC7D,OAAO,EAAE,MAAM;CAG5B;AACD,6EAA6E;AAC7E,qBAAa,+BAAgC,SAAQ,oBAAoB;;CAOxE;AACD,kFAAkF;AAClF,qBAAa,8BAA+B,SAAQ,oBAAoB;IAC1D,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW;gBAA/C,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW;CAMrE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-only ingestion bridge for question extraction (SMRT #4517): the
|
|
3
|
+
* `extract-questions` catalog handler and the preserve step that validates a
|
|
4
|
+
* completed proposal against retained evidence. Never import from browser code.
|
|
5
|
+
*/
|
|
6
|
+
import type { OperationHandler } from '@happyvertical/smrt-ingestion/execution';
|
|
7
|
+
import { type IngestionService } from '@happyvertical/smrt-ingestion/server';
|
|
8
|
+
import type { CourseAuthoringActor } from './course-authoring-contracts.js';
|
|
9
|
+
import type { WorksheetBundle } from './question-contracts.js';
|
|
10
|
+
import { type QuestionExtractionGrounding, type QuestionExtractionView } from './question-extraction-contracts.js';
|
|
11
|
+
import { type QuestionExtractionService } from './question-extraction-service.js';
|
|
12
|
+
export declare const QUESTION_EXTRACTION_HANDLER_ID = "@happyvertical/smrt-education:extract-questions";
|
|
13
|
+
/**
|
|
14
|
+
* The `extract-questions` handler for ONE authenticated actor (guardian or a
|
|
15
|
+
* delegated agent). The application resolves `request` from its session. Keep
|
|
16
|
+
* every ingestion policy layer `requireReview: true`; there is no automation.
|
|
17
|
+
* Apply requires `preserveQuestionExtractionAnalysis` to have kept the exact
|
|
18
|
+
* proposal first.
|
|
19
|
+
*/
|
|
20
|
+
export declare function educationQuestionExtractionHandler(input: {
|
|
21
|
+
extractions: QuestionExtractionService;
|
|
22
|
+
request: CourseAuthoringActor;
|
|
23
|
+
}): OperationHandler;
|
|
24
|
+
type Snapshot = Awaited<ReturnType<IngestionService['getCompletedAnalysis']>>;
|
|
25
|
+
/** Retained original evidence of one completed analysis, as extraction grounding. */
|
|
26
|
+
export declare function questionExtractionGrounding(snapshot: Snapshot, warnings?: readonly string[]): QuestionExtractionGrounding;
|
|
27
|
+
/**
|
|
28
|
+
* Preserve the current completed `extract-questions` proposal of one intake
|
|
29
|
+
* item for extraction review: validates it against retained evidence, matches
|
|
30
|
+
* it to known worksheets and records it (idempotent per analysis attempt).
|
|
31
|
+
* Not ready, no proposal or competing proposals throw
|
|
32
|
+
* `QuestionExtractionPendingError`; invalid output throws
|
|
33
|
+
* `QuestionExtractionValidationError`. Writes no question records.
|
|
34
|
+
*/
|
|
35
|
+
export declare function preserveQuestionExtractionAnalysis(input: {
|
|
36
|
+
ingestion: IngestionService;
|
|
37
|
+
extractions: QuestionExtractionService;
|
|
38
|
+
request: CourseAuthoringActor;
|
|
39
|
+
itemId: string;
|
|
40
|
+
expectedWorksheetVersionId?: string;
|
|
41
|
+
worksheets?: readonly WorksheetBundle[];
|
|
42
|
+
}): Promise<QuestionExtractionView>;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=question-extraction-ingestion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-extraction-ingestion.d.ts","sourceRoot":"","sources":["../src/question-extraction-ingestion.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,sCAAsC,CAAC;AAG9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAEL,KAAK,2BAA2B,EAGhC,KAAK,sBAAsB,EAC5B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,KAAK,yBAAyB,EAE/B,MAAM,kCAAkC,CAAC;AAE1C,eAAO,MAAM,8BAA8B,oDACQ,CAAC;AAuFpD;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAAC,KAAK,EAAE;IACxD,WAAW,EAAE,yBAAyB,CAAC;IACvC,OAAO,EAAE,oBAAoB,CAAC;CAC/B,GAAG,gBAAgB,CA4DnB;AAED,KAAK,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;AAE9E,qFAAqF;AACrF,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,GAAE,SAAS,MAAM,EAAO,GAC/B,2BAA2B,CAyG7B;AAED;;;;;;;GAOG;AACH,wBAAsB,kCAAkC,CAAC,KAAK,EAAE;IAC9D,SAAS,EAAE,gBAAgB,CAAC;IAC5B,WAAW,EAAE,yBAAyB,CAAC;IACvC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,UAAU,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;CACzC,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAwDlC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { SmrtCollection, SmrtObject, type SmrtSaveOptions } from '@happyvertical/smrt-core';
|
|
2
|
+
import { type ExtractedQuestionOutcome, type QuestionExtractionSourceKind } from './question-extraction-contracts.js';
|
|
3
|
+
/**
|
|
4
|
+
* Append-only preserved question extraction: one row per tenant, intake item
|
|
5
|
+
* and ingestion analysis attempt. Holds the validated extraction (anchors
|
|
6
|
+
* resolved against retained evidence), the evidence-only match and the
|
|
7
|
+
* extractor identity. The originals stay in ingestion; this never copies bytes.
|
|
8
|
+
*/
|
|
9
|
+
export declare class QuestionExtractionRecord extends SmrtObject {
|
|
10
|
+
tenantId: string;
|
|
11
|
+
/** Ingestion intake item id (an ingestion-owned identity, not a local FK). */
|
|
12
|
+
intakeItemId: string;
|
|
13
|
+
analysisAttemptId: string;
|
|
14
|
+
sourceIdentity: string;
|
|
15
|
+
sourceKind: QuestionExtractionSourceKind;
|
|
16
|
+
/** Digest of the reviewed proposal arguments; binds the later human decision. */
|
|
17
|
+
proposalDigest: string;
|
|
18
|
+
/** Digest of every preserve input (grounding, extractor, worksheets): same-key replays must match. */
|
|
19
|
+
inputDigest: string;
|
|
20
|
+
extractorJson: string;
|
|
21
|
+
extractionJson: string;
|
|
22
|
+
matchJson: string;
|
|
23
|
+
recordedByUserId: string;
|
|
24
|
+
recordedAt: Date;
|
|
25
|
+
constructor(options?: Record<string, unknown>);
|
|
26
|
+
delete(): Promise<void>;
|
|
27
|
+
save(options?: SmrtSaveOptions): Promise<this>;
|
|
28
|
+
}
|
|
29
|
+
export declare class QuestionExtractionRecordCollection extends SmrtCollection<QuestionExtractionRecord> {
|
|
30
|
+
static readonly _itemClass: typeof QuestionExtractionRecord;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Append-only applied outcome of one extracted question: which question record
|
|
34
|
+
* it created or matched (or why none), with its source anchors and media refs.
|
|
35
|
+
* This is the provenance link from a question record back to page and region.
|
|
36
|
+
*/
|
|
37
|
+
export declare class ExtractedQuestionLink extends SmrtObject {
|
|
38
|
+
tenantId: string;
|
|
39
|
+
extractionId: string;
|
|
40
|
+
questionKey: string;
|
|
41
|
+
sourceIdentity: string;
|
|
42
|
+
outcome: ExtractedQuestionOutcome;
|
|
43
|
+
questionId: string | null;
|
|
44
|
+
questionRevisionId: string | null;
|
|
45
|
+
anchorsJson: string;
|
|
46
|
+
mediaJson: string;
|
|
47
|
+
appliedByUserId: string;
|
|
48
|
+
recordedAt: Date;
|
|
49
|
+
constructor(options?: Record<string, unknown>);
|
|
50
|
+
delete(): Promise<void>;
|
|
51
|
+
save(options?: SmrtSaveOptions): Promise<this>;
|
|
52
|
+
}
|
|
53
|
+
export declare class ExtractedQuestionLinkCollection extends SmrtCollection<ExtractedQuestionLink> {
|
|
54
|
+
static readonly _itemClass: typeof ExtractedQuestionLink;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=question-extraction-models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-extraction-models.d.ts","sourceRoot":"","sources":["../src/question-extraction-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EACd,UAAU,EACV,KAAK,eAAe,EAErB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,4BAA4B,EAClC,MAAM,oCAAoC,CAAC;AAuD5C;;;;;GAKG;AACH,qBAiBa,wBAAyB,SAAQ,UAAU;IAC1C,QAAQ,SAAM;IAC1B,8EAA8E;IAC9E,YAAY,SAAM;IAClB,iBAAiB,SAAM;IACvB,cAAc,SAAM;IACpB,UAAU,EAAE,4BAA4B,CAAoB;IAC5D,iFAAiF;IACjF,cAAc,SAAM;IACpB,sGAAsG;IACtG,WAAW,SAAM;IACQ,aAAa,SAAQ;IACrB,cAAc,SAAQ;IACtB,SAAS,SAAQ;IAC1C,gBAAgB,SAAM;IACtB,UAAU,OAAc;gBACZ,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAIlC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAGvB,IAAI,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAiB9D;AACD,qBAAa,kCAAmC,SAAQ,cAAc,CAAC,wBAAwB,CAAC;IAC9F,MAAM,CAAC,QAAQ,CAAC,UAAU,kCAA4B;CACvD;AAED;;;;GAIG;AACH,qBAqBa,qBAAsB,SAAQ,UAAU;IACvC,QAAQ,SAAM;IACkC,YAAY,SAAM;IAC9E,WAAW,SAAM;IACjB,cAAc,SAAM;IACpB,OAAO,EAAE,wBAAwB,CAAkB;IACP,UAAU,EAAE,MAAM,GAAG,IAAI,CAAQ;IACzB,kBAAkB,EAClE,MAAM,GACN,IAAI,CAAQ;IACS,WAAW,SAAQ;IACnB,SAAS,SAAQ;IAC1C,eAAe,SAAM;IACrB,UAAU,OAAc;gBACZ,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAIlC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAGvB,IAAI,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAsB9D;AACD,qBAAa,+BAAgC,SAAQ,cAAc,CAAC,qBAAqB,CAAC;IACxF,MAAM,CAAC,QAAQ,CAAC,UAAU,+BAAyB;CACpD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { DatabaseInterface } from '@happyvertical/sql';
|
|
2
|
+
import { type CourseAuthoringActor, type CourseAuthoringAuthorizer } from './course-authoring-contracts.js';
|
|
3
|
+
import { QuestionAuthoringService, type QuestionAuthoringServiceOptions } from './question-authoring-service.js';
|
|
4
|
+
import type { GuardianWorksheetBundle, WorksheetBundle } from './question-contracts.js';
|
|
5
|
+
import { type ExtractedQuestionResult, type QuestionExtractionGrounding, type QuestionExtractionView, type QuestionExtractorIdentity } from './question-extraction-contracts.js';
|
|
6
|
+
/** Digest of reviewed proposal arguments; binds a preserved extraction to its decision. */
|
|
7
|
+
export declare function questionExtractionProposalDigest(args: unknown): string;
|
|
8
|
+
export interface PreserveQuestionExtractionRequest extends CourseAuthoringActor {
|
|
9
|
+
intakeItemId: string;
|
|
10
|
+
/** The ingestion analysis attempt that produced the proposal (one record per attempt). */
|
|
11
|
+
analysisAttemptId: string;
|
|
12
|
+
grounding: QuestionExtractionGrounding;
|
|
13
|
+
extractor: QuestionExtractorIdentity;
|
|
14
|
+
/** The proposal arguments (closed `QUESTION_EXTRACTION_ARGS_SCHEMA`). */
|
|
15
|
+
extraction: unknown;
|
|
16
|
+
/** Host-known worksheet (for example from the assignment); never overrides a printed id. */
|
|
17
|
+
expectedWorksheetVersionId?: string;
|
|
18
|
+
/** Extra candidate worksheets the host already holds; generated printables are found automatically. */
|
|
19
|
+
worksheets?: readonly WorksheetBundle[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Preserve, match, review and apply structured questions extracted from scans
|
|
23
|
+
* and imported course files (SMRT #4517). Reuses the course authorizer:
|
|
24
|
+
* preserve/apply need `education.course.author`; reads need `read-draft`.
|
|
25
|
+
* Question records are written only through `createQuestion`, keyed by source
|
|
26
|
+
* identity, so retries and re-ingestion of the same bytes never multiply them.
|
|
27
|
+
*/
|
|
28
|
+
export declare class QuestionExtractionService extends QuestionAuthoringService {
|
|
29
|
+
private readonly courseAuthorizer;
|
|
30
|
+
private readonly serviceOptions;
|
|
31
|
+
constructor(db: DatabaseInterface, authorizer: CourseAuthoringAuthorizer, options?: QuestionAuthoringServiceOptions);
|
|
32
|
+
/** The same service bound to a host-owned transaction executor (ingestion apply). */
|
|
33
|
+
withExecutor(executor: DatabaseInterface): QuestionExtractionService;
|
|
34
|
+
/**
|
|
35
|
+
* Known worksheets carrying this version id: released lessons whose generated
|
|
36
|
+
* printable was attached with it. Keyed bundles; needs `read-draft`.
|
|
37
|
+
*/
|
|
38
|
+
resolveWorksheet(request: CourseAuthoringActor & {
|
|
39
|
+
worksheetVersionId: string;
|
|
40
|
+
}): Promise<GuardianWorksheetBundle | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Validate extractor output against retained evidence, match it to known
|
|
43
|
+
* worksheet revisions and keep it for extraction review. Idempotent per
|
|
44
|
+
* (tenant, intake item, analysis attempt); a different payload for the same
|
|
45
|
+
* attempt is `CourseRequestKeyConflictError`. Writes no question records.
|
|
46
|
+
*/
|
|
47
|
+
preserveExtraction(request: PreserveQuestionExtractionRequest): Promise<QuestionExtractionView>;
|
|
48
|
+
/** The preserved extraction with its match and, once applied, its outcomes. */
|
|
49
|
+
readExtraction(request: CourseAuthoringActor & {
|
|
50
|
+
extractionId: string;
|
|
51
|
+
}): Promise<QuestionExtractionView>;
|
|
52
|
+
/** The preserved extraction for one intake item and reviewed proposal, if any. */
|
|
53
|
+
findExtraction(request: CourseAuthoringActor & {
|
|
54
|
+
intakeItemId: string;
|
|
55
|
+
proposalDigest: string;
|
|
56
|
+
}): Promise<QuestionExtractionView | null>;
|
|
57
|
+
/**
|
|
58
|
+
* Apply a reviewed extraction in one transaction. Matched questions link to
|
|
59
|
+
* their existing revision; readable unmatched exercises become question
|
|
60
|
+
* records (`extracted`/`inferred` provenance) keyed by source identity and
|
|
61
|
+
* question key; ambiguous, unreadable, unsupported and example items are
|
|
62
|
+
* recorded without a question. A repeated apply replays the stored outcomes.
|
|
63
|
+
*/
|
|
64
|
+
applyExtraction(request: CourseAuthoringActor & {
|
|
65
|
+
extractionId: string;
|
|
66
|
+
}): Promise<ExtractedQuestionResult[]>;
|
|
67
|
+
private record;
|
|
68
|
+
private links;
|
|
69
|
+
private view;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=question-extraction-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-extraction-service.d.ts","sourceRoot":"","sources":["../src/question-extraction-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAE/B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,wBAAwB,EACxB,KAAK,+BAA+B,EACrC,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,uBAAuB,EACvB,eAAe,EACh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