@serene-pub/sdk 0.6.0-pr-7 → 0.6.0-pr-9
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/dist/annexFields.d.ts +14 -0
- package/dist/annexFields.js +7 -0
- package/dist/announce.d.ts +62 -16
- package/dist/announce.js +90 -4
- package/dist/appletCard.d.ts +17 -0
- package/dist/appletCard.js +60 -0
- package/dist/attributes.d.ts +3 -3
- package/dist/attributes.js +1 -1
- package/dist/builder.d.ts +28 -13
- package/dist/builder.js +57 -5
- package/dist/cadences.d.ts +8 -1
- package/dist/cadences.js +27 -2
- package/dist/characterProfile.d.ts +137 -0
- package/dist/characterProfile.js +24 -0
- package/dist/component.d.ts +1 -1
- package/dist/componentImports.d.ts +1 -1
- package/dist/componentImports.js +2 -0
- package/dist/componentWire.js +28 -0
- package/dist/conditions.d.ts +5 -1
- package/dist/conditions.js +7 -0
- package/dist/declarations.d.ts +63 -1
- package/dist/declarations.js +176 -7
- package/dist/descriptors.d.ts +145 -6
- package/dist/descriptors.js +106 -5
- package/dist/document.d.ts +9 -1
- package/dist/document.js +44 -1
- package/dist/events.d.ts +82 -8
- package/dist/events.js +42 -5
- package/dist/executor.d.ts +27 -0
- package/dist/executor.js +32 -8
- package/dist/exposure.d.ts +35 -1
- package/dist/exposure.js +64 -2
- package/dist/extension.d.ts +30 -2
- package/dist/extension.js +3 -1
- package/dist/fit.d.ts +4 -1
- package/dist/fit.js +43 -1
- package/dist/functions.d.ts +7 -1
- package/dist/functions.js +3 -1
- package/dist/genres.d.ts +67 -2
- package/dist/genres.js +160 -8
- package/dist/hookGrants.js +10 -0
- package/dist/hostElements.d.ts +3 -3
- package/dist/hostElements.js +12 -4
- package/dist/index.d.ts +5 -0
- package/dist/index.js +10 -0
- package/dist/layout.d.ts +18 -0
- package/dist/libraryDraft.d.ts +2 -0
- package/dist/libraryDraft.js +5 -1
- package/dist/lorebookFile.d.ts +8 -0
- package/dist/lorebookFile.js +21 -0
- package/dist/participants.d.ts +83 -8
- package/dist/participants.js +9 -5
- package/dist/pluginPermissions.js +1 -1
- package/dist/promptBlocks.d.ts +5 -1
- package/dist/promptBlocks.js +23 -8
- package/dist/provisos.d.ts +92 -0
- package/dist/provisos.js +273 -0
- package/dist/receiverRules.js +1 -1
- package/dist/registrations.d.ts +154 -14
- package/dist/registrations.js +293 -23
- package/dist/registry.js +6 -3
- package/dist/repertoires.d.ts +13 -1
- package/dist/repertoires.js +5 -1
- package/dist/rulesetDocument.d.ts +11 -0
- package/dist/rulesetDocument.js +17 -0
- package/dist/rulesetSections.d.ts +12 -0
- package/dist/rulesetSections.js +8 -0
- package/dist/rulesets.js +6 -0
- package/dist/sceneSettings.d.ts +7 -1
- package/dist/sceneSettings.js +10 -5
- package/dist/sessionDossier.d.ts +159 -2
- package/dist/sessionLayout.d.ts +296 -85
- package/dist/sessionLayout.js +397 -133
- package/dist/sessionSettings.d.ts +18 -0
- package/dist/settings.d.ts +28 -1
- package/dist/settings.js +50 -2
- package/dist/shapes.d.ts +15 -1
- package/dist/shapes.js +15 -1
- package/dist/sheetLatitude.d.ts +148 -0
- package/dist/sheetLatitude.js +161 -0
- package/dist/speech.d.ts +14 -3
- package/dist/storyTime.d.ts +77 -1
- package/dist/storyTime.js +117 -8
- package/dist/surfaces.d.ts +49 -2
- package/dist/surfaces.js +3 -0
- package/dist/template.d.ts +38 -1
- package/dist/templateCheck.d.ts +24 -0
- package/dist/templateCheck.js +465 -10
- package/dist/templateFit.js +8 -1
- package/dist/templateIds.d.ts +6 -0
- package/dist/templateIds.js +9 -0
- package/dist/turnLock.d.ts +10 -1
- package/dist/turnLock.js +6 -1
- package/dist/turnOrder.d.ts +37 -4
- package/dist/turnOrder.js +49 -11
- package/dist/validate.d.ts +4 -2
- package/dist/validate.js +84 -11
- package/dist/variableLayouts.d.ts +160 -0
- package/dist/variableLayouts.js +202 -0
- package/dist/variables.d.ts +237 -20
- package/dist/variables.js +292 -33
- package/dist/widgetDecls.js +12 -0
- package/dist/widgets.d.ts +449 -47
- package/dist/widgets.js +31 -0
- package/host-elements.d.ts +4 -2
- package/package.json +1 -1
package/dist/descriptors.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* editor work from rows.
|
|
8
8
|
* @ruling 01 §1, 04 §3, NOMENCLATURE §5, 10 §10.2
|
|
9
9
|
*/
|
|
10
|
-
import { exposureFindings } from './exposure.js';
|
|
10
|
+
import { exposureFindings, templateExposureWarnings } from './exposure.js';
|
|
11
11
|
import { pluginRuleRef } from './pluginRuleRef.js';
|
|
12
12
|
import { checkBandDeclarations, checkRendersDeclarations } from './bands.js';
|
|
13
13
|
import { settingsSchemaFindings } from './settings.js';
|
|
@@ -365,6 +365,10 @@ export function assertSessionWrites(shape, who) {
|
|
|
365
365
|
`Each library write is a boolean or absent — absent means off, and only an ` +
|
|
366
366
|
`explicit true allows the write.`);
|
|
367
367
|
}
|
|
368
|
+
if (writes.seats !== undefined && typeof writes.seats !== 'boolean')
|
|
369
|
+
throw new Error(`${who} declares writes.seats ${JSON.stringify(writes.seats)}. ` +
|
|
370
|
+
`It is a boolean or absent — absent means off, and only an explicit true ` +
|
|
371
|
+
`allows a pipeline to bench a seat or bring one back.`);
|
|
368
372
|
const bad = SESSION_WRITES.filter((w) => writes[w] !== undefined && typeof writes[w] !== 'boolean');
|
|
369
373
|
if (!bad.length)
|
|
370
374
|
return;
|
|
@@ -519,6 +523,29 @@ export const CHANNEL_LANE_MODES = ['shared', 'personal'];
|
|
|
519
523
|
export const CHANNEL_ROLES = ['conversation', 'folio'];
|
|
520
524
|
/** The voices a channel's turn may seed under. `none` seeds no row at all. @experimental */
|
|
521
525
|
export const CHANNEL_VOICES = ['character', 'narrator', 'none'];
|
|
526
|
+
/**
|
|
527
|
+
* 🚧 The table channel's slug in {@link TABLE_CHANNEL_DECL}. Where a genre's
|
|
528
|
+
* rolls, checks and calculations are written — never the story's history, which
|
|
529
|
+
* the Narrator would imitate (PLAN-rulesets §30, ruled 2026-10-16).
|
|
530
|
+
* A folio with no voice and no speaker (not the Narrator, not an envoy); each row
|
|
531
|
+
* is anchored to the message it belongs to (`metadata.anchorMessageId`), so it
|
|
532
|
+
* reads "at that moment" and retracts with it.
|
|
533
|
+
* @experimental
|
|
534
|
+
*/
|
|
535
|
+
export const TABLE_CHANNEL = 'table';
|
|
536
|
+
/**
|
|
537
|
+
* 🚧 The table channel's declaration, as a genre lists it in
|
|
538
|
+
* `SessionShape.channels`. The messages widget draws its rows inline under their
|
|
539
|
+
* anchors (`interleave`), or a copy pinned to it shows them as a log (_Dice_).
|
|
540
|
+
* @experimental
|
|
541
|
+
*/
|
|
542
|
+
export const TABLE_CHANNEL_DECL = Object.freeze({
|
|
543
|
+
slug: TABLE_CHANNEL,
|
|
544
|
+
label: { en: 'Dice' },
|
|
545
|
+
role: 'folio',
|
|
546
|
+
voice: 'none',
|
|
547
|
+
table: true,
|
|
548
|
+
});
|
|
522
549
|
/**
|
|
523
550
|
* This shape's channels as full declarations, defaults resolved — the one
|
|
524
551
|
* reader every consumer of `SessionShape.channels` should use, so the short
|
|
@@ -569,6 +596,7 @@ export function channelDecls(shape) {
|
|
|
569
596
|
...(decl.lanes ? { lanes: decl.lanes } : {}),
|
|
570
597
|
...(decl.audience ? { audience: decl.audience } : {}),
|
|
571
598
|
...(decl.lore ? { lore: decl.lore } : {}),
|
|
599
|
+
...(decl.table === true ? { table: true } : {}),
|
|
572
600
|
};
|
|
573
601
|
};
|
|
574
602
|
const declared = (Array.isArray(s.channels) ? s.channels : [])
|
|
@@ -611,6 +639,25 @@ export function channelLoreRole(shape, channel) {
|
|
|
611
639
|
? 'story'
|
|
612
640
|
: 'never';
|
|
613
641
|
}
|
|
642
|
+
/**
|
|
643
|
+
* 🚧 The slug of the shape's table channel — the one declaration marked
|
|
644
|
+
* `table: true` with voice `none`. ⏳ A shape with none marked answers an unmarked
|
|
645
|
+
* `table` channel declared `role: 'folio'`, `voice: 'none'` (bundles built before
|
|
646
|
+
* the marker). Undefined when the shape keeps no table, when two channels are
|
|
647
|
+
* marked, or when the marked one has a voice — the declaration refuses those, and
|
|
648
|
+
* a read never guesses. Never throws: a stored shape is data.
|
|
649
|
+
* @experimental
|
|
650
|
+
*/
|
|
651
|
+
export function tableChannelOf(shape) {
|
|
652
|
+
const decls = channelDecls(shape);
|
|
653
|
+
const marked = decls.filter((d) => d.table === true);
|
|
654
|
+
if (marked.length > 1)
|
|
655
|
+
return undefined;
|
|
656
|
+
if (marked.length === 1)
|
|
657
|
+
return marked[0].voice === 'none' ? marked[0].slug : undefined;
|
|
658
|
+
const legacy = decls.find((d) => d.slug === TABLE_CHANNEL && d.role === 'folio' && d.voice === 'none');
|
|
659
|
+
return legacy ? TABLE_CHANNEL : undefined;
|
|
660
|
+
}
|
|
614
661
|
function assertShapeCalendar(shape, who) {
|
|
615
662
|
const calendar = shape?.calendar;
|
|
616
663
|
if (calendar === undefined)
|
|
@@ -634,13 +681,14 @@ export function assertChannelDecls(shape, who) {
|
|
|
634
681
|
return;
|
|
635
682
|
if (!Array.isArray(channels))
|
|
636
683
|
throw new Error(`${who} declares a 'channels' that is not an array. A genre's channels are a list ` +
|
|
637
|
-
`of slugs, each a bare string or a { slug, role?, voice?, messageVerbs?, label?, turnControls?, lanes?, audience?, lore? } (R-C).`);
|
|
684
|
+
`of slugs, each a bare string or a { slug, role?, voice?, messageVerbs?, label?, turnControls?, lanes?, audience?, lore?, table? } (R-C).`);
|
|
685
|
+
let firstTable;
|
|
638
686
|
for (const raw of channels) {
|
|
639
687
|
const isString = typeof raw === 'string';
|
|
640
688
|
if (!isString && (!raw || typeof raw !== 'object' || Array.isArray(raw)))
|
|
641
689
|
throw new Error(`${who} declares a channel that is neither a slug nor a declaration: ` +
|
|
642
690
|
`${JSON.stringify(raw)}. Each channel is a bare string or a ` +
|
|
643
|
-
`{ slug, role?, voice?, messageVerbs?, label?, turnControls?, lanes?, audience?, lore? } (R-C).`);
|
|
691
|
+
`{ slug, role?, voice?, messageVerbs?, label?, turnControls?, lanes?, audience?, lore?, table? } (R-C).`);
|
|
644
692
|
const decl = (isString ? { slug: raw } : raw);
|
|
645
693
|
const slug = typeof decl.slug === 'string' ? decl.slug.trim() : '';
|
|
646
694
|
if (!slug)
|
|
@@ -693,6 +741,13 @@ export function assertChannelDecls(shape, who) {
|
|
|
693
741
|
throw new Error(`${at} declares lore '${String(decl.lore)}'. A channel's lore role is 'story', 'aside' or 'never' — events, context, or nothing a summary reads.`);
|
|
694
742
|
if (slug === DEFAULT_CHANNEL && decl.lore !== undefined && decl.lore !== 'story')
|
|
695
743
|
throw new Error(`${at} declares lore '${String(decl.lore)}'. '${DEFAULT_CHANNEL}' is the story's channel; declare another channel for asides.`);
|
|
744
|
+
if (decl.table === true) {
|
|
745
|
+
if (firstTable !== undefined)
|
|
746
|
+
throw new Error(`${who} marks two table channels, '${firstTable}' and '${slug}'. A session keeps one table, where the host writes its table lines: mark one.`);
|
|
747
|
+
firstTable = slug;
|
|
748
|
+
if (decl.voice !== 'none')
|
|
749
|
+
throw new Error(`${at} is marked the table channel without voice 'none'. The table is written in no voice and nobody speaks in it: declare voice 'none'.`);
|
|
750
|
+
}
|
|
696
751
|
assertMessageVerbFloors({ messageVerbs: decl.messageVerbs }, at);
|
|
697
752
|
// R6: the display name is display text, and the per-channel turn
|
|
698
753
|
// controls are judged on exactly the terms the genre's are.
|
|
@@ -942,13 +997,25 @@ function register(d) {
|
|
|
942
997
|
// A finding, not a refusal: the fallback is documented (inference), the
|
|
943
998
|
// omission is recorded, and `validate()` says it on every placement.
|
|
944
999
|
const reviewFinding = reviewFieldsFinding(d);
|
|
945
|
-
|
|
946
|
-
|
|
1000
|
+
// G7: a template or variables exposure is ignored, with a warning kept here beside it.
|
|
1001
|
+
const noted = [...(reviewFinding ? [reviewFinding] : []), ...templateExposureOf(d)];
|
|
1002
|
+
if (noted.length)
|
|
1003
|
+
registrationFindings.set(d.id, noted);
|
|
947
1004
|
else
|
|
948
1005
|
registrationFindings.delete(d.id);
|
|
949
1006
|
types.set(d.id, d);
|
|
950
1007
|
return d;
|
|
951
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Where a definition's slots expose a context or variable template to the owner (G7): warnings, by slot kind then key.
|
|
1011
|
+
* @internal
|
|
1012
|
+
*/
|
|
1013
|
+
export function templateExposureOf(d) {
|
|
1014
|
+
const out = [];
|
|
1015
|
+
for (const [slotName, slot] of Object.entries(d.slots ?? {}))
|
|
1016
|
+
out.push(...templateExposureWarnings(slot?.schema, `${d.id} slots.${slotName}.schema`, slot?.kind));
|
|
1017
|
+
return out;
|
|
1018
|
+
}
|
|
952
1019
|
/** 🚧 A node's settings may reach the owner; model plumbing never does (A10, R1 — ruled 10-12). */
|
|
953
1020
|
function checkExposure(d) {
|
|
954
1021
|
const found = [];
|
|
@@ -1310,6 +1377,25 @@ export function widgetDeclsFindings(raw, where) {
|
|
|
1310
1377
|
});
|
|
1311
1378
|
return out;
|
|
1312
1379
|
}
|
|
1380
|
+
/**
|
|
1381
|
+
* 🚧 Node definitions that were published and are now removed, by id without
|
|
1382
|
+
* the `@N` pin, each with the sentence a stored pipeline naming one fails with.
|
|
1383
|
+
* @internal
|
|
1384
|
+
*/
|
|
1385
|
+
export const REMOVED_NODE_DEFINITIONS = {
|
|
1386
|
+
'core:outlet/attach-lorebook': "Reading a lorebook into a session was removed in 0.6: a session keeps the lorebook it started with. Write into the session's lorebook instead, or start a new session with that lorebook.",
|
|
1387
|
+
};
|
|
1388
|
+
/**
|
|
1389
|
+
* 🚧 The sentence for a removed node definition (id with or without `@N`), or null when it is not removed.
|
|
1390
|
+
* @internal
|
|
1391
|
+
*/
|
|
1392
|
+
export function removedNodeDefinitionSentence(definitionId) {
|
|
1393
|
+
const at = definitionId.indexOf('@');
|
|
1394
|
+
const bare = at < 0 ? definitionId : definitionId.slice(0, at);
|
|
1395
|
+
return Object.prototype.hasOwnProperty.call(REMOVED_NODE_DEFINITIONS, bare)
|
|
1396
|
+
? REMOVED_NODE_DEFINITIONS[bare]
|
|
1397
|
+
: null;
|
|
1398
|
+
}
|
|
1313
1399
|
/** @experimental */
|
|
1314
1400
|
export function getDefinition(id) {
|
|
1315
1401
|
return types.get(id);
|
|
@@ -1580,6 +1666,21 @@ function assertEntryShape(id, shape, door = 'core') {
|
|
|
1580
1666
|
`in this release. A ruleset's come from its entryable repertoires ` +
|
|
1581
1667
|
`(deriveRulesetEntryTypes), never by hand — a hand-written plugin type also owns ` +
|
|
1582
1668
|
`a database constraint and the rows under it, and that half is not built.`);
|
|
1669
|
+
if (shape.defaultBeginning !== undefined &&
|
|
1670
|
+
shape.defaultBeginning !== 'perpetual' &&
|
|
1671
|
+
shape.defaultBeginning !== 'began')
|
|
1672
|
+
throw new Error(`${id} declares defaultBeginning '${String(shape.defaultBeginning)}'. Say 'perpetual' or 'began', or leave it out.`);
|
|
1673
|
+
if (shape.defaultDecayRate !== undefined &&
|
|
1674
|
+
!(typeof shape.defaultDecayRate === 'number' &&
|
|
1675
|
+
Number.isFinite(shape.defaultDecayRate) &&
|
|
1676
|
+
shape.defaultDecayRate >= 0 &&
|
|
1677
|
+
shape.defaultDecayRate <= 1))
|
|
1678
|
+
throw new Error(`${id} declares defaultDecayRate ${String(shape.defaultDecayRate)}. A Decay rate is a number from 0 to 1: 0 is a fact, above 0 a living entry.`);
|
|
1679
|
+
if (shape.defaultBeginning !== undefined) {
|
|
1680
|
+
const parts = ['year', 'month', 'day'].filter((k) => Object.prototype.hasOwnProperty.call(shape.fields ?? {}, k));
|
|
1681
|
+
if (parts.length)
|
|
1682
|
+
throw new Error(`${id} declares defaultBeginning, but its entries carry their own date (its fields declare ${parts.join(', ')}), so a Beginning default would do nothing. Leave it out.`);
|
|
1683
|
+
}
|
|
1583
1684
|
const unknown = unknownRoles(shape);
|
|
1584
1685
|
if (unknown.length)
|
|
1585
1686
|
throw new Error(`${id} declares ${unknown.map((r) => `'${r}'`).join(', ')}, which no engine ` +
|
package/dist/document.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export interface DocNode {
|
|
|
53
53
|
status?: I18n;
|
|
54
54
|
label?: I18n;
|
|
55
55
|
purpose?: I18n;
|
|
56
|
-
/**
|
|
56
|
+
/** ⏳ Transitional (R6): the host offers the owner every model call's prompt choice, whatever this says; kept so existing specs build, its only value is `'owner'`. */
|
|
57
57
|
promptReach?: 'owner';
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
@@ -210,6 +210,14 @@ export type CompiledSpec<A extends string = string> = SpecDocument & {
|
|
|
210
210
|
* @ruling F25, 15 §1.3
|
|
211
211
|
*/
|
|
212
212
|
export declare function resolveDownstreamOracle(built: BuiltSpec, fromKey: string): string;
|
|
213
|
+
/**
|
|
214
|
+
* 🚧 The param values a document declares for one node: the node's own `config.params`, with
|
|
215
|
+
* every **default** preset's `params` row for it laid over them, in order. What the packager's
|
|
216
|
+
* `W_WRITES_HISTORY` and conformance C39 read a lore write's `entryType` from — one copy for
|
|
217
|
+
* both. Pure.
|
|
218
|
+
* @experimental
|
|
219
|
+
*/
|
|
220
|
+
export declare function declaredNodeParams(doc: Pick<SpecDocument, 'nodes' | 'presets'>, nodeKey: string): Record<string, unknown>;
|
|
213
221
|
/**
|
|
214
222
|
* Canonical form — stable key order, for hashing and round-trip identity.
|
|
215
223
|
*
|
package/dist/document.js
CHANGED
|
@@ -87,6 +87,30 @@ function withActionHandles(doc) {
|
|
|
87
87
|
});
|
|
88
88
|
return doc;
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* A clause's chains: the member-holding ones in position order (the position
|
|
92
|
+
* of each chain's first member, node or nested clause), then the member-less
|
|
93
|
+
* ones sorted by name (code-unit order). The app's store rebuilds chains from
|
|
94
|
+
* the members that sit in them and from the stored `branches` keys, and jsonb
|
|
95
|
+
* does not keep key order while a document's hash keeps array order, so the
|
|
96
|
+
* compiler writes the order the store can rebuild. The app's store `chainsOf`
|
|
97
|
+
* follows the same rule.
|
|
98
|
+
*/
|
|
99
|
+
function orderedChains(clause, nodes, clauses) {
|
|
100
|
+
const first = new Map();
|
|
101
|
+
for (const m of [...nodes, ...clauses]) {
|
|
102
|
+
if (m.clauseId !== clause.id || m.clauseChain === undefined)
|
|
103
|
+
continue;
|
|
104
|
+
const at = first.get(m.clauseChain);
|
|
105
|
+
if (at === undefined || m.position < at)
|
|
106
|
+
first.set(m.clauseChain, m.position);
|
|
107
|
+
}
|
|
108
|
+
const held = clause.chains
|
|
109
|
+
.filter((c) => first.has(c))
|
|
110
|
+
.sort((a, b) => first.get(a) - first.get(b));
|
|
111
|
+
const empty = clause.chains.filter((c) => !first.has(c)).sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
|
|
112
|
+
return [...held, ...empty];
|
|
113
|
+
}
|
|
90
114
|
function compileBuilt(built) {
|
|
91
115
|
const nodes = built.nodes.map((n) => ({
|
|
92
116
|
key: n.key,
|
|
@@ -236,7 +260,7 @@ function compileBuilt(built) {
|
|
|
236
260
|
presets: built.presets,
|
|
237
261
|
nodes,
|
|
238
262
|
edges,
|
|
239
|
-
clauses: built.clauses,
|
|
263
|
+
clauses: built.clauses.map((c) => ({ ...c, chains: orderedChains(c, built.nodes, built.clauses) })),
|
|
240
264
|
};
|
|
241
265
|
}
|
|
242
266
|
/**
|
|
@@ -261,6 +285,25 @@ export function resolveDownstreamOracle(built, fromKey) {
|
|
|
261
285
|
}
|
|
262
286
|
return spineOracles[0].key;
|
|
263
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* 🚧 The param values a document declares for one node: the node's own `config.params`, with
|
|
290
|
+
* every **default** preset's `params` row for it laid over them, in order. What the packager's
|
|
291
|
+
* `W_WRITES_HISTORY` and conformance C39 read a lore write's `entryType` from — one copy for
|
|
292
|
+
* both. Pure.
|
|
293
|
+
* @experimental
|
|
294
|
+
*/
|
|
295
|
+
export function declaredNodeParams(doc, nodeKey) {
|
|
296
|
+
const out = {};
|
|
297
|
+
const own = doc.nodes.find((n) => n.key === nodeKey)?.config?.params;
|
|
298
|
+
if (own && typeof own === 'object')
|
|
299
|
+
Object.assign(out, own);
|
|
300
|
+
for (const p of doc.presets ?? [])
|
|
301
|
+
if (p.default)
|
|
302
|
+
for (const v of p.values)
|
|
303
|
+
if (v.nodeKey === nodeKey && v.slot === 'params' && v.value && typeof v.value === 'object')
|
|
304
|
+
Object.assign(out, v.value);
|
|
305
|
+
return out;
|
|
306
|
+
}
|
|
264
307
|
/**
|
|
265
308
|
* Canonical form — stable key order, for hashing and round-trip identity.
|
|
266
309
|
*
|
package/dist/events.d.ts
CHANGED
|
@@ -56,6 +56,16 @@ export interface EventDef {
|
|
|
56
56
|
* @ruling PLAN-turn-order §B3, C28
|
|
57
57
|
*/
|
|
58
58
|
declaredRoot?: true;
|
|
59
|
+
/**
|
|
60
|
+
* 🚧 **One registration runs** on this event: of the registrations a session's
|
|
61
|
+
* effective list holds on it, the host runs exactly one — the session's choice,
|
|
62
|
+
* else the one marked `default` (`RegistrationDecl.default`). Each registration
|
|
63
|
+
* is one option a session's owner may pick, named by its `label`. Absent: every
|
|
64
|
+
* registration on the event runs, in `order`.
|
|
65
|
+
* ⚠ Not a lock: a preset adds and drops options as on any event.
|
|
66
|
+
* @ruling programme 2.3, TC2 (owner 2026-11-18)
|
|
67
|
+
*/
|
|
68
|
+
runsOne?: true;
|
|
59
69
|
/**
|
|
60
70
|
* The shape of what a listener receives. A shape id,
|
|
61
71
|
* on the same terms as a port's: `pipeline_event_registry.payload_shape`
|
|
@@ -356,7 +366,9 @@ export declare const CORE_EVENTS: {
|
|
|
356
366
|
* `core:outlet/attach-sprite@1` (the Sprite set fill). About a CARD, not a session: no session row is written, and the
|
|
357
367
|
* payload names the character, the sprite set, each sprite label with the
|
|
358
368
|
* sprite row it gained (`attached: [{ label, spriteId }]`) and the labels
|
|
359
|
-
* that came back with no picture (`missing`).
|
|
369
|
+
* that came back with no picture (`missing`). The payload also carries
|
|
370
|
+
* 🚧 `castMemberId` — set when the pictures went to a cast member, and
|
|
371
|
+
* then `characterId` is null.
|
|
360
372
|
* @ruling DESIGN-image-generation §6.3
|
|
361
373
|
*/
|
|
362
374
|
readonly spritesAttached: EventDef;
|
|
@@ -366,6 +378,8 @@ export declare const CORE_EVENTS: {
|
|
|
366
378
|
* About a CARD, not a session: no session row is written, and the payload
|
|
367
379
|
* names the character and each picture placed (`offered: [{ mediaId,
|
|
368
380
|
* key }]`). Nothing was chosen: the avatar and likeness are untouched.
|
|
381
|
+
* The payload also carries 🚧 `castMemberId` — set when the pictures went
|
|
382
|
+
* to a cast member, and then `characterId` is null.
|
|
369
383
|
* @ruling DESIGN-image-generation §6.2
|
|
370
384
|
*/
|
|
371
385
|
readonly mediaOffered: EventDef;
|
|
@@ -456,7 +470,7 @@ export declare const CORE_EVENTS: {
|
|
|
456
470
|
readonly sessionArchived: EventDef;
|
|
457
471
|
/** 🚧 Raised by the scene handler (sockets/scenes.ts) at the apply; not `scene-closed`, not `lore-entry-created`. */
|
|
458
472
|
readonly sceneSummaryApplied: EventDef;
|
|
459
|
-
/** 🚧 Raised by `settleThrough`
|
|
473
|
+
/** 🚧 Raised by `settleThrough` once per story lane whose settle line moved. */
|
|
460
474
|
readonly historySettled: EventDef;
|
|
461
475
|
/**
|
|
462
476
|
* 🚧 A **rest was taken** under the session's rules (lane G3, 2026-10-23;
|
|
@@ -576,6 +590,25 @@ export declare const CORE_EVENTS: {
|
|
|
576
590
|
* @ruling 13 §7c, F32
|
|
577
591
|
*/
|
|
578
592
|
readonly scheduleTick: EventDef;
|
|
593
|
+
/**
|
|
594
|
+
* 🚧 Something that can change whose turn it is happened. The host raises it
|
|
595
|
+
* after each event that can change whose turn it is; the payload carries the
|
|
596
|
+
* session, the causing event and its `EventCause`.
|
|
597
|
+
*
|
|
598
|
+
* One registration runs (`runsOne`): the session's choice, else the
|
|
599
|
+
* registration marked `default`. Each registration is a whole turn-order
|
|
600
|
+
* pipeline that ends in `core:outlet/set-turn-order@1`.
|
|
601
|
+
*
|
|
602
|
+
* A genre with no registration here keeps its per-event turn-order
|
|
603
|
+
* registrations, and the ask runs nothing. Payload
|
|
604
|
+
* `core:shape/turn-order-asked@1` (`TurnOrderAskedPayload`).
|
|
605
|
+
*
|
|
606
|
+
* ⚠ Not `turn-order-changed` — that is the fact after the write, core-internal.
|
|
607
|
+
* An action, like `message-deletion-asked`: a request, not a write's
|
|
608
|
+
* consequence.
|
|
609
|
+
* @ruling programme 2.3, TC1, TC2, TN1 (owner 2026-11-18)
|
|
610
|
+
*/
|
|
611
|
+
readonly turnOrderAsked: EventDef;
|
|
579
612
|
};
|
|
580
613
|
/**
|
|
581
614
|
* 🚧 Core's events as **objects** — what an author passes where an event is
|
|
@@ -721,7 +754,9 @@ export declare const coreEvents: {
|
|
|
721
754
|
* `core:outlet/attach-sprite@1` (the Sprite set fill). About a CARD, not a session: no session row is written, and the
|
|
722
755
|
* payload names the character, the sprite set, each sprite label with the
|
|
723
756
|
* sprite row it gained (`attached: [{ label, spriteId }]`) and the labels
|
|
724
|
-
* that came back with no picture (`missing`).
|
|
757
|
+
* that came back with no picture (`missing`). The payload also carries
|
|
758
|
+
* 🚧 `castMemberId` — set when the pictures went to a cast member, and
|
|
759
|
+
* then `characterId` is null.
|
|
725
760
|
* @ruling DESIGN-image-generation §6.3
|
|
726
761
|
*/
|
|
727
762
|
readonly spritesAttached: EventDef;
|
|
@@ -731,6 +766,8 @@ export declare const coreEvents: {
|
|
|
731
766
|
* About a CARD, not a session: no session row is written, and the payload
|
|
732
767
|
* names the character and each picture placed (`offered: [{ mediaId,
|
|
733
768
|
* key }]`). Nothing was chosen: the avatar and likeness are untouched.
|
|
769
|
+
* The payload also carries 🚧 `castMemberId` — set when the pictures went
|
|
770
|
+
* to a cast member, and then `characterId` is null.
|
|
734
771
|
* @ruling DESIGN-image-generation §6.2
|
|
735
772
|
*/
|
|
736
773
|
readonly mediaOffered: EventDef;
|
|
@@ -821,7 +858,7 @@ export declare const coreEvents: {
|
|
|
821
858
|
readonly sessionArchived: EventDef;
|
|
822
859
|
/** 🚧 Raised by the scene handler (sockets/scenes.ts) at the apply; not `scene-closed`, not `lore-entry-created`. */
|
|
823
860
|
readonly sceneSummaryApplied: EventDef;
|
|
824
|
-
/** 🚧 Raised by `settleThrough`
|
|
861
|
+
/** 🚧 Raised by `settleThrough` once per story lane whose settle line moved. */
|
|
825
862
|
readonly historySettled: EventDef;
|
|
826
863
|
/**
|
|
827
864
|
* 🚧 A **rest was taken** under the session's rules (lane G3, 2026-10-23;
|
|
@@ -941,6 +978,25 @@ export declare const coreEvents: {
|
|
|
941
978
|
* @ruling 13 §7c, F32
|
|
942
979
|
*/
|
|
943
980
|
readonly scheduleTick: EventDef;
|
|
981
|
+
/**
|
|
982
|
+
* 🚧 Something that can change whose turn it is happened. The host raises it
|
|
983
|
+
* after each event that can change whose turn it is; the payload carries the
|
|
984
|
+
* session, the causing event and its `EventCause`.
|
|
985
|
+
*
|
|
986
|
+
* One registration runs (`runsOne`): the session's choice, else the
|
|
987
|
+
* registration marked `default`. Each registration is a whole turn-order
|
|
988
|
+
* pipeline that ends in `core:outlet/set-turn-order@1`.
|
|
989
|
+
*
|
|
990
|
+
* A genre with no registration here keeps its per-event turn-order
|
|
991
|
+
* registrations, and the ask runs nothing. Payload
|
|
992
|
+
* `core:shape/turn-order-asked@1` (`TurnOrderAskedPayload`).
|
|
993
|
+
*
|
|
994
|
+
* ⚠ Not `turn-order-changed` — that is the fact after the write, core-internal.
|
|
995
|
+
* An action, like `message-deletion-asked`: a request, not a write's
|
|
996
|
+
* consequence.
|
|
997
|
+
* @ruling programme 2.3, TC1, TC2, TN1 (owner 2026-11-18)
|
|
998
|
+
*/
|
|
999
|
+
readonly turnOrderAsked: EventDef;
|
|
944
1000
|
};
|
|
945
1001
|
/**
|
|
946
1002
|
* The id an event is named by: core's `core:event/<slug>@<version>`, a
|
|
@@ -1081,7 +1137,7 @@ export interface SessionChangePayload {
|
|
|
1081
1137
|
round?: number;
|
|
1082
1138
|
/** 🚧 `turn-ended`: whose turn ended, as a participant reference; null for narration. */
|
|
1083
1139
|
speaker?: string | null;
|
|
1084
|
-
/** 🚧 `turn-ended` · `round-ended`: the lane the turn was taken on — a canonical channel string (`main`, `main:2`, `sanctum`) (R51). */
|
|
1140
|
+
/** 🚧 `turn-ended` · `round-ended`: the lane the turn was taken on — a canonical channel string (`main`, `main:2`, `sanctum`) (R51). `history-settled`: the story lane whose settle line moved; absent: `main`. */
|
|
1085
1141
|
lane?: string;
|
|
1086
1142
|
/**
|
|
1087
1143
|
* 🚧 `turn-ended`: how many turns each speaker has taken this round, this
|
|
@@ -1105,13 +1161,15 @@ export interface SessionChangePayload {
|
|
|
1105
1161
|
fromMessageId: number;
|
|
1106
1162
|
throughMessageId: number;
|
|
1107
1163
|
};
|
|
1108
|
-
/** 🚧 `history-settled`: where
|
|
1164
|
+
/** 🚧 `history-settled`: where that lane's line stood before (`messageId` is where it stands now); null when unset. */
|
|
1109
1165
|
previousSettledMessageId?: number | null;
|
|
1110
1166
|
}
|
|
1111
1167
|
/**
|
|
1112
1168
|
* The payload of `core:event/cast-changed@1` (`core:shape/cast-change@1`):
|
|
1113
1169
|
* one seated participant's row moved. `ref` is the participant reference
|
|
1114
|
-
*
|
|
1170
|
+
* of the seat: ⏳ `character:<id>` (a seat by its card, until the flip),
|
|
1171
|
+
* 🚧 `seated-member:<id>` (by its cast member), `player-seat:<id>` or
|
|
1172
|
+
* `envoy:<slug>`; `change` says which
|
|
1115
1173
|
* column, open so a host may name one this release does not. `'enabled'` is
|
|
1116
1174
|
* the seat switched on or off (`value` is the new boolean; renamed from
|
|
1117
1175
|
* `'active'` 2026-09-28).
|
|
@@ -1128,7 +1186,7 @@ export interface CastChangePayload {
|
|
|
1128
1186
|
at: number;
|
|
1129
1187
|
cause?: EventCause;
|
|
1130
1188
|
lineage?: RunLineage;
|
|
1131
|
-
/** character:<id> |
|
|
1189
|
+
/** The seat's participant reference: ⏳ character:<id> | 🚧 seated-member:<id> | player-seat:<id> | envoy:<slug> */
|
|
1132
1190
|
ref: string;
|
|
1133
1191
|
change: 'enabled' | 'position' | 'portrayal' | 'added' | 'removed' | (string & {});
|
|
1134
1192
|
value?: unknown;
|
|
@@ -1235,6 +1293,22 @@ export interface RulesetConversionPayload {
|
|
|
1235
1293
|
added: Record<string, unknown>;
|
|
1236
1294
|
};
|
|
1237
1295
|
}
|
|
1296
|
+
/**
|
|
1297
|
+
* 🚧 The payload of `core:event/turn-order-asked@1`
|
|
1298
|
+
* (`core:shape/turn-order-asked@1`): something that can change whose turn it
|
|
1299
|
+
* is happened, and the one registration the session runs on the ask answers
|
|
1300
|
+
* it (programme 2.3, TC2, owner 2026-11-18).
|
|
1301
|
+
* @experimental
|
|
1302
|
+
*/
|
|
1303
|
+
export interface TurnOrderAskedPayload {
|
|
1304
|
+
sessionId: number;
|
|
1305
|
+
/** When, as epoch milliseconds. */
|
|
1306
|
+
at: number;
|
|
1307
|
+
/** The id of the event that raised the ask — `core:event/message-created@1`. Never `event`, which in other payloads is the payload's own event. */
|
|
1308
|
+
asked: string;
|
|
1309
|
+
/** That event's cause. */
|
|
1310
|
+
cause?: EventCause;
|
|
1311
|
+
}
|
|
1238
1312
|
/**
|
|
1239
1313
|
* The payload of `core:event/turn-order-changed@1`
|
|
1240
1314
|
* (`core:shape/turn-order-changed@1`): the order as
|
package/dist/events.js
CHANGED
|
@@ -44,6 +44,8 @@ export function defineEvent(def) {
|
|
|
44
44
|
}
|
|
45
45
|
if (def.carries !== undefined && (!Array.isArray(def.carries) || def.carries.some((k) => typeof k !== 'string' || !k)))
|
|
46
46
|
throw new Error(`event '${def.slug}' declares carries that are not entity kinds — a list such as ['session', 'message']`);
|
|
47
|
+
if (def.runsOne !== undefined && def.runsOne !== true)
|
|
48
|
+
throw new Error(`event '${def.slug}' declares runsOne as ${JSON.stringify(def.runsOne)} — it is true, or left out`);
|
|
47
49
|
if (def.declaredRoot && def.causedBy?.length) {
|
|
48
50
|
throw new Error(`event '${def.slug}' is a declared root and declares causedBy — a root starts outside ` +
|
|
49
51
|
`every pipeline, so nothing writes it. Drop one of the two`);
|
|
@@ -549,7 +551,9 @@ export const CORE_EVENTS = {
|
|
|
549
551
|
* `core:outlet/attach-sprite@1` (the Sprite set fill). About a CARD, not a session: no session row is written, and the
|
|
550
552
|
* payload names the character, the sprite set, each sprite label with the
|
|
551
553
|
* sprite row it gained (`attached: [{ label, spriteId }]`) and the labels
|
|
552
|
-
* that came back with no picture (`missing`).
|
|
554
|
+
* that came back with no picture (`missing`). The payload also carries
|
|
555
|
+
* 🚧 `castMemberId` — set when the pictures went to a cast member, and
|
|
556
|
+
* then `characterId` is null.
|
|
553
557
|
* @ruling DESIGN-image-generation §6.3
|
|
554
558
|
*/
|
|
555
559
|
spritesAttached: defineEvent({
|
|
@@ -561,7 +565,7 @@ export const CORE_EVENTS = {
|
|
|
561
565
|
affectsUser: true,
|
|
562
566
|
causedBy: ['core:outlet/attach-sprite'],
|
|
563
567
|
payload: S.json,
|
|
564
|
-
description: "Pictures were filed as a card's sprites. The payload carries the character, the sprite set, each sprite label with the sprite it gained, and the labels that came back empty.",
|
|
568
|
+
description: "Pictures were filed as a card's sprites. The payload carries the character, the sprite set, each sprite label with the sprite it gained, and the labels that came back empty. When the pictures went to a cast member, `castMemberId` names it and `characterId` is null.",
|
|
565
569
|
}),
|
|
566
570
|
/**
|
|
567
571
|
* 🚧 Pictures were offered to a card's **gallery** by
|
|
@@ -569,6 +573,8 @@ export const CORE_EVENTS = {
|
|
|
569
573
|
* About a CARD, not a session: no session row is written, and the payload
|
|
570
574
|
* names the character and each picture placed (`offered: [{ mediaId,
|
|
571
575
|
* key }]`). Nothing was chosen: the avatar and likeness are untouched.
|
|
576
|
+
* The payload also carries 🚧 `castMemberId` — set when the pictures went
|
|
577
|
+
* to a cast member, and then `characterId` is null.
|
|
572
578
|
* @ruling DESIGN-image-generation §6.2
|
|
573
579
|
*/
|
|
574
580
|
mediaOffered: defineEvent({
|
|
@@ -580,7 +586,7 @@ export const CORE_EVENTS = {
|
|
|
580
586
|
affectsUser: true,
|
|
581
587
|
causedBy: ['core:outlet/offer-media'],
|
|
582
588
|
payload: S.json,
|
|
583
|
-
description: "Pictures were added to a card's gallery to choose from. The payload carries the character and each picture placed, with the series key it was drawn for.",
|
|
589
|
+
description: "Pictures were added to a card's gallery to choose from. The payload carries the character and each picture placed, with the series key it was drawn for. When the pictures went to a cast member, `castMemberId` names it and `characterId` is null.",
|
|
584
590
|
}),
|
|
585
591
|
/**
|
|
586
592
|
* Not a write's event: the marker the `sessionChanges` list ends with when
|
|
@@ -815,7 +821,7 @@ export const CORE_EVENTS = {
|
|
|
815
821
|
payload: S.sessionChange,
|
|
816
822
|
description: "A scene's summary was saved into the lorebook — the stretch it was written from is part of the record now. The payload names the scene, its entry and the messages it was written from.",
|
|
817
823
|
}),
|
|
818
|
-
/** 🚧 Raised by `settleThrough`
|
|
824
|
+
/** 🚧 Raised by `settleThrough` once per story lane whose settle line moved. */
|
|
819
825
|
historySettled: defineEvent({
|
|
820
826
|
slug: 'history-settled',
|
|
821
827
|
name: { en: 'History settled' },
|
|
@@ -825,7 +831,7 @@ export const CORE_EVENTS = {
|
|
|
825
831
|
carries: ['session', 'message'],
|
|
826
832
|
affectsUser: false,
|
|
827
833
|
payload: S.sessionChange,
|
|
828
|
-
description: "
|
|
834
|
+
description: "A story lane's settle line moved: Back no longer reaches the message the payload names, or any earlier line on that lane. The payload's lane names the story lane (absent: main, which also carries every line on no story channel); a write that moves several lanes raises one event per lane.",
|
|
829
835
|
}),
|
|
830
836
|
/**
|
|
831
837
|
* 🚧 A **rest was taken** under the session's rules (lane G3, 2026-10-23;
|
|
@@ -1082,6 +1088,37 @@ export const CORE_EVENTS = {
|
|
|
1082
1088
|
affectsUser: false,
|
|
1083
1089
|
description: 'A declared cadence elapsed. Payload: cadence, scheduledFor, scope.',
|
|
1084
1090
|
}),
|
|
1091
|
+
// ── Turn order ───────────────────────────────────────────────────────────
|
|
1092
|
+
/**
|
|
1093
|
+
* 🚧 Something that can change whose turn it is happened. The host raises it
|
|
1094
|
+
* after each event that can change whose turn it is; the payload carries the
|
|
1095
|
+
* session, the causing event and its `EventCause`.
|
|
1096
|
+
*
|
|
1097
|
+
* One registration runs (`runsOne`): the session's choice, else the
|
|
1098
|
+
* registration marked `default`. Each registration is a whole turn-order
|
|
1099
|
+
* pipeline that ends in `core:outlet/set-turn-order@1`.
|
|
1100
|
+
*
|
|
1101
|
+
* A genre with no registration here keeps its per-event turn-order
|
|
1102
|
+
* registrations, and the ask runs nothing. Payload
|
|
1103
|
+
* `core:shape/turn-order-asked@1` (`TurnOrderAskedPayload`).
|
|
1104
|
+
*
|
|
1105
|
+
* ⚠ Not `turn-order-changed` — that is the fact after the write, core-internal.
|
|
1106
|
+
* An action, like `message-deletion-asked`: a request, not a write's
|
|
1107
|
+
* consequence.
|
|
1108
|
+
* @ruling programme 2.3, TC1, TC2, TN1 (owner 2026-11-18)
|
|
1109
|
+
*/
|
|
1110
|
+
turnOrderAsked: defineEvent({
|
|
1111
|
+
slug: 'turn-order-asked',
|
|
1112
|
+
declaredRoot: true,
|
|
1113
|
+
name: { en: 'Turn order asked' },
|
|
1114
|
+
version: 1,
|
|
1115
|
+
family: 'action',
|
|
1116
|
+
carries: ['session'],
|
|
1117
|
+
affectsUser: true,
|
|
1118
|
+
runsOne: true,
|
|
1119
|
+
payload: S.turnOrderAsked,
|
|
1120
|
+
description: "Something that can change whose turn it is happened — the one turn order option the session runs answers it and prepares the turns. The payload carries the session, the event that caused the ask and that event's cause.",
|
|
1121
|
+
}),
|
|
1085
1122
|
};
|
|
1086
1123
|
/**
|
|
1087
1124
|
* 🚧 Core's events as **objects** — what an author passes where an event is
|
package/dist/executor.d.ts
CHANGED
|
@@ -519,6 +519,19 @@ export interface RunOptions {
|
|
|
519
519
|
* @ruling F36
|
|
520
520
|
*/
|
|
521
521
|
timeoutCeilingMs?: number;
|
|
522
|
+
/**
|
|
523
|
+
* 🚧 Apply no step time limit for this run: neither a definition's `timeoutMs`
|
|
524
|
+
* nor `timeoutCeilingMs`. A pub's diagnostic switch (an administrator finding
|
|
525
|
+
* out whether a time limit is what stops a step); a stuck step then waits until
|
|
526
|
+
* the host stops the run. The executor does not abort a node in flight on
|
|
527
|
+
* `cancelSignal` (it is checked between nodes), so the host's stop must reach
|
|
528
|
+
* the requests the node waits on — core's does: every request it performs
|
|
529
|
+
* listens to the run's own signal. Limits a host enforces inside its own
|
|
530
|
+
* calls (a sandbox's deadline, a connection's idle watchdog) are the host's and
|
|
531
|
+
* are not touched. Read once, at the run's start.
|
|
532
|
+
* @experimental
|
|
533
|
+
*/
|
|
534
|
+
stepTimeLimitsOff?: boolean;
|
|
522
535
|
/**
|
|
523
536
|
* Force every clause sequential, as an admin may.
|
|
524
537
|
* @ruling 01 §4
|
|
@@ -592,6 +605,20 @@ export interface RunOptions {
|
|
|
592
605
|
by: string;
|
|
593
606
|
reason: string;
|
|
594
607
|
} | undefined;
|
|
608
|
+
/**
|
|
609
|
+
* 🚧 Promises the host hands this run: every write-class outlet of the run
|
|
610
|
+
* (`effects: 'write'`) waits, before it starts, until every promise given has
|
|
611
|
+
* settled — resolved or rejected. Reads, prompts and model calls do not wait.
|
|
612
|
+
* A rejected promise opens the gate as a resolved one does: the earlier run's
|
|
613
|
+
* failure is its own, and this run proceeds. The wait is not execution, so no
|
|
614
|
+
* timeout clock runs on it. The executor never inspects what the promises
|
|
615
|
+
* stand for; the host decides when each settles. A Stop (`cancelSignal`) is
|
|
616
|
+
* read when the gate opens: a run stopped while waiting ends `cancelled`
|
|
617
|
+
* once released, and writes nothing. Absent or empty: no wait.
|
|
618
|
+
* @experimental
|
|
619
|
+
* @ruling RG3, RN1
|
|
620
|
+
*/
|
|
621
|
+
writeAfter?: readonly Promise<unknown>[];
|
|
595
622
|
/**
|
|
596
623
|
* Compact a receipt that halts before any effectful node: trigger, spec version,
|
|
597
624
|
* halt node/reason and elapsed, with no payloads and no node rows.
|