@qti-components/delivery 0.1.0-next.4 → 0.1.0-next.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.
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './model/test-model.js';
2
2
  export * from './model/item-facts.js';
3
3
  export type { XmlElement, XmlNode } from './model/xml-node.js';
4
4
  export * from './lifecycle/item-lifecycle.js';
5
+ export * from './lifecycle/item-rules.js';
5
6
  export * from './random/seeded-random.js';
6
7
  export * from './random/selection.js';
7
8
  export * from './random/shuffle.js';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './model/test-model.js';
2
2
  export * from './model/item-facts.js';
3
3
  export * from './lifecycle/item-lifecycle.js';
4
+ export * from './lifecycle/item-rules.js';
4
5
  export * from './random/seeded-random.js';
5
6
  export * from './random/selection.js';
6
7
  export * from './random/shuffle.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './model/test-model.js';\nexport * from './model/item-facts.js';\nexport type { XmlElement, XmlNode } from './model/xml-node.js';\nexport * from './lifecycle/item-lifecycle.js';\nexport * from './random/seeded-random.js';\nexport * from './random/selection.js';\nexport * from './random/shuffle.js';\nexport * from './state/clock.js';\nexport * from './state/commands.js';\nexport * from './state/create-delivery-state.js';\nexport * from './state/delivery-state.js';\nexport * from './processing.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './model/test-model.js';\nexport * from './model/item-facts.js';\nexport type { XmlElement, XmlNode } from './model/xml-node.js';\nexport * from './lifecycle/item-lifecycle.js';\nexport * from './lifecycle/item-rules.js';\nexport * from './random/seeded-random.js';\nexport * from './random/selection.js';\nexport * from './random/shuffle.js';\nexport * from './state/clock.js';\nexport * from './state/commands.js';\nexport * from './state/create-delivery-state.js';\nexport * from './state/delivery-state.js';\nexport * from './processing.js';\n"]}
@@ -72,7 +72,10 @@ export interface ItemLifecycleInput {
72
72
  adaptive: boolean;
73
73
  navigationMode: TestPartModel['navigationMode'];
74
74
  submissionMode: TestPartModel['submissionMode'];
75
- /** The item's `numAttempts`. */
75
+ /**
76
+ * The attempts the candidate has ended. QTI's `numAttempts` counts an attempt as it begins; this
77
+ * delivery counts it when it ends, and T3d keeps that (`plans/item-lifecycle.md`).
78
+ */
76
79
  numAttempts: number;
77
80
  /** The item's `completionStatus` (`not_attempted`, `unknown`, `incomplete`, `completed`). */
78
81
  completionStatus: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"item-lifecycle.js","sourceRoot":"","sources":["../../src/lifecycle/item-lifecycle.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,SAAS;IACT,aAAa;IACb,eAAe;IACf,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WAAW,GAAG,WAAW,CAAC;AACxD,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,mBAAmB,CAAC,KAAyB;IAC3D,OAAO;QACL,YAAY,EAAE,eAAe,CAAC,KAAK,CAAC;QACpC,wFAAwF;QACxF,oBAAoB,EAAE,KAAK,CAAC,cAAc,KAAK,YAAY;QAC3D,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,6FAA6F;QAC7F,SAAS,EAAE,KAAK,CAAC,cAAc,KAAK,WAAW,IAAI,CAAC,KAAK,CAAC,IAAI;QAC9D,WAAW,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW;QAC7C,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY;KAChD,CAAC;AACJ,CAAC","sourcesContent":["import type { SessionControl, TestPartModel } from '../model/test-model.js';\n\n/**\n * The item session lifecycle (QTI 3 info model §2.2.1, Figure 2.1) as one finite state machine per\n * item instance: every item session is in exactly one of these states, and only the transitions in\n * `ITEM_LIFECYCLE` happen. Each rule of item session control is a guard on one of them.\n *\n * ```mermaid\n * stateDiagram-v2\n * [*] --> initial\n * initial --> interacting: beginAttempt [attemptsLeft]\n * initial --> closed: endItemSession\n * interacting --> closed: endAttempt [individualSubmission, no attemptsLeft]\n * interacting --> modalFeedback: endAttempt [individualSubmission, attemptsLeft, modalFeedback]\n * interacting --> interacting: endAttempt [individualSubmission, attemptsLeft]\n * interacting --> suspended: endCandidateSession\n * interacting --> closed: endItemSession\n * modalFeedback --> interacting: beginAttempt [attemptsLeft]\n * modalFeedback --> suspended: endCandidateSession\n * modalFeedback --> closed: endItemSession\n * suspended --> interacting: beginCandidateSession [mayResume]\n * suspended --> closed: endItemSession\n * closed --> review: beginReview [allowReview]\n * review --> closed: endReview\n * closed --> solution: beginSolution [showSolution]\n * solution --> closed: endSolution\n * ```\n *\n * What QTI ties to the states: interactions are enabled in `interacting` only; in `closed` and\n * `review` the responses show but are fixed; in `solution` the correct responses show instead. An\n * item that goes from `initial` straight to `closed` keeps NULL responses.\n *\n * The text of §2.2.1 names six states; `modalFeedback` comes from its figure (Figure 2.1, as this\n * plan reads it): the item after an attempt whose response processing set modal feedback, with\n * attempts left (\"modal feedback is shown to the candidate directly following response\n * processing\", §2.6). The candidate reads it before trying again.\n *\n * Experimental (0.x): roadmap 1 phase T3; see `plans/delivery-state.md`.\n */\nexport const ITEM_LIFECYCLE_STATES = [\n 'initial',\n 'interacting',\n 'modalFeedback',\n 'suspended',\n 'closed',\n 'review',\n 'solution'\n] as const;\n\nexport type ItemLifecycleState = (typeof ITEM_LIFECYCLE_STATES)[number];\n\n/**\n * What happens to an item session, in QTI's words (info model §2.2.1). The delivery's commands\n * (`navigate`, `beginAttempt`, `endAttempt`, `endTestPart`, `timeUp`) are turned into these, per item.\n */\nexport const ITEM_LIFECYCLE_EVENTS = [\n 'beginAttempt',\n 'endAttempt',\n 'endCandidateSession',\n 'beginCandidateSession',\n 'endItemSession',\n 'beginReview',\n 'endReview',\n 'beginSolution',\n 'endSolution'\n] as const;\n\nexport type ItemLifecycleEvent = (typeof ITEM_LIFECYCLE_EVENTS)[number];\n\n/** The conditions a transition can depend on; `itemLifecycleGuards` reads them for one item. */\nexport const ITEM_LIFECYCLE_GUARDS = [\n 'attemptsLeft',\n 'individualSubmission',\n 'modalFeedback',\n 'mayResume',\n 'allowReview',\n 'showSolution'\n] as const;\n\nexport type ItemLifecycleGuard = (typeof ITEM_LIFECYCLE_GUARDS)[number];\n\nexport type ItemLifecycleGuards = Readonly<Record<ItemLifecycleGuard, boolean>>;\n\n/** One way out of a state: taken when every `when` guard holds and no `unless` guard does. */\nexport interface ItemLifecycleBranch {\n readonly to: ItemLifecycleState;\n readonly when?: readonly ItemLifecycleGuard[];\n readonly unless?: readonly ItemLifecycleGuard[];\n}\n\n/** A state with no guard, or branches tried in order, the first that holds taken. */\nexport type ItemLifecycleTarget = ItemLifecycleState | readonly ItemLifecycleBranch[];\n\n/** The transition table: a pair it does not list is refused. */\nexport const ITEM_LIFECYCLE: Readonly<\n Record<ItemLifecycleState, Readonly<Partial<Record<ItemLifecycleEvent, ItemLifecycleTarget>>>>\n> = {\n initial: {\n beginAttempt: [{ to: 'interacting', when: ['attemptsLeft'] }],\n endItemSession: 'closed'\n },\n interacting: {\n // The guards are read after response processing, with the ended attempt counted.\n endAttempt: [\n { to: 'closed', when: ['individualSubmission'], unless: ['attemptsLeft'] },\n { to: 'modalFeedback', when: ['individualSubmission', 'attemptsLeft', 'modalFeedback'] },\n { to: 'interacting', when: ['individualSubmission', 'attemptsLeft'] }\n ],\n endCandidateSession: 'suspended',\n endItemSession: 'closed'\n },\n modalFeedback: {\n beginAttempt: [{ to: 'interacting', when: ['attemptsLeft'] }],\n endCandidateSession: 'suspended',\n endItemSession: 'closed'\n },\n suspended: {\n beginCandidateSession: [{ to: 'interacting', when: ['mayResume'] }],\n endItemSession: 'closed'\n },\n closed: {\n beginReview: [{ to: 'review', when: ['allowReview'] }],\n beginSolution: [{ to: 'solution', when: ['showSolution'] }]\n },\n review: {\n endReview: 'closed'\n },\n solution: {\n endSolution: 'closed'\n }\n};\n\n/**\n * The state an item session goes to on `event`, or null when the table refuses it: the pair is not\n * listed, or no branch's guards hold. Pure: the same state, event and guards give the same answer\n * on every runtime.\n */\nexport function transition(\n state: ItemLifecycleState,\n event: ItemLifecycleEvent,\n guards: ItemLifecycleGuards\n): ItemLifecycleState | null {\n const target = ITEM_LIFECYCLE[state][event];\n if (target === undefined) return null;\n if (typeof target === 'string') return target;\n const branch = target.find(\n ({ when = [], unless = [] }) => when.every(guard => guards[guard]) && !unless.some(guard => guards[guard])\n );\n return branch?.to ?? null;\n}\n\n/** What the guards of one item session are read from. */\nexport interface ItemLifecycleInput {\n /** The item-ref's resolved session control (`ItemRefModel.sessionControl`). */\n sessionControl: Pick<SessionControl, 'maxAttempts' | 'allowReview' | 'showSolution'>;\n /** From the item's facts (`ItemFacts.adaptive`). */\n adaptive: boolean;\n navigationMode: TestPartModel['navigationMode'];\n submissionMode: TestPartModel['submissionMode'];\n /** The item's `numAttempts`. */\n numAttempts: number;\n /** The item's `completionStatus` (`not_attempted`, `unknown`, `incomplete`, `completed`). */\n completionStatus: string | null;\n /** The candidate has moved on from the item; in a linear part there is no way back. */\n left: boolean;\n /** The last response processing set modal feedback to show. */\n modalFeedback: boolean;\n}\n\n/**\n * Whether another attempt is allowed (implementation guide §4.4.2.1): a non-adaptive item until it\n * has used `max-attempts` (0 is unlimited); an adaptive item, which ignores `max-attempts`, until its\n * response processing set `completionStatus` to `completed`.\n */\nexport function hasAttemptsLeft({\n sessionControl: { maxAttempts },\n adaptive,\n numAttempts,\n completionStatus\n}: Pick<ItemLifecycleInput, 'sessionControl' | 'adaptive' | 'numAttempts' | 'completionStatus'>): boolean {\n if (adaptive) return completionStatus !== 'completed';\n return maxAttempts === 0 || numAttempts < maxAttempts;\n}\n\n/** The guards of one item session, from its session control, its facts, its part and its variables. */\nexport function itemLifecycleGuards(input: ItemLifecycleInput): ItemLifecycleGuards {\n return {\n attemptsLeft: hasAttemptsLeft(input),\n // In a simultaneous part every response is processed when the part is submitted (§4.1).\n individualSubmission: input.submissionMode === 'individual',\n modalFeedback: input.modalFeedback,\n // A linear part restricts the candidate to each item in turn: once left, never again (§4.1).\n mayResume: input.navigationMode === 'nonlinear' || !input.left,\n allowReview: input.sessionControl.allowReview,\n showSolution: input.sessionControl.showSolution\n };\n}\n"]}
1
+ {"version":3,"file":"item-lifecycle.js","sourceRoot":"","sources":["../../src/lifecycle/item-lifecycle.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,SAAS;IACT,aAAa;IACb,eAAe;IACf,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,UAAU;CACF,CAAC;AAIX;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,cAAc;IACd,YAAY;IACZ,qBAAqB;IACrB,uBAAuB;I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;QACxF,oBAAoB,EAAE,KAAK,CAAC,cAAc,KAAK,YAAY;QAC3D,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,6FAA6F;QAC7F,SAAS,EAAE,KAAK,CAAC,cAAc,KAAK,WAAW,IAAI,CAAC,KAAK,CAAC,IAAI;QAC9D,WAAW,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW;QAC7C,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY;KAChD,CAAC;AACJ,CAAC","sourcesContent":["import type { SessionControl, TestPartModel } from '../model/test-model.js';\n\n/**\n * The item session lifecycle (QTI 3 info model §2.2.1, Figure 2.1) as one finite state machine per\n * item instance: every item session is in exactly one of these states, and only the transitions in\n * `ITEM_LIFECYCLE` happen. Each rule of item session control is a guard on one of them.\n *\n * ```mermaid\n * stateDiagram-v2\n * [*] --> initial\n * initial --> interacting: beginAttempt [attemptsLeft]\n * initial --> closed: endItemSession\n * interacting --> closed: endAttempt [individualSubmission, no attemptsLeft]\n * interacting --> modalFeedback: endAttempt [individualSubmission, attemptsLeft, modalFeedback]\n * interacting --> interacting: endAttempt [individualSubmission, attemptsLeft]\n * interacting --> suspended: endCandidateSession\n * interacting --> closed: endItemSession\n * modalFeedback --> interacting: beginAttempt [attemptsLeft]\n * modalFeedback --> suspended: endCandidateSession\n * modalFeedback --> closed: endItemSession\n * suspended --> interacting: beginCandidateSession [mayResume]\n * suspended --> closed: endItemSession\n * closed --> review: beginReview [allowReview]\n * review --> closed: endReview\n * closed --> solution: beginSolution [showSolution]\n * solution --> closed: endSolution\n * ```\n *\n * What QTI ties to the states: interactions are enabled in `interacting` only; in `closed` and\n * `review` the responses show but are fixed; in `solution` the correct responses show instead. An\n * item that goes from `initial` straight to `closed` keeps NULL responses.\n *\n * The text of §2.2.1 names six states; `modalFeedback` comes from its figure (Figure 2.1, as this\n * plan reads it): the item after an attempt whose response processing set modal feedback, with\n * attempts left (\"modal feedback is shown to the candidate directly following response\n * processing\", §2.6). The candidate reads it before trying again.\n *\n * Experimental (0.x): roadmap 1 phase T3; see `plans/delivery-state.md`.\n */\nexport const ITEM_LIFECYCLE_STATES = [\n 'initial',\n 'interacting',\n 'modalFeedback',\n 'suspended',\n 'closed',\n 'review',\n 'solution'\n] as const;\n\nexport type ItemLifecycleState = (typeof ITEM_LIFECYCLE_STATES)[number];\n\n/**\n * What happens to an item session, in QTI's words (info model §2.2.1). The delivery's commands\n * (`navigate`, `beginAttempt`, `endAttempt`, `endTestPart`, `timeUp`) are turned into these, per item.\n */\nexport const ITEM_LIFECYCLE_EVENTS = [\n 'beginAttempt',\n 'endAttempt',\n 'endCandidateSession',\n 'beginCandidateSession',\n 'endItemSession',\n 'beginReview',\n 'endReview',\n 'beginSolution',\n 'endSolution'\n] as const;\n\nexport type ItemLifecycleEvent = (typeof ITEM_LIFECYCLE_EVENTS)[number];\n\n/** The conditions a transition can depend on; `itemLifecycleGuards` reads them for one item. */\nexport const ITEM_LIFECYCLE_GUARDS = [\n 'attemptsLeft',\n 'individualSubmission',\n 'modalFeedback',\n 'mayResume',\n 'allowReview',\n 'showSolution'\n] as const;\n\nexport type ItemLifecycleGuard = (typeof ITEM_LIFECYCLE_GUARDS)[number];\n\nexport type ItemLifecycleGuards = Readonly<Record<ItemLifecycleGuard, boolean>>;\n\n/** One way out of a state: taken when every `when` guard holds and no `unless` guard does. */\nexport interface ItemLifecycleBranch {\n readonly to: ItemLifecycleState;\n readonly when?: readonly ItemLifecycleGuard[];\n readonly unless?: readonly ItemLifecycleGuard[];\n}\n\n/** A state with no guard, or branches tried in order, the first that holds taken. */\nexport type ItemLifecycleTarget = ItemLifecycleState | readonly ItemLifecycleBranch[];\n\n/** The transition table: a pair it does not list is refused. */\nexport const ITEM_LIFECYCLE: Readonly<\n Record<ItemLifecycleState, Readonly<Partial<Record<ItemLifecycleEvent, ItemLifecycleTarget>>>>\n> = {\n initial: {\n beginAttempt: [{ to: 'interacting', when: ['attemptsLeft'] }],\n endItemSession: 'closed'\n },\n interacting: {\n // The guards are read after response processing, with the ended attempt counted.\n endAttempt: [\n { to: 'closed', when: ['individualSubmission'], unless: ['attemptsLeft'] },\n { to: 'modalFeedback', when: ['individualSubmission', 'attemptsLeft', 'modalFeedback'] },\n { to: 'interacting', when: ['individualSubmission', 'attemptsLeft'] }\n ],\n endCandidateSession: 'suspended',\n endItemSession: 'closed'\n },\n modalFeedback: {\n beginAttempt: [{ to: 'interacting', when: ['attemptsLeft'] }],\n endCandidateSession: 'suspended',\n endItemSession: 'closed'\n },\n suspended: {\n beginCandidateSession: [{ to: 'interacting', when: ['mayResume'] }],\n endItemSession: 'closed'\n },\n closed: {\n beginReview: [{ to: 'review', when: ['allowReview'] }],\n beginSolution: [{ to: 'solution', when: ['showSolution'] }]\n },\n review: {\n endReview: 'closed'\n },\n solution: {\n endSolution: 'closed'\n }\n};\n\n/**\n * The state an item session goes to on `event`, or null when the table refuses it: the pair is not\n * listed, or no branch's guards hold. Pure: the same state, event and guards give the same answer\n * on every runtime.\n */\nexport function transition(\n state: ItemLifecycleState,\n event: ItemLifecycleEvent,\n guards: ItemLifecycleGuards\n): ItemLifecycleState | null {\n const target = ITEM_LIFECYCLE[state][event];\n if (target === undefined) return null;\n if (typeof target === 'string') return target;\n const branch = target.find(\n ({ when = [], unless = [] }) => when.every(guard => guards[guard]) && !unless.some(guard => guards[guard])\n );\n return branch?.to ?? null;\n}\n\n/** What the guards of one item session are read from. */\nexport interface ItemLifecycleInput {\n /** The item-ref's resolved session control (`ItemRefModel.sessionControl`). */\n sessionControl: Pick<SessionControl, 'maxAttempts' | 'allowReview' | 'showSolution'>;\n /** From the item's facts (`ItemFacts.adaptive`). */\n adaptive: boolean;\n navigationMode: TestPartModel['navigationMode'];\n submissionMode: TestPartModel['submissionMode'];\n /**\n * The attempts the candidate has ended. QTI's `numAttempts` counts an attempt as it begins; this\n * delivery counts it when it ends, and T3d keeps that (`plans/item-lifecycle.md`).\n */\n numAttempts: number;\n /** The item's `completionStatus` (`not_attempted`, `unknown`, `incomplete`, `completed`). */\n completionStatus: string | null;\n /** The candidate has moved on from the item; in a linear part there is no way back. */\n left: boolean;\n /** The last response processing set modal feedback to show. */\n modalFeedback: boolean;\n}\n\n/**\n * Whether another attempt is allowed (implementation guide §4.4.2.1): a non-adaptive item until it\n * has used `max-attempts` (0 is unlimited); an adaptive item, which ignores `max-attempts`, until its\n * response processing set `completionStatus` to `completed`.\n */\nexport function hasAttemptsLeft({\n sessionControl: { maxAttempts },\n adaptive,\n numAttempts,\n completionStatus\n}: Pick<ItemLifecycleInput, 'sessionControl' | 'adaptive' | 'numAttempts' | 'completionStatus'>): boolean {\n if (adaptive) return completionStatus !== 'completed';\n return maxAttempts === 0 || numAttempts < maxAttempts;\n}\n\n/** The guards of one item session, from its session control, its facts, its part and its variables. */\nexport function itemLifecycleGuards(input: ItemLifecycleInput): ItemLifecycleGuards {\n return {\n attemptsLeft: hasAttemptsLeft(input),\n // In a simultaneous part every response is processed when the part is submitted (§4.1).\n individualSubmission: input.submissionMode === 'individual',\n modalFeedback: input.modalFeedback,\n // A linear part restricts the candidate to each item in turn: once left, never again (§4.1).\n mayResume: input.navigationMode === 'nonlinear' || !input.left,\n allowReview: input.sessionControl.allowReview,\n showSolution: input.sessionControl.showSolution\n };\n}\n"]}
@@ -0,0 +1,95 @@
1
+ import type { SessionControl, TestPartModel } from '../model/test-model.js';
2
+ import type { ItemLifecycleInput, ItemLifecycleState } from './item-lifecycle.js';
3
+ /**
4
+ * What one item session may do now, answered from its lifecycle state, its session control and its
5
+ * responses. Every reader of attempts, skipping, feedback, review or the solution asks here instead
6
+ * of working the rule out itself (roadmap 1, T3b).
7
+ *
8
+ * The answers follow QTI 3 (`qti-item-session-control`, info model §7.19; implementation guide
9
+ * §4.1 and §4.4.2) and nothing else: whether the last attempt was optimal decides none of them
10
+ * (decided 2026-11-27, `plans/host-api.md`).
11
+ *
12
+ * Experimental (0.x).
13
+ */
14
+ export interface ItemRules {
15
+ /**
16
+ * Another attempt is allowed: `max-attempts` not reached (0 is unlimited), or, for an adaptive
17
+ * item, which ignores `max-attempts`, `completionStatus` not `completed`.
18
+ */
19
+ readonly attemptsLeft: boolean;
20
+ /** No further attempt is allowed: the negation of `attemptsLeft`. */
21
+ readonly attemptsUsed: boolean;
22
+ /** The responses can change: only while `interacting`. In every other state they are fixed or not shown. */
23
+ readonly interactive: boolean;
24
+ /** The item session is over: `closed`, or in `review` or `solution`, which come back to `closed`. */
25
+ readonly done: boolean;
26
+ /**
27
+ * The candidate may end the attempt now: the item is `interacting` in a part with individual
28
+ * submission, and `maySubmit` holds.
29
+ */
30
+ readonly mayEndAttempt: boolean;
31
+ /**
32
+ * The responses may be submitted as they are: `allow-skipping="false"` refuses an item with no
33
+ * response, `validate-responses` an invalid one. Two separate rules, both for individual
34
+ * submission only (§7.19).
35
+ */
36
+ readonly maySubmit: boolean;
37
+ /** Submitting no response is allowed: `allow-skipping`, or a response given, or simultaneous submission. */
38
+ readonly maySkip: boolean;
39
+ /**
40
+ * Feedback, modal and integrated, may show: always while attempts are left, after the last
41
+ * attempt only with `show-feedback`. In `review`, an adaptive item with `allow-review` shows its
42
+ * feedback whatever `show-feedback` says (§7.19, `allow-review`).
43
+ */
44
+ readonly mayShowFeedback: boolean;
45
+ /**
46
+ * The item session may enter `review` now: it is `closed`, with `allow-review`. False in `review`
47
+ * itself; whether review shows is the state.
48
+ */
49
+ readonly mayBeginReview: boolean;
50
+ /**
51
+ * The item session may enter `solution`, which shows the correct responses: it is `closed`, with
52
+ * `show-solution`. False in `solution` itself; whether the solution shows is the state.
53
+ */
54
+ readonly mayBeginSolution: boolean;
55
+ }
56
+ /** What the rules of one item session are read from: its lifecycle input, its state and its responses. */
57
+ export interface ItemRulesInput extends Omit<ItemLifecycleInput, 'sessionControl'> {
58
+ /** The item-ref's resolved session control (`ItemRefModel.sessionControl`). */
59
+ sessionControl: Omit<SessionControl, 'allowComment'>;
60
+ /** The item session's lifecycle state. */
61
+ state: ItemLifecycleState;
62
+ /**
63
+ * The candidate gave no response: every response variable holds its default or NULL. False for an
64
+ * item with no response variables, which "by definition cannot be skipped" (§7.19).
65
+ */
66
+ skipped: boolean;
67
+ /** Every interaction's response satisfies its constraints (the item's `valid`). */
68
+ valid: boolean;
69
+ }
70
+ /** The rules of one item session. Pure: the same input gives the same answers on every runtime. */
71
+ export declare function itemRules(input: ItemRulesInput): ItemRules;
72
+ /** Where the candidate is in a part, for its navigation answers. */
73
+ export interface NavigationRulesInput {
74
+ navigationMode: TestPartModel['navigationMode'];
75
+ submissionMode: TestPartModel['submissionMode'];
76
+ /** The current item's position among the part's items in order, from 0; -1 when none is current. */
77
+ index: number;
78
+ /** The number of items in the part. */
79
+ count: number;
80
+ /** The rules of the current item. */
81
+ current: Pick<ItemRules, 'maySubmit' | 'interactive'>;
82
+ }
83
+ /** Whether the candidate may move to the next or the previous item of a part. */
84
+ export interface NavigationRules {
85
+ /**
86
+ * There is a next item and, in a linear part with individual submission, the current item may be
87
+ * left: Next ends an attempt that was not ended and closes the item (decided 2026-11-27), so its
88
+ * responses must be ones the candidate may submit.
89
+ */
90
+ readonly mayGoNext: boolean;
91
+ /** There is a previous item, in a nonlinear part: a linear part never goes back (§4.1). */
92
+ readonly mayGoPrevious: boolean;
93
+ }
94
+ /** The navigation answers of a part. Pure. */
95
+ export declare function navigationRules({ navigationMode, submissionMode, index, count, current }: NavigationRulesInput): NavigationRules;
@@ -0,0 +1,33 @@
1
+ import { itemLifecycleGuards, transition } from './item-lifecycle.js';
2
+ /** The rules of one item session. Pure: the same input gives the same answers on every runtime. */
3
+ export function itemRules(input) {
4
+ const { state, sessionControl, adaptive } = input;
5
+ const guards = itemLifecycleGuards(input);
6
+ const individual = guards.individualSubmission;
7
+ const maySkip = !individual || sessionControl.allowSkipping || !input.skipped;
8
+ const maySubmit = maySkip && (!individual || !sessionControl.validateResponses || input.valid);
9
+ return {
10
+ attemptsLeft: guards.attemptsLeft,
11
+ attemptsUsed: !guards.attemptsLeft,
12
+ interactive: state === 'interacting',
13
+ done: state === 'closed' || state === 'review' || state === 'solution',
14
+ mayEndAttempt: maySubmit && transition(state, 'endAttempt', guards) !== null,
15
+ maySubmit,
16
+ maySkip,
17
+ mayShowFeedback: guards.attemptsLeft ||
18
+ sessionControl.showFeedback ||
19
+ (state === 'review' && adaptive && sessionControl.allowReview),
20
+ mayBeginReview: transition(state, 'beginReview', guards) !== null,
21
+ mayBeginSolution: transition(state, 'beginSolution', guards) !== null
22
+ };
23
+ }
24
+ /** The navigation answers of a part. Pure. */
25
+ export function navigationRules({ navigationMode, submissionMode, index, count, current }) {
26
+ const onItem = index >= 0 && index < count;
27
+ const endsAttempt = navigationMode === 'linear' && submissionMode === 'individual' && current.interactive;
28
+ return {
29
+ mayGoNext: onItem && index < count - 1 && (!endsAttempt || current.maySubmit),
30
+ mayGoPrevious: onItem && index > 0 && navigationMode === 'nonlinear'
31
+ };
32
+ }
33
+ //# sourceMappingURL=item-rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item-rules.js","sourceRoot":"","sources":["../../src/lifecycle/item-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA0EtE,mGAAmG;AACnG,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAClD,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,MAAM,CAAC,oBAAoB,CAAC;IAC/C,MAAM,OAAO,GAAG,CAAC,UAAU,IAAI,cAAc,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC9E,MAAM,SAAS,GAAG,OAAO,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,cAAc,CAAC,iBAAiB,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/F,OAAO;QACL,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,YAAY,EAAE,CAAC,MAAM,CAAC,YAAY;QAClC,WAAW,EAAE,KAAK,KAAK,aAAa;QACpC,IAAI,EAAE,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,UAAU;QACtE,aAAa,EAAE,SAAS,IAAI,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,IAAI;QAC5E,SAAS;QACT,OAAO;QACP,eAAe,EACb,MAAM,CAAC,YAAY;YACnB,cAAc,CAAC,YAAY;YAC3B,CAAC,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAI,cAAc,CAAC,WAAW,CAAC;QAChE,cAAc,EAAE,UAAU,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,CAAC,KAAK,IAAI;QACjE,gBAAgB,EAAE,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,CAAC,KAAK,IAAI;KACtE,CAAC;AACJ,CAAC;AA0BD,8CAA8C;AAC9C,MAAM,UAAU,eAAe,CAAC,EAC9B,cAAc,EACd,cAAc,EACd,KAAK,EACL,KAAK,EACL,OAAO,EACc;IACrB,MAAM,MAAM,GAAG,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC;IAC3C,MAAM,WAAW,GAAG,cAAc,KAAK,QAAQ,IAAI,cAAc,KAAK,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC;IAC1G,OAAO;QACL,SAAS,EAAE,MAAM,IAAI,KAAK,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,WAAW,IAAI,OAAO,CAAC,SAAS,CAAC;QAC7E,aAAa,EAAE,MAAM,IAAI,KAAK,GAAG,CAAC,IAAI,cAAc,KAAK,WAAW;KACrE,CAAC;AACJ,CAAC","sourcesContent":["import { itemLifecycleGuards, transition } from './item-lifecycle.js';\n\nimport type { SessionControl, TestPartModel } from '../model/test-model.js';\nimport type { ItemLifecycleInput, ItemLifecycleState } from './item-lifecycle.js';\n\n/**\n * What one item session may do now, answered from its lifecycle state, its session control and its\n * responses. Every reader of attempts, skipping, feedback, review or the solution asks here instead\n * of working the rule out itself (roadmap 1, T3b).\n *\n * The answers follow QTI 3 (`qti-item-session-control`, info model §7.19; implementation guide\n * §4.1 and §4.4.2) and nothing else: whether the last attempt was optimal decides none of them\n * (decided 2026-11-27, `plans/host-api.md`).\n *\n * Experimental (0.x).\n */\nexport interface ItemRules {\n /**\n * Another attempt is allowed: `max-attempts` not reached (0 is unlimited), or, for an adaptive\n * item, which ignores `max-attempts`, `completionStatus` not `completed`.\n */\n readonly attemptsLeft: boolean;\n /** No further attempt is allowed: the negation of `attemptsLeft`. */\n readonly attemptsUsed: boolean;\n /** The responses can change: only while `interacting`. In every other state they are fixed or not shown. */\n readonly interactive: boolean;\n /** The item session is over: `closed`, or in `review` or `solution`, which come back to `closed`. */\n readonly done: boolean;\n /**\n * The candidate may end the attempt now: the item is `interacting` in a part with individual\n * submission, and `maySubmit` holds.\n */\n readonly mayEndAttempt: boolean;\n /**\n * The responses may be submitted as they are: `allow-skipping=\"false\"` refuses an item with no\n * response, `validate-responses` an invalid one. Two separate rules, both for individual\n * submission only (§7.19).\n */\n readonly maySubmit: boolean;\n /** Submitting no response is allowed: `allow-skipping`, or a response given, or simultaneous submission. */\n readonly maySkip: boolean;\n /**\n * Feedback, modal and integrated, may show: always while attempts are left, after the last\n * attempt only with `show-feedback`. In `review`, an adaptive item with `allow-review` shows its\n * feedback whatever `show-feedback` says (§7.19, `allow-review`).\n */\n readonly mayShowFeedback: boolean;\n /**\n * The item session may enter `review` now: it is `closed`, with `allow-review`. False in `review`\n * itself; whether review shows is the state.\n */\n readonly mayBeginReview: boolean;\n /**\n * The item session may enter `solution`, which shows the correct responses: it is `closed`, with\n * `show-solution`. False in `solution` itself; whether the solution shows is the state.\n */\n readonly mayBeginSolution: boolean;\n}\n\n/** What the rules of one item session are read from: its lifecycle input, its state and its responses. */\nexport interface ItemRulesInput extends Omit<ItemLifecycleInput, 'sessionControl'> {\n /** The item-ref's resolved session control (`ItemRefModel.sessionControl`). */\n sessionControl: Omit<SessionControl, 'allowComment'>;\n /** The item session's lifecycle state. */\n state: ItemLifecycleState;\n /**\n * The candidate gave no response: every response variable holds its default or NULL. False for an\n * item with no response variables, which \"by definition cannot be skipped\" (§7.19).\n */\n skipped: boolean;\n /** Every interaction's response satisfies its constraints (the item's `valid`). */\n valid: boolean;\n}\n\n/** The rules of one item session. Pure: the same input gives the same answers on every runtime. */\nexport function itemRules(input: ItemRulesInput): ItemRules {\n const { state, sessionControl, adaptive } = input;\n const guards = itemLifecycleGuards(input);\n const individual = guards.individualSubmission;\n const maySkip = !individual || sessionControl.allowSkipping || !input.skipped;\n const maySubmit = maySkip && (!individual || !sessionControl.validateResponses || input.valid);\n return {\n attemptsLeft: guards.attemptsLeft,\n attemptsUsed: !guards.attemptsLeft,\n interactive: state === 'interacting',\n done: state === 'closed' || state === 'review' || state === 'solution',\n mayEndAttempt: maySubmit && transition(state, 'endAttempt', guards) !== null,\n maySubmit,\n maySkip,\n mayShowFeedback:\n guards.attemptsLeft ||\n sessionControl.showFeedback ||\n (state === 'review' && adaptive && sessionControl.allowReview),\n mayBeginReview: transition(state, 'beginReview', guards) !== null,\n mayBeginSolution: transition(state, 'beginSolution', guards) !== null\n };\n}\n\n/** Where the candidate is in a part, for its navigation answers. */\nexport interface NavigationRulesInput {\n navigationMode: TestPartModel['navigationMode'];\n submissionMode: TestPartModel['submissionMode'];\n /** The current item's position among the part's items in order, from 0; -1 when none is current. */\n index: number;\n /** The number of items in the part. */\n count: number;\n /** The rules of the current item. */\n current: Pick<ItemRules, 'maySubmit' | 'interactive'>;\n}\n\n/** Whether the candidate may move to the next or the previous item of a part. */\nexport interface NavigationRules {\n /**\n * There is a next item and, in a linear part with individual submission, the current item may be\n * left: Next ends an attempt that was not ended and closes the item (decided 2026-11-27), so its\n * responses must be ones the candidate may submit.\n */\n readonly mayGoNext: boolean;\n /** There is a previous item, in a nonlinear part: a linear part never goes back (§4.1). */\n readonly mayGoPrevious: boolean;\n}\n\n/** The navigation answers of a part. Pure. */\nexport function navigationRules({\n navigationMode,\n submissionMode,\n index,\n count,\n current\n}: NavigationRulesInput): NavigationRules {\n const onItem = index >= 0 && index < count;\n const endsAttempt = navigationMode === 'linear' && submissionMode === 'individual' && current.interactive;\n return {\n mayGoNext: onItem && index < count - 1 && (!endsAttempt || current.maySubmit),\n mayGoPrevious: onItem && index > 0 && navigationMode === 'nonlinear'\n };\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qti-components/delivery",
3
3
  "description": "The QTI 3 delivery engine: test model, item session lifecycle, sequencing and session state, with no browser globals",
4
- "version": "0.1.0-next.4",
4
+ "version": "0.1.0-next.5",
5
5
  "author": "",
6
6
  "keywords": [
7
7
  "qti",