@serene-pub/sdk 0.6.0-pr-4 → 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.
Files changed (186) hide show
  1. package/README.md +23 -19
  2. package/dist/actions.d.ts +149 -67
  3. package/dist/actions.js +89 -35
  4. package/dist/annexFields.d.ts +8 -4
  5. package/dist/annexFields.js +5 -2
  6. package/dist/announce.d.ts +78 -28
  7. package/dist/announce.js +14 -5
  8. package/dist/attributes.d.ts +9 -6
  9. package/dist/attributes.js +9 -5
  10. package/dist/bands.d.ts +41 -6
  11. package/dist/bands.js +83 -33
  12. package/dist/builder.d.ts +161 -58
  13. package/dist/builder.js +128 -22
  14. package/dist/candidates.d.ts +5 -3
  15. package/dist/candidates.js +3 -2
  16. package/dist/clauses.d.ts +2 -1
  17. package/dist/clauses.js +2 -1
  18. package/dist/component.d.ts +24 -7
  19. package/dist/component.js +16 -6
  20. package/dist/componentBuild.d.ts +16 -5
  21. package/dist/componentBuild.js +14 -5
  22. package/dist/componentClient.d.ts +61 -30
  23. package/dist/componentClient.js +11 -1
  24. package/dist/componentImports.d.ts +8 -5
  25. package/dist/componentImports.js +23 -4
  26. package/dist/componentModule.js +2 -1
  27. package/dist/componentWire.d.ts +2 -1
  28. package/dist/componentWire.js +34 -2
  29. package/dist/config.d.ts +28 -14
  30. package/dist/config.js +20 -10
  31. package/dist/connections.d.ts +9 -4
  32. package/dist/connections.js +7 -4
  33. package/dist/declarations.d.ts +46 -17
  34. package/dist/declarations.js +46 -15
  35. package/dist/descriptors.d.ts +242 -97
  36. package/dist/descriptors.js +145 -41
  37. package/dist/dev.d.ts +6 -5
  38. package/dist/dev.js +6 -5
  39. package/dist/document.d.ts +74 -25
  40. package/dist/document.js +32 -11
  41. package/dist/dowry.d.ts +241 -0
  42. package/dist/dowry.js +315 -0
  43. package/dist/engines.d.ts +16 -7
  44. package/dist/engines.js +6 -4
  45. package/dist/eventMapLaws.d.ts +19 -8
  46. package/dist/eventMapLaws.js +9 -6
  47. package/dist/events.d.ts +101 -39
  48. package/dist/events.js +106 -33
  49. package/dist/executor.d.ts +122 -41
  50. package/dist/executor.js +188 -95
  51. package/dist/extension.d.ts +99 -35
  52. package/dist/extension.js +43 -9
  53. package/dist/facets.d.ts +2 -1
  54. package/dist/facets.js +4 -2
  55. package/dist/foldedSections.d.ts +4 -2
  56. package/dist/foldedSections.js +2 -1
  57. package/dist/genres.d.ts +123 -41
  58. package/dist/genres.js +127 -22
  59. package/dist/guardedConnection.d.ts +4 -3
  60. package/dist/guardedConnection.js +4 -3
  61. package/dist/handlebarsReach.d.ts +1 -1
  62. package/dist/handlebarsReach.js +1 -1
  63. package/dist/hash.d.ts +16 -5
  64. package/dist/hash.js +14 -4
  65. package/dist/hookGrants.d.ts +3 -2
  66. package/dist/hookGrants.js +6 -4
  67. package/dist/hooks.d.ts +21 -16
  68. package/dist/hooks.js +12 -10
  69. package/dist/hostElements.d.ts +41 -17
  70. package/dist/hostElements.js +49 -17
  71. package/dist/i18n.d.ts +5 -3
  72. package/dist/i18n.js +5 -3
  73. package/dist/identity.d.ts +4 -3
  74. package/dist/identity.js +4 -3
  75. package/dist/index.d.ts +5 -0
  76. package/dist/index.js +15 -0
  77. package/dist/layout.d.ts +36 -15
  78. package/dist/layout.js +2 -2
  79. package/dist/loadouts.d.ts +97 -0
  80. package/dist/loadouts.js +81 -0
  81. package/dist/media.d.ts +26 -4
  82. package/dist/media.js +2 -1
  83. package/dist/messageBlocks.d.ts +44 -32
  84. package/dist/messageBlocks.js +23 -18
  85. package/dist/migration.d.ts +16 -8
  86. package/dist/migration.js +14 -8
  87. package/dist/names.d.ts +2 -1
  88. package/dist/names.js +2 -1
  89. package/dist/nodeInput.d.ts +2 -1
  90. package/dist/nodeInput.js +2 -1
  91. package/dist/participants.d.ts +22 -15
  92. package/dist/participants.js +14 -12
  93. package/dist/personGate.d.ts +2 -1
  94. package/dist/personGate.js +2 -1
  95. package/dist/pluginHarness.d.ts +8 -3
  96. package/dist/pluginHarness.js +4 -2
  97. package/dist/pluginPermissions.d.ts +2 -1
  98. package/dist/pluginPermissions.js +12 -1
  99. package/dist/pluginRuleRef.d.ts +2 -2
  100. package/dist/pluginRuleRef.js +1 -1
  101. package/dist/predicates.d.ts +16 -11
  102. package/dist/predicates.js +7 -6
  103. package/dist/preview.d.ts +8 -3
  104. package/dist/preview.js +2 -1
  105. package/dist/promptBlocks.d.ts +5 -3
  106. package/dist/promptBlocks.js +5 -3
  107. package/dist/rankingDecisions.d.ts +2 -1
  108. package/dist/rankingDecisions.js +2 -1
  109. package/dist/receipt.d.ts +65 -29
  110. package/dist/receipt.js +9 -4
  111. package/dist/receiverRules.js +3 -2
  112. package/dist/refs.d.ts +34 -9
  113. package/dist/refs.js +33 -13
  114. package/dist/registry.d.ts +42 -23
  115. package/dist/registry.js +7 -5
  116. package/dist/review.d.ts +16 -5
  117. package/dist/review.js +11 -4
  118. package/dist/sampling.d.ts +54 -0
  119. package/dist/sampling.js +95 -3
  120. package/dist/sceneSettings.d.ts +312 -0
  121. package/dist/sceneSettings.js +425 -0
  122. package/dist/scope.d.ts +6 -4
  123. package/dist/scope.js +4 -3
  124. package/dist/scripts.d.ts +81 -14
  125. package/dist/scripts.js +90 -11
  126. package/dist/sessionDossier.d.ts +521 -0
  127. package/dist/sessionDossier.js +33 -0
  128. package/dist/sessionLayout.d.ts +303 -19
  129. package/dist/sessionLayout.js +354 -40
  130. package/dist/sessionSettings.d.ts +8 -5
  131. package/dist/settings.d.ts +45 -20
  132. package/dist/settings.js +19 -12
  133. package/dist/settingsSlot.d.ts +11 -8
  134. package/dist/settingsSlot.js +11 -8
  135. package/dist/shapes.d.ts +99 -36
  136. package/dist/shapes.js +101 -35
  137. package/dist/sheets.d.ts +4 -2
  138. package/dist/sheets.js +6 -3
  139. package/dist/statShapes.d.ts +2 -1
  140. package/dist/statShapes.js +2 -1
  141. package/dist/status.d.ts +13 -9
  142. package/dist/status.js +8 -6
  143. package/dist/storage.d.ts +2 -1
  144. package/dist/storage.js +2 -1
  145. package/dist/storyTime.d.ts +13 -7
  146. package/dist/storyTime.js +11 -6
  147. package/dist/strokes.d.ts +176 -0
  148. package/dist/strokes.js +281 -0
  149. package/dist/surfaces.d.ts +54 -25
  150. package/dist/surfaces.js +3 -3
  151. package/dist/template.d.ts +9 -5
  152. package/dist/template.js +5 -3
  153. package/dist/templateCheck.d.ts +2 -2
  154. package/dist/templateCheck.js +2 -2
  155. package/dist/templateFit.d.ts +37 -8
  156. package/dist/templateFit.js +92 -8
  157. package/dist/templateIds.d.ts +3 -3
  158. package/dist/templateIds.js +3 -3
  159. package/dist/templateScopeAt.d.ts +21 -11
  160. package/dist/templateScopeAt.js +21 -11
  161. package/dist/testing.d.ts +11 -4
  162. package/dist/testing.js +13 -5
  163. package/dist/tokenizers.d.ts +2 -2
  164. package/dist/tokenizers.js +2 -2
  165. package/dist/turnLock.d.ts +4 -2
  166. package/dist/turnLock.js +2 -1
  167. package/dist/turnOrder.d.ts +17 -11
  168. package/dist/turnOrder.js +9 -5
  169. package/dist/validate.d.ts +11 -8
  170. package/dist/validate.js +81 -10
  171. package/dist/values.d.ts +17 -8
  172. package/dist/values.js +11 -6
  173. package/dist/variables.d.ts +46 -7
  174. package/dist/variables.js +87 -6
  175. package/dist/verdicts.d.ts +20 -13
  176. package/dist/verdicts.js +17 -11
  177. package/dist/widgetDecls.d.ts +8 -4
  178. package/dist/widgetDecls.js +4 -2
  179. package/dist/widgets.d.ts +987 -94
  180. package/dist/widgets.js +93 -18
  181. package/dist/wire.d.ts +13 -6
  182. package/dist/wire.js +3 -3
  183. package/dist/worldinfo.d.ts +11 -6
  184. package/dist/worldinfo.js +8 -4
  185. package/host-elements.d.ts +13 -0
  186. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The component client's contract (§3.5, C3): what a remote component is
2
+ * The component client's contract: what a remote component is
3
3
  * handed. The host implements it in the page's UI worker over the widget
4
4
  * wire — the same sections a native widget reads off its context and a
5
5
  * frame is posted, and the same verbs back — and `@serene-pub/component-client`
@@ -7,46 +7,66 @@
7
7
  *
8
8
  * A component module exports one mount function: it draws into `root`
9
9
  * (placing elements from `SP_HOST_ELEMENTS`) and returns a cleanup.
10
+ *
11
+ * **A component never types `v1`.** `.v1` is the wire's version clock: the
12
+ * envelope ({@link WidgetData}) carries each section as `{ v1 }`, and the
13
+ * component client unwraps the current version — `ctx.messages` is
14
+ * `messages.v1`, `ctx.scope('session:state')` is `session_state.v1`. When a
15
+ * section ships a `v2`, the client is the one place that picks.
16
+ *
17
+ * New to the project's words (scope, section, grant, dossier)? See the
18
+ * vocabulary page, `guides/vocabulary.md`.
19
+ * @ruling §3.5, C3
10
20
  */
11
- import type { ViewerV1, WidgetRequestKind, WidgetRequests, WidgetScopedSectionValues, WidgetSectionScope } from './widgets.js';
12
- import type { TurnOrderV1 } from './turnOrder.js';
13
- /** Every section the host pushes, as the latest value received. @experimental */
14
- export interface ComponentSections {
15
- session?: unknown;
16
- messages?: unknown[];
21
+ import type { MessageV1, WidgetBaseSection, WidgetData, WidgetEvent, WidgetRequestKind, WidgetRequests, WidgetScopedSections, WidgetScopedSectionValues, WidgetSectionScope, WidgetWriteGrant } from './widgets.js';
22
+ /**
23
+ * Every base section of the envelope ({@link WidgetData}) but `channels`,
24
+ * flat: the section's current version, `undefined` until the host posts it.
25
+ * Derived, never hand-listed — a base section added to `WidgetData` is here
26
+ * at once, and the component wire does not compile until it hands it over.
27
+ * (`channels` differs on purpose: the envelope's is the declared slugs; a
28
+ * component is handed each lane's rows, below.)
29
+ * @experimental
30
+ */
31
+ export type ComponentBaseSections = {
32
+ [S in Exclude<WidgetBaseSection, 'channels'>]?: WidgetData[S]['v1'];
33
+ };
34
+ /**
35
+ * Every section the host pushes, as the latest value received.
36
+ *
37
+ * `session`, `messages`, `layout`, `actions`, `props`, `settings`, `annex`,
38
+ * `locale`, `viewer` (🚧 who is looking), `turnOrder`, `attendance` — each
39
+ * that section's `v1`, from {@link ComponentBaseSections}.
40
+ * @experimental
41
+ */
42
+ export interface ComponentSections extends ComponentBaseSections {
17
43
  /** Per-lane rows, when the widget declared channels. */
18
- channels: Record<string, unknown[]>;
19
- settings?: Record<string, unknown>;
20
- actions?: unknown;
21
- annex?: Record<string, unknown>;
22
- props?: Record<string, unknown>;
44
+ channels: Record<string, MessageV1[]>;
23
45
  theme?: {
24
46
  theme: string;
25
47
  mode: 'light' | 'dark';
26
48
  };
27
- /** The viewer's language code — render a locale map with `i18nText(text, ctx.locale)`. */
28
- locale?: string;
29
- /** 🚧 Who is looking: `{ userId, isAdmin, isGuest }`. */
30
- viewer?: ViewerV1;
31
- /** The session's turn order: who is due, in order, and who could be (`turnOrder.v1`). */
32
- turnOrder?: TurnOrderV1;
33
49
  /**
34
- * 🚧 The scoped sections this widget was granted, by their posted name
35
- * (`session_full`, `session_state`, …) — the SDK's one table
36
- * (`WidgetScopedSections`), each its section's `v1`.
50
+ * 🚧 The raw bag: the scoped sections this widget was granted, by their
51
+ * posted name (`session_full`, `session_state`, …) — the SDK's one table
52
+ * (`WidgetScopedSections`), each its section's `v1`. Read one with
53
+ * {@link ComponentContext.scope}, by the scope you declared; this bag is
54
+ * for code that walks every section.
37
55
  */
38
56
  scoped: Partial<WidgetScopedSectionValues>;
39
57
  /**
40
- * 🚧 The scopes this widget holds, BARE (`session:state`, never
58
+ * 🚧 The scopes and write grants this widget holds, BARE
59
+ * (`session:state`, `session:state:write`, `channel:main:write`; never
41
60
  * `widget:session:state`) — as the host last said (`grants`), on mount
42
61
  * and whenever an admin's review changes them. `undefined` until the host
43
62
  * says (and from a host that never does). So a component tells "this
44
63
  * scope was not granted" (drawn as such) from "its section has not been
45
64
  * posted yet" (drawn as loading) — both of which are an absent `scoped`
46
- * entry. Read one scope with {@link ComponentContext.granted}.
65
+ * entry — and can hide a button whose write it does not hold. A write
66
+ * grant ({@link WidgetWriteGrant}) pushes no section of its own. Read one
67
+ * with {@link ComponentContext.granted}.
47
68
  */
48
- grants?: readonly WidgetSectionScope[];
49
- layout?: unknown;
69
+ grants?: readonly (WidgetSectionScope | WidgetWriteGrant)[];
50
70
  /** The view state this widget saved last time, handed back once on mount. */
51
71
  state?: unknown;
52
72
  suspended: boolean;
@@ -66,7 +86,7 @@ export interface ComponentContext extends Readonly<ComponentSections> {
66
86
  /** Called with the section's name whenever the host pushes one. */
67
87
  subscribe(fn: (section: ComponentSection) => void): () => void;
68
88
  /** Widget events (`message:created`, `layout:changed`, …). */
69
- onEvent(fn: (event: unknown) => void): () => void;
89
+ onEvent(fn: (event: WidgetEvent) => void): () => void;
70
90
  /** Press an action by key or identity, as the native `invoke` verb does. */
71
91
  invoke(key: string, args?: ComponentInvokeArgs): void;
72
92
  /**
@@ -87,11 +107,22 @@ export interface ComponentContext extends Readonly<ComponentSections> {
87
107
  */
88
108
  t(source: string): string;
89
109
  /**
90
- * 🚧 Was `scope` granted? `true` or `false` once the host has said
91
- * (`grants`); `undefined` before it has — so `false` is the one answer
92
- * that means "draw not granted", and `undefined` still means "wait".
110
+ * 🚧 Was `scope` — or a write grant, `session:state:write`,
111
+ * `channel:<slug>:write` — granted? `true` or `false` once the host has
112
+ * said (`grants`); `undefined` before it has — so `false` is the one
113
+ * answer that means "draw not granted", and `undefined` still means "wait".
114
+ * A widget that asks `send`, `draft` or `set-attribute-value` checks its
115
+ * write grant here before it offers the button.
116
+ */
117
+ granted(scope: WidgetSectionScope | WidgetWriteGrant): boolean | undefined;
118
+ /**
119
+ * 🚧 The section a granted scope delivers, by the same string `scopes`
120
+ * and `granted` take: `ctx.scope('session:state')` is the session's
121
+ * stats and states. `undefined` when it is not granted, or not posted
122
+ * yet — {@link granted} tells the two apart. (Not `scopes`: that is the
123
+ * list a widget declares.)
93
124
  */
94
- granted(scope: WidgetSectionScope): boolean | undefined;
125
+ scope<S extends WidgetSectionScope>(scope: S): WidgetScopedSectionValues[WidgetScopedSections[S]['section']] | undefined;
95
126
  }
96
127
  /** What a component module exports: mount into `root`; return a cleanup. @experimental */
97
128
  export type ComponentMountFn = (root: HTMLElement, ctx: ComponentContext) => void | (() => void);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The component client's contract (§3.5, C3): what a remote component is
2
+ * The component client's contract: what a remote component is
3
3
  * handed. The host implements it in the page's UI worker over the widget
4
4
  * wire — the same sections a native widget reads off its context and a
5
5
  * frame is posted, and the same verbs back — and `@serene-pub/component-client`
@@ -7,6 +7,16 @@
7
7
  *
8
8
  * A component module exports one mount function: it draws into `root`
9
9
  * (placing elements from `SP_HOST_ELEMENTS`) and returns a cleanup.
10
+ *
11
+ * **A component never types `v1`.** `.v1` is the wire's version clock: the
12
+ * envelope ({@link WidgetData}) carries each section as `{ v1 }`, and the
13
+ * component client unwraps the current version — `ctx.messages` is
14
+ * `messages.v1`, `ctx.scope('session:state')` is `session_state.v1`. When a
15
+ * section ships a `v2`, the client is the one place that picks.
16
+ *
17
+ * New to the project's words (scope, section, grant, dossier)? See the
18
+ * vocabulary page, `guides/vocabulary.md`.
19
+ * @ruling §3.5, C3
10
20
  */
11
21
  /** Types a component's mount function; returns it unchanged. @experimental */
12
22
  export const defineComponent = (fn) => fn;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * What a component may import (§3.5, R23, R35).
2
+ * What a component may import.
3
3
  *
4
4
  * A component's source imports `svelte`, the component client and the
5
5
  * unstyled controls — and places `sp-*` elements (`hostElements.ts`). It
@@ -19,24 +19,27 @@
19
19
  * 3. **Runtime** — the worker's own CSP and the bootstrap's stripped network
20
20
  * globals.
21
21
  *
22
- * Preact, the React alias and `htm` arrive after 1.0 (R35); the list grows,
22
+ * Preact, the React alias and `htm` arrive after 1.0; the list grows,
23
23
  * it never shrinks.
24
+ * @ruling §3.5, R23, R35, R35
24
25
  */
25
26
  /**
26
27
  * Bare specifiers a component may import. A trailing `/*` admits subpaths.
27
28
  *
28
- * The last seven are experimental (C6 P1, owner ruling 2026-09-25 Q4): the
29
+ * The last eight are experimental: the
29
30
  * SDK's component subpath and core's UI kit — the helpers core's own
30
31
  * components are written against — so a clone of a core component compiles
31
32
  * in-app from its source, and a CLI modder has the same kit. Each names ONE
32
33
  * module (no `/*`): nothing else of the SDK's or core-catalog's is admitted.
33
34
  * @experimental
35
+ * @ruling C6 P1, owner ruling 2026-09-25 Q4
34
36
  */
35
- export declare const COMPONENT_IMPORTS: readonly ['svelte', 'svelte/*', '@serene-pub/component-client', '@serene-pub/component-client/*', '@serene-pub/controls', '@serene-pub/sdk/component', '@serene-pub/core-catalog/conversation', '@serene-pub/core-catalog/lore-entries', '@serene-pub/core-catalog/scene-portraits', '@serene-pub/core-catalog/session-state', '@serene-pub/core-catalog/widgets', '@serene-pub/core-catalog/authors-note'];
37
+ export declare const COMPONENT_IMPORTS: readonly ['svelte', 'svelte/*', '@serene-pub/component-client', '@serene-pub/component-client/*', '@serene-pub/controls', '@serene-pub/sdk/component', '@serene-pub/core-catalog/conversation', '@serene-pub/core-catalog/lore-entries', '@serene-pub/core-catalog/scene-portraits', '@serene-pub/core-catalog/session-state', '@serene-pub/core-catalog/widgets', '@serene-pub/core-catalog/authors-note', '@serene-pub/core-catalog/turn-order', '@serene-pub/core-catalog/actions', '@serene-pub/core-catalog/annex', '@serene-pub/core-catalog/album', '@serene-pub/core-catalog/chronicle', '@serene-pub/core-catalog/places', '@serene-pub/core-catalog/attendance', '@serene-pub/core-catalog/backdrop'];
36
38
  /**
37
39
  * Specifiers no component may import, however it is built — the renderer is
38
- * the host's (R23), and so is the worker runtime that installs it.
40
+ * the host's, and so is the worker runtime that installs it.
39
41
  * @experimental
42
+ * @ruling R23
40
43
  */
41
44
  export declare const COMPONENT_FORBIDDEN_IMPORTS: readonly ['@remote-dom/*', '@serene-pub/component-client/worker-runtime'];
42
45
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * What a component may import (§3.5, R23, R35).
2
+ * What a component may import.
3
3
  *
4
4
  * A component's source imports `svelte`, the component client and the
5
5
  * unstyled controls — and places `sp-*` elements (`hostElements.ts`). It
@@ -19,18 +19,20 @@
19
19
  * 3. **Runtime** — the worker's own CSP and the bootstrap's stripped network
20
20
  * globals.
21
21
  *
22
- * Preact, the React alias and `htm` arrive after 1.0 (R35); the list grows,
22
+ * Preact, the React alias and `htm` arrive after 1.0; the list grows,
23
23
  * it never shrinks.
24
+ * @ruling §3.5, R23, R35, R35
24
25
  */
25
26
  /**
26
27
  * Bare specifiers a component may import. A trailing `/*` admits subpaths.
27
28
  *
28
- * The last seven are experimental (C6 P1, owner ruling 2026-09-25 Q4): the
29
+ * The last eight are experimental: the
29
30
  * SDK's component subpath and core's UI kit — the helpers core's own
30
31
  * components are written against — so a clone of a core component compiles
31
32
  * in-app from its source, and a CLI modder has the same kit. Each names ONE
32
33
  * module (no `/*`): nothing else of the SDK's or core-catalog's is admitted.
33
34
  * @experimental
35
+ * @ruling C6 P1, owner ruling 2026-09-25 Q4
34
36
  */
35
37
  export const COMPONENT_IMPORTS = [
36
38
  'svelte',
@@ -47,11 +49,28 @@ export const COMPONENT_IMPORTS = [
47
49
  // 🚧 2026-10-02 (AN1): the author's note widget's plain half — appended,
48
50
  // so the list only grows.
49
51
  '@serene-pub/core-catalog/authors-note',
52
+ // 🚧 2026-10-10 (W1): the turn order widget's plain half — appended.
53
+ '@serene-pub/core-catalog/turn-order',
54
+ // 🚧 2026-10-11 (W8): the actions widget's plain half — appended.
55
+ '@serene-pub/core-catalog/actions',
56
+ // 🚧 2026-10-11 (W9): the annex widget's plain half — appended.
57
+ '@serene-pub/core-catalog/annex',
58
+ // 🚧 2026-10-11 (W2): the album widget's plain half — appended.
59
+ '@serene-pub/core-catalog/album',
60
+ // 🚧 2026-10-11 (W3): the chronicle widget's plain half — appended.
61
+ '@serene-pub/core-catalog/chronicle',
62
+ // 🚧 2026-10-11 (W4): the places widget's plain half — appended.
63
+ '@serene-pub/core-catalog/places',
64
+ // 🚧 2026-10-11 (W10): the Who's here widget's plain half — appended.
65
+ '@serene-pub/core-catalog/attendance',
66
+ // 🚧 2026-10-12 (DESIGN-image-generation §6.4): the backdrop widget's plain half — appended.
67
+ '@serene-pub/core-catalog/backdrop',
50
68
  ];
51
69
  /**
52
70
  * Specifiers no component may import, however it is built — the renderer is
53
- * the host's (R23), and so is the worker runtime that installs it.
71
+ * the host's, and so is the worker runtime that installs it.
54
72
  * @experimental
73
+ * @ruling R23
55
74
  */
56
75
  export const COMPONENT_FORBIDDEN_IMPORTS = ['@remote-dom/*', '@serene-pub/component-client/worker-runtime'];
57
76
  const matches = (specifier, pattern) => pattern.endsWith('/*')
@@ -1,5 +1,5 @@
1
1
  /**
2
- * What a BUILT component module may carry (§3.5, C4 / C30) — judged on the
2
+ * What a BUILT component module may carry — judged on the
3
3
  * module's text, as a host judges a package it is handed and the CLI judges
4
4
  * what it just wrote.
5
5
  *
@@ -19,6 +19,7 @@
19
19
  * Worker( is bad") is not code, and minified output (`import{a}from"x"`)
20
20
  * is read as the import it is. The CSP of the page's worker is the wall;
21
21
  * this says so at build time.
22
+ * @ruling §3.5, C4 / C30
22
23
  */
23
24
  import { isHostElement } from './hostElements.js';
24
25
  /** Keywords after which a `/` starts a regular expression, not a division. */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The component wire (§3.5, C2/C3b): what crosses between a page and its UI
2
+ * The component wire: what crosses between a page and its UI
3
3
  * worker, beside each mount's own widget-protocol port — and the worker
4
4
  * side of that port, the {@link ComponentContext} a component is handed.
5
5
  *
@@ -16,6 +16,7 @@
16
16
  * cannot overtake the DOM changes of the turn that sent it.
17
17
  *
18
18
  * @internal
19
+ * @ruling §3.5, C2/C3b
19
20
  */
20
21
  import type { ComponentContext } from './componentClient.js';
21
22
  import type { RequestDeclineCode } from './surfaces.js';
@@ -1,4 +1,19 @@
1
1
  import { WIDGET_SCOPED_SECTIONS, isWidgetScopedSectionName } from './widgets.js';
2
+ /**
3
+ * A grant a component may be told it holds: a scope the table names, or a
4
+ * write grant — `<scope>:write` on such a scope, or `channel:<slug>:write`.
5
+ * Anything else the host sends is dropped, as an unknown scope always was.
6
+ */
7
+ const isHeldGrant = (g) => {
8
+ if (typeof g !== 'string')
9
+ return false;
10
+ if (Object.hasOwn(WIDGET_SCOPED_SECTIONS, g))
11
+ return true;
12
+ if (!g.endsWith(':write'))
13
+ return false;
14
+ const base = g.slice(0, -':write'.length);
15
+ return Object.hasOwn(WIDGET_SCOPED_SECTIONS, base) || /^channel:\S+$/.test(base);
16
+ };
2
17
  /** The handle key a function is replaced by on the wire. @experimental */
3
18
  export const FN = '__spFn';
4
19
  /** @experimental */
@@ -116,10 +131,11 @@ export function createComponentContext(port) {
116
131
  return notify('scoped');
117
132
  }
118
133
  case 'grants': {
119
- // A list, or nothing new; only a scope the table names is kept.
134
+ // A list, or nothing new; only a scope the table names, or a
135
+ // write grant, is kept. Sections still key off the scopes alone.
120
136
  if (!Array.isArray(m.grants))
121
137
  return;
122
- data.grants = m.grants.filter((g) => typeof g === 'string' && Object.hasOwn(WIDGET_SCOPED_SECTIONS, g));
138
+ data.grants = m.grants.filter(isHeldGrant);
123
139
  return notify('grants');
124
140
  }
125
141
  case 'viewer':
@@ -128,6 +144,9 @@ export function createComponentContext(port) {
128
144
  case 'turn-order':
129
145
  data.turnOrder = m.turnOrder;
130
146
  return notify('turnOrder');
147
+ case 'attendance':
148
+ data.attendance = m.attendance;
149
+ return notify('attendance');
131
150
  case 'page':
132
151
  case 'response': {
133
152
  const waiting = pending.get(String(m.requestId));
@@ -257,12 +276,20 @@ export function createComponentContext(port) {
257
276
  get turnOrder() {
258
277
  return data.turnOrder;
259
278
  },
279
+ get attendance() {
280
+ return data.attendance;
281
+ },
260
282
  get grants() {
261
283
  return data.grants;
262
284
  },
263
285
  granted(scope) {
264
286
  return data.grants === undefined ? undefined : data.grants.includes(scope);
265
287
  },
288
+ // One spelling for the author: the scope they declared, looked up in
289
+ // the table, read off the raw bag. A withdrawn grant left no entry.
290
+ scope(scope) {
291
+ return data.scoped[WIDGET_SCOPED_SECTIONS[scope]];
292
+ },
266
293
  ready() {
267
294
  port.postMessage({ t: 'ready' });
268
295
  },
@@ -275,6 +302,11 @@ export function createComponentContext(port) {
275
302
  port.close();
276
303
  }
277
304
  };
305
+ // Every section a component is handed has a getter here: a base section
306
+ // added to `WidgetData` (and so to `ComponentSections`) does not compile
307
+ // until this object hands it over.
308
+ const handsEvery = true;
309
+ void handsEvery;
278
310
  return ctx;
279
311
  }
280
312
  //# sourceMappingURL=componentWire.js.map
package/dist/config.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  /**
2
- * Configuration resolution (12 §2). Four layers, first hit wins, evaluated
2
+ * Configuration resolution. Four layers, first hit wins, evaluated
3
3
  * independently per path — which is what makes an admin's connection change reach a
4
- * user who has customized their prompts (F20).
4
+ * user who has customized their prompts.
5
5
  *
6
- * ## The chain (R-10, ruled 2026-09-15; 09-B B8)
6
+ * ## The chain (ruled 2026-09-15)
7
7
  *
8
8
  * **`session · config · defaults · author`.**
9
9
  *
10
10
  * - `session` — a session's own override of a value (the *chat override* of
11
- * 12 §2's "pipeline → config → chat override").
11
+ * the "pipeline → config → chat override").
12
12
  * - `config` — the rows of the **selected config**: the config IS the
13
13
  * instance's tuning. An administrator's edit lands in the config (ruled
14
14
  * 2026-08-24), so there is no separate `instance` layer for it to be shadowed
@@ -20,19 +20,20 @@
20
20
  * - `author` — the definition's declared parameter defaults; the floor.
21
21
  *
22
22
  * `user` and `instance` stood in this list until 2026-09-16 and were pushed by
23
- * nothing: `world.ts` never projected a row at either (plans/29a §3). Their
23
+ * nothing: `world.ts` never projected a row at either. Their
24
24
  * semantics fold into `config` — the config an admin edits is the instance's
25
25
  * configuration — which is the 2026-08-24 ruling stated as a constant.
26
26
  *
27
27
  * Resolved run-wide *before* execution, which is why referencing another node's
28
- * config is not a data edge (F35).
28
+ * config is not a data edge.
29
29
  *
30
- * ## `config`, not `preset` (R1)
30
+ * ## `config`, not `preset`
31
31
  *
32
32
  * Two other things are called a preset — a **session preset** (the bundle a
33
33
  * session is born on) and an author's `.preset(…)` on a spec — and neither is
34
34
  * this layer, so the scope takes the canon's word for what it holds: the
35
35
  * **config**.
36
+ * @ruling 12 §2, F20, R-10, 09-B B8, 12 §2, plans/29a §3, F35, R1
36
37
  */
37
38
  import type { CapabilitySet } from './capabilities.js';
38
39
  /** @experimental */
@@ -101,7 +102,10 @@ export interface ConnectionRecord {
101
102
  id: string;
102
103
  name: string;
103
104
  kind: string;
104
- /** Readable — not a credential (01 §10). */
105
+ /**
106
+ * Readable — not a credential.
107
+ * @ruling 01 §10
108
+ */
105
109
  metadata: {
106
110
  contextLength?: number;
107
111
  tokenizer?: string;
@@ -180,7 +184,7 @@ export declare function slotConnectionModelId(value: unknown): string | number |
180
184
  * A resolved `connection` slot, as a binding receives it.
181
185
  *
182
186
  * `metadata` only — `material` is a credential and is injected by the executor
183
- * at call time (01 §10), so no node ever sees it.
187
+ * at call time, so no node ever sees it.
184
188
  *
185
189
  * `modelId` is the model half of the pair the slot named, carried through so a
186
190
  * host can honour the pick instead of reducing it to an endpoint. Null means
@@ -190,6 +194,7 @@ export declare function slotConnectionModelId(value: unknown): string | number |
190
194
  * whose own defaults are pairs resolves that half for itself, from the store
191
195
  * the default came out of.
192
196
  * @experimental
197
+ * @ruling 01 §10
193
198
  */
194
199
  export interface ResolvedConnection {
195
200
  id: string;
@@ -201,10 +206,11 @@ export interface ResolvedConnection {
201
206
  * (`ConfigWorld.models`); null when the slot named no model or the model
202
207
  * states none, in which case the sampling config's window decides.
203
208
  *
204
- * Carried here so the ONE window computation (R-8) can read it off the
209
+ * Carried here so the ONE window computation can read it off the
205
210
  * same resolved slot the request is sent with — a budget sized to the
206
211
  * sampling config's window while the request went to a model with a
207
212
  * smaller one was wrong in the direction that truncates.
213
+ * @ruling R-8
208
214
  */
209
215
  contextWindow: number | null;
210
216
  }
@@ -224,7 +230,10 @@ export interface ConfigWorld {
224
230
  connectionId: string;
225
231
  contextWindow?: number | null;
226
232
  }>;
227
- /** Singleton kinds, e.g. embeddings (01 §10). */
233
+ /**
234
+ * Singleton kinds, e.g. embeddings.
235
+ * @ruling 01 §10
236
+ */
228
237
  activeConnection: Record<string, string | null>;
229
238
  /**
230
239
  * The instance's default sampling config per kind — the same keys
@@ -278,18 +287,23 @@ export declare function resolveConfigSources(world: ConfigWorld, nodeKeys: strin
278
287
  /** Effective config = base ⊕ overrides, per (nodeKey, slot, path). @internal */
279
288
  export declare function resolveConfig(world: ConfigWorld, nodeKeys: string[]): ResolvedConfig;
280
289
  /**
281
- * Which scopes may write which slot (12 §4). The admin cascade needs no mechanism:
290
+ * Which scopes may write which slot. The admin cascade needs no mechanism:
282
291
  * connection has no writable scope below the config for a non-admin, so an
283
292
  * admin's choice reaches everyone automatically.
284
293
  *
285
294
  * `config` here is the selected config — the one place an administrator's
286
- * edit lands (R-10 folded `instance` into it, 2026-09-16). A slot a session may
295
+ * edit lands (`instance` was folded into it, 2026-09-16). A slot a session may
287
296
  * not write is a slot only the config carries.
288
297
  * @internal
298
+ * @ruling 12 §4, R-10
289
299
  */
290
300
  export declare const WRITE_MATRIX: Record<string, ScopeKind[]>;
291
301
  /** @internal */
292
302
  export declare function mayWrite(slot: string, scope: ScopeKind): boolean;
293
- /** Reject a write the matrix forbids, with the reason (15 §1.3). @experimental */
303
+ /**
304
+ * Reject a write the matrix forbids, with the reason.
305
+ * @experimental
306
+ * @ruling 15 §1.3
307
+ */
294
308
  export declare function assertWritable(slot: string, scope: ScopeKind): void;
295
309
  //# sourceMappingURL=config.d.ts.map
package/dist/config.js CHANGED
@@ -1,14 +1,14 @@
1
1
  /**
2
- * Configuration resolution (12 §2). Four layers, first hit wins, evaluated
2
+ * Configuration resolution. Four layers, first hit wins, evaluated
3
3
  * independently per path — which is what makes an admin's connection change reach a
4
- * user who has customized their prompts (F20).
4
+ * user who has customized their prompts.
5
5
  *
6
- * ## The chain (R-10, ruled 2026-09-15; 09-B B8)
6
+ * ## The chain (ruled 2026-09-15)
7
7
  *
8
8
  * **`session · config · defaults · author`.**
9
9
  *
10
10
  * - `session` — a session's own override of a value (the *chat override* of
11
- * 12 §2's "pipeline → config → chat override").
11
+ * the "pipeline → config → chat override").
12
12
  * - `config` — the rows of the **selected config**: the config IS the
13
13
  * instance's tuning. An administrator's edit lands in the config (ruled
14
14
  * 2026-08-24), so there is no separate `instance` layer for it to be shadowed
@@ -20,19 +20,20 @@
20
20
  * - `author` — the definition's declared parameter defaults; the floor.
21
21
  *
22
22
  * `user` and `instance` stood in this list until 2026-09-16 and were pushed by
23
- * nothing: `world.ts` never projected a row at either (plans/29a §3). Their
23
+ * nothing: `world.ts` never projected a row at either. Their
24
24
  * semantics fold into `config` — the config an admin edits is the instance's
25
25
  * configuration — which is the 2026-08-24 ruling stated as a constant.
26
26
  *
27
27
  * Resolved run-wide *before* execution, which is why referencing another node's
28
- * config is not a data edge (F35).
28
+ * config is not a data edge.
29
29
  *
30
- * ## `config`, not `preset` (R1)
30
+ * ## `config`, not `preset`
31
31
  *
32
32
  * Two other things are called a preset — a **session preset** (the bundle a
33
33
  * session is born on) and an author's `.preset(…)` on a spec — and neither is
34
34
  * this layer, so the scope takes the canon's word for what it holds: the
35
35
  * **config**.
36
+ * @ruling 12 §2, F20, R-10, 09-B B8, 12 §2, plans/29a §3, F35, R1
36
37
  */
37
38
  /** @internal */
38
39
  export const SCOPE_ORDER = ['session', 'config', 'defaults', 'author'];
@@ -177,14 +178,15 @@ export function resolveConfig(world, nodeKeys) {
177
178
  return out;
178
179
  }
179
180
  /**
180
- * Which scopes may write which slot (12 §4). The admin cascade needs no mechanism:
181
+ * Which scopes may write which slot. The admin cascade needs no mechanism:
181
182
  * connection has no writable scope below the config for a non-admin, so an
182
183
  * admin's choice reaches everyone automatically.
183
184
  *
184
185
  * `config` here is the selected config — the one place an administrator's
185
- * edit lands (R-10 folded `instance` into it, 2026-09-16). A slot a session may
186
+ * edit lands (`instance` was folded into it, 2026-09-16). A slot a session may
186
187
  * not write is a slot only the config carries.
187
188
  * @internal
189
+ * @ruling 12 §4, R-10
188
190
  */
189
191
  export const WRITE_MATRIX = {
190
192
  // A session names no connection (ruled 2026-09-30): the pair a step runs
@@ -210,13 +212,21 @@ export const WRITE_MATRIX = {
210
212
  // reports cannot be compared. Same scopes as `template`; widening to
211
213
  // session later is one entry here, additively (18 §4a).
212
214
  scripts: ['config'],
215
+ // A loadout is the engine a step runs on (I12) — compute, like the
216
+ // connection beside it, so only the configuration may name one. A session
217
+ // never picks a loadout (09-30: a session never picks a connection).
218
+ loadout: ['config'],
213
219
  };
214
220
  /** @internal */
215
221
  export function mayWrite(slot, scope) {
216
222
  const kind = scopeKindOf(scope);
217
223
  return kind !== undefined && (WRITE_MATRIX[slot] ?? []).includes(kind);
218
224
  }
219
- /** Reject a write the matrix forbids, with the reason (15 §1.3). @experimental */
225
+ /**
226
+ * Reject a write the matrix forbids, with the reason.
227
+ * @experimental
228
+ * @ruling 15 §1.3
229
+ */
220
230
  export function assertWritable(slot, scope) {
221
231
  if (!mayWrite(slot, scope)) {
222
232
  throw new Error(`scope '${scope}' may not write slot '${slot}'. ` +
@@ -1,5 +1,5 @@
1
1
  /**
2
- * What an import has to wire before it can run — the ruling on 13 §10a.
2
+ * What an import has to wire before it can run — the ruling on connection bindings.
3
3
  *
4
4
  * The question was whether connection bindings deserve their own table, so that an
5
5
  * export could state *structurally* that connections were excluded rather than relying
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * **Ruled: no table.** A second table implies a second lifecycle — its own ids, its own
9
9
  * ownership rules, its own migration — and there isn't one. A connection binding is a
10
- * config value at instance scope, which 12's five-layer chain already owns.
10
+ * config value at instance scope, which the config chain already owns.
11
11
  *
12
12
  * The guarantee people wanted from the table is available without it, and stronger. A
13
13
  * table could only ever report the connections the exporting instance had *filled in*,
@@ -15,6 +15,7 @@
15
15
  * importer would find out at the first run. Slots are declared on the **type**, so
16
16
  * deriving the requirement from descriptors is complete by construction — independent of
17
17
  * what the exporter did, and independent of whether the exporter was even configured.
18
+ * @ruling 13 §10a, 12
18
19
  */
19
20
  import type { SpecDocument } from './document.js';
20
21
  import { type CapabilityId, type CapabilitySet, type Verdict } from './capabilities.js';
@@ -22,7 +23,10 @@ import { type CapabilityId, type CapabilitySet, type Verdict } from './capabilit
22
23
  export interface ConnectionRequirement {
23
24
  nodeKey: string;
24
25
  slot: string;
25
- /** Which connection kind satisfies it — the produced shape (F17). */
26
+ /**
27
+ * Which connection kind satisfies it — the produced shape.
28
+ * @ruling F17
29
+ */
26
30
  kind?: string;
27
31
  definitionId: string;
28
32
  /** What the connection must be able to do. Unmet is a hard failure at bind. */
@@ -41,10 +45,11 @@ export declare function requiredConnections(doc: SpecDocument): ConnectionRequir
41
45
  /**
42
46
  * What is still unwired, given what the importing instance has bound so far.
43
47
  *
44
- * Feeds `needs-configuration` (12 §6), which is deliberately not `broken`. A spec nobody
48
+ * Feeds `needs-configuration`, which is deliberately not `broken`. A spec nobody
45
49
  * has given a connection is not damaged, it is unfinished — and the difference decides
46
50
  * whether a user files a bug or opens settings.
47
51
  * @experimental
52
+ * @ruling 12 §6
48
53
  */
49
54
  export declare function unwiredConnections(doc: SpecDocument, bound: ReadonlyArray<{
50
55
  nodeKey: string;