wai: wai generate and wai score, and the instruction object of wai.generate.spectral (form v0) #197
Loading…
Reference in a new issue
No description provided.
Delete branch "wai/generate-score-cli"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Native pins for generated pictures and scores.
wai generateandwai scoremake them with the reference code, and the payload ofwai.generate.spectralgets a byte layout. A browser sink that makes the same pieces can then check every byte against a pin made natively. No library source changes, so the pins bind the shared browser binding pages already load.wai.generate.spectral(SPEC §5, Payload ofwai.generate.spectral).model: the model file's SHA-256.prompt,seedandsteps.sizes: every size a sink may make."or\, so it needs no escape. Every value has a stated range. As a result, an envelope's content hash names the instructions.modelis its identity. An envelope that names the generator, as capability, fallback orWAI2component, carries noprior, and a sink refuses one that does, even a pin over the very filemodelnames. §3.1 says so beside the pin rules, and prior-carriage §7's row says the set is never pinned. No library source changes.create, and onlycreate. A generator has no source to replicate or improve. An envelope that names the generator with any other intent is non-conforming, andwai wraprefusesreplicate,improve, an open string or the empty string over it, as capability or as fallback.wai generate(featuregenerate):{w, h, bytes, sha256};--instrmakes a listed size from an object, reading the object as a sink does;--write-instrwrites the canonical object.wai score build | render(featurescore):buildwrites aWSCRfrom integer note fields only (score §2.3). A fraction, an unknown member, a member given twice or a cut release is refused.renderprintssamples,pcm_sha256,mixdown_blake3andscore_hash, and--pcmwrites the samples. It refuses a contract of more than one channel or of another numeric profile, asbuilddoes.WSCRthat declares more notes than its bytes hold is refused before the reader reserves room for them.wai wraprefuses awai.generate.spectralpayload, as capability or as fallback, that is not a form-v0 object, and any intent butcreateover it. This applies in every build.wai inspectandwai unwrapreport every envelope orWAI2component that names the generator: its payload (form v0, with the reader's reason), its intent and any pin, ✓ or ✗.wai generate --instr,wai wrap,inspectandunwraprefuse an object with the code of the first rule it breaks (not_canonical,prompt_byte,seed_range,member_repeated, …). A member given twice is refused as such: JSON is read with every object's members distinct.tests/vectors/generate/sizes.json: the committed prompt at 256×128 and 640×320.tests/vectors/generate/instr-v0.json: the object and the SHA-256 at each of its four listed sizes; twelve objects at the inclusive bounds of form v0, which a sink accepts, each with the SHA-256 of its first listed size (seed 0 and 2³² − 1, steps 1 and 64, an empty prompt, 256 bytes, 0x20 and 0x7E, JSON's structural characters, a side of 1, a side of 4096 and 2²³ pixels, 16 sizes, the w-then-h order); and 36 objects a sink refuses, each with the rule the reference reader finds broken first.score-conformance/expected_hashes.json: gainspcm_sha256for every vector.score-conformance/notes/<name>.json: the authoring form, whichwai score buildturns back into the committedWSCRbyte for byte.wai_score_vectors verifychecks all of these.waiwithgenerate,scoreand runtests/cli_generate_score.rs, which asserts each refusal's reason and makes and wraps every accepted object;tests/generate.rsholds the same lists to a second, independent statement of form v0. The two larger listed sizes run in the release step only, because they take seconds each in a debug build.wai-web/demo/verify_generate_wasm.mjs: the browser binding'sgenerateSpectralat every pinned size (sizes.json, instr-v0.json's object and every accepted object) andScoreSinkover every score vector give the SHA-256 the native tools wrote. It now also triggers onwai/score-conformance/.Pins (RGB8 SHA-256; prompt
a calm spectral horizon, seed 7, steps 4, modelsha256:963ee634…1504f9e):c0650ea4419bf6ba6697c7ccbe936bd2dc4c87ebb76ef781ea8175c59b1aad5d6c7eabbc826affc752394fa67bf74e135331664d53edf13a4f6eabb9b1f8070454bc40567935a8b264d1836bd94439623b233c3551b535ea54960f35327e5bf2909aa2d54cc1ab3a98912b173e5b031c8634a794b9ad58f0526a543b4cb7acc8763e9f672810db934d8c492db77230d6d1e7ab1375c6ff1f076222fa4dfcc83aScore
pcm_sha256:dc3c7ef8…5a025fc4e9c4e9…8f79b7b8dc096c…d80554Every value above was made natively, and each equals what the shared browser binding computes for the same input.
Review round 2 (nine commits on
3770d1ab): the pin relation, the intent rule,inspect/unwrapfindings, accepted objects at every bound with reasons for every refusal, the wasm32 pin check, the REGISTRY note,score rendercontract checks, duplicate members refused, the note-count test reaching the guard it names, and a scratch-file race between two concurrent tests. Each falsified where a test guards it:not_canonical, notprompt_byte), andstepscapped at 63 (the accepted list fails);improvewritten);inspect/unwrap;score render's contract checks disabled (a two-channel contract rendered);serde_json(a repeatedstartbuilds);verify_generate_wasm.mjsfails on it).Checked locally on macOS arm64, at
4c09bea7:pcm_sha256and the notes files;cli_generate_score(14 passed, 1 ignored: the large sizes) andgenerate(4 passed, 1 ignored);wai-webwasm32 and the neural gates.cli_generate_score15 passed;generate5 passed (the large sizes among them).cli_wrap_intentwithout features: 9 passed.verify_generate_wasm.mjson a wasm32 node build of this tree: 35 checks pass.wandhswapped inwai generate;pcm_sha256and a drifted notes file (verifyreports each);git diff 248846f1 HEADis empty forsrc/generate.rs,src/score,src/worldandwai-web/src.mainalready; none is new.The forge CI runs on this pull request.
🤖 Generated with Claude Code
wai generateandwai score build|render, with native pins a sink checks against a220d16a48Form v0 names the model inside the payload by the SHA-256 of one file, and SPEC §5 never said how that relates to §3.1's parameter-set pin, which governs every GenerativeDeterministic capability: whether a generate envelope carries a pin, or which wins when a pin and `model` disagree. The library registers the set as several files, so a form-less pin over the very file `model` names would be refused form_required. SPEC §5 now states the relation: the model file is the parameter set and `model` its identity; an envelope that names the generator carries no `prior` and a sink refuses one that does, whatever it names. §3.1 says so beside the pin rules, the non-conforming list names it, and prior-carriage §7's row says the set is never pinned and names the file. No library source changes. `wai inspect` and `wai unwrap` reported a generate envelope with a corrupt payload as conforming ("component roles ✓", no payload line). They now report the payload (form v0, with the reader's reason), the intent and any pin of every envelope or WAI2 component that names the generator, ✓ or ✗; inspect's verdict says the envelope does not conform. inspect_and_unwrap_report_the_generators_envelope covers a prompt byte changed in place, the intent improve, a pin over the model file itself, and a WAI2 component with and without a pin. Co-Authored-By: Claude Opus 5.5 <[email protected]>