@serene-pub/sdk 0.6.0-pr-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +17 -0
  3. package/README.md +368 -0
  4. package/dist/actions.d.ts +572 -0
  5. package/dist/actions.js +829 -0
  6. package/dist/annexFields.d.ts +234 -0
  7. package/dist/annexFields.js +413 -0
  8. package/dist/announce.d.ts +464 -0
  9. package/dist/announce.js +426 -0
  10. package/dist/attributes.d.ts +670 -0
  11. package/dist/attributes.js +904 -0
  12. package/dist/bands.d.ts +125 -0
  13. package/dist/bands.js +256 -0
  14. package/dist/builder.d.ts +683 -0
  15. package/dist/builder.js +677 -0
  16. package/dist/candidates.d.ts +109 -0
  17. package/dist/candidates.js +118 -0
  18. package/dist/capabilities.d.ts +744 -0
  19. package/dist/capabilities.js +679 -0
  20. package/dist/channels.d.ts +106 -0
  21. package/dist/channels.js +129 -0
  22. package/dist/clauses.d.ts +40 -0
  23. package/dist/clauses.js +43 -0
  24. package/dist/component.d.ts +33 -0
  25. package/dist/component.js +27 -0
  26. package/dist/componentBuild.d.ts +48 -0
  27. package/dist/componentBuild.js +84 -0
  28. package/dist/componentClient.d.ts +100 -0
  29. package/dist/componentClient.js +13 -0
  30. package/dist/componentImports.d.ts +51 -0
  31. package/dist/componentImports.js +106 -0
  32. package/dist/componentModule.d.ts +8 -0
  33. package/dist/componentModule.js +270 -0
  34. package/dist/componentWire.d.ts +130 -0
  35. package/dist/componentWire.js +280 -0
  36. package/dist/config.d.ts +295 -0
  37. package/dist/config.js +231 -0
  38. package/dist/connections.d.ts +89 -0
  39. package/dist/connections.js +131 -0
  40. package/dist/declarations.d.ts +290 -0
  41. package/dist/declarations.js +794 -0
  42. package/dist/descriptors.d.ts +1774 -0
  43. package/dist/descriptors.js +1329 -0
  44. package/dist/dev.d.ts +136 -0
  45. package/dist/dev.js +161 -0
  46. package/dist/document.d.ts +202 -0
  47. package/dist/document.js +312 -0
  48. package/dist/engines.d.ts +117 -0
  49. package/dist/engines.js +203 -0
  50. package/dist/eventMapLaws.d.ts +63 -0
  51. package/dist/eventMapLaws.js +128 -0
  52. package/dist/events.d.ts +554 -0
  53. package/dist/events.js +633 -0
  54. package/dist/executor.d.ts +771 -0
  55. package/dist/executor.js +1829 -0
  56. package/dist/extension.d.ts +448 -0
  57. package/dist/extension.js +315 -0
  58. package/dist/facets.d.ts +53 -0
  59. package/dist/facets.js +60 -0
  60. package/dist/foldedSections.d.ts +74 -0
  61. package/dist/foldedSections.js +161 -0
  62. package/dist/genres.d.ts +507 -0
  63. package/dist/genres.js +633 -0
  64. package/dist/guardedConnection.d.ts +138 -0
  65. package/dist/guardedConnection.js +341 -0
  66. package/dist/handlebarsReach.d.ts +122 -0
  67. package/dist/handlebarsReach.js +222 -0
  68. package/dist/hash.d.ts +146 -0
  69. package/dist/hash.js +166 -0
  70. package/dist/hookGrants.d.ts +47 -0
  71. package/dist/hookGrants.js +68 -0
  72. package/dist/hooks.d.ts +290 -0
  73. package/dist/hooks.js +113 -0
  74. package/dist/hostElements.d.ts +447 -0
  75. package/dist/hostElements.js +702 -0
  76. package/dist/i18n.d.ts +94 -0
  77. package/dist/i18n.js +123 -0
  78. package/dist/identity.d.ts +93 -0
  79. package/dist/identity.js +135 -0
  80. package/dist/index.d.ts +85 -0
  81. package/dist/index.js +176 -0
  82. package/dist/layout.d.ts +194 -0
  83. package/dist/layout.js +40 -0
  84. package/dist/media.d.ts +202 -0
  85. package/dist/media.js +70 -0
  86. package/dist/messageBlocks.d.ts +487 -0
  87. package/dist/messageBlocks.js +683 -0
  88. package/dist/migration.d.ts +128 -0
  89. package/dist/migration.js +261 -0
  90. package/dist/names.d.ts +78 -0
  91. package/dist/names.js +136 -0
  92. package/dist/nodeInput.d.ts +399 -0
  93. package/dist/nodeInput.js +178 -0
  94. package/dist/participants.d.ts +291 -0
  95. package/dist/participants.js +252 -0
  96. package/dist/personGate.d.ts +62 -0
  97. package/dist/personGate.js +77 -0
  98. package/dist/pick.d.ts +84 -0
  99. package/dist/pick.js +103 -0
  100. package/dist/pluginHarness.d.ts +235 -0
  101. package/dist/pluginHarness.js +558 -0
  102. package/dist/pluginPermissions.d.ts +25 -0
  103. package/dist/pluginPermissions.js +97 -0
  104. package/dist/pluginRuleRef.d.ts +13 -0
  105. package/dist/pluginRuleRef.js +10 -0
  106. package/dist/predicates.d.ts +182 -0
  107. package/dist/predicates.js +249 -0
  108. package/dist/preview.d.ts +120 -0
  109. package/dist/preview.js +82 -0
  110. package/dist/promptBlocks.d.ts +130 -0
  111. package/dist/promptBlocks.js +197 -0
  112. package/dist/rankingDecisions.d.ts +60 -0
  113. package/dist/rankingDecisions.js +48 -0
  114. package/dist/receipt.d.ts +313 -0
  115. package/dist/receipt.js +60 -0
  116. package/dist/receiverRules.d.ts +24 -0
  117. package/dist/receiverRules.js +94 -0
  118. package/dist/refs.d.ts +117 -0
  119. package/dist/refs.js +137 -0
  120. package/dist/registry.d.ts +230 -0
  121. package/dist/registry.js +273 -0
  122. package/dist/review.d.ts +108 -0
  123. package/dist/review.js +97 -0
  124. package/dist/sampling.d.ts +152 -0
  125. package/dist/sampling.js +712 -0
  126. package/dist/scope.d.ts +65 -0
  127. package/dist/scope.js +128 -0
  128. package/dist/scripts.d.ts +243 -0
  129. package/dist/scripts.js +326 -0
  130. package/dist/sessionLayout.d.ts +339 -0
  131. package/dist/sessionLayout.js +503 -0
  132. package/dist/sessionSettings.d.ts +70 -0
  133. package/dist/sessionSettings.js +2 -0
  134. package/dist/settings.d.ts +501 -0
  135. package/dist/settings.js +604 -0
  136. package/dist/settingsSlot.d.ts +108 -0
  137. package/dist/settingsSlot.js +166 -0
  138. package/dist/shapes.d.ts +373 -0
  139. package/dist/shapes.js +408 -0
  140. package/dist/sheets.d.ts +165 -0
  141. package/dist/sheets.js +251 -0
  142. package/dist/statShapes.d.ts +96 -0
  143. package/dist/statShapes.js +112 -0
  144. package/dist/status.d.ts +103 -0
  145. package/dist/status.js +125 -0
  146. package/dist/storage.d.ts +145 -0
  147. package/dist/storage.js +33 -0
  148. package/dist/storyTime.d.ts +308 -0
  149. package/dist/storyTime.js +560 -0
  150. package/dist/surfaces.d.ts +501 -0
  151. package/dist/surfaces.js +292 -0
  152. package/dist/template.d.ts +312 -0
  153. package/dist/template.js +554 -0
  154. package/dist/templateCheck.d.ts +60 -0
  155. package/dist/templateCheck.js +516 -0
  156. package/dist/templateFit.d.ts +157 -0
  157. package/dist/templateFit.js +349 -0
  158. package/dist/templateIds.d.ts +138 -0
  159. package/dist/templateIds.js +144 -0
  160. package/dist/templateScopeAt.d.ts +131 -0
  161. package/dist/templateScopeAt.js +354 -0
  162. package/dist/testing.d.ts +177 -0
  163. package/dist/testing.js +383 -0
  164. package/dist/tokenizers.d.ts +113 -0
  165. package/dist/tokenizers.js +184 -0
  166. package/dist/turnLock.d.ts +96 -0
  167. package/dist/turnLock.js +79 -0
  168. package/dist/turnOrder.d.ts +143 -0
  169. package/dist/turnOrder.js +128 -0
  170. package/dist/validate.d.ts +74 -0
  171. package/dist/validate.js +1399 -0
  172. package/dist/values.d.ts +212 -0
  173. package/dist/values.js +390 -0
  174. package/dist/variables.d.ts +493 -0
  175. package/dist/variables.js +662 -0
  176. package/dist/verdicts.d.ts +275 -0
  177. package/dist/verdicts.js +348 -0
  178. package/dist/widgetDecls.d.ts +88 -0
  179. package/dist/widgetDecls.js +119 -0
  180. package/dist/widgets.d.ts +1527 -0
  181. package/dist/widgets.js +208 -0
  182. package/dist/wire.d.ts +126 -0
  183. package/dist/wire.js +140 -0
  184. package/dist/worldinfo.d.ts +150 -0
  185. package/dist/worldinfo.js +212 -0
  186. package/host-elements.d.ts +914 -0
  187. package/package.json +67 -0
@@ -0,0 +1,1774 @@
1
+ /**
2
+ * Descriptors — the shared-scope declaration of a **node definition** (01 §1, 04 §3;
3
+ * NOMENCLATURE §5 — *node type* is retired, ruled 2026-09-14).
4
+ *
5
+ * A descriptor is data: it can be listed, rendered and validated without loading
6
+ * the handler that implements it. That is what lets the plugin manager and the
7
+ * editor work from rows (10 §10.2).
8
+ */
9
+ import type { ShapeId } from './shapes.js';
10
+ import type { CapabilityId } from './capabilities.js';
11
+ import type { ReviewPosition } from './review.js';
12
+ import type { TemplateScope, VarField } from './template.js';
13
+ import type { VariableDecl } from './variables.js';
14
+ import { type SettingsSchema, type FieldDecl } from './settings.js';
15
+ import { type I18n, type LocaleMap } from './i18n.js';
16
+ import { type EnabledWhen, type EnabledWhenDecl } from './predicates.js';
17
+ import type { WidgetDecl } from './layout.js';
18
+ import type { MediaCapability } from './media.js';
19
+ import { type DisplayKeys } from './hash.js';
20
+ /**
21
+ * The node kinds (R-13, ruled 2026-09-14): **inlet** (where the run enters) ·
22
+ * **query** (reads) · **task** (pure transform) · **oracle** (calls out to an
23
+ * external nondeterministic source — a model, TTS, image gen, embeddings, a human)
24
+ * · **outlet** (the only effect-capable kind: writes, attaches, emits — the run
25
+ * leaves into the world here). Was `input · query · task · provider · consumer`
26
+ * until 2026-09-16; the kind is part of the id grammar (`core:inlet/…`), so every
27
+ * definition id moved with it.
28
+ *
29
+ * `entry` is the odd one out and deliberately so: the first five are **nodes**
30
+ * — things a spec wires — and an entry type is a **row shape**, the declared
31
+ * answer to "what kind of thing is this lorebook row". It is a Kind rather than
32
+ * a registry of its own because everything downstream of a declaration is the
33
+ * same machinery: one `snapshotRegistry`, one content hash, one boot sync, one
34
+ * freeze rule (the argument 18 §2 makes for script kinds, one construct over).
35
+ * @experimental
36
+ */
37
+ export type Kind = 'inlet' | 'query' | 'task' | 'oracle' | 'outlet' | 'entry';
38
+ export type { I18n, LocaleMap } from './i18n.js';
39
+ /**
40
+ * Slot kinds (12 §2). Siblings; only two are ever cross-referenced.
41
+ *
42
+ * `settings` (R-9, ruled 2026-09-15) is the one kind **no author declares**:
43
+ * the substrate declares it, on every definition that is `optional`
44
+ * (`enabled`), every one whose `effects` gate (`review`), and every gather
45
+ * clause (`mode`). The slot name `settings` is reserved for it — `register`
46
+ * refuses a descriptor that authors one, and an out-port of the name, since
47
+ * `<node>.settings` is the address F39 reads as a switch — and it is projected into the
48
+ * registry row by `snapshotRegistry` rather than written on the descriptor,
49
+ * so the executor keeps reading `config[key].settings.*` exactly as before
50
+ * and the panel renders it from the row like any slot (`settingsSlot.ts`).
51
+ * @experimental
52
+ */
53
+ export type SlotKind = 'connection' | 'sampling' | 'prompts' | 'template' | 'parameters' | 'wire' | 'variables' | 'scripts' | 'settings';
54
+ /** @experimental */
55
+ export interface SlotDecl {
56
+ kind: SlotKind;
57
+ /**
58
+ * One of the few settings people actually change on this node.
59
+ *
60
+ * A panel that lists every declared setting equally makes the reader find
61
+ * the prompt among the thresholds every time. The author is the one who
62
+ * knows which three or four are reached for and which exist for the day
63
+ * somebody needs them, so the answer is declared rather than guessed from
64
+ * type or position — a client heuristic would be wrong differently on every
65
+ * plugin.
66
+ *
67
+ * Presentation, not permission: nothing is hidden by it, and everything
68
+ * unmarked is one disclosure away.
69
+ */
70
+ quick?: boolean;
71
+ /** For connection/sampling: which shape's connections are eligible. */
72
+ shape?: ShapeId;
73
+ /**
74
+ * What the connection in this slot must be able to do.
75
+ *
76
+ * Unmet is a hard failure at bind, naming the capability in the words a
77
+ * person saw when they configured it — never a 400 from a provider that was
78
+ * asked for something its API has no field for.
79
+ *
80
+ * On the SLOT rather than on the Descriptor because the requirement is about
81
+ * a *connection*, and a connection comes from a slot: a node with two
82
+ * connection slots needs to state two different things.
83
+ *
84
+ * This supersedes `shape` for connection slots. `shape` says "an image-gen
85
+ * connection"; this says "one that can do text→image", which is the same fact
86
+ * with the modality assumption removed.
87
+ */
88
+ requires?: readonly CapabilityId[];
89
+ /**
90
+ * What the binding will *use if present* and must cope without.
91
+ *
92
+ * The binding asks with `ctx.can(id)`, which is narrowed to exactly these
93
+ * ids — so an undeclared capability, or a typo, does not compile. The
94
+ * fallback path is the author's to write; declaring something optional is a
95
+ * promise that both branches exist.
96
+ *
97
+ * ⚠ Not the same `optional` as `Descriptor.optional` further down this file,
98
+ * which means "producing nothing is a legitimate outcome for this node". Two
99
+ * meanings, one word, one file — the objects differ so it compiles, and the
100
+ * reader is the one who pays. Named to match the ruling; if it is ever
101
+ * renamed, `prefers` is the word that was wanted.
102
+ */
103
+ optional?: readonly CapabilityId[];
104
+ /** What this slot is for, shown under its option. Display text — see FieldDecl. */
105
+ description?: I18n;
106
+ /** Which lens renders it (05 §3). */
107
+ facet?: string;
108
+ /** For prompts: the authored text fields. */
109
+ fields?: Record<string, {
110
+ type: 'text';
111
+ i18n?: I18n;
112
+ }>;
113
+ /** For parameters: the declared schema. Options may be sourced from the connection. */
114
+ schema?: Record<string, FieldDecl>;
115
+ /**
116
+ * Which template language this slot's source is written in — a registry id, not a
117
+ * hardcoded literal (src/engines.ts). The value stored in the slot carries it too, so
118
+ * two slots in one spec may use different engines.
119
+ *
120
+ * The one-element spelling of `acceptedEngines`, and permanently valid: a reader
121
+ * must resolve both, or every slot authored before the set existed silently widens
122
+ * to the host's default.
123
+ */
124
+ engine?: string;
125
+ /**
126
+ * Every template language this slot accepts, most-preferred first.
127
+ *
128
+ * A template's pool is `(what it renders, which language)` and stays that way —
129
+ * a Liquid source and a Handlebars one are not interchangeable, and neither
130
+ * renders the other. What a set widens is the SLOT: a picker offers the union of
131
+ * the accepted pools, so a person may write the same layout in either language
132
+ * without the slot having to be re-declared.
133
+ *
134
+ * **Order is meaning.** The first entry is what a NEW template here is written
135
+ * in, so re-ordering this list changes what an untouched install produces —
136
+ * which is why it is content, hashed with the rest of the declaration.
137
+ *
138
+ * Supersedes `engine` when both are given; an empty array declares nothing.
139
+ */
140
+ acceptedEngines?: readonly string[];
141
+ /**
142
+ * For `wire` slots: the format id this oracle defaults to. Overridable through the
143
+ * normal scope chain, and in core sourced from the connection's adapter metadata so
144
+ * picking Ollama gets the right instruct format without configuring anything
145
+ * (src/wire.ts).
146
+ */
147
+ format?: string;
148
+ /**
149
+ * For template slots: the variables this template may reference.
150
+ *
151
+ * ⚠ Required, and 16 §4 is wrong to imply otherwise. A *source* template renders one
152
+ * item out of a collection, and the item's shape lives inside the port's payload
153
+ * rather than on the port — so typed ports alone cannot tell an author what
154
+ * `{{ entry.title }}` is allowed to be. See src/template.ts.
155
+ */
156
+ variables?: TemplateScope;
157
+ /**
158
+ * For `scripts` slots: which script types this hook accepts (18 §4a).
159
+ *
160
+ * Pinned ids — `core:script:text/transform@1` — and **part of the content
161
+ * hash** (S3): widening or narrowing what a hook accepts changes what an
162
+ * untouched spec does, which is the `optional` lesson applied before it is
163
+ * re-learned. Plain strings rather than the `ScriptKindId` alias, because
164
+ * scripts.ts already imports from this module and a type-only cycle is
165
+ * still a cycle.
166
+ *
167
+ * The value stored in a scripts slot is an ordered list of script row ids —
168
+ * a chain. Transform chains fold; verdict chains reduce (18 §5). The chain
169
+ * is configuration like any slot value: resolved through the scope chain,
170
+ * carried by presets, exported with the document.
171
+ */
172
+ accepts?: string[];
173
+ /**
174
+ * For `scripts` slots: where the chains apply, as (port, phase) — the
175
+ * substrate declaration of 18 §4a. `before` transforms a value entering the
176
+ * named in-port; `after` transforms what left the named out-port. The
177
+ * binding never sees a chain and cannot decline one; declaring is all a
178
+ * type does, which is what makes a plugin's hook trustworthy without
179
+ * trusting the plugin (03 §4 symmetry).
180
+ */
181
+ port?: string;
182
+ phase?: 'before' | 'after';
183
+ /**
184
+ * For `scripts` slots: read-only context this hook supplies beyond the
185
+ * port's own variables — a speaker's name, the cast list. In-only **by
186
+ * construction**: extras have no legal out declaration, so the general
187
+ * in-but-not-out rule (18 §6a) covers them with no special case. The
188
+ * editor offers exactly `ports + extras` as the fixed choices for a
189
+ * script's declared reads — never a freeform name, which would be a
190
+ * declaration nothing supplies.
191
+ */
192
+ extras?: string[];
193
+ /**
194
+ * For `variables` slots: which context variable each key renders.
195
+ *
196
+ * `{ characters: 'core:var/characters@1' }` says this node produces a value
197
+ * called `characters`, and how it is presented is the registered variable's
198
+ * business rather than this node's. Each key becomes one addressable setting
199
+ * pointing at a swappable template row — so a prose rendering written for one
200
+ * pipeline can be selected from any other pipeline that renders the same
201
+ * variable. That cross-pipeline reuse is the point, and it only works because
202
+ * the row is keyed by *what it renders* rather than by which spec it was
203
+ * authored in.
204
+ *
205
+ * Named `renders` rather than `variables` because the field above already
206
+ * owns that name for a different question — that one asks what a template
207
+ * *may reference*, this one asks what a slot *produces*.
208
+ */
209
+ renders?: Record<string, string>;
210
+ /**
211
+ * For `variables` slots: the slot also renders every **band declared
212
+ * upstream** of in-port `from` (typed templates P2) — each under its band
213
+ * key, through the variable the declaring source names
214
+ * (`Descriptor.bands`). So `renders` is open: a plugin's source adds a
215
+ * layout setting here by declaring its band, with no edit to this node.
216
+ *
217
+ * Followed through any node that takes candidates in (concatenation,
218
+ * fusion, ranking); `rendersAt` is the answer for one node of a document.
219
+ * **Contract** — hashed with the slot: which bands a node renders is what
220
+ * its template may place.
221
+ * @experimental
222
+ */
223
+ rendersBands?: {
224
+ from: string;
225
+ };
226
+ }
227
+ /**
228
+ * One band of a `share` or `perMember` parameter.
229
+ *
230
+ * The client renders a bar with a label and a colour per band, and **none of
231
+ * those may be written in the client**. A plugin that adds a sixth retrieval
232
+ * source has to get a labelled band without anyone editing that screen, which
233
+ * is the 1:1 rule applied to a control that would otherwise need a hardcoded
234
+ * list of five.
235
+ */
236
+ /**
237
+ * The field language, re-exported from settings.ts — where it is now defined
238
+ * once for node params, plugin settings, session-mode fields and message-block
239
+ * forms alike.
240
+ *
241
+ * These used to be a second, subtly different declaration living here: it had
242
+ * `share` and `perMember` where settings had `text`, keyed its label `i18n`
243
+ * where settings said `label`, and nothing converted between the two. The
244
+ * comment in settings.ts promising "the same shape node params use" was
245
+ * describing an intention, not the code. It is the code now.
246
+ */
247
+ export type { MemberDecl, FieldDecl, FieldType } from './settings.js';
248
+ export { fieldLabel, fieldAccepts } from './settings.js';
249
+ /**
250
+ * One interior script point (18 §4e): a named moment inside a binding's work
251
+ * where a user chain may run, and which script kinds may be attached there.
252
+ *
253
+ * `accepts` is the attachment rule, on the same terms as `SlotDecl.accepts`
254
+ * for a port hook — pinned ids, part of the content hash. Plain strings rather
255
+ * than the `ScriptKindId` alias for the reason that field gives: scripts.ts
256
+ * imports from this module. `label` is display text, stripped from the hash.
257
+ * @experimental
258
+ */
259
+ export interface ScriptPointDecl {
260
+ key: string;
261
+ accepts: string[];
262
+ label?: I18n;
263
+ description?: I18n;
264
+ }
265
+ /**
266
+ * A definition's interior points, as copies — the one reader of
267
+ * `scriptPoints` (the executor's broker and the registry projection both go
268
+ * through it), so a caller may not edit the declaration through it.
269
+ * @experimental
270
+ */
271
+ export declare function scriptPointsOf(d: {
272
+ scriptPoints?: ReadonlyArray<ScriptPointDecl>;
273
+ }): ScriptPointDecl[];
274
+ /**
275
+ * The message verbs no genre may remove (R-15, ruled 2026-09-15): a person
276
+ * can always stop a reply, branch a session and rewrite a line. Not keys of
277
+ * `SessionShape.messageVerbs`; a declaration naming one `false` is refused
278
+ * at registration (`assertMessageVerbFloors`).
279
+ * @experimental
280
+ */
281
+ export declare const MESSAGE_VERB_FLOORS: readonly ['stop', 'branch', 'edit'];
282
+ /** @experimental */
283
+ export type MessageVerbFloor = (typeof MESSAGE_VERB_FLOORS)[number];
284
+ /**
285
+ * The opt-in built-ins: core's writes a genre may switch off and never
286
+ * re-implement. Default on.
287
+ * @experimental
288
+ */
289
+ export declare const MESSAGE_VERB_BUILT_INS: readonly ['delete', 'hide', 'swipe'];
290
+ /** @experimental */
291
+ export type MessageVerbBuiltIn = (typeof MESSAGE_VERB_BUILT_INS)[number];
292
+ /** The genre-declared content actions — built-in write + declared content. @experimental */
293
+ export declare const MESSAGE_VERB_CONTENT: readonly ['retry', 'extend', 'stepBack'];
294
+ /** @experimental */
295
+ export type MessageVerbContent = (typeof MESSAGE_VERB_CONTENT)[number];
296
+ /** Every forbiddable verb, in the order the availability map reads them. @experimental */
297
+ export declare const MESSAGE_VERBS: readonly ["retry", "extend", "stepBack", "delete", "hide", "swipe"];
298
+ /** @experimental */
299
+ export type MessageVerb = (typeof MESSAGE_VERBS)[number];
300
+ /**
301
+ * The turn controls (lair pass B7 + B8, 2026-09-27) — the composer's presses
302
+ * that move the story on, as opposed to the message verbs, which act on one
303
+ * row. Keys of `SessionShape.turnControls`, in the order the extra venue
304
+ * draws them.
305
+ *
306
+ * - `advance` is **Continue**: it fires the turn order's head
307
+ * (`sessions:fireTurn` with no entry). ⚠ Not `extend` — that is the
308
+ * message verb that extends one reply by prefill (`messageVerbs.extend`).
309
+ * - `pick` is **Pick who speaks**: it fires a character the person names
310
+ * (`sessions:fireTurn` with a `character:<id>` entry the order does not
311
+ * hold).
312
+ * - `narrate` fires a **narrator turn** (`sessions:fireTurn` with a `null`
313
+ * ref the order does not hold) — only a `voice: 'narrator'` genre has a
314
+ * narrator to fire (`turnControlDefault`).
315
+ * - `retake` is **Regenerate the last turn, as a whole** (lair pass R2,
316
+ * owner 2026-09-28; label _Regenerate_, `sessions:retakeTurn`): it
317
+ * deletes the newest turn's **turn yield** — every row that turn's run
318
+ * created, on every channel, never a person's own line — and takes the
319
+ * same turn again. ⚠ Not `retry`, the message verb that rewrites ONE
320
+ * reply in place and keeps its swipes. Offered only where a genre
321
+ * declares it (`turnControlDefault`): a genre whose turn writes one row
322
+ * keeps `retry`.
323
+ * @experimental
324
+ */
325
+ export declare const TURN_CONTROLS: readonly ['advance', 'pick', 'narrate', 'retake'];
326
+ /** @experimental */
327
+ export type TurnControl = (typeof TURN_CONTROLS)[number];
328
+ /**
329
+ * What an undeclared turn control resolves to — read off the shape's own
330
+ * declarations, so a genre that says nothing keeps what its shape already
331
+ * means (R42: turn controls only where there is somebody to take a turn):
332
+ *
333
+ * - `advance` and `pick` are on where the shape has a **character system**
334
+ * (`characters` declared with a `max` other than 0; an unreadable shape
335
+ * counts as having one) — the composer's historical rule.
336
+ * - `narrate` is on where the shape has a **narrator** (`voice:
337
+ * 'narrator'`), the one genre family with a narrator to fire.
338
+ * - `retake` is never on by default: nothing in a shape says a turn writes
339
+ * more than one row, so a genre opts in (`turnControls.retake: true`).
340
+ * @experimental
341
+ */
342
+ export declare function turnControlDefault(shape: unknown, control: TurnControl): boolean;
343
+ /**
344
+ * One turn control as a genre declares it: `true` / `false`, or offered with
345
+ * a **present-when** — enabled-when predicates over the session's published
346
+ * values (`predicates.ts`, the junction's grammar) that say whether the
347
+ * control *applies* in the session's current mode. A control whose
348
+ * present-when fails is **hidden**, not greyed: it has no meaning in that
349
+ * mode. Its `reason` is the sentence the door
350
+ * refuses a press with. Whether an applicable control can be pressed *now*
351
+ * is the core action's own enabled-when — greyed, with a reason.
352
+ * @experimental
353
+ */
354
+ export type TurnControlDecl = boolean | {
355
+ presentWhen: EnabledWhenDecl;
356
+ };
357
+ /**
358
+ * One turn control, resolved: offered at all, and the present-when to
359
+ * evaluate against the published values (empty = always present).
360
+ * @experimental
361
+ */
362
+ export interface TurnControlPresence {
363
+ offered: boolean;
364
+ presentWhen: EnabledWhen[];
365
+ }
366
+ /** Every turn control, resolved. @experimental */
367
+ export type TurnControlPolicy = Record<TurnControl, TurnControlPresence>;
368
+ /**
369
+ * What turn controls this shape offers, resolved — the `resolveWrites`
370
+ * posture: an undeclared or unreadable control is the shape's default
371
+ * (`turnControlDefault`), `false` takes it away, `true` or an object offers it. Pure, and
372
+ * takes `unknown` for a stored shape.
373
+ *
374
+ * With a `channel` (a slug or `slug:lane`; lair re-plan R6), that channel's
375
+ * declared `ChannelDecl.turnControls` win over the genre's, key by key — the
376
+ * `messageVerbs` merge. A channel the shape does not declare in the long
377
+ * form answers the genre's policy.
378
+ * @experimental
379
+ */
380
+ export declare function resolveTurnControls(shape: unknown, channel?: string): TurnControlPolicy;
381
+ /**
382
+ * Is this turn control present over these published values — offered, and
383
+ * every present-when holds? The failing predicate's reason when not; `null`
384
+ * reason for a control the genre does not offer at all.
385
+ * @experimental
386
+ */
387
+ export declare function turnControlPresent(policy: TurnControlPolicy, control: TurnControl, values: unknown): {
388
+ present: true;
389
+ } | {
390
+ present: false;
391
+ reason: LocaleMap | null;
392
+ };
393
+ /**
394
+ * A `turnControls` declaration's faults, refused at the declaration: an
395
+ * unknown control, a value that is neither a boolean nor `{ presentWhen }`,
396
+ * a present-when the enabled-when grammar refuses, or a present-when over
397
+ * `item.*` (a turn control acts on no row).
398
+ * @experimental
399
+ */
400
+ export declare function assertTurnControls(shape: SessionShape | undefined, who: string): void;
401
+ /**
402
+ * The writes a genre may switch off (R-B, 2026-09-17) — what a session does
403
+ * *beyond messages*. Keys of `SessionShape.writes`, in the order a policy
404
+ * reads them.
405
+ * @experimental
406
+ */
407
+ export declare const SESSION_WRITES: readonly ['lore', 'scenes'];
408
+ /** @experimental */
409
+ export type SessionWrite = (typeof SESSION_WRITES)[number];
410
+ /** Availability of every switchable session write. Absent means both on. @experimental */
411
+ export type SessionWritePolicy = Record<SessionWrite, boolean>;
412
+ /**
413
+ * What this shape lets a session write, resolved. Absent, unknown or
414
+ * unreadable is **both on** — the standard chat's posture, and the same
415
+ * "a policy that cannot be read refuses nothing" rule `messageVerbs` keeps.
416
+ * Only an explicit `false` takes a write away.
417
+ *
418
+ * Pure, and takes `unknown` on purpose: the app reads a shape that arrived
419
+ * from a stored registry row, not a typed declaration.
420
+ * @experimental
421
+ */
422
+ export declare function resolveWrites(shape: unknown): SessionWritePolicy;
423
+ /**
424
+ * A `writes` declaration whose values are not booleans is refused — with a
425
+ * sentence, at the declaration, where the author is. Shared by `register`
426
+ * (an inlet's `sessionShape`) and `genre()` (a genre's `shape`), on the same
427
+ * terms as `assertMessageVerbFloors`. Unknown keys are ignored, as the
428
+ * resolver ignores them: a key this release does not know is not a write.
429
+ * @experimental
430
+ */
431
+ export declare function assertSessionWrites(shape: SessionShape | undefined, who: string): void;
432
+ /**
433
+ * The five built-in writes (R-15), by the verb a person knows them as: the
434
+ * one-node spec core runs for each, and the outlet that spec ends in.
435
+ *
436
+ * Here rather than only in the core catalog because the **validator** needs
437
+ * them (U5b review W8): a built-in outlet performs the item rule's write —
438
+ * the handler judged who may act on which row before the run began — so a
439
+ * spec that is not the built-in's own placing one would perform that write
440
+ * with nobody having judged anything. `validate()` refuses the placement
441
+ * unless the document's id is one of `BUILTIN_SPEC_IDS`, and the host
442
+ * refuses the commit on the same test (defence in depth). A manifest
443
+ * permission letting a plugin spec place one is the future this leaves room
444
+ * for; it is not granted today.
445
+ * @internal
446
+ */
447
+ export declare const BUILTIN_SPEC_IDS: Readonly<{
448
+ readonly delete: 'core:spec/builtin-delete';
449
+ readonly hide: 'core:spec/builtin-hide';
450
+ readonly edit: 'core:spec/builtin-edit';
451
+ readonly swipe: 'core:spec/builtin-swipe';
452
+ readonly branch: 'core:spec/builtin-branch';
453
+ }>;
454
+ /** @internal */
455
+ export type BuiltInKind = keyof typeof BUILTIN_SPEC_IDS;
456
+ /** The outlet each built-in's spec ends in — `effects: 'write'`, every one. @experimental */
457
+ export declare const BUILTIN_OUTLET_IDS: Readonly<{
458
+ readonly delete: 'core:outlet/delete-message@1';
459
+ readonly hide: 'core:outlet/hide-message@1';
460
+ readonly edit: 'core:outlet/edit-message@1';
461
+ readonly swipe: 'core:outlet/swipe-message@1';
462
+ readonly branch: 'core:outlet/branch-session@1';
463
+ }>;
464
+ /** Is this definition id one of the five built-in write outlets? @experimental */
465
+ export declare const isBuiltInOutlet: (definitionId: string) => boolean;
466
+ /** Is this spec id one of the five built-in specs — the only documents that may place a built-in outlet? @internal */
467
+ export declare const isBuiltInSpec: (specId: string) => boolean;
468
+ /**
469
+ * The form-answer pair (plans/29 R-15 *Forms*; 30 §U5d, built 2026-09-17):
470
+ * the inlet `core:event/form-addressed@1` lands on, and the outlet that
471
+ * commits an oracle's answer exactly as a click would. The outlet may be
472
+ * placed only in a document whose inlet is the form-addressed one
473
+ * (`validate()`; the host checks the same at the commit): it answers THE
474
+ * form the event carried, and a document reached by any other event has no
475
+ * form to answer — a spec placing it elsewhere would fire an action as
476
+ * somebody nobody asked.
477
+ * @internal
478
+ */
479
+ export declare const FORM_ADDRESSED_INLET_ID = "core:inlet/form-addressed@1";
480
+ /** @experimental */
481
+ export declare const ANSWER_FORM_OUTLET_ID = "core:outlet/answer-form@1";
482
+ /**
483
+ * The review-fields rule (R-15 *The review gate*; 30 §U5d): a definition
484
+ * with `effects: 'write' | 'external'` declares `review: { fields }` — what a
485
+ * reviewer may edit at the gate, `[]` when nothing (approve or refuse). A
486
+ * definition that declares none still registers and still gates — the form
487
+ * is then **inferred** from the whole payload, every field editable, which is
488
+ * the documented fallback a plugin definition gets — but `register()` records
489
+ * the omission as a finding and `validate()` reports it on every node bound
490
+ * to such a definition, so a shipped effectful definition without one is
491
+ * visible rather than silent. Every core definition declares one.
492
+ * @experimental
493
+ */
494
+ export declare function reviewFieldsFinding(d: {
495
+ id: string;
496
+ effects?: string;
497
+ review?: {
498
+ fields: readonly string[];
499
+ };
500
+ }): string | null;
501
+ /**
502
+ * What `register()` noted about a definition without refusing it — today
503
+ * the review-fields rule alone. Keyed by definition id; empty for a clean
504
+ * one. Read by a host at boot to say so once, and by tests asserting that
505
+ * every shipped effectful definition declares its fields.
506
+ * @experimental
507
+ */
508
+ export declare function definitionFindings(id?: string): string[];
509
+ /**
510
+ * A `messageVerbs` declaration that names a floor `false` is refused — with a
511
+ * sentence, at the declaration, where the author is. Shared by `register`
512
+ * (an inlet's `sessionShape`) and `genre()` (a genre's `shape`), so the two
513
+ * places a shape can be declared cannot disagree about what a floor is.
514
+ * Unknown keys are ignored, as the app's reader ignores them: a key this
515
+ * release does not know is not a floor.
516
+ * @experimental
517
+ */
518
+ export declare function assertMessageVerbFloors(shape: SessionShape | undefined, who: string): void;
519
+ /** @experimental */
520
+ export interface PortDecl {
521
+ [port: string]: ShapeId;
522
+ }
523
+ /**
524
+ * `Out`/`In` are generic so the *port names* survive into the type system. That is what
525
+ * lets the builder offer `$.history.messages` with autocomplete instead of
526
+ * `$ref('history', 'messages')` with a string (see src/scope.ts). Both default to the
527
+ * open `PortDecl`, so nothing that ignores the generics changes.
528
+ */
529
+ /**
530
+ * The chat-shape contract a mode-bearing input type carries (19 §1). See
531
+ * `Descriptor.shape` for the rules; this is the vocabulary.
532
+ *
533
+ * Bounds omit `max` for "unlimited" and omit the whole capability for "does
534
+ * not exist here". Every field is optional so the standard mode can state
535
+ * today's behaviour exactly and a prose mode can state almost nothing.
536
+ * @experimental
537
+ */
538
+ export interface SessionShape {
539
+ /** The character system: toggles, ordering, pickers, cast rows. */
540
+ characters?: {
541
+ min: number;
542
+ max?: number;
543
+ };
544
+ /** The persona system. Absent or `max: 0`: the user is prose. */
545
+ personas?: {
546
+ min: number;
547
+ max?: number;
548
+ };
549
+ /** The lorebook attachment picker, and retrieval satisfiability. */
550
+ lorebook?: 'optional' | 'required';
551
+ /** What the send surface is. `none` for purely trigger-driven modes. */
552
+ composer?: 'text' | 'none';
553
+ /** Whose name the seed line carries (16's seedName rule, declared). */
554
+ voice?: 'character' | 'narrator';
555
+ /**
556
+ * Mode-declared per-session fields (`SettingsSchema` — the one field
557
+ * language). Rendered in session settings, stored on the session, supplied
558
+ * back through this input's published document.
559
+ */
560
+ fields?: SettingsSchema;
561
+ /**
562
+ * Does the session settings form offer a **Scenario** field (§4.11,
563
+ * R12)? Declared, never assumed: core's chat, adventure and lair say
564
+ * `true`; guide says `false`. Absent = no field.
565
+ */
566
+ scenario?: boolean;
567
+ /**
568
+ * Does the session settings form offer **Tags** (§4.11, R12)? `true` for
569
+ * every core genre. Absent = no tags section.
570
+ */
571
+ tags?: boolean;
572
+ /**
573
+ * Whether creating a chat of this mode seeds the cast's greeting messages,
574
+ * and on which channel (20 §7). Absent means the default — **on, on
575
+ * `main`** — so a custom input node gets the standard chat's welcoming
576
+ * behaviour for free and turns it off or redirects it only if it wants to.
577
+ * Core's `user-message` input declares it explicitly so the reusable case
578
+ * reads at a glance.
579
+ */
580
+ greeting?: {
581
+ /** Seed character greetings on creation. Default true. */
582
+ enabled?: boolean;
583
+ /** Which channel the greetings land on. Default `main`. */
584
+ channel?: string;
585
+ };
586
+ /**
587
+ * Which message verbs sessions of this genre offer (20 §4; R-15, ruled
588
+ * 2026-09-15). Absent means all on — the standard chat's posture. Core
589
+ * owns the mechanics and integrity rules; this only declares
590
+ * *availability*, checked server-side at the verb (presence is
591
+ * presentation, refusal is the law).
592
+ *
593
+ * Three groups, and the type is the enforcement:
594
+ *
595
+ * · **Floors** — `stop` · `branch` · `edit` — are **unrepresentable
596
+ * here**, and `register`/`genre()` refuse a declaration that names one
597
+ * `false` (`assertMessageVerbFloors`). They are present in every genre:
598
+ * a person can always stop a reply, always branch a session and always
599
+ * rewrite a line, and a genre that could take those away would own the
600
+ * user.
601
+ * · **Opt-in built-ins** — `delete` · `hide` · `swipe` — are core's
602
+ * writes (`core:outlet/delete-message@1` …), always emitting what
603
+ * changed; a genre may switch one off, never re-implement it.
604
+ * · **Genre-declared content actions** — `retry` (regenerate) ·
605
+ * `extend` · `stepBack` — are the genre's pipeline producing text
606
+ * plus core's rewrite of the row. A dice-are-final genre forbidding
607
+ * `retry` is a real design.
608
+ *
609
+ * ⚠ `extend` here is the **prefill** extend — carry one reply on. The
610
+ * composer's Continue, which fires the next turn, is a turn control
611
+ * (`turnControls.advance`), switched separately.
612
+ */
613
+ messageVerbs?: {
614
+ retry?: boolean;
615
+ extend?: boolean;
616
+ stepBack?: boolean;
617
+ delete?: boolean;
618
+ hide?: boolean;
619
+ swipe?: boolean;
620
+ };
621
+ /**
622
+ * Which turn controls sessions of this genre offer, and when each is
623
+ * present (lair pass B7 + B8, 2026-09-27). Absent is the shape's
624
+ * default (`turnControlDefault`: Continue and Pick where there is a
625
+ * character system, narrate where there is a narrator). A
626
+ * control is `true`, `false`, or `{ presentWhen }` — enabled-when
627
+ * predicates over the published values; when they fail the control is
628
+ * hidden, and the door refuses a press with the failing reason
629
+ * (`TurnControlDecl`). Enforced server-side at the fire, like
630
+ * `messageVerbs`: presence is presentation, refusal is the law.
631
+ *
632
+ * `advance` is the composer's **Continue** — fire the turn order's head.
633
+ * ⚠ Not `messageVerbs.extend`, which extends one reply by prefill: a
634
+ * genre whose composed reply cannot be extended mid-sentence switches
635
+ * that off and keeps this.
636
+ *
637
+ * `retake` is **Regenerate the last turn** (R2, 2026-09-28) — delete the
638
+ * newest turn's yield and take the turn again. Never on by default: a
639
+ * genre whose turn writes several rows declares it.
640
+ */
641
+ turnControls?: {
642
+ advance?: TurnControlDecl;
643
+ pick?: TurnControlDecl;
644
+ narrate?: TurnControlDecl;
645
+ retake?: TurnControlDecl;
646
+ };
647
+ /**
648
+ * What sessions of this genre may write beyond messages (R-B, 2026-09-17).
649
+ * Absent = both on — the standard chat's posture. Enforced server-side at
650
+ * the write, like `messageVerbs`: presence is presentation, refusal is the
651
+ * law.
652
+ *
653
+ * Not a third `lorebook` value: `lorebook: 'optional'` with
654
+ * `writes.lore: false` already reads as attach-and-reference, and the two
655
+ * answer different questions — one is whether a book may be attached, the
656
+ * other whether the session's own machinery may add to it. A genre whose
657
+ * lorebook is a *reference* (a rulebook, a docs set) says so here, and a
658
+ * user-attached pipeline or a plugin hook cannot then rewrite it mid-game.
659
+ *
660
+ * The lever is about what a **session** does. Editing the same lorebook
661
+ * from the lorebook screens is untouched: that is a person at a book, not
662
+ * a session writing through one.
663
+ */
664
+ writes?: {
665
+ /** May a session of this genre add lore entries to its lorebook? */
666
+ lore?: boolean;
667
+ /** May a session of this genre open scenes? */
668
+ scenes?: boolean;
669
+ };
670
+ /**
671
+ * Which surface renders sessions of this mode (20 §12). Absent means
672
+ * core's log — today's behaviour exactly. A plugin id (`acme/crawl`)
673
+ * names the plugin whose declared `session-view` frame surface replaces
674
+ * the whole message section: the total-conversion lane. The frame gets
675
+ * the session over the MessageChannel and returns actions as validated
676
+ * requests; it forfeits core's in-log chrome deliberately. "Restyle the
677
+ * standard chat" is blocks, never this.
678
+ */
679
+ view?: string;
680
+ /**
681
+ * The session's channels beyond the implicit `main` (20 §7) — filter
682
+ * lanes inside one session. What renders a channel is the surface story
683
+ * (a frame subscribes to it); what *stores* it is `messages.channel`; and
684
+ * pipelines choose which lanes build their context through the history
685
+ * query's `channel` param. Declaring one here is what makes it exist for
686
+ * sessions of this mode.
687
+ *
688
+ * **Slugs, and only slugs (ruling 2026-09-09).** A channel is an
689
+ * organizational bucket this genre chooses arbitrarily and names here; the
690
+ * **lanes** under a slug are runtime and open-ended — a lane exists because
691
+ * a pipeline wrote to it, and this genre's pipelines allocate and manage
692
+ * them (one lane per agent with the agent↔lane map in extension data; five
693
+ * ongoing private conversations under `text-messages`, with a sixth later).
694
+ * **No lane count is declared**, here or anywhere. `main` is always the
695
+ * default channel and lane 1 always the default lane, so a bare slug is
696
+ * `slug:1`, `main` is `main:1`, and lane 1 is stored as the bare slug —
697
+ * lanes from 2 up store `slug:n`. The number is multiplicity and order,
698
+ * never identity: the slug is the reference. Lane metadata (title,
699
+ * participants, open or closed) is this genre's business and lives in its
700
+ * extension data — core stores a string. Parse and format one with
701
+ * `parseChannel` / `formatChannel`.
702
+ *
703
+ * **A bare string, or a `ChannelDecl`** (R-C, 2026-09-17). The string is
704
+ * the whole declaration for the ordinary case and keeps meaning exactly
705
+ * what it meant — `'phone'` is `{ slug: 'phone', role: 'conversation' }`
706
+ * with the genre's `voice` and `messageVerbs`. Read the normalised list
707
+ * with `channelDecls`; a string stays a string in the declaration, so the
708
+ * content hash of every genre written before this union is unmoved.
709
+ */
710
+ channels?: (string | ChannelDecl)[];
711
+ /**
712
+ * The panels a session of this mode offers in the surface grid (21). The
713
+ * grid is container-responsive: panels flow into tracks that appear and
714
+ * disappear with the *content box* width (not the viewport), so opening a
715
+ * sidebar cascades panels the same way shrinking the window would.
716
+ *
717
+ * Absent means the default — the standard chat's single primary panel (the
718
+ * log + composer). A mode declares extra panels by pushing `WidgetDecl`s; a
719
+ * panel names a **component** (`component`, run in the UI worker), which
720
+ * places an `sp-frame` for any region that needs a real document. A panel
721
+ * is a *view onto channels* — it renders what a node
722
+ * writes to the channels it subscribes to. This is the "map / cell phone /
723
+ * mission list appears when the action is toggled on" lane: a node emits a
724
+ * `surface:open` intent naming a declared panel, and the grid flows it in.
725
+ *
726
+ * Exactly one panel should carry `role: 'primary'` — it is anchored, always
727
+ * placed, and never cascades to the drawer. Absent-panels defaults supply a
728
+ * primary log automatically, so a mode only lists what it adds.
729
+ */
730
+ panels?: WidgetDecl[];
731
+ }
732
+ /**
733
+ * One channel, declared in full (R-C, 2026-09-17) — the long form of an
734
+ * element of `SessionShape.channels`, where the short form is the slug alone.
735
+ *
736
+ * Three things a genre may say about a channel that it cannot say about the
737
+ * session as a whole: how the channel's messages **enter a prompt**, whose
738
+ * **name** a turn triggered there speaks under, and which **verbs** its rows
739
+ * offer. A writing room's `manuscript` is a folio with no speaker and no
740
+ * deleting; its `main` is an ordinary conversation. One genre, two postures,
741
+ * and nothing about either is expressible on the shape alone.
742
+ *
743
+ * Every field but `slug` is optional and every default is today's behaviour,
744
+ * which is what makes the union additive: a bare string is this object with
745
+ * `role: 'conversation'`, the genre's `voice` and the genre's `messageVerbs`.
746
+ * @experimental
747
+ */
748
+ export interface ChannelDecl {
749
+ /**
750
+ * The channel's slug — a bare slug, never `slug:lane`. Lanes are runtime
751
+ * (see `SessionShape.channels`); a declaration that names one is refused.
752
+ */
753
+ slug: string;
754
+ /**
755
+ * How this channel enters a prompt. `conversation` (the default): turns
756
+ * with speakers, as every channel has always been assembled. `folio`:
757
+ * one text block in time order, no speaker names, placed **before** the
758
+ * conversation — the manuscript the conversation is about.
759
+ */
760
+ role?: 'conversation' | 'folio';
761
+ /**
762
+ * Whose name the seed line carries for a turn triggered on this channel
763
+ * (the genre-wide `voice`, per channel). Default: the genre's `voice`.
764
+ * `none`: no seed row at all — the extend-prefill posture, which is
765
+ * what a folio channel wants, since a manuscript has no speaker to
766
+ * announce.
767
+ */
768
+ voice?: 'character' | 'narrator' | 'none';
769
+ /**
770
+ * Which verbs this channel's messages offer, over the genre's. Declared
771
+ * keys win; the rest keep the genre's answer. The floors are
772
+ * unrepresentable here too — `assertMessageVerbFloors` judges a channel's
773
+ * declaration on exactly the terms it judges a genre's.
774
+ */
775
+ messageVerbs?: SessionShape['messageVerbs'];
776
+ /**
777
+ * The channel's display name (lair re-plan R6, 2026-09-28) — what a
778
+ * widget header and the composer's channel control call it: the Lair's
779
+ * `sanctum` is _Sanctum_. Display text (R-20), normalised by
780
+ * `channelDecls` to a locale map. Absent: readers show the slug, as
781
+ * before the field existed.
782
+ */
783
+ label?: I18n;
784
+ /**
785
+ * Which turn controls this channel's composer offers, over the genre's
786
+ * `turnControls` (lair re-plan R6) — the `messageVerbs` merge rule:
787
+ * declared keys win, the rest keep the genre's answer. The Lair's
788
+ * Sanctum takes Pick who speaks and Regenerate the last turn away and
789
+ * keeps Continue and Narrate. Read one channel's policy with
790
+ * `resolveTurnControls(shape, channel)`.
791
+ */
792
+ turnControls?: SessionShape['turnControls'];
793
+ }
794
+ /** The roles a channel's messages may play in a prompt. @experimental */
795
+ export declare const CHANNEL_ROLES: readonly ['conversation', 'folio'];
796
+ /** @experimental */
797
+ export type ChannelRole = (typeof CHANNEL_ROLES)[number];
798
+ /** The voices a channel's turn may seed under. `none` seeds no row at all. @experimental */
799
+ export declare const CHANNEL_VOICES: readonly ['character', 'narrator', 'none'];
800
+ /** @experimental */
801
+ export type ChannelVoice = (typeof CHANNEL_VOICES)[number];
802
+ /**
803
+ * This shape's channels as full declarations, defaults resolved — the one
804
+ * reader every consumer of `SessionShape.channels` should use, so the short
805
+ * and long forms cannot be read differently anywhere.
806
+ *
807
+ * `main` comes first and always exists, declared or not: it is the session's
808
+ * default channel, so a genre that lists only `manuscript` still has it. A
809
+ * genre that *does* declare `main` gets its own declaration in that first
810
+ * position rather than a second row.
811
+ *
812
+ * What "resolved" means, per entry: `role` is always present; `voice` is the
813
+ * channel's, else the genre's, else absent; `messageVerbs` is the genre's
814
+ * with the channel's declared keys over the top, absent when neither declares
815
+ * any; `turnControls` the same, over the genre's `turnControls`; `label` a
816
+ * locale map, absent when undeclared. So the answer read off an entry is the
817
+ * effective one, and no caller has to remember the inheritance.
818
+ *
819
+ * Takes `unknown` for the same reason `resolveWrites` does, and never throws:
820
+ * a shape from a stored registry row is data. An unreadable entry is skipped
821
+ * rather than guessed at — the refusal belongs at the declaration
822
+ * (`assertChannelDecls`), not at a read on the turn's path.
823
+ * @experimental
824
+ */
825
+ export declare function channelDecls(shape: unknown): ChannelDecl[];
826
+ /**
827
+ * A channel declaration that cannot mean what it says is refused — with a
828
+ * sentence, at the declaration, on the same terms as `assertMessageVerbFloors`.
829
+ *
830
+ * `main` may only be a conversation: it is the channel every session has and
831
+ * the one a turn lands on by default, so a genre that made it a document
832
+ * would leave the session with nowhere to talk.
833
+ * @experimental
834
+ */
835
+ export declare function assertChannelDecls(shape: SessionShape | undefined, who: string): void;
836
+ /** @experimental */
837
+ export interface Descriptor<Out extends PortDecl = PortDecl, In extends PortDecl = PortDecl, Id extends string = string> {
838
+ /**
839
+ * `namespace:kind/name@N` — and the `@N` is the **type** version, which is a pin
840
+ * (01 §3). Distinct from a spec's semver, which is an upgrade key (src/identity.ts).
841
+ * Carried in the type so a pinned constructor can expose `.v1()` at the call site.
842
+ */
843
+ id: Id;
844
+ kind: Kind;
845
+ i18n?: {
846
+ name?: I18n;
847
+ description?: I18n;
848
+ };
849
+ slots?: Record<string, SlotDecl>;
850
+ ports: {
851
+ in?: In;
852
+ out?: Out;
853
+ };
854
+ /** Oracle/outlet only — the review gate keys on this, not on kind (01 §7). */
855
+ effects?: 'none' | 'external' | 'write' | 'emit';
856
+ /**
857
+ * An author may default review **on** for their own node. There is no value here
858
+ * that forbids it — that is the enforcement, not a rule someone checks (F14).
859
+ *
860
+ * **Policy**, not contract (`DESCRIPTOR_POLICY_KEYS`): where the gate
861
+ * starts is offered to the person who configures the node, and moving it
862
+ * changes no port, shape or behaviour of the node itself.
863
+ */
864
+ reviewDefault?: ReviewPosition;
865
+ /**
866
+ * Which of this node's in-ports a reviewer may **edit** at the gate (R-15,
867
+ * U5b review C1, 2026-09-16): an allow-list of port names. Absent, the
868
+ * form is inferred from the whole payload the node received, as it always
869
+ * was — every field editable. Declared, the form shows these fields and
870
+ * no other, and a decision that submits any other key is refused with a
871
+ * sentence rather than folded in silently.
872
+ *
873
+ * The case it exists for is an **identity** field: the `target` of a
874
+ * delete, the `fromMessage` of a branch, the `index` of a swipe. The
875
+ * handler judged whether THIS person may act on THIS row before the run
876
+ * started; a form that let the reviewer retype the id re-aimed a write
877
+ * that had already passed that check, at a row it never saw. So an
878
+ * effectful definition whose payload names a row declares what may
879
+ * change — the text, the direction, the title — and the id is never
880
+ * among them. `fields: []` is a legitimate declaration: approve or
881
+ * reject, nothing to edit (a delete).
882
+ *
883
+ * **Contract** (`DESCRIPTOR_CONTRACT_KEYS`, plans/31 V6): `fields` is the
884
+ * list a decision is validated against, so a pinned spec's review form
885
+ * and the keys its decisions may carry run against it — widening or
886
+ * narrowing the list moves the hash.
887
+ *
888
+ * Read from the in-process definition, and carried on the registry row
889
+ * (`RegistryEntry.review`) so a `transport: process` plugin outlet's form
890
+ * can be read without loading the plugin.
891
+ */
892
+ review?: {
893
+ fields: readonly string[];
894
+ };
895
+ /** Connection kind for providers (== produced shape). Contract. */
896
+ shape?: ShapeId;
897
+ /**
898
+ * May this node be switched off? Requires shape transparency (01 §14
899
+ * F-toggleable). **Policy** — what the panel offers; the switch itself is
900
+ * a setting, and the node runs the same either side of it.
901
+ */
902
+ toggleable?: boolean;
903
+ /**
904
+ * Producing nothing is a legitimate outcome, so failing is not the run's
905
+ * failure.
906
+ *
907
+ * An `err` — including a timeout — becomes an empty `ok` and the run
908
+ * continues. The receipt still records what went wrong: `result` stays
909
+ * `err`, `reason` keeps the message, and `recoveredAsEmpty` marks it, so
910
+ * this is *tolerated* rather than hidden. A node whose failure nobody can
911
+ * see is worse than one that stops the run.
912
+ *
913
+ * For enrichment a template already guards with `{{#if}}` — the narrative
914
+ * graph's relationship summary is the case this exists for: a slow read of
915
+ * an optional block should never cost somebody their reply. It does **not**
916
+ * license wiring a required input to an optional node; downstream still has
917
+ * to mean something when the value is absent, which is a property of the
918
+ * ports, not of this flag.
919
+ *
920
+ * Deliberately not `halt` or `cancelled`. A halt is a binding saying "stop
921
+ * here" on purpose (a preview, a review gate) and a cancellation is the
922
+ * user; neither is a failure to absorb.
923
+ *
924
+ * **Contract**: the ports do not move when it flips, but every spec pinning
925
+ * the version changes behaviour on failure.
926
+ */
927
+ optional?: boolean;
928
+ /**
929
+ * Declares it consumes the run seed — keeps Tasks pure (F11). **Contract**:
930
+ * a replay with the same seed is only a replay while the set of nodes
931
+ * drawing on it is the set the document was compiled against.
932
+ */
933
+ declaresRandomness?: boolean;
934
+ /**
935
+ * Declared, not bound (plans/29 R-2, 2026-09-17).
936
+ *
937
+ * A definition core publishes because a plan owns it — `speak` (plans/14),
938
+ * the two MCP oracles (plans/28) — while no handler implements it yet. The
939
+ * flag is what stops the gap from being invisible: the registry row reads
940
+ * `status: 'provisional'` and is badged; every listing that OFFERS
941
+ * definitions leaves it out; `validate()` refuses a document placing it
942
+ * (law R-2, *bind it or remove the node*); and the executor refuses to run
943
+ * the node with the same sentence, so a document that reached it by another
944
+ * door halts legibly rather than on "no binding registered".
945
+ *
946
+ * **Policy, never hashed** (plans/31 V6, 2026-09-17 — reversing U6's
947
+ * choice): what is *offered* is policy and what *runs* is contract, and
948
+ * this flag decides only the first. The day the handler lands the pin
949
+ * stays where it is; the registry row's `status` moves from
950
+ * `provisional` to `live` on the next sync, and the receipts that named
951
+ * the hash still describe the same contract. `true` or absent, never
952
+ * `false`: a definition is either provisional or it is not.
953
+ */
954
+ provisional?: true;
955
+ /**
956
+ * Interior script points (18 §4e): named moments *inside* the binding's
957
+ * work where user text-transform chains may run — a drafting loop's
958
+ * intermediate texts. Declared here so "which nodes can run scripts, and
959
+ * where" is answerable from the document; the binding invokes one with
960
+ * `ctx.scripts.applyText(key, text)` and gets no `ctx.scripts` at all
961
+ * without a declaration. **Part of the hashed contract** — a point
962
+ * appearing or vanishing, or what it `accepts`, changes what an untouched
963
+ * spec's configuration can reach (S3's argument, one construct over).
964
+ * `label`/`description` are display text and stripped from the hash as
965
+ * everywhere.
966
+ *
967
+ * A point declares what it **accepts** (R-11, ruled 2026-09-15; 18 §4e):
968
+ * the executor hands that list to the applier, which refuses a link of any
969
+ * other kind — it hardcoded `text/transform` until 2026-09-16. Read the
970
+ * list through `scriptPointsOf`. A bare-string point (`'each-draft'`) is
971
+ * refused at `register()` — the spelling was retired without an alias.
972
+ */
973
+ scriptPoints?: ScriptPointDecl[];
974
+ /**
975
+ * The chat-shape contract (19 §0–§1) — present **only on input types**,
976
+ * and its presence is what makes the input type a **chat mode**. The mode
977
+ * id is this type's id; any spec pinning it and matching the primary-write
978
+ * signature is in the mode's bucket, by construction.
979
+ *
980
+ * The core idea is **capability references**: the shape names the systems
981
+ * of core it uses, and declaring one is what enables that system's UI,
982
+ * storage and query satisfiability for chats of the mode. A capability the
983
+ * shape does not declare does not exist for the chat — no toggles, no
984
+ * rows, no budget spent retrieving for it. `personas` absent or `max: 0`
985
+ * means the user is prose: nameless text, no identity, a first-class
986
+ * state rather than an edge case.
987
+ *
988
+ * **Hashed contract** (display lives in `i18n` as everywhere): widening
989
+ * `characters.max` changes what existing sessions legally contain — the
990
+ * `optional` lesson, again. `fields` reuses `SettingsSchema` — the
991
+ * one-field-language rule — rendered in session settings and supplied back
992
+ * through this input's published document. Duties and triggers are
993
+ * deliberately NOT here: the shape is owner-only, and event functions
994
+ * beyond the intrinsic composer are contributed by the specs that serve
995
+ * them (19 §3–§4), so a mode never has to know its narrator exists.
996
+ *
997
+ * Named `sessionShape` because `shape` was already taken by the provider
998
+ * connection kind above — renaming *that* would re-hash every provider
999
+ * on the instance for a word.
1000
+ */
1001
+ sessionShape?: SessionShape;
1002
+ /**
1003
+ * May finish before an upstream stream ends (01 §11). **Contract**: a
1004
+ * stream consumer that may return early and one that must drain are two
1005
+ * different things to wire a stream into.
1006
+ */
1007
+ earlyExit?: boolean;
1008
+ /**
1009
+ * Public pipeline hooks may be pinned by any spec (01 §9b). **Policy**:
1010
+ * who may pin it is decided at install, not run — a spec that already
1011
+ * pins it runs against the same contract either way.
1012
+ */
1013
+ public?: boolean;
1014
+ /**
1015
+ * F36 — every hook invocation is bounded. **Policy**, both of them: how
1016
+ * long the host waits is the host's to tune, and a spec's document is
1017
+ * indifferent to it.
1018
+ *
1019
+ * `timeoutKind` says what `timeoutMs` measures. `'wall'` (the default):
1020
+ * the invocation, start to finish. `'idle'`: the gap between signs of
1021
+ * progress — every `ctx.pulse()` (and every `CallHandles.pulse` the host
1022
+ * calls for a request it performs) restarts it, and the pub's ceiling
1023
+ * bounds the whole. Declare `'idle'` for work whose length is honest but
1024
+ * unknown — a streamed reply, a model loading — and `'wall'` for work
1025
+ * that should simply be quick.
1026
+ */
1027
+ timeoutMs?: number;
1028
+ timeoutKind?: 'wall' | 'idle';
1029
+ /**
1030
+ * Which core event a write causes. Declared here, never per spec (01 §8).
1031
+ * Refused at registration unless that event's `causedBy` names this
1032
+ * definition (R33): `EventDef.causedBy` is the one authored statement of
1033
+ * what causes what, and this field must agree with it.
1034
+ */
1035
+ causesEvent?: string;
1036
+ /**
1037
+ * The in-port whose literal names the event a write causes, when that is
1038
+ * decided per node rather than per definition — `record-event`'s `event`. The event must be one a package declared; the receipt records it
1039
+ * like any `causesEvent`. Never both on one definition.
1040
+ */
1041
+ causesEventFrom?: string;
1042
+ /**
1043
+ * Inlet only (R33, PLAN-turn-order §4.14): the event payload shapes this
1044
+ * inlet reads. A spec may lock one inlet to several events (`{ genre,
1045
+ * events }`) only when every listed event's `payload` is here; an inlet
1046
+ * that declares none answers one event. `core:inlet/session-event@1`
1047
+ * declares the session payloads.
1048
+ */
1049
+ payloads?: ShapeId[];
1050
+ /**
1051
+ * Outlet only: the row this outlet commits becomes the run's **live row**
1052
+ * (R-21 (2)) — where core routes an oracle's stream, and what Stop
1053
+ * finalises when a run is cancelled with nothing left to run.
1054
+ *
1055
+ * Declared rather than inferred from the event the write causes, because
1056
+ * two outlets can cause `message-created` and only one of them makes a
1057
+ * row a stream should land in: a greeting seed writes several messages
1058
+ * and none of them is anybody's placeholder. **Contract**: where the
1059
+ * stream lands is a property of the wiring the document was compiled
1060
+ * against.
1061
+ *
1062
+ * The declaration says the outlet *can* open the live row; a write opens
1063
+ * it only when it is a row still being written — its `generating` in-port
1064
+ * fed truthy, or its `row` in-port claiming an existing row
1065
+ * (`LIVE_ROW_PORTS`, `opensLiveRow`). A complete message written by the
1066
+ * same outlet is an ordinary write (F7, W1).
1067
+ */
1068
+ liveRow?: boolean;
1069
+ /**
1070
+ * Where an oracle's token usage sits on its response — a dotted path a
1071
+ * host may read for the receipt. **Policy**: it could only change what a
1072
+ * receipt reports, never what the node produces.
1073
+ */
1074
+ usage?: string;
1075
+ /**
1076
+ * Which media kinds this type can take in and give out.
1077
+ *
1078
+ * Declared rather than inferred from ports, because the ports are
1079
+ * deliberately general: one `media-ref` shape carries every kind, so the
1080
+ * port says *that* media flows here and this says *which*. That split is
1081
+ * what keeps a new modality from being a new shape, new ports and a new
1082
+ * branch in every wire adapter, while still letting a picker grey out a
1083
+ * connection that cannot read PDFs.
1084
+ *
1085
+ * A **type** declaring `accepts` says the contract has somewhere to put
1086
+ * media. Whether a given *connection* behind it actually does is a runtime
1087
+ * capability the adapter reports — same shape, same field name, resolved
1088
+ * against this at bind time. A spec that wires an image into a connection
1089
+ * whose model is text-only should fail where the user can see it, not at
1090
+ * the provider's HTTP call.
1091
+ *
1092
+ * **Contract**: it decides what a document may wire into the node's media
1093
+ * ports, which is what a bind-time refusal is checked against.
1094
+ */
1095
+ media?: MediaCapability;
1096
+ /**
1097
+ * The entry-row contract — present **only on entry types**, and its
1098
+ * presence is what makes one (`describeEntryType` is the only door that
1099
+ * sets it).
1100
+ *
1101
+ * Named `entryShape` on the same terms as `sessionShape`: `shape` above is
1102
+ * already the provider connection kind, and the two facts are unrelated.
1103
+ * Hashed, whole — see the note on `EntryShape`.
1104
+ */
1105
+ entryShape?: EntryShape;
1106
+ /**
1107
+ * The bands this source publishes, each with the variable that lays it out
1108
+ * (typed templates P2, 2026-09-27) — `{ secretEntry: varSecretEntry }`.
1109
+ *
1110
+ * A band is the ranker's word for one source's slice of the window, named
1111
+ * at the head of the source's candidates (`bandIntent`). Declared here, it
1112
+ * is also a **top-level template name**: Assemble renders it as
1113
+ * `{{{secretEntry}}}` through the variable's selected layout, and its
1114
+ * `variables` slot offers that layout as a setting (`rendersBands`).
1115
+ *
1116
+ * Keys are identifiers; the variable is registered and its scope declares
1117
+ * the key; a key never shadows a name core renders or means two things —
1118
+ * each refused at registration with the fix (`checkBandDeclarations`). A
1119
+ * band a source emits and does not declare is still ranked and budgeted,
1120
+ * reaches no template name, and is named on the receipt with the fix.
1121
+ *
1122
+ * **Contract** (`DESCRIPTOR_CONTRACT_KEYS`, owner ruling 2026-09-27): it
1123
+ * decides what a template may reference, so a plugin update that changes
1124
+ * which bands a step produces moves the hash — hashed as `{ key:
1125
+ * variableId }`, key order ignored. It still rides the registry row's
1126
+ * `policy` as `{ key: variableId }`, so a host reads a plugin's bands
1127
+ * without loading the plugin (F6), and `definitionContract` reads it back
1128
+ * from there to the same hash.
1129
+ * @experimental
1130
+ */
1131
+ bands?: Record<string, VariableDecl>;
1132
+ /**
1133
+ * Which out-ports carry each declared band — `{ recalledLines: ['messages'] }`.
1134
+ * A band not named here is carried on every out-port, which is what every
1135
+ * single-port source means.
1136
+ *
1137
+ * Needed by a source publishing different bands on different ports:
1138
+ * `core:query/entity-search@1` puts lore on `main` and recalled lines on
1139
+ * `messages`, and a spec wiring only `main` must not offer a template
1140
+ * `{{{recalledLines}}}` that can never fill. `bandsReaching` follows it;
1141
+ * each key must be a declared band and each port a declared out-port
1142
+ * (`checkBandDeclarations`).
1143
+ *
1144
+ * **Contract**, beside `bands` and for its reason: it decides which bands
1145
+ * reach a template. Rides the registry row's `policy` verbatim.
1146
+ * @experimental
1147
+ */
1148
+ bandPorts?: Record<string, readonly string[]>;
1149
+ /**
1150
+ * What each out-port's payload looks like, in the template type language
1151
+ * (typed templates P1) — `{ out: { templateContext: { type: 'object', … } } }`.
1152
+ *
1153
+ * A port says which shape flows; this says what is inside it, which is what
1154
+ * a template editor needs to offer `{{ templateContext.char }}` with a type.
1155
+ * Optional and additive: a port without one is `'any'`, as every port was.
1156
+ *
1157
+ * **Contract** (owner ruling 2026-09-27): what a template reading the port
1158
+ * may reference, so changing it moves the hash (display text stripped, as
1159
+ * in the slots). Like `bands`, it rides the row's `policy` verbatim and is
1160
+ * hashed from there.
1161
+ * @experimental
1162
+ */
1163
+ portSchemas?: {
1164
+ out?: Record<string, VarField>;
1165
+ };
1166
+ }
1167
+ /**
1168
+ * A descriptor's display text, beyond the `i18n`/`description` pair every
1169
+ * declaration carries.
1170
+ *
1171
+ * `label` is what settings.ts calls the canonical key for a field or a member
1172
+ * band — `i18n` there is its deprecated alias — and those sit two levels down
1173
+ * inside `slots[].schema` and `entryShape.fields`. Renaming "Top K" was
1174
+ * therefore a hash change, which is exactly the edit src/hash.ts promises will
1175
+ * not put the reload loop back.
1176
+ *
1177
+ * ⚠ `title` is deliberately absent. `WidgetDecl.title` is a heading, but
1178
+ * `EntryRoles.title` is which field the engine reads as a row's title —
1179
+ * contract, and moving one is an `@N+1` on purpose. One word, two answers, both
1180
+ * reachable from here, so a key-name rule cannot have it both ways; the panel
1181
+ * heading stays hashed until one of them is renamed.
1182
+ *
1183
+ * ## Where it is read
1184
+ *
1185
+ * Inside `definitionContract`, on every contract field that can carry a
1186
+ * label — `slots`, `scriptPoints`, `sessionShape`, `entryShape`. The
1187
+ * re-declaration guard below and core's `pipeline_definition_registry`
1188
+ * projection both hash through that one function, so there is no second list
1189
+ * to keep in step; the value is exported for the tests that prove the strip
1190
+ * holds at every depth. Adding a word here re-hashes every definition that
1191
+ * carries it — a pointer move on every install, exactly as adding one to
1192
+ * `UNIVERSAL_DISPLAY` would be.
1193
+ * @internal
1194
+ */
1195
+ export declare const DESCRIPTOR_DISPLAY_KEYS: DisplayKeys;
1196
+ /**
1197
+ * The two halves of a `Descriptor` (plans/31 V6, ruled 2026-09-17).
1198
+ *
1199
+ * **Contract** is what a pinned spec runs against: the ports and shapes a
1200
+ * document was compiled against, the slots it configures and their schema,
1201
+ * the effects the gate keys on, the fields a reviewer's decision may carry,
1202
+ * whether the node may fail empty, return early, draw on the seed, hold the
1203
+ * live row, cause an event, take media. It is what `definitionContractHash`
1204
+ * digests, and that hash is what a registry row's pointer and a run's receipt
1205
+ * name — so moving any of it republishes the slug on every install.
1206
+ *
1207
+ * **Policy** is what is *offered* or *shown*: whether the definition is
1208
+ * listed (`provisional`, `public`), where its gate starts, whether the panel
1209
+ * offers a switch, how long the host waits, what the receipt reads, what the
1210
+ * node is called. It lives on the registry row (`RegistryEntry.policy`,
1211
+ * `i18n`, `public`) and is never hashed: flipping any of it leaves every pin
1212
+ * where it is and takes effect on the next sync — and on the next hot reload,
1213
+ * since the registry replaces a re-declaration whose contract is unchanged.
1214
+ *
1215
+ * Every `Descriptor` key is in exactly one list. `DescriptorFieldsClassified`
1216
+ * below makes a key in neither — or in both — a compile error, so a new field
1217
+ * is classified before it exists; `sdk-tests/contract.test.ts` gives the
1218
+ * one-line reason per field.
1219
+ * @experimental
1220
+ */
1221
+ export declare const DESCRIPTOR_CONTRACT_KEYS: readonly ["id", "kind", "ports", "slots", "effects", "review", "shape", "optional", "declaresRandomness", "scriptPoints", "sessionShape", "earlyExit", "causesEvent", "causesEventFrom", "payloads", "liveRow", "media", "entryShape", "bands", "bandPorts", "portSchemas"];
1222
+ /** @experimental */
1223
+ export declare const DESCRIPTOR_POLICY_KEYS: readonly ["i18n", "reviewDefault", "toggleable", "provisional", "public", "timeoutMs", "timeoutKind", "usage"];
1224
+ /** @experimental */
1225
+ export type DescriptorContractKey = (typeof DESCRIPTOR_CONTRACT_KEYS)[number];
1226
+ /** @experimental */
1227
+ export type DescriptorPolicyKey = (typeof DESCRIPTOR_POLICY_KEYS)[number];
1228
+ type IsNever<T> = [T] extends [never] ? true : false;
1229
+ /**
1230
+ * `true` — and `never`, so the constant below stops compiling, the day a
1231
+ * `Descriptor` field is in neither list or in both. Nothing reads either;
1232
+ * the type error is the point.
1233
+ * @experimental
1234
+ */
1235
+ export type DescriptorFieldsClassified = [
1236
+ IsNever<Exclude<keyof Descriptor, DescriptorContractKey | DescriptorPolicyKey>>,
1237
+ IsNever<Extract<DescriptorContractKey, DescriptorPolicyKey>>
1238
+ ] extends [true, true] ? true : never;
1239
+ /** @experimental */
1240
+ export declare const DESCRIPTOR_FIELDS_CLASSIFIED: DescriptorFieldsClassified;
1241
+ /**
1242
+ * The policy half of a definition as a registry row carries it
1243
+ * (`RegistryEntry.policy`): the `Descriptor` fields that are policy and have
1244
+ * no column of their own. `i18n` and `public` are policy too and project to
1245
+ * their own columns; `usage` is read by no row reader and is not carried.
1246
+ * Mutable by design — a sync refreshes it in place, the hash never sees it —
1247
+ * with one exception: `bands` and `portSchemas` are contract carried here
1248
+ * (owner ruling 2026-09-27), so the row needs no column for them, and
1249
+ * `definitionContract` hashes them from here.
1250
+ * @experimental
1251
+ */
1252
+ export interface DefinitionPolicy {
1253
+ provisional?: true;
1254
+ reviewDefault?: ReviewPosition;
1255
+ timeoutMs?: number;
1256
+ timeoutKind?: 'wall' | 'idle';
1257
+ toggleable?: boolean;
1258
+ /** The bands a source declares, as `{ key: variableId }` — `Descriptor.bands`, by id. */
1259
+ bands?: Record<string, string>;
1260
+ /** `Descriptor.bandPorts`, keys and ports sorted. */
1261
+ bandPorts?: Record<string, string[]>;
1262
+ /** `Descriptor.portSchemas`, verbatim. */
1263
+ portSchemas?: {
1264
+ out?: Record<string, VarField>;
1265
+ };
1266
+ }
1267
+ /** A definition's policy, projected — `undefined` keys dropped so a row and a re-read agree. @experimental */
1268
+ export declare function definitionPolicy(d: {
1269
+ provisional?: true;
1270
+ reviewDefault?: ReviewPosition;
1271
+ timeoutMs?: number;
1272
+ timeoutKind?: 'wall' | 'idle';
1273
+ toggleable?: boolean;
1274
+ bands?: Record<string, VariableDecl | string>;
1275
+ bandPorts?: Record<string, readonly string[]>;
1276
+ portSchemas?: {
1277
+ out?: Record<string, VarField>;
1278
+ };
1279
+ }): DefinitionPolicy;
1280
+ /**
1281
+ * What `definitionContract` reads. A `Descriptor` satisfies it, and so does a
1282
+ * `RegistryEntry` — the same declaration from the other end of the table,
1283
+ * where the id is bare beside a `version`, the ports are shape ids, the
1284
+ * substrate's `settings` slot rides among the author's, and an entry type's
1285
+ * `fields` schema lives in `configSchema`. The material is the same object
1286
+ * from either, which is what lets core hash a row it read back and get the
1287
+ * hash it was written under.
1288
+ *
1289
+ * Script kinds ride the same registry rows (18 §2), so a row's `semantics` is
1290
+ * contract here too. Their own re-declaration guard (`scripts.ts`) hashes the
1291
+ * declaration whole and is not this function.
1292
+ * @experimental
1293
+ */
1294
+ export interface ContractSource {
1295
+ /** `ns:kind/name@N` on a descriptor; bare beside `version` on a row. */
1296
+ id: string;
1297
+ version?: number;
1298
+ kind: string;
1299
+ ports?: {
1300
+ in?: Record<string, unknown>;
1301
+ out?: Record<string, unknown>;
1302
+ };
1303
+ slots?: Record<string, unknown>;
1304
+ effects?: string;
1305
+ review?: {
1306
+ fields: readonly string[];
1307
+ };
1308
+ shape?: string;
1309
+ optional?: boolean;
1310
+ declaresRandomness?: boolean;
1311
+ scriptPoints?: ReadonlyArray<ScriptPointDecl>;
1312
+ sessionShape?: unknown;
1313
+ earlyExit?: boolean;
1314
+ causesEvent?: string;
1315
+ causesEventFrom?: string;
1316
+ payloads?: readonly string[];
1317
+ liveRow?: boolean;
1318
+ media?: unknown;
1319
+ entryShape?: unknown;
1320
+ /** A row's spelling of `entryShape.fields` (`RegistryEntry.configSchema`). */
1321
+ configSchema?: unknown;
1322
+ /** A descriptor's bands (`VariableDecl`) — or ids, as a row's policy spells them. */
1323
+ bands?: Record<string, VariableDecl | string>;
1324
+ bandPorts?: Record<string, readonly string[]>;
1325
+ portSchemas?: {
1326
+ out?: Record<string, VarField>;
1327
+ };
1328
+ /**
1329
+ * A row's policy half. Never hashed — except `bands` and `portSchemas`,
1330
+ * contract that rides here (owner ruling 2026-09-27) and is read from
1331
+ * here when the source has no field of its own.
1332
+ */
1333
+ policy?: {
1334
+ bands?: Record<string, string>;
1335
+ bandPorts?: Record<string, readonly string[]>;
1336
+ portSchemas?: {
1337
+ out?: Record<string, VarField>;
1338
+ };
1339
+ } | null;
1340
+ /** Script kinds only. */
1341
+ semantics?: string;
1342
+ }
1343
+ /**
1344
+ * The hashed material of a definition — the contract, as data.
1345
+ *
1346
+ * `id` and `version` are the slug's two halves; `ports` is shape ids by port
1347
+ * name, both directions always present; `slots` is the author's, display
1348
+ * text out (`DESCRIPTOR_DISPLAY_KEYS`); `entryShape` is whole, `fields`
1349
+ * included; `scriptPoints` is the full shape `scriptPointsOf` folds to. A
1350
+ * boolean flag is `true` or absent — `false` and unset mean the same thing
1351
+ * and hash the same, which is also what lets a `NOT NULL DEFAULT false`
1352
+ * column read back to the hash it was written under. A function value is
1353
+ * not contract (`declarationData`).
1354
+ * @experimental
1355
+ */
1356
+ export interface DefinitionContract {
1357
+ id: string;
1358
+ version: number;
1359
+ kind: string;
1360
+ ports: {
1361
+ in: Record<string, string | undefined>;
1362
+ out: Record<string, string | undefined>;
1363
+ };
1364
+ slots: Record<string, unknown>;
1365
+ effects?: string;
1366
+ review?: {
1367
+ fields: string[];
1368
+ };
1369
+ shape?: string;
1370
+ optional?: true;
1371
+ declaresRandomness?: true;
1372
+ scriptPoints?: unknown;
1373
+ sessionShape?: unknown;
1374
+ earlyExit?: true;
1375
+ causesEvent?: string;
1376
+ causesEventFrom?: string;
1377
+ payloads?: string[];
1378
+ liveRow?: true;
1379
+ media?: unknown;
1380
+ entryShape?: unknown;
1381
+ /** `{ key: variableId }` — which top-level template names this source publishes. */
1382
+ bands?: Record<string, string>;
1383
+ /** `{ key: ports }` — which out-ports carry a band; sorted. */
1384
+ bandPorts?: Record<string, string[]>;
1385
+ /** Out-port payload schemas, display text out. */
1386
+ portSchemas?: unknown;
1387
+ semantics?: string;
1388
+ }
1389
+ /** The contract of a definition — every `DESCRIPTOR_CONTRACT_KEYS` field, as data, and nothing else. @internal */
1390
+ export declare function definitionContract(source: ContractSource): DefinitionContract;
1391
+ /**
1392
+ * The content hash of a definition — a digest of `definitionContract`, and
1393
+ * the one answer to *is this the same definition?* The registry guard below,
1394
+ * core's `pipeline_definition_registry` pointer and a run's receipt all name
1395
+ * this string.
1396
+ * @internal
1397
+ */
1398
+ export declare function definitionContractHash(source: ContractSource): string;
1399
+ /**
1400
+ * The extras every script site is offered, whatever its slot lists (R32,
1401
+ * PLAN-turn-order §4.14): `session`, the run's settings document. The
1402
+ * executor supplies them at every site — a slot's port hook and an interior
1403
+ * point alike — so a slot's `extras` names only what is particular to it,
1404
+ * and listing an ambient one is refused (one way to say it, R26).
1405
+ * @internal
1406
+ */
1407
+ export declare const AMBIENT_SCRIPT_EXTRAS: readonly ['session'];
1408
+ /**
1409
+ * Can `swap` stand in for `pinned` at node `key` (R28)? A swap is seated with
1410
+ * the pin's node config, so it must be the same kind with the same in- and
1411
+ * out-ports (by name and shape) and the same slots — a slot the pin's node
1412
+ * does not wire would never reach the swap, and a person would pick an
1413
+ * option that silently ignores its own settings. Script points are free: a
1414
+ * chain is configured on the node key, whatever sits there. One sentence
1415
+ * for the builder and the package pass alike.
1416
+ * @experimental
1417
+ */
1418
+ export declare function swapFitFinding(key: string, pinned: Pick<Descriptor, 'id' | 'kind' | 'ports' | 'slots'>, swap: Pick<Descriptor, 'id' | 'kind' | 'ports' | 'slots'> & {
1419
+ provisional?: true;
1420
+ }): string | undefined;
1421
+ /**
1422
+ * Can one inlet answer every event of an `events` lock (R33)? Each listed
1423
+ * event must carry a payload the inlet declares it reads; an inlet that
1424
+ * declares none answers one event only. One sentence for the builder and
1425
+ * the package pass alike.
1426
+ * @experimental
1427
+ */
1428
+ export declare function eventsLockFindings(inlet: Pick<Descriptor, 'id' | 'payloads'>, events: readonly string[]): string[];
1429
+ /**
1430
+ * The display text of a list of widget declarations (R-20): each `title`
1431
+ * (required — the chrome and the tray show it) and each `settings` schema.
1432
+ * Shared by a session shape's `panels` and a genre's shape, which carry the
1433
+ * same declarations.
1434
+ * @experimental
1435
+ */
1436
+ export declare function widgetDeclsFindings(raw: unknown, where: string): string[];
1437
+ /** @experimental */
1438
+ export declare function getDefinition(id: string): Descriptor | undefined;
1439
+ /** @experimental */
1440
+ export declare function allDefinitions(): Descriptor[];
1441
+ /** @experimental */
1442
+ export declare function _clearDefinitions(): void;
1443
+ /**
1444
+ * ## Why every `describe*` is generic over its slots
1445
+ *
1446
+ * `Descriptor.slots` is the open `Record<string, SlotDecl>`, so a declaration
1447
+ * passed straight into it arrives with its **keys erased** — and with them the
1448
+ * `params` slot's `schema` keys, which is the entire declared parameter
1449
+ * vocabulary of the node. That erasure is what let `input.params.foo` be an
1450
+ * `any` lookup on a node whose schema has no `foo`: `topK` and `limit` were
1451
+ * both read that way for releases, off nodes that did declare them, at a
1452
+ * spelling nothing supplied.
1453
+ *
1454
+ * Capturing the argument in `S` keeps the literal keys, which is what
1455
+ * `InputOf` (src/nodeInput.ts) derives a handler's `input` type from.
1456
+ *
1457
+ * ⚠ **Type-level only.** `register()` still receives the same object and the
1458
+ * content hash is computed over the same runtime value, so nothing here moves a
1459
+ * declaration or re-hashes a type.
1460
+ *
1461
+ * ⚠ **`S` is constrained rather than `const`, and the difference is
1462
+ * deliberate.** `describeOracleDefinition` below needs the literal *values* — the
1463
+ * `optional: ['json_schema']` tuple `ctx.can()` narrows against — so it pays
1464
+ * for `const` with a validation done by intersection in the parameter. Names
1465
+ * are all `InputOf` needs, and an object literal keeps its own keys with or
1466
+ * without `const`; a `const` here would additionally freeze `accepts: [...]`
1467
+ * and `extras: [...]` into readonly tuples, which `SlotDecl` declares as
1468
+ * mutable `string[]` and which several core input and task types use.
1469
+ * @experimental
1470
+ */
1471
+ export declare const describeInletDefinition: <O extends PortDecl, I extends PortDecl, const Id extends string, const S extends Record<string, SlotDecl> = Record<string, SlotDecl>>(d: Omit<Descriptor<O, I, Id>, 'kind' | 'slots'> & {
1472
+ slots?: S;
1473
+ }) => Descriptor<O, I, Id> & {
1474
+ kind: 'inlet';
1475
+ slots?: S;
1476
+ };
1477
+ /** @experimental */
1478
+ export declare const describeQueryDefinition: <O extends PortDecl, I extends PortDecl, const Id extends string, const S extends Record<string, SlotDecl> = Record<string, SlotDecl>>(d: Omit<Descriptor<O, I, Id>, 'kind' | 'slots'> & {
1479
+ slots?: S;
1480
+ }) => Descriptor<O, I, Id> & {
1481
+ kind: 'query';
1482
+ slots?: S;
1483
+ };
1484
+ /** @public */
1485
+ export declare const describeTaskDefinition: <O extends PortDecl, I extends PortDecl, const Id extends string, const S extends Record<string, SlotDecl> = Record<string, SlotDecl>>(d: Omit<Descriptor<O, I, Id>, 'kind' | 'slots'> & {
1486
+ slots?: S;
1487
+ }) => Descriptor<O, I, Id> & {
1488
+ kind: 'task';
1489
+ slots?: S;
1490
+ };
1491
+ /**
1492
+ * An oracle definition.
1493
+ *
1494
+ * `const S` on the slots is what makes `ctx.can()` safe: without it,
1495
+ * `optional: ['json_schema']` widens to `CapabilityId[]` at the declaration and
1496
+ * the binding can only be told "some capability", which is no narrowing at all.
1497
+ * With it the literal tuple survives into `Pinned<D>` and out the other side, so
1498
+ * a binding asking about a capability its node never declared does not compile.
1499
+ * @experimental
1500
+ */
1501
+ export declare const describeOracleDefinition: <O extends PortDecl, I extends PortDecl, const Id extends string, const S extends Record<string, unknown> = Record<string, never>>(d: Omit<Descriptor<O, I, Id>, 'kind' | 'slots'> & {
1502
+ slots?: S & Record<string, SlotDecl>;
1503
+ }) => Descriptor<O, I, Id> & {
1504
+ kind: 'oracle';
1505
+ slots?: S;
1506
+ };
1507
+ /** @experimental */
1508
+ export declare const describeOutletDefinition: <O extends PortDecl, I extends PortDecl, const Id extends string, const S extends Record<string, SlotDecl> = Record<string, SlotDecl>>(d: Omit<Descriptor<O, I, Id>, 'kind' | 'slots'> & {
1509
+ slots?: S;
1510
+ }) => Descriptor<O, I, Id> & {
1511
+ kind: 'outlet';
1512
+ slots?: S;
1513
+ };
1514
+ /**
1515
+ * The field roles the engine reads. Frozen, and the reason it is frozen is rule 2
1516
+ * above: the list grows when a *behaviour* needs a new question answered, never
1517
+ * because a type has a field it would like consulted.
1518
+ * @experimental
1519
+ */
1520
+ export declare const ENTRY_ROLES: readonly [
1521
+ /** Which field is this row's display title. */
1522
+ 'title',
1523
+ /** How siblings sort among themselves — structured keys, never a string. */
1524
+ 'order',
1525
+ /** Which field carries the manual 1..3 boost. Absent means **no bonus**. */
1526
+ 'priority',
1527
+ /** Which reference column decides who may see this row, under which policy. */
1528
+ 'anchor',
1529
+ /** Which fields make the text an embedding is computed over. */
1530
+ 'embedText',
1531
+ /** Which field holds the trigger keys the keyword scan matches. */
1532
+ 'key',
1533
+ /** Which reference column points at the row this one hangs under. */
1534
+ 'parent'];
1535
+ /** @experimental */
1536
+ export type EntryRole = (typeof ENTRY_ROLES)[number];
1537
+ /**
1538
+ * The budget bands a candidate can compete in — the engine's `RetrievalBand`,
1539
+ * closed on purpose.
1540
+ *
1541
+ * ⚠ Closed because the failure of an open one is **silent**: the signal-weight
1542
+ * and share maps are total over this union, so an entry type declaring a band
1543
+ * nobody budgets has its candidates scored against `undefined` and dropped with
1544
+ * a green test suite. That is not hypothetical — history was absent from every
1545
+ * prompt for two spec versions exactly this way. A new shape picks the band it
1546
+ * competes in; it does not mint one.
1547
+ * @experimental
1548
+ */
1549
+ export declare const ENTRY_SOURCE_KINDS: readonly ['messages', 'worldLore', 'characterLore', 'history', 'relationships'];
1550
+ /** @experimental */
1551
+ export type EntrySourceKind = (typeof ENTRY_SOURCE_KINDS)[number];
1552
+ /**
1553
+ * The short name this type's rows carry on the wire — `extensions.serenepub`
1554
+ * in a character-card book.
1555
+ *
1556
+ * Closed to the names the importer reads: the three every file has carried,
1557
+ * plus `location` and `item`, which the app's importer restores as a place and
1558
+ * an item (lorebooks plan A26 — written as world lore, a place reads back
1559
+ * without its links' meaning or its stats). A type outside them declares
1560
+ * nothing here: no marker is honest, where a marker no importer reads is a
1561
+ * file that round-trips into the wrong shape. Widening the list is a
1562
+ * deliberate act with an importer change beside it.
1563
+ * @experimental
1564
+ */
1565
+ export declare const ENTRY_EXPORT_KEYS: readonly ['world', 'character', 'history', 'location', 'item'];
1566
+ /** @experimental */
1567
+ export type EntryExportKey = (typeof ENTRY_EXPORT_KEYS)[number];
1568
+ /**
1569
+ * Visibility policies a type may select for its anchor.
1570
+ *
1571
+ * `core:policy/binding-visibility@1` is the four branches character lore
1572
+ * already has — character equality, persona membership, narrator-only when the
1573
+ * binding is unbound, invisible when the row is unanchored. That is *policy*,
1574
+ * so it is named, versioned and implemented by core; the type picks from this
1575
+ * list and never authors one (rule 3).
1576
+ * @experimental
1577
+ */
1578
+ export declare const ENTRY_ANCHOR_POLICIES: readonly ['core:policy/binding-visibility@1'];
1579
+ /** @experimental */
1580
+ export type EntryAnchorPolicy = (typeof ENTRY_ANCHOR_POLICIES)[number];
1581
+ /**
1582
+ * How this type reaches a prompt: the id of the variable whose layout renders
1583
+ * its admitted rows (`core:var/world-lore@1`, `core:var/character-lore@1`).
1584
+ * A context template places that variable; nothing folds a type's rows into
1585
+ * another variable's value.
1586
+ * @experimental
1587
+ */
1588
+ export type EntryRender = string;
1589
+ /** One key of a sort, in an ordered list. Structured data — never a parsed string. @experimental */
1590
+ export interface EntryOrderKey {
1591
+ /** A declared field, or a column the engine reads for every type. */
1592
+ field: string;
1593
+ dir: 'asc' | 'desc';
1594
+ /**
1595
+ * Where absent values sort. Optional because the two-key case (a year and
1596
+ * a month that may be null) is the one that needs it, and most do not.
1597
+ */
1598
+ nulls?: 'first' | 'last';
1599
+ }
1600
+ /** The reference column that decides who may see a row, and under which policy. @experimental */
1601
+ export interface EntryAnchor {
1602
+ /**
1603
+ * The column carrying the reference. A **real column with a real foreign
1604
+ * key**, never a value inside `fields`: dangling and cross-tenant refs are
1605
+ * a live threat here, which is why cross-ref validation exists at all.
1606
+ */
1607
+ column: string;
1608
+ policy: EntryAnchorPolicy;
1609
+ }
1610
+ /**
1611
+ * Which field plays each field role for this type.
1612
+ *
1613
+ * Every field role is optional: a type answers the questions it has answers to,
1614
+ * and `checkEntryTypes` is what notices when a field role has stopped being
1615
+ * answered by anybody — so a dead field role is deleted rather than accreting.
1616
+ * @experimental
1617
+ */
1618
+ export interface EntryRoles {
1619
+ title?: string;
1620
+ order?: readonly EntryOrderKey[];
1621
+ priority?: string;
1622
+ anchor?: EntryAnchor;
1623
+ embedText?: readonly string[];
1624
+ key?: string;
1625
+ parent?: string;
1626
+ }
1627
+ /**
1628
+ * The entry-row contract, as it sits on the descriptor and in the row.
1629
+ *
1630
+ * **Hashed, all of it.** Field roles, render, source kind, export key and the anchor
1631
+ * policy are what the engine reads to decide where a row competes, how it
1632
+ * sorts, who may see it and where it renders — so changing one changes what an
1633
+ * untouched install does while every pin keeps resolving, which is precisely
1634
+ * the silent behaviour change the freeze rule exists to stop. The consequence
1635
+ * is intended: **moving a field role forces `@N+1`.**
1636
+ *
1637
+ * `fields` is hashed too, and it has to be for a second reason: the declared
1638
+ * schema is projected into database CHECK constraints, so a schema change is a
1639
+ * constraint change. Display text inside it (`i18n`, `description`) is stripped
1640
+ * before hashing like everywhere else.
1641
+ * @experimental
1642
+ */
1643
+ export interface EntryShape {
1644
+ roles: EntryRoles;
1645
+ /**
1646
+ * The type-specific half of the row — what lands in `fields` jsonb, declared
1647
+ * in the one field language (settings.ts), rendered by the one form
1648
+ * renderer, and projected into constraints and indexes by one boot step.
1649
+ *
1650
+ * Only the **T1 declarative** subset projects into a constraint: required,
1651
+ * type, min/max, enum. T2 predicates (`showIf`) are UI-level and depend on
1652
+ * state a row does not carry.
1653
+ */
1654
+ fields?: SettingsSchema;
1655
+ render?: EntryRender;
1656
+ sourceKind: EntrySourceKind;
1657
+ exportKey?: EntryExportKey;
1658
+ /**
1659
+ * What an amendment to one of these rows means: `amend` layers onto the
1660
+ * base, `replace` supersedes it.
1661
+ *
1662
+ * A **mode, not a per-amendment choice** — mixing both semantics in one
1663
+ * assembled view makes the result unpredictable. Declared on the type with
1664
+ * a per-row override, which is the nullable-with-fallback pattern
1665
+ * `matchMode` already uses.
1666
+ */
1667
+ amendMode?: 'amend' | 'replace';
1668
+ }
1669
+ /** What an author writes. Flat, because nesting the facets buys nothing here. @experimental */
1670
+ export interface EntryTypeDecl<Id extends string = string> extends EntryShape {
1671
+ /** `core:entry/<name>@N`. The version is the pin, exactly as for node definitions. */
1672
+ id: Id;
1673
+ i18n?: {
1674
+ name?: I18n;
1675
+ description?: I18n;
1676
+ };
1677
+ }
1678
+ /** An entry type as it comes back out of the registry — the kind, narrowed. @experimental */
1679
+ export type EntryDescriptor<Id extends string = string> = Descriptor<PortDecl, PortDecl, Id> & {
1680
+ kind: 'entry';
1681
+ entryShape: EntryShape;
1682
+ };
1683
+ /**
1684
+ * Declare an entry type.
1685
+ *
1686
+ * The version lives in the id and therefore at every call site that names one,
1687
+ * which is the same convention `pin()` keeps for node definitions. What is
1688
+ * deliberately *not* here is a pinned constructor: `pin()` mints `v1()`, and
1689
+ * `v1()` builds a node a spec wires. An entry type is a row shape — there is
1690
+ * nothing to construct — so minting one would offer a call that can only ever
1691
+ * be a mistake.
1692
+ * @experimental
1693
+ */
1694
+ export declare const describeEntryType: <const Id extends string>(d: EntryTypeDecl<Id>) => EntryDescriptor<Id>;
1695
+ /** Every entry type this build declares. @internal */
1696
+ export declare const allEntryTypes: () => EntryDescriptor[];
1697
+ /** A conformance finding. Every one names what to do, as everywhere here (15 §1.3). @experimental */
1698
+ export interface EntryFinding {
1699
+ severity: 'error';
1700
+ code: 'E_UNKNOWN_ROLE' | 'E_DEAD_ROLE';
1701
+ message: string;
1702
+ fix: string;
1703
+ where?: string;
1704
+ }
1705
+ /**
1706
+ * The conformance canary — the field role vocabulary checked in **both** directions
1707
+ * (the shape values.ts's four-way registry canary already has).
1708
+ *
1709
+ * Forward: nothing declares a field role the engine does not read.
1710
+ * `describeEntryType`
1711
+ * refuses that at the author's line, so this is the backstop for declarations
1712
+ * that did not come through the door — a row written by another build, a type
1713
+ * read back from the registry.
1714
+ *
1715
+ * Backward, and this is the direction that earns the canary: **every field role
1716
+ * the engine reads is declared by somebody.** A field role no type answers is a
1717
+ * question
1718
+ * the engine asks nothing, and the vocabulary is frozen precisely so that one
1719
+ * gets deleted rather than sitting there looking supported.
1720
+ * @experimental
1721
+ */
1722
+ export declare function checkEntryTypes(types: ReadonlyArray<{
1723
+ id: string;
1724
+ entryShape?: EntryShape;
1725
+ }>): EntryFinding[];
1726
+ /**
1727
+ * A pinned constructor. The builder method names the *kind*; this names the
1728
+ * *type and version* (04 §4b). Both are required — drop either and F21 or static
1729
+ * pin-checking goes with it.
1730
+ * @experimental
1731
+ */
1732
+ export interface NodeSpec<D extends Descriptor<any, any, any> = Descriptor> {
1733
+ readonly __node: true;
1734
+ descriptor: D;
1735
+ config: Record<string, unknown>;
1736
+ }
1737
+ /** `'core:query/session-history@2'` → `'2'`. Absent means `1`. */
1738
+ type VersionOf<S extends string> = S extends `${string}@${infer V}` ? V : '1';
1739
+ /** @experimental */
1740
+ export type NodeCtor<D extends Descriptor<any, any, any>> = (config?: Record<string, unknown>) => NodeSpec<D>;
1741
+ /**
1742
+ * A pinned constructor (04 §4b).
1743
+ *
1744
+ * The builder method names the **kind**; this names the **type and version**, and the
1745
+ * version sits at the call site — `generateText.v1({ … })` — for three reasons that a
1746
+ * version baked into the id cannot deliver:
1747
+ *
1748
+ * - upgrading a pin is a **visible diff**, not an invisible change of meaning
1749
+ * - two versions of a type can **coexist in one spec**, which a migration needs
1750
+ * - a deprecated pin **strikes through** on `generateText.v1` precisely, because the
1751
+ * key is what carries the version
1752
+ * @experimental
1753
+ */
1754
+ export type Pinned<D extends Descriptor<any, any, any>> = {
1755
+ readonly [K in `v${VersionOf<D['id']>}`]: NodeCtor<D>;
1756
+ } & {
1757
+ readonly id: D['id'];
1758
+ readonly descriptor: D;
1759
+ };
1760
+ /** @public */
1761
+ export declare function pin<D extends Descriptor<any, any, any>>(descriptor: D): Pinned<D>;
1762
+ /** The out-port map of whatever a pinned constructor produces — the scope's raw material. @experimental */
1763
+ export type OutPortsOf<N> = N extends NodeSpec<infer D> ? D extends Descriptor<infer O, any, any> ? O : PortDecl : PortDecl;
1764
+ /**
1765
+ * The in-ports that make a `liveRow` outlet's write the run's live row (F7,
1766
+ * W1): a placeholder (`generating`) or a claimed row (`row`). Anything else
1767
+ * the outlet writes is a complete row — an ordinary write, as many as the
1768
+ * pipeline likes.
1769
+ * @experimental
1770
+ */
1771
+ export declare const LIVE_ROW_PORTS: readonly ['generating', 'row'];
1772
+ /** Whether a `liveRow` outlet's resolved payload opens the live row (see `LIVE_ROW_PORTS`). @experimental */
1773
+ export declare function opensLiveRow(payload: unknown): boolean;
1774
+ //# sourceMappingURL=descriptors.d.ts.map