Equipments
Equipments are the context passed by the Core to a pack's defineLayer builder. A pack selects the entries it needs through destructuring. The same context is available to library packs and runtime layers.
import { defineLayer } from '#core:layers'
export default defineLayer(({ engine, config, logs, libraries, layers }) => {
// Return your library API or your attach/detach implementation.
})
The outer equipment object is frozen. Its properties contain objects and functions with their own behaviour, so this does not make the whole object graph immutable.
-
engine
Exposes runtime information and Core operations. Read nodejsv, runtype, baseroot, platform, hostname, machine, and system for environment information. Await vcore for the Core version. Call memram(), uptime(), cpus(), and network() for the information supplied by those helpers. uptime() reports host uptime through Node.js's OS API.
const version = await engine.vcore const memory = engine.memram() const hostUptime = engine.uptime()bundleAssign(bundle, reference, assets) populates the supplied layer bundle. vault.requireAccess(callerLabel, providerLabel) requests an access token, and vault.requireKey(token, keyName, child) requests a key within the token's permissions. Both Vault methods can return an error string. Check the result before using it.
importing(requestedPath), requiring(requestedPath), and fileaccess(requestedPath) are dedicated runtime gates for the supported import and file-access paths. Their availability and permitted targets depend on Guardian configuration. These entry points complement the import checks performed during startup.
-
config
Contains the project's configuration with the top-level stack property removed. It includes engineopt and any application options placed in the project configuration. A separate configuration file inside a pack is loaded by that pack's own code.
-
logs
Calls the Core's audit helper. Use it to keep pack messages consistent with the project's logging settings. Depending on the call and configuration, messages can also be written to the configured log directory.
logs('message', 'The pack is ready') logs('warn', 'A required resource is unavailable') -
libraries
current is the pack's typology, so it is library for a library pack. list() returns library metadata. match(label, onlyprocessed) looks for a library in the registry, with false selecting entries marked unprocessed and true selecting processed entries. require(label) returns the library API by pack label.
Current library entries are left unprocessed by the runtime handler. For a usable API, request it with require and check the methods you need. The lookup can return an error string when the library is absent.
-
layers
current is the pack's typology. list() returns runtime-layer metadata. match(name, onlyprocessed) checks labels or typologies in the selected processing state. require(typology, token, requestApis) requests the published instance when requestApis is false, or the lifecycle API when it is true.
layers.status.setOK(), setKO(), and now() write or read the status associated with the current typology. The Core updates lifecycle status itself during attach and detach. Use manual status updates only when your implementation has a specific need for them.
The token comes from engine.vault.requireAccess using pack labels. See the runtime-layer access example for the complete sequence.