@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.
- package/LICENSE +202 -0
- package/NOTICE +17 -0
- package/README.md +368 -0
- package/dist/actions.d.ts +572 -0
- package/dist/actions.js +829 -0
- package/dist/annexFields.d.ts +234 -0
- package/dist/annexFields.js +413 -0
- package/dist/announce.d.ts +464 -0
- package/dist/announce.js +426 -0
- package/dist/attributes.d.ts +670 -0
- package/dist/attributes.js +904 -0
- package/dist/bands.d.ts +125 -0
- package/dist/bands.js +256 -0
- package/dist/builder.d.ts +683 -0
- package/dist/builder.js +677 -0
- package/dist/candidates.d.ts +109 -0
- package/dist/candidates.js +118 -0
- package/dist/capabilities.d.ts +744 -0
- package/dist/capabilities.js +679 -0
- package/dist/channels.d.ts +106 -0
- package/dist/channels.js +129 -0
- package/dist/clauses.d.ts +40 -0
- package/dist/clauses.js +43 -0
- package/dist/component.d.ts +33 -0
- package/dist/component.js +27 -0
- package/dist/componentBuild.d.ts +48 -0
- package/dist/componentBuild.js +84 -0
- package/dist/componentClient.d.ts +100 -0
- package/dist/componentClient.js +13 -0
- package/dist/componentImports.d.ts +51 -0
- package/dist/componentImports.js +106 -0
- package/dist/componentModule.d.ts +8 -0
- package/dist/componentModule.js +270 -0
- package/dist/componentWire.d.ts +130 -0
- package/dist/componentWire.js +280 -0
- package/dist/config.d.ts +295 -0
- package/dist/config.js +231 -0
- package/dist/connections.d.ts +89 -0
- package/dist/connections.js +131 -0
- package/dist/declarations.d.ts +290 -0
- package/dist/declarations.js +794 -0
- package/dist/descriptors.d.ts +1774 -0
- package/dist/descriptors.js +1329 -0
- package/dist/dev.d.ts +136 -0
- package/dist/dev.js +161 -0
- package/dist/document.d.ts +202 -0
- package/dist/document.js +312 -0
- package/dist/engines.d.ts +117 -0
- package/dist/engines.js +203 -0
- package/dist/eventMapLaws.d.ts +63 -0
- package/dist/eventMapLaws.js +128 -0
- package/dist/events.d.ts +554 -0
- package/dist/events.js +633 -0
- package/dist/executor.d.ts +771 -0
- package/dist/executor.js +1829 -0
- package/dist/extension.d.ts +448 -0
- package/dist/extension.js +315 -0
- package/dist/facets.d.ts +53 -0
- package/dist/facets.js +60 -0
- package/dist/foldedSections.d.ts +74 -0
- package/dist/foldedSections.js +161 -0
- package/dist/genres.d.ts +507 -0
- package/dist/genres.js +633 -0
- package/dist/guardedConnection.d.ts +138 -0
- package/dist/guardedConnection.js +341 -0
- package/dist/handlebarsReach.d.ts +122 -0
- package/dist/handlebarsReach.js +222 -0
- package/dist/hash.d.ts +146 -0
- package/dist/hash.js +166 -0
- package/dist/hookGrants.d.ts +47 -0
- package/dist/hookGrants.js +68 -0
- package/dist/hooks.d.ts +290 -0
- package/dist/hooks.js +113 -0
- package/dist/hostElements.d.ts +447 -0
- package/dist/hostElements.js +702 -0
- package/dist/i18n.d.ts +94 -0
- package/dist/i18n.js +123 -0
- package/dist/identity.d.ts +93 -0
- package/dist/identity.js +135 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +176 -0
- package/dist/layout.d.ts +194 -0
- package/dist/layout.js +40 -0
- package/dist/media.d.ts +202 -0
- package/dist/media.js +70 -0
- package/dist/messageBlocks.d.ts +487 -0
- package/dist/messageBlocks.js +683 -0
- package/dist/migration.d.ts +128 -0
- package/dist/migration.js +261 -0
- package/dist/names.d.ts +78 -0
- package/dist/names.js +136 -0
- package/dist/nodeInput.d.ts +399 -0
- package/dist/nodeInput.js +178 -0
- package/dist/participants.d.ts +291 -0
- package/dist/participants.js +252 -0
- package/dist/personGate.d.ts +62 -0
- package/dist/personGate.js +77 -0
- package/dist/pick.d.ts +84 -0
- package/dist/pick.js +103 -0
- package/dist/pluginHarness.d.ts +235 -0
- package/dist/pluginHarness.js +558 -0
- package/dist/pluginPermissions.d.ts +25 -0
- package/dist/pluginPermissions.js +97 -0
- package/dist/pluginRuleRef.d.ts +13 -0
- package/dist/pluginRuleRef.js +10 -0
- package/dist/predicates.d.ts +182 -0
- package/dist/predicates.js +249 -0
- package/dist/preview.d.ts +120 -0
- package/dist/preview.js +82 -0
- package/dist/promptBlocks.d.ts +130 -0
- package/dist/promptBlocks.js +197 -0
- package/dist/rankingDecisions.d.ts +60 -0
- package/dist/rankingDecisions.js +48 -0
- package/dist/receipt.d.ts +313 -0
- package/dist/receipt.js +60 -0
- package/dist/receiverRules.d.ts +24 -0
- package/dist/receiverRules.js +94 -0
- package/dist/refs.d.ts +117 -0
- package/dist/refs.js +137 -0
- package/dist/registry.d.ts +230 -0
- package/dist/registry.js +273 -0
- package/dist/review.d.ts +108 -0
- package/dist/review.js +97 -0
- package/dist/sampling.d.ts +152 -0
- package/dist/sampling.js +712 -0
- package/dist/scope.d.ts +65 -0
- package/dist/scope.js +128 -0
- package/dist/scripts.d.ts +243 -0
- package/dist/scripts.js +326 -0
- package/dist/sessionLayout.d.ts +339 -0
- package/dist/sessionLayout.js +503 -0
- package/dist/sessionSettings.d.ts +70 -0
- package/dist/sessionSettings.js +2 -0
- package/dist/settings.d.ts +501 -0
- package/dist/settings.js +604 -0
- package/dist/settingsSlot.d.ts +108 -0
- package/dist/settingsSlot.js +166 -0
- package/dist/shapes.d.ts +373 -0
- package/dist/shapes.js +408 -0
- package/dist/sheets.d.ts +165 -0
- package/dist/sheets.js +251 -0
- package/dist/statShapes.d.ts +96 -0
- package/dist/statShapes.js +112 -0
- package/dist/status.d.ts +103 -0
- package/dist/status.js +125 -0
- package/dist/storage.d.ts +145 -0
- package/dist/storage.js +33 -0
- package/dist/storyTime.d.ts +308 -0
- package/dist/storyTime.js +560 -0
- package/dist/surfaces.d.ts +501 -0
- package/dist/surfaces.js +292 -0
- package/dist/template.d.ts +312 -0
- package/dist/template.js +554 -0
- package/dist/templateCheck.d.ts +60 -0
- package/dist/templateCheck.js +516 -0
- package/dist/templateFit.d.ts +157 -0
- package/dist/templateFit.js +349 -0
- package/dist/templateIds.d.ts +138 -0
- package/dist/templateIds.js +144 -0
- package/dist/templateScopeAt.d.ts +131 -0
- package/dist/templateScopeAt.js +354 -0
- package/dist/testing.d.ts +177 -0
- package/dist/testing.js +383 -0
- package/dist/tokenizers.d.ts +113 -0
- package/dist/tokenizers.js +184 -0
- package/dist/turnLock.d.ts +96 -0
- package/dist/turnLock.js +79 -0
- package/dist/turnOrder.d.ts +143 -0
- package/dist/turnOrder.js +128 -0
- package/dist/validate.d.ts +74 -0
- package/dist/validate.js +1399 -0
- package/dist/values.d.ts +212 -0
- package/dist/values.js +390 -0
- package/dist/variables.d.ts +493 -0
- package/dist/variables.js +662 -0
- package/dist/verdicts.d.ts +275 -0
- package/dist/verdicts.js +348 -0
- package/dist/widgetDecls.d.ts +88 -0
- package/dist/widgetDecls.js +119 -0
- package/dist/widgets.d.ts +1527 -0
- package/dist/widgets.js +208 -0
- package/dist/wire.d.ts +126 -0
- package/dist/wire.js +140 -0
- package/dist/worldinfo.d.ts +150 -0
- package/dist/worldinfo.js +212 -0
- package/host-elements.d.ts +914 -0
- package/package.json +67 -0
package/dist/genres.d.ts
ADDED
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session genres (24 §3) — first-class declared objects with their own ids.
|
|
3
|
+
*
|
|
4
|
+
* A genre is what kind of session something is: `core:genre/chat`. It owns
|
|
5
|
+
* its id; the create pipeline is its **required member**, not its identity
|
|
6
|
+
* (revises 23 §7). The genre object declares everything a surface asks about
|
|
7
|
+
* for the life of a session — display name, family, standing shape — plus
|
|
8
|
+
* its **event surface**: which session events exist for this genre and which
|
|
9
|
+
* are required. Presets validate against that surface; dispatch keys on
|
|
10
|
+
* (genre, event).
|
|
11
|
+
*
|
|
12
|
+
* Pipelines reference the genre object directly (`input(…, { genre: chat,
|
|
13
|
+
* event: events.messageRespond })`) — a typed reference the compiler checks,
|
|
14
|
+
* never a string retyped per spec. In the document it serializes to the id.
|
|
15
|
+
*/
|
|
16
|
+
import type { WidgetDecl } from './layout.js';
|
|
17
|
+
import { type GenreLayoutDecl } from './widgetDecls.js';
|
|
18
|
+
import { type I18n, type SessionShape, type SlotDecl } from './descriptors.js';
|
|
19
|
+
import { type LocaleMap } from './i18n.js';
|
|
20
|
+
import { type AttributeSlotDecl } from './attributes.js';
|
|
21
|
+
import type { AttributeSheetDecl } from './sheets.js';
|
|
22
|
+
import { type EnabledWhen, type EnabledWhenDecl } from './predicates.js';
|
|
23
|
+
/** @experimental */
|
|
24
|
+
export declare function assertGenreId(id: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* The core session events (24 §5), as **event ids** — `core:event/<name>@1`.
|
|
27
|
+
*
|
|
28
|
+
* Constants so the core vocabulary is typo-proof. Since R-4 (ruled 2026-09-15,
|
|
29
|
+
* landed 2026-09-16) these ARE `CORE_EVENTS` entries (`events.ts`): one
|
|
30
|
+
* registry, and a genre's event surface, a preset's `bindings` map and a spec's
|
|
31
|
+
* inlet lock are all keyed by these ids. The bare names (`session-created`)
|
|
32
|
+
* were the keys until the fold; a host migrates its stored keys once.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export declare const sessionEvents: Readonly<{
|
|
36
|
+
/** The create slot — required; exactly one pipeline per genre declares it. */
|
|
37
|
+
readonly sessionCreated: 'core:event/session-created@1';
|
|
38
|
+
/** The primary turn. A swipe is this pipeline re-run, not a new event. */
|
|
39
|
+
readonly messageRespond: 'core:event/message-respond@1';
|
|
40
|
+
/** Arbitrary buttons/triggers — the existing functions surface (19 §3). */
|
|
41
|
+
readonly sessionAction: 'core:event/session-action@1';
|
|
42
|
+
/** A character or persona joined; payload carries the kind. */
|
|
43
|
+
readonly memberAdded: 'core:event/member-added@1';
|
|
44
|
+
/** A character or persona left; payload carries the kind. */
|
|
45
|
+
readonly memberRemoved: 'core:event/member-removed@1';
|
|
46
|
+
/**
|
|
47
|
+
* A form in a message was addressed to a participant the AI portrays
|
|
48
|
+
* (R-15 *Forms*; U5d). Optional in every genre's surface: a genre that
|
|
49
|
+
* binds nothing leaves such a form waiting, as it would for a person.
|
|
50
|
+
*/
|
|
51
|
+
readonly formAddressed: 'core:event/form-addressed@1';
|
|
52
|
+
/** A row that is not generating landed — a send, a greeting, a finished or stopped reply. */
|
|
53
|
+
readonly messageCompleted: 'core:event/message-completed@1';
|
|
54
|
+
/** A person rewrote a settled message. */
|
|
55
|
+
readonly messageEdited: 'core:event/message-edited@1';
|
|
56
|
+
/** A message was deleted. */
|
|
57
|
+
readonly messageDeleted: 'core:event/message-deleted@1';
|
|
58
|
+
/** A message was hidden from the prompt, or shown again. */
|
|
59
|
+
readonly messageHidden: 'core:event/message-hidden@1';
|
|
60
|
+
/** A line's shown sprite changed — a picker's choice or a person's (DESIGN-sprites). */
|
|
61
|
+
readonly spriteShown: 'core:event/sprite-shown@1';
|
|
62
|
+
/** A seated participant's row changed — active, position, visibility or portrayal. */
|
|
63
|
+
readonly castChanged: 'core:event/cast-changed@1';
|
|
64
|
+
/** `sessions:update` landed — name, scenario, lorebook, genre fields, preset, channels, tags. */
|
|
65
|
+
readonly sessionUpdated: 'core:event/session-updated@1';
|
|
66
|
+
/** A session was branched at a message into a new session; recorded on the branch. */
|
|
67
|
+
readonly sessionBranched: 'core:event/session-branched@1';
|
|
68
|
+
/**
|
|
69
|
+
* A pipeline's annex entry changed — "my state changed". Caused by
|
|
70
|
+
* `core:outlet/set-session-annex@1`; the payload names the owner.
|
|
71
|
+
*/
|
|
72
|
+
readonly annexChanged: 'core:event/annex-changed@1';
|
|
73
|
+
/**
|
|
74
|
+
* `metadata.turnOrder` was written. **For typing only**: core-internal,
|
|
75
|
+
* read by the auto-advance listener and the `sessions:turnOrder` push;
|
|
76
|
+
* `genre()` refuses it in `events`, so no preset can bind it.
|
|
77
|
+
*/
|
|
78
|
+
readonly turnOrderChanged: 'core:event/turn-order-changed@1';
|
|
79
|
+
}>;
|
|
80
|
+
/** @experimental */
|
|
81
|
+
export type SessionEvent = (typeof sessionEvents)[keyof typeof sessionEvents];
|
|
82
|
+
/**
|
|
83
|
+
* Why no genre may list, and no spec may lock, `turn-order-changed`
|
|
84
|
+
* (PLAN-turn-order §4.1): the turn-order write's own event is core-internal.
|
|
85
|
+
* One sentence for `genre()`, the builder's `.inlet()` and the package pass.
|
|
86
|
+
* @experimental
|
|
87
|
+
*/
|
|
88
|
+
export declare const TURN_ORDER_CHANGED_IS_INTERNAL: string;
|
|
89
|
+
/** One entry of a genre's event surface. @experimental */
|
|
90
|
+
export interface GenreEventDecl {
|
|
91
|
+
/** A preset for this genre must bind this event. */
|
|
92
|
+
required?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* An open slot: any number of pipelines may serve it (actions). A
|
|
95
|
+
* non-open event binds at most one pipeline per preset.
|
|
96
|
+
*/
|
|
97
|
+
open?: boolean;
|
|
98
|
+
}
|
|
99
|
+
/** @public */
|
|
100
|
+
export interface GenreDecl {
|
|
101
|
+
readonly id: string;
|
|
102
|
+
/** The picker card's title — a string or a locale map with `en` (R-20). */
|
|
103
|
+
readonly name: I18n;
|
|
104
|
+
readonly family: string;
|
|
105
|
+
/** The picker card's subtitle. */
|
|
106
|
+
readonly description?: I18n;
|
|
107
|
+
/** The standing SessionShape every surface asks about (19 §1). */
|
|
108
|
+
readonly shape?: SessionShape;
|
|
109
|
+
/**
|
|
110
|
+
* The event surface: which events exist for this genre, and which are
|
|
111
|
+
* required. `session-created` is implicitly required for every genre and
|
|
112
|
+
* is added if absent — a genre without a create pipeline is not a genre.
|
|
113
|
+
*/
|
|
114
|
+
readonly events: Readonly<Record<string, GenreEventDecl>>;
|
|
115
|
+
/**
|
|
116
|
+
* The attribute slots this genre brings — `hp` and `gold` for a dungeon
|
|
117
|
+
* crawl, `weather` and `time-of-day` for an adventure.
|
|
118
|
+
*
|
|
119
|
+
* The declarations themselves, not ids: a genre that names a slot nothing
|
|
120
|
+
* declared would be a session whose stats validate against nothing. Core
|
|
121
|
+
* owns the *types* (attributes.ts); a genre composes definitions from them,
|
|
122
|
+
* which is why this list is a genre's to carry and not core's.
|
|
123
|
+
*
|
|
124
|
+
* A genre that advertises none — the standard chat — is a session where no
|
|
125
|
+
* bar is ever drawn, which is the one-LLM-call rule holding at the surface.
|
|
126
|
+
*/
|
|
127
|
+
readonly slots?: readonly AttributeSlotDecl[];
|
|
128
|
+
/**
|
|
129
|
+
* The attribute **sheets** this genre brings — named, ordered bundles of
|
|
130
|
+
* the same slots (`sheets.ts`).
|
|
131
|
+
*
|
|
132
|
+
* Beside `slots` rather than instead of it, and both are read: a genre may
|
|
133
|
+
* name a handful of loose slots, a sheet, or both, and `genreSlots` is the
|
|
134
|
+
* one union of the two. A sheet is what carries the things a loose list
|
|
135
|
+
* cannot — the order the slots are drawn and evaluated in, and the
|
|
136
|
+
* `required`/`default`/`config` a genre decides per slot — so a genre with
|
|
137
|
+
* anything to say about those says it with a sheet.
|
|
138
|
+
*/
|
|
139
|
+
readonly sheets?: readonly AttributeSheetDecl[];
|
|
140
|
+
/**
|
|
141
|
+
* 🚧 Whether a session of this genre may track attributes **beyond** the
|
|
142
|
+
* genre's own `slots` and `sheets` (its baseline) — ruled 2026-09-25:
|
|
143
|
+
* "genres set the baseline and allow/deny custom attributes from being
|
|
144
|
+
* added". `'allow'`: a session reads its world's attributes (the sheets
|
|
145
|
+
* on its lorebook and cast members, and every slot the world's timeline
|
|
146
|
+
* holds), on by default and picked slot by slot, and may add its own.
|
|
147
|
+
* `'deny'` (the default when unstated): the session tracks exactly the
|
|
148
|
+
* baseline — the standard chat denies, so a chat session never grows a
|
|
149
|
+
* bar because its lorebook happens to carry one.
|
|
150
|
+
*
|
|
151
|
+
* Not `slots`: those are what the genre brings; this is whether anything
|
|
152
|
+
* else may come in.
|
|
153
|
+
*/
|
|
154
|
+
readonly customAttributes?: CustomAttributes;
|
|
155
|
+
/**
|
|
156
|
+
* The **envoys** this genre brings with it (plans/29 R-18, ruled
|
|
157
|
+
* 2026-09-15; built 2026-09-16 as U5g) — speakers that exist nowhere in
|
|
158
|
+
* the library: Serene Pub's guide, a dungeon's narrator-in-residence. An
|
|
159
|
+
* array, so a genre may offer several; the session or its preset's
|
|
160
|
+
* defaults seat one or more, and `default: true` seats one with no choice.
|
|
161
|
+
*
|
|
162
|
+
* Normalised at declaration: every entry carries `speaks` (`in-turn`
|
|
163
|
+
* unless stated), keys are unique, at most one is the default, and every
|
|
164
|
+
* `name` is display text with `en` — a string or a locale map (R-20). Part
|
|
165
|
+
* of the declaration's hash, so a changed envoy is a changed genre.
|
|
166
|
+
*/
|
|
167
|
+
readonly envoys?: readonly EnvoyDecl[];
|
|
168
|
+
/**
|
|
169
|
+
* 🚧 What a person's **persona-less line** is called in this genre
|
|
170
|
+
* (lair re-plan R4, owner ruling 3, 2026-09-28) — the Lair's
|
|
171
|
+
* "Dungeon Master". The counterpart to envoys: an envoy names a speaker
|
|
172
|
+
* the genre brings, this names the person at the keyboard when no persona
|
|
173
|
+
* speaks for them.
|
|
174
|
+
*
|
|
175
|
+
* Display text (R-20), normalised to a locale map at the declaration.
|
|
176
|
+
* Read at render and at prompt time — the log's author name, the
|
|
177
|
+
* transcript label, `{{playerLabel}}` in every context builder — and
|
|
178
|
+
* **never stamped on a row**: it is a role, not an identity, so a rename
|
|
179
|
+
* relabels history. A session may override it; the settings document's
|
|
180
|
+
* `playerLabel` is the session's value, else this, else absent.
|
|
181
|
+
*
|
|
182
|
+
* Refused on a genre whose `shape.personas.min` is 1 or more: a persona
|
|
183
|
+
* always names the person's line there, so nothing would ever carry it.
|
|
184
|
+
* Absent when unstated, so a genre that says nothing hashes as it did.
|
|
185
|
+
*/
|
|
186
|
+
readonly playerLabel?: LocaleMap;
|
|
187
|
+
/**
|
|
188
|
+
* The genre's **enabled-when defaults** (plans/29 R-15; U5e, built
|
|
189
|
+
* 2026-09-17), keyed by action **identity** — `<spec>#<key>`, and
|
|
190
|
+
* `core#<verb>` for one of core's message verbs (plans/31 V2, ruled
|
|
191
|
+
* 2026-09-17; it was the function key until then). A genre's defaults
|
|
192
|
+
* name its own actions and core's verbs; a key that is not an identity
|
|
193
|
+
* is refused at the declaration. An action that declares its own
|
|
194
|
+
* `enabledWhen` beats this; a session's binding override beats both. Each entry is the junction clause's predicate
|
|
195
|
+
* shape over the session's published values (`predicates.ts`), stored
|
|
196
|
+
* in list form with `reason` a locale map; refused at the declaration
|
|
197
|
+
* on the same terms as the envoys.
|
|
198
|
+
*/
|
|
199
|
+
readonly enabledWhen?: Readonly<Record<string, readonly EnabledWhen[]>>;
|
|
200
|
+
/**
|
|
201
|
+
* The genre's **pinned settings** (PLAN-turn-order §4.13, R14; ruled
|
|
202
|
+
* 2026-09-21) — the genre layer of the settings cascade, keyed by
|
|
203
|
+
* setting key: `session > genre > core`.
|
|
204
|
+
*
|
|
205
|
+
* A genre that declares the field (`shape.fields[key]`) **and** pins a
|
|
206
|
+
* value here gets the pinned value as the control's initial value; the
|
|
207
|
+
* person's stored value wins over it. A genre that pins a value and
|
|
208
|
+
* declares no field renders no control, stores nothing on the session,
|
|
209
|
+
* and the pinned value is what every run reads — the replacement for a
|
|
210
|
+
* `hidden` flag. A pinned value is never stored per session.
|
|
211
|
+
*/
|
|
212
|
+
readonly settings?: Readonly<Record<string, unknown>>;
|
|
213
|
+
/**
|
|
214
|
+
* Widgets this genre's sessions do not offer (R71) — any package's, core's
|
|
215
|
+
* included, by the id the page knows them by (`widgetRef`). Declared by
|
|
216
|
+
* value (`omitWidgets: [coreWidgets.stats]`).
|
|
217
|
+
*/
|
|
218
|
+
readonly omitWidgets?: readonly string[];
|
|
219
|
+
/** The layouts this genre ships (R71); the first is its default. */
|
|
220
|
+
readonly layouts?: readonly GenreLayoutDecl[];
|
|
221
|
+
}
|
|
222
|
+
/** @experimental */
|
|
223
|
+
export interface GenreProps {
|
|
224
|
+
/** The picker card's title — a string or a locale map with `en` (R-20). */
|
|
225
|
+
name: I18n;
|
|
226
|
+
family: string;
|
|
227
|
+
description?: I18n;
|
|
228
|
+
shape?: SessionShape;
|
|
229
|
+
events?: Record<string, GenreEventDecl>;
|
|
230
|
+
slots?: readonly AttributeSlotDecl[];
|
|
231
|
+
sheets?: readonly AttributeSheetDecl[];
|
|
232
|
+
/** Whether sessions may track attributes beyond the baseline — see `GenreDecl.customAttributes`. */
|
|
233
|
+
customAttributes?: CustomAttributes;
|
|
234
|
+
envoys?: readonly EnvoyDecl[];
|
|
235
|
+
/** What a person's persona-less line is called — see `GenreDecl.playerLabel`. */
|
|
236
|
+
playerLabel?: I18n;
|
|
237
|
+
/** Enabled-when defaults per action identity — see `GenreDecl.enabledWhen`. */
|
|
238
|
+
enabledWhen?: Readonly<Record<string, EnabledWhenDecl>>;
|
|
239
|
+
/** Pinned setting values — the genre layer of the cascade; see `GenreDecl.settings`. */
|
|
240
|
+
settings?: Readonly<Record<string, unknown>>;
|
|
241
|
+
/** Widgets this genre's sessions do not offer, by value (R71). */
|
|
242
|
+
omitWidgets?: readonly WidgetDecl[];
|
|
243
|
+
/** The layouts this genre ships (`layout()`); the first is its default. */
|
|
244
|
+
layouts?: readonly GenreLayoutDecl[];
|
|
245
|
+
}
|
|
246
|
+
/** 🚧 Whether a genre's sessions may track attributes beyond its baseline (`GenreDecl.customAttributes`). @experimental */
|
|
247
|
+
export type CustomAttributes = 'allow' | 'deny';
|
|
248
|
+
/** Does this genre let its sessions track attributes beyond its own? Unstated is `'deny'`. @experimental */
|
|
249
|
+
export declare const genreAllowsCustomAttributes: (g: GenreDecl | string) => boolean;
|
|
250
|
+
/**
|
|
251
|
+
* When an envoy speaks (plans/29 R-21 (6)).
|
|
252
|
+
*
|
|
253
|
+
* · `in-turn` — a turn-taking candidate like any cast character: the turn
|
|
254
|
+
* strategies may pick it, the composer's reply may be its. The default for
|
|
255
|
+
* a genre's envoys.
|
|
256
|
+
* · `on-action` — speaks **only through an action's outputs**: a dice
|
|
257
|
+
* plugin's *Roll* reports as its envoy, and no strategy ever picks it. The
|
|
258
|
+
* only value an action's envoy may carry (`ActionDecl.envoy`).
|
|
259
|
+
* @experimental
|
|
260
|
+
*/
|
|
261
|
+
export type EnvoySpeaks = 'in-turn' | 'on-action';
|
|
262
|
+
/**
|
|
263
|
+
* A speaker a genre or a contributed action brings with it (plans/29 R-18).
|
|
264
|
+
*
|
|
265
|
+
* Declared in one of exactly two places — `GenreDecl.envoys[]` or
|
|
266
|
+
* `ActionDecl.envoy` — and nowhere else: there is no API to add an envoy to
|
|
267
|
+
* another genre and no user authors one. Addressed as `envoy:<slug>` wherever
|
|
268
|
+
* a character is `character:<id>` (`participants.ts`): a genre's slug is its
|
|
269
|
+
* `key`; an action's is `<plugin>.<key>`, namespaced like a slash name so it
|
|
270
|
+
* cannot collide with a genre's (`envoyIdentity`).
|
|
271
|
+
*
|
|
272
|
+
* Its data is **configuration** (R-18 (2)): `prompts`, `description` and
|
|
273
|
+
* `image` are the genre's declared defaults, read by a pipeline node through
|
|
274
|
+
* `slot.prompts({ envoy })` and tuned in the Pipelines panel with deviation
|
|
275
|
+
* semantics like any other setting — no second schema.
|
|
276
|
+
*
|
|
277
|
+
* ⚠ Not a *character* (a library row) and not a *persona* (the user's own).
|
|
278
|
+
* @experimental
|
|
279
|
+
*/
|
|
280
|
+
export interface EnvoyDecl {
|
|
281
|
+
/** The genre-local key — lowercase kebab, no dots (a dot marks an action's namespace). */
|
|
282
|
+
key: string;
|
|
283
|
+
/** Display text (R-20): a string or a locale map with `en` — `'Guide'` is `{ en: 'Guide' }`. */
|
|
284
|
+
name: I18n;
|
|
285
|
+
/**
|
|
286
|
+
* ⏳ An `http(s)://` URL or a `data:image/…` URI (`ENVOY_IMAGE`) — refused
|
|
287
|
+
* at the declaration otherwise, because a host renders it as an `<img>`
|
|
288
|
+
* source and nothing else, and a `javascript:` or `data:text/html` string
|
|
289
|
+
* is not an image. Neither the SDK nor the catalog ships binary assets
|
|
290
|
+
* today (widgets carry Lucide icon *names*); until a package can ship an
|
|
291
|
+
* image, the string is the image.
|
|
292
|
+
*/
|
|
293
|
+
image?: string;
|
|
294
|
+
description?: I18n;
|
|
295
|
+
/**
|
|
296
|
+
* The envoy's authored instructions — the fields of the context builder's
|
|
297
|
+
* `prompts` slot (`core:task/build-template-context@1`: `systemPrompt`,
|
|
298
|
+
* `postHistoryInstructions`), because that is the slot a node reads them
|
|
299
|
+
* through. One vocabulary, read by reference; never a mapping.
|
|
300
|
+
*/
|
|
301
|
+
prompts?: {
|
|
302
|
+
systemPrompt?: string;
|
|
303
|
+
postHistoryInstructions?: string;
|
|
304
|
+
};
|
|
305
|
+
/** Seated on every new session of the genre, with no choice. At most one per genre. */
|
|
306
|
+
default?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* The genre's **fallback envoy** (ruled 2026-09-26: "everyone should have
|
|
309
|
+
* names, even just placeholders") — the speaker a line **nobody claims**
|
|
310
|
+
* posts as: a message a pipeline writes with no character, no persona, no
|
|
311
|
+
* `speaker` and no `narration`. The host stamps its reference on the row
|
|
312
|
+
* at the write (`metadata.speaker = envoy:<key>`), so the line is named
|
|
313
|
+
* like any envoy's. At most one per genre, and a **genre's** envoy only:
|
|
314
|
+
* an action's envoy already speaks for exactly its action.
|
|
315
|
+
*
|
|
316
|
+
* Not `default` (seated with no choice) and not a turn: a fallback that
|
|
317
|
+
* should never be picked by a strategy says `speaks: 'on-action'`. A genre
|
|
318
|
+
* that declares none gets `UNCLAIMED_LINE_NAME` — never "Unknown".
|
|
319
|
+
*/
|
|
320
|
+
fallback?: boolean;
|
|
321
|
+
/** See `EnvoySpeaks`. A genre's default is `in-turn`; an action's envoy is always `on-action`. */
|
|
322
|
+
speaks?: EnvoySpeaks;
|
|
323
|
+
/**
|
|
324
|
+
* The line this envoy opens a new session with (lair re-plan R6,
|
|
325
|
+
* 2026-09-28): the Lair's Castellan introduces the game and invites the
|
|
326
|
+
* person to start. **Declared, not generated** — a create run is a
|
|
327
|
+
* person waiting, so it calls no model; the text is interpolated
|
|
328
|
+
* (`{{char}}` is the envoy, `{{playerLabel}}`, `{{characterNames}}`)
|
|
329
|
+
* and written by the genre's create spec through
|
|
330
|
+
* `core:query/envoy-greeting@1`, only while the envoy is seated.
|
|
331
|
+
*
|
|
332
|
+
* `channel` is where it lands, one the genre declares (default `main`).
|
|
333
|
+
* A **genre's** envoy only: an action's envoy speaks for its action.
|
|
334
|
+
*
|
|
335
|
+
* ⚠ Not `SessionShape.greeting`, which is the CARDS' greetings.
|
|
336
|
+
*/
|
|
337
|
+
greeting?: EnvoyGreeting;
|
|
338
|
+
}
|
|
339
|
+
/** An envoy's opening line and where it lands — see `EnvoyDecl.greeting`. @experimental */
|
|
340
|
+
export interface EnvoyGreeting {
|
|
341
|
+
/** The line, interpolated at create. Display text (R-20). */
|
|
342
|
+
text: I18n;
|
|
343
|
+
/** A channel the genre declares. Default `main`. */
|
|
344
|
+
channel?: string;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* The name a line nobody claims is shown and prompted under when its genre
|
|
348
|
+
* declares no fallback envoy (`EnvoyDecl.fallback`) — display text (R-20), read
|
|
349
|
+
* in the viewer's language. The host's last resort, so no line is ever
|
|
350
|
+
* attributed to "Unknown" (ruled 2026-09-26). The same word the host already
|
|
351
|
+
* gives narration with no narrator name.
|
|
352
|
+
* @experimental
|
|
353
|
+
*/
|
|
354
|
+
export declare const UNCLAIMED_LINE_NAME: LocaleMap;
|
|
355
|
+
/** An envoy's key: a lowercase kebab token. Dots are reserved for an action's namespace. @experimental */
|
|
356
|
+
export declare const ENVOY_KEY: RegExp;
|
|
357
|
+
/** An envoy's image: an `http(s)://` URL or a `data:image/…` URI — an `<img>` source, nothing else. @experimental */
|
|
358
|
+
export declare const ENVOY_IMAGE: RegExp;
|
|
359
|
+
/**
|
|
360
|
+
* Every fault in one envoy declaration, as sentences (the teaching-error
|
|
361
|
+
* pattern, 15 §1.3). Empty when it is sound. `owner` says which of the two
|
|
362
|
+
* declaring places this is, because an action's envoy has one rule of its own:
|
|
363
|
+
* it may only be `on-action`.
|
|
364
|
+
* @internal
|
|
365
|
+
*/
|
|
366
|
+
export declare function envoyFindings(raw: unknown, at: string, owner?: 'genre' | 'action'): string[];
|
|
367
|
+
/**
|
|
368
|
+
* The findings on a genre's whole list: each entry's, plus unique keys, at
|
|
369
|
+
* most one default, and — given the genre's `channels` (slugs, `main`
|
|
370
|
+
* included; R6) — a greeting on a channel the genre does not declare.
|
|
371
|
+
* @internal
|
|
372
|
+
*/
|
|
373
|
+
export declare function envoysFindings(raw: unknown, at?: string, channels?: readonly string[]): string[];
|
|
374
|
+
/** One envoy in its document form: `speaks` stated, nothing else added. @experimental */
|
|
375
|
+
export declare function normalizeEnvoy(raw: EnvoyDecl, speaks: EnvoySpeaks): EnvoyDecl;
|
|
376
|
+
/**
|
|
377
|
+
* A genre's enabled-when defaults, as findings: keyed by an action identity
|
|
378
|
+
* (`<spec>#<key>`, or `core#<verb>`), each value a predicate or a list judged
|
|
379
|
+
* by `enabledWhenFindings`. Empty when sound or absent.
|
|
380
|
+
* @experimental
|
|
381
|
+
*/
|
|
382
|
+
export declare function genreEnabledWhenFindings(raw: unknown, at?: string): string[];
|
|
383
|
+
/**
|
|
384
|
+
* Every display string a genre carries (R-20): `name` (required) and
|
|
385
|
+
* `description`; the shape's `fields` schema and its `panels[]` titles; and
|
|
386
|
+
* the `label` / `description` of every slot and sheet it brings. The slots and
|
|
387
|
+
* sheets passed their own doors already; they are read again here because a
|
|
388
|
+
* genre is the declaration a session is created under, and a picker card that
|
|
389
|
+
* lists a slot with no label is this genre's defect to hear about.
|
|
390
|
+
* @experimental
|
|
391
|
+
*/
|
|
392
|
+
export declare function genreDisplayTextFindings(props: GenreProps, at: string): string[];
|
|
393
|
+
/** Core's conversation widget — the primary widget a genre must replace if it withholds it. @internal */
|
|
394
|
+
export declare const CONVERSATION_WIDGET_ID = "messages";
|
|
395
|
+
/**
|
|
396
|
+
* Declare a genre. The id is stated in full, under your plugin's slug
|
|
397
|
+
* (`acme.dice:genre/table`), and the genre value is what everything else
|
|
398
|
+
* references.
|
|
399
|
+
* @public
|
|
400
|
+
*/
|
|
401
|
+
export declare function genre(id: string, props: GenreProps): GenreDecl;
|
|
402
|
+
/** @internal */
|
|
403
|
+
export declare const getGenre: (id: string) => GenreDecl | undefined;
|
|
404
|
+
/** @experimental */
|
|
405
|
+
export declare const genres: () => GenreDecl[];
|
|
406
|
+
/** @experimental */
|
|
407
|
+
export declare function _clearGenres(): void;
|
|
408
|
+
/**
|
|
409
|
+
* Register a genre from a package's **stored manifest** — the declaration
|
|
410
|
+
* `genre()` already built and `serene-pub build` serialised, which the host
|
|
411
|
+
* reads back because it never evaluates a plugin's code in-process.
|
|
412
|
+
*
|
|
413
|
+
* Not `genre()`: that is the authoring door and takes values (widget refs,
|
|
414
|
+
* `EnabledWhenDecl`), where a manifest holds their compiled form (widget ids,
|
|
415
|
+
* normalised predicates) — re-running the authoring checks over it would
|
|
416
|
+
* refuse the very shape they produced. What is checked here is what a stored
|
|
417
|
+
* row can still get wrong: the id grammar, the `core:` namespace, and that the
|
|
418
|
+
* owner segment is the declaring package's. A present entry is **replaced**,
|
|
419
|
+
* like a stored slot: the manifest is the one author, and an upgraded package
|
|
420
|
+
* re-registering is that author, not a second party.
|
|
421
|
+
* @internal
|
|
422
|
+
*/
|
|
423
|
+
export declare function _registerPackageGenre(packageId: string, raw: GenreDecl): GenreDecl;
|
|
424
|
+
/**
|
|
425
|
+
* Withdraw a package's genre, so a disabled or uninstalled plugin's genre stops
|
|
426
|
+
* resolving and an upgraded package may declare it again, differently. The
|
|
427
|
+
* host's to call when it reconciles plugin genres. `core:` genres are never
|
|
428
|
+
* withdrawn: they arrive and leave with the build.
|
|
429
|
+
* @internal
|
|
430
|
+
*/
|
|
431
|
+
export declare function _withdrawGenre(id: string): boolean;
|
|
432
|
+
/**
|
|
433
|
+
* The attribute slots a session of this genre carries — its sheets' and its own
|
|
434
|
+
* loose list, as one vocabulary.
|
|
435
|
+
*
|
|
436
|
+
* Sheets first, in the order the genre names them and each in its own order,
|
|
437
|
+
* then whatever the genre lists loose that no sheet already brought. Deduped by
|
|
438
|
+
* id, and the *first* mention is what fixes a slot's position: order here is
|
|
439
|
+
* not decoration — it is what a panel draws, what a state block renders, and
|
|
440
|
+
* what rules run in — so the union preserves it rather than sorting it.
|
|
441
|
+
*
|
|
442
|
+
* An id this build does not declare answers with an empty list rather than
|
|
443
|
+
* with every slot in the registry: an unknown genre is a genre whose vocabulary
|
|
444
|
+
* this install cannot state, and guessing it is how a stat appears where the
|
|
445
|
+
* author never put one. A sheet entry naming a slot this build no longer
|
|
446
|
+
* declares is skipped on the same terms. Values already stored against such a
|
|
447
|
+
* session are untouched — they are read as opaque data, which is the standing
|
|
448
|
+
* "never refuse, fall back and say so" rule for a stale binding.
|
|
449
|
+
* @experimental
|
|
450
|
+
*/
|
|
451
|
+
export declare const genreSlots: (id: string) => readonly AttributeSlotDecl[];
|
|
452
|
+
/**
|
|
453
|
+
* The sheets a genre brings, by id or by declaration — empty for a genre this
|
|
454
|
+
* build does not declare, on the same "never guess" terms as `genreSlots`.
|
|
455
|
+
*
|
|
456
|
+
* The declarations and not just their slots, because `required`, `default` and
|
|
457
|
+
* the per-slot `config` are what session creation and the panels read, and
|
|
458
|
+
* `genreSlots` has deliberately flattened those away.
|
|
459
|
+
* @internal
|
|
460
|
+
*/
|
|
461
|
+
export declare const genreSheets: (g: GenreDecl | string) => readonly AttributeSheetDecl[];
|
|
462
|
+
/**
|
|
463
|
+
* The envoys a genre declares, by id — empty for a genre this build does not
|
|
464
|
+
* declare, on the same "never guess" terms as `genreSlots`.
|
|
465
|
+
* @experimental
|
|
466
|
+
*/
|
|
467
|
+
export declare const genreEnvoys: (id: string) => readonly EnvoyDecl[];
|
|
468
|
+
/**
|
|
469
|
+
* The genre's fallback envoy (`EnvoyDecl.fallback`) — the speaker a line
|
|
470
|
+
* nobody claims posts as — or undefined when it declares none.
|
|
471
|
+
* @experimental
|
|
472
|
+
*/
|
|
473
|
+
export declare const genreFallbackEnvoy: (g: GenreDecl | string) => EnvoyDecl | undefined;
|
|
474
|
+
/** One of a genre's envoys by key, or undefined. @experimental */
|
|
475
|
+
export declare const genreEnvoy: (g: GenreDecl | string, key: string) => EnvoyDecl | undefined;
|
|
476
|
+
/**
|
|
477
|
+
* The genre's enabled-when default for one function, by id or declaration —
|
|
478
|
+
* empty for a genre this build does not declare or a function it says
|
|
479
|
+
* nothing about, on the same "never guess" terms as `genreSlots`.
|
|
480
|
+
* @internal
|
|
481
|
+
*/
|
|
482
|
+
export declare const genreEnabledWhen: (g: GenreDecl | string, fn: string) => readonly EnabledWhen[];
|
|
483
|
+
/** A genre reference as it lands in documents: always the id. Takes a `GenreDecl`, a `use()` ref or an id. @experimental */
|
|
484
|
+
export declare const genreIdOf: (g: GenreDecl | {
|
|
485
|
+
readonly id: string;
|
|
486
|
+
} | string) => string;
|
|
487
|
+
/**
|
|
488
|
+
* The configurable surface of one envoy, as a slot declaration (R-18 (2)).
|
|
489
|
+
*
|
|
490
|
+
* An envoy is not a node and has no registry row to carry a declaration —
|
|
491
|
+
* so the SDK declares its slot from the two facts the genre does carry, its
|
|
492
|
+
* `prompts` defaults and its name, the way `clauseSettingsSlotFor` declares
|
|
493
|
+
* a gather clause's mode. A host renders it through the same reader a node's
|
|
494
|
+
* slot goes through, at the address `envoy:<key>` (`envoyConfigKey`), with
|
|
495
|
+
* the genre's text as the author default: an admin's edit is a deviation
|
|
496
|
+
* above it, and clearing the edit is the genre's text again.
|
|
497
|
+
*
|
|
498
|
+
* `parameters`, not `prompts`, and the reason is what each kind means to a
|
|
499
|
+
* panel: a `prompts` slot is a **reference** to a swappable prompt row, and
|
|
500
|
+
* an envoy's instructions are not a row anybody swaps — they are the genre's
|
|
501
|
+
* words, tuned in place. The slot is still *named* `prompts`, because that
|
|
502
|
+
* is the name the reading node's own slot has and the name `slot.prompts({
|
|
503
|
+
* envoy })` resolves at; the fields are that node's fields.
|
|
504
|
+
* @internal
|
|
505
|
+
*/
|
|
506
|
+
export declare function envoyPromptsSlotFor(envoy: EnvoyDecl): SlotDecl;
|
|
507
|
+
//# sourceMappingURL=genres.d.ts.map
|