Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,15 @@ packages/author/ @missing-elements/h5p-author — a playable .h5p of an
Scenario's paths, Game Map's stages, Find the Hotspot's areas
lib/text.mjs, translate.mjs, media.mjs, pack.mjs, schema.mjs, quiz.mjs text as H5P stores it; the
libraries' translations; files and web addresses; the pinned pack read
by part; the field list a source is written from; the skill's quiz format
by part; the field list a source is written from; the first skill's
quiz format, still built
scripts/ sync-skill.mjs writes the skill's type files' generated sections from the
pack (`pnpm --filter @missing-elements/h5p-author sync:skill`);
check-pack-published.mjs, the publish guard for the pinned pack
tests/ node tests: the generator, text and translations, layouts and schema,
builds with media from disk and a local server, the command;
package-types.ts as for the normalizer
builds with media from disk and a local server, the command, the quiz
format; fixtures/ the quiz format's two examples, which apps/skills
plays too; package-types.ts as for the normalizer
types/ generated, not in git: the declarations

packages/cmi5/ @missing-elements/h5p-cmi5 — cmi5 for the element, published as a library
Expand Down Expand Up @@ -310,9 +312,10 @@ apps/skills/ the skills' test project, a project of the kind a skil
tests/author-verify.test.ts every h5p-author type file's example built, with sample media, and
played trusted and untrusted through the verifier's published API, each
a pass with no warnings; each file's generated section compared with
the pack's, so a pack refresh shows a change; and the quiz format: both
kinds, the eight-scenario example, a quiz in Ukrainian and one whose
titles and author carry quotes and markup
the pack's, so a pack refresh shows a change; and the quiz format, from
the author package's fixtures: both kinds, the eight-scenario example,
a quiz in Ukrainian and one whose titles and author carry quotes and
markup
tests/author-playback.test.ts the eight-scenario example in the verifier's preview, the review the
skill hands a person, trusted and untrusted: every question's feedback,
75% failing and 83.3% passing an 80% threshold, retry to 100%, and only
Expand Down Expand Up @@ -1958,10 +1961,15 @@ owner's design: the content type chosen with the user first, a file per type in
skill so no agent works out how a type is built, a short skill, one package for the whole pack. It
replaced the skill's bundled `scripts/build-quiz.mjs`, which built Multiple Choice and Question Set
alone, and its quiz format stays a source the build takes (`lib/quiz.mjs` maps it), so nothing
written in it broke. Measured on a five-question quiz, at four characters a token: `content.json`
was about 3,470 tokens to write by hand, after reading 3,900 to 9,500 of a type's semantics; the
source is 1,000 to 1,800 tokens, written from a type file of 200 to 3,000. Seven things the code
does not say by itself:
written in it broke. The skill stopped describing it on 2026-11-01 (#102), when an agent given a
quiz was found reading both it and the two type files: every type is written from its type file,
a quiz from H5P.QuestionSet's and H5P.MultiChoice's, and the format's two examples are the tests'
fixtures. The skill runs the verifier once, trusted (the owner's call, the same day): the build
already holds text to the content check's rules, from the pack an untrusted check plays, and
`apps/skills` plays every example untrusted too. Measured on a five-question quiz, at four
characters a token: `content.json` was about 3,470 tokens to write by hand, after reading 3,900 to
9,500 of a type's semantics; the source is 1,000 to 1,800 tokens, written from a type file of 200
to 3,000. Seven things the code does not say by itself:

- **One generator, two ways to run it.** `ContentGenerator` was the sweep's
(`apps/demo/scripts/lib/sweep-content.mjs`), and moved here so there is one copy; the sweep runs
Expand Down
7 changes: 4 additions & 3 deletions apps/skills/tests/author-playback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import { buildPackage } from '@missing-elements/h5p-author'
const project = resolve(import.meta.dirname, '..')
// The pack this project installed, named to the preview as `--libraries` names a copy of its parts.
const parts = resolve(project, 'node_modules/@missing-elements/h5p-libraries/parts')
/** The skill's quiz format, as the scenario example writes it. */
/** The quiz format the skill first wrote, as the scenario example writes it. */
type Quiz = {
kind: string, passPercentage?: number, passedFeedback?: string, failedFeedback?: string,
questions: { title?: string, prompt: string, multipleAnswers?: boolean, answers: { text: string, correct: boolean, feedback?: string }[] }[]
}
const source: Quiz = JSON.parse(await readFile(resolve(project, '../../skills/h5p-author/assets/phishing-scenarios.json'), 'utf8'))
const example: Quiz = JSON.parse(await readFile(resolve(project, '../../skills/h5p-author/assets/quiz.json'), 'utf8'))
const fixtures = resolve(project, '../../packages/author/tests/fixtures')
const source: Quiz = JSON.parse(await readFile(join(fixtures, 'phishing-scenarios.json'), 'utf8'))
const example: Quiz = JSON.parse(await readFile(join(fixtures, 'quiz.json'), 'utf8'))
const single: Quiz = { ...example, kind: 'multiple-choice', questions: [example.questions[0]] }
let dir: string
let file: string
Expand Down
14 changes: 9 additions & 5 deletions apps/skills/tests/author-verify.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest'
const project = resolve(import.meta.dirname, '..')
// The pack this project installed, named to the check as `--libraries` names a copy of its parts.
const parts = resolve(project, 'node_modules/@missing-elements/h5p-libraries/parts')
const skill = resolve(project, '../../skills/h5p-author')
const types = join(skill, 'references/types')
const example = JSON.parse(await readFile(join(skill, 'assets/quiz.json'), 'utf8'))
const scenarios = JSON.parse(await readFile(join(skill, 'assets/phishing-scenarios.json'), 'utf8'))
const types = resolve(project, '../../skills/h5p-author/references/types')
// The quiz format's two examples, which the author package's tests keep.
const fixtures = resolve(project, '../../packages/author/tests/fixtures')
const example = JSON.parse(await readFile(join(fixtures, 'quiz.json'), 'utf8'))
const scenarios = JSON.parse(await readFile(join(fixtures, 'phishing-scenarios.json'), 'utf8'))
const META = { title: 'Example', language: 'en', license: 'CC BY', authors: [{ name: 'Ann Author', role: 'Author' }] }
const files = (await readdir(types)).filter((name) => name.endsWith('.md')).sort()
let dir: string
Expand Down Expand Up @@ -88,7 +89,10 @@ beforeAll(async () => {
})
afterAll(async () => { if (dir) await rm(dir, { recursive: true, force: true }) })

/** Step 4 of the skill: the check, through the verifier's published API, trusted and untrusted. */
/**
* Step 4 of the skill, the check, through the verifier's published API: trusted, as the skill
* runs it, and untrusted, which holds the build to the content check's rules.
*/
async function playsBothWays(file: string) {
for (const untrusted of [false, true]) {
const report = await verifyPackage({ file, untrusted, libraries: untrusted ? parts : undefined, settle: 500 })
Expand Down
7 changes: 4 additions & 3 deletions packages/author/tests/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import { MediaStore } from '../lib/media.mjs'
import { quizProblems } from '../lib/quiz.mjs'
import { jpeg, mp4, png } from './helpers/media'

const skill = resolve(import.meta.dirname, '../../../skills/h5p-author')
// The quiz format's two examples, from the skill that first wrote it.
const fixtures = resolve(import.meta.dirname, 'fixtures')
const parts = resolve(import.meta.dirname, '../../libraries/parts')
const bin = resolve(import.meta.dirname, '../bin/h5p-author.mjs')
const example = JSON.parse(await readFile(join(skill, 'assets/quiz.json'), 'utf8'))
const scenarios = JSON.parse(await readFile(join(skill, 'assets/phishing-scenarios.json'), 'utf8'))
const example = JSON.parse(await readFile(join(fixtures, 'quiz.json'), 'utf8'))
const scenarios = JSON.parse(await readFile(join(fixtures, 'phishing-scenarios.json'), 'utf8'))
const exec = promisify(execFile)
const META = { title: 'Rivers', language: 'en', license: 'CC BY', authors: [{ name: 'Ann Author', role: 'Author' }] }
let dir: string
Expand Down
2 changes: 0 additions & 2 deletions skills/h5p-author/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ content holds have files too: H5P.AdvancedText, H5P.Image, H5P.Video, H5P.Text.
- A file is `{ "path": "photo.jpg" }`, beside the source or a web address, with `copyright`
when known.
- Sub-content is `{ "library": "H5P.MultiChoice", "params": { … }, "metadata": { "title": "…" } }`.
- A quiz of Multiple Choice questions alone is shorter in [the quiz format](./references/quiz-format.md),
which the build also takes.

## 3. Build

Expand Down
3 changes: 0 additions & 3 deletions skills/h5p-author/references/authoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ Use what the user already gave. Ask for what is missing and matters:
- A pass mark with its messages: the failed one says what to do next.
- Alternative text for every picture that carries meaning: what it shows, for a learner who
cannot see it.
- For a quiz with a pass mark and mixed answer modes, [the eight-scenario brief](./scenario-quiz.md)
and [its source](../assets/phishing-scenarios.json) show the whole of it: answer key,
explanatory feedback, an 80% threshold, and the fail, retry and pass checks.

## Media

Expand Down
65 changes: 0 additions & 65 deletions skills/h5p-author/references/quiz-format.md

This file was deleted.

87 changes: 0 additions & 87 deletions skills/h5p-author/references/scenario-quiz.md

This file was deleted.

Loading