/** * Boot preamble: cooperative lock FSM constants + `invokeCtxBootHooks`. * This file is the **only** source for these symbols; `kernel/init.js` is generated by * `node scripts/bundle-kernel-init.mjs` (concat `lib/boot/*.js`, `lib/init/fragments/*.js`, then `lib/init/init-main.js`). * CI: `scripts/verify-init-bundle-recipe.mjs` / `verify-kernel-seeder-parity.mjs`. */ /** Boot transaction journal row state (resume / audit / rollback FSM). */ const BARE_OS_BOOT_TXN_STATE = Object.freeze({ STAGE_STARTED: 'stage_started', STAGE_COMMITTED: 'stage_committed', STAGE_ROLLBACK: 'stage_rollback', STAGE_SKIPPED: 'stage_skipped' }) /** * @param {Record} ctx * @param {Record} ev */ async function invokeCtxBootHooks(ctx, ev) { const label = String( ev.phase !== undefined && ev.phase !== null ? ev.phase : ev.step !== undefined && ev.step !== null ? ev.step : '' ) const merged = { ...ev, phase: label, step: label } if (typeof ctx.bareOsInvokeBootStepHooks === 'function') { await ctx.bareOsInvokeBootStepHooks(merged) return } if (typeof ctx.bareOsInvokeBootPhaseHooks === 'function') { await ctx.bareOsInvokeBootPhaseHooks(merged) } }