@serene-pub/conformance 0.6.0-pr-2 → 0.6.0-pr-5

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 CHANGED
@@ -110,6 +110,17 @@ 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
+
113
124
  ## A package's own artifact (C30–C33)
114
125
 
115
126
  C30 added 2026-09-24 (PLAN-sdk-1.0 §3.5); C31–C33 added 2026-09-26, from the gaps the Twenty
@@ -146,21 +157,63 @@ The helpers read the artifact the way an instance reads it at install — never
146
157
  - **`conformPackage(host, only?)`** runs `PACKAGE_REQUIREMENTS` (C28–C33) with no fixtures;
147
158
  `conform(host, fx, { only })` runs any subset.
148
159
 
160
+ `serene-pub scaffold plugin` writes this as `test/conformance.test.ts`. It reads the build, so
161
+ run `npm run package` first. A component is mounted in a DOM, so the file runs under
162
+ `happy-dom` (a devDependency: `npm i -D happy-dom`). Each result's verdict is `pass`.
163
+
149
164
  ```ts
150
- import { conformPackage, manifestSeams, pinnedDefinitionIn, renderConformance } from '@serene-pub/conformance'
165
+ // @vitest-environment happy-dom
166
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
167
+ import { join, resolve } from 'node:path'
168
+ import { expect, it } from 'vitest'
169
+ // The SDK's reference executor: the laws a package is judged under.
170
+ import { canonicalHash, importDocument, replay, run, validate } from '@serene-pub/sdk'
171
+ import {
172
+ componentsFromManifest,
173
+ conformPackage,
174
+ manifestSeams,
175
+ pinnedDefinitionIn,
176
+ renderConformance,
177
+ type HostUnderTest,
178
+ } from '@serene-pub/conformance'
151
179
  import { mountComponent } from '@serene-pub/cli/testing'
152
180
  import { coreSpec } from '@serene-pub/core-catalog'
153
181
 
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))
182
+ const root = resolve(import.meta.dirname, '..') // the package root
183
+ const build = join(root, 'dist', 'plugin')
184
+ const aside = join(root, 'node_modules', '.cache', 'conformance')
185
+
186
+ it('passes the package cases (C28–C33)', async () => {
187
+ const manifest = JSON.parse(readFileSync(join(build, 'manifest.json'), 'utf8'))
188
+ const bundle = existsSync(join(build, 'bundle.js')) ? readFileSync(join(build, 'bundle.js'), 'utf8') : undefined
189
+ let n = 0
190
+ // The harness imports a module from disk, so a mounted module is written aside first.
191
+ const writeAside = (code: string) => {
192
+ mkdirSync(aside, { recursive: true })
193
+ const path = join(aside, `component-${n++}.js`)
194
+ writeFileSync(path, code)
195
+ return path
196
+ }
197
+
198
+ const host: HostUnderTest = {
199
+ name: `${manifest.slug} (built)`,
200
+ validate, run, replay, canonicalHash, importDocument,
201
+ ...manifestSeams(manifest, bundle),
202
+ pinnedDefinition: (spec, node) => pinnedDefinitionIn(coreSpec(spec)?.build(), node),
203
+ components: () => componentsFromManifest(manifest, (entry) => readFileSync(join(root, entry), 'utf8')),
204
+ // The kit names grants as strings; the harness types them as scopes.
205
+ mountComponent: async (code, sections, opts) =>
206
+ (await mountComponent({
207
+ root,
208
+ entry: writeAside(code),
209
+ context: sections as never,
210
+ grants: opts?.grants as never,
211
+ reads: opts?.reads as never,
212
+ })) as never,
213
+ }
214
+ const results = await conformPackage(host)
215
+ expect(results.filter((r) => !r.pass), renderConformance(results)).toEqual([])
216
+ }, 120_000)
164
217
  ```
165
218
 
166
219
  C29 stays "not judged" outside the app: the event map is drawn from every installed package
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Components (§3.5, C4 / C30): what a host must do with a remote component,
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
- backdrop: false,
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 (03 §9).
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 (plans/29 R-3), imported rather than restated.
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
@@ -37,7 +37,7 @@ import type { Descriptor } from '@serene-pub/sdk';
37
37
  export * from './components.js';
38
38
  export * from './packages.js';
39
39
  /**
40
- * One entry of a host's venue listing, as C19 reads it (F40): the action's
40
+ * One entry of a host's venue listing, as C19 reads it: the action's
41
41
  * identity — its `key` and the id of the spec that contributed it, never the
42
42
  * declaration object, because a host decorates its entries — and, in the
43
43
  * composer, the slash name the host calls it by.
@@ -58,7 +58,7 @@ export interface BuiltComponent {
58
58
  /** The scopes the page grants it (`session:full`, …) when C31 mounts it. */
59
59
  grants?: string[];
60
60
  /**
61
- * The base sections its widget declares it reads (`WidgetDecl.reads`, R75)
61
+ * The base sections its widget declares it reads (`WidgetDecl.reads`)
62
62
  * — C31 mounts it with those and no others, as the page does, so a module
63
63
  * that reads a section it never declared fails here rather than on a
64
64
  * layout. Omitted: every base section, as a declaration without `reads`
@@ -85,14 +85,14 @@ export interface HostUnderTest {
85
85
  importDocument(doc: SpecDocument): SpecDocument;
86
86
  /**
87
87
  * The host's own venue projection of the actions one document
88
- * contributes, for one channel (F40) — what its composer, message menu
88
+ * contributes, for one channel — what its composer, message menu
89
89
  * and settings tabs render from. C19 judges THIS, entry by entry: the
90
90
  * SDK's executor implements it with `placeActions` over `actionsOf(doc)`,
91
91
  * each entry decorated with `slashNameOf`; core implements it with
92
92
  * `listSessionActions`'s placement (its `specSlug` is `specId` here).
93
93
  * Optional because a validator-only host has no listing — C19 then fails
94
94
  * naming the missing seam, rather than judging a rule the kit applied on
95
- * the host's behalf, which any host would pass (U7 review, C1).
95
+ * the host's behalf, which any host would pass.
96
96
  */
97
97
  listActions?(doc: SpecDocument, channel: string): VenueListings<ListedAction> | Promise<VenueListings<ListedAction>>;
98
98
  /**
@@ -107,7 +107,7 @@ export interface HostUnderTest {
107
107
  shipped?(): ShippedCatalogue | Promise<ShippedCatalogue>;
108
108
  /**
109
109
  * The **event map** this host draws for one genre, with each node's
110
- * termination policy — C29's evidence (PLAN-turn-order §B3). The graph is
110
+ * termination policy — C29's evidence. The graph is
111
111
  * the host's own (the app's `eventMap`), never one the kit derives, and a
112
112
  * termination policy is the host's statement of how a loop through that
113
113
  * node stops: auto-advance's cause rule and cap, or the run caps that park
@@ -117,14 +117,14 @@ export interface HostUnderTest {
117
117
  eventMap?(genre: string): EventMapEvidence | Promise<EventMapEvidence>;
118
118
  /**
119
119
  * The BUILT component modules this host ships or has been handed — C30's
120
- * evidence for what a module may carry (§3.5).
120
+ * evidence for what a module may carry.
121
121
  */
122
122
  components?(): BuiltComponent[] | Promise<BuiltComponent[]>;
123
123
  /**
124
124
  * Mount a built component module the way this host's page does — its
125
125
  * worker, its gate — in a **plugin's box** (never core's), with these
126
126
  * sections pushed and, when given, these scopes granted and only these
127
- * base sections read (`reads`, R75 — the page withholds every other base
127
+ * base sections read (`reads` — the page withholds every other base
128
128
  * section, as it does from a widget that declared them); show the kit the
129
129
  * result. C30 mounts its own fixture through it; C31 mounts every module
130
130
  * `components()` lists. The SDK harness takes both as they are
@@ -147,7 +147,7 @@ export interface HostUnderTest {
147
147
  remote: ComponentView;
148
148
  }>;
149
149
  /**
150
- * The swaps offered to this host (R28/R29) — a package's manifest's
150
+ * The swaps offered to this host — a package's manifest's
151
151
  * `swaps`, each with the declaration of the definition it seats
152
152
  * (`swapsFromManifest`). C32 fits each against `pinnedDefinition`; C33
153
153
  * probes each definition's handler.
@@ -182,19 +182,20 @@ export interface HostUnderTest {
182
182
  */
183
183
  hookCtxKeys?(kind: HookCtxKind): readonly string[] | undefined | Promise<readonly string[] | undefined>;
184
184
  /**
185
- * How this host mounts a frame surface (20 §12). Optional; without it C26
185
+ * How this host mounts a frame surface. Optional; without it C26
186
186
  * names the gap rather than judging a boundary the kit cannot see.
187
187
  */
188
188
  frameMount?(): FrameMount | Promise<FrameMount>;
189
189
  /**
190
- * One entry per door this host has (01 §13). The kit feeds each
190
+ * One entry per door this host has. The kit feeds each
191
191
  * registered verdict's `failing(door)` input through it and expects
192
192
  * `judge(failing).sentence` back (the en text) somewhere in what the door
193
193
  * refused with; `null` if the door heard the input and did not refuse —
194
194
  * a failure, the rule is not heard there; `undefined` if this host's door
195
195
  * does not hear that verdict at all — a gap, named on the result (the
196
196
  * SDK's `registry` is `register()`, which never judges what a host can
197
- * run, so R-2's publication half is the app's to answer there). The entry
197
+ * run, so the publication half of `core:verdict/provisional` is the app's
198
+ * to answer there). The entry
198
199
  * drives the host's REAL door — `validate` runs its validator on a
199
200
  * document built to hit the verdict, `run` runs the executor and answers
200
201
  * the receipt's halt or note, `registry` registers a declaration and
@@ -204,7 +205,7 @@ export interface HostUnderTest {
204
205
  */
205
206
  doors?: Partial<Record<Door, (verdictId: string, failing: unknown) => string | null | undefined | Promise<string | null | undefined>>>;
206
207
  }
207
- /** @experimental What a host ships, for C24's read of the form surface (R-15). */
208
+ /** @experimental What a host ships, for C24's read of the form surface. */
208
209
  export interface ShippedCatalogue {
209
210
  genres: readonly GenreDecl[];
210
211
  presets: readonly PresetDecl[];
@@ -243,7 +244,7 @@ export interface CheckReport {
243
244
  * A half of the requirement this host could not be judged on, and why.
244
245
  * Recorded on the result as `skipped`, never as a failure — for a gap in
245
246
  * the host's shape rather than a law broken: C18(b) on a host whose
246
- * `run` refuses a document `validate()` refuses (U7 review, W1).
247
+ * `run` refuses a document `validate()` refuses.
247
248
  */
248
249
  skip(why: string): void;
249
250
  /**
@@ -278,8 +279,8 @@ export interface Requirement {
278
279
  export interface Fixtures {
279
280
  /**
280
281
  * A minimal chat turn: input → query → task → provider → write, the write
281
- * opening the run's **live row** (`create-message` with `generating: true`
282
- * — F7, W1). C16 holds the host to naming that row; a complete message
282
+ * opening the run's **live row** (`create-message` with `generating: true`).
283
+ * C16 holds the host to naming that row; a complete message
283
284
  * would be an ordinary write, and a run with none names no live row.
284
285
  */
285
286
  chatTurn(): SpecDocument;
@@ -293,17 +294,17 @@ export interface Fixtures {
293
294
  looped(max: number): SpecDocument;
294
295
  /**
295
296
  * Two `create-message` placeholders (`generating: true`) in one document,
296
- * an oracle between them (F37). Two live rows, which `validate()`
297
+ * an oracle between them. Two live rows, which `validate()`
297
298
  * refuses under F7 — that refusal IS the one-live-row law at publish
298
- * (a complete message beside them would be an ordinary write, W1), and C16(a) holds the host to it. Never run: the run
299
+ * (a complete message beside them would be an ordinary write), and C16(a) holds the host to it. Never run: the run
299
300
  * half of the law is proved on `chatTurn()`, a document the host can
300
- * publish (U7 review, W1).
301
+ * publish.
301
302
  */
302
303
  twoWrites(): SpecDocument;
303
304
  /**
304
- * A document contributing actions (F40): at least one `quick`, one not,
305
+ * A document contributing actions: at least one `quick`, one not,
305
306
  * one on a named channel, one whose `key` is a core verb's (a different
306
- * identity, never shadowing it — plans/31 V2). Every
307
+ * identity, never shadowing it). Every
307
308
  * one of them must be reachable from its venue's listing.
308
309
  */
309
310
  actions(): SpecDocument;
@@ -320,8 +321,8 @@ export interface Fixtures {
320
321
  because: string;
321
322
  }>;
322
323
  /**
323
- * A document with a **live-row** outlet inside a repeating clause (01 §4,
324
- * W1) — an `each` or loop body. One reply row per pass is N live rows;
324
+ * A document with a **live-row** outlet inside a repeating clause
325
+ * — an `each` or loop body. One reply row per pass is N live rows;
325
326
  * other writes may repeat, and any write may sit in a gather or a
326
327
  * junction. Optional; without it C21 judges the two-live-rows half alone
327
328
  * and names the fixture it is missing.
@@ -330,8 +331,8 @@ export interface Fixtures {
330
331
  /**
331
332
  * A **parallel** gather whose chains each end in a write, the first chain
332
333
  * declared finishing LAST (a slow node before its write). C8 holds the
333
- * host to committing the writes in declaration order in both modes (01 §4,
334
- * W1b). Optional; without it C8 judges its results half alone and names
334
+ * host to committing the writes in declaration order in both
335
+ * modes. Optional; without it C8 judges its results half alone and names
335
336
  * the fixture it is missing.
336
337
  */
337
338
  gatherWrites?(): SpecDocument;
@@ -344,10 +345,20 @@ export interface Fixtures {
344
345
  * not judged.
345
346
  */
346
347
  worldAction?(): SpecDocument;
348
+ /**
349
+ * 🚧 The **summarize-scene** specs to judge (live scenes §13.5) — a
350
+ * genre's own, as `summarizeScene()` builds them, or one ejected to its
351
+ * graph. C34 runs each with the kit's stand-ins for the source, the
352
+ * source's attachments, the cast, the model calls and the save, and the
353
+ * HOST's bindings for the two pure
354
+ * steps between them (`core:task/render-transcript@1`,
355
+ * `core:task/batch-messages@2`). Optional; without it C34 is skipped.
356
+ */
357
+ summarizeScenes?(): SpecDocument[];
347
358
  bindings(over?: Bindings): Bindings;
348
359
  world: RunOptions['world'];
349
360
  /**
350
- * How many writes the world has taken so far (F38), for a host whose
361
+ * How many writes the world has taken so far, for a host whose
351
362
  * writes the kit cannot watch through `RunOptions.host` — a row count in a
352
363
  * test database, say. Optional: the kit's own probe covers a host that
353
364
  * 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 (03 §9).
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,14 @@
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
21
  // One verdict per law (01 §13): C27 enumerates what is registered and holds
22
22
  // the host's doors to each verdict's own sentence.
23
23
  import { i18nText, verdicts } from '@serene-pub/sdk';
24
24
  /**
25
- * The plugin grant table (plans/29 R-3), imported rather than restated.
25
+ * The plugin grant table, imported rather than restated.
26
26
  * `pluginHarness.ts` keeps it byte-for-byte with the two sandboxes' programs
27
27
  * and the app's `hookCtx.ts`, and its docblock says what a further copy would
28
28
  * be: the drift the install-time check exists to catch. C25 judges a host's
@@ -109,7 +109,7 @@ const headline = (e) => {
109
109
  const law = lines.slice(1).find((l) => l.startsWith('['));
110
110
  return law ? `${lines[0]} ${law}` : (lines[0] ?? '');
111
111
  };
112
- /** Said up front by every C18(b) failure on a refused document (U7 review, W1). */
112
+ /** Said up front by every C18(b) failure on a refused document. */
113
113
  const UNVALIDATED = 'C18(b) runs a document validate() refuses, on purpose — a host that skips validation must ' +
114
114
  'still hand out no setting; a host that cannot run an unvalidated document needs a run seam ' +
115
115
  'that skips publish-time validation';
@@ -1295,7 +1295,113 @@ export const REQUIREMENTS = [
1295
1295
  must(!failed.length, failed.join('\n'));
1296
1296
  },
1297
1297
  },
1298
+ {
1299
+ id: 'C34',
1300
+ law: 'live scenes §13.5 (2026-10-13)',
1301
+ 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',
1302
+ 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.',
1303
+ async check(host, fx, report) {
1304
+ const docs = fx.summarizeScenes?.() ?? [];
1305
+ if (!docs.length)
1306
+ return report.skip('no fixture supplies summarize-scene specs — supply `summarizeScenes()` for C34 to judge them');
1307
+ for (const doc of docs)
1308
+ await judgeSummarizeScene(host, fx, doc);
1309
+ },
1310
+ },
1298
1311
  ];
1312
+ // ── C34: the summarize-scene fixture ────────────────────────────────────────
1313
+ /**
1314
+ * The span C34 runs a summarize-scene spec over: two story lines and an aside
1315
+ * on a channel no genre declares. Rows in the `summarize-source@2` row shape
1316
+ * (`id`, `role`, `senderName`, `content`, `channel`).
1317
+ */
1318
+ const SCENE_STORY = [
1319
+ { id: 9101, role: 'user', senderName: 'Ada', content: 'We push the door open.', channel: 'main' },
1320
+ { id: 9102, role: 'assistant', senderName: 'Bram', content: 'The hinges scream; something below goes quiet.', channel: 'main' },
1321
+ ];
1322
+ const SCENE_ASIDE = [
1323
+ { id: 9103, role: 'user', senderName: 'Ada', content: 'Make the next room colder.', channel: 'conformance-unknown' },
1324
+ ];
1325
+ const SCENE_CAST = { characters: [{ id: 1, name: 'Bram' }], personas: [], envoys: [] };
1326
+ const SCENE_SUMMARY = 'The party opened the door, and something below went quiet.';
1327
+ const C34_DEFINITIONS = {
1328
+ inlet: 'core:inlet/summarize-request@1',
1329
+ render: 'core:task/render-transcript@1',
1330
+ outlet: 'save',
1331
+ read: ['synth', 'naming'],
1332
+ };
1333
+ /**
1334
+ * A document node's pin, `id@version`: a built node stores the id bare and
1335
+ * the version beside it; a receipt's row may carry either form.
1336
+ */
1337
+ const pinOf = (n) => /@\d+$/.test(n.definitionId) ? n.definitionId : `${n.definitionId}@${n.definitionVersion ?? 1}`;
1338
+ async function judgeSummarizeScene(host, fx, doc) {
1339
+ const id = doc.id ?? '(unnamed spec)';
1340
+ const nodes = (doc.nodes ?? []).map((n) => ({ ...n, definitionId: pinOf(n) }));
1341
+ const renderKey = nodes.find((n) => n.definitionId === C34_DEFINITIONS.render)?.key;
1342
+ const inlet = nodes.find((n) => n.kind === 'inlet');
1343
+ 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`);
1344
+ const save = nodes.find((n) => n.key === C34_DEFINITIONS.outlet);
1345
+ must(save?.kind === 'outlet', `${id}: no outlet keyed '${C34_DEFINITIONS.outlet}' — the scenes socket previews to it`);
1346
+ for (const key of C34_DEFINITIONS.read)
1347
+ must(nodes.some((n) => n.key === key), `${id}: no node keyed '${key}' — the scenes socket reads the summary off it`);
1348
+ 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`);
1349
+ const errors = host.validate(doc).filter((f) => f.severity === 'error');
1350
+ must(!errors.length, `${id}: validate() refuses it — ${errors.map((e) => `${e.law}: ${e.message}`).join('; ')}`);
1351
+ const run = async (story, asides, request) => {
1352
+ const saved = [];
1353
+ const receipt = await host.run(doc, {
1354
+ input: { scope: { sessionId: 1 }, request, session: {} },
1355
+ world: fx.world,
1356
+ bindings: fx.bindings({
1357
+ 'core:inlet/summarize-request@1': async (i) => ok(i),
1358
+ 'core:query/summarize-source@2': async () => ok({ main: story, messages: story, asides }),
1359
+ 'core:query/session-cast@1': async () => ok({ main: SCENE_CAST, cast: SCENE_CAST, envoys: [] }),
1360
+ // The span's rows are the kit's, so are their files: none.
1361
+ 'core:query/history-attachments@1': async () => ok({ main: {}, attachments: {} }),
1362
+ 'core:oracle/summarize-batch@1': async (i) => {
1363
+ const draft = `A draft of ${String(i?.batch ?? '').length} characters.`;
1364
+ return ok({ main: draft, draft });
1365
+ },
1366
+ 'core:oracle/summarize-synth@1': async () => ok({ main: SCENE_SUMMARY, content: SCENE_SUMMARY }),
1367
+ 'core:oracle/name-entry@1': async () => ok({ main: 'The Door', name: 'The Door' }),
1368
+ 'core:oracle/extract-cast@1': async () => {
1369
+ const cast = { participants: [], mentioned: [] };
1370
+ return ok({ main: cast, cast });
1371
+ },
1372
+ 'core:outlet/create-lore-entry@1': async (i) => {
1373
+ saved.push({ name: i?.name, content: i?.content });
1374
+ return ok({ main: 1, entryId: 1 });
1375
+ },
1376
+ }),
1377
+ });
1378
+ const render = receipt.nodes.find((n) => n.nodeKey === renderKey);
1379
+ const units = (render?.output?.units ?? undefined);
1380
+ return { receipt, saved, units };
1381
+ };
1382
+ // (a) The inlet in, the outlet out: a span with story and an aside on a
1383
+ // channel nothing declared reaches `save` with a name and a body.
1384
+ const full = await run(SCENE_STORY, SCENE_ASIDE, { messageIds: [9101, 9102, 9103], channel: 'main' });
1385
+ must(full.receipt.outcome === 'ok', `${id}: a span with an aside on an undeclared channel ended '${full.receipt.outcome}'` +
1386
+ (full.receipt.haltReason ? ` (${full.receipt.haltNodeKey}: ${full.receipt.haltReason})` : '') +
1387
+ ' — a plugin’s channel in the span must never stop a summary');
1388
+ 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`);
1389
+ // (b) Units carry message ids: every unit names a row of the span, and
1390
+ // every row of the span — the aside included — is in some unit.
1391
+ must(Array.isArray(full.units), `${id}: '${C34_DEFINITIONS.render}' published no \`units\` list`);
1392
+ const rows = [...SCENE_STORY, ...SCENE_ASIDE].map((r) => r.id);
1393
+ for (const u of full.units) {
1394
+ must(rows.includes(Number(u?.messageId)), `${id}: a transcript unit names message ${JSON.stringify(u?.messageId)}, which is not a row of the span`);
1395
+ must(typeof u?.text === 'string', `${id}: a transcript unit carries no text`);
1396
+ must(typeof u?.tokens === 'number', `${id}: a transcript unit carries no token count`);
1397
+ }
1398
+ for (const r of rows)
1399
+ 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`);
1400
+ // (c) An empty span: no rows at all is a quiet scene, not an error.
1401
+ const empty = await run([], [], { messageIds: [] });
1402
+ 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`);
1403
+ must(!empty.units || empty.units.length === 0, `${id}: an empty span rendered ${empty.units?.length} transcript units out of no rows`);
1404
+ }
1299
1405
  /**
1300
1406
  * The requirements a package's own declarations can fail, judged over its
1301
1407
  * BUILT artifact with no fixtures: what it ships (C28, C29), its component
@@ -8,7 +8,7 @@
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 (R28/R29), with the declaration of what it seats. */
11
+ /** @experimental One swap a package offers, with the declaration of what it seats. */
12
12
  export interface SwapEvidence {
13
13
  /** The spec the swap targets (`core:spec/chat-turn-order`). */
14
14
  spec: 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`, R75).
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`, R75).
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
- const grants = [...new Set(widgets.flatMap((w) => (w.scopes ?? []).filter((s) => !s.startsWith('channel:'))))];
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-2",
3
+ "version": "0.6.0-pr-5",
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-2"
36
+ "@serene-pub/sdk": "^0.6.0-pr-5"
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-2"
42
+ "@serene-pub/sdk": "0.6.0-pr-5"
43
43
  },
44
44
  "publishConfig": {
45
45
  "access": "public",