@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/genres.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { widgetRef } from './widgetDecls.js';
|
|
2
2
|
import { drawnWidgetIds, layoutWidgetIds, resolveWidgetAlias } from './sessionLayout.js';
|
|
3
|
-
import { assertChannelDecls, assertMessageVerbFloors, assertSessionWrites, assertTurnControls, SESSION_CREATION_MODES, channelDecls, lorebookReadOptional, lorebookShapeFindings, widgetDeclsFindings, } from './descriptors.js';
|
|
3
|
+
import { assertChannelDecls, assertMessageVerbFloors, assertSessionWrites, assertTurnControls, SESSION_CREATION_MODES, channelDecls, channelLoreRole, lorebookReadOptional, lorebookShapeFindings, widgetDeclsFindings, } from './descriptors.js';
|
|
4
4
|
import { assertSceneSettings, declaredScenePlace } from './sceneSettings.js';
|
|
5
|
+
import { assertProvisos, provisoWarnings } from './provisos.js';
|
|
5
6
|
import { storyCalendarProblems } from './storyTime.js';
|
|
6
7
|
import { i18nFindings, localeMapOf } from './i18n.js';
|
|
7
|
-
import { eventById, notADeclaredEvent } from './events.js';
|
|
8
|
+
import { CORE_EVENTS, eventById, eventIdOf, notADeclaredEvent } from './events.js';
|
|
8
9
|
import { settingsSchemaFindings } from './settings.js';
|
|
9
|
-
import { exposureFindings } from './exposure.js';
|
|
10
|
+
import { exposureFindings, templateExposureWarnings } from './exposure.js';
|
|
10
11
|
import { genreUsesFindings } from './fit.js';
|
|
11
12
|
import { _withdrawHostStateOf, declareHostState, HOST_PLACE_KEY } from './hostState.js';
|
|
12
13
|
import { refuseUnlessIdentical } from './hash.js';
|
|
13
14
|
import { getRuleset, handbookFindings, isRulesetTemplateId, RIGOURS } from './rulesets.js';
|
|
14
15
|
import { finding, RULESET_ID_PATTERN, RulesetError } from './repertoires.js';
|
|
15
|
-
import { isActionIdentity, parseSpecId, assertSpecId } from './identity.js';
|
|
16
|
+
import { isActionIdentity, parseActionIdentity, parseSpecId, assertSpecId } from './identity.js';
|
|
16
17
|
import { enabledWhenFindings, normalizeEnabledWhen, } from './predicates.js';
|
|
17
18
|
/** `owner:genre/name` โ lowercase, digits, hyphens, dots in the owner. */
|
|
18
19
|
const GENRE_ID = /^[a-z0-9]+(?:[.-][a-z0-9]+)*:genre\/[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
@@ -546,6 +547,111 @@ function assertScenePlaceDeclared(props, id) {
|
|
|
546
547
|
if (place.stateKey !== HOST_PLACE_KEY)
|
|
547
548
|
throw new Error(`${id}.scenes.place.stateKey: '${place.stateKey}' is not a place the host keeps โ the place is '${HOST_PLACE_KEY}', the host's own (a genre declares no slots)`);
|
|
548
549
|
}
|
|
550
|
+
/**
|
|
551
|
+
* A genre's warnings, never refusals: its template exposures, and stated
|
|
552
|
+
* defaults that register no turn order option.
|
|
553
|
+
*
|
|
554
|
+
* Every template exposure in a genre's `shape.fields`. A genre field's reach
|
|
555
|
+
* defaults to `'owner'`, so its `template`, `templates` or `variables` field
|
|
556
|
+
* reaches the session's owner with or without an explicit reach: it warns
|
|
557
|
+
* either way. The field stays in the declaration (hashes do not move) and
|
|
558
|
+
* core shows it to administrators only. A genre whose stated defaults register
|
|
559
|
+
* nothing on `turn-order-asked` is warned, never refused. A shape that still
|
|
560
|
+
* carries `turnSeatChanges` is warned: the key has no effect. A default
|
|
561
|
+
* registration whose `when` reads `session.rounds.<name>` for a name that is
|
|
562
|
+
* not one of the genre's story channels is warned, never refused: it reads as
|
|
563
|
+
* absent, so the condition is false. A field or setting spelled like a rule core
|
|
564
|
+
* enforces that `shape.provisos` does not name is warned, never refused.
|
|
565
|
+
* @experimental
|
|
566
|
+
* @ruling G7, programme 2.3
|
|
567
|
+
*/
|
|
568
|
+
export function genreWarnings(decl) {
|
|
569
|
+
const out = templateExposureWarnings(decl.shape?.fields, `${decl.id}.shape.fields`, undefined, 'owner');
|
|
570
|
+
out.push(...autoAdvanceWarnings(decl));
|
|
571
|
+
if (decl.shape && Object.prototype.hasOwnProperty.call(decl.shape, 'turnSeatChanges'))
|
|
572
|
+
out.push(`genre '${decl.id}': \`turnSeatChanges\` has no effect and can be removed.`);
|
|
573
|
+
if (decl.defaults !== undefined) {
|
|
574
|
+
const asked = eventIdOf(CORE_EVENTS.turnOrderAsked);
|
|
575
|
+
const registers = (genreDefaultsOf(decl)?.registrations ?? []).some((r) => r.trigger.family === 'event' && r.trigger.event === asked);
|
|
576
|
+
if (!registers)
|
|
577
|
+
out.push(`${decl.id}.defaults registers nothing on Turn order asked ('${asked}'); its turn order runs on per-event registrations, which core retires โ register one: register(coreEvents.turnOrderAsked, โฆ, { default: true })`);
|
|
578
|
+
}
|
|
579
|
+
out.push(...roundsReadWarnings(decl));
|
|
580
|
+
out.push(...summarizeSceneWarnings(decl));
|
|
581
|
+
out.push(...provisoWarnings(decl));
|
|
582
|
+
return out;
|
|
583
|
+
}
|
|
584
|
+
/** A genre that declares `summarize.scene` and registers nothing on the summarize-scene action. */
|
|
585
|
+
function summarizeSceneWarnings(decl) {
|
|
586
|
+
const scene = decl.summarize?.scene;
|
|
587
|
+
if (typeof scene !== 'string' || scene === '')
|
|
588
|
+
return [];
|
|
589
|
+
const registers = (genreDefaultsOf(decl)?.registrations ?? []).some((r) => r.trigger.family === 'action' && parseActionIdentity(r.trigger.action)?.key === 'summarize-scene');
|
|
590
|
+
if (registers)
|
|
591
|
+
return [];
|
|
592
|
+
return [
|
|
593
|
+
`genre '${decl.id}': summarize.scene is read for one more release, then retired โ register your pipeline on the summarize-scene action instead.`,
|
|
594
|
+
];
|
|
595
|
+
}
|
|
596
|
+
/** `session.rounds.<name>` paths a condition reads, walking `on` / `all` / `any` / `not`. */
|
|
597
|
+
function roundsPathsOf(c) {
|
|
598
|
+
if (!c || typeof c !== 'object')
|
|
599
|
+
return [];
|
|
600
|
+
const o = c;
|
|
601
|
+
if (typeof o.on === 'string')
|
|
602
|
+
return [o.on];
|
|
603
|
+
const kids = Array.isArray(o.all) ? o.all : Array.isArray(o.any) ? o.any : o.not !== undefined ? [o.not] : [];
|
|
604
|
+
return kids.flatMap(roundsPathsOf);
|
|
605
|
+
}
|
|
606
|
+
/** A default registration that reads the round of a channel that is not a story channel of the genre. */
|
|
607
|
+
function roundsReadWarnings(decl) {
|
|
608
|
+
if (decl.defaults === undefined)
|
|
609
|
+
return [];
|
|
610
|
+
const story = channelDecls(decl.shape)
|
|
611
|
+
.map((c) => c.slug)
|
|
612
|
+
.filter((slug) => channelLoreRole(decl.shape, slug) === 'story');
|
|
613
|
+
if (!story.includes('main'))
|
|
614
|
+
story.unshift('main');
|
|
615
|
+
const out = [];
|
|
616
|
+
for (const r of genreDefaultsOf(decl)?.registrations ?? []) {
|
|
617
|
+
const names = new Set();
|
|
618
|
+
for (const path of roundsPathsOf(r.when)) {
|
|
619
|
+
if (!path.startsWith('session.rounds.'))
|
|
620
|
+
continue;
|
|
621
|
+
const name = path.slice('session.rounds.'.length);
|
|
622
|
+
if (!story.includes(name))
|
|
623
|
+
names.add(name);
|
|
624
|
+
}
|
|
625
|
+
for (const name of names)
|
|
626
|
+
out.push(`genre '${decl.id}': registration '${r.key}' reads the round of '${name}', which is not one of this genre's story channels (${story.join(', ')}) โ it reads as absent, so the condition is false. Name a story channel, or declare '${name}' with lore: 'story'.`);
|
|
627
|
+
}
|
|
628
|
+
return out;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* What a genre leaves unsaid about Auto-advance. A genre that declares no
|
|
632
|
+
* `autoAdvance` field offers no switch, so nothing starts by itself in its
|
|
633
|
+
* sessions; one that declares it and says nothing of `autoAdvanceRuns` (a field,
|
|
634
|
+
* a pinned setting, or a default setting) never fires. Both are told to the
|
|
635
|
+
* modder here and to the session's owner on the Turn line. A warning, never a
|
|
636
|
+
* refusal: a genre expects, it never locks.
|
|
637
|
+
* @experimental
|
|
638
|
+
* @ruling TA1 (owner 2026-11-19)
|
|
639
|
+
*/
|
|
640
|
+
export function autoAdvanceWarnings(decl) {
|
|
641
|
+
const fields = (decl.shape?.fields ?? {});
|
|
642
|
+
if (!('autoAdvance' in fields))
|
|
643
|
+
return [
|
|
644
|
+
`genre '${decl.id}': This genre declares no Auto-advance, so nothing starts by itself in its sessions; the session's owner is told so on the Turn line. Declare the field to offer the switch.`,
|
|
645
|
+
];
|
|
646
|
+
const says = 'autoAdvanceRuns' in fields ||
|
|
647
|
+
'autoAdvanceRuns' in (decl.settings ?? {}) ||
|
|
648
|
+
'autoAdvanceRuns' in (genreDefaultsOf(decl)?.settings ?? {});
|
|
649
|
+
return says
|
|
650
|
+
? []
|
|
651
|
+
: [
|
|
652
|
+
`genre '${decl.id}': This genre declares Auto-advance and says nothing of how far it runs, so it never fires; the session's owner is told so on the Turn line. Pin autoAdvanceRuns in the genre's settings, or declare it as a field to offer the choice.`,
|
|
653
|
+
];
|
|
654
|
+
}
|
|
549
655
|
/**
|
|
550
656
|
* Declare a genre. The id is stated in full, under your plugin's slug
|
|
551
657
|
* (`acme.dice:genre/table`), and the genre value is what everything else
|
|
@@ -563,6 +669,7 @@ export function genre(id, props) {
|
|
|
563
669
|
// degrade at the write site where nobody is reading.
|
|
564
670
|
assertSessionWrites(props.shape, id);
|
|
565
671
|
assertTurnControls(props.shape, id);
|
|
672
|
+
assertProvisos(props.shape, props.settings, id);
|
|
566
673
|
assertChannelDecls(props.shape, id);
|
|
567
674
|
{
|
|
568
675
|
const proposed = props.shape?.creationMode;
|
|
@@ -600,6 +707,28 @@ export function genre(id, props) {
|
|
|
600
707
|
if (typeof props.shape.view !== 'string')
|
|
601
708
|
throw new Error(`${id}.shape.applet without a session view. Declare shape.view (the plugin whose frame the applet mounts) or drop applet.`);
|
|
602
709
|
}
|
|
710
|
+
// ๐ง The book seats its cast (M3b, โ
M3-4): refused here โ a declaration that could never seat anyone is an authoring mistake.
|
|
711
|
+
if (props.shape?.castFromLorebook !== undefined) {
|
|
712
|
+
const at = `${id}.shape.castFromLorebook`;
|
|
713
|
+
const declared = props.shape.castFromLorebook;
|
|
714
|
+
if (declared === null || typeof declared !== 'object' || Array.isArray(declared))
|
|
715
|
+
throw new Error(`${at} must be an object โ { field?: 'examples' } โ or left out.`);
|
|
716
|
+
const field = declared.field;
|
|
717
|
+
if (field !== undefined) {
|
|
718
|
+
if (typeof field !== 'string' || field.trim() === '')
|
|
719
|
+
throw new Error(`${at}.field must be the name of a boolean field of this shape. Name one, or drop field to seat the cast always.`);
|
|
720
|
+
const decl = props.shape.fields?.[field];
|
|
721
|
+
if (!decl)
|
|
722
|
+
throw new Error(`${at}.field must name a boolean field of this shape; '${field}' is not declared in shape.fields. Declare it there as { type: 'boolean' } or drop field.`);
|
|
723
|
+
if (decl.type !== 'boolean')
|
|
724
|
+
throw new Error(`${at}.field must name a boolean field of this shape; '${field}' is a ${String(decl.type)} field. Name a boolean field or drop field.`);
|
|
725
|
+
}
|
|
726
|
+
if (props.shape.lorebook === undefined)
|
|
727
|
+
throw new Error(`${at} needs shape.lorebook: without the attachment picker no book is ever attached. Declare lorebook: 'optional' or drop castFromLorebook.`);
|
|
728
|
+
const seats = props.shape.characters;
|
|
729
|
+
if (seats === undefined || seats.max === 0)
|
|
730
|
+
throw new Error(`${at} needs character seats: shape.characters is ${seats === undefined ? 'absent' : 'max: 0'}, so every seat would be refused. Declare characters with room for the cast or drop castFromLorebook.`);
|
|
731
|
+
}
|
|
603
732
|
assertScenePlaceDeclared(props, id);
|
|
604
733
|
const events = { ...(props.events ?? {}) };
|
|
605
734
|
// The turn-order write's own event is core-internal (PLAN-turn-order
|
|
@@ -655,6 +784,12 @@ export function genre(id, props) {
|
|
|
655
784
|
throw new RulesetError(id, rulesetFound);
|
|
656
785
|
if (props.members !== undefined && props.members !== 'solo' && props.members !== 'group')
|
|
657
786
|
throw new Error(`${id}.members: 'solo' or 'group' โ not ${JSON.stringify(props.members)}`);
|
|
787
|
+
if (props.keepsTime !== undefined && props.keepsTime !== 'story' && props.keepsTime !== 'real' && props.keepsTime !== 'none')
|
|
788
|
+
throw new Error(`${id}.keepsTime: 'story', 'real' or 'none' โ not ${JSON.stringify(props.keepsTime)}`);
|
|
789
|
+
if (props.timeline !== undefined && props.timeline !== 'required')
|
|
790
|
+
throw new Error(`${id}.timeline: 'required', or leave it out โ not ${JSON.stringify(props.timeline)}`);
|
|
791
|
+
if (props.timeline === 'required' && props.keepsTime !== 'story')
|
|
792
|
+
throw new Error(`${id}.timeline: 'required' needs keepsTime: 'story' โ a genre that requires a timeline keeps story time (keepsTime is ${props.keepsTime === undefined ? 'left out' : JSON.stringify(props.keepsTime)})`);
|
|
658
793
|
const usesFound = genreUsesFindings(props.uses, `${id}.uses`);
|
|
659
794
|
if (usesFound.length)
|
|
660
795
|
throw new Error(usesFound.join('\n'));
|
|
@@ -678,6 +813,10 @@ export function genre(id, props) {
|
|
|
678
813
|
// ๐ง 2026-10-23: absent when unstated, so a genre that says nothing hashes as it did.
|
|
679
814
|
...(props.handbook !== undefined ? { handbook: Object.freeze(props.handbook.map((p) => Object.freeze({ title: p.title, body: p.body }))) } : {}),
|
|
680
815
|
...(props.members === 'solo' ? { members: 'solo' } : {}),
|
|
816
|
+
// ๐ง absent when unstated, so a genre that says nothing hashes as it did.
|
|
817
|
+
...(props.keepsTime !== undefined ? { keepsTime: props.keepsTime } : {}),
|
|
818
|
+
// ๐ง absent when unstated, so a genre that says nothing hashes as it did.
|
|
819
|
+
...(props.timeline === 'required' ? { timeline: 'required' } : {}),
|
|
681
820
|
...(props.uses ? { uses: Object.freeze(JSON.parse(JSON.stringify(props.uses))) } : {}),
|
|
682
821
|
// PLAN-layering D4: absent when unstated, so a genre that says nothing hashes as it did.
|
|
683
822
|
...(props.defaults ? { defaults: freezeGenreDefaults(props.defaults) } : {}),
|
|
@@ -687,7 +826,9 @@ export function genre(id, props) {
|
|
|
687
826
|
// R4: absent when unstated, so a genre that says nothing hashes as it did.
|
|
688
827
|
...(playerLabel ? { playerLabel } : {}),
|
|
689
828
|
// G2: absent when unstated, so a genre that says nothing hashes as it did.
|
|
690
|
-
...(props.history
|
|
829
|
+
...(props.history
|
|
830
|
+
? { history: Object.freeze({ settle: props.history.settle, ...(props.history.back ? { back: props.history.back } : {}) }) }
|
|
831
|
+
: {}),
|
|
691
832
|
...(enabledWhen && Object.keys(enabledWhen).length ? { enabledWhen } : {}),
|
|
692
833
|
// The pinned settings (ยง4.13): copied when stated, frozen like the
|
|
693
834
|
// rest, absent otherwise โ so an unpinned genre hashes as it did.
|
|
@@ -738,7 +879,7 @@ export function genreDefaultsShapeFindings(raw, at = 'defaults') {
|
|
|
738
879
|
return [];
|
|
739
880
|
const out = [];
|
|
740
881
|
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
741
|
-
return [`${at}: the genre's defaults are { registrations: [ โฆ ], settings? } โ got ${Array.isArray(raw) ? 'a list' : typeof raw}`];
|
|
882
|
+
return [`${at}: the genre's defaults are { registrations: [ โฆ ], groups?, settings? } โ got ${Array.isArray(raw) ? 'a list' : typeof raw}`];
|
|
742
883
|
const d = raw;
|
|
743
884
|
if (!Array.isArray(d.registrations))
|
|
744
885
|
out.push(`${at}.registrations: a list of registrations โ register(trigger, pipeline, { โฆ })`);
|
|
@@ -748,11 +889,21 @@ export function genreDefaultsShapeFindings(raw, at = 'defaults') {
|
|
|
748
889
|
if (!reg || typeof reg !== 'object' || typeof reg.key !== 'string' || !reg.trigger || typeof reg.trigger.family !== 'string' || typeof reg.pipeline !== 'string')
|
|
749
890
|
out.push(`${at}.registrations[${i}]: not a registration โ make each with register(trigger, pipeline, { โฆ })`);
|
|
750
891
|
});
|
|
892
|
+
if (d.groups !== undefined) {
|
|
893
|
+
if (!Array.isArray(d.groups))
|
|
894
|
+
out.push(`${at}.groups: a list of routine groups โ routineGroup(cadence, { key })`);
|
|
895
|
+
else
|
|
896
|
+
d.groups.forEach((g, i) => {
|
|
897
|
+
const grp = g;
|
|
898
|
+
if (!grp || typeof grp !== 'object' || typeof grp.key !== 'string' || !grp.cadence || typeof grp.cadence.id !== 'string')
|
|
899
|
+
out.push(`${at}.groups[${i}]: not a routine group โ make each with routineGroup(cadence, { key })`);
|
|
900
|
+
});
|
|
901
|
+
}
|
|
751
902
|
if (d.settings !== undefined && (!d.settings || typeof d.settings !== 'object' || Array.isArray(d.settings)))
|
|
752
903
|
out.push(`${at}.settings: a map of setting key โ value (or { value, lock?, askAtStart? })`);
|
|
753
904
|
for (const k of Object.keys(d))
|
|
754
|
-
if (k !== 'registrations' && k !== 'settings')
|
|
755
|
-
out.push(`${at}.${k} is not part of the genre's defaults โ registrations and settings; the default preset ` +
|
|
905
|
+
if (k !== 'registrations' && k !== 'groups' && k !== 'settings')
|
|
906
|
+
out.push(`${at}.${k} is not part of the genre's defaults โ registrations, groups and settings; the default preset ` +
|
|
756
907
|
`says so itself (preset({ โฆ, default: true }))`);
|
|
757
908
|
return out;
|
|
758
909
|
}
|
|
@@ -760,6 +911,7 @@ const freezeGenreDefaults = (d) => Object.freeze({
|
|
|
760
911
|
// The registrations themselves, not copies: the registration door
|
|
761
912
|
// recognises what `register()` handed out (a string reference warns, R30).
|
|
762
913
|
registrations: Object.freeze([...d.registrations]),
|
|
914
|
+
...(d.groups && d.groups.length ? { groups: Object.freeze([...d.groups]) } : {}),
|
|
763
915
|
...(d.settings && Object.keys(d.settings).length ? { settings: Object.freeze({ ...d.settings }) } : {}),
|
|
764
916
|
});
|
|
765
917
|
/**
|
package/dist/hookGrants.js
CHANGED
|
@@ -28,6 +28,16 @@ export const HOOK_CTX_KINDS = [
|
|
|
28
28
|
* person's saved documents (๐ง M2b); no network.
|
|
29
29
|
* - **oracle** โ storage, package and fetch. The one kind that calls out, which is what
|
|
30
30
|
* `effects: 'external'` names.
|
|
31
|
+
*
|
|
32
|
+
* The table says what a kind's `ctx` CARRIES, never whether a member works on a
|
|
33
|
+
* given call. The applet group โ `ctx.annex('user')` and `ctx.storage.user` โ is
|
|
34
|
+
* present on every kind above that has `annex` / `storage` and, per call, works
|
|
35
|
+
* only while the host's frame-origin cause names the calling plugin: its own
|
|
36
|
+
* mounted frame's request, or a person's press in it, caused the call (owner
|
|
37
|
+
* 2026-11-04). An event or lifecycle hook, the schedule tick and a routine,
|
|
38
|
+
* cadence or schedule run carry none, so those members reject there with one
|
|
39
|
+
* sentence ("<thing> is only available while the app is open.") โ present and
|
|
40
|
+
* refusing, never absent, like `ctx.storage.user` with no acting person.
|
|
31
41
|
* @ruling F11, F32
|
|
32
42
|
*/
|
|
33
43
|
const GRANTS = {
|
package/dist/hostElements.d.ts
CHANGED
|
@@ -215,10 +215,10 @@ export declare const SP_HOST_ELEMENTS: {
|
|
|
215
215
|
readonly doc: 'A host-owned slider. `input` (while dragging) and `change` (on release) carry `{ value }`.';
|
|
216
216
|
};
|
|
217
217
|
readonly 'sp-combobox': {
|
|
218
|
-
readonly attributes: readonly ["value", "placeholder", "disabled", "label", "class"];
|
|
218
|
+
readonly attributes: readonly ["value", "placeholder", "disabled", "label", "trigger-label", "class"];
|
|
219
219
|
readonly events: readonly ["input", "change"];
|
|
220
220
|
readonly children: readonly ["sp-option"];
|
|
221
|
-
readonly doc: 'A host-owned searchable select. `input` carries `{ query }` as the person types; `change` carries `{ value }`.';
|
|
221
|
+
readonly doc: 'A host-owned searchable select. `input` carries `{ query }` as the person types; `change` carries `{ value }`. `trigger-label` names the button that opens the list for a screen reader (absent: "Show options for โนlabelโบ" when `label` is set).';
|
|
222
222
|
};
|
|
223
223
|
readonly 'sp-option': {
|
|
224
224
|
readonly attributes: readonly ["value", "disabled", "class"];
|
|
@@ -473,5 +473,5 @@ export declare function hostElementsDts(): string;
|
|
|
473
473
|
* the suite says which to bump. `doc` strings are not the shape.
|
|
474
474
|
* @ruling F1, R22
|
|
475
475
|
*/
|
|
476
|
-
export declare const HOST_ELEMENTS_VERSION: '1.
|
|
476
|
+
export declare const HOST_ELEMENTS_VERSION: '1.10';
|
|
477
477
|
//# sourceMappingURL=hostElements.d.ts.map
|
package/dist/hostElements.js
CHANGED
|
@@ -138,7 +138,9 @@ export const SP_HOST_ELEMENTS = {
|
|
|
138
138
|
'๐ง `playing` (1.8; heading audio control 2026-10-29; core\'s alone) โ present, the page plays it; absent after present, the page pauses it. ' +
|
|
139
139
|
'An element that lands without it is left alone, so `autoplay` still plays. A play the browser refuses is answered with a `pause` event. ' +
|
|
140
140
|
'The page plays one sound at a time: another player starting pauses this one, and its `pause` arrives. ' +
|
|
141
|
-
'The element\'s own `play` / `pause` / `ended` events stay the truth; to start over, draw a fresh element.
|
|
141
|
+
'The element\'s own `play` / `pause` / `ended` events stay the truth; to start over, draw a fresh element. ' +
|
|
142
|
+
'๐ง `playlist` (1.10, spoken audio as an ordered list of files) โ space-separated app media URLs, each judged as `src`; with it the PAGE owns `src`: it plays the files in order on the same element, moving to the next in its own `ended` handler, skipping one that fails to load, and putting the first back after the last. ' +
|
|
143
|
+
'On a playlist element the events\' detail adds `playlistIndex` (0-based) and `playlistLength`, and `pause` ยท `ended` ยท `timeupdate` ยท `loadedmetadata` of a move between files are not delivered, so `ended` arrives once, after the last file; `error` carries `{ playlistIndex, playlistLength }` for the file that failed.', [...ARIA, 'src', 'controls', 'preload', 'autoplay', 'playing', 'playlist'], ['error', 'play', 'pause', 'ended', 'timeupdate', 'loadedmetadata']),
|
|
142
144
|
video: plain('๐ง A moving-picture player (1.3, O11) โ `audio`\'s rules, and a `track` of captions inside it.', [...ARIA, 'src', 'controls', 'preload', 'width', 'height'], ['error']),
|
|
143
145
|
track: plain("๐ง A video's timed text (1.3, O11): `kind` is `captions` ยท `subtitles` ยท `descriptions` ยท `chapters`; `src`, when given, the app's media.", ['kind', 'src', 'srclang', 'label', 'default']),
|
|
144
146
|
// โโ host sp elements โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
@@ -238,10 +240,10 @@ export const SP_HOST_ELEMENTS = {
|
|
|
238
240
|
doc: 'A host-owned slider. `input` (while dragging) and `change` (on release) carry `{ value }`.',
|
|
239
241
|
},
|
|
240
242
|
'sp-combobox': {
|
|
241
|
-
attributes: ['value', 'placeholder', 'disabled', 'label', 'class'],
|
|
243
|
+
attributes: ['value', 'placeholder', 'disabled', 'label', 'trigger-label', 'class'],
|
|
242
244
|
events: ['input', 'change'],
|
|
243
245
|
children: ['sp-option'],
|
|
244
|
-
doc: 'A host-owned searchable select. `input` carries `{ query }` as the person types; `change` carries `{ value }`.',
|
|
246
|
+
doc: 'A host-owned searchable select. `input` carries `{ query }` as the person types; `change` carries `{ value }`. `trigger-label` names the button that opens the list for a screen reader (absent: "Show options for โนlabelโบ" when `label` is set).',
|
|
245
247
|
},
|
|
246
248
|
'sp-option': {
|
|
247
249
|
attributes: ['value', 'disabled', 'class'],
|
|
@@ -535,6 +537,12 @@ export function hostAttributeValueFinding(tag, attribute, value) {
|
|
|
535
537
|
return v === 'async' || v === 'sync' || v === 'auto' ? undefined : `img decoding '${value}' โ async, sync or auto`;
|
|
536
538
|
if ((t === 'audio' || t === 'video') && attribute === 'preload')
|
|
537
539
|
return v === 'none' || v === 'metadata' || v === 'auto' ? undefined : `${t} preload '${value}' โ none, metadata or auto`;
|
|
540
|
+
if (t === 'audio' && attribute === 'playlist') {
|
|
541
|
+
const bad = v.split(/\s+/).find((token) => token && !isAppMedia(token));
|
|
542
|
+
if (!v)
|
|
543
|
+
return `audio playlist '${value}' โ the app's media only, space-separated`;
|
|
544
|
+
return bad === undefined ? undefined : `audio playlist '${bad}' โ the app's media only, space-separated`;
|
|
545
|
+
}
|
|
538
546
|
if (t === 'track' && attribute === 'kind')
|
|
539
547
|
return ['captions', 'subtitles', 'descriptions', 'chapters'].includes(v)
|
|
540
548
|
? undefined
|
|
@@ -749,5 +757,5 @@ export function hostElementsDts() {
|
|
|
749
757
|
* the suite says which to bump. `doc` strings are not the shape.
|
|
750
758
|
* @ruling F1, R22
|
|
751
759
|
*/
|
|
752
|
-
export const HOST_ELEMENTS_VERSION = '1.
|
|
760
|
+
export const HOST_ELEMENTS_VERSION = '1.10';
|
|
753
761
|
//# sourceMappingURL=hostElements.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './shapes.js';
|
|
2
2
|
export * from './candidates.js';
|
|
3
3
|
export * from './i18n.js';
|
|
4
|
+
export * from './appletCard.js';
|
|
4
5
|
export * from './verdicts.js';
|
|
5
6
|
export * from './descriptors.js';
|
|
6
7
|
export * from './nodeInput.js';
|
|
@@ -29,6 +30,7 @@ export * from './engines.js';
|
|
|
29
30
|
export * from './templateIds.js';
|
|
30
31
|
export * from './loadouts.js';
|
|
31
32
|
export * from './variables.js';
|
|
33
|
+
export * from './variableLayouts.js';
|
|
32
34
|
export * from './bands.js';
|
|
33
35
|
export * from './templateScopeAt.js';
|
|
34
36
|
export * from './templateFit.js';
|
|
@@ -40,6 +42,8 @@ export * from './checkMethods.js';
|
|
|
40
42
|
export * from './rulesetDocument.js';
|
|
41
43
|
export * from './rulesetTemplates.js';
|
|
42
44
|
export * from './rulesetSections.js';
|
|
45
|
+
export * from './sheetLatitude.js';
|
|
46
|
+
export * from './provisos.js';
|
|
43
47
|
export * from './functions.js';
|
|
44
48
|
export * from './ties.js';
|
|
45
49
|
export * from './jsonSchema.js';
|
|
@@ -102,6 +106,7 @@ export * from './componentWire.js';
|
|
|
102
106
|
export * from './componentModule.js';
|
|
103
107
|
export * from './channels.js';
|
|
104
108
|
export * from './participants.js';
|
|
109
|
+
export * from './characterProfile.js';
|
|
105
110
|
export * from './turnOrder.js';
|
|
106
111
|
export * from './sessionSettings.js';
|
|
107
112
|
export * from './actions.js';
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from './candidates.js';
|
|
|
3
3
|
// Display text (R-20): the one `I18n` type, `i18nFindings` every publish door
|
|
4
4
|
// runs, and `i18nText` every reader resolves through.
|
|
5
5
|
export * from './i18n.js';
|
|
6
|
+
export * from './appletCard.js';
|
|
6
7
|
// One verdict per law (01 ยง13): `defineVerdict` / `verdicts()` and the five
|
|
7
8
|
// verdicts whose judges read only leaf vocabulary โ the effects line and form
|
|
8
9
|
// staleness are declared in `messageBlocks.ts`, beside the primitives they
|
|
@@ -48,6 +49,10 @@ export * from './templateIds.js';
|
|
|
48
49
|
// `loadout-ref` value a node's `loadout` slot holds, and `prefers`.
|
|
49
50
|
export * from './loadouts.js';
|
|
50
51
|
export * from './variables.js';
|
|
52
|
+
// ๐ง Variable layouts by reference (PLAN-variable-layouts-2026-11-10): the
|
|
53
|
+
// `<owner>/<slug>@<major>` a template, a preset and the pub name a layout by,
|
|
54
|
+
// and `variableLayout()`, the typed seed a plugin ships one with.
|
|
55
|
+
export * from './variableLayouts.js';
|
|
51
56
|
// Bands as template variables (typed templates P2): a source declares the
|
|
52
57
|
// bands it publishes; `rendersAt` is what a node's variables slot renders.
|
|
53
58
|
export * from './bands.js';
|
|
@@ -83,6 +88,9 @@ export * from './rulesetDocument.js';
|
|
|
83
88
|
// ruleset laws a shipped catalogue keeps (2026-10-22).
|
|
84
89
|
export * from './rulesetTemplates.js';
|
|
85
90
|
export * from './rulesetSections.js';
|
|
91
|
+
// ๐ง Sheet latitude โ how far each role may change sheets and move items by hand, and the one judge (2026-11-05).
|
|
92
|
+
export * from './sheetLatitude.js';
|
|
93
|
+
export * from './provisos.js';
|
|
86
94
|
export * from './functions.js';
|
|
87
95
|
export * from './ties.js';
|
|
88
96
|
// ๐ง A declared shape as the JSON Schema a model answers against, and the one
|
|
@@ -195,6 +203,8 @@ export * from './channels.js';
|
|
|
195
203
|
// Participant references โ the audience grammar and the inlet's speaker
|
|
196
204
|
// (R-15, R-18 (3)); `Portrayal` is the resolver's answer the receipt pins.
|
|
197
205
|
export * from './participants.js';
|
|
206
|
+
// ๐ง The character profile and the cast member as a session reads them (cv-sdk).
|
|
207
|
+
export * from './characterProfile.js';
|
|
198
208
|
// Turn order as state (PLAN-turn-order ยง4.2): the candidate, entry and order
|
|
199
209
|
// documents, `EMPTY_TURN_ORDER` and `readTurnOrder`. After participants
|
|
200
210
|
// because a candidate's `ref` is a participant reference.
|
package/dist/layout.d.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* @ruling PLAN-layout-one-format-2026-09-28 brief 1
|
|
14
14
|
*/
|
|
15
15
|
import type { I18n } from './i18n.js';
|
|
16
|
+
import type { PanelPriority } from './sessionLayout.js';
|
|
16
17
|
import type { SettingsSchema } from './settings.js';
|
|
17
18
|
import type { WidgetBaseSection, WidgetSectionScope, WidgetWriteGrant } from './widgets.js';
|
|
18
19
|
/**
|
|
@@ -182,6 +183,23 @@ export interface WidgetDecl {
|
|
|
182
183
|
* reading order (middle, left, right) and `validateSessionLayout` warns.
|
|
183
184
|
*/
|
|
184
185
|
maxInstances?: number;
|
|
186
|
+
/**
|
|
187
|
+
* ๐ง How the host sizes and weighs the panel that shows this widget when the
|
|
188
|
+
* layout doesn't say. `height`: `fit` its content, or `fill` a share of what
|
|
189
|
+
* is left (absent: `fill`). `priority`: when a zone runs short, `low` gives
|
|
190
|
+
* way first, then `normal` (absent: `normal`). A layout's own
|
|
191
|
+
* `PanelV2.height` / `priority` win. Core's: Messages
|
|
192
|
+
* `{ height: 'fill', priority: 'low' }`, Composer
|
|
193
|
+
* `{ height: 'fit', priority: 'high' }`, Turn line
|
|
194
|
+
* `{ height: 'fit', priority: 'normal' }`.
|
|
195
|
+
*
|
|
196
|
+
* @ruling the owner, 2026-11-05 (R8: "an expanding composer weighs more than
|
|
197
|
+
* the activity/turn, and it weighs more than the messages")
|
|
198
|
+
*/
|
|
199
|
+
panel?: {
|
|
200
|
+
height?: 'fit' | 'fill';
|
|
201
|
+
priority?: PanelPriority;
|
|
202
|
+
};
|
|
185
203
|
/**
|
|
186
204
|
* โณ The surface manager's packing hints โ what the app's panel packer
|
|
187
205
|
* reads: the column span a widget asks for, its minimum box, whether it may
|
package/dist/libraryDraft.d.ts
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* `readLibraryDraft` takes every such block out of the text (what the person reads, and what is saved), and reads
|
|
10
10
|
* the LAST one: `make` names its kind and `draft` its parsed JSON. No block, an unknown kind, or JSON that does not
|
|
11
11
|
* parse โ `make: ''` and no `draft` (the blocks are still taken out). Pure; what `core:task/read-library-draft@1` runs.
|
|
12
|
+
* It is also the Guide reply's cleanup step: draft blocks out, and a line that is exactly `See: /docs/<path>` (optionally in
|
|
13
|
+
* backticks, optionally a trailing `.`) turned into a markdown link the message renderer draws.
|
|
12
14
|
* โ Not a tool call (`parse-tool-call@1`) and not `parse-json@1` (which reads a whole reply as JSON).
|
|
13
15
|
* @experimental
|
|
14
16
|
*/
|
package/dist/libraryDraft.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const BLOCK = /<!--\s*draft:([a-z-]+)\s*([\s\S]*?)-->/g;
|
|
2
|
+
const SEE_LINE = /^See: ?`?(\/docs\/[^\s`]+?)`?\.?[ \t]*$/gm;
|
|
2
3
|
/** @experimental */
|
|
3
4
|
export function readLibraryDraft(text) {
|
|
4
5
|
const s = typeof text === 'string' ? text : '';
|
|
@@ -9,7 +10,10 @@ export function readLibraryDraft(text) {
|
|
|
9
10
|
// draft anyone can read, and it must not be saved into the message.
|
|
10
11
|
const closed = s.replace(BLOCK, '');
|
|
11
12
|
const open = closed.search(/<!--\s*draft:/);
|
|
12
|
-
const stripped = (open >= 0 ? closed.slice(0, open) : closed)
|
|
13
|
+
const stripped = (open >= 0 ? closed.slice(0, open) : closed)
|
|
14
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
15
|
+
.trimEnd()
|
|
16
|
+
.replace(SEE_LINE, 'See: [$1]($1)');
|
|
13
17
|
if (!last || (last.kind !== 'character' && last.kind !== 'lorebook'))
|
|
14
18
|
return { text: stripped, make: '' };
|
|
15
19
|
try {
|
package/dist/lorebookFile.d.ts
CHANGED
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
* file-level shape only: size, JSON, nesting, the entries list, and the
|
|
12
12
|
* ceilings on counts and lengths. It never touches a database.
|
|
13
13
|
*
|
|
14
|
+
* The file-level fields it also checks are a book's **rules**:
|
|
15
|
+
* `extensions.serenepub.primaryRuleset` (plus an optional `rulesetVersion`), the
|
|
16
|
+
* book's own ruleset beside `storyTime` (ruling โ
M3b-S5-1, 2026-11-05). They are
|
|
17
|
+
* not a session's ruleset and not a lock: a session started on the book adopts
|
|
18
|
+
* them, and a Freeform book brings none. An id this pub doesn't have is the
|
|
19
|
+
* importer's business (it imports the book on Freeform with a warning), not the
|
|
20
|
+
* validator's; this checks the shape only.
|
|
21
|
+
*
|
|
14
22
|
* @experimental
|
|
15
23
|
*/
|
|
16
24
|
/** The ceilings an imported lorebook file is held to. Mirrors the app's `LOREBOOK_IMPORT_LIMITS`. @experimental */
|
package/dist/lorebookFile.js
CHANGED
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
* file-level shape only: size, JSON, nesting, the entries list, and the
|
|
12
12
|
* ceilings on counts and lengths. It never touches a database.
|
|
13
13
|
*
|
|
14
|
+
* The file-level fields it also checks are a book's **rules**:
|
|
15
|
+
* `extensions.serenepub.primaryRuleset` (plus an optional `rulesetVersion`), the
|
|
16
|
+
* book's own ruleset beside `storyTime` (ruling โ
M3b-S5-1, 2026-11-05). They are
|
|
17
|
+
* not a session's ruleset and not a lock: a session started on the book adopts
|
|
18
|
+
* them, and a Freeform book brings none. An id this pub doesn't have is the
|
|
19
|
+
* importer's business (it imports the book on Freeform with a warning), not the
|
|
20
|
+
* validator's; this checks the shape only.
|
|
21
|
+
*
|
|
14
22
|
* @experimental
|
|
15
23
|
*/
|
|
16
24
|
/** The ceilings an imported lorebook file is held to. Mirrors the app's `LOREBOOK_IMPORT_LIMITS`. @experimental */
|
|
@@ -175,6 +183,19 @@ export function lorebookFileFindings(text) {
|
|
|
175
183
|
out.push(`Lorebook's narrative graph has too many nodes (${count(graph?.nodes)}); the maximum supported is ${L.maxNarrativeNodes}.`);
|
|
176
184
|
if (count(graph?.relationships) > L.maxNarrativeRelationships)
|
|
177
185
|
out.push(`Lorebook's narrative graph has too many relationships (${count(graph?.relationships)}); the maximum supported is ${L.maxNarrativeRelationships}.`);
|
|
186
|
+
if (serenepub && typeof serenepub === 'object' && !Array.isArray(serenepub)) {
|
|
187
|
+
const { primaryRuleset, rulesetVersion } = serenepub;
|
|
188
|
+
const named = primaryRuleset !== undefined && primaryRuleset !== null;
|
|
189
|
+
const versioned = rulesetVersion !== undefined && rulesetVersion !== null;
|
|
190
|
+
if (named && (typeof primaryRuleset !== 'string' || primaryRuleset === '' || primaryRuleset.length > L.maxNameChars))
|
|
191
|
+
out.push("This lorebook's primaryRuleset must be a ruleset id, such as 'core:ruleset/freeform@1'.");
|
|
192
|
+
if (versioned && (typeof rulesetVersion !== 'string' || !/^\d+\.\d+\.\d+/.test(rulesetVersion))) {
|
|
193
|
+
const shown = typeof rulesetVersion === 'string' && rulesetVersion.length <= 40 ? ` '${rulesetVersion}'` : '';
|
|
194
|
+
out.push(`This lorebook's rulesetVersion${shown} isn't a version like 1.2.0.`);
|
|
195
|
+
}
|
|
196
|
+
if (versioned && !named)
|
|
197
|
+
out.push('This lorebook names a rulesetVersion but no primaryRuleset.');
|
|
198
|
+
}
|
|
178
199
|
const book = data.character_book ?? data.data?.character_book ?? data;
|
|
179
200
|
if (typeof book?.name === 'string' && book.name.length > L.maxNameChars)
|
|
180
201
|
out.push(`This lorebook's name is ${fmt(book.name.length)} characters; Serene Pub reads up to ${fmt(L.maxNameChars)}.`);
|