@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/events.d.ts
ADDED
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The event registry (01 §8 / F8, 13 §7 and §7g).
|
|
3
|
+
*
|
|
4
|
+
* No node emits: a write causes the event its outlet declares. Core's events are a
|
|
5
|
+
* closed set; a package declares its own with `defineSessionEvent()` and records one
|
|
6
|
+
* with the `record-event` write. Both kinds live in this registry.
|
|
7
|
+
*
|
|
8
|
+
* Two things here are deliberate and both were rulings, not conveniences:
|
|
9
|
+
*
|
|
10
|
+
* 1. **`slug` is the stable reference, not the id.** The primary key differs between
|
|
11
|
+
* instances because it autoincrements; the slug is what lets a seeded row be
|
|
12
|
+
* identified, synced and updated across instances and upgrades. Same convention
|
|
13
|
+
* belongs on every core-seeded registry — types, surfaces, shapes — so there is
|
|
14
|
+
* one identity convention rather than four.
|
|
15
|
+
*
|
|
16
|
+
* 2. **Two families.** A *data* event says something changed and carries write-target
|
|
17
|
+
* mappings, so it participates in the write → event → subscription cycle check.
|
|
18
|
+
* An *action* event says someone asked — a click, a scheduler tick. It has no write
|
|
19
|
+
* targets, so it drops out of the cycle graph instead of needing an exception.
|
|
20
|
+
* Without the distinction, `ui-action` would either blur F8's "occurrences core
|
|
21
|
+
* observes" or need a special case in the CTE.
|
|
22
|
+
*/
|
|
23
|
+
import type { ShapeId } from './shapes.js';
|
|
24
|
+
import type { RunLineage } from './executor.js';
|
|
25
|
+
import type { TurnOrderV1 } from './turnOrder.js';
|
|
26
|
+
import { type I18n } from './i18n.js';
|
|
27
|
+
/** @experimental */
|
|
28
|
+
export type EventFamily = 'data' | 'action';
|
|
29
|
+
/** @experimental */
|
|
30
|
+
export interface EventDef {
|
|
31
|
+
/** Autoincrement in core; opaque here. Never the reference used to sync. */
|
|
32
|
+
id: number;
|
|
33
|
+
/** Unique, PK-agnostic, stable across instances and upgrades (13 §7g). */
|
|
34
|
+
slug: string;
|
|
35
|
+
version: number;
|
|
36
|
+
family: EventFamily;
|
|
37
|
+
/** Does firing this touch a user's account or assets? Drives consent (11 §4). */
|
|
38
|
+
affectsUser: boolean;
|
|
39
|
+
/** Data events only: the consumer targets whose writes cause this event. */
|
|
40
|
+
causedBy?: string[];
|
|
41
|
+
/**
|
|
42
|
+
* A **declared root** (PLAN-turn-order §B3, C28): the event starts from
|
|
43
|
+
* outside every pipeline — a person or the host does it — so it needs no
|
|
44
|
+
* `causedBy`. A genre may list an event only if it is caused or a declared
|
|
45
|
+
* root. Distinct from the event map's computed `root` (no `causes` edge
|
|
46
|
+
* in): `message-respond` is a declared root the auto-advance listener
|
|
47
|
+
* also causes.
|
|
48
|
+
*/
|
|
49
|
+
declaredRoot?: true;
|
|
50
|
+
/**
|
|
51
|
+
* The shape of what a listener receives (R-15, 2026-09-16). A shape id,
|
|
52
|
+
* on the same terms as a port's: `pipeline_event_registry.payload_shape`
|
|
53
|
+
* projects it, and the field-by-field account lives on the payload
|
|
54
|
+
* interface the id names (`SessionChangePayload` for
|
|
55
|
+
* `core:shape/session-change@1`). Optional so an event whose payload is
|
|
56
|
+
* still the description's prose (`ui-action`, `schedule-tick`) registers
|
|
57
|
+
* as it always did.
|
|
58
|
+
*/
|
|
59
|
+
payload?: ShapeId;
|
|
60
|
+
/**
|
|
61
|
+
* What a person reads for this event where a screen names one — a
|
|
62
|
+
* preset's binding slots, a consent line. A locale map with `en`
|
|
63
|
+
* mandatory, like every other display string; the id
|
|
64
|
+
* (`core:event/message-respond@1`) is the address and is shown as the
|
|
65
|
+
* tooltip, never as the label. Optional so a declaration without one
|
|
66
|
+
* still registers; a host falls back to the humanised slug.
|
|
67
|
+
*/
|
|
68
|
+
name?: {
|
|
69
|
+
en: string;
|
|
70
|
+
} & Record<string, string>;
|
|
71
|
+
description: string;
|
|
72
|
+
/** Reserved, always null in 0.6. Reopening is a permission, not a migration. */
|
|
73
|
+
ownerPluginId?: null;
|
|
74
|
+
}
|
|
75
|
+
/** @experimental */
|
|
76
|
+
export declare function defineEvent(def: Omit<EventDef, 'id' | 'ownerPluginId'>): EventDef;
|
|
77
|
+
/** @internal */
|
|
78
|
+
export declare const getEvent: (slug: string) => EventDef | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* The event an id names — core's (`core:event/message-completed@1`) or one a
|
|
81
|
+
* package declared — or `undefined`. Core's are keyed by bare slug, so the
|
|
82
|
+
* owner and version are checked here rather than trusted:
|
|
83
|
+
* `acme:event/message-completed@1` is not core's event.
|
|
84
|
+
* @experimental
|
|
85
|
+
*/
|
|
86
|
+
export declare function eventById(id: string): EventDef | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* The sentence every door refuses an undeclared event with: a lock, a
|
|
89
|
+
* `causesEvent`, a recording. One wording, so a modder meets the same fix
|
|
90
|
+
* wherever the mistake was written.
|
|
91
|
+
* @experimental
|
|
92
|
+
*/
|
|
93
|
+
export declare const notADeclaredEvent: (id: string) => string;
|
|
94
|
+
/** @internal */
|
|
95
|
+
export declare const allEvents: () => EventDef[];
|
|
96
|
+
/**
|
|
97
|
+
* `owner:event/name@N` — the grammar every event key wears since R-4: a
|
|
98
|
+
* genre's event surface, a preset's `bindings` map and a spec's inlet lock
|
|
99
|
+
* are keyed by this and nothing else. The owner segment matches the genre
|
|
100
|
+
* id's (`core`, `acme.rp`); the name is lowercase-hyphenated; the version
|
|
101
|
+
* is a whole number.
|
|
102
|
+
* @experimental
|
|
103
|
+
*/
|
|
104
|
+
export declare const EVENT_ID: RegExp;
|
|
105
|
+
/**
|
|
106
|
+
* Is this string an event id? A bare name (`message-respond`) is not, and a
|
|
107
|
+
* host that stored bare keys before the fold migrates them once — it never
|
|
108
|
+
* accepts a new one (plans/30 §U3 review, W6).
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
export declare const isEventId: (id: string) => boolean;
|
|
112
|
+
/**
|
|
113
|
+
* The events the inter-spec cycle CTE reads (F9). Action events are excluded by
|
|
114
|
+
* construction rather than by an exception someone has to remember.
|
|
115
|
+
* @experimental
|
|
116
|
+
*/
|
|
117
|
+
export declare const cycleRelevantEvents: () => EventDef[];
|
|
118
|
+
/** @experimental */
|
|
119
|
+
export declare function _clearEvents(): void;
|
|
120
|
+
/**
|
|
121
|
+
* An event a package declares: something that happened, recorded by a
|
|
122
|
+
* pipeline's `record-event` write and heard by anything in its scope — for a
|
|
123
|
+
* session event, the session's bound pipelines, plugin listeners and widgets
|
|
124
|
+
* (R56). Declared once, globally, and passed by value wherever it is recorded
|
|
125
|
+
* or heard. Who may record it is the package entry's to say:
|
|
126
|
+
* `defineExtension({ events })`.
|
|
127
|
+
*
|
|
128
|
+
* ⚠ An event is a happening, never a secret: everything in the session hears
|
|
129
|
+
* its payload. Keep a secret in state, in a part whose audience is empty.
|
|
130
|
+
* @experimental
|
|
131
|
+
*/
|
|
132
|
+
export interface SessionEventDecl<Payload = unknown> {
|
|
133
|
+
readonly __decl: 'session-event';
|
|
134
|
+
/** `<package slug>:event/<name>@<version>`. */
|
|
135
|
+
readonly id: string;
|
|
136
|
+
/** The shape of what the recording carries; a new shape is a new version. */
|
|
137
|
+
readonly payload: ShapeId;
|
|
138
|
+
readonly name: I18n;
|
|
139
|
+
readonly description: I18n;
|
|
140
|
+
/** Which part of the app it happens in. Only `session` exists before SDK 1.0. */
|
|
141
|
+
readonly domain: 'session';
|
|
142
|
+
/** Phantom — carries the payload's type. Never populated. */
|
|
143
|
+
readonly __payload?: Payload;
|
|
144
|
+
}
|
|
145
|
+
/** The shape every recorded event reaches a listener in (see `RecordedEventPayload`). @experimental */
|
|
146
|
+
export declare const RECORDED_EVENT_SHAPE = "core:shape/recorded-event@1";
|
|
147
|
+
/** What a listener's inlet receives for a recorded event. @experimental */
|
|
148
|
+
export interface RecordedEventPayload<P = unknown> {
|
|
149
|
+
event: string;
|
|
150
|
+
sessionId: number;
|
|
151
|
+
at: number;
|
|
152
|
+
cause?: EventCause;
|
|
153
|
+
lineage?: RunLineage;
|
|
154
|
+
/** What the recording pipeline wrote, in the event's declared payload shape. */
|
|
155
|
+
payload: P;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Declare an event your package's pipelines record. The id is under
|
|
159
|
+
* your package's slug; the payload is a shape id, and a pipeline that records
|
|
160
|
+
* the event is checked against it at publish. Registered on declaration, so a
|
|
161
|
+
* spec's inlet may lock on it: `.inlet('e', C.sessionEvent.v1(), { genre,
|
|
162
|
+
* events: [guessed] })`.
|
|
163
|
+
* @experimental
|
|
164
|
+
*/
|
|
165
|
+
export declare function defineSessionEvent<Payload = unknown>(d: {
|
|
166
|
+
id: string;
|
|
167
|
+
payload: ShapeId | {
|
|
168
|
+
readonly id: ShapeId;
|
|
169
|
+
};
|
|
170
|
+
name: I18n;
|
|
171
|
+
description: I18n;
|
|
172
|
+
}): SessionEventDecl<Payload>;
|
|
173
|
+
/** The most a recording's payload may weigh, serialized — it rides every listener's inlet and the ledger. @experimental */
|
|
174
|
+
export declare const MAX_RECORDED_PAYLOAD_BYTES: number;
|
|
175
|
+
/**
|
|
176
|
+
* What is wrong with a value recorded as an event's payload, or undefined.
|
|
177
|
+
* The host's check at the write: plain JSON, within the size cap, and a
|
|
178
|
+
* string where the declared shape is text. Publish checks the wiring; this
|
|
179
|
+
* checks the value that actually arrived.
|
|
180
|
+
* @experimental
|
|
181
|
+
*/
|
|
182
|
+
export declare function recordedPayloadFindings(shape: ShapeId, value: unknown): string | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Withdraw a package event, so an upgraded package may declare it again,
|
|
185
|
+
* differently. The host's to call on uninstall and reinstall.
|
|
186
|
+
* @internal
|
|
187
|
+
*/
|
|
188
|
+
export declare function _withdrawSessionEvent(id: string): void;
|
|
189
|
+
/** A package event by id, or undefined. @experimental */
|
|
190
|
+
export declare const packageEventById: (id: string) => SessionEventDecl | undefined;
|
|
191
|
+
/** Whether a value is an event declaration (so a literal can be written as its id). @experimental */
|
|
192
|
+
export declare const isSessionEventDecl: (v: unknown) => v is SessionEventDecl;
|
|
193
|
+
/** @experimental */
|
|
194
|
+
export declare const CORE_EVENTS: {
|
|
195
|
+
readonly messageCreated: EventDef;
|
|
196
|
+
/**
|
|
197
|
+
* A row was finished or rewritten by a pipeline's own write. A regenerate,
|
|
198
|
+
* a swipe's fresh alternative and an extend are THIS event with `verb`
|
|
199
|
+
* on the payload — `regenerate` · `swipe` · `extend` — rather than three
|
|
200
|
+
* events of their own (R-15, 2026-09-16): each is the genre's pipeline
|
|
201
|
+
* producing text plus core's rewrite of the row, and the rewrite is one
|
|
202
|
+
* outlet. A plain reply's finishing write carries no `verb`.
|
|
203
|
+
*/
|
|
204
|
+
readonly messageUpdated: EventDef;
|
|
205
|
+
readonly messageDeleted: EventDef;
|
|
206
|
+
readonly messageHidden: EventDef;
|
|
207
|
+
readonly messageEdited: EventDef;
|
|
208
|
+
readonly messageSwiped: EventDef;
|
|
209
|
+
/**
|
|
210
|
+
* A line's **shown sprite** changed (DESIGN-sprites §5.2): a sprite picker
|
|
211
|
+
* chose one after a reply, or a person changed it from the message menu.
|
|
212
|
+
* The payload names the line, the speaker, the `{ set, label }` now shown
|
|
213
|
+
* (null for none) and `source` — `picker` or `person`. What TTS line
|
|
214
|
+
* direction and any face-driven widget listen for.
|
|
215
|
+
*/
|
|
216
|
+
readonly spriteShown: EventDef;
|
|
217
|
+
/**
|
|
218
|
+
* Stop is not a write outlet: it is the run-level guarantee (R-17) —
|
|
219
|
+
* core finalises the row a cancelled run was filling — so it has no
|
|
220
|
+
* `causedBy`. Emitted by the host from that finalisation, and from the
|
|
221
|
+
* message's own Stop when it releases the row first.
|
|
222
|
+
*/
|
|
223
|
+
readonly messageStopped: EventDef;
|
|
224
|
+
readonly sessionBranched: EventDef;
|
|
225
|
+
/**
|
|
226
|
+
* A row that is **not generating** landed: a user send, a seeded
|
|
227
|
+
* greeting, a finalised reply, a stopped reply. Never for a placeholder
|
|
228
|
+
* or a generating row — the reply's *completion* is the fact, not its
|
|
229
|
+
* opening. Distinct from `message-created` (which fires at the write,
|
|
230
|
+
* placeholder included) and `message-updated` (which also fires on an
|
|
231
|
+
* attach): this is the one event that means "there is a new settled
|
|
232
|
+
* turn to answer".
|
|
233
|
+
*/
|
|
234
|
+
readonly messageCompleted: EventDef;
|
|
235
|
+
/**
|
|
236
|
+
* A seated participant's row changed — switched on or off (`active`),
|
|
237
|
+
* `position` or portrayal. Not add or remove: those stay
|
|
238
|
+
* `member-added` / `member-removed`. No `causedBy`: the cast toggles are
|
|
239
|
+
* socket writes, not an outlet's.
|
|
240
|
+
*/
|
|
241
|
+
readonly castChanged: EventDef;
|
|
242
|
+
/**
|
|
243
|
+
* The session row changed. Two origins: a person's settings write
|
|
244
|
+
* (`sessions:update` and the other settings sockets — name, scenario,
|
|
245
|
+
* lorebook, genre fields, preset, channels, tags; cause `settings`), and
|
|
246
|
+
* `core:outlet/advance-story-clock`, which moves the session's story
|
|
247
|
+
* clock (`changed: ['storyClock']`, cause `run`). The payload's `changed`
|
|
248
|
+
* lists the fields by name. `causedBy` names the outlet, so the event map
|
|
249
|
+
* draws the edge a spec bound here that advances the clock would loop
|
|
250
|
+
* on; it is therefore not a declared root, though a person's write also
|
|
251
|
+
* starts it (as the auto-advance listener also causes `message-respond`).
|
|
252
|
+
* ⚠ Never emitted by `writeTurnOrder`, which is raw SQL for exactly this
|
|
253
|
+
* reason (§3).
|
|
254
|
+
*/
|
|
255
|
+
readonly sessionUpdated: EventDef;
|
|
256
|
+
/**
|
|
257
|
+
* `metadata.turnOrder` was written by `core:outlet/set-turn-order@1`.
|
|
258
|
+
* **Core-internal**: the auto-advance listener and the
|
|
259
|
+
* `sessions:turnOrder` push read it; `genre()` refuses it in a genre's
|
|
260
|
+
* `events`, so no preset can bind a spec to it and the recompute cannot
|
|
261
|
+
* feed itself.
|
|
262
|
+
*/
|
|
263
|
+
readonly turnOrderChanged: EventDef;
|
|
264
|
+
/**
|
|
265
|
+
* A pipeline's annex entry changed: "my state changed", for any genre.
|
|
266
|
+
* A package writes its annex through `core:outlet/set-session-annex@1`
|
|
267
|
+
* and binds this; for a named happening of its own it declares an event
|
|
268
|
+
* and records it. Emitted only
|
|
269
|
+
* when the merged value differs from the stored one, so a spec that
|
|
270
|
+
* rewrites the same value cannot feed itself; the lineage caps stop the
|
|
271
|
+
* rest.
|
|
272
|
+
*/
|
|
273
|
+
readonly annexChanged: EventDef;
|
|
274
|
+
/**
|
|
275
|
+
* Not a write's event: the marker the `sessionChanges` list ends with when
|
|
276
|
+
* more than fifty changes waited between two replies (U5b review S1). The
|
|
277
|
+
* newest fifty are delivered and this one entry says how many older ones
|
|
278
|
+
* were not, so a pipeline can tell a full list from a truncated one. Never
|
|
279
|
+
* written to `session_changes` and never on a receipt's `emitted` — no
|
|
280
|
+
* `causedBy`, because no outlet causes it.
|
|
281
|
+
*/
|
|
282
|
+
readonly sessionChangesTruncated: EventDef;
|
|
283
|
+
/**
|
|
284
|
+
* A **form** — a `choices` or `form` block a message carries — was
|
|
285
|
+
* addressed to a participant the AI portrays this turn (R-15 *Forms*;
|
|
286
|
+
* R-21 (5); 30 §U5d). Caused by the write that carried the block, and
|
|
287
|
+
* dispatched through the same path as the lifecycle events, so every
|
|
288
|
+
* answer run is a child of the run that asked (`parentRunId`,
|
|
289
|
+
* `rootRunId`, `depth`) and 01 §8's cycle caps hold: a form whose answer
|
|
290
|
+
* asks another form stops at the depth cap, receipted. A form addressed
|
|
291
|
+
* to a person is no event: the block waits for the click.
|
|
292
|
+
*/
|
|
293
|
+
readonly formAddressed: EventDef;
|
|
294
|
+
/**
|
|
295
|
+
* A form was **answered** — by a click, or by the answer pipeline's
|
|
296
|
+
* outlet committing an oracle's answer exactly as a click would. Lands in
|
|
297
|
+
* the session's changes so the next reply's inlet sees it (`answer`,
|
|
298
|
+
* `addressee`, `blockId`, `action` on the payload).
|
|
299
|
+
*/
|
|
300
|
+
readonly formAnswered: EventDef;
|
|
301
|
+
/**
|
|
302
|
+
* A form was **superseded** (plans/29 R-15 *Staleness and order*; 30
|
|
303
|
+
* §U5f): the channel head moved past the turn it was issued at before it
|
|
304
|
+
* was answered, and a press on it reached the door. Recorded ONCE per
|
|
305
|
+
* block, the first time the door sees it stale, so the next reply's
|
|
306
|
+
* inlet learns the question lapsed — not on every render, and never by a
|
|
307
|
+
* render. No outlet causes it: the door does, like the truncation marker.
|
|
308
|
+
*/
|
|
309
|
+
readonly formSuperseded: EventDef;
|
|
310
|
+
readonly loreEntryCreated: EventDef;
|
|
311
|
+
/**
|
|
312
|
+
* Two lore entries were linked (L2, 2026-09-17) — a room's exit, who keeps
|
|
313
|
+
* what, what stands near what.
|
|
314
|
+
*
|
|
315
|
+
* Its own event rather than `lore-entry-created`: a link is not an entry,
|
|
316
|
+
* nothing about it is created or changed, and a subscriber that wants to
|
|
317
|
+
* redraw a map wants exactly this and none of the writes that make rows.
|
|
318
|
+
*
|
|
319
|
+
* ⚠ It declares no payload shape — it rides the run's receipt as caused by
|
|
320
|
+
* the outlet, and the link itself (its name, its words both ways) is the
|
|
321
|
+
* outlet's `linkId` row, read where it is needed (places plan B2,
|
|
322
|
+
* 2026-09-29). An idempotent repeat that found the standing row wrote
|
|
323
|
+
* nothing, and causes no event (`written: false`).
|
|
324
|
+
*/
|
|
325
|
+
readonly loreLinkCreated: EventDef;
|
|
326
|
+
readonly graphProposalCreated: EventDef;
|
|
327
|
+
/** The create slot — required; exactly one pipeline per genre answers it. */
|
|
328
|
+
readonly sessionCreated: EventDef;
|
|
329
|
+
/** The primary turn. A swipe is this pipeline re-run, not a new event. */
|
|
330
|
+
readonly messageRespond: EventDef;
|
|
331
|
+
/** Arbitrary buttons/triggers — the contributed functions surface (19 §3). */
|
|
332
|
+
readonly sessionAction: EventDef;
|
|
333
|
+
readonly memberAdded: EventDef;
|
|
334
|
+
readonly memberRemoved: EventDef;
|
|
335
|
+
/**
|
|
336
|
+
* A UI action asked for a run (13 §7). Carrying both users is what answers the
|
|
337
|
+
* budget-owner question without a separate rule: **budget and quota attach to the
|
|
338
|
+
* owner; the receipt's attribution records the trigger.** Group sessions need no
|
|
339
|
+
* special case.
|
|
340
|
+
*
|
|
341
|
+
* ⏳ Overlaps `session-action` since the fold (a contributed action IS a UI
|
|
342
|
+
* action). Kept because ruling 49 (`UiActionPayload`, the owner/trigger
|
|
343
|
+
* split) has no other home yet; nothing subscribes to it. Retire when the
|
|
344
|
+
* action model (30 §U5) gives the payload one.
|
|
345
|
+
*/
|
|
346
|
+
readonly uiAction: EventDef;
|
|
347
|
+
/**
|
|
348
|
+
* The path for scheduled model work (13 §7c). No callable may call an oracle
|
|
349
|
+
* (F32), and lifecycle callbacks may not trigger pipelines, so nightly
|
|
350
|
+
* summarization subscribes here instead — which also puts it on the consent
|
|
351
|
+
* screen, where a lifecycle callback doing the same work would have been
|
|
352
|
+
* invisible. Serene Pub emits it hourly (`cadence: 'hourly'`, `scheduledFor`
|
|
353
|
+
* the ISO instant it was due, `scope: 'pub'`), only to subscribed,
|
|
354
|
+
* granted listeners; `SCHEDULED_WORK_PATH` names it.
|
|
355
|
+
*/
|
|
356
|
+
readonly scheduleTick: EventDef;
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* One **session change** — the payload of every built-in write's event
|
|
360
|
+
* (`core:shape/session-change@1`), and one entry of the `sessionChanges`
|
|
361
|
+
* list the next reply's inlet publishes (R-15). The fields past `at` are per
|
|
362
|
+
* event; every one is additive and a reader keys on `event` before reaching
|
|
363
|
+
* for them.
|
|
364
|
+
*
|
|
365
|
+
* Written to the session's changes at the write, read once by the next
|
|
366
|
+
* reply run that is not a preview, so a pipeline sees each change exactly
|
|
367
|
+
* once. The list a run receives is capped at the newest fifty, and ends with
|
|
368
|
+
* a `session-changes-truncated` entry when older ones were dropped.
|
|
369
|
+
*
|
|
370
|
+
* ## What a delete leaves behind, and for how long
|
|
371
|
+
*
|
|
372
|
+
* The content a change carries — `lost.content`, `previous.content` — exists
|
|
373
|
+
* so the NEXT run can see what went. Once a run has consumed the change it
|
|
374
|
+
* has done its job: the host nulls the content on the stored row and keeps
|
|
375
|
+
* the event, the ids and the rest of the payload, so the ledger still says a
|
|
376
|
+
* line was deleted without holding the line indefinitely. A run's receipt
|
|
377
|
+
* keeps what the outlet published under the receipt's own retention.
|
|
378
|
+
*/
|
|
379
|
+
/**
|
|
380
|
+
* Why a session event fired (PLAN-turn-order §4.1) — on every session
|
|
381
|
+
* event's payload since 2026-09-21. The auto-advance listener keys on it:
|
|
382
|
+
* a `user` cause may fire the head turn, an auto `run` cause may fire the
|
|
383
|
+
* next, and `edit` / `settings` / `system` never fire anything. An open
|
|
384
|
+
* string so a plugin's host code may name its own cause; core's five are
|
|
385
|
+
* the ones the listener reads.
|
|
386
|
+
*
|
|
387
|
+
* At the emitters: a user send → `{ kind: 'user', userId }`; a run's write
|
|
388
|
+
* → `{ kind: 'run', runId, auto }` where `auto` is true iff auto-advance
|
|
389
|
+
* fired the run; a person's edit, hide, delete or swipe → `{ kind: 'edit',
|
|
390
|
+
* userId }`; settings and cast toggles → `{ kind: 'settings', userId }`;
|
|
391
|
+
* boot, migration and the importer → `{ kind: 'system' }`.
|
|
392
|
+
* @experimental
|
|
393
|
+
*/
|
|
394
|
+
export interface EventCause {
|
|
395
|
+
/** Open string; core values: user | run | edit | settings | system. */
|
|
396
|
+
kind: 'user' | 'run' | 'edit' | 'settings' | 'system' | (string & {});
|
|
397
|
+
userId?: number;
|
|
398
|
+
runId?: string;
|
|
399
|
+
/** On kind 'run': the run was fired by auto-advance. */
|
|
400
|
+
auto?: boolean;
|
|
401
|
+
}
|
|
402
|
+
/** @experimental */
|
|
403
|
+
export interface SessionChangePayload {
|
|
404
|
+
/** The event id — `core:event/message-deleted@1`. */
|
|
405
|
+
event: string;
|
|
406
|
+
sessionId: number;
|
|
407
|
+
/** The message the change was about. Absent on a branch, which is about a session. */
|
|
408
|
+
messageId?: number;
|
|
409
|
+
/** When, as epoch milliseconds. */
|
|
410
|
+
at: number;
|
|
411
|
+
/** `message-deleted`: what the row held. `content` is nulled on the stored row once consumed. */
|
|
412
|
+
lost?: {
|
|
413
|
+
content: string | null;
|
|
414
|
+
role: string;
|
|
415
|
+
/** Who voiced it, as a participant reference; null for narration. */
|
|
416
|
+
speaker: string | null;
|
|
417
|
+
channel: string;
|
|
418
|
+
metadata: unknown;
|
|
419
|
+
};
|
|
420
|
+
/**
|
|
421
|
+
* `message-edited` and `message-swiped`: what was showing before; on
|
|
422
|
+
* `message-updated` with `verb: regenerate`, the reply the regenerate
|
|
423
|
+
* replaced (U5b review W3). `content` is nulled on the stored row once
|
|
424
|
+
* consumed.
|
|
425
|
+
*/
|
|
426
|
+
previous?: {
|
|
427
|
+
content: string | null;
|
|
428
|
+
swipeIndex?: number | null;
|
|
429
|
+
};
|
|
430
|
+
/** `message-hidden`: hidden now, or shown again. */
|
|
431
|
+
hidden?: boolean;
|
|
432
|
+
/** `message-swiped`: the alternative now selected. */
|
|
433
|
+
swipeIndex?: number;
|
|
434
|
+
/** `message-updated`: the verb that re-drove the row, when one did. */
|
|
435
|
+
verb?: 'regenerate' | 'swipe' | 'extend';
|
|
436
|
+
/** `session-changes-truncated`: how many older changes the list did not carry. */
|
|
437
|
+
dropped?: number;
|
|
438
|
+
/** `message-stopped`: how much of the reply had arrived. */
|
|
439
|
+
textLength?: number;
|
|
440
|
+
/**
|
|
441
|
+
* `session-branched`: recorded on the NEW session — `sessionId` is the
|
|
442
|
+
* branch — with the session and message it forked from. The source's
|
|
443
|
+
* history did not move, so it is told nothing.
|
|
444
|
+
*/
|
|
445
|
+
fromSessionId?: number;
|
|
446
|
+
fromMessageId?: number;
|
|
447
|
+
/** `form-answered` · `form-superseded`: the block in question, within `messageId`. */
|
|
448
|
+
blockId?: string;
|
|
449
|
+
/** `form-answered`: the action identity the answer fired (`<spec slug>#<key>`). */
|
|
450
|
+
action?: string;
|
|
451
|
+
/** `form-answered`: who the form was addressed to, as a participant reference. */
|
|
452
|
+
addressee?: string;
|
|
453
|
+
/**
|
|
454
|
+
* `form-answered`: the answer — `{ choice }` for a choices block, the
|
|
455
|
+
* entered values for a form — and who committed it: `click` (a person
|
|
456
|
+
* portraying the addressee) or `oracle` (the answer pipeline).
|
|
457
|
+
*/
|
|
458
|
+
answer?: Record<string, unknown>;
|
|
459
|
+
answeredBy?: 'click' | 'oracle';
|
|
460
|
+
/** Why this fired — see `EventCause`. Absent on rows written before 2026-09-21. */
|
|
461
|
+
cause?: EventCause;
|
|
462
|
+
/** The run that made the write, when one did — its place in the tree of runs. */
|
|
463
|
+
lineage?: RunLineage;
|
|
464
|
+
/** `session-updated`: the columns/fields that changed, by name. */
|
|
465
|
+
changed?: string[];
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* The payload of `core:event/cast-changed@1` (`core:shape/cast-change@1`):
|
|
469
|
+
* one seated participant's row moved. `ref` is the participant reference
|
|
470
|
+
* (`character:<id>` · `persona:<id>` · `envoy:<slug>`); `change` says which
|
|
471
|
+
* column, open so a host may name one this release does not. `'enabled'` is
|
|
472
|
+
* the seat switched on or off (`value` is the new boolean; renamed from
|
|
473
|
+
* `'active'` 2026-09-28, NOMENCLATURE §25).
|
|
474
|
+
*
|
|
475
|
+
* `member-added` / `member-removed` carry the same payload since the modder
|
|
476
|
+
* pass (R31): `change: 'added' | 'removed'`, so one inlet reads every seat
|
|
477
|
+
* change — an envoy's included — the same way.
|
|
478
|
+
* @experimental
|
|
479
|
+
*/
|
|
480
|
+
export interface CastChangePayload {
|
|
481
|
+
event: string;
|
|
482
|
+
sessionId: number;
|
|
483
|
+
at: number;
|
|
484
|
+
cause?: EventCause;
|
|
485
|
+
lineage?: RunLineage;
|
|
486
|
+
/** character:<id> | persona:<id> | envoy:<slug> */
|
|
487
|
+
ref: string;
|
|
488
|
+
change: 'enabled' | 'position' | 'portrayal' | 'added' | 'removed' | (string & {});
|
|
489
|
+
value?: unknown;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* The payload of `core:event/annex-changed@1` (`core:shape/annex-change@1`,
|
|
493
|
+
* R30): which owner's annex entry changed. The value itself is not carried —
|
|
494
|
+
* a spec reads it through `core:query/session-annex@1`, so the event stays
|
|
495
|
+
* small and never races the row.
|
|
496
|
+
* @experimental
|
|
497
|
+
*/
|
|
498
|
+
export interface AnnexChangePayload {
|
|
499
|
+
event: string;
|
|
500
|
+
sessionId: number;
|
|
501
|
+
at: number;
|
|
502
|
+
cause?: EventCause;
|
|
503
|
+
lineage?: RunLineage;
|
|
504
|
+
/** The annex key that changed: a genre id, a plugin id, or `user:<slug>`. */
|
|
505
|
+
owner: string;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* The payload of `core:event/turn-order-changed@1`
|
|
509
|
+
* (`core:shape/turn-order-changed@1`): the order as
|
|
510
|
+
* `core:outlet/set-turn-order@1` wrote it, and the run that wrote it (null
|
|
511
|
+
* when the write was not a run's). `cause` is the inlet's — the cause of
|
|
512
|
+
* the event that led to the recompute, carried through so the listener
|
|
513
|
+
* can tell a send from an edit.
|
|
514
|
+
* @experimental
|
|
515
|
+
*/
|
|
516
|
+
export interface TurnOrderChangedPayload {
|
|
517
|
+
event: string;
|
|
518
|
+
sessionId: number;
|
|
519
|
+
at: number;
|
|
520
|
+
cause?: EventCause;
|
|
521
|
+
lineage?: RunLineage;
|
|
522
|
+
runId: string | null;
|
|
523
|
+
/** The document as written. */
|
|
524
|
+
turnOrder: TurnOrderV1;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* The payload of `core:event/form-addressed@1` (`core:shape/form-addressed@1`)
|
|
528
|
+
* — what the host records when a block's addressee resolves to the AI, and
|
|
529
|
+
* what `core:inlet/form-addressed@1` publishes port by port.
|
|
530
|
+
* @experimental
|
|
531
|
+
*/
|
|
532
|
+
export interface FormAddressedPayload {
|
|
533
|
+
sessionId: number;
|
|
534
|
+
/** The message carrying the block. */
|
|
535
|
+
messageId: number;
|
|
536
|
+
/** The block's id within the message (`FormBlockFields.id`). */
|
|
537
|
+
blockId: string;
|
|
538
|
+
/** The stamped identity of the action the form answers with (`<spec slug>#<key>`). */
|
|
539
|
+
action: string;
|
|
540
|
+
/** Who the form is put to — a reference the resolver answered `ai` for. */
|
|
541
|
+
addressee: string;
|
|
542
|
+
}
|
|
543
|
+
/** @experimental */
|
|
544
|
+
export interface UiActionPayload {
|
|
545
|
+
sessionId: string;
|
|
546
|
+
/** Budget and quota attach here. */
|
|
547
|
+
ownerUserId: string;
|
|
548
|
+
/** Attribution records this. May differ from the owner in a group session. (`triggeringUserId` until 2026-09-28.) */
|
|
549
|
+
actorUserId: string;
|
|
550
|
+
action: string;
|
|
551
|
+
modeId: string;
|
|
552
|
+
input: unknown;
|
|
553
|
+
}
|
|
554
|
+
//# sourceMappingURL=events.d.ts.map
|