Copy the skill's type files with a source's problems

Merged
AL
2h ago
+319-43

Closes #11.

Copy the problems for the chat now copies, after the problems, the h5p-author skill's type files of the source's own content type and of the libraries it names. A chat in a browser, such as Gemini in Chrome, has the skill's text and none of its files, so it guessed how a type is written and learned one level's names from each round of problems. With the files, the weakest Claude model wrote 42 of 46 sources right by its second reply, and 29 without them (h5p-offline-player#172).

The build page found 2 problems in the source. Fix them all and write the whole source again:
- params.chapters[0]: is the params of sub-content, without the sub-content around them: write params.chapters[0] as { "library": "H5P.Column", "params": { "content": … } }
- params.chapters[0].metadata.title: is required: the chapter's name in the table of contents

How these content types are written, from the h5p-author skill's type files:

# Interactive Book (H5P.InteractiveBook)
…

What changes

  • vite.config.ts: typeFiles() writes /h5p/build/types/<Type>.md and index.json from the pinned @missing-elements/h5p-author, which carries them since 0.7.0: 32 files, 106 kB. The folder is emptied before each build, like Vite's others.
  • build-source.ts: typesNamed(source) is the source's own type, then the libraries it names, in order, each once. forTheChat(problems, typeFiles) adds their files in the wording that was measured.
  • build-page.ts: the files are fetched when a source's problems are listed, so the copy is written within the button's press. Where they cannot be fetched, the problems are copied alone, and they are asked for again with the next problems. A line under the button says what the copy carries.
  • Pins: h5p-author 0.6.0 to 0.7.0, whose problems say what to write, and the player 1.5.1 to 1.6.0, the version 0.7.0 names, so the site keeps one copy of it. Its element and workers are 1.5.1's.
  • README: a section on the type files.

Tested

  • pnpm build and pnpm e2e: 11 pass, 7 before. New: the copy for one content type; for a book that names three libraries, one twice and one with no file; a type the pack does not have; a fetch that fails, then works; files that arrive after newer problems are shown; the served files against the package's. Each of five mutations of the new code fails a test.
  • The page copies the text that was measured. The 39 sources that failed their first build in the test's two runs with the files were pasted into the built page: 38 copy byte for byte what the model had been given. The other is a Game Map, whose problems 0.7.0 words better than the build the test ran: 3, where it had 4.
  • The one difference from the test, tried on Haiku 5.5. The test gave the files with the first problems only. The page gives them with every copy, since it cannot know what the chat already has. One run of the test had a second round of problems: its first source named a type the pack does not have, so no file went with it. On the page, that second copy carries the right type's file, and from it Haiku's next source built, held what was asked for and plays (h5p-verify).

After merging

The bundles and the page build with h5p-author 0.7.0, and /h5p/bundles/index.json says so. _site grows by 0.1 MB.


Summary by cubic

Fixes the H5P build page so "Copy the problems for the chat" also copies the h5p-author skill's type files, which a browser chat like Gemini has no access to. In the measured run on the weakest Claude model (h5p-offline-player#172), 42 of 46 sources built right by the second reply, up from 29 without the files.

What changes

  • vite.config.ts writes /h5p/build/types/<Type>.md and index.json from the pinned @missing-elements/h5p-author 0.7.0, which has carried the files since that release.
  • The copy appends the type files of the source's own content type and the libraries it names, in order, each once, in the wording that was measured.
  • The page fetches the files when it lists the problems, so it can copy them within the button's press; when they cannot be fetched, the problems are copied alone.
  • Pins @missing-elements/h5p-author 0.6.0 to 0.7.0 and the offline-player to 1.6.0 (the version 0.7.0 names), and documents the type files in the README.

Closes #11.