@pie-qti/assessment-player 1.0.0-beta.3 → 1.0.0-beta.5

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.
Files changed (134) hide show
  1. package/README.md +28 -7
  2. package/dist/components/createPlayerConnection.svelte.d.ts +90 -0
  3. package/dist/components/createPlayerConnection.svelte.js +151 -0
  4. package/dist/components/createPlayerConnection.svelte.js.map +1 -0
  5. package/dist/components/displaySettings.svelte.d.ts +23 -0
  6. package/dist/components/displaySettings.svelte.js +40 -0
  7. package/dist/components/displaySettings.svelte.js.map +1 -0
  8. package/dist/components/srOnly.d.ts +29 -0
  9. package/dist/components/srOnly.js +55 -0
  10. package/dist/components/srOnly.js.map +1 -0
  11. package/dist/components/submitDialogAction.d.ts +25 -0
  12. package/dist/components/submitDialogAction.js +89 -0
  13. package/dist/components/submitDialogAction.js.map +1 -0
  14. package/dist/core/AssessmentPlayer.d.ts +1102 -53
  15. package/dist/core/AssessmentPlayer.js +2836 -457
  16. package/dist/core/AssessmentPlayer.js.map +1 -1
  17. package/dist/core/AssessmentSessionCoordinator.d.ts +76 -7
  18. package/dist/core/AssessmentSessionCoordinator.js +185 -10
  19. package/dist/core/AssessmentSessionCoordinator.js.map +1 -1
  20. package/dist/core/AutosaveManager.d.ts +104 -0
  21. package/dist/core/AutosaveManager.js +181 -0
  22. package/dist/core/AutosaveManager.js.map +1 -0
  23. package/dist/core/ItemSessionController.d.ts +17 -26
  24. package/dist/core/ItemSessionController.js +33 -73
  25. package/dist/core/ItemSessionController.js.map +1 -1
  26. package/dist/core/NavigationManager.d.ts +18 -50
  27. package/dist/core/NavigationManager.js +21 -83
  28. package/dist/core/NavigationManager.js.map +1 -1
  29. package/dist/core/TimeManager.d.ts +62 -16
  30. package/dist/core/TimeManager.js +148 -57
  31. package/dist/core/TimeManager.js.map +1 -1
  32. package/dist/core/autosave.d.ts +44 -0
  33. package/dist/core/autosave.js +46 -0
  34. package/dist/core/autosave.js.map +1 -0
  35. package/dist/core/deliveryStructure.d.ts +54 -0
  36. package/dist/core/deliveryStructure.js +72 -0
  37. package/dist/core/deliveryStructure.js.map +1 -0
  38. package/dist/core/errors.d.ts +116 -0
  39. package/dist/core/errors.js +77 -0
  40. package/dist/core/errors.js.map +1 -0
  41. package/dist/core/exitBoundaries.d.ts +64 -0
  42. package/dist/core/exitBoundaries.js +98 -0
  43. package/dist/core/exitBoundaries.js.map +1 -0
  44. package/dist/core/feedback.d.ts +46 -0
  45. package/dist/core/feedback.js +47 -0
  46. package/dist/core/feedback.js.map +1 -0
  47. package/dist/core/formatTime.d.ts +8 -0
  48. package/dist/core/formatTime.js +20 -0
  49. package/dist/core/formatTime.js.map +1 -0
  50. package/dist/core/index.d.ts +7 -4
  51. package/dist/core/index.js +4 -1
  52. package/dist/core/index.js.map +1 -1
  53. package/dist/core/navigationPolicy.d.ts +46 -0
  54. package/dist/core/navigationPolicy.js +66 -0
  55. package/dist/core/navigationPolicy.js.map +1 -0
  56. package/dist/core/pause.d.ts +58 -0
  57. package/dist/core/pause.js +101 -0
  58. package/dist/core/pause.js.map +1 -0
  59. package/dist/core/playerEvents.d.ts +51 -0
  60. package/dist/core/playerEvents.js +66 -0
  61. package/dist/core/playerEvents.js.map +1 -0
  62. package/dist/core/reviewState.d.ts +81 -0
  63. package/dist/core/reviewState.js +113 -0
  64. package/dist/core/reviewState.js.map +1 -0
  65. package/dist/core/reviewViews.d.ts +43 -0
  66. package/dist/core/reviewViews.js +88 -0
  67. package/dist/core/reviewViews.js.map +1 -0
  68. package/dist/core/scopeLocks.d.ts +36 -0
  69. package/dist/core/scopeLocks.js +78 -0
  70. package/dist/core/scopeLocks.js.map +1 -0
  71. package/dist/core/sessionRecords.d.ts +31 -0
  72. package/dist/core/sessionRecords.js +74 -0
  73. package/dist/core/sessionRecords.js.map +1 -0
  74. package/dist/core/submissionPolicy.d.ts +65 -0
  75. package/dist/core/submissionPolicy.js +71 -0
  76. package/dist/core/submissionPolicy.js.map +1 -0
  77. package/dist/core/templateDefaults.d.ts +26 -0
  78. package/dist/core/templateDefaults.js +54 -0
  79. package/dist/core/templateDefaults.js.map +1 -0
  80. package/dist/core/testStructure.d.ts +118 -3
  81. package/dist/core/testStructure.js +255 -6
  82. package/dist/core/testStructure.js.map +1 -1
  83. package/dist/core/timePolicy.d.ts +40 -0
  84. package/dist/core/timePolicy.js +106 -0
  85. package/dist/core/timePolicy.js.map +1 -0
  86. package/dist/index.d.ts +7 -4
  87. package/dist/index.js +5 -1
  88. package/dist/index.js.map +1 -1
  89. package/dist/integration/ReferenceBackendAdapter.d.ts +64 -101
  90. package/dist/integration/ReferenceBackendAdapter.js +214 -1033
  91. package/dist/integration/ReferenceBackendAdapter.js.map +1 -1
  92. package/dist/integration/api-contract.d.ts +175 -10
  93. package/dist/integration/api-contract.js.map +1 -1
  94. package/dist/integration/assessment-item-scorer.d.ts +56 -5
  95. package/dist/integration/assessment-item-scorer.js +116 -13
  96. package/dist/integration/assessment-item-scorer.js.map +1 -1
  97. package/dist/integration/index.d.ts +2 -2
  98. package/dist/integration/index.js +1 -1
  99. package/dist/integration/index.js.map +1 -1
  100. package/dist/integration/qti-test-parser.d.ts +44 -0
  101. package/dist/integration/qti-test-parser.js +558 -0
  102. package/dist/integration/qti-test-parser.js.map +1 -0
  103. package/dist/integration/session-store.d.ts +54 -0
  104. package/dist/integration/session-store.js +75 -0
  105. package/dist/integration/session-store.js.map +1 -0
  106. package/dist/integration/test-navigation.d.ts +23 -0
  107. package/dist/integration/test-navigation.js +32 -0
  108. package/dist/integration/test-navigation.js.map +1 -0
  109. package/dist/integration/toSectionComposition.js +8 -1
  110. package/dist/integration/toSectionComposition.js.map +1 -1
  111. package/dist/reporting/index.d.ts +3 -0
  112. package/dist/reporting/index.js +3 -0
  113. package/dist/reporting/index.js.map +1 -0
  114. package/dist/reporting/inferBaseType.d.ts +13 -0
  115. package/dist/reporting/inferBaseType.js +26 -0
  116. package/dist/reporting/inferBaseType.js.map +1 -0
  117. package/dist/reporting/serializeAssessmentResult.d.ts +27 -0
  118. package/dist/reporting/serializeAssessmentResult.js +377 -0
  119. package/dist/reporting/serializeAssessmentResult.js.map +1 -0
  120. package/dist/reporting/toAssessmentResultXml.d.ts +39 -0
  121. package/dist/reporting/toAssessmentResultXml.js +304 -0
  122. package/dist/reporting/toAssessmentResultXml.js.map +1 -0
  123. package/dist/reporting/types.d.ts +85 -0
  124. package/dist/reporting/types.js +8 -0
  125. package/dist/reporting/types.js.map +1 -0
  126. package/dist/types/index.d.ts +96 -9
  127. package/dist/types/index.js.map +1 -1
  128. package/package.json +18 -14
  129. package/dist/core/StatePersistenceManager.d.ts +0 -125
  130. package/dist/core/StatePersistenceManager.js +0 -268
  131. package/dist/core/StatePersistenceManager.js.map +0 -1
  132. package/dist/utils/PerformanceMonitor.d.ts +0 -114
  133. package/dist/utils/PerformanceMonitor.js +0 -172
  134. package/dist/utils/PerformanceMonitor.js.map +0 -1
@@ -9,18 +9,19 @@
9
9
  */
10
10
  import { type AssessmentItemDefinitionPlugin, type ItemSession, type PciConfiguration, type PnpProfile, type PlayerSecurityConfig, type QTIRole, type SerializedItemSessionState } from '@pie-qti/item-player';
11
11
  import { type I18nProvider } from '@pie-qti/i18n';
12
+ import type { StringComparisonOptions } from '@pie-qti/qti-processing';
12
13
  import type { QtiSectionRuntimeHostContract, QtiSectionToolConfig } from '@pie-qti/section-player';
13
- import type { AssessmentRubricBlock, AssessmentSessionState, BackendAdapter, InitSessionRequest, SecureItemRef } from '../integration/api-contract.js';
14
- import type { AssessmentResults, ItemResult, NavigationState, TimeLimits, VisibleTestFeedback } from '../types/index.js';
14
+ import type { AssessmentRubricBlock, AssessmentSessionState, BackendAdapter, InitSessionRequest } from '../integration/api-contract.js';
15
+ import type { AssessmentEndReason, AssessmentResults, CandidateSectionView, CheckAnswerState, ItemFeedbackView, ItemResult, NavigationState, ResultsSummary, VisibleTestFeedback } from '../types/index.js';
16
+ import { type AutosaveState } from './AutosaveManager.js';
17
+ import { type CurrentItemView, type SectionItemRefView } from './deliveryStructure.js';
18
+ import { type SubmissionBlocker } from './submissionPolicy.js';
19
+ import { type EffectiveItemTimeLimits } from './timePolicy.js';
20
+ import { type ForwardTransitionInfo, type ItemAnswerStatus, type ReviewItemView } from './reviewState.js';
15
21
  export interface BackendAssessmentPlayerConfig {
16
22
  backend: BackendAdapter;
17
23
  initSession: InitSessionRequest;
18
24
  role?: QTIRole;
19
- /**
20
- * @deprecated Ignored. The backend draws selection and ordering at session start; pass an rng to
21
- * `new ReferenceBackendAdapter({ rng })` for deterministic draws.
22
- */
23
- rng?: () => number;
24
25
  /** Definition-lifetime extractor and renderer extensions applied to every item. */
25
26
  plugins?: readonly AssessmentItemDefinitionPlugin[];
26
27
  /**
@@ -48,6 +49,13 @@ export interface BackendAssessmentPlayerConfig {
48
49
  * Without this resolver, authored PCI code remains disabled.
49
50
  */
50
51
  pci?: PciConfiguration;
52
+ /**
53
+ * String comparison folds beyond QTI's equality for the candidates' input, applied by every
54
+ * item session the player opens (see the item player's
55
+ * `AssessmentItemDefinitionConfig.stringComparison`). Exact when absent. Give the scoring
56
+ * backend the same setting: it re-runs response processing on submitted items.
57
+ */
58
+ stringComparison?: StringComparisonOptions;
51
59
  /**
52
60
  * Optional host hooks for delegated section rendering.
53
61
  * Used for section shared-content URL policy and runtime callbacks.
@@ -60,15 +68,50 @@ export interface BackendAssessmentPlayerConfig {
60
68
  /** Optional tools rendered in item headers. */
61
69
  itemTools?: QtiSectionToolConfig[];
62
70
  /**
63
- * Demo/reference-only escape hatch. When false (default), rich item-session
64
- * variables stay client-local and are not submitted because template variables
65
- * can contain answer keys. Production backends should own this state server-side.
71
+ * Include the rich serialized item session (`SubmitResponsesRequest.itemSession`) in
72
+ * submissions. Off by default for production backends: template variables can contain
73
+ * answer keys, and such a backend should own that state server-side. A backend that
74
+ * scores from the item session declares `requiresItemSession` (the reference adapter —
75
+ * reference/preview mode — does) and always receives it, whatever this says.
66
76
  */
67
77
  sendItemSessionToBackend?: boolean;
78
+ /** Show the section menu in the shell header. Default shown; `false` hides it. */
68
79
  showSections?: boolean;
80
+ /** Let the candidate jump between sections from the shell's section menu. Default allowed; `false` disables the entries. */
69
81
  allowSectionNavigation?: boolean;
82
+ /** Show the position/progress indicator in the shell's navigation bar. Default shown; `false` hides it. */
70
83
  showProgress?: boolean;
84
+ /**
85
+ * Seconds before a limit expires at which a warning fires. Default 60 when unset;
86
+ * `0` turns this default warning off (`timeWarningThresholds` still fire).
87
+ */
71
88
  timeWarningThreshold?: number;
89
+ /**
90
+ * Additional warning thresholds in seconds (for example `[300, 60]` for 5-minute
91
+ * and 1-minute warnings). Each fires once per limiting scope.
92
+ */
93
+ timeWarningThresholds?: number[];
94
+ /**
95
+ * Opt-in begin gate. When true the player is created without entering an item and
96
+ * every clock stays stopped until `start()` (the shell's Begin button); hosts that
97
+ * leave it unset keep starting delivery and the clocks at session creation.
98
+ */
99
+ beginGate?: boolean;
100
+ /**
101
+ * Debounced autosave of the session snapshot through `BackendAdapter.saveState`
102
+ * after candidate activity (responses, navigation, flags, timer visibility, pause),
103
+ * and an immediate best-effort save via `flushAutosave()`. Default ON when the
104
+ * backend reports the save capability (`canSaveState` is not false); set `false`
105
+ * when the host persists state itself. Failures are non-fatal and surface through
106
+ * `onAutosaveChange` (`failed`) and `onAutosaveFailed`.
107
+ */
108
+ autosave?: boolean;
109
+ /** Autosave debounce window in ms. Default 1500. */
110
+ autosaveIntervalMs?: number;
111
+ /** Save-indicator state changes: `idle`, `pending`, `saving`, `saved`, `failed`. */
112
+ onAutosaveChange?: (state: AutosaveState) => void;
113
+ /** A debounced or flushed autosave failed; the draft retries on the next change. */
114
+ onAutosaveFailed?: (error: Error) => void;
72
115
  /**
73
116
  * Deterministic clock for time-limit tracking. Defaults to Date.now; intended for
74
117
  * tests and hosts that drive delivery from their own timeline.
@@ -84,25 +127,139 @@ export interface BackendAssessmentPlayerConfig {
84
127
  onItemChange?: (itemIndex: number, totalItems: number) => void;
85
128
  onSectionChange?: (sectionIndex: number, totalSections: number) => void;
86
129
  onResponseChange?: (responses: Record<string, unknown>) => void;
87
- onComplete?: () => void;
130
+ /**
131
+ * The test ended in this delivery (every ending: a candidate submit, a proctor's
132
+ * force-submit, a QTI EXIT_TEST branch, a whole-test expiry), with its results.
133
+ */
134
+ onComplete?: (results: AssessmentResults) => void;
135
+ /**
136
+ * A hard time limit ran out with no late submission: the whole test (the core then
137
+ * finalizes automatically), or a scope whose expiry leaves nothing unlocked.
138
+ */
139
+ onTimeExpired?: (event: AssessmentTimeExpiryEvent) => void;
140
+ /** A test part, section or item limit expired; its items are now closed. */
141
+ onScopeTimeExpired?: (event: ScopeTimeExpiryEvent) => void;
142
+ /**
143
+ * A proctor pause started (`paused` true, with its reason) or ended. A session
144
+ * restored paused reports its pause here once, right after creation.
145
+ */
146
+ onPauseChange?: (paused: boolean, reason?: string) => void;
147
+ /**
148
+ * The session reached its terminal state: finalized in this delivery
149
+ * (`restored: false`) or restored already finalized (`restored: true`).
150
+ */
151
+ onFinalized?: (event: AssessmentFinalizedEvent) => void;
152
+ /**
153
+ * Host hook for core and backend failures. Reach policy:
154
+ *
155
+ * - Core- and backend-reported failures reach it as they happen: a failed item entry
156
+ * (the first item, an expiry hop), test-level outcome-processing and item-scoring
157
+ * failures, an unevaluable branch rule or preCondition (`testConditionFailed`), a
158
+ * failed automatic finalization at a time expiry, autosave rejections.
159
+ * - Candidate-initiated hard backend failures (`submitFailed`, `finalizeFailed`) reach
160
+ * it too: the core throws them for the candidate flow, and the built-in shell
161
+ * (AssessmentShell) additionally calls this hook at those sites, so a host that
162
+ * only listens here still hears about a submission the backend refused.
163
+ * - Validation refusals stay inline-only: the coded warnings that name questions
164
+ * still needing an answer (`finalizeResponseRequired` &c.) and `attemptValidationFailed`
165
+ * are candidate-facing state, not failures — they never reach this hook.
166
+ *
167
+ * Errors are `AssessmentPlayerError` instances carrying a stable `code` for
168
+ * localization; `message` keeps the raw detail (including backend error text) for
169
+ * logs — never show it to candidates.
170
+ */
171
+ onError?: (error: Error) => void;
88
172
  }
89
- type CurrentItemView = {
90
- identifier: string;
173
+ /** What a shell's start screen shows before delivery begins (opt-in begin gate). */
174
+ export interface AssessmentStartInfo {
175
+ /** The assessmentTest title; shells fall back to a localized generic title. */
91
176
  title?: string;
92
- required?: boolean;
93
- itemXml: string;
94
- deliveryContext?: SecureItemRef['deliveryContext'];
95
- };
96
- type SectionItemRefView = {
177
+ /**
178
+ * Seconds the candidate has for the whole test, PNP extended time applied (what
179
+ * remains of it for a resumed session); undefined when the test has no maximum.
180
+ */
181
+ testTimeLimitSeconds?: number;
182
+ /** Whether any test part, section or item adds its own maximum. */
183
+ hasScopedTimeLimits: boolean;
184
+ /** The first test part's rubric blocks (candidate instructions); role-filter before display. */
185
+ rubricBlocks: import('../integration/api-contract.js').AssessmentRubricBlock[];
186
+ /** Delivered item count. */
187
+ totalItems: number;
188
+ /** True when the session carries prior activity (a resume). */
189
+ resuming: boolean;
190
+ /**
191
+ * When the restored draft was last saved (client clock), for the resume prompt
192
+ * ("You have answers saved from {time}"); undefined for a fresh session.
193
+ */
194
+ savedAt?: number;
195
+ }
196
+ /**
197
+ * Fired through `onTimeExpired` (and the element's `time-expired` event) when a hard
198
+ * time limit runs out with no late submission: the whole-test limit, or a scope whose
199
+ * expiry leaves no unlocked item.
200
+ */
201
+ export interface AssessmentTimeExpiryEvent {
202
+ /** The scope whose hard limit expired; `assessment` is the whole test. */
203
+ scope: 'assessment' | 'testPart' | 'section' | 'item';
204
+ /** The expired scope's identifier; undefined for the assessment scope. */
205
+ identifier?: string;
206
+ /** True when the core already ran the automatic finalization for a whole-test expiry. */
207
+ autoFinalized: boolean;
208
+ /** True when the candidate must submit now (auto-finalize failed, or nothing unlocked remains). */
209
+ submissionRequired: boolean;
210
+ }
211
+ /** Fired through `onScopeTimeExpired` when a test part, section or item limit expires. */
212
+ export interface ScopeTimeExpiryEvent {
213
+ scope: 'testPart' | 'section' | 'item';
97
214
  identifier: string;
98
- href?: string;
99
- title?: string;
100
- itemXml: string;
101
- deliveryContext?: SecureItemRef['deliveryContext'];
102
- };
103
- export interface EffectiveItemTimeLimits {
104
- timeLimits?: TimeLimits;
105
- source?: 'item' | 'section' | 'testPart' | 'assessment';
215
+ /** True when delivery moved on to an open item; false when nothing open remains (a dead end). */
216
+ deliveryContinues: boolean;
217
+ /**
218
+ * The flat index of the open item delivery moves to (forward in the part, an open
219
+ * question earlier in a nonlinear part, or the next part). Absent when the candidate
220
+ * was outside the expired scope and stays where they are, and at a dead end.
221
+ */
222
+ nextIndex?: number;
223
+ }
224
+ /** Fired through `onFinalized` once the session is terminal. */
225
+ export interface AssessmentFinalizedEvent {
226
+ /** True for a session the backend restored already finalized; false for a finalization in this delivery. */
227
+ restored: boolean;
228
+ results: AssessmentResults;
229
+ /**
230
+ * Why the test ended, for a finalization in this delivery: a candidate submit, a time
231
+ * expiry, a proctor's forced submit, or a QTI branch rule (`EXIT_TEST` and friends).
232
+ * Absent for a session restored already finalized (this delivery did not end it).
233
+ */
234
+ endReason?: AssessmentEndReason;
235
+ }
236
+ export type { AssessmentEndReason };
237
+ export type { EffectiveItemTimeLimits } from './timePolicy.js';
238
+ /**
239
+ * An item a candidate-initiated end of the test would refuse to submit
240
+ * (`getSubmissionBlockers()`): QTI `allowSkipping=false` with no response (`required`),
241
+ * or `validateResponses=true` with responses that do not satisfy the interactions
242
+ * (`invalid`). Both apply only to items in individual submission parts.
243
+ * Defined in `submissionPolicy.ts` with the gate that produces it.
244
+ */
245
+ export type { SubmissionBlocker } from './submissionPolicy.js';
246
+ /** What a shell's countdown shows for the active scope right now. */
247
+ export interface AssessmentTimeState {
248
+ /** Whether any active scope carries a hard maximum (false: nothing to count down). */
249
+ limited: boolean;
250
+ /** Seconds left on the nearest active maximum; null when nothing is limited. */
251
+ remainingSeconds: number | null;
252
+ elapsedSeconds: number;
253
+ /** Whether the nearest active maximum has run out. */
254
+ expired: boolean;
255
+ /** The scope the displayed limit was authored on. */
256
+ scope: 'assessment' | 'testPart' | 'section' | 'item' | null;
257
+ /** Whether the displayed limit allows working past its expiry. */
258
+ allowLateSubmission: boolean;
259
+ /** Whether a proctor pause currently freezes every clock. */
260
+ paused: boolean;
261
+ /** Whether delivery has begun (false while a begin gate holds the start screen). */
262
+ started: boolean;
106
263
  }
107
264
  export declare class AssessmentPlayer {
108
265
  private config;
@@ -117,37 +274,416 @@ export declare class AssessmentPlayer {
117
274
  private items;
118
275
  private currentItemIndex;
119
276
  private readonly itemDefinitions;
277
+ /** endAttemptInteraction bindings per item: response identifier → countAttempt. */
278
+ private readonly endAttemptResponses;
120
279
  private currentItemSession;
121
280
  private currentItemSessionUnsubscribe;
122
281
  /** Test-level outcomes from the last outcome processing; null until it first runs. */
123
282
  private testOutcomes;
124
283
  private finalized;
284
+ /** Set by destroy(); a scheduled end-attempt submission after teardown is dropped. */
285
+ private destroyed;
286
+ /** Results produced by the finalization; returned when submit() is called again after the end. */
287
+ private finalResults;
125
288
  /** Scopes whose time limit expired without late submission, keyed `scope:identifier`. */
126
- private readonly lockedScopes;
127
- private legacyFeedback;
128
- private itemChangeListeners;
129
- private sectionChangeListeners;
130
- private responseChangeListeners;
131
- private completeListeners;
132
- private testFeedbackChangeListeners;
133
- private timeWarningListeners;
134
- private timeExpiredListeners;
135
- private timeTickListeners;
289
+ private readonly scopeLocks;
290
+ /**
291
+ * Navigation serialization: exactly one navigation or submission transition may run at
292
+ * a time. While set, further navigation and submit calls are rejected as busy.
293
+ */
294
+ private transitionInFlight;
295
+ /**
296
+ * Scope-expiry hops waiting for the transition in flight to settle (the timer fired
297
+ * while it ran). The transition checks this to leave the move to the hop, the way it
298
+ * previously detected the move an unlocked hop had already made mid-flight.
299
+ */
300
+ private queuedExpiryHops;
301
+ /** Last reported test-level outcome-processing failure, so hosts hear about each new one once. */
302
+ private reportedOutcomeProcessingError;
303
+ /**
304
+ * Test-scope branch rules and preConditions already reported as unevaluable, keyed by
305
+ * condition XML + failure message: the rules re-evaluate on every forward step, and the
306
+ * host must hear about each distinct failed rule once, not on every step.
307
+ */
308
+ private reportedTestConditionFailures;
309
+ /** Item scoring failures already reported, keyed by item identifier + failure message. */
310
+ private reportedItemScoringErrors;
311
+ /** False while an opt-in begin gate holds delivery: no item is entered and no clock runs. */
312
+ private started;
313
+ /** A proctor pause: every clock is frozen and candidate actions are rejected. */
314
+ private readonly pauseControl;
315
+ /** The whole-test hard limit expired (no late submission); delivery collects and ends. */
316
+ private assessmentExpired;
317
+ /** The live attempt was suspended by a pause; resume() reopens it from its pause snapshot. */
318
+ private suspendedForPause;
319
+ /** Debounced draft persistence through `saveState` (autosave); null when disabled. */
320
+ private autosave;
321
+ /** True while the session carries a backend-restored snapshot (a resume). */
322
+ private restoredFromSnapshot;
323
+ /** `timing.savedAt` of the restored snapshot, shown on the resume prompt. */
324
+ private restoredSavedAt;
325
+ /**
326
+ * Item feedback the most recent item-level submission produced (item modal feedback
327
+ * from the session's response processing, else the backend's `result.feedback`).
328
+ * Shells show it after a check-answer or a submit-on-move; it clears on the next
329
+ * submission or when the shell dismisses it.
330
+ */
331
+ private lastItemFeedback;
332
+ /**
333
+ * The responses each item's last counted submission carried. Moving on from an item
334
+ * that already has a recorded result (a practice check) re-submits only when the
335
+ * candidate changed something: an unchanged response does not spend another attempt.
336
+ */
337
+ private readonly lastSubmittedResponses;
338
+ /**
339
+ * Template defaults of nonlinear test parts, evaluated once at part entry for every
340
+ * item ref (QTI): test part identifier → item identifier → defaults.
341
+ */
342
+ private readonly templateDefaultsByPart;
343
+ /** The presentation policy the live session was opened with (null: the item-player default). */
344
+ private liveSessionPresentation;
345
+ /** Set during a proctor force-submit: submissions carry `submissionReason: 'proctor'`. */
346
+ private administrativeReason;
347
+ /**
348
+ * Items the running end of the test collects although their QTI skipping/validation
349
+ * control would refuse them, because the candidate can no longer reach them (their
350
+ * test part was left): they go out as they stand, `submissionReason: 'unreachable'`.
351
+ */
352
+ private unreachableCollection;
353
+ /** Why the running (or finished) end of the test happens; the first caller decides. */
354
+ private endReason;
355
+ /**
356
+ * Scopes that expired while an end of the test ran: they closed at once, but delivery
357
+ * leaves them only if that end does not finalize (the end of the test never navigates).
358
+ */
359
+ private readonly expiriesDuringEnd;
360
+ /** The delivered items as the delivery rules walk them (index-aligned with `items`). */
361
+ private deliveredForRules;
362
+ /** Flat index per item identifier. */
363
+ private readonly indexByIdentifier;
364
+ /**
365
+ * Whether the test carries branch rules or preconditions at all; without them the next item
366
+ * is always the adjacent open one, and no rule is evaluated.
367
+ */
368
+ private hasDeliveryRules;
369
+ /** Set while the end of the test persists its final snapshot: every item session in it is closed. */
370
+ private snapshotsCloseItemSessions;
371
+ /** Rejections for transitions queued behind a transition (`runWhenIdle`), settled on destroy(). */
372
+ private readonly queuedIdleTransitions;
373
+ /** A restored whole-test expiry's automatic finalize is scheduled (or ran). */
374
+ private restoredExpiryFinalizeScheduled;
375
+ private readonly events;
376
+ /** Item XML–derived review facts (interaction response ids, item title) per item identifier. */
377
+ private reviewInfoCache;
378
+ /** Declared response default values per item (QTI: a response equal to its default is no response). */
379
+ private readonly responseDefaultsCache;
136
380
  private constructor();
381
+ /**
382
+ * Enter the backend-provided current item (or the first) as delivery begins. The
383
+ * restoring navigation has no await before the session is attached, so the live
384
+ * session exists when this returns. A failure is recorded (not swallowed): the shell
385
+ * shows its typed failure screen with Retry instead of an eternal loading state.
386
+ * An item an expired limit closed is never entered editable: delivery lands on the
387
+ * next open item, like the live expiry's hop, or — with none left — shows the closed
388
+ * item read-only and asks for the submission (reported once listeners can hear it).
389
+ */
390
+ private enterInitialItem;
391
+ /**
392
+ * Where a restoring entry lands: the requested item when it is open; else the open item
393
+ * the live expiry would have moved the candidate to (forward in the part, an open earlier
394
+ * question of a nonlinear part, the next part); else — nothing open remains — the
395
+ * requested item itself, shown read-only, as an expiry dead end.
396
+ */
397
+ private restoringEntryTarget;
398
+ /** Flat indexes of the snapshot's visited item identifiers. */
399
+ private visitedIndexes;
400
+ /**
401
+ * Lock every scope whose restored clock already ran past its hard maximum (no late
402
+ * submission): its live expiry never fired in this runtime, so without this its items
403
+ * would reopen editable until the next tick. A whole-test limit that ran out marks the
404
+ * test expired. The live timer is told, so it does not fire these expiries again.
405
+ */
406
+ private lockExpiredScopesFromClocks;
407
+ /**
408
+ * A whole-test limit that ran out while the session was away finalizes like a live
409
+ * expiry — once delivery runs (not behind a begin gate, not during a pause), and on
410
+ * the next task so the shell's listeners hear it.
411
+ */
412
+ private finalizeRestoredExpiryWhenRunning;
413
+ /** The item entry a failed hop will retry: the initial item, or an expiry hop target. */
414
+ private pendingEntryIndex;
415
+ /** The last failed item entry, for the shell's typed failure screen. */
416
+ private entryError;
417
+ private recordEntryFailure;
418
+ /** Whether the last item entry (the first item, or an expiry hop) failed. */
419
+ hasEntryFailure(): boolean;
420
+ /** The failed item entry's error, for host logs and localized shell display. */
421
+ getEntryError(): Error | null;
422
+ /**
423
+ * Retry the failed item entry: re-enter the initial item, or re-run the expiry hop
424
+ * that failed. Serialized with all other transitions; a renewed failure is reported
425
+ * through `onError` and this rejects.
426
+ */
427
+ retryEntry(): Promise<void>;
137
428
  private get state();
138
- private set state(value);
429
+ /**
430
+ * Whether a navigation or submission transition is currently in flight. Shells must
431
+ * disable navigation controls while this is set.
432
+ */
433
+ isBusy(): boolean;
434
+ /**
435
+ * Serialize navigation and submission transitions. Exactly one transition runs at a
436
+ * time; concurrent navigation or submit calls reject with a typed `navigationInFlight`
437
+ * error instead of racing the in-flight backend request. The in-flight flag is set
438
+ * inside the try so nothing before the operation — a throwing listener included —
439
+ * can leave it stuck true (every later transition would then be rejected as busy
440
+ * forever); the `finally` always resets it.
441
+ */
442
+ private runExclusive;
443
+ /**
444
+ * A candidate-initiated transition (navigation, submission): rejected with a coded
445
+ * error during a proctor pause or before the begin gate opens, otherwise serialized
446
+ * like every transition.
447
+ */
448
+ private runCandidateTransition;
449
+ /** Whether a proctor pause is in force (owned by `PauseController`). */
450
+ private get paused();
451
+ /** The candidate-facing reason given for the current pause, if any. */
452
+ private get pauseReason();
453
+ private assertCandidateActionAllowed;
454
+ /**
455
+ * Create the autosave engine. ON by default when the backend reports the save
456
+ * capability (`canSaveState !== false`); `config.autosave === false` disables it
457
+ * for hosts that persist state themselves.
458
+ */
459
+ private createAutosave;
460
+ /** A due save is deferred while a transition runs and retried once it settles. */
461
+ private notifyAutosaveActivity;
462
+ /**
463
+ * Save the current draft immediately (best-effort): the shell calls this from
464
+ * `visibilitychange`/`pagehide`, and hosts may call it before their own teardown.
465
+ * While a transition is in flight the save is re-queued instead of racing it.
466
+ * Resolves once a save attempt settled (or immediately when autosave is off).
467
+ */
468
+ flushAutosave(): Promise<void>;
469
+ /** The current save-indicator state (`idle` when autosave is disabled). */
470
+ getAutosaveState(): AutosaveState;
471
+ /** Whether autosave is active for this session (backend capability + config). */
472
+ isAutosaveEnabled(): boolean;
473
+ /** Fires on every save-indicator state change. */
474
+ onAutosaveChange(listener: (state: AutosaveState) => void): () => void;
475
+ private notifyAutosaveChange;
476
+ /**
477
+ * Whether the session was created from a backend snapshot that already carries
478
+ * candidate work (a resume worth offering: saved answers). Shells show their
479
+ * resume prompt from this. Elapsed time alone does not count: a session that was
480
+ * merely started (or started over) has nothing to resume.
481
+ */
482
+ hasRestoredProgress(): boolean;
483
+ /** When the restored snapshot was last saved (client clock), for the resume prompt. */
484
+ getRestoredSavedAt(): number | undefined;
485
+ /**
486
+ * Discard the candidate's draft and restart delivery. Start over clears what the
487
+ * candidate authored and the backend has not accepted — responses, flags, comments,
488
+ * visited state, the timer preference and unrecorded check state — and persists the
489
+ * blank draft at once. It keeps the time accounting: every clock, each expired scope
490
+ * and a whole-test expiry persist, so restarting never grants a fresh time allowance
491
+ * after the questions were seen. Items the backend already accepted keep their
492
+ * recorded results (the backend stays authoritative for them). Delivery repositions
493
+ * to the first item that is still open; when none is, the closed item is shown
494
+ * read-only and the expiry's submit path is requested again (`onTimeExpired` with
495
+ * `submissionRequired`). Rejects while paused, behind a begin gate, once finalized,
496
+ * and while another transition runs.
497
+ */
498
+ startOver(): Promise<void>;
139
499
  private getEffectiveItemTimeLimits;
140
500
  getCurrentEffectiveTimeLimits(): EffectiveItemTimeLimits;
141
501
  private getSubmitTimingEvidence;
142
502
  private assertMinimumTime;
503
+ /**
504
+ * Every enclosing section's minimum time gates leaving it: a transition out of an
505
+ * enclosing scope (another section, another test part, or the end of the test) waits
506
+ * for the outer sections' minimums too, not only the innermost section's.
507
+ */
508
+ private assertEnclosingSectionMinimumTime;
143
509
  private assertTransitionMinimum;
144
- private flattenItems;
145
- getAllSections(): Array<{
146
- id: string;
147
- title?: string;
148
- visible: boolean;
149
- index: number;
150
- }>;
510
+ /**
511
+ * Whether an item still owes the backend a submission: it has no recorded result yet
512
+ * (the candidate left it open, answered or not), or its live responses differ from the
513
+ * ones its last counted submission carried (a practice answer revised after the
514
+ * check, or a revised answer a nonlinear jump left behind). Unchanged responses are
515
+ * never re-sent, so an accepted item spends no extra attempt here.
516
+ */
517
+ private itemNeedsSubmission;
518
+ private isIndividual;
519
+ /**
520
+ * Whether submissions carry the serialized item session: always for a backend that
521
+ * scores from it (`requiresItemSession` — the reference adapter: a templated item must be
522
+ * scored against the instance the candidate saw), else as the host configured.
523
+ */
524
+ private sendsItemSession;
525
+ /** The item's current responses: the live session's for the active item, else the stored ones. */
526
+ private currentResponsesFor;
527
+ /**
528
+ * QTI itemSessionControl `allowSkipping` / `validateResponses` for one item's
529
+ * responses. Both are "only applicable when the item is in a testPart with individual
530
+ * submission mode", so a simultaneous part is never gated. A skipped item (no
531
+ * response at all: every response NULL, empty or still equal to its declared default —
532
+ * the test `numberResponded` applies) may be submitted only when skipping is allowed,
533
+ * and is then not validated; an answered item validates when the item asks for it.
534
+ */
535
+ private submissionGate;
536
+ /**
537
+ * The declared default of each response variable, as the item's own session holds it
538
+ * (template processing may set it): the live session for the active item, the persisted
539
+ * handoff otherwise, else — for an item never opened — a fresh session's declarations.
540
+ */
541
+ private responseDefaultsFor;
542
+ /**
543
+ * The item's response validation (a QTI valid response: every value well-formed and,
544
+ * where an interaction requires input — minChoices, minStrings, matchMin… — complete),
545
+ * checked on a detached session so the live attempt is untouched. Null when nothing is
546
+ * left to validate: the attempt already closed (accepted as it is), or the session could
547
+ * not be opened (the submission reports that, the gate invents no failure).
548
+ */
549
+ private responseValidationFor;
550
+ /** Whether the item's responses satisfy their interactions' constraints (see `responseValidationFor`). */
551
+ private responsesSatisfyConstraints;
552
+ /**
553
+ * Whether the end of the test would submit this item: mirrors `endTestInternal`'s
554
+ * collection — the open current item without an accepted (unchanged) result, and every
555
+ * visited individual-mode item whose responses the backend has not accepted yet.
556
+ */
557
+ private wouldCollectAtFinalize;
558
+ /**
559
+ * The QTI submission control that would refuse this item's submission now, if any:
560
+ * `required` (allowSkipping=false, no response) or `invalid` (validateResponses=true,
561
+ * responses that do not satisfy the interactions), with what the response still owes.
562
+ */
563
+ private blockerFor;
564
+ /** Every item the end of the test would collect against its submission controls, reachable or not. */
565
+ private blockerCandidates;
566
+ /**
567
+ * Items a candidate-initiated end of the test would refuse to submit: in individual
568
+ * parts, an item without any response while `allowSkipping=false` (`required`), or an
569
+ * answered item whose responses fail validation while `validateResponses=true`
570
+ * (`invalid`). Only items the end of the test would actually submit are considered
571
+ * (presented ones the backend has not accepted), and only those the candidate can still
572
+ * reach: a question in a test part already left cannot hold Submit — it is collected as
573
+ * it stands (`getUnreachableSubmissionBlockers()`, `submissionReason: 'unreachable'`).
574
+ * An item an expired limit closed is collected as it stands too. Empty once the delivery
575
+ * is closed by time or finalized. Shells list these in the submit confirmation;
576
+ * `submit()` rejects naming them.
577
+ */
578
+ getSubmissionBlockers(): SubmissionBlocker[];
579
+ /**
580
+ * Questions the end of the test collects although their QTI skipping/validation control
581
+ * would refuse them, because the candidate can no longer reach them (their test part was
582
+ * left — a session restored from before the leave gate, a branch rule). They never hold
583
+ * Submit: the end of the test sends them as they stand with `submissionReason: 'unreachable'`.
584
+ */
585
+ getUnreachableSubmissionBlockers(): SubmissionBlocker[];
586
+ /**
587
+ * Questions of the current test part that would be left behind owing an answer: QTI
588
+ * parts cannot be re-entered, so leaving an individual part with them would strand them.
589
+ * The shell's "Leave this part?" confirmation lists them (with jumps) and holds Continue;
590
+ * `next()` / `navigateTo()` refuse to leave the part while any remains
591
+ * (`leavePartResponseRequired` / `leavePartResponseInvalid`). Only questions the
592
+ * candidate can still reach count — one behind them in a linear part (a session restored
593
+ * from before this gate) could never be answered, so it cannot hold the way out; the end
594
+ * of the test collects it as it stands (`unreachable`). Empty for a simultaneous part
595
+ * (QTI: the controls do not apply), once finalized, and in a time-closed delivery.
596
+ */
597
+ getTestPartBlockers(): SubmissionBlocker[];
598
+ /** Reject a candidate-initiated end of the test that would submit held-back items, naming them. */
599
+ private assertNoSubmissionBlockers;
600
+ /**
601
+ * Reject leaving the test part `from` belongs to while questions in it (or, for an
602
+ * EXIT_SECTION, in the ended scope) still owe an answer the candidate can still give.
603
+ * `exclude` is the item the move itself submits (next() submits the current item before
604
+ * it moves). An unreachable question never holds the way out (see `getTestPartBlockers`).
605
+ */
606
+ private assertCanLeaveScope;
607
+ private throwForBlockers;
608
+ /**
609
+ * QTI feedback visibility is attempt-relative: with more than one attempt allowed,
610
+ * feedback for every non-final attempt must be shown; once the last attempt has
611
+ * ended, `showFeedback` governs. Adaptive items always show their feedback.
612
+ * `attemptsAfter` counts the attempts once the attempt being judged has ended.
613
+ */
614
+ private feedbackVisible;
615
+ /**
616
+ * Sections presented to the candidate: visible themselves and under visible ancestors.
617
+ * A QTI `visible="false"` section is not presented as a section — its content appears as
618
+ * part of the parent — so neither it nor its descendants surface a title here. Items
619
+ * inside keep being delivered in order.
620
+ */
621
+ private presentedSectionList;
622
+ /**
623
+ * Whether jumping to a presented section is legal right now: in linear navigation there
624
+ * is no jumping at all; in nonlinear navigation only sections of the current test part
625
+ * are reachable, never locked items or items review has closed. Finalized tests have no
626
+ * legal targets.
627
+ */
628
+ private isLegalSectionTarget;
629
+ /**
630
+ * The assessmentTest `title` the backend returned, trimmed, or `undefined` when it
631
+ * has none. Shells fall back to a localized generic title, never the identifier.
632
+ */
633
+ getAssessmentTitle(): string | undefined;
634
+ /**
635
+ * Candidate-facing sections: visible sections only (QTI `visible="false"` sections are
636
+ * not presented as sections and their titles never surface), each with whether jumping
637
+ * to it is legal right now for the current navigationMode.
638
+ */
639
+ getAllSections(): CandidateSectionView[];
640
+ /**
641
+ * Whether jumping straight to a delivered item is legal right now: false once the test
642
+ * has finalized, and — for any item other than the current one — false while the target
643
+ * is time-locked, its review policy forbids returning, or the navigation rules (linear
644
+ * mode, test-part sequencing) do not reach it. The review screen renders illegal targets
645
+ * status-only; `navigateTo()` still enforces this authoritatively.
646
+ */
647
+ isNavigationTargetLegal(index: number): boolean;
648
+ /** `isNavigationTargetLegal` with the forward step computed once for a batch of targets. */
649
+ private isNavigationTargetLegalWith;
650
+ private reviewInfoFor;
651
+ /**
652
+ * Answered / partially answered / unanswered for one delivered item, from its
653
+ * candidate responses (one verdict per interaction for composite items). The single
654
+ * definition of "answered" the review screen, section menu and submit confirmation share.
655
+ */
656
+ getItemAnswerStatus(itemIdentifier: string): ItemAnswerStatus;
657
+ /** How many delivered items carry a response (answered or partially answered). */
658
+ getAnsweredItemCount(): number;
659
+ /** Every delivered item as the review screen lists it: status, flag, visited, jump legality. */
660
+ getReviewItems(): ReviewItemView[];
661
+ /**
662
+ * Candidate-facing results for a shell's opt-in completion summary: per delivered
663
+ * item the answered status and — when the backend returned one — its score, plus the
664
+ * finalized totals. Null until the assessment has been finalized; high-stakes hosts
665
+ * simply never render it (the shell's `showResultsSummary` stays off by default).
666
+ */
667
+ getResultsSummary(): ResultsSummary | null;
668
+ /**
669
+ * What the candidate's next forward step would do. QTI test parts are delivered in
670
+ * sequence and cannot be re-entered, so a step that leaves the current part is the
671
+ * irreversible move the shell confirms before making.
672
+ */
673
+ getForwardTransitionInfo(): ForwardTransitionInfo;
674
+ /**
675
+ * Set (or clear) the candidate's flag-for-review on an item; defaults to the current
676
+ * item. Flag state lives in the session state (`itemFlags`), survives navigation and
677
+ * is part of `getState()` snapshots.
678
+ */
679
+ setItemFlag(flagged: boolean, itemIdentifier?: string): void;
680
+ /** Toggle the current (or given) item's flag; returns the new state. */
681
+ toggleItemFlag(itemIdentifier?: string): boolean;
682
+ isItemFlagged(itemIdentifier?: string): boolean;
683
+ /** Identifiers of the items currently flagged for review. */
684
+ getFlaggedItemIdentifiers(): string[];
685
+ /** Fires when an item's flag-for-review state changes. */
686
+ onFlagChange(listener: (itemIdentifier: string, flagged: boolean) => void): () => void;
151
687
  getNavigationState(): NavigationState;
152
688
  getCurrentItem(): CurrentItemView | null;
153
689
  /**
@@ -160,6 +696,19 @@ export declare class AssessmentPlayer {
160
696
  getCurrentItemSession(): ItemSession | null;
161
697
  getCurrentSectionItemRefs(): SectionItemRefView[];
162
698
  getResponsesForItem(itemIdentifier: string): Record<string, unknown>;
699
+ /**
700
+ * The assessment identifier the backend drew this session for (`SecureAssessment.identifier`).
701
+ * Section tool bars and host integrations name the assessment with it.
702
+ */
703
+ getAssessmentId(): string;
704
+ /**
705
+ * The delivered items of the active item's innermost section, with their current
706
+ * response records shared by reference (a shallow copy of the outer map only).
707
+ * For section composition building: the values are read-only views of session
708
+ * state and must not be mutated by callers — the deep-cloning accessors above
709
+ * remain the boundary for persistence and events.
710
+ */
711
+ getSectionItemResponses(): Record<string, Record<string, unknown>>;
163
712
  getCurrentSharedRubricBlocks(): AssessmentRubricBlock[];
164
713
  getCurrentRubricBlocks(): AssessmentRubricBlock[];
165
714
  /**
@@ -186,10 +735,44 @@ export declare class AssessmentPlayer {
186
735
  getResponses(): Record<string, unknown>;
187
736
  saveCurrentItemSession(): SerializedItemSessionState | null;
188
737
  private endItemSessionForSubmit;
738
+ /**
739
+ * How an item presents feedback and solutions under its resolved item session
740
+ * control, for its current attempt count (feedback visibility is attempt-relative,
741
+ * see `feedbackVisible`).
742
+ */
743
+ private presentationFor;
744
+ /**
745
+ * A counted submission can change what the item shows: feedback a non-final attempt
746
+ * revealed hides once the last attempt ended (unless showFeedback is on), and the
747
+ * first non-final attempt reveals it. Reopen the live session under the new policy
748
+ * when it differs; the item stays where it is.
749
+ */
750
+ private refreshLivePresentation;
189
751
  private getItemDefinition;
190
752
  private mirrorSessionResponses;
191
753
  private attachCurrentItemSession;
754
+ /** The item's endAttemptInteraction bindings, parsed from its item XML once and cached. */
755
+ private endAttemptResponseMap;
756
+ /**
757
+ * QTI endAttempt on the response path: a candidate activating an endAttemptInteraction writes
758
+ * its boolean response. Assessment delivery decides what that means — the item session is
759
+ * owned here and must never be closed by a renderer. In a simultaneous test part the response
760
+ * processing is deferred to the end of the part, so the response is recorded like any other.
761
+ * In an individual test part the item is submitted through the normal per-item path with the
762
+ * interaction's countAttempt honored; the candidate stays on the item.
763
+ */
764
+ private scheduleEndAttemptSubmission;
192
765
  private releaseCurrentItemSession;
766
+ /**
767
+ * Freeze the live attempt for a proctor pause: suspend it (its responses become
768
+ * read-only and its QTI `duration` is captured in the persisted snapshot). The
769
+ * suspended session stays attached so the item keeps rendering, disabled, behind the
770
+ * pause; `reopenLiveSessionAfterPause()` reopens it from the snapshot so the paused
771
+ * time never counts as time on task.
772
+ */
773
+ private suspendLiveSessionForPause;
774
+ /** Reopen the attempt a proctor pause froze, at the exact state the pause captured. */
775
+ private reopenLiveSessionAfterPause;
193
776
  /**
194
777
  * Get the current session state snapshot (client-side view).
195
778
  * Note: backend remains authoritative; this is intended for simple save/resume.
@@ -202,21 +785,372 @@ export declare class AssessmentPlayer {
202
785
  */
203
786
  restoreState(state: AssessmentSessionState): Promise<void>;
204
787
  private restoreTimeTracking;
788
+ /**
789
+ * Navigate to an item by index. Serialized with all other navigation and submission
790
+ * transitions: while one is in flight this rejects with a `navigationInFlight` error,
791
+ * and once the test has finalized it rejects with `testFinalized`.
792
+ */
205
793
  navigateTo(index: number, options?: {
206
794
  restoring?: boolean;
207
795
  }): Promise<void>;
796
+ private performNavigateTo;
797
+ /**
798
+ * Navigate to a section by identifier. Legal targets only: a presented (visible)
799
+ * section reachable under the current navigationMode. Illegal jumps reject with a
800
+ * typed `AssessmentPlayerError` instead of throwing plain errors.
801
+ */
208
802
  navigateToSection(sectionId: string): Promise<void>;
803
+ /** Move forward. Serialized with all other transitions; rejects as busy while one is in flight. */
209
804
  next(): Promise<void>;
805
+ private performNext;
806
+ /**
807
+ * Leave the simultaneous test part `last` belongs to: its pending responses go out
808
+ * first (a failed request throws and keeps the candidate here for a retry), and the
809
+ * branch decision the flush returns for the part's last item — the part's testPart
810
+ * branchRule ran there, with every item's variables committed — is what delivery
811
+ * follows, through `followBranch`'s part-leave, EXIT_TEST and finalized guards. With
812
+ * no decision (or one that led nowhere) the delivery rules decide on the committed
813
+ * state, honouring the following parts' preconditions.
814
+ */
815
+ private crossSimultaneousPart;
816
+ /**
817
+ * The branch decision a simultaneous part's flush left for its last item, when it takes
818
+ * delivery out of the part that is ending. A target inside that part is rejected: the
819
+ * part is being left, its responses are out, and its rules cannot deliver into it again.
820
+ */
821
+ private partCrossingDecisionTarget;
822
+ /** Whether the delivered item after `q` lies outside `q`'s test part (or nothing does). */
823
+ private endsTestPart;
824
+ /** The part's effective QTI submission mode. */
825
+ private isSimultaneousSubmission;
826
+ /**
827
+ * Whether `next()` from the item submits it: an individual part's item whose attempts
828
+ * remain, that is not closed, and whose responses differ from its last counted submission
829
+ * (or that has none).
830
+ */
831
+ private nextSubmits;
832
+ /**
833
+ * The backend's decisions for leaving an item (`nextItemIdentifier`), keyed per item on
834
+ * the session state (`state.branchDecisions`) with that item's last-submission record,
835
+ * so a restored session lands identically. A counted submission that stays on the item
836
+ * (a practice check, a counted endAttemptInteraction) keeps its decision; so does a
837
+ * branch exit refused while questions of the part still owed an answer, and a
838
+ * simultaneous part's crossing flush keeps the decision made for its last item. The next
839
+ * forward step from that item that submits nothing — the candidate moves on with the
840
+ * response unchanged — follows it; a changed response re-submits and the fresh decision
841
+ * replaces it. At most the freshest decision is kept: any later counted submission voids
842
+ * the earlier ones (the outcomes they were decided on have moved), and following a
843
+ * decision clears it.
844
+ */
845
+ /** The backend decision kept for `q` that delivery has not followed yet (its target). */
846
+ private keptDecisionTarget;
847
+ /** Keep `target` as the one decision delivery may still follow — the item's freshest. */
848
+ private keepBranchDecision;
849
+ /** Every kept decision is void: a counted submission moved the outcomes they decided on. */
850
+ private clearKeptBranchDecisions;
851
+ /**
852
+ * The backend decision kept for leaving `q` — its item's entry in the session state
853
+ * (`branchDecisions`), made by `q`'s last counted submission — if delivery has not
854
+ * followed it yet. A decision onto an item an expired time limit has closed since is
855
+ * passed over like the item itself: the delivery rules then find the next open item.
856
+ */
857
+ private keptBranchDecisionFor;
858
+ /**
859
+ * Where the candidate's Next goes from `q`: when it submits the item — or crosses out of
860
+ * a simultaneous part whose responses still have to go out (`crossingFlushDue`) — the
861
+ * backend decides once the submissions are accepted (the adjacent open item stands for
862
+ * that decision until then; the pre-flush rules read uncommitted state); otherwise the
863
+ * destination is known now (`unsubmittedForwardIndex`). -1 when nothing follows — Submit
864
+ * is the way on.
865
+ */
866
+ private forwardStepIndex;
867
+ /**
868
+ * Whether `next()` from `q` crosses out of its simultaneous part with some of the part's
869
+ * responses not yet accepted: the crossing flushes them, and that flush decides the landing.
870
+ */
871
+ private crossingFlushDue;
872
+ /**
873
+ * Where a forward step from `q` that submits nothing lands — a move on after a practice
874
+ * check, a move out of a simultaneous part, a jump into the next test part: the backend's
875
+ * decision kept for `q`, else the next item the delivery rules make eligible
876
+ * (`ruleForwardIndex`). -1 when nothing follows (an EXIT_* decision nothing follows, or
877
+ * nothing eligible). A decision whose literal target resolves to nothing forward is
878
+ * skipped — the rule does not fire — so the delivery rules decide, exactly as the
879
+ * backend's own walk falls through from an unresolvable target.
880
+ */
881
+ private unsubmittedForwardIndex;
882
+ /**
883
+ * The next item after `q` when no backend decision applies, by the reference backend's own
884
+ * rules (`nextItemIdentifier`): branch rules first — in a linear part the item's and those
885
+ * of each section it ends, the test part's at its end — then preconditions: a test part's on
886
+ * entering it in any navigation mode, a linear part's sections and items on reaching them.
887
+ * They read the test outcomes the backend last returned and the recorded variables of every
888
+ * item it accepted (`ITEM.VARIABLE`), as the backend does. Items an expired time limit closed
889
+ * are passed over. A test without branch rules or preconditions moves to the adjacent open item.
890
+ */
891
+ private ruleForwardIndex;
892
+ /**
893
+ * The items the delivery rules reach after `fromIndex`, in order: each one whose
894
+ * preconditions hold as the sequence enters its test part (any navigation mode) and, in a
895
+ * linear part, its sections and the item itself. Without rules, every following item.
896
+ */
897
+ private eligibleIndexesAfter;
898
+ /**
899
+ * The declarations branch rules and preconditions read, built as the reference backend
900
+ * builds them for a decision about leaving `from`: the test outcomes the backend last
901
+ * returned, every item with a recorded result as `ITEM.VARIABLE` (an item without one reads
902
+ * as NULL), and `from`'s own variables unprefixed where the test declares no such outcome.
903
+ */
904
+ private navigationDeclarationsFor;
905
+ private indexOfItem;
906
+ /** The forward step, computed at most once for a batch of legality checks. */
907
+ private lazyForward;
908
+ /**
909
+ * Whether the item's last counted submission already carried these responses.
910
+ * False when nothing was recorded: the caller then submits as usual.
911
+ */
912
+ private responsesUnchangedSinceSubmission;
913
+ /**
914
+ * Seed the submitted-response memory from a restored snapshot: an item whose recorded
915
+ * result the snapshot carries was accepted with exactly those responses, so moving on
916
+ * (or finalizing) with them unchanged re-submits nothing and re-spends no attempt.
917
+ */
918
+ private seedSubmittedResponses;
919
+ /** Move back. Serialized with all other transitions; rejects as busy while one is in flight. */
210
920
  previous(): Promise<void>;
211
- /** Submit current item (server-side scoring) */
921
+ /**
922
+ * Submit current item (server-side scoring). Serialized with all other navigation and
923
+ * submission transitions; rejects as busy while one is in flight.
924
+ */
212
925
  submitCurrentItem(): Promise<ItemResult>;
926
+ /**
927
+ * Whether the shell should offer the item-level "Check answer" control on the active
928
+ * item, with the attempt facts it displays. The control exists only in `individual`
929
+ * submission-mode parts where more than one attempt is allowed (or the item is
930
+ * adaptive): QTI shows feedback for every non-final attempt then, whatever
931
+ * `showFeedback` says, so checking in place always reveals something. A single
932
+ * attempt keeps the submit-on-move delivery (its feedback, under `showFeedback`, rides
933
+ * the transition); QTI simultaneous parts have no per-item submission.
934
+ */
935
+ getCheckAnswerState(): CheckAnswerState | null;
936
+ /**
937
+ * Practice flow: submit the active item through the normal per-item path and STAY on
938
+ * it, so its feedback becomes visible (the shell shows `getLastItemFeedback()`).
939
+ * The submission counts toward `maxAttempts`; while attempts remain the item reopens
940
+ * writable afterwards (non-adaptive items reopen from the pre-submit state with the
941
+ * computed outcomes restored), so the candidate can revise and check again. Adaptive
942
+ * items keep their engine-driven attempt loop. Once the attempts are used up this
943
+ * rejects with a coded `maxAttemptsReached`; moving on with `next()` then needs no
944
+ * further submission. Serialized with all other transitions.
945
+ */
946
+ checkCurrentItem(): Promise<ItemResult | null>;
947
+ /**
948
+ * While counted attempts remain on a non-adaptive item whose attempt just ended (a
949
+ * practice check, a submit-on-move the candidate may come back to), reopen it writable
950
+ * from that processed attempt: the session keeps the attempt count (the engine restores
951
+ * `contextVariables.numAttempts`, so the next counted attempt runs response processing as
952
+ * attempt k+1) and the outcomes response processing computed — the integrated feedback
953
+ * renders from them while the candidate revises — with its lifecycle set back to
954
+ * `interacting`. What the item persists from then on is the attempt the backend accepted.
955
+ */
956
+ private reopenForRemainingAttempts;
957
+ /**
958
+ * The item feedback the most recent item-level submission produced (item modal
959
+ * feedback from response processing, or the backend's `result.feedback`), or null.
960
+ * Shells show it after `checkCurrentItem()` and after a submit-on-move `next()`.
961
+ */
962
+ getLastItemFeedback(): ItemFeedbackView | null;
963
+ /** Discard the captured item feedback once the shell has shown it. */
964
+ clearLastItemFeedback(): void;
965
+ private getLastItemFeedbackFor;
966
+ /**
967
+ * Capture an item-level submission's feedback for the shell, under the item's
968
+ * attempt-relative feedback visibility (`attemptsAfter`: the counted attempts once this
969
+ * submission is recorded). A submission that produces none clears a stale capture for
970
+ * the flow that follows it.
971
+ */
972
+ private captureItemFeedback;
973
+ private submitCurrentItemInternal;
974
+ /**
975
+ * Follow the backend's branching decision for the item just submitted. A decision that
976
+ * would leave the test part (EXIT_TESTPART, an EXIT_SECTION with nothing after it in
977
+ * the part, a target in a later part) or end the test (EXIT_TEST) while other questions
978
+ * of the part still owe an answer is refused like a candidate's own step out of the
979
+ * part: the candidate stays, the coded error names the questions, and the decision is
980
+ * kept — the next `next()` from this item follows it once they are answered (a changed
981
+ * response re-submits and replaces it).
982
+ *
983
+ * The end of the test never navigates: a decision its own submission returns is kept
984
+ * the same way and the collection runs where the candidate stands. A decision whose
985
+ * submission a scope expiry raced (the item's scope ran out while the submission was in
986
+ * flight) is not followed — the expiry's queued hop moves delivery, and the decision
987
+ * would undo that move or land in the closed scope — and a test part delivery already
988
+ * left is never re-entered.
989
+ */
990
+ private followBranch;
991
+ /** Where a branch decision lands: an item index, or -1 when it ends the test or resolves to nothing forward. */
992
+ private branchTargetIndex;
993
+ /** Whether a branch decision takes delivery out of the item's test part (or ends the test). */
994
+ private branchExitLeavesPart;
995
+ /**
996
+ * Leave the scope ended by an EXIT_TESTPART / EXIT_SECTION branch rule: continue with
997
+ * the first delivered item outside it, finalizing the ended test part (or, when nothing
998
+ * follows anywhere, the whole test) through the same finalization path as submit().
999
+ *
1000
+ * The literal resolves over the item's full enclosing chain (like the backend's
1001
+ * branch-rule walk), not the innermost section alone: an outer-section EXIT lands
1002
+ * outside the whole outer section.
1003
+ */
1004
+ private applyExitBoundary;
1005
+ /**
1006
+ * The enclosing section a literal EXIT_SECTION leaves (see
1007
+ * `exitBoundaries.endedEnclosingSection`).
1008
+ */
1009
+ private endedEnclosingSection;
213
1010
  private canPrevious;
1011
+ /**
1012
+ * QTI `allowReview` for returning to an item: it governs only once the item's session is
1013
+ * over — after its last attempt, or (adaptive) once it completed. While attempts remain
1014
+ * the candidate may come back and use them.
1015
+ */
1016
+ private canReviewItem;
1017
+ /** The lifecycle of an item's session: the live one for the active item, else the persisted handoff. */
1018
+ private itemLifecycleOf;
214
1019
  private canNext;
1020
+ /**
1021
+ * Whether a candidate-initiated move from `currentIndex` to `targetIndex` follows the
1022
+ * navigation rules (see `navigationPolicy.canNavigateByTestPart`).
1023
+ */
215
1024
  private canNavigateByTestPart;
216
1025
  private submitSimultaneousItems;
217
- /** Submit entire assessment (finalize on backend) */
218
- submit(): Promise<AssessmentResults>;
219
- getItemSessionInfo(_itemIdentifier?: string): {
1026
+ /**
1027
+ * Submit the entire assessment and finalize on the backend — the single terminal
1028
+ * transition, also used for QTI `EXIT_TEST` (and for EXIT_TESTPART / EXIT_SECTION when
1029
+ * nothing follows the ended scope). Serialized with all other navigation and submission
1030
+ * transitions. Calling it again after the test has ended returns the same results.
1031
+ *
1032
+ * A candidate's submit is rejected while paused, and — with a coded
1033
+ * `finalizeResponseRequired` / `finalizeResponseInvalid` naming the items
1034
+ * (`getSubmissionBlockers()`) — while items in individual parts would be submitted
1035
+ * against their `allowSkipping=false` / `validateResponses=true` controls.
1036
+ *
1037
+ * `{ force: true }` is the proctor's administrative end of the test: it runs during a
1038
+ * pause, and neither minimum times nor the skipping/validation gates hold it back; the
1039
+ * collected submissions carry `timing.submissionReason: 'proctor'` — except items an
1040
+ * expired time limit closed, which go out as `time-expired` (time wins), and the end is
1041
+ * an `expiry` end when the time had already closed the delivery. It never fails for
1042
+ * concurrency: while a candidate's navigation or submission is in flight, it waits for
1043
+ * that transition to settle and then ends the test (when the transition itself ended
1044
+ * the test, it resolves with those results).
1045
+ */
1046
+ submit(options?: {
1047
+ force?: boolean;
1048
+ }): Promise<AssessmentResults>;
1049
+ /**
1050
+ * Run an administrative transition exclusively as soon as the lock is free: queued
1051
+ * behind the transition in flight (a pause, a force submit, an expiry hop) instead of
1052
+ * rejecting as busy. The lock is taken synchronously when the in-flight transition
1053
+ * releases it, so no candidate action can slip in between. Rejects only when the
1054
+ * player is destroyed.
1055
+ */
1056
+ private runWhenIdle;
1057
+ /**
1058
+ * Whether an expired hard limit closed the delivery: the whole test expired, or the
1059
+ * current item sits inside an expired scope and no open question remains reachable from
1060
+ * it (an expiry dead end). An earlier question still open in the part keeps delivery
1061
+ * open — the expiry moves the candidate there instead — so its skipping/validation
1062
+ * controls and minimum times keep applying. Only a closed delivery is collected as
1063
+ * `time-expired` without them.
1064
+ */
1065
+ private isTimeClosedDelivery;
1066
+ /**
1067
+ * Why an item's submission runs: an item an expired hard limit closed submits the
1068
+ * responses frozen at the expiry (`time-expired`) — its own scope expired, or the
1069
+ * whole test did; a proctor's forced end of the test collects as `proctor`; a question
1070
+ * the candidate can no longer reach although its QTI skipping/validation control would
1071
+ * refuse it is collected as it stands (`unreachable`); everything else is a normal
1072
+ * candidate submission.
1073
+ */
1074
+ private submissionReasonFor;
1075
+ /**
1076
+ * The one normal-end-of-test path: pending simultaneous-mode responses are submitted,
1077
+ * the current individual-mode item is submitted if needed, then the backend finalizes
1078
+ * (outcome processing runs, results are produced) and navigation closes. Individual-
1079
+ * mode attempts an expired limit closed are collected as well: their responses were
1080
+ * frozen when the time ran out. The same is true for any visited individual-mode item
1081
+ * whose responses never reached the backend because the candidate jumped away without
1082
+ * a forward submission (nonlinear `navigateTo`/`previous` submit nothing): it is
1083
+ * collected through the same detached end-attempt loop instead of being finalized
1084
+ * from NULL.
1085
+ *
1086
+ * A candidate-initiated end of the test first checks the QTI submission controls of
1087
+ * individual parts: it never submits an item without a response while
1088
+ * `allowSkipping=false`, nor an answered item whose responses fail validation while
1089
+ * `validateResponses=true` — it rejects naming them instead, as long as the candidate
1090
+ * can still reach them. A question in a test part already left cannot hold the end of
1091
+ * the test: it is collected as it stands (`submissionReason: 'unreachable'`). An
1092
+ * administrative end (a time expiry, a proctor's forced submit) collects everything as
1093
+ * it stands; an item a skipping control held back is then recorded as skipped.
1094
+ *
1095
+ * `reason` records why the test ends; the outermost caller decides (a candidate's
1096
+ * submit whose final submission branches to EXIT_TEST stays a candidate end) — except
1097
+ * that an end collecting a delivery the time already closed (the whole test expired, or
1098
+ * an expiry dead end left nothing open) is an `expiry` end whoever triggers it: the
1099
+ * auto-finalize, the candidate's Submit after it failed, a proctor's force-submit.
1100
+ *
1101
+ * The end never navigates: it collects where the candidate stands. A branch decision
1102
+ * its own submission returns is kept on record (`followBranch`), and a scope expiry
1103
+ * while it runs only closes the scope — moving delivery off it waits for this end and
1104
+ * happens only if the end does not finalize.
1105
+ */
1106
+ private endTestInternal;
1107
+ private collectAndFinalize;
1108
+ private finalizeInternal;
1109
+ /**
1110
+ * Why the test ended in this delivery (`candidate`, `expiry`, `proctor` or `branch`);
1111
+ * null while it runs and for a session restored already finalized.
1112
+ */
1113
+ getEndReason(): AssessmentEndReason | null;
1114
+ /**
1115
+ * The test ended: close every delivered item session in the player's record. Nothing
1116
+ * can be submitted any more, so an item a practice check reopened for attempts the
1117
+ * candidate did not use stands as the backend accepted it; the active item's live
1118
+ * session is replaced by a closed one (read-only; no item change — the end never
1119
+ * navigates).
1120
+ */
1121
+ private closeItemSessionsForEnd;
1122
+ /**
1123
+ * Surface a backend test-level outcome-processing failure to the host (onError and,
1124
+ * for finalize, the results). Candidate responses stay accepted and persisted; only
1125
+ * SCORE/testFeedback computation failed.
1126
+ */
1127
+ private reportOutcomeProcessingError;
1128
+ /**
1129
+ * The reporter the delivery-rules walk (`nextItemIdentifier`, `firstEligibleItem`)
1130
+ * hands each unevaluable branch rule or preCondition to. A broken rule reads as false
1131
+ * (delivery proceeds on the default path — the same rule never blocks or aborts the
1132
+ * test), but the host learns of it through `config.onError` as a coded
1133
+ * `testConditionFailed` error, once per distinct failed rule rather than on every
1134
+ * re-evaluation.
1135
+ */
1136
+ private reportTestConditionFailure;
1137
+ /**
1138
+ * A backend scoring result whose response processing failed carries a degenerate 0
1139
+ * (its declared maximum where known) plus a `scoringError` — the item-level mirror of
1140
+ * `outcomeProcessingError`. The submission stands and delivery continues, but the host
1141
+ * must be able to tell "answered wrong" from "the engine failed to score"; each
1142
+ * distinct item failure is reported once.
1143
+ */
1144
+ private reportItemScoringError;
1145
+ /**
1146
+ * Report a distinct failure to the host once: `seen` holds the keys already reported,
1147
+ * `key` encodes what makes one failure distinct from another (each reporter composes
1148
+ * its own), and `build` constructs the coded error the host hears through
1149
+ * `config.onError` the first time the key is seen.
1150
+ */
1151
+ private reportOnce;
1152
+ /** The current item's session-control state (attempts, feedback, review, skipping, comments); null before delivery. */
1153
+ getItemSessionInfo(): {
220
1154
  canSubmit: boolean;
221
1155
  remainingAttempts: number | null;
222
1156
  attemptCount: number;
@@ -235,31 +1169,147 @@ export declare class AssessmentPlayer {
235
1169
  getRemainingTime(): number;
236
1170
  getElapsedTime(): number;
237
1171
  isTimeExpired(): boolean;
1172
+ /** Whether delivery has begun. False only while an opt-in begin gate holds the start screen. */
1173
+ hasStarted(): boolean;
1174
+ /**
1175
+ * Open the begin gate (`beginGate` config): enter the first — or restored — item and
1176
+ * start every clock. The shell calls it from its Begin button. Idempotent, and a no-op
1177
+ * without a begin gate (the player then started at creation). A proctor pause in
1178
+ * force keeps the clocks frozen until `resume()`.
1179
+ */
1180
+ start(): void;
1181
+ /**
1182
+ * Proctor pause. Freezes every clock — assessment, test part, section and item; the
1183
+ * live attempt is suspended so its QTI `duration` stops too — and rejects candidate
1184
+ * actions with a coded `assessmentPaused` error until `resume()`. `reason` is
1185
+ * host-supplied, candidate-facing text shown with the pause (localize it in the host).
1186
+ * A pause requested during a navigation or submission applies once it settles; while
1187
+ * already paused, a new reason replaces the shown one. No-op after the test ended.
1188
+ */
1189
+ pause(reason?: string): void;
1190
+ /** End a proctor pause: the clocks continue and the live attempt reopens where it stood. */
1191
+ resume(): void;
1192
+ isPaused(): boolean;
1193
+ /** The candidate-facing reason given for the current pause, if any. */
1194
+ getPauseReason(): string | undefined;
1195
+ /** The countdown a shell shows: the active scope's nearest hard maximum and the clock state. */
1196
+ getTimeState(): AssessmentTimeState;
1197
+ /**
1198
+ * Whether the session is terminal: the test has ended here, or the backend restored a
1199
+ * session it had already finalized. Shells show their completed view; `submit()`
1200
+ * returns the stored results without another backend round trip.
1201
+ */
1202
+ isFinalized(): boolean;
1203
+ /** The stored results of a session restored already finalized. */
1204
+ private finalResultsFromInit;
1205
+ /**
1206
+ * What a start screen shows before delivery begins: the test title, the time the
1207
+ * candidate has for the whole test (PNP extended time applied; what remains of it for
1208
+ * a resumed session), whether parts, sections or items carry their own limits, and the
1209
+ * first test part's rubric blocks (role-filter them before display).
1210
+ */
1211
+ getStartInfo(): AssessmentStartInfo;
1212
+ /** Whether the candidate hid the countdown. Persisted in the session state, like flags. */
1213
+ isTimerHidden(): boolean;
1214
+ setTimerHidden(hidden: boolean): void;
238
1215
  onItemChange(listener: (index: number, total: number) => void): () => void;
239
1216
  onSectionChange(listener: (index: number, total: number) => void): () => void;
240
1217
  onResponseChange(listener: (responses: Record<string, unknown>) => void): () => void;
241
- onComplete(listener: () => void): () => void;
1218
+ /**
1219
+ * The test ended in this delivery — by any path: a candidate submit, a proctor's
1220
+ * force-submit, a QTI EXIT_TEST branch, a whole-test expiry — with its results.
1221
+ */
1222
+ onComplete(listener: (results: AssessmentResults) => void): () => void;
1223
+ /** Fires when a navigation/submission transition starts or ends (`getNavigationState().isLoading` mirrors this). */
1224
+ onBusyChange(listener: (busy: boolean) => void): () => void;
242
1225
  /** Called when `getVisibleFeedback()` may have changed: new outcomes, a new test part, or the end. */
243
1226
  onTestFeedbackChange(listener: () => void): () => void;
244
1227
  onTimeWarning(listener: (remainingSeconds: number) => void): () => void;
245
- onTimeExpired(listener: () => void): () => void;
1228
+ /**
1229
+ * A hard time limit ran out with no late submission: the whole test (the core then
1230
+ * finalizes automatically; the event follows with `autoFinalized`, or with
1231
+ * `submissionRequired` when finalization failed), or a scope whose expiry leaves nothing
1232
+ * unlocked (`submissionRequired`: the candidate must submit now).
1233
+ */
1234
+ onTimeExpired(listener: (event: AssessmentTimeExpiryEvent) => void): () => void;
1235
+ /** A test part, section or item limit expired: its items closed, delivery moved on if it could. */
1236
+ onScopeTimeExpired(listener: (event: ScopeTimeExpiryEvent) => void): () => void;
1237
+ /** Fires when a proctor pause starts (with its reason) or ends. */
1238
+ onPauseChange(listener: (paused: boolean, reason?: string) => void): () => void;
246
1239
  onTimeTick(listener: (remainingSeconds: number, elapsedSeconds: number) => void): () => void;
247
1240
  destroy(): void;
248
1241
  private notifyItemChange;
249
1242
  private notifySectionChange;
250
1243
  private notifyResponseChange;
251
1244
  private notifyComplete;
1245
+ private notifyBusyChange;
252
1246
  private notifyTestFeedbackChange;
253
1247
  private notifyTimeWarning;
254
- private evaluateTemplateDefaults;
1248
+ private notifyPauseChange;
1249
+ /**
1250
+ * The template defaults an item's new session starts from (QTI `templateDefault`;
1251
+ * see `templateDefaults.templateDefaultsFor`). The part cache is the player's.
1252
+ */
1253
+ private templateDefaultsFor;
255
1254
  private isItemLocked;
1255
+ /** The expired scope that closes an item (outermost first); the assessment for a whole-test expiry. */
1256
+ private lockingScopeOf;
1257
+ /**
1258
+ * Nothing open remains (a restore, or a start over, landed on an expired scope with
1259
+ * no open item after it): the candidate must submit now — the same report the live
1260
+ * expiry dead end makes, so the shell offers Submit wherever the candidate is.
1261
+ */
1262
+ private notifyExpiryDeadEnd;
256
1263
  private nextUnlockedIndex;
1264
+ /**
1265
+ * Whether delivery may land on the item after a closure: no expired limit closed it and
1266
+ * the review policy lets the candidate be there (QTI `allowReview` once its attempts are
1267
+ * used up). Later parts are entered fresh, so only the time lock applies to them.
1268
+ */
1269
+ private isOpenTarget;
1270
+ /**
1271
+ * Where delivery goes when the item at `fromIndex` closes (a scope expiry, or a restore
1272
+ * that lands on a closed item), looking across the whole reachable delivery rather than
1273
+ * only forward: the next open item of its test part; else — in a nonlinear part — the
1274
+ * nearest open item before it; else the first open item of a later part (parts are
1275
+ * delivered in order, so earlier parts are never re-entered, and a part is left only
1276
+ * when nothing in it is open any more). Forward, only items the delivery rules reach
1277
+ * count: a part (or, in a linear part, a section or item) whose precondition fails is
1278
+ * skipped as on any forward step. -1 when nothing open remains: the expiry dead end,
1279
+ * where the candidate's way out is the submission.
1280
+ */
1281
+ private openItemAfterClosure;
257
1282
  /**
258
1283
  * A test part, section or item without late submission ran out of time: its items close for the
259
- * candidate, and delivery moves to the next item outside it.
1284
+ * candidate, and delivery moves to the next open item — forward in the part, else an open
1285
+ * question earlier in a nonlinear part, else the next part. Only when nothing open
1286
+ * remains anywhere reachable is it the expiry dead end.
1287
+ *
1288
+ * The end of the test never navigates: while one runs, the expiry only closes the scope
1289
+ * (the collection takes its items as they stand, `time-expired`). Leaving it — the move
1290
+ * and its report — waits for that end, and is moot once the end finalized.
260
1291
  */
261
1292
  private handleScopeExpired;
1293
+ /**
1294
+ * Close an expired scope for the candidate: move delivery off it, or report the dead
1295
+ * end. Called from the timer's expiry (`handleScopeExpired`), so the hop is a
1296
+ * state-changing transition like any other: it queues behind the navigation or
1297
+ * submission transition in flight and takes the transition lock once that settles,
1298
+ * instead of racing the in-flight backend request.
1299
+ */
1300
+ private leaveExpiredScope;
1301
+ /** The hop itself, run under the transition lock (or inline while the end holds it). */
1302
+ private leaveExpiredScopeLocked;
1303
+ /**
1304
+ * The whole-test hard limit expired without late submission (TimeManager calls this
1305
+ * only for that case): finalize like a submit so pending responses are collected and
1306
+ * outcomes computed, then report the expiry. If finalization fails, the session stays
1307
+ * open and the shell offers the Submit action.
1308
+ */
1309
+ private handleAssessmentTimeExpired;
1310
+ private autoFinalizeForTimeExpiry;
262
1311
  private notifyTimeExpired;
1312
+ private notifyScopeTimeExpired;
263
1313
  private notifyTimeTick;
264
1314
  /**
265
1315
  * Get the i18n provider instance
@@ -272,4 +1322,3 @@ export declare class AssessmentPlayer {
272
1322
  */
273
1323
  private createDefaultI18nProvider;
274
1324
  }
275
- export {};