Documentation
Foundation changelog
Every notable change to Foundation, version by version, including API changes.
From the documentation of dev.
All notable changes to Foundation are documented here. The format follows Keep a Changelog and versions follow Semantic Versioning. API changes are listed under their own heading inside each release.
[Unreleased]
Added
- Installable
foundationscript package. - English and French documentation: introduction, requirements, installation, compatibility, configuration, administration commands, package integration, lifecycle, package settings, localization, keys and validation, timers and futures, events, commands, services and capabilities, permissions, storage, persistent data, logging, API reference.
- Structured console logging with masked secret fields and suppression of repeated warnings and errors.
foundation/config.toml, created with commented defaults on first start: server language (language, English and French messages), log level and debug categories. Invalid files are ignored with every problem logged, and the defaults are used.- Per-package settings files in
foundation/config/<package>.toml. - Commands
foundation version,foundation help,foundation packages,foundation services(providers, consumers, missing services, capabilities),foundation reload-config(reloads every configuration file without restarting; audited),foundation op add|remove|listandfoundation permissions check|list. Each is behind afoundation.command.*permission; the console can use all of them. - Operators kept in
foundation/operators.json; a damaged file gives no operator and is never overwritten. - Commands typed in the server console and in the chat (
/prefix) run package commands;commands.unknown_in_chatchooses whether unknown/messages are answered or left to other packages. - Storage in
foundation/data/foundation.db(SQLite), created on first start. Package data is never deleted when a package stops or is removed, and pending writes are written before the server stops. Quotas per store infoundation/config.toml([storage]max_bytes_per_package,max_keys_per_package), applied afterfoundation reload-config. - Release archives
foundation-<version>.zipon GitHub Releases, withSHA256SUMSand build provenance, in four channels: stable, release candidate, beta and nightly (built every day frommainwhen it changed), also listed on foundationnw.dev.foundation versionshows the full version.
API
Foundationglobal (read-only) withVERSION,API_VERSION(0.1) andRegister(package, manifest).- Package contexts:
GetId,GetName,GetVersion,GetState,IsActive,OnReady,OnDisable,Track. - Package states
initializing,ready,failed,disabled; dependents are disabled before their dependencies; all packages are disabled when Foundation stops. - Errors raised as
[foundation:<code>] ...with the codesinvalid_argument,invalid_value,invalid_state,incompatible_api. - Error values returned for expected failures (
code,category,message,params,details,cause) with the codesinvalid_key,validation_failed,async_failed,timeout. Foundation.Keys:Parse,Split,IsReserved.Foundation.Schema:String,Number,Integer,Boolean,Any,Enum,Optional,Record,List,Map,Custom,Validate,IsSchema.- Localization:
context:RegisterCatalog,context:Translate, with plural forms (English and French rules) and language fallback. - Package settings:
context:Configand the settings object (Get,Values,GetPath,OnChange), with versioned layouts and migrations. - Timers owned by the package:
context:NextTick,Delay,Repeat,Debounce,Throttle. - Futures:
context:Future,context:All, andThen,Catch,Finally,Timeout,Cancel. - Events:
context:DefineEvent,context:Emit,context:Listen, with priorities (lowesttomonitor), cancellation and fields listeners may change. - Foundation events:
foundation:package_ready,package_failed,package_disabled,config_reloaded,command(cancellable),command_completed. - Commands:
context:RegisterCommand(aliases, subcommands, typed arguments, sender kinds, cooldowns, audit) andcontext:RegisterArgumentType; senders withReply,GetKind,GetId,GetName,GetPlayer; error codecommand_usage. - Services:
context:ProvideService(contract versions, priorities, explicit replacement),GetService,GetServices,OnService; returned services stop working when their provider stops. Manifest fieldservices(required services block the ready state and fail the package when lost; optional ones are declarative). - Capabilities: manifest field
capabilities,Foundation.Capabilities.HasandProviders. - Foundation events:
foundation:service_available,service_unavailable,capability_available,capability_unavailable. - Permissions:
context:DeclarePermission(defaultseveryone,nobody,operators,non_operators, deprecation),context:AttachPermission(temporary allow/deny, deny wins),Foundation.Permissions.Has,Explain,Get,List; command fieldpermission. - Permission provider contract
foundation:permission_provider1.x (Check(account, node)). Foundation.Operators.IsOperatorandList; eventsfoundation:operator_addedandoperator_removed.- Stores:
context:Store(name, { version, migrations })withGet,Set,Delete,Keys,Batch(all or nothing),Usage,GetName; JSON values; versioned data with migrations applied in one transaction, which fail the package without changing the data. - Persistent data:
context:DefineData(name, schema, { default })withGet,Set,Deleteper subject (account id or player sender), validated against the schema;context:ReadData("<package>:<name>")for read-only access from any package. - Error codes
storage_unavailable,storage_failed,storage_corrupt,storage_quota.