@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.
Files changed (106) hide show
  1. package/dist/annexFields.d.ts +14 -0
  2. package/dist/annexFields.js +7 -0
  3. package/dist/announce.d.ts +62 -16
  4. package/dist/announce.js +90 -4
  5. package/dist/appletCard.d.ts +17 -0
  6. package/dist/appletCard.js +60 -0
  7. package/dist/attributes.d.ts +3 -3
  8. package/dist/attributes.js +1 -1
  9. package/dist/builder.d.ts +28 -13
  10. package/dist/builder.js +57 -5
  11. package/dist/cadences.d.ts +8 -1
  12. package/dist/cadences.js +27 -2
  13. package/dist/characterProfile.d.ts +137 -0
  14. package/dist/characterProfile.js +24 -0
  15. package/dist/component.d.ts +1 -1
  16. package/dist/componentImports.d.ts +1 -1
  17. package/dist/componentImports.js +2 -0
  18. package/dist/componentWire.js +28 -0
  19. package/dist/conditions.d.ts +5 -1
  20. package/dist/conditions.js +7 -0
  21. package/dist/declarations.d.ts +63 -1
  22. package/dist/declarations.js +176 -7
  23. package/dist/descriptors.d.ts +145 -6
  24. package/dist/descriptors.js +106 -5
  25. package/dist/document.d.ts +9 -1
  26. package/dist/document.js +44 -1
  27. package/dist/events.d.ts +82 -8
  28. package/dist/events.js +42 -5
  29. package/dist/executor.d.ts +27 -0
  30. package/dist/executor.js +32 -8
  31. package/dist/exposure.d.ts +35 -1
  32. package/dist/exposure.js +64 -2
  33. package/dist/extension.d.ts +30 -2
  34. package/dist/extension.js +3 -1
  35. package/dist/fit.d.ts +4 -1
  36. package/dist/fit.js +43 -1
  37. package/dist/functions.d.ts +7 -1
  38. package/dist/functions.js +3 -1
  39. package/dist/genres.d.ts +67 -2
  40. package/dist/genres.js +160 -8
  41. package/dist/hookGrants.js +10 -0
  42. package/dist/hostElements.d.ts +3 -3
  43. package/dist/hostElements.js +12 -4
  44. package/dist/index.d.ts +5 -0
  45. package/dist/index.js +10 -0
  46. package/dist/layout.d.ts +18 -0
  47. package/dist/libraryDraft.d.ts +2 -0
  48. package/dist/libraryDraft.js +5 -1
  49. package/dist/lorebookFile.d.ts +8 -0
  50. package/dist/lorebookFile.js +21 -0
  51. package/dist/participants.d.ts +83 -8
  52. package/dist/participants.js +9 -5
  53. package/dist/pluginPermissions.js +1 -1
  54. package/dist/promptBlocks.d.ts +5 -1
  55. package/dist/promptBlocks.js +23 -8
  56. package/dist/provisos.d.ts +92 -0
  57. package/dist/provisos.js +273 -0
  58. package/dist/receiverRules.js +1 -1
  59. package/dist/registrations.d.ts +154 -14
  60. package/dist/registrations.js +293 -23
  61. package/dist/registry.js +6 -3
  62. package/dist/repertoires.d.ts +13 -1
  63. package/dist/repertoires.js +5 -1
  64. package/dist/rulesetDocument.d.ts +11 -0
  65. package/dist/rulesetDocument.js +17 -0
  66. package/dist/rulesetSections.d.ts +12 -0
  67. package/dist/rulesetSections.js +8 -0
  68. package/dist/rulesets.js +6 -0
  69. package/dist/sceneSettings.d.ts +7 -1
  70. package/dist/sceneSettings.js +10 -5
  71. package/dist/sessionDossier.d.ts +159 -2
  72. package/dist/sessionLayout.d.ts +296 -85
  73. package/dist/sessionLayout.js +397 -133
  74. package/dist/sessionSettings.d.ts +18 -0
  75. package/dist/settings.d.ts +28 -1
  76. package/dist/settings.js +50 -2
  77. package/dist/shapes.d.ts +15 -1
  78. package/dist/shapes.js +15 -1
  79. package/dist/sheetLatitude.d.ts +148 -0
  80. package/dist/sheetLatitude.js +161 -0
  81. package/dist/speech.d.ts +14 -3
  82. package/dist/storyTime.d.ts +77 -1
  83. package/dist/storyTime.js +117 -8
  84. package/dist/surfaces.d.ts +49 -2
  85. package/dist/surfaces.js +3 -0
  86. package/dist/template.d.ts +38 -1
  87. package/dist/templateCheck.d.ts +24 -0
  88. package/dist/templateCheck.js +465 -10
  89. package/dist/templateFit.js +8 -1
  90. package/dist/templateIds.d.ts +6 -0
  91. package/dist/templateIds.js +9 -0
  92. package/dist/turnLock.d.ts +10 -1
  93. package/dist/turnLock.js +6 -1
  94. package/dist/turnOrder.d.ts +37 -4
  95. package/dist/turnOrder.js +49 -11
  96. package/dist/validate.d.ts +4 -2
  97. package/dist/validate.js +84 -11
  98. package/dist/variableLayouts.d.ts +160 -0
  99. package/dist/variableLayouts.js +202 -0
  100. package/dist/variables.d.ts +237 -20
  101. package/dist/variables.js +292 -33
  102. package/dist/widgetDecls.js +12 -0
  103. package/dist/widgets.d.ts +449 -47
  104. package/dist/widgets.js +31 -0
  105. package/host-elements.d.ts +4 -2
  106. package/package.json +1 -1
package/dist/executor.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * but never waiting, consumption budgets, per-kind injection, and core-emitted events.
7
7
  */
8
8
  import { JUNCTION_CLAUSE_PORTS, envoyConfigKeysOf } from './document.js';
9
- import { AMBIENT_SCRIPT_EXTRAS, getDefinition, opensLiveRow, seamsOf } from './descriptors.js';
9
+ import { AMBIENT_SCRIPT_EXTRAS, getDefinition, opensLiveRow, removedNodeDefinitionSentence, seamsOf } from './descriptors.js';
10
10
  import { packageEventById } from './events.js';
11
11
  import { collectDataRefs, isSlotRef } from './refs.js';
12
12
  import { resolveConfigSources, slotConnectionId, slotConnectionModelId, SLOT_VALUE, } from './config.js';
@@ -232,6 +232,7 @@ export async function run(doc, opts) {
232
232
  const seed = opts.seed ?? 'seed:0';
233
233
  const rng = seededRandom(seed);
234
234
  const now = opts.now ?? (() => Date.now());
235
+ const limitsOff = opts.stepTimeLimitsOff === true;
235
236
  // Clauses are addressed alongside nodes so a clause can carry a setting of
236
237
  // its own โ€” its execution mode. Keys cannot collide: a clause id qualifies
237
238
  // the nodes inside it (`drafting` contains `drafting.item.draft`), so the
@@ -674,8 +675,12 @@ export async function run(doc, opts) {
674
675
  };
675
676
  const invokeInner = async (node, scope, blockMode, iteration, iterationCount) => {
676
677
  const d = getDefinition(`${node.definitionId}@${node.definitionVersion}`);
677
- if (!d)
678
- return err(`unknown type ${node.definitionId}@${node.definitionVersion}`);
678
+ if (!d) {
679
+ const removed = removedNodeDefinitionSentence(node.definitionId);
680
+ return err(removed
681
+ ? `${node.key}: ${removed}`
682
+ : `unknown type ${node.definitionId}@${node.definitionVersion}`);
683
+ }
679
684
  // Declared, not bound (plans/29 R-2). `validate()` refuses the document;
680
685
  // this is the same refusal for a document that reached the executor by
681
686
  // another door โ€” a stored version older than the flag โ€” so it halts on
@@ -1019,7 +1024,8 @@ export async function run(doc, opts) {
1019
1024
  // the run is worth recording in full whatever happens next.
1020
1025
  if (d.effects && d.effects !== 'none')
1021
1026
  effectfulNodeRan = true;
1022
- const timeoutMs = Math.min(d.timeoutMs ?? Infinity, opts.timeoutCeilingMs ?? Infinity);
1027
+ const ceilingMs = limitsOff ? Infinity : (opts.timeoutCeilingMs ?? Infinity);
1028
+ const timeoutMs = limitsOff ? Infinity : Math.min(d.timeoutMs ?? Infinity, ceilingMs);
1023
1029
  nr.timeoutMsApplied = Number.isFinite(timeoutMs) ? timeoutMs : undefined;
1024
1030
  const controller = new AbortController();
1025
1031
  // F36: `wall` bounds the invocation; `idle` bounds the gap between
@@ -1027,7 +1033,7 @@ export async function run(doc, opts) {
1027
1033
  const clock = nodeClock({
1028
1034
  ms: timeoutMs,
1029
1035
  kind: d.timeoutKind ?? 'wall',
1030
- ceilingMs: opts.timeoutCeilingMs ?? Infinity,
1036
+ ceilingMs,
1031
1037
  }, controller);
1032
1038
  const base = {
1033
1039
  signal: controller.signal,
@@ -1093,8 +1099,25 @@ export async function run(doc, opts) {
1093
1099
  throw new Error(`'${point}' is not a script point '${nr.definitionId}' declares. ` +
1094
1100
  `Declared: ${declared.map((sp) => sp.at).join(', ')}. ` +
1095
1101
  `Points are part of the hashed contract โ€” declare it on the descriptor.`);
1096
- // No try/catch: an applier throw reaches the binding that asked.
1097
- const outcome = await applyAtSeam(known, value, 'binding');
1102
+ // An applier throw is absorbed and recorded, as at a port seam (18 S2;
1103
+ // the `ScriptChainApplier` contract); only a halt reaches the binding.
1104
+ let outcome;
1105
+ try {
1106
+ outcome = await applyAtSeam(known, value, 'binding');
1107
+ }
1108
+ catch (e) {
1109
+ ;
1110
+ (nr.scripts ??= []).push({
1111
+ scriptId: -1,
1112
+ name: '(engine)',
1113
+ scriptKind: '',
1114
+ phase: 'before',
1115
+ appliedBy: 'binding',
1116
+ result: 'err',
1117
+ reason: e.message,
1118
+ });
1119
+ return value;
1120
+ }
1098
1121
  if (outcome.halt) {
1099
1122
  interiorHalt ??= outcome.halt.reason;
1100
1123
  throw new ScriptSeamHalt(outcome.halt.reason);
@@ -1661,7 +1684,8 @@ export async function run(doc, opts) {
1661
1684
  /** Set when the run ended by throwing; rethrown after the run-end hook. */
1662
1685
  let thrown;
1663
1686
  try {
1664
- const outcome = await runLevel({ clauseId: undefined, chain: undefined }, values);
1687
+ const rootGate = (opts.writeAfter ?? []).map((p) => Promise.resolve(p).then(() => undefined, () => undefined));
1688
+ const outcome = await runLevel({ clauseId: undefined, chain: undefined }, values, undefined, undefined, undefined, rootGate);
1665
1689
  if (outcome.kind === 'halt') {
1666
1690
  receipt.outcome = 'halt';
1667
1691
  receipt.haltReason = outcome.reason;
@@ -78,10 +78,44 @@ export declare function setting(value: unknown, decide?: {
78
78
  export declare const MODEL_PLUMBING: readonly string[];
79
79
  /** Is this setting model plumbing โ€” by its key, or by sourcing its options from a connection? @experimental */
80
80
  export declare const isModelPlumbing: (key: string, decl?: Pick<FieldDecl, 'from'>) => boolean;
81
+ /**
82
+ * Does this setting key name a context template or a variable layout โ€”
83
+ * `template`, `templates` or `variables` โ€” and not source its options from a
84
+ * connection? Core's settings cascade imports this test, so the two never
85
+ * restate the rule.
86
+ * @experimental
87
+ * @ruling G7
88
+ */
89
+ export declare const isTemplateSetting: (key: string, decl?: Pick<FieldDecl, 'from'>) => boolean;
90
+ /**
91
+ * Every place a schema exposes a context template or a variable template to
92
+ * the owner (`reach: 'owner'`): by the slot's kind when the schema belongs to
93
+ * a `template` or `variables` slot (any field in it, whatever its key), else
94
+ * by the key (`template`, `templates`, `variables`). Templates are an
95
+ * administrator's: the exposure is ignored โ€” the declaration stays, core
96
+ * never shows it โ€” and each is a warning sentence, never a refusal (owner
97
+ * ruling G7, 2026-11-16). Connections, sampling and loadouts are still
98
+ * `exposureFindings`' refusals. `defaultReach` is the reach of a field that
99
+ * states none: pass `'owner'` for a genre's fields.
100
+ * @experimental
101
+ * @ruling G7
102
+ */
103
+ export declare function templateExposureWarnings(schema: Readonly<Record<string, FieldDecl>> | undefined, at?: string, slotKind?: string, defaultReach?: 'admin' | 'owner'): string[];
104
+ /**
105
+ * A ruleset's `options.fields` named like a template setting (`template`,
106
+ * `templates`, `variables`), whatever their reach. A ruleset's option reaches
107
+ * the owner's _Rules options_ and only ever picks a rules convention, so a
108
+ * template-like name is a mistake to rename, never an exposure to hide. One
109
+ * warning sentence per field, never a refusal.
110
+ * @experimental
111
+ * @ruling G7
112
+ */
113
+ export declare function rulesetOptionWarnings(schema: Readonly<Record<string, FieldDecl>> | undefined, at?: string): string[];
81
114
  /**
82
115
  * Every exposure fault in a schema: model plumbing declared `reach: 'owner'`
83
116
  * (never โ€” ruled 10-12), an unknown reach, a `fixedAtStart` that is not
84
- * `true`. As sentences that say what to do instead.
117
+ * `true`. As sentences that say what to do instead. A template or variables
118
+ * exposure is not one: it is `templateExposureWarnings`' (G7).
85
119
  * @experimental
86
120
  * @ruling R1, R32
87
121
  */
package/dist/exposure.js CHANGED
@@ -89,10 +89,72 @@ export const MODEL_PLUMBING = Object.freeze([
89
89
  /** Is this setting model plumbing โ€” by its key, or by sourcing its options from a connection? @experimental */
90
90
  export const isModelPlumbing = (key, decl) => MODEL_PLUMBING.includes(key) ||
91
91
  (typeof decl?.from === 'string' && decl.from.startsWith('connection.'));
92
+ /** The keys that name a context template or a variable layout: ignored with a warning, never refused (G7, 2026-11-16). */
93
+ const TEMPLATE_KEYS = ['template', 'templates', 'variables'];
94
+ const isConnectionSourced = (d) => typeof d?.from === 'string' && d.from.startsWith('connection.');
95
+ /**
96
+ * Does this setting key name a context template or a variable layout โ€”
97
+ * `template`, `templates` or `variables` โ€” and not source its options from a
98
+ * connection? Core's settings cascade imports this test, so the two never
99
+ * restate the rule.
100
+ * @experimental
101
+ * @ruling G7
102
+ */
103
+ export const isTemplateSetting = (key, decl) => TEMPLATE_KEYS.includes(key) && !isConnectionSourced(decl);
104
+ /**
105
+ * Every place a schema exposes a context template or a variable template to
106
+ * the owner (`reach: 'owner'`): by the slot's kind when the schema belongs to
107
+ * a `template` or `variables` slot (any field in it, whatever its key), else
108
+ * by the key (`template`, `templates`, `variables`). Templates are an
109
+ * administrator's: the exposure is ignored โ€” the declaration stays, core
110
+ * never shows it โ€” and each is a warning sentence, never a refusal (owner
111
+ * ruling G7, 2026-11-16). Connections, sampling and loadouts are still
112
+ * `exposureFindings`' refusals. `defaultReach` is the reach of a field that
113
+ * states none: pass `'owner'` for a genre's fields.
114
+ * @experimental
115
+ * @ruling G7
116
+ */
117
+ export function templateExposureWarnings(schema, at = 'fields', slotKind, defaultReach) {
118
+ const out = [];
119
+ const byKind = slotKind === 'template' || slotKind === 'variables';
120
+ for (const [key, d] of Object.entries(schema ?? {})) {
121
+ if (!d || typeof d !== 'object')
122
+ continue;
123
+ if ((d.reach ?? defaultReach) === 'owner' && (byKind || isTemplateSetting(key, d)))
124
+ out.push(`${at}.${key} exposes a context or variable template to the owner (reach: 'owner') โ€” templates are an ` +
125
+ `administrator's, so the exposure was ignored and the setting stays administrator-only; ` +
126
+ (defaultReach === 'owner' ? `say reach: 'admin'` : `drop the reach`));
127
+ if (d.type === 'object' && d.fields)
128
+ out.push(...templateExposureWarnings(d.fields, `${at}.${key}`, slotKind, defaultReach));
129
+ }
130
+ return out;
131
+ }
132
+ /**
133
+ * A ruleset's `options.fields` named like a template setting (`template`,
134
+ * `templates`, `variables`), whatever their reach. A ruleset's option reaches
135
+ * the owner's _Rules options_ and only ever picks a rules convention, so a
136
+ * template-like name is a mistake to rename, never an exposure to hide. One
137
+ * warning sentence per field, never a refusal.
138
+ * @experimental
139
+ * @ruling G7
140
+ */
141
+ export function rulesetOptionWarnings(schema, at = 'options.fields') {
142
+ const out = [];
143
+ for (const [key, d] of Object.entries(schema ?? {})) {
144
+ if (!d || typeof d !== 'object')
145
+ continue;
146
+ if (isTemplateSetting(key, d))
147
+ out.push(`${at}.${key}: named like a template setting; a ruleset's option is a rules choice and never picks a template. Rename it.`);
148
+ if (d.type === 'object' && d.fields)
149
+ out.push(...rulesetOptionWarnings(d.fields, `${at}.${key}`));
150
+ }
151
+ return out;
152
+ }
92
153
  /**
93
154
  * Every exposure fault in a schema: model plumbing declared `reach: 'owner'`
94
155
  * (never โ€” ruled 10-12), an unknown reach, a `fixedAtStart` that is not
95
- * `true`. As sentences that say what to do instead.
156
+ * `true`. As sentences that say what to do instead. A template or variables
157
+ * exposure is not one: it is `templateExposureWarnings`' (G7).
96
158
  * @experimental
97
159
  * @ruling R1, R32
98
160
  */
@@ -103,7 +165,7 @@ export function exposureFindings(schema, at = 'fields') {
103
165
  continue;
104
166
  if (d.reach !== undefined && d.reach !== 'admin' && d.reach !== 'owner')
105
167
  out.push(`${at}.${key}.reach: 'admin' or 'owner' โ€” not ${JSON.stringify(d.reach)}`);
106
- if (d.reach === 'owner' && isModelPlumbing(key, d))
168
+ if (d.reach === 'owner' && isModelPlumbing(key, d) && !isTemplateSetting(key, d))
107
169
  out.push(`${at}.${key} is model plumbing (the connection, sampling, loadout, prompts or templates a step ` +
108
170
  `runs on) and declares reach: 'owner' โ€” plumbing is an administrator's, never a member's; drop the reach`);
109
171
  if (d.fixedAtStart !== undefined && d.fixedAtStart !== true)
@@ -40,7 +40,7 @@ import { type AnnexFieldDecl } from './annexFields.js';
40
40
  import type { SurfacesDecl } from './surfaces.js';
41
41
  import type { RulesetDocument } from './rulesetDocument.js';
42
42
  import { type VariableDecl } from './variables.js';
43
- import { type StoredSwapContribution, type SwapContribution } from './declarations.js';
43
+ import { type StoredSwapContribution, type StoredTurnOrderOption, type SwapContribution, type TurnOrderOptionDecl } from './declarations.js';
44
44
  /**
45
45
  * The **handler** implementing a node definition. Data in, expected shape out; the executor is the only caller.
46
46
  * **Private** (the default) means only this extension's pipelines may use the
@@ -478,6 +478,16 @@ export interface ExtensionDecl {
478
478
  * here; the instance checks exposure and fit at install.
479
479
  */
480
480
  swaps?: SwapContribution[];
481
+ /**
482
+ * Turn order options this plugin adds to genres it names โ€” `{ genre: storyGenre,
483
+ * option: register(coreEvents.turnOrderAsked, natural, { label: 'Natural hand-off' }) }`.
484
+ * Each registers on Turn order asked and never marks `default` (a plugin never
485
+ * changes a genre's default); its pipeline is one of `pipelines`. A genre that is
486
+ * not installed is accepted: the instance offers the option once that genre arrives.
487
+ * @experimental
488
+ * @ruling TQ1, TQ2, TQ4 (owner 2026-11-19)
489
+ */
490
+ turnOrderOptions?: TurnOrderOptionDecl[];
481
491
  /**
482
492
  * What this plugin asks the sandbox for: a storage quota, a network
483
493
  * allowlist. **Declared, because nothing else can compile them** โ€” the
@@ -556,6 +566,23 @@ export interface ExtensionDecl {
556
566
  provides?: {
557
567
  lorebooks?: readonly string[];
558
568
  };
569
+ /**
570
+ * ๐Ÿšง The applet card the Apps view, Home and the launcher show for this package (M2d).
571
+ * `poster` is the picture, shown 16:9 and cropped (1280ร—720 recommended; no aspect
572
+ * check); `logo` an optional small square mark over the poster's lower-left; `blurb`
573
+ * one short descriptive line, at most 160 characters. `poster` and `logo` are
574
+ * package-relative paths under the declared `assets.dir` (as `provides.lorebooks`),
575
+ * served at `/plugin-assets/<id>/<version>/<path>`. `serene-pub check` refuses a path
576
+ * outside `assets.dir` (`E_APPLET_CARD_OUTSIDE_ASSETS`), a missing file
577
+ * (`E_APPLET_CARD_MISSING`), a blurb over 160 characters (`E_APPLET_CARD_BLURB_LONG`)
578
+ * and a card on a package with no applet genre (`E_APPLET_CARD_WITHOUT_APPLET`).
579
+ * @experimental (M2d)
580
+ */
581
+ appletCard?: {
582
+ poster?: string;
583
+ logo?: string;
584
+ blurb?: I18n;
585
+ };
559
586
  /**
560
587
  * ๐Ÿšง Rulesets shipped in the package, as ruleset documents (M0,
561
588
  * SHAPES L4 Declaration): install and upgrade publish each as a `rulesets`
@@ -581,11 +608,12 @@ export interface ExtensionDecl {
581
608
  * down to its id โ€” the shapes the packager writes into the manifest.
582
609
  * @experimental
583
610
  */
584
- export interface Extension extends Omit<ExtensionDecl, 'configs' | 'presets' | 'swaps' | 'events'> {
611
+ export interface Extension extends Omit<ExtensionDecl, 'configs' | 'presets' | 'swaps' | 'turnOrderOptions' | 'events'> {
585
612
  readonly __extension: true;
586
613
  configs?: ConfigDecl[];
587
614
  presets?: PresetDecl[];
588
615
  swaps?: StoredSwapContribution[];
616
+ turnOrderOptions?: StoredTurnOrderOption[];
589
617
  events?: StoredEventDeclaration[];
590
618
  /**
591
619
  * The shapes registered under this package's slug when it was declared
package/dist/extension.js CHANGED
@@ -32,7 +32,7 @@ import { listShapes } from './shapes.js';
32
32
  import { preset, storedConfig, storedEventDeclaration, } from './announce.js';
33
33
  import { annexFieldListFindings } from './annexFields.js';
34
34
  import { getVariable, pluginVariableFindings } from './variables.js';
35
- import { declarationFindings, storedSwap, swapInputFindings, } from './declarations.js';
35
+ import { declarationFindings, storedSwap, storedTurnOrderOption, swapInputFindings, } from './declarations.js';
36
36
  /** @public */
37
37
  export function handler(definition, fn, opts = {}) {
38
38
  const descriptor = ('descriptor' in definition ? definition.descriptor : definition);
@@ -301,6 +301,7 @@ export function defineExtension(d) {
301
301
  components: d.components,
302
302
  widgets: d.widgets,
303
303
  swaps: d.swaps,
304
+ turnOrderOptions: d.turnOrderOptions,
304
305
  events,
305
306
  // Declared nothing is `[]`: every key a pipeline of this package
306
307
  // writes to its own annex must be declared (ruling 2026-09-26).
@@ -318,6 +319,7 @@ export function defineExtension(d) {
318
319
  ...(presets ? { presets } : {}),
319
320
  ...(events ? { events } : {}),
320
321
  ...(d.swaps ? { swaps: d.swaps.map(storedSwap) } : {}),
322
+ ...(d.turnOrderOptions ? { turnOrderOptions: d.turnOrderOptions.map(storedTurnOrderOption) } : {}),
321
323
  ...(shapes.length ? { shapes } : {}),
322
324
  };
323
325
  }
package/dist/fit.d.ts CHANGED
@@ -168,6 +168,8 @@ export interface RulesetFit {
168
168
  readonly inWords: readonly FitRow[];
169
169
  /** What the ruleset provides that the genre never exercises โ€” shown neutrally, never a penalty. */
170
170
  readonly unused: readonly string[];
171
+ /** ๐Ÿšง The times its rules count on that the genre does not keep โ€” a rating and a sentence, never a refusal (genres expect, never lock). Absent when none. */
172
+ readonly timeUnmet?: readonly ('story' | 'real')[];
171
173
  }
172
174
  /**
173
175
  * Cross-examine a genre's uses against a ruleset's provides.
@@ -180,9 +182,10 @@ export interface RulesetFit {
180
182
  * ยท Poor โ€” more than half of the uses by words
181
183
  * ยท Incompatible โ€” any use missing with no words fallback
182
184
  * A genre with no `uses` fits every ruleset Great (it asks for nothing).
185
+ * A genre that declares `keepsTime` lowers a better-than-Poor rating to Poor when the ruleset's functions count on a time the genre does not keep (`countsTime`), and says so; `timeUnmet` names it.
183
186
  * @experimental
184
187
  */
185
- export declare function rulesetFit(genre: Pick<GenreDecl, 'uses'> | null | undefined, ruleset: RulesetDecl | null | undefined): RulesetFit;
188
+ export declare function rulesetFit(genre: Pick<GenreDecl, 'uses' | 'keepsTime'> | null | undefined, ruleset: RulesetDecl | null | undefined): RulesetFit;
186
189
  /**
187
190
  * ๐Ÿšง What a genre **plays best with** (RF fix 8), as the picker lists it โ€”
188
191
  * each expectation, required first, then optional (each label once): `plays
package/dist/fit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { normaliseConventions, rulesetDecides } from './rulesets.js';
2
2
  import { checkMethodKind } from './checkMethods.js';
3
3
  import { rulesetAttributeKinds, rulesetSections, rulesetZoneTypes } from './rulesetSections.js';
4
- import { functionProvides } from './functions.js';
4
+ import { functionProvides, resolveFunctionRef } from './functions.js';
5
5
  /** The six ratings, worst first. @experimental */
6
6
  export const RULESET_RATINGS = ['incompatible', 'poor', 'ok', 'good', 'great', 'perfect'];
7
7
  /** The picker's groups (ruled 2026-10-19): [Incompatible] ยท [Poor] ยท [Ok, Good] ยท [Great, Perfect]. @experimental */
@@ -158,6 +158,23 @@ export function rulesetProvides(decl) {
158
158
  return { verbs, slots, pieces, conditions, casting, dice, chance, methods: kinds, tags, tagged, scripted, decides: rulesetDecides(decl), attributeTags, zoneTags };
159
159
  }
160
160
  const PROSE_FALLBACK_VERBS = new Set(['modify', 'set', 'adjustDegree', 'harm', 'heal', 'cure', 'consume']);
161
+ /** Which times a ruleset's functions count on: each declaration's `countsTime`, and core's recurring function set to an hour or a day (a clock move). */
162
+ function timeNeedOf(ruleset) {
163
+ const need = { story: false, real: false };
164
+ if (!ruleset)
165
+ return need;
166
+ for (const ref of rulesetSections(ruleset).functions ?? []) {
167
+ const t = resolveFunctionRef(ref).decl?.countsTime;
168
+ if (t === 'story' || t === 'both')
169
+ need.story = true;
170
+ if (t === 'real' || t === 'both')
171
+ need.real = true;
172
+ const every = ref.options?.every;
173
+ if (ref.ref === 'core:function/recurring@1' && (every === 'hour' || every === 'day'))
174
+ need.story = true;
175
+ }
176
+ return need;
177
+ }
161
178
  /**
162
179
  * Cross-examine a genre's uses against a ruleset's provides.
163
180
  *
@@ -169,6 +186,7 @@ const PROSE_FALLBACK_VERBS = new Set(['modify', 'set', 'adjustDegree', 'harm', '
169
186
  * ยท Poor โ€” more than half of the uses by words
170
187
  * ยท Incompatible โ€” any use missing with no words fallback
171
188
  * A genre with no `uses` fits every ruleset Great (it asks for nothing).
189
+ * A genre that declares `keepsTime` lowers a better-than-Poor rating to Poor when the ruleset's functions count on a time the genre does not keep (`countsTime`), and says so; `timeUnmet` names it.
172
190
  * @experimental
173
191
  */
174
192
  export function rulesetFit(genre, ruleset) {
@@ -254,6 +272,30 @@ export function rulesetFit(genre, ruleset) {
254
272
  : rating === 'great'
255
273
  ? `this genre asks for nothing in particular`
256
274
  : `${words.map(name).join(', ')} โ€” told in words`;
275
+ const keeps = genre?.keepsTime;
276
+ if (keeps) {
277
+ const need = timeNeedOf(ruleset);
278
+ const timeUnmet = [];
279
+ if (need.story && keeps !== 'story')
280
+ timeUnmet.push('story');
281
+ if (need.real && keeps !== 'real')
282
+ timeUnmet.push('real');
283
+ if (timeUnmet.length) {
284
+ const lowered = rating === 'incompatible' ? rating : 'poor';
285
+ const timeReason = timeUnmet[0] === 'story'
286
+ ? `its rules count story time, and this genre ${keeps === 'real' ? 'runs on real time' : 'keeps no clock'}: they would never move`
287
+ : `its rules count real time, and this genre ${keeps === 'story' ? 'keeps a story clock' : 'keeps no clock'}: they would move with the hours outside the story`;
288
+ return {
289
+ rating: lowered,
290
+ group: ratingGroupOf(lowered),
291
+ reason: rating === 'incompatible' ? reason : timeReason,
292
+ rows,
293
+ unused,
294
+ inWords,
295
+ timeUnmet,
296
+ };
297
+ }
298
+ }
257
299
  return { rating, group: ratingGroupOf(rating), reason, rows, unused, inWords };
258
300
  }
259
301
  /**
@@ -247,6 +247,12 @@ export interface FunctionProps {
247
247
  rollsDice?: true;
248
248
  /** ๐Ÿšง The function this one was forked from, by id (`forkFunction`). */
249
249
  forkedFrom?: FunctionId;
250
+ /**
251
+ * ๐Ÿšง Which time the function counts on โ€” the story clock (`'story'`), real
252
+ * elapsed time (`'real'`), or both; left out, it counts on neither. Ruleset
253
+ * fit reads it (`rulesetFit`). Content, inside the hash โ€” not display text.
254
+ */
255
+ countsTime?: 'story' | 'real' | 'both';
250
256
  }
251
257
  /** ๐Ÿšง A declared function module: its props and its id. @experimental */
252
258
  export interface FunctionDecl extends FunctionProps {
@@ -370,7 +376,7 @@ export declare const tagListFindings: (tags: unknown, at: string) => string[];
370
376
  * `missing-prose` ยท `bad-function-binding` ยท `bad-phase` ยท `bad-schema` ยท
371
377
  * `bad-form` ยท `bad-body` ยท `body-without-phases` ยท `phases-without-body` ยท
372
378
  * `bad-emits` ยท `bad-invokable` ยท `bad-adds` (with the attribute, outcome
373
- * and zone type reasons inside) ยท `bad-tags` ยท `bad-chance` ยท `bad-fork`.
379
+ * and zone type reasons inside) ยท `bad-tags` ยท `bad-chance` ยท `bad-fork` ยท `bad-counts-time`.
374
380
  * @experimental
375
381
  */
376
382
  export declare function functionFindings(id: string, props: FunctionProps): string[];
package/dist/functions.js CHANGED
@@ -266,7 +266,7 @@ function schemaFindings(schema, at, reason) {
266
266
  * `missing-prose` ยท `bad-function-binding` ยท `bad-phase` ยท `bad-schema` ยท
267
267
  * `bad-form` ยท `bad-body` ยท `body-without-phases` ยท `phases-without-body` ยท
268
268
  * `bad-emits` ยท `bad-invokable` ยท `bad-adds` (with the attribute, outcome
269
- * and zone type reasons inside) ยท `bad-tags` ยท `bad-chance` ยท `bad-fork`.
269
+ * and zone type reasons inside) ยท `bad-tags` ยท `bad-chance` ยท `bad-fork` ยท `bad-counts-time`.
270
270
  * @experimental
271
271
  */
272
272
  export function functionFindings(id, props) {
@@ -380,6 +380,8 @@ export function functionFindings(id, props) {
380
380
  out.push(finding('bad-chance', `${at} rolls dice and does not say chance. Dice are chance โ€” say chance: true too.`));
381
381
  if (props.forkedFrom !== undefined && !isFunctionId(props.forkedFrom))
382
382
  out.push(finding('bad-fork', `${at}.forkedFrom is the id of the function it was forked from โ€” 'core:function/die-target@1'.`));
383
+ if (props.countsTime !== undefined && props.countsTime !== 'story' && props.countsTime !== 'real' && props.countsTime !== 'both')
384
+ out.push(finding('bad-counts-time', `${at}.countsTime is 'story', 'real' or 'both', or left out โ€” not ${JSON.stringify(props.countsTime)}.`));
383
385
  return out;
384
386
  }
385
387
  function addsFindings(adds, at) {
package/dist/genres.d.ts CHANGED
@@ -18,7 +18,7 @@ import type { WidgetDecl } from './layout.js';
18
18
  import { type GenreLayoutDecl } from './widgetDecls.js';
19
19
  import { type I18n, type SessionShape, type SlotDecl } from './descriptors.js';
20
20
  import { type LocaleMap } from './i18n.js';
21
- import type { RegistrationDecl } from './registrations.js';
21
+ import type { RegistrationDecl, RoutineGroupDecl } from './registrations.js';
22
22
  import { type SettingValue } from './exposure.js';
23
23
  import { type GenreUses } from './fit.js';
24
24
  import { type HandbookPage, type Rigour } from './rulesets.js';
@@ -182,6 +182,12 @@ export interface GenreDecl {
182
182
  }[];
183
183
  /** ๐Ÿšง Who may sit here (ruled 2026-10-19): `'solo'` โ€” never a group session: the form hides the group switch and the host refuses `isGroup`, invites, guest claims and lanes (the Guide: one person's questions about the app). `'group'` (default) โ€” as the shape allows. */
184
184
  readonly members?: 'solo' | 'group';
185
+ /** ๐Ÿšง Which time this genre keeps โ€” a story clock (`'story'`: Story, the Lair, the Dungeon Crawler), real time (`'real'`: the Guide, Chat) or neither (`'none'`). `rulesetFit` weighs a ruleset's functions' `countsTime` against it; left out, fit does not weigh time. It no longer picks a new session's notes' timeline (since 2026-11-16 the default is none; see `timeline`). */
186
+ readonly keepsTime?: 'story' | 'real' | 'none';
187
+ /**
188
+ * ๐Ÿšง This genre's **timeline mandate**: it requires its sessions' new lorebooks to start with a timeline, so no preset may declare `defaults.timeline: false`. Only `'required'` exists (the vocabulary `uses.dice` has). Without it a new session's own notes start with no timeline (owner 2026-11-16: "If the genre/preset supports undated, use undated by default", Story included), whatever `keepsTime` says; a preset's `defaults.timeline` boolean may start one. Needs `keepsTime: 'story'`. Not a lock on a session โ€” a session on an undated lorebook still plays ("genres expect, never lock") โ€” and not `keepsTime`. Absent when unstated.
189
+ */
190
+ readonly timeline?: 'required';
185
191
  /**
186
192
  * ๐Ÿšง What this genre **plays best with** (PLAN-genre-restructure ยง11; RF fix 8, owner ruling
187
193
  * 2026-10-23: "genres expect, never lock"): the verbs its scripts emit (or `'any'`), and the
@@ -256,6 +262,16 @@ export interface GenreDecl {
256
262
  };
257
263
  readonly pipeline: string;
258
264
  }[];
265
+ /**
266
+ * ๐Ÿšง The routine groups the genre's routines share โ€” one cadence, one run limit each. Read
267
+ * typed with `genreDefaultsOf`.
268
+ */
269
+ readonly groups?: readonly {
270
+ readonly key: string;
271
+ readonly cadence: {
272
+ readonly id: string;
273
+ };
274
+ }[];
259
275
  readonly settings?: Readonly<Record<string, unknown>>;
260
276
  };
261
277
  /**
@@ -311,6 +327,8 @@ export interface GenreDecl {
311
327
  */
312
328
  readonly history?: {
313
329
  readonly settle: 'on-write' | 'on-commit';
330
+ /** ๐Ÿšง How far one press of Back reaches (owner 2026-11-04): 'turn' (default) = the person's line and every reply that answered it; 'message' = the newest message only, with the routine lines (clock moves, notes) filed on it. */
331
+ readonly back?: 'message' | 'turn';
314
332
  };
315
333
  /**
316
334
  * The genre's **enabled-when defaults** (built
@@ -364,6 +382,8 @@ export interface GenreDecl {
364
382
  * story and which are asides is the SPEC's business (its source step's
365
383
  * params), not the genre's. Absent when unstated, so a genre that says
366
384
  * nothing hashes as it did.
385
+ *
386
+ * โณ Read for one more release (CP6), then retired: register the pipeline on the summarize-scene action instead.
367
387
  */
368
388
  /**
369
389
  * ๐Ÿšง The **rigour** this genre's sessions run rulesets at โ€” the options a
@@ -421,6 +441,10 @@ export interface GenreProps {
421
441
  handbook?: readonly HandbookPage[];
422
442
  /** ๐Ÿšง `'solo'` refuses group sessions โ€” see `GenreDecl.members`. */
423
443
  members?: 'solo' | 'group';
444
+ /** ๐Ÿšง Which time the genre keeps โ€” see `GenreDecl.keepsTime`. */
445
+ keepsTime?: 'story' | 'real' | 'none';
446
+ /** ๐Ÿšง The genre requires new sessions' own notes to start with a timeline (the timeline mandate); without it they start none โ€” see `GenreDecl.timeline`. */
447
+ timeline?: 'required';
424
448
  /** ๐Ÿšง What the genre uses of a ruleset โ€” see `GenreDecl.uses`. */
425
449
  uses?: GenreUses;
426
450
  /** ๐Ÿšง The genre's defaults โ€” its registrations and setting values; see `GenreDecl.defaults`. */
@@ -433,6 +457,7 @@ export interface GenreProps {
433
457
  /** When the genre's history settles โ€” see `GenreDecl.history`. */
434
458
  history?: {
435
459
  readonly settle: HistorySettle;
460
+ readonly back?: 'message' | 'turn';
436
461
  };
437
462
  /** Enabled-when defaults per action identity โ€” see `GenreDecl.enabledWhen`. */
438
463
  enabledWhen?: Readonly<Record<string, EnabledWhenDecl>>;
@@ -445,7 +470,10 @@ export interface GenreProps {
445
470
  omitWidgets?: readonly WidgetDecl[];
446
471
  /** The layouts this genre ships (`layout()`); the first is its default. */
447
472
  layouts?: readonly GenreLayoutDecl[];
448
- /** ๐Ÿšง The summarize pipelines this genre owns, by spec id โ€” see `GenreDecl.summarize`. */
473
+ /**
474
+ * ๐Ÿšง The summarize pipelines this genre owns, by spec id โ€” see `GenreDecl.summarize`.
475
+ * โณ Read for one more release (CP6), then retired: register the pipeline on the summarize-scene action instead.
476
+ */
449
477
  summarize?: {
450
478
  scene?: string;
451
479
  };
@@ -658,6 +686,41 @@ export declare const CONVERSATION_WIDGET_ID = "messages";
658
686
  * @experimental
659
687
  */
660
688
  export declare function genreSummarizeFindings(raw: unknown, at?: string): string[];
689
+ /**
690
+ * A genre's warnings, never refusals: its template exposures, and stated
691
+ * defaults that register no turn order option.
692
+ *
693
+ * Every template exposure in a genre's `shape.fields`. A genre field's reach
694
+ * defaults to `'owner'`, so its `template`, `templates` or `variables` field
695
+ * reaches the session's owner with or without an explicit reach: it warns
696
+ * either way. The field stays in the declaration (hashes do not move) and
697
+ * core shows it to administrators only. A genre whose stated defaults register
698
+ * nothing on `turn-order-asked` is warned, never refused. A shape that still
699
+ * carries `turnSeatChanges` is warned: the key has no effect. A default
700
+ * registration whose `when` reads `session.rounds.<name>` for a name that is
701
+ * not one of the genre's story channels is warned, never refused: it reads as
702
+ * absent, so the condition is false. A field or setting spelled like a rule core
703
+ * enforces that `shape.provisos` does not name is warned, never refused.
704
+ * @experimental
705
+ * @ruling G7, programme 2.3
706
+ */
707
+ export declare function genreWarnings(decl: Pick<GenreDecl, 'id' | 'shape' | 'settings'> & {
708
+ readonly defaults?: GenreDecl['defaults'];
709
+ readonly summarize?: GenreDecl['summarize'];
710
+ }): string[];
711
+ /**
712
+ * What a genre leaves unsaid about Auto-advance. A genre that declares no
713
+ * `autoAdvance` field offers no switch, so nothing starts by itself in its
714
+ * sessions; one that declares it and says nothing of `autoAdvanceRuns` (a field,
715
+ * a pinned setting, or a default setting) never fires. Both are told to the
716
+ * modder here and to the session's owner on the Turn line. A warning, never a
717
+ * refusal: a genre expects, it never locks.
718
+ * @experimental
719
+ * @ruling TA1 (owner 2026-11-19)
720
+ */
721
+ export declare function autoAdvanceWarnings(decl: Pick<GenreDecl, 'id' | 'shape' | 'settings'> & {
722
+ readonly defaults?: GenreDecl['defaults'];
723
+ }): string[];
661
724
  /**
662
725
  * Declare a genre. The id is stated in full, under your plugin's slug
663
726
  * (`acme.dice:genre/table`), and the genre value is what everything else
@@ -693,6 +756,8 @@ export declare function genre<const P extends GenreProps>(id: string, props: P):
693
756
  */
694
757
  export interface GenreDefaults {
695
758
  readonly registrations: readonly RegistrationDecl[];
759
+ /** ๐Ÿšง The genre's routine groups; its default preset presents them unchanged (RG1). */
760
+ readonly groups?: readonly RoutineGroupDecl[];
696
761
  readonly settings?: Readonly<Record<string, SettingValue>>;
697
762
  }
698
763
  /** The genre's defaults, typed โ€” `GenreDecl.defaults` read back as what was declared. @experimental */