@serene-pub/conformance 0.6.0-pr-1

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,17 @@
1
+ Serene Pub SDK
2
+ Copyright (c) 2025-2026 Jody Doolittle
3
+
4
+ This product includes software developed as part of the Serene Pub project
5
+ (https://github.com/doolijb/serene-pub).
6
+
7
+ The Serene Pub SDK is licensed under the Apache License, Version 2.0.
8
+
9
+ Note that the Serene Pub application itself is a separate work, licensed under
10
+ the GNU Affero General Public License v3.0. Building on this SDK does not place
11
+ your extension under the AGPL — that is the reason this SDK is licensed
12
+ permissively.
13
+
14
+ "Serene Pub" and the Serene Pub logo are trademarks of the project owner and are
15
+ not licensed by the Apache License (see Section 6). Their use is governed by the
16
+ project's trademark policy:
17
+ https://github.com/doolijb/serene-pub/blob/main/TRADEMARK.md
package/README.md ADDED
@@ -0,0 +1,187 @@
1
+ # `@serene-pub/conformance`
2
+
3
+ Thirty-three executable requirements a Serene Pub executor must satisfy. Run by SP Core against
4
+ its own implementation, and by any alternate host.
5
+
6
+ **Plugin authors need one part of it:** the six package cases (C28–C33, `conformPackage`) over
7
+ what `npm run package` built — see [A package's own artifact](#a-packages-own-artifact-c30c33).
8
+ The rest answer "does this host obey the laws?" — for "does my hook behave, and did my change
9
+ alter what gets sent?", use `@serene-pub/sdk/testing`.
10
+
11
+ Each requirement names what breaks when it fails, in user-visible terms, so a red result is
12
+ a bug report rather than a number.
13
+
14
+ ## The laws of 09-AMENDMENTS-B (C16–C20)
15
+
16
+ Added 2026-09-17 (plans/30 U7) for the five laws the amendments appended to the Fixed
17
+ Ledger — F37–F41, renumbered from the amendments' F35–F39 because 01 already held F35 and
18
+ F36.
19
+
20
+ | Id | Law | Holds that | What breaks when it fails |
21
+ | --- | --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
22
+ | C16 | F37 | **One live row.** (a) `validate()` refuses two `create-message` placeholders in one document (`fx.twoWrites()`) under F7, with a fix — that refusal is the law at publish; (b) a run of `fx.chatTurn()`, whose write opens the live row (`generating: true`), names that row to the host, once, and the world takes exactly one write; (c) the dry run of the same tells the host `dry`, names no real row (`undefined` or `dry:…`) and commits nothing. | The composer streams into the wrong row, two placeholders appear, Stop cannot tell which row to finalise. |
23
+ | C17 | F38 | **A preview writes nothing.** `dry: true` on `fx.chatTurn()`: every outlet runs, every recorded write is the synthetic `dry:<nodeKey>` id, the event a write causes is still recorded and flagged `dry` (never dropped, never dispatched), the host is told `dry`, and the world took zero writes. | A token estimate leaves a placeholder row behind every keystroke; a debug preview bills for rows nobody asked for. |
24
+ | C18 | F39 | **Settings never travel.** (a) `validate()` refuses a data edge from a node's `settings` address (`settings`, `settings.review`, …) and a hand-written config reference naming it (`{ __ref: 'slot', slot: 'settings', ofNode }`) under `F39` with a fix. (b) The write outlet's **declared** switch `settings.review` is set `on` through `world.overrides`, with a reviewer that approves: **positive control first** — the reviewer was asked for the owner at `on` (the owner received its own switch; a host ignoring overrides fails here) — then no other hook's ctx or input carries that switch at its value, and a sentinel planted beside it on the same slot reaches nobody; on the sound document and on each refused one run **unvalidated** (the executor resolves the reference to nothing and notes why on the row). The switch and the sentinel are the check; a ctx key that merely sounds like an accessor is a hint in the failure text, never a finding. | A plugin node silently depends on another node's review toggle; configs stop being independent. |
25
+ | C19 | F40 | **Every enabled action is reachable.** The host's own listing — `HostUnderTest.listActions(doc, channel)` — of `fx.actions()` (a quick one, a plain one, one on a named channel, one on a core verb's function): each action is listed exactly once in its venue, in the primary set iff `quick`, on its channel and not on `main` when declared for another, and every composer entry carries the slash name the host calls it by — in the grammar its spec may claim, the declared name when there is one, the derived name otherwise. Compared by `key` + `specId`, never by object. A host without the seam fails C19 by name. | An installed action is invisible with no way to reach it. |
26
+ | C20 | F41 | **The effects line.** A `world` action in a venue off the owner's side (a `widget`; a message's own ⋮ is the owner's since 2026-09-28, lair re-plan R11), and one whose `act` audience names `participant`, are each refused by `validate()` under `F41` — the label, not a word in the sentence — with a fix. | A character grants another character permission by construction. |
27
+
28
+ Three seams a host supplies, and what happens without each:
29
+
30
+ - **`Fixtures.writesSeen()`** — C16 and C17's write probe watches `RunOptions.host.commit`.
31
+ A host whose writes bypass that seam supplies a row count instead, and the checks read it
32
+ before and after each run. The probe is read first: a probe that saw the commit is never
33
+ shadowed by a row count it kept from moving (a host routing `ctx.commit` through
34
+ `RunOptions.host` hands the probe the write the database never gets). With neither
35
+ showing a write, C16 and C17 fail naming the gap rather than passing on a zero they could
36
+ not have observed — "the fixtures supply no writesSeen()" only when there is none.
37
+ - **`HostUnderTest.listActions(doc, channel)`** — the host's own venue projection, which
38
+ C19 judges entry by entry. The SDK's host builds it with `placeActions` over
39
+ `actionsOf(doc)`, each entry decorated with `slashNameOf`; core builds it from
40
+ `listSessionActions` (its `specSlug` is the entry's `specId`). Without it C19 fails by
41
+ name: the law is about what the host lists, and a listing the kit computed on the host's
42
+ behalf would pass any host.
43
+ - **A `run` that skips publish-time validation** — C18(b) runs the refused F39 documents
44
+ on purpose. A host whose `run` refuses them (its error carries F39/F7 findings, or
45
+ `assertValid`'s `[F39]` lines) is **not failed**: that half is recorded on the result as
46
+ `skipped`, with the reason, and `renderConformance` prints it as `~ not judged`. Read
47
+ those before calling a host conformant.
48
+
49
+ Two things the kit does **not** reach, and why:
50
+
51
+ - **The hook ctx per kind (plans/29 R-3)** was out of reach until C25: the kit's
52
+ `HostUnderTest` had no plugin surface to hand a hook. It now asks for one —
53
+ `hookCtxKeys(kind)`, the keys a handler the host dispatched found on its `ctx` — and the
54
+ host's own sandbox tests (in core, `SesWorkerSandbox.test.ts`, `QuickJsSandbox.test.ts`
55
+ and the install-time conformance probe) remain the proof for the kinds it cannot
56
+ dispatch; C25 names those rather than passing on them.
57
+
58
+ - **C20's third half** — a message block naming a `world` action — was likewise out of
59
+ reach, because a spec's `blocks` are a node's output and `validate()` does not inspect a
60
+ literal. C23 judges it where it is judged in the product: at the write, through
61
+ `worldBlockFunctions`, the same function the host runs.
62
+
63
+ ## The laws the showcase lanes hit (C21–C26)
64
+
65
+ Added 2026-09-17 (plans/genres §14 D-7) for the six laws Battleship, Twenty Questions, Lair
66
+ and Whodunit each designed around. Every one of them already held in code; none was on a
67
+ page an author reads, which is the failure this kit exists to prevent.
68
+
69
+ | Id | Law | Holds that | What breaks when it fails |
70
+ | --- | --- | ---------- | ------------------------- |
71
+ | C21 | F7, 01 §4 | **One live row per run, never inside a repeat, and no second message on its channel** (restated W1, 2026-09-23). (a) `validate()` refuses `fx.twoWrites()` — two reply rows — under F7 with a fix naming the alternatives: update the one row through its target, write anything else beside it, or put a second message on another channel. (b) `fx.writeInClause()` — the live row inside an `each` — is refused under 01 §4, with the spine named as where it goes instead. Other writes, in clauses or not, are unlimited. | One turn leaves two reply rows behind, or N of them from inside a repeat, and nothing can say which row to stream into or finalise. |
72
+ | C22 | F8, F32 | **No pipeline triggers another.** Four halves, because there are four doors: no published definition is a trigger outlet (the host's own registry is the evidence); `assertHookSurface` refuses `trigger`, `run` and `call` on a hook surface; any definition that names the event it causes from its config (`causesEventFrom`, as `record-event` does for a package's own events) is a write outlet; and `validate()` refuses a node declaring `emits` under F8, naming the one path — a write causes the event its outlet declares, and a preset binds a pipeline to that event. | Runs start runs. A model call nobody asked for appears on no receipt as anything's consequence, and a loop between two specs has no budget and no place to break it. |
73
+ | C23 | F41 | **The effects line at a block.** (a) At publish: `form` is the one venue a block reaches, so a `world` action declaring it is refused by `validate()` under F41. (b) At the write: `worldBlockFunctions(blocks, doc)` names any `world` action a `choices` block carries, and the host refuses the write. (b) is a runtime law **because no document carries a block tree** — a spec's blocks are a node's output — with a negative control, since a gate that refused every block would break every message that offers a choice. | A block a node wrote puts an out-of-fiction button in front of a character, and permission stops being the owner's to give. |
74
+ | C24 | R-15 | **Every genre can be addressed by a form, and every shipped preset binds the pipeline that answers one** (ruled 2026-09-17). Read off `HostUnderTest.shipped()`: each genre declares `core:event/form-addressed@1` and does not make it required, and each preset binds a spec to it. | A pipeline writes a form, the reader fills it in, the press reaches no run, and no error says why. |
75
+ | C25 | plans/29 R-3, F11, F32 | **The plugin grant table.** The table itself is pinned against `hookCtxGrants` — task and chain-link get neither grant, query/outlet/event/lifecycle get `storage`, the oracle gets `storage` and `fetch` — and then the host's own endowment is judged per kind through `hookCtxKeys(kind)`: the keys equal `hookCtxKeysFor(kind)`, and `read`, `call` and `commit` reach no plugin handler. The absent `commit` is also why **a plugin write-class outlet is not available**: it emits the event it declares and core's outlet does the writing (the packager refuses the declaration up front, `E_PLUGIN_WRITE_OUTLET`). | A package reaches through a door nobody granted, and the permissions an administrator reads stop describing what it can do. |
76
+ | C26 | 20 §12, F32 | **A frame has no ambient authority.** From `HostUnderTest.frameMount()`: the sandbox is `allow-scripts` and nothing else (no `allow-same-origin`, so an opaque origin; no `allow-forms`, so a submit does not leave), and the CSP names a `default-src` floor, `script-src 'self'` — no inline script, no script from anywhere else — `form-action 'none'`, no `'unsafe-eval'` and no `'unsafe-inline'` outside `style-src`, and no off-origin source outside `connect-src` (which carries only the hosts the package declared) and the reporting directives. Supplied `accepts`, the port answers an action-firing message and nothing that commits. | A package's UI reads the session's cookies, calls the app's API as the signed-in user, or posts to an origin nobody granted. |
77
+
78
+ Five more seams a host supplies, all optional, none failing in silence:
79
+ `Fixtures.writeInClause()` and `Fixtures.worldAction()` (the documents C21 and C23 need, and
80
+ a `world` action in the `form` venue among `invalid()` for C23's publish half),
81
+ `HostUnderTest.shipped()`, `HostUnderTest.hookCtxKeys(kind)` and
82
+ `HostUnderTest.frameMount()`. A host that omits one is **skipped on that half, with the
83
+ fixture or seam named** — the same discipline as `writesSeen()` and `listActions()`: a check
84
+ the kit could compute on the host's behalf would pass any host.
85
+
86
+ ## One verdict per law (C27)
87
+
88
+ Added 2026-09-17 (plans/31 V4) for the constitutional law 01 §13: *a rule has exactly one
89
+ verdict function; every door calls it and quotes its sentence; a door that re-derives a rule
90
+ is a defect.* The SDK registers its verdicts with `defineVerdict` and enumerates them with
91
+ `verdicts()`; seven are registered today — display text (R-20), enablement (U5e), audience
92
+ (R-15), the effects line (F41), form staleness (U5f), settings never travel (F39) and
93
+ provisional definitions (R-2).
94
+
95
+ | Id | Law | Holds that | What breaks when it fails |
96
+ | --- | --- | ---------- | ------------------------- |
97
+ | C27 | 01 §13 | **Every verdict is heard at every door it declares.** For each registered verdict and each door it declares, the kit feeds `failing(door)` through the host's own door — `HostUnderTest.doors[door](verdictId, input)`, which drives the real door and answers what it refused with — and holds the answer to contain `judge(failing).sentence` (the en text) verbatim. A door may frame the sentence (a node key before it, several findings under one heading, the fix after it) but never reword it. A host without the seam is skipped naming it; a door the host lacks is skipped per verdict. | A person meets a different refusal depending on which door they came through, and a rule fixed at one door stays broken at the rest. |
98
+
99
+ The SDK's own host answers `construction`, `validate`, `registry` and `run`; the doors only a
100
+ product has — `publish`, `fire`, `write`, `list` — are the app host's to supply (plans/31 V5).
101
+
102
+ ## The event map (C28, C29)
103
+
104
+ Added 2026-09-24 (PLAN-turn-order §B3). Both laws are judged by SDK functions a host's own boot
105
+ check also calls (`uncausedGenreEvents`, `unterminatedCycles`), so the kit and the host cannot
106
+ disagree about what they mean.
107
+
108
+ | Id | Law | Holds that | What breaks when it fails |
109
+ | --- | --- | ---------- | ------------------------- |
110
+ | C28 | §B3, R33 | **Every event a shipped genre lists is caused by a write or is a declared root.** Read off `HostUnderTest.shipped()`. A declared root (`declaredRoot: true` on the event) starts outside every pipeline: `session-created`, `message-respond`, `session-action`, `member-added`, `member-removed`, `cast-changed`, `session-updated`. | A preset binds a pipeline to an event nothing ever fires, and nothing says so. |
111
+ | C29 | §B3, §3.2 | **Every loop in a genre's event map passes through a node with a termination policy.** Read off `HostUnderTest.eventMap(genre)`: the host's own map plus a termination policy per node — auto-advance's cause rule and cap, or the run caps that park a run tree, stated on the node where they actually bind (an event the host dispatches as a child of its run). A host without the seam is skipped, naming it. | One event starts a loop nothing stops: runs pile up and a model is called without end. |
112
+
113
+ ## A package's own artifact (C30–C33)
114
+
115
+ C30 added 2026-09-24 (PLAN-sdk-1.0 §3.5); C31–C33 added 2026-09-26, from the gaps the Twenty
116
+ Questions plugin hit running the kit over its own build.
117
+
118
+ | Id | Law | Holds that | What breaks when it fails |
119
+ | --- | --- | ---------- | ------------------------- |
120
+ | C30 | §3.5, R23 | **A component is judged, mounted and mirrored the way the page runs it.** Every module `components()` lists passes `componentModuleFindings` (advisories become notes); the kit's own fixture round-trips through `mountComponent` (a push reaches it, a click comes back as an `invoke`, a `<script>` is refused and said); and `componentParity()`'s native/remote pair renders the same rows, streams a reply the same way and edits through the same `edit` verb. The edit is driven **the way the widget exposes it**: the row's field is the page's `sp-composer-field` (core's `MessageComposer`), typed into by raising the field's own `input` event through `ComponentView.dispatch`; a clone that swapped in a plain `textarea` is typed into as one. | A widget that looks alive and does nothing; a clone whose cutover changes what people see. |
121
+ | C31 | §3.5, 20 §12 | **Every built component mounts in a plugin's box with nothing refused, no error, and unmounts cleanly.** Each module `components()` lists is mounted through `mountComponent(code, sections, { grants })` — its own `grants` and `sections`, else `componentParitySections()` — and holds `refused == []`, `errors == []` (`ComponentView.errors`), and an `unmount()` that neither throws nor raises. An empty box is a note. | A widget installs and shows an empty box: the page dropped what it placed (an unedited clone of core's messages widget places core's `sp-host-view`s), or it raised an error nobody reads. |
122
+ | C32 | R28, R29, R53 | **Every swap a package offers fits the node it stands in for.** For each of `swaps()`: the package declares the definition, the host seats something at `pinnedDefinition(spec, node)`, and `swapFitFinding` finds nothing. | A person picks the option and the node it replaced stops computing. |
123
+ | C33 | F11, 13 §7h | **Every definition a swap seats passes the binding probes** (B1–B5 of `@serene-pub/sdk/testing`: a discriminated result, no services for a Task, randomness from the seed only, it settles, it honours abort), over `nodeHandler(id)`, with input from `PROBE_SAMPLES` by in-port shape or the host's `probeInput(d)`. A definition reading a shape with no sample is skipped with the shapes named. | A strategy that returns a bare value, rolls `Math.random`, hangs, or ignores an admin's abort. |
124
+
125
+ The seams, all optional, none failing in silence: `components()` (each `{ id, code, grants?,
126
+ sections? }`), `mountComponent(code, sections, opts?)`, `componentParity()`, `swaps()`,
127
+ `pinnedDefinition(spec, node)`, `nodeHandler(definitionId)`, `probeInput(d)`; and on a
128
+ `ComponentView`, `dispatch`, `errors` and `settle` (the SDK harness's `mountComponent` has all
129
+ three).
130
+
131
+ ### Running the package cases over a build
132
+
133
+ The helpers read the artifact the way an instance reads it at install — never the source:
134
+
135
+ - **`manifestSeams(manifest, bundle?)`** → `shipped`, `swaps`, `nodeHandler` off a parsed
136
+ `manifest.json` and the handler bundle's code.
137
+ - **`definitionFromManifest(entry)`** — a `nodeDefinitions[]` entry back as its descriptor.
138
+ The compiled manifest **already records full port shapes**: `declaration` is the descriptor
139
+ verbatim (D-6b); the entry's top-level `ports`/`slots` stay the names-only audit summary,
140
+ which an admin's screen and the install check key on, so they are not changed. An entry
141
+ with no declaration (packaged before D-6b) is refused with "re-package".
142
+ - **`swapsFromManifest`**, **`hooksFromBundle(code)`** (evaluates the self-contained CommonJS
143
+ bundle with a `require` that refuses — a test's evaluation, not the host's isolation),
144
+ **`pinnedDefinitionIn(doc, node)`** (the definition a compiled spec seats, from the
145
+ registry), **`componentParitySections()`** (the sections the parity contract names).
146
+ - **`conformPackage(host, only?)`** runs `PACKAGE_REQUIREMENTS` (C28–C33) with no fixtures;
147
+ `conform(host, fx, { only })` runs any subset.
148
+
149
+ ```ts
150
+ import { conformPackage, manifestSeams, pinnedDefinitionIn, renderConformance } from '@serene-pub/conformance'
151
+ import { mountComponent } from '@serene-pub/cli/testing'
152
+ import { coreSpec } from '@serene-pub/core-catalog'
153
+
154
+ const host = {
155
+ name: `${manifest.slug} (built)`,
156
+ validate, run, replay, canonicalHash, importDocument, // the SDK's reference executor
157
+ ...manifestSeams(manifest, bundleCode),
158
+ pinnedDefinition: (spec, node) => pinnedDefinitionIn(coreSpec(spec)?.build(), node),
159
+ components: async () => manifest.components.map((c) => ({ id: c.slug, code: codeOf(c), grants: ['session:full'] })),
160
+ mountComponent: (code, sections, opts) => mountComponent({ root, entry: writeAside(code), context: sections, ...opts }),
161
+ }
162
+ const results = await conformPackage(host)
163
+ console.log(renderConformance(results))
164
+ ```
165
+
166
+ C29 stays "not judged" outside the app: the event map is drawn from every installed package
167
+ and core's listeners, and a map a package drew itself would pass any package.
168
+
169
+ ## Running it
170
+
171
+ ```
172
+ SHOW_CONFORMANCE=1 npx tsx --test sdk-tests/conformance.test.ts
173
+ ```
174
+
175
+ `sdk-tests/conformance.test.ts` builds the fixtures with `spec(...)` and runs the kit
176
+ against the SDK's own executor; `95c` there proves each new law fails on a **broken host**
177
+ — one that names a stranger's row, drops a dry write's event, ignores `world.overrides`,
178
+ hands the owner's declared switches through a ctx, resolves a settings edge to a value,
179
+ lists an action twice, puts a `phone` action on `main`, calls a plugin's action by a bare
180
+ slash name, or mislabels the effects line — with a sentence naming the shape. `95d` does the same for
181
+ C21–C26: a validator that lost 01 §4 or F8, a catalogue whose genre cannot be addressed by a
182
+ form, a task handed `storage`, an outlet handed `commit`, a frame mounted with
183
+ `allow-same-origin` or served `'unsafe-inline'`. `95e` does it for C27: a host whose
184
+ `validate` door paraphrases the display-text sentence goes red naming the verdict and the door.
185
+ `sdk-tests/packageConformance.test.ts` runs C30's parity half on core's messages widget
186
+ against a clone compiled from its `source.json`, and C31–C33 over a manifest the compiler's own
187
+ projection wrote — each passing, and each failing on the shape it exists to catch.
@@ -0,0 +1,93 @@
1
+ /**
2
+ * A mounted component, as a host shows it to the kit — the page's mirrored
3
+ * DOM and the host's record of what the component asked for. The SDK's
4
+ * harness (`@serene-pub/cli/testing` `mountComponent`) is one; a host's own
5
+ * mount (a native widget in a test DOM) is another.
6
+ * @experimental
7
+ */
8
+ export interface ComponentView {
9
+ /** The mirrored markup, as the page holds it. */
10
+ html(): string;
11
+ /** Every element matching `selector`, in document order. */
12
+ queryAll(selector: string): Element[];
13
+ /** Push one section, as the page does when it changes. */
14
+ push(section: string, value: unknown): Promise<void>;
15
+ /** Click an element: by selector, or the element itself (one `queryAll` returned). */
16
+ click(target: string | Element): Promise<void>;
17
+ input(selector: string, value: string): Promise<void>;
18
+ /** Every `invoke` the component made, in order. */
19
+ readonly invoked: Array<{
20
+ key: string;
21
+ messageId?: number;
22
+ payload?: Record<string, unknown>;
23
+ }>;
24
+ /** What the vocabulary refused (an element, an attribute, a value). */
25
+ readonly refused: string[];
26
+ /**
27
+ * Raise an `sp-*` element's own event (`input`, `submit`, `key`, …) with
28
+ * its declared detail, as the page raises it — by selector, or the element
29
+ * itself. How a case drives a field the page owns (`sp-composer-field`):
30
+ * a remote hears that field's events, never a DOM `input` on a textarea
31
+ * it does not have. Optional; a case that needs it fails naming it.
32
+ */
33
+ dispatch?(target: string | Element, type: string, detail?: unknown): Promise<void>;
34
+ /** Every `ctx.error` the component raised, in order. Optional; C31 needs it. */
35
+ readonly errors?: ReadonlyArray<{
36
+ message: string;
37
+ fatal: boolean;
38
+ }>;
39
+ /** Wait until the component has done everything it was prompted to. Optional. */
40
+ settle?(): Promise<void>;
41
+ unmount(): Promise<void>;
42
+ }
43
+ /**
44
+ * The kit's own component, already built: plain ES, no imports — the
45
+ * protocol with nothing else in the way. It counts the messages it is
46
+ * pushed, continues on a click, and tries one element no page takes.
47
+ * @experimental
48
+ */
49
+ export declare const COMPONENT_PROTOCOL_FIXTURE = "export default (root, ctx) => {\n\tconst count = document.createElement('p')\n\tcount.setAttribute('class', 'kit-count')\n\tconst go = document.createElement('button')\n\tgo.setAttribute('type', 'button')\n\tgo.setAttribute('class', 'kit-go')\n\tgo.textContent = 'Continue'\n\tgo.addEventListener('click', () => ctx.invoke('advance'))\n\tconst sneaky = document.createElement('script')\n\tsneaky.textContent = 'globalThis.kitRan = true'\n\troot.append(count, go, sneaky)\n\tconst draw = () => { count.textContent = String((ctx.messages ?? []).length) }\n\tdraw()\n\treturn ctx.subscribe(draw)\n}\n";
50
+ /** @experimental The built module's own findings: its errors fail it; its advisories are said. */
51
+ export declare function judgeComponentModule(id: string, code: string): string[];
52
+ /** @experimental The protocol round trip, over a view of the fixture a host mounted. */
53
+ export declare function componentProtocolCase(view: ComponentView): Promise<void>;
54
+ /**
55
+ * Parity between a messages widget's native copy and a remote built from the
56
+ * same source: the same rows render the same bodies, a streamed reply is
57
+ * followed the same way, and an edit reaches the host as the same `edit`
58
+ * verb. Both views are mounted by the caller with the same sections (two
59
+ * rows, ids 1 and 2, and a listed `edit`), in the core messages widget's
60
+ * contract: rows are the part `messages.message`
61
+ * (`[data-widget-part~="messages.message"]`), a row's text is its `sp-message-body text`,
62
+ * a row's quick Edit is `button[aria-label="Edit"]`, its edit field is the
63
+ * page's field inside the row — `sp-composer-field`, which core's
64
+ * `MessageComposer` places and a remote drives through the field's own
65
+ * `input` event (`ComponentView.dispatch`), or a plain `textarea` a clone
66
+ * may have swapped in — and Save is the row's button reading "Save".
67
+ * `componentParitySections()` is those sections.
68
+ * @experimental
69
+ */
70
+ export declare function componentParityCase(native: ComponentView, remote: ComponentView): Promise<void>;
71
+ /**
72
+ * The sections the parity case's contract names, as a page pushes them to a
73
+ * messages widget: a session, two rows (ids 1 and 2 — a person's, then a
74
+ * character's), core's listed `edit` as a quick message action, a viewer,
75
+ * and the `session_full` dossier core's widget reads its lines, its
76
+ * composer and its turn from (row 3 is the reply the case streams in). Mount
77
+ * a native copy and its remote each with a fresh call — C31 mounts every
78
+ * module with these unless the host names its own.
79
+ * @experimental
80
+ */
81
+ export declare function componentParitySections(): Record<string, unknown>;
82
+ /**
83
+ * A package's own built module, mounted by the host in a plugin's box (C31):
84
+ * it mounts (the host's `mountComponent` resolved — the harness waits for
85
+ * the component's ready), the guarded connection refused nothing it placed,
86
+ * it raised no `ctx.error`, and it unmounts without throwing or raising one.
87
+ * Behaviour is the package's own component tests'; this is the floor a
88
+ * module must clear before any behaviour is worth asking about. Returns
89
+ * advisories (an empty box).
90
+ * @experimental
91
+ */
92
+ export declare function componentMountCase(id: string, view: ComponentView): Promise<string[]>;
93
+ //# sourceMappingURL=components.d.ts.map