Skip to content

Rules systems ​

A generic table does not require D&D fields. A system extension registers a SystemContribution, and the host resolves it through host.system(id).

The headless contract ​

MemberMeaning
id, titleNamespaced identity and display title
schemaVersionSource schema version understood by this system
validate(source)Return { ok: true, value } or { ok: false, errors }
derive(source)Reproducible JSON derived from valid source
resolveCheck(input, dice)Validate and resolve a check using supplied dice

The arguments and successful values are JsonValue. Dice are a readonly array of numbers. Keep source durable and derived values reproducible. Validate source before deriving; a typed interface alone does not validate JSON.

Rules must not sample random values, consult the wall clock or invoke storage or network drivers. Inject supplied dice values from the authoritative outcome path. Presentation consumes the result instead of rolling again.

First-party 2024 workflow ​

@talerook/rules-2024 provides the initial 5.5e (2024) system extension. Its foundation workflow validates an ability-score schema, derives ability modifiers and resolves a check from a supplied d20. The package README records the mathematical reference and check date against the official SRD 5.2 and the official SRD entry. It is deliberately bounded and does not establish full 2024 rules or content conformance.

ts
import { createExtensionHost } from '@talerook/engine';
import { rules2024Extension, rules2024System } from '@talerook/rules-2024';

const host = createExtensionHost();
await host.load(rules2024Extension);
const system = host.system(rules2024System.id);
if (!system) throw new Error('2024 system is not active');

const result = system.resolveCheck(
  { abilityScore: 16, proficient: true, proficiencyBonus: 2 },
  [12],
);
// { ok: true, value: { die: 12, modifier: 3, proficiency: 2, total: 17 } }
await host.dispose();

The source schema requires all six ability scores as integers from 1 to 30. Check input requires an ability score, a proficient boolean and an integer proficiencyBonus from 2 to 9. Exactly one supplied integer d20 result from 1 to 20 is accepted. This computes a total; it does not determine difficulty, success, advantage or critical outcomes.

Spellcasting, conditions, character creation, equipment, complete combat, content licensing and broader automation need their own implementation and acceptance evidence. First support is 5.5e; 5e support is a possible later addition. Do not treat a generic system interface as evidence of support for other games.

UI is a separate contribution ​

Headless rules belong in the system package. Panels and presentation can register through the same extension manifest or a separately scoped UI extension. Keep sheet layout and renderer dependencies outside pure system validation and resolution.

Persisted extension state and source upgrade workflows are future work. A schemaVersion number identifies the contract; it does not implement migration or backup by itself.

SDK 0.1 private preview. Hosting at docs.talerook.com is planned.