@serene-pub/conformance 0.6.0-pr-4 → 0.6.0-pr-6
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/README.md +83 -14
- package/dist/components.js +2 -2
- package/dist/index.d.ts +57 -29
- package/dist/index.js +292 -10
- package/dist/packages.d.ts +3 -3
- package/dist/packages.js +6 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@serene-pub/conformance`
|
|
2
2
|
|
|
3
|
-
Thirty-
|
|
3
|
+
Thirty-seven executable requirements a Serene Pub executor must satisfy. Run by SP Core against
|
|
4
4
|
its own implementation, and by any alternate host.
|
|
5
5
|
|
|
6
6
|
**Plugin authors need one part of it:** the six package cases (C28–C33, `conformPackage`) over
|
|
@@ -69,9 +69,9 @@ page an author reads, which is the failure this kit exists to prevent.
|
|
|
69
69
|
| Id | Law | Holds that | What breaks when it fails |
|
|
70
70
|
| --- | --- | ---------- | ------------------------- |
|
|
71
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
|
|
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 genre's defaults or a preset registers a pipeline on 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
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
|
|
74
|
+
| C24 | R-15 | **Every genre can be addressed by a form, and every shipped preset registers 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's effective registrations (its genre's defaults ⊕ its changes, or ⏳ its `bindings`) put a pipeline on it. | A pipeline writes a form, the reader fills it in, the press reaches no run, and no error says why. |
|
|
75
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
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
77
|
|
|
@@ -110,6 +110,33 @@ disagree about what they mean.
|
|
|
110
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
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
112
|
|
|
113
|
+
## A genre's summarize-scene (C34) 🚧
|
|
114
|
+
|
|
115
|
+
Added 2026-10-13 (live scenes §13.5). Fixture: `summarizeScenes()` — the specs to judge, built
|
|
116
|
+
by `summarizeScene()` from `@serene-pub/core-catalog` or ejected to their graph. The kit stands
|
|
117
|
+
in for the source, the cast, the model calls and the save; the host's own bindings run
|
|
118
|
+
`core:task/render-transcript@1` and `core:task/batch-messages@2`.
|
|
119
|
+
|
|
120
|
+
| Id | Law | Holds that | What breaks when it fails |
|
|
121
|
+
| --- | --- | ---------- | ------------------------- |
|
|
122
|
+
| C34 | live scenes §13.5 | **A genre's summarize-scene spec accepts `summarize-request@1`, ends in `save` (with `synth` and `naming` beside it), survives an empty span and an aside on an undeclared channel, and renders transcript units that each carry a message id of the span — every row in some unit.** | A scene of that genre cannot be summarized, or its summary cannot be traced to its rows. |
|
|
123
|
+
|
|
124
|
+
## Registrations (C35–C37) 🚧
|
|
125
|
+
|
|
126
|
+
Added 2026-10-21 with the layering restructure (a pipeline is **registered** on an event, an
|
|
127
|
+
action or a routine's cadence; the genre carries its defaults; a preset is one set of changes on
|
|
128
|
+
them). All three read the host's catalogue, `HostUnderTest.shipped()`, and quote the SDK's own
|
|
129
|
+
verdicts rather than restating them (01 §13): C35 and C36 run the registration door
|
|
130
|
+
(`registrationFindings`) and keep one law each, C37 runs `presetLevelFindings`.
|
|
131
|
+
Supply `shipped().pipelines` (the published documents) for C35 and the pipeline half of C36 to be
|
|
132
|
+
judged; without them each says what went unjudged.
|
|
133
|
+
|
|
134
|
+
| Case | Law | What is checked | What breaks when it fails |
|
|
135
|
+
| --- | --- | --- | --- |
|
|
136
|
+
| C35 | R4, A11, A17 | **Every registration fits its pipeline.** Each registration of each genre's defaults, and each one a preset adds, is judged by `registrationFindings`' `registration fit` law: everything the pipeline's steps read is carried by its trigger. A pipeline the catalogue does not ship is another package's, judged where it is installed. | A pipeline runs on a trigger that does not carry what it reads, and the first turn fails in a session instead of the registration being refused in words. |
|
|
137
|
+
| C36 | R1, A10 (10-12) | **Model plumbing never reaches a member.** No genre field (`exposureFindings`) and no registered pipeline's settings (`exposed plumbing`) declare a connection, sampling, loadout, prompt or template with `reach: 'owner'`. | A session owner who is not an administrator is offered the model plumbing members were ruled never to touch. |
|
|
138
|
+
| C37 | R2, R3, R22 | **One level.** Every shipped preset names a genre the catalogue ships, names no parent (`extends`, `base`, …), and drops or changes only what its genre's defaults (or its own `register`) hold; no genre has two default presets. | A preset reads differently on every pub depending on another preset, and which preset a new session starts from is left to chance. |
|
|
139
|
+
|
|
113
140
|
## A package's own artifact (C30–C33)
|
|
114
141
|
|
|
115
142
|
C30 added 2026-09-24 (PLAN-sdk-1.0 §3.5); C31–C33 added 2026-09-26, from the gaps the Twenty
|
|
@@ -146,21 +173,63 @@ The helpers read the artifact the way an instance reads it at install — never
|
|
|
146
173
|
- **`conformPackage(host, only?)`** runs `PACKAGE_REQUIREMENTS` (C28–C33) with no fixtures;
|
|
147
174
|
`conform(host, fx, { only })` runs any subset.
|
|
148
175
|
|
|
176
|
+
`serene-pub scaffold plugin` writes this as `test/conformance.test.ts`. It reads the build, so
|
|
177
|
+
run `npm run package` first. A component is mounted in a DOM, so the file runs under
|
|
178
|
+
`happy-dom` (a devDependency: `npm i -D happy-dom`). Each result's verdict is `pass`.
|
|
179
|
+
|
|
149
180
|
```ts
|
|
150
|
-
|
|
181
|
+
// @vitest-environment happy-dom
|
|
182
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
183
|
+
import { join, resolve } from 'node:path'
|
|
184
|
+
import { expect, it } from 'vitest'
|
|
185
|
+
// The SDK's reference executor: the laws a package is judged under.
|
|
186
|
+
import { canonicalHash, importDocument, replay, run, validate } from '@serene-pub/sdk'
|
|
187
|
+
import {
|
|
188
|
+
componentsFromManifest,
|
|
189
|
+
conformPackage,
|
|
190
|
+
manifestSeams,
|
|
191
|
+
pinnedDefinitionIn,
|
|
192
|
+
renderConformance,
|
|
193
|
+
type HostUnderTest,
|
|
194
|
+
} from '@serene-pub/conformance'
|
|
151
195
|
import { mountComponent } from '@serene-pub/cli/testing'
|
|
152
196
|
import { coreSpec } from '@serene-pub/core-catalog'
|
|
153
197
|
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
198
|
+
const root = resolve(import.meta.dirname, '..') // the package root
|
|
199
|
+
const build = join(root, 'dist', 'plugin')
|
|
200
|
+
const aside = join(root, 'node_modules', '.cache', 'conformance')
|
|
201
|
+
|
|
202
|
+
it('passes the package cases (C28–C33)', async () => {
|
|
203
|
+
const manifest = JSON.parse(readFileSync(join(build, 'manifest.json'), 'utf8'))
|
|
204
|
+
const bundle = existsSync(join(build, 'bundle.js')) ? readFileSync(join(build, 'bundle.js'), 'utf8') : undefined
|
|
205
|
+
let n = 0
|
|
206
|
+
// The harness imports a module from disk, so a mounted module is written aside first.
|
|
207
|
+
const writeAside = (code: string) => {
|
|
208
|
+
mkdirSync(aside, { recursive: true })
|
|
209
|
+
const path = join(aside, `component-${n++}.js`)
|
|
210
|
+
writeFileSync(path, code)
|
|
211
|
+
return path
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const host: HostUnderTest = {
|
|
215
|
+
name: `${manifest.slug} (built)`,
|
|
216
|
+
validate, run, replay, canonicalHash, importDocument,
|
|
217
|
+
...manifestSeams(manifest, bundle),
|
|
218
|
+
pinnedDefinition: (spec, node) => pinnedDefinitionIn(coreSpec(spec)?.build(), node),
|
|
219
|
+
components: () => componentsFromManifest(manifest, (entry) => readFileSync(join(root, entry), 'utf8')),
|
|
220
|
+
// The kit names grants as strings; the harness types them as scopes.
|
|
221
|
+
mountComponent: async (code, sections, opts) =>
|
|
222
|
+
(await mountComponent({
|
|
223
|
+
root,
|
|
224
|
+
entry: writeAside(code),
|
|
225
|
+
context: sections as never,
|
|
226
|
+
grants: opts?.grants as never,
|
|
227
|
+
reads: opts?.reads as never,
|
|
228
|
+
})) as never,
|
|
229
|
+
}
|
|
230
|
+
const results = await conformPackage(host)
|
|
231
|
+
expect(results.filter((r) => !r.pass), renderConformance(results)).toEqual([])
|
|
232
|
+
}, 120_000)
|
|
164
233
|
```
|
|
165
234
|
|
|
166
235
|
C29 stays "not judged" outside the app: the event map is drawn from every installed package
|
package/dist/components.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Components (
|
|
2
|
+
* Components (C4 / C30): what a host must do with a remote component,
|
|
3
3
|
* as cases a host is run through — the built module's own findings, the
|
|
4
4
|
* protocol round trip, and parity between a widget's native copy and a
|
|
5
5
|
* remote built from the same source.
|
|
@@ -225,7 +225,7 @@ export function componentParitySections() {
|
|
|
225
225
|
turn: { order: [], candidates: [], show: false, canChoose: false },
|
|
226
226
|
readOnly: null,
|
|
227
227
|
state: { ledgers: {}, pending: {}, waiting: [] },
|
|
228
|
-
|
|
228
|
+
appBackground: false,
|
|
229
229
|
},
|
|
230
230
|
},
|
|
231
231
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The conformance kit
|
|
2
|
+
* The conformance kit.
|
|
3
3
|
*
|
|
4
4
|
* This is the artifact SP Core upgrades *against*. The rest of this package is a
|
|
5
5
|
* reference implementation whose runtime half is placeholder — a real executor will have
|
|
@@ -24,7 +24,7 @@ import type { GenreDecl, PresetDecl } from '@serene-pub/sdk';
|
|
|
24
24
|
import type { EventGraph } from '@serene-pub/sdk';
|
|
25
25
|
import { type Door } from '@serene-pub/sdk';
|
|
26
26
|
/**
|
|
27
|
-
* The plugin grant table
|
|
27
|
+
* The plugin grant table, imported rather than restated.
|
|
28
28
|
* `pluginHarness.ts` keeps it byte-for-byte with the two sandboxes' programs
|
|
29
29
|
* and the app's `hookCtx.ts`, and its docblock says what a further copy would
|
|
30
30
|
* be: the drift the install-time check exists to catch. C25 judges a host's
|
|
@@ -34,10 +34,11 @@ import { type HookCtxKind } from '@serene-pub/sdk/testing';
|
|
|
34
34
|
import { type ComponentView } from './components.js';
|
|
35
35
|
import { type NodeHandler, type SwapEvidence } from './packages.js';
|
|
36
36
|
import type { Descriptor } from '@serene-pub/sdk';
|
|
37
|
+
import { type RulesetDecl, type RulesetTemplate } from '@serene-pub/sdk';
|
|
37
38
|
export * from './components.js';
|
|
38
39
|
export * from './packages.js';
|
|
39
40
|
/**
|
|
40
|
-
* One entry of a host's venue listing, as C19 reads it
|
|
41
|
+
* One entry of a host's venue listing, as C19 reads it: the action's
|
|
41
42
|
* identity — its `key` and the id of the spec that contributed it, never the
|
|
42
43
|
* declaration object, because a host decorates its entries — and, in the
|
|
43
44
|
* composer, the slash name the host calls it by.
|
|
@@ -58,7 +59,7 @@ export interface BuiltComponent {
|
|
|
58
59
|
/** The scopes the page grants it (`session:full`, …) when C31 mounts it. */
|
|
59
60
|
grants?: string[];
|
|
60
61
|
/**
|
|
61
|
-
* The base sections its widget declares it reads (`WidgetDecl.reads
|
|
62
|
+
* The base sections its widget declares it reads (`WidgetDecl.reads`)
|
|
62
63
|
* — C31 mounts it with those and no others, as the page does, so a module
|
|
63
64
|
* that reads a section it never declared fails here rather than on a
|
|
64
65
|
* layout. Omitted: every base section, as a declaration without `reads`
|
|
@@ -85,29 +86,29 @@ export interface HostUnderTest {
|
|
|
85
86
|
importDocument(doc: SpecDocument): SpecDocument;
|
|
86
87
|
/**
|
|
87
88
|
* The host's own venue projection of the actions one document
|
|
88
|
-
* contributes, for one channel
|
|
89
|
+
* contributes, for one channel — what its composer, message menu
|
|
89
90
|
* and settings tabs render from. C19 judges THIS, entry by entry: the
|
|
90
91
|
* SDK's executor implements it with `placeActions` over `actionsOf(doc)`,
|
|
91
92
|
* each entry decorated with `slashNameOf`; core implements it with
|
|
92
93
|
* `listSessionActions`'s placement (its `specSlug` is `specId` here).
|
|
93
94
|
* Optional because a validator-only host has no listing — C19 then fails
|
|
94
95
|
* naming the missing seam, rather than judging a rule the kit applied on
|
|
95
|
-
* the host's behalf, which any host would pass
|
|
96
|
+
* the host's behalf, which any host would pass.
|
|
96
97
|
*/
|
|
97
98
|
listActions?(doc: SpecDocument, channel: string): VenueListings<ListedAction> | Promise<VenueListings<ListedAction>>;
|
|
98
99
|
/**
|
|
99
100
|
* What this host **ships**: the genres it offers in the picker and the
|
|
100
101
|
* presets that fill their event slots. C24's law is about a catalogue
|
|
101
102
|
* rather than a document — a genre that declares no `form-addressed` event
|
|
102
|
-
* has nowhere to route an answer, and a preset that
|
|
103
|
-
* leaves every form it writes unanswerable — so it is read off what the
|
|
103
|
+
* has nowhere to route an answer, and a preset that registers no pipeline on
|
|
104
|
+
* it leaves every form it writes unanswerable — so it is read off what the
|
|
104
105
|
* host ships and nowhere else. Optional: a host that ships no catalogue of
|
|
105
106
|
* its own (a validator, a test harness) is not judged on it.
|
|
106
107
|
*/
|
|
107
108
|
shipped?(): ShippedCatalogue | Promise<ShippedCatalogue>;
|
|
108
109
|
/**
|
|
109
110
|
* The **event map** this host draws for one genre, with each node's
|
|
110
|
-
* termination policy — C29's evidence
|
|
111
|
+
* termination policy — C29's evidence. The graph is
|
|
111
112
|
* the host's own (the app's `eventMap`), never one the kit derives, and a
|
|
112
113
|
* termination policy is the host's statement of how a loop through that
|
|
113
114
|
* node stops: auto-advance's cause rule and cap, or the run caps that park
|
|
@@ -117,14 +118,14 @@ export interface HostUnderTest {
|
|
|
117
118
|
eventMap?(genre: string): EventMapEvidence | Promise<EventMapEvidence>;
|
|
118
119
|
/**
|
|
119
120
|
* The BUILT component modules this host ships or has been handed — C30's
|
|
120
|
-
* evidence for what a module may carry
|
|
121
|
+
* evidence for what a module may carry.
|
|
121
122
|
*/
|
|
122
123
|
components?(): BuiltComponent[] | Promise<BuiltComponent[]>;
|
|
123
124
|
/**
|
|
124
125
|
* Mount a built component module the way this host's page does — its
|
|
125
126
|
* worker, its gate — in a **plugin's box** (never core's), with these
|
|
126
127
|
* sections pushed and, when given, these scopes granted and only these
|
|
127
|
-
* base sections read (`reads
|
|
128
|
+
* base sections read (`reads` — the page withholds every other base
|
|
128
129
|
* section, as it does from a widget that declared them); show the kit the
|
|
129
130
|
* result. C30 mounts its own fixture through it; C31 mounts every module
|
|
130
131
|
* `components()` lists. The SDK harness takes both as they are
|
|
@@ -147,7 +148,7 @@ export interface HostUnderTest {
|
|
|
147
148
|
remote: ComponentView;
|
|
148
149
|
}>;
|
|
149
150
|
/**
|
|
150
|
-
* The swaps offered to this host
|
|
151
|
+
* The swaps offered to this host — a package's manifest's
|
|
151
152
|
* `swaps`, each with the declaration of the definition it seats
|
|
152
153
|
* (`swapsFromManifest`). C32 fits each against `pinnedDefinition`; C33
|
|
153
154
|
* probes each definition's handler.
|
|
@@ -182,19 +183,20 @@ export interface HostUnderTest {
|
|
|
182
183
|
*/
|
|
183
184
|
hookCtxKeys?(kind: HookCtxKind): readonly string[] | undefined | Promise<readonly string[] | undefined>;
|
|
184
185
|
/**
|
|
185
|
-
* How this host mounts a frame surface
|
|
186
|
+
* How this host mounts a frame surface. Optional; without it C26
|
|
186
187
|
* names the gap rather than judging a boundary the kit cannot see.
|
|
187
188
|
*/
|
|
188
189
|
frameMount?(): FrameMount | Promise<FrameMount>;
|
|
189
190
|
/**
|
|
190
|
-
* One entry per door this host has
|
|
191
|
+
* One entry per door this host has. The kit feeds each
|
|
191
192
|
* registered verdict's `failing(door)` input through it and expects
|
|
192
193
|
* `judge(failing).sentence` back (the en text) somewhere in what the door
|
|
193
194
|
* refused with; `null` if the door heard the input and did not refuse —
|
|
194
195
|
* a failure, the rule is not heard there; `undefined` if this host's door
|
|
195
196
|
* does not hear that verdict at all — a gap, named on the result (the
|
|
196
197
|
* SDK's `registry` is `register()`, which never judges what a host can
|
|
197
|
-
* run, so
|
|
198
|
+
* run, so the publication half of `core:verdict/provisional` is the app's
|
|
199
|
+
* to answer there). The entry
|
|
198
200
|
* drives the host's REAL door — `validate` runs its validator on a
|
|
199
201
|
* document built to hit the verdict, `run` runs the executor and answers
|
|
200
202
|
* the receipt's halt or note, `registry` registers a declaration and
|
|
@@ -204,10 +206,26 @@ export interface HostUnderTest {
|
|
|
204
206
|
*/
|
|
205
207
|
doors?: Partial<Record<Door, (verdictId: string, failing: unknown) => string | null | undefined | Promise<string | null | undefined>>>;
|
|
206
208
|
}
|
|
207
|
-
/** @experimental What a host ships, for C24's read of the form surface
|
|
209
|
+
/** @experimental What a host ships, for C24's read of the form surface. */
|
|
208
210
|
export interface ShippedCatalogue {
|
|
209
211
|
genres: readonly GenreDecl[];
|
|
210
212
|
presets: readonly PresetDecl[];
|
|
213
|
+
/**
|
|
214
|
+
* 🚧 The pipelines the catalogue ships — their published documents — so
|
|
215
|
+
* C35 and C36 can hold every registration of the genres' defaults and the
|
|
216
|
+
* presets to what its pipeline reads and exposes. Optional: without them
|
|
217
|
+
* those two say what went unjudged. A registration naming a pipeline not
|
|
218
|
+
* here is another package's, judged where that package is installed.
|
|
219
|
+
*/
|
|
220
|
+
pipelines?: readonly SpecDocument[];
|
|
221
|
+
/**
|
|
222
|
+
* 🚧 The rulesets the catalogue ships — their declarations — so C38 can
|
|
223
|
+
* hold each to the ruleset laws (`rulesetCatalogueFindings`). Optional:
|
|
224
|
+
* without them C38 says what went unjudged.
|
|
225
|
+
*/
|
|
226
|
+
rulesets?: readonly RulesetDecl[];
|
|
227
|
+
/** 🚧 The ruleset templates it ships (`rulesetTemplates()`), for C38. */
|
|
228
|
+
rulesetTemplates?: readonly RulesetTemplate[];
|
|
211
229
|
}
|
|
212
230
|
/** @experimental C29's evidence: one genre's event map and the termination policy of each node that has one. */
|
|
213
231
|
export interface EventMapEvidence extends EventGraph {
|
|
@@ -243,7 +261,7 @@ export interface CheckReport {
|
|
|
243
261
|
* A half of the requirement this host could not be judged on, and why.
|
|
244
262
|
* Recorded on the result as `skipped`, never as a failure — for a gap in
|
|
245
263
|
* the host's shape rather than a law broken: C18(b) on a host whose
|
|
246
|
-
* `run` refuses a document `validate()` refuses
|
|
264
|
+
* `run` refuses a document `validate()` refuses.
|
|
247
265
|
*/
|
|
248
266
|
skip(why: string): void;
|
|
249
267
|
/**
|
|
@@ -278,8 +296,8 @@ export interface Requirement {
|
|
|
278
296
|
export interface Fixtures {
|
|
279
297
|
/**
|
|
280
298
|
* A minimal chat turn: input → query → task → provider → write, the write
|
|
281
|
-
* opening the run's **live row** (`create-message` with `generating: true`
|
|
282
|
-
*
|
|
299
|
+
* opening the run's **live row** (`create-message` with `generating: true`).
|
|
300
|
+
* C16 holds the host to naming that row; a complete message
|
|
283
301
|
* would be an ordinary write, and a run with none names no live row.
|
|
284
302
|
*/
|
|
285
303
|
chatTurn(): SpecDocument;
|
|
@@ -293,17 +311,17 @@ export interface Fixtures {
|
|
|
293
311
|
looped(max: number): SpecDocument;
|
|
294
312
|
/**
|
|
295
313
|
* Two `create-message` placeholders (`generating: true`) in one document,
|
|
296
|
-
* an oracle between them
|
|
314
|
+
* an oracle between them. Two live rows, which `validate()`
|
|
297
315
|
* refuses under F7 — that refusal IS the one-live-row law at publish
|
|
298
|
-
* (a complete message beside them would be an ordinary write
|
|
316
|
+
* (a complete message beside them would be an ordinary write), and C16(a) holds the host to it. Never run: the run
|
|
299
317
|
* half of the law is proved on `chatTurn()`, a document the host can
|
|
300
|
-
* publish
|
|
318
|
+
* publish.
|
|
301
319
|
*/
|
|
302
320
|
twoWrites(): SpecDocument;
|
|
303
321
|
/**
|
|
304
|
-
* A document contributing actions
|
|
322
|
+
* A document contributing actions: at least one `quick`, one not,
|
|
305
323
|
* one on a named channel, one whose `key` is a core verb's (a different
|
|
306
|
-
* identity, never shadowing it
|
|
324
|
+
* identity, never shadowing it). Every
|
|
307
325
|
* one of them must be reachable from its venue's listing.
|
|
308
326
|
*/
|
|
309
327
|
actions(): SpecDocument;
|
|
@@ -320,8 +338,8 @@ export interface Fixtures {
|
|
|
320
338
|
because: string;
|
|
321
339
|
}>;
|
|
322
340
|
/**
|
|
323
|
-
* A document with a **live-row** outlet inside a repeating clause
|
|
324
|
-
*
|
|
341
|
+
* A document with a **live-row** outlet inside a repeating clause
|
|
342
|
+
* — an `each` or loop body. One reply row per pass is N live rows;
|
|
325
343
|
* other writes may repeat, and any write may sit in a gather or a
|
|
326
344
|
* junction. Optional; without it C21 judges the two-live-rows half alone
|
|
327
345
|
* and names the fixture it is missing.
|
|
@@ -330,8 +348,8 @@ export interface Fixtures {
|
|
|
330
348
|
/**
|
|
331
349
|
* A **parallel** gather whose chains each end in a write, the first chain
|
|
332
350
|
* declared finishing LAST (a slow node before its write). C8 holds the
|
|
333
|
-
* host to committing the writes in declaration order in both
|
|
334
|
-
*
|
|
351
|
+
* host to committing the writes in declaration order in both
|
|
352
|
+
* modes. Optional; without it C8 judges its results half alone and names
|
|
335
353
|
* the fixture it is missing.
|
|
336
354
|
*/
|
|
337
355
|
gatherWrites?(): SpecDocument;
|
|
@@ -344,10 +362,20 @@ export interface Fixtures {
|
|
|
344
362
|
* not judged.
|
|
345
363
|
*/
|
|
346
364
|
worldAction?(): SpecDocument;
|
|
365
|
+
/**
|
|
366
|
+
* 🚧 The **summarize-scene** specs to judge (live scenes §13.5) — a
|
|
367
|
+
* genre's own, as `summarizeScene()` builds them, or one ejected to its
|
|
368
|
+
* graph. C34 runs each with the kit's stand-ins for the source, the
|
|
369
|
+
* source's attachments, the cast, the model calls and the save, and the
|
|
370
|
+
* HOST's bindings for the two pure
|
|
371
|
+
* steps between them (`core:task/render-transcript@1`,
|
|
372
|
+
* `core:task/batch-messages@2`). Optional; without it C34 is skipped.
|
|
373
|
+
*/
|
|
374
|
+
summarizeScenes?(): SpecDocument[];
|
|
347
375
|
bindings(over?: Bindings): Bindings;
|
|
348
376
|
world: RunOptions['world'];
|
|
349
377
|
/**
|
|
350
|
-
* How many writes the world has taken so far
|
|
378
|
+
* How many writes the world has taken so far, for a host whose
|
|
351
379
|
* writes the kit cannot watch through `RunOptions.host` — a row count in a
|
|
352
380
|
* test database, say. Optional: the kit's own probe covers a host that
|
|
353
381
|
* routes `ctx.commit` to `RunOptions.host.commit`, and is read first — a
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The conformance kit
|
|
2
|
+
* The conformance kit.
|
|
3
3
|
*
|
|
4
4
|
* This is the artifact SP Core upgrades *against*. The rest of this package is a
|
|
5
5
|
* reference implementation whose runtime half is placeholder — a real executor will have
|
|
@@ -15,14 +15,16 @@
|
|
|
15
15
|
* Every check states **what would be broken if it failed**, because a red line saying
|
|
16
16
|
* "F13" tells an implementer nothing about what to go and look at.
|
|
17
17
|
*/
|
|
18
|
-
import { actionsOf, DEFAULT_CHANNEL, parseChannel, slashFindings, slashNameOf } from '@serene-pub/sdk';
|
|
18
|
+
import { actionsOf, DEFAULT_CHANNEL, ok, parseChannel, slashFindings, slashNameOf } from '@serene-pub/sdk';
|
|
19
19
|
import { allDefinitions, assertHookSurface, effectsOf, sessionEvents, worldBlockFunctions } from '@serene-pub/sdk';
|
|
20
20
|
import { uncausedGenreEvents, unterminatedCycles } from '@serene-pub/sdk';
|
|
21
|
+
import { effectiveRegistrations, genreDefaultsOf, presetChangesOf } from '@serene-pub/sdk';
|
|
22
|
+
import { exposureFindings, presetLevelFindings, registrationFindings } from '@serene-pub/sdk';
|
|
21
23
|
// One verdict per law (01 §13): C27 enumerates what is registered and holds
|
|
22
24
|
// the host's doors to each verdict's own sentence.
|
|
23
25
|
import { i18nText, verdicts } from '@serene-pub/sdk';
|
|
24
26
|
/**
|
|
25
|
-
* The plugin grant table
|
|
27
|
+
* The plugin grant table, imported rather than restated.
|
|
26
28
|
* `pluginHarness.ts` keeps it byte-for-byte with the two sandboxes' programs
|
|
27
29
|
* and the app's `hookCtx.ts`, and its docblock says what a further copy would
|
|
28
30
|
* be: the drift the install-time check exists to catch. C25 judges a host's
|
|
@@ -32,6 +34,7 @@ import { hookCtxGrants, hookCtxKeysFor, HOOK_CTX_KINDS } from '@serene-pub/sdk/t
|
|
|
32
34
|
import { COMPONENT_PROTOCOL_FIXTURE, componentMountCase, componentParityCase, componentParitySections, componentProtocolCase, judgeComponentModule, } from './components.js';
|
|
33
35
|
import { probeSampleFor } from './packages.js';
|
|
34
36
|
import { swapFitFinding } from '@serene-pub/sdk';
|
|
37
|
+
import { rulesetCatalogueFindings } from '@serene-pub/sdk';
|
|
35
38
|
import { probeBinding, probeCtxFor } from '@serene-pub/sdk/testing';
|
|
36
39
|
export * from './components.js';
|
|
37
40
|
export * from './packages.js';
|
|
@@ -109,7 +112,7 @@ const headline = (e) => {
|
|
|
109
112
|
const law = lines.slice(1).find((l) => l.startsWith('['));
|
|
110
113
|
return law ? `${lines[0]} ${law}` : (lines[0] ?? '');
|
|
111
114
|
};
|
|
112
|
-
/** Said up front by every C18(b) failure on a refused document
|
|
115
|
+
/** Said up front by every C18(b) failure on a refused document. */
|
|
113
116
|
const UNVALIDATED = 'C18(b) runs a document validate() refuses, on purpose — a host that skips validation must ' +
|
|
114
117
|
'still hand out no setting; a host that cannot run an unvalidated document needs a run seam ' +
|
|
115
118
|
'that skips publish-time validation';
|
|
@@ -822,7 +825,7 @@ export const REQUIREMENTS = [
|
|
|
822
825
|
must(errs.some((e) => e.law === 'F8'), `${because} — but validate() raised no F8 error ` +
|
|
823
826
|
`(${errs.map((e) => e.law).join(', ') || 'no errors at all'})`);
|
|
824
827
|
must(errs.filter((e) => e.law === 'F8').every((e) => !!e.fix && e.fix.length > 10), `${because} — refused without naming the one path: a write causes the event its outlet ` +
|
|
825
|
-
`declares, and a preset
|
|
828
|
+
`declares, and a genre's defaults or a preset registers a pipeline on that event (15 §1.3)`);
|
|
826
829
|
}
|
|
827
830
|
},
|
|
828
831
|
},
|
|
@@ -902,7 +905,7 @@ export const REQUIREMENTS = [
|
|
|
902
905
|
{
|
|
903
906
|
id: 'C24',
|
|
904
907
|
law: 'R-15',
|
|
905
|
-
title: 'every genre can be addressed by a form, and every shipped preset
|
|
908
|
+
title: 'every genre can be addressed by a form, and every shipped preset registers the pipeline that answers one',
|
|
906
909
|
consequence: 'A pipeline writes a form into the session and nothing answers it: the block renders, the reader fills it in, the press reaches no run, and no error says why. The feature works in the genre it was built in and is dead in every other.',
|
|
907
910
|
async check(host, fx, report) {
|
|
908
911
|
const shipped = await host.shipped?.();
|
|
@@ -917,11 +920,17 @@ export const REQUIREMENTS = [
|
|
|
917
920
|
must(!!decl, `genre '${g.id}' does not declare ${EVENT} — a genre that cannot be addressed by a form has ` +
|
|
918
921
|
`nowhere to route an answer, so a pipeline that writes one into it has written a dead control`);
|
|
919
922
|
must(decl.required !== true, `genre '${g.id}' makes ${EVENT} required — the slot is offered, never demanded: a genre whose ` +
|
|
920
|
-
`forms are all owner-addressed still declares it, and a preset that
|
|
923
|
+
`forms are all owner-addressed still declares it, and a preset that registers nothing there is still a preset`);
|
|
921
924
|
}
|
|
925
|
+
// 🚧 By registration (PLAN-layering D4): what a preset answers is its
|
|
926
|
+
// genre's defaults ⊕ its changes; a preset still on ⏳ bindings is
|
|
927
|
+
// read through `presetChangesOf`, so either form is judged.
|
|
922
928
|
for (const p of shipped.presets) {
|
|
923
|
-
const
|
|
924
|
-
|
|
929
|
+
const g = shipped.genres.find((x) => x.id === p.genre);
|
|
930
|
+
const defaults = genreDefaultsOf(g)?.registrations;
|
|
931
|
+
const answered = !!p.bindings?.[EVENT]?.spec ||
|
|
932
|
+
effectiveRegistrations(defaults, presetChangesOf(p, defaults)).some((r) => r.trigger.family === 'event' && r.trigger.event === EVENT);
|
|
933
|
+
must(answered, `preset '${p.slug}' registers no pipeline on ${EVENT} — a shipped preset answers the forms its ` +
|
|
925
934
|
`genre can be addressed by, or the answer button does nothing in every session started from it`);
|
|
926
935
|
}
|
|
927
936
|
},
|
|
@@ -1122,7 +1131,7 @@ export const REQUIREMENTS = [
|
|
|
1122
1131
|
id: 'C28',
|
|
1123
1132
|
law: 'PLAN-turn-order §B3, R33',
|
|
1124
1133
|
title: 'every event a genre lists is caused by a write or is a declared root',
|
|
1125
|
-
consequence: 'A preset
|
|
1134
|
+
consequence: 'A preset registers a pipeline on an event nothing ever fires: the registration looks filled, the pipeline is published, and it never runs. Nobody is told, because nothing failed.',
|
|
1126
1135
|
async check(host, fx, report) {
|
|
1127
1136
|
const shipped = await host.shipped?.();
|
|
1128
1137
|
if (!shipped)
|
|
@@ -1295,7 +1304,280 @@ export const REQUIREMENTS = [
|
|
|
1295
1304
|
must(!failed.length, failed.join('\n'));
|
|
1296
1305
|
},
|
|
1297
1306
|
},
|
|
1307
|
+
{
|
|
1308
|
+
id: 'C34',
|
|
1309
|
+
law: 'live scenes §13.5 (2026-10-13)',
|
|
1310
|
+
title: 'a genre’s summarize-scene spec accepts the summarize request, ends in the save, survives an empty span and an unknown channel, and renders units that carry message ids',
|
|
1311
|
+
consequence: 'A scene of that genre cannot be summarized: the scenes socket hands the spec a request it does not read, finds no `synth` / `naming` / `save` to read back, fails on a quiet scene or on a plugin’s channel it never heard of, or drafts from text no row can be traced to — so a reprocess cannot say which lines a summary came from.',
|
|
1312
|
+
async check(host, fx, report) {
|
|
1313
|
+
const docs = fx.summarizeScenes?.() ?? [];
|
|
1314
|
+
if (!docs.length)
|
|
1315
|
+
return report.skip('no fixture supplies summarize-scene specs — supply `summarizeScenes()` for C34 to judge them');
|
|
1316
|
+
for (const doc of docs)
|
|
1317
|
+
await judgeSummarizeScene(host, fx, doc);
|
|
1318
|
+
},
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
id: 'C35',
|
|
1322
|
+
law: 'R4, A11, A17',
|
|
1323
|
+
title: 'every registration a host ships fits its pipeline: what the pipeline reads, its trigger carries',
|
|
1324
|
+
consequence: 'A pipeline mounted on a trigger that does not carry what it reads runs and finds nothing where it looks — a reply with no speaker, a routine with no message — so the first turn fails in a session, where the registration should have been refused in words before anyone started one.',
|
|
1325
|
+
async check(host, fx, report) {
|
|
1326
|
+
const shipped = await host.shipped?.();
|
|
1327
|
+
if (!shipped)
|
|
1328
|
+
return report.skip('the host declares no catalogue — supply `shipped()` for its registrations to be judged');
|
|
1329
|
+
if (!shipped.pipelines?.length)
|
|
1330
|
+
return report.skip('the catalogue ships no pipelines — supply `shipped().pipelines` (the published documents) for fit to be judged');
|
|
1331
|
+
const failures = shippedRegistrations(shipped).flatMap(({ layer, decls }) => doorFindings(shipped, decls, layer, 'registration fit'));
|
|
1332
|
+
must(!failures.length, failures.join('\n'));
|
|
1333
|
+
},
|
|
1334
|
+
},
|
|
1335
|
+
{
|
|
1336
|
+
id: 'C36',
|
|
1337
|
+
law: 'R1, A10 (ruled 2026-10-12)',
|
|
1338
|
+
title: 'model plumbing never reaches a member: no shipped setting exposes a connection, sampling, loadout, prompt or template to the owner',
|
|
1339
|
+
consequence: 'A session owner who is not an administrator is offered the model a step runs on, its sampling or its prompts — the plumbing members were ruled never to touch — and a change there reaches every turn of that session with nobody who manages the models knowing.',
|
|
1340
|
+
async check(host, fx, report) {
|
|
1341
|
+
const shipped = await host.shipped?.();
|
|
1342
|
+
if (!shipped)
|
|
1343
|
+
return report.skip('the host declares no catalogue — supply `shipped()` for its settings to be judged');
|
|
1344
|
+
const failures = [];
|
|
1345
|
+
for (const g of shipped.genres)
|
|
1346
|
+
failures.push(...exposureFindings(g.shape?.fields, `genre '${g.id}' shape.fields`));
|
|
1347
|
+
if (!shipped.pipelines?.length)
|
|
1348
|
+
report.skip('the catalogue ships no pipelines — supply `shipped().pipelines` for the registered pipelines\' settings to be judged');
|
|
1349
|
+
else
|
|
1350
|
+
for (const { layer, decls } of shippedRegistrations(shipped))
|
|
1351
|
+
failures.push(...doorFindings(shipped, decls, layer, 'exposed plumbing'));
|
|
1352
|
+
must(!failures.length, failures.join('\n'));
|
|
1353
|
+
},
|
|
1354
|
+
},
|
|
1355
|
+
{
|
|
1356
|
+
id: 'C37',
|
|
1357
|
+
law: 'R2, R3, R22',
|
|
1358
|
+
title: 'every shipped preset is one set of changes on one genre’s defaults, and a genre has at most one default preset',
|
|
1359
|
+
consequence: 'A preset built on another preset — or one that drops or changes what its genre never registered — reads differently on every pub depending on what the other preset holds that day, and a person who picks it cannot tell what the session will run; two defaults for one genre leave which preset a new session starts from to chance.',
|
|
1360
|
+
async check(host, fx, report) {
|
|
1361
|
+
const shipped = await host.shipped?.();
|
|
1362
|
+
if (!shipped)
|
|
1363
|
+
return report.skip('the host declares no catalogue — supply `shipped()` for its presets to be judged');
|
|
1364
|
+
const failures = [];
|
|
1365
|
+
const defaults = new Map();
|
|
1366
|
+
for (const p of shipped.presets) {
|
|
1367
|
+
const g = shipped.genres.find((x) => x.id === p.genre);
|
|
1368
|
+
if (!g)
|
|
1369
|
+
failures.push(`preset '${p.slug}' names genre '${String(p.genre)}', which the catalogue does not ship`);
|
|
1370
|
+
failures.push(...presetLevelFindings(p, genreDefaultsOf(g)?.registrations));
|
|
1371
|
+
if (p.default === true)
|
|
1372
|
+
defaults.set(p.genre, [...(defaults.get(p.genre) ?? []), p.slug]);
|
|
1373
|
+
}
|
|
1374
|
+
for (const [genre, slugs] of defaults)
|
|
1375
|
+
if (slugs.length > 1)
|
|
1376
|
+
failures.push(`genre '${genre}' has ${slugs.length} default presets (${slugs.join(', ')}) — the genre's defaults name one default preset (R22)`);
|
|
1377
|
+
must(!failures.length, failures.join('\n'));
|
|
1378
|
+
},
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
id: 'C38',
|
|
1382
|
+
law: 'PLAN-rulesets-authoring R1, R2, D3 (2026-10-22)',
|
|
1383
|
+
title: 'every shipped ruleset keeps the ruleset laws: chance reads through bands or degrees, every repertoire is tagged, and a template is copied, never played or offered by a genre',
|
|
1384
|
+
consequence: 'A ruleset that rolls with nothing to roll against and nothing to read the roll as hands the table a number and no outcome; an untagged repertoire leaves whether the ruleset has conditions or casting to a guess from its name, so a genre is rated against what a word looked like; and a template a genre offers, or the catalogue plays, puts an archetype meant to be copied into people’s sessions, where its sample rows become somebody’s rules.',
|
|
1385
|
+
async check(host, fx, report) {
|
|
1386
|
+
const shipped = await host.shipped?.();
|
|
1387
|
+
if (!shipped)
|
|
1388
|
+
return report.skip('the host declares no catalogue — supply `shipped()` for its rulesets to be judged');
|
|
1389
|
+
if (!shipped.rulesets?.length)
|
|
1390
|
+
return report.skip('the catalogue ships no rulesets — supply `shipped().rulesets` (and `rulesetTemplates`) for the ruleset laws to be judged');
|
|
1391
|
+
const failures = rulesetCatalogueFindings({
|
|
1392
|
+
rulesets: shipped.rulesets,
|
|
1393
|
+
templates: shipped.rulesetTemplates ?? [],
|
|
1394
|
+
genres: shipped.genres,
|
|
1395
|
+
});
|
|
1396
|
+
must(!failures.length, failures.join('\n'));
|
|
1397
|
+
},
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
id: 'C39',
|
|
1401
|
+
law: 'pass 6 (RULED strict 2026-10-24), pass 8 §3',
|
|
1402
|
+
title: 'every lore write a catalogue ships names its entry type, and every lore write in a pipeline that reads a span of the story to summarise names the messages it was written from',
|
|
1403
|
+
consequence: 'A summary saved without its sources moves no settle line, so Back keeps reaching under it and takes back rows the lorebook already records; an entry filed without its type lands as world lore whatever it was.',
|
|
1404
|
+
async check(host, fx, report) {
|
|
1405
|
+
const shipped = await host.shipped?.();
|
|
1406
|
+
if (!shipped)
|
|
1407
|
+
return report.skip('the host declares no catalogue — supply `shipped()` for its lore writes to be judged');
|
|
1408
|
+
if (!shipped.pipelines?.length)
|
|
1409
|
+
return report.skip('the catalogue ships no pipelines — supply `shipped().pipelines` for its lore writes to be judged');
|
|
1410
|
+
const failures = shipped.pipelines.flatMap((d) => loreWriteFindings(d));
|
|
1411
|
+
must(!failures.length, failures.join('\n'));
|
|
1412
|
+
},
|
|
1413
|
+
},
|
|
1414
|
+
];
|
|
1415
|
+
// ── C39: lore writes ────────────────────────────────────────────────────────
|
|
1416
|
+
const LORE_CREATE = 'core:outlet/create-lore-entry';
|
|
1417
|
+
const LORE_WRITES = [
|
|
1418
|
+
'core:outlet/create-lore-entry',
|
|
1419
|
+
'core:outlet/update-lore-entry',
|
|
1420
|
+
'core:outlet/link-lore-entries',
|
|
1421
|
+
'core:outlet/graph-proposal',
|
|
1298
1422
|
];
|
|
1423
|
+
const SPAN_READS = ['core:query/summarize-source', 'core:query/graph-scenes'];
|
|
1424
|
+
/** The param values a document declares for `nodeKey` — its default presets' `params` rows, over the node's own. */
|
|
1425
|
+
function declaredParams(d, nodeKey) {
|
|
1426
|
+
const out = {};
|
|
1427
|
+
const own = d.nodes.find((n) => n.key === nodeKey)?.config?.params;
|
|
1428
|
+
if (own && typeof own === 'object')
|
|
1429
|
+
Object.assign(out, own);
|
|
1430
|
+
for (const p of d.presets ?? [])
|
|
1431
|
+
if (p.default)
|
|
1432
|
+
for (const v of p.values)
|
|
1433
|
+
if (v.nodeKey === nodeKey && v.slot === 'params' && v.value && typeof v.value === 'object')
|
|
1434
|
+
Object.assign(out, v.value);
|
|
1435
|
+
return out;
|
|
1436
|
+
}
|
|
1437
|
+
/** C39's judgement of one shipped document. */
|
|
1438
|
+
function loreWriteFindings(d) {
|
|
1439
|
+
const out = [];
|
|
1440
|
+
const reads = d.nodes.some((n) => SPAN_READS.includes(n.definitionId));
|
|
1441
|
+
for (const n of d.nodes) {
|
|
1442
|
+
if (n.definitionId === LORE_CREATE) {
|
|
1443
|
+
const t = declaredParams(d, n.key).entryType;
|
|
1444
|
+
if (t === undefined || t === null || t === '')
|
|
1445
|
+
out.push(`${d.id} ${n.key}: files lore without naming its entry type.`);
|
|
1446
|
+
}
|
|
1447
|
+
if (reads && LORE_WRITES.includes(n.definitionId)) {
|
|
1448
|
+
const wired = n.config?.sources !== undefined ||
|
|
1449
|
+
d.edges.some((e) => e.to === n.key && (e.toPort === 'sources' || e.toPort.startsWith('sources.')));
|
|
1450
|
+
if (!wired)
|
|
1451
|
+
out.push(`${d.id} ${n.key}: writes lore from a span of the story without sources.`);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
return out;
|
|
1455
|
+
}
|
|
1456
|
+
// ── C35 · C36: the registrations a catalogue ships, at the one door ─────────
|
|
1457
|
+
/** The genres' defaults and each preset's own registrations, with the layer each was declared in. */
|
|
1458
|
+
function shippedRegistrations(shipped) {
|
|
1459
|
+
const out = [];
|
|
1460
|
+
for (const g of shipped.genres) {
|
|
1461
|
+
const decls = genreDefaultsOf(g)?.registrations;
|
|
1462
|
+
if (decls?.length)
|
|
1463
|
+
out.push({ layer: `the defaults of '${g.id}'`, decls });
|
|
1464
|
+
}
|
|
1465
|
+
for (const p of shipped.presets) {
|
|
1466
|
+
const g = shipped.genres.find((x) => x.id === p.genre);
|
|
1467
|
+
const added = presetChangesOf(p, genreDefaultsOf(g)?.registrations).register;
|
|
1468
|
+
if (added?.length)
|
|
1469
|
+
out.push({ layer: `preset '${p.slug}'`, decls: added });
|
|
1470
|
+
}
|
|
1471
|
+
return out;
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* One law's findings from the registration door (`registrationFindings`) —
|
|
1475
|
+
* the same verdict a package build and a host's install give, quoted (01 §13).
|
|
1476
|
+
* A pipeline the catalogue does not ship is another package's: not judged here.
|
|
1477
|
+
*/
|
|
1478
|
+
function doorFindings(shipped, decls, layer, law) {
|
|
1479
|
+
const byId = new Map((shipped.pipelines ?? []).map((d) => [d.id, d]));
|
|
1480
|
+
return registrationFindings(decls, {
|
|
1481
|
+
pipeline: (id) => byId.get(id),
|
|
1482
|
+
external: (id) => !byId.has(id),
|
|
1483
|
+
layer,
|
|
1484
|
+
})
|
|
1485
|
+
.filter((f) => f.severity === 'error' && f.law === law)
|
|
1486
|
+
.map((f) => f.message);
|
|
1487
|
+
}
|
|
1488
|
+
// ── C34: the summarize-scene fixture ────────────────────────────────────────
|
|
1489
|
+
/**
|
|
1490
|
+
* The span C34 runs a summarize-scene spec over: two story lines and an aside
|
|
1491
|
+
* on a channel no genre declares. Rows in the `summarize-source@2` row shape
|
|
1492
|
+
* (`id`, `role`, `senderName`, `content`, `channel`).
|
|
1493
|
+
*/
|
|
1494
|
+
const SCENE_STORY = [
|
|
1495
|
+
{ id: 9101, role: 'user', senderName: 'Ada', content: 'We push the door open.', channel: 'main' },
|
|
1496
|
+
{ id: 9102, role: 'assistant', senderName: 'Bram', content: 'The hinges scream; something below goes quiet.', channel: 'main' },
|
|
1497
|
+
];
|
|
1498
|
+
const SCENE_ASIDE = [
|
|
1499
|
+
{ id: 9103, role: 'user', senderName: 'Ada', content: 'Make the next room colder.', channel: 'conformance-unknown' },
|
|
1500
|
+
];
|
|
1501
|
+
const SCENE_CAST = { characters: [{ id: 1, name: 'Bram' }], personas: [], envoys: [] };
|
|
1502
|
+
const SCENE_SUMMARY = 'The party opened the door, and something below went quiet.';
|
|
1503
|
+
const C34_DEFINITIONS = {
|
|
1504
|
+
inlet: 'core:inlet/summarize-request@1',
|
|
1505
|
+
render: 'core:task/render-transcript@1',
|
|
1506
|
+
outlet: 'save',
|
|
1507
|
+
read: ['synth', 'naming'],
|
|
1508
|
+
};
|
|
1509
|
+
/**
|
|
1510
|
+
* A document node's pin, `id@version`: a built node stores the id bare and
|
|
1511
|
+
* the version beside it; a receipt's row may carry either form.
|
|
1512
|
+
*/
|
|
1513
|
+
const pinOf = (n) => /@\d+$/.test(n.definitionId) ? n.definitionId : `${n.definitionId}@${n.definitionVersion ?? 1}`;
|
|
1514
|
+
async function judgeSummarizeScene(host, fx, doc) {
|
|
1515
|
+
const id = doc.id ?? '(unnamed spec)';
|
|
1516
|
+
const nodes = (doc.nodes ?? []).map((n) => ({ ...n, definitionId: pinOf(n) }));
|
|
1517
|
+
const renderKey = nodes.find((n) => n.definitionId === C34_DEFINITIONS.render)?.key;
|
|
1518
|
+
const inlet = nodes.find((n) => n.kind === 'inlet');
|
|
1519
|
+
must(inlet?.definitionId === C34_DEFINITIONS.inlet, `${id}: its inlet is '${inlet?.definitionId ?? 'none'}' — a summarize-scene spec takes '${C34_DEFINITIONS.inlet}', the request the scenes socket sends`);
|
|
1520
|
+
const save = nodes.find((n) => n.key === C34_DEFINITIONS.outlet);
|
|
1521
|
+
must(save?.kind === 'outlet', `${id}: no outlet keyed '${C34_DEFINITIONS.outlet}' — the scenes socket previews to it`);
|
|
1522
|
+
for (const key of C34_DEFINITIONS.read)
|
|
1523
|
+
must(nodes.some((n) => n.key === key), `${id}: no node keyed '${key}' — the scenes socket reads the summary off it`);
|
|
1524
|
+
must(nodes.some((n) => n.definitionId === C34_DEFINITIONS.render), `${id}: no '${C34_DEFINITIONS.render}' step — nothing lays the transcript out, so no unit names its message`);
|
|
1525
|
+
const errors = host.validate(doc).filter((f) => f.severity === 'error');
|
|
1526
|
+
must(!errors.length, `${id}: validate() refuses it — ${errors.map((e) => `${e.law}: ${e.message}`).join('; ')}`);
|
|
1527
|
+
const run = async (story, asides, request) => {
|
|
1528
|
+
const saved = [];
|
|
1529
|
+
const receipt = await host.run(doc, {
|
|
1530
|
+
input: { scope: { sessionId: 1 }, request, session: {} },
|
|
1531
|
+
world: fx.world,
|
|
1532
|
+
bindings: fx.bindings({
|
|
1533
|
+
'core:inlet/summarize-request@1': async (i) => ok(i),
|
|
1534
|
+
'core:query/summarize-source@2': async () => ok({ main: story, messages: story, asides }),
|
|
1535
|
+
'core:query/session-cast@1': async () => ok({ main: SCENE_CAST, cast: SCENE_CAST, envoys: [] }),
|
|
1536
|
+
// The span's rows are the kit's, so are their files: none.
|
|
1537
|
+
'core:query/history-attachments@1': async () => ok({ main: {}, attachments: {} }),
|
|
1538
|
+
'core:oracle/summarize-batch@1': async (i) => {
|
|
1539
|
+
const draft = `A draft of ${String(i?.batch ?? '').length} characters.`;
|
|
1540
|
+
return ok({ main: draft, draft });
|
|
1541
|
+
},
|
|
1542
|
+
'core:oracle/summarize-synth@1': async () => ok({ main: SCENE_SUMMARY, content: SCENE_SUMMARY }),
|
|
1543
|
+
'core:oracle/name-entry@1': async () => ok({ main: 'The Door', name: 'The Door' }),
|
|
1544
|
+
'core:oracle/extract-cast@1': async () => {
|
|
1545
|
+
const cast = { participants: [], mentioned: [] };
|
|
1546
|
+
return ok({ main: cast, cast });
|
|
1547
|
+
},
|
|
1548
|
+
'core:outlet/create-lore-entry@1': async (i) => {
|
|
1549
|
+
saved.push({ name: i?.name, content: i?.content });
|
|
1550
|
+
return ok({ main: 1, entryId: 1 });
|
|
1551
|
+
},
|
|
1552
|
+
}),
|
|
1553
|
+
});
|
|
1554
|
+
const render = receipt.nodes.find((n) => n.nodeKey === renderKey);
|
|
1555
|
+
const units = (render?.output?.units ?? undefined);
|
|
1556
|
+
return { receipt, saved, units };
|
|
1557
|
+
};
|
|
1558
|
+
// (a) The inlet in, the outlet out: a span with story and an aside on a
|
|
1559
|
+
// channel nothing declared reaches `save` with a name and a body.
|
|
1560
|
+
const full = await run(SCENE_STORY, SCENE_ASIDE, { messageIds: [9101, 9102, 9103], channel: 'main' });
|
|
1561
|
+
must(full.receipt.outcome === 'ok', `${id}: a span with an aside on an undeclared channel ended '${full.receipt.outcome}'` +
|
|
1562
|
+
(full.receipt.haltReason ? ` (${full.receipt.haltNodeKey}: ${full.receipt.haltReason})` : '') +
|
|
1563
|
+
' — a plugin’s channel in the span must never stop a summary');
|
|
1564
|
+
must(full.saved.length === 1 && !!full.saved[0].name && !!full.saved[0].content, `${id}: the run wrote ${full.saved.length} entries through '${C34_DEFINITIONS.outlet}' — expected one, with a name and a body`);
|
|
1565
|
+
// (b) Units carry message ids: every unit names a row of the span, and
|
|
1566
|
+
// every row of the span — the aside included — is in some unit.
|
|
1567
|
+
must(Array.isArray(full.units), `${id}: '${C34_DEFINITIONS.render}' published no \`units\` list`);
|
|
1568
|
+
const rows = [...SCENE_STORY, ...SCENE_ASIDE].map((r) => r.id);
|
|
1569
|
+
for (const u of full.units) {
|
|
1570
|
+
must(rows.includes(Number(u?.messageId)), `${id}: a transcript unit names message ${JSON.stringify(u?.messageId)}, which is not a row of the span`);
|
|
1571
|
+
must(typeof u?.text === 'string', `${id}: a transcript unit carries no text`);
|
|
1572
|
+
must(typeof u?.tokens === 'number', `${id}: a transcript unit carries no token count`);
|
|
1573
|
+
}
|
|
1574
|
+
for (const r of rows)
|
|
1575
|
+
must(full.units.some((u) => Number(u?.messageId) === r), `${id}: message ${r} of the span is in no transcript unit — a reprocess could not trace it`);
|
|
1576
|
+
// (c) An empty span: no rows at all is a quiet scene, not an error.
|
|
1577
|
+
const empty = await run([], [], { messageIds: [] });
|
|
1578
|
+
must(empty.receipt.outcome === 'ok' || empty.receipt.outcome === 'halt', `${id}: an empty span ended '${empty.receipt.outcome}' — a scene with nothing in it must end quietly (ok, or a halt with a reason), never as an error`);
|
|
1579
|
+
must(!empty.units || empty.units.length === 0, `${id}: an empty span rendered ${empty.units?.length} transcript units out of no rows`);
|
|
1580
|
+
}
|
|
1299
1581
|
/**
|
|
1300
1582
|
* The requirements a package's own declarations can fail, judged over its
|
|
1301
1583
|
* BUILT artifact with no fixtures: what it ships (C28, C29), its component
|
package/dist/packages.d.ts
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* so a package's test runs the same cases core runs, over its artifact.
|
|
9
9
|
*/
|
|
10
10
|
import type { Descriptor, GenreDecl, PresetDecl } from '@serene-pub/sdk';
|
|
11
|
-
/** @experimental One swap a package offers
|
|
11
|
+
/** @experimental One swap a package offers, with the declaration of what it seats. */
|
|
12
12
|
export interface SwapEvidence {
|
|
13
|
-
/** The spec the swap targets (`core:spec/
|
|
13
|
+
/** The spec the swap targets (`core:spec/story-turn-order`). */
|
|
14
14
|
spec: string;
|
|
15
15
|
/** The node key on that spec it stands in for. */
|
|
16
16
|
node: string;
|
|
@@ -81,7 +81,7 @@ export interface ManifestComponent {
|
|
|
81
81
|
* `HostUnderTest.components` for a package, so C31 mounts every module the
|
|
82
82
|
* way the page mounts it on a layout: granted the section scopes its widgets
|
|
83
83
|
* ask for (`scopes`; a `channel:` scope is not a section grant) and handed
|
|
84
|
-
* only the base sections they read (`reads
|
|
84
|
+
* only the base sections they read (`reads`).
|
|
85
85
|
*
|
|
86
86
|
* A component more than one widget renders gets the union — the most any
|
|
87
87
|
* placement hands it. When any of those widgets leaves `reads` out, it reads
|
package/dist/packages.js
CHANGED
|
@@ -4,7 +4,7 @@ import { getDefinition } from '@serene-pub/sdk';
|
|
|
4
4
|
* `HostUnderTest.components` for a package, so C31 mounts every module the
|
|
5
5
|
* way the page mounts it on a layout: granted the section scopes its widgets
|
|
6
6
|
* ask for (`scopes`; a `channel:` scope is not a section grant) and handed
|
|
7
|
-
* only the base sections they read (`reads
|
|
7
|
+
* only the base sections they read (`reads`).
|
|
8
8
|
*
|
|
9
9
|
* A component more than one widget renders gets the union — the most any
|
|
10
10
|
* placement hands it. When any of those widgets leaves `reads` out, it reads
|
|
@@ -17,7 +17,11 @@ import { getDefinition } from '@serene-pub/sdk';
|
|
|
17
17
|
export async function componentsFromManifest(manifest, code) {
|
|
18
18
|
return Promise.all((manifest.components ?? []).map(async (c) => {
|
|
19
19
|
const widgets = (manifest.widgets ?? []).filter((w) => w.component === c.slug);
|
|
20
|
-
|
|
20
|
+
// A bare `channel:<slug>` grants nothing (a widget's lanes are its `channels`);
|
|
21
|
+
// a channel's write grant (`channel:<slug>:write`) is a grant like any other.
|
|
22
|
+
const grants = [
|
|
23
|
+
...new Set(widgets.flatMap((w) => (w.scopes ?? []).filter((s) => !s.startsWith('channel:') || s.endsWith(':write')))),
|
|
24
|
+
];
|
|
21
25
|
const everySection = !widgets.length || widgets.some((w) => !Array.isArray(w.reads));
|
|
22
26
|
const reads = everySection ? undefined : [...new Set(widgets.flatMap((w) => w.reads ?? []))];
|
|
23
27
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serene-pub/conformance",
|
|
3
|
-
"version": "0.6.0-pr-
|
|
3
|
+
"version": "0.6.0-pr-6",
|
|
4
4
|
"description": "The host conformance kit: thirty-three executable requirements a Serene Pub executor must satisfy. Run by Serene Pub and by any alternate host; its package cases (C28–C33) by plugin authors over a built package.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/SerenePub/serene-pub-sdk/tree/main/conformance#readme",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"./package.json": "./package.json"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@serene-pub/sdk": "^0.6.0-pr-
|
|
36
|
+
"@serene-pub/sdk": "^0.6.0-pr-6"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc -p tsconfig.build.json"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@serene-pub/sdk": "0.6.0-pr-
|
|
42
|
+
"@serene-pub/sdk": "0.6.0-pr-6"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public",
|