@jsprismarine/kernel 0.23.0-unstable-20261121073620 → 0.23.0
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.
- package/CHANGELOG.md +3 -3
- package/dist/kernel.d.ts +1 -1
- package/dist/kernel.js +1 -1
- package/dist/kernel.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @jsprismarine/kernel
|
|
2
2
|
|
|
3
|
-
## 0.23.0
|
|
3
|
+
## 0.23.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
### Patch Changes
|
|
14
14
|
|
|
15
15
|
- [#3273](https://github.com/JSPrismarine/JSPrismarine/pull/3273) [`e9c34cb`](https://github.com/JSPrismarine/JSPrismarine/commit/e9c34cb7afbfe8232eab6c8b3dd506f8e2d135e8) Thanks [@filiphsps](https://github.com/filiphsps)! - The server reports how far its start has got. `Kernel` takes an `onStart` option that hears each module begin and finish starting; a callback that throws is logged and the start goes on, the console protocol gains a `boot` message carrying each step, and a server with a remote console attached sends one for every step before it reports `running`.
|
|
16
|
-
- Updated dependencies [[`60edd7a`](https://github.com/JSPrismarine/JSPrismarine/commit/60edd7a1234650367fe5c2406ee402641be33ed9), [`bf419b8`](https://github.com/JSPrismarine/JSPrismarine/commit/bf419b82bfea52c095ca09b02c1c4ac955ac1d0a), [`c8e1685`](https://github.com/JSPrismarine/JSPrismarine/commit/c8e1685ae8316255d39674af9d00ac8d778f674d), [`b41035b`](https://github.com/JSPrismarine/JSPrismarine/commit/b41035be9b61570008b3405aa169418b19081915), [`4bda824`](https://github.com/JSPrismarine/JSPrismarine/commit/4bda8241a8631da2d205133c85fd361871d6cf61), [`7e2e6f3`](https://github.com/JSPrismarine/JSPrismarine/commit/7e2e6f3cff1f20a11a3f59aac94c68a33fa71a35), [`3e71a8d`](https://github.com/JSPrismarine/JSPrismarine/commit/3e71a8dd75bd0a97e0f8587666f60f160844ff0b), [`586269e`](https://github.com/JSPrismarine/JSPrismarine/commit/586269e324cddfe57caf4206f387895cda6d479f), [`5d2fb0e`](https://github.com/JSPrismarine/JSPrismarine/commit/5d2fb0eb3730e59260a09e60c130e57e5fdb099c), [`936970c`](https://github.com/JSPrismarine/JSPrismarine/commit/936970c04f98b392e4b753f3c89224da3d03cb49), [`57caf26`](https://github.com/JSPrismarine/JSPrismarine/commit/57caf2632f92e5da55ce6eedc4eb0be3d66190d4), [`4b590cf`](https://github.com/JSPrismarine/JSPrismarine/commit/4b590cf6c529d17d8df20d8eab9b2157dc213a19), [`349a814`](https://github.com/JSPrismarine/JSPrismarine/commit/349a81448bfc8be2f901efe14527b8c9334f11eb), [`
|
|
17
|
-
- @jsprismarine/errors@0.23.0
|
|
16
|
+
- Updated dependencies [[`60edd7a`](https://github.com/JSPrismarine/JSPrismarine/commit/60edd7a1234650367fe5c2406ee402641be33ed9), [`bf419b8`](https://github.com/JSPrismarine/JSPrismarine/commit/bf419b82bfea52c095ca09b02c1c4ac955ac1d0a), [`c8e1685`](https://github.com/JSPrismarine/JSPrismarine/commit/c8e1685ae8316255d39674af9d00ac8d778f674d), [`b41035b`](https://github.com/JSPrismarine/JSPrismarine/commit/b41035be9b61570008b3405aa169418b19081915), [`4bda824`](https://github.com/JSPrismarine/JSPrismarine/commit/4bda8241a8631da2d205133c85fd361871d6cf61), [`7e2e6f3`](https://github.com/JSPrismarine/JSPrismarine/commit/7e2e6f3cff1f20a11a3f59aac94c68a33fa71a35), [`3e71a8d`](https://github.com/JSPrismarine/JSPrismarine/commit/3e71a8dd75bd0a97e0f8587666f60f160844ff0b), [`586269e`](https://github.com/JSPrismarine/JSPrismarine/commit/586269e324cddfe57caf4206f387895cda6d479f), [`5d2fb0e`](https://github.com/JSPrismarine/JSPrismarine/commit/5d2fb0eb3730e59260a09e60c130e57e5fdb099c), [`936970c`](https://github.com/JSPrismarine/JSPrismarine/commit/936970c04f98b392e4b753f3c89224da3d03cb49), [`57caf26`](https://github.com/JSPrismarine/JSPrismarine/commit/57caf2632f92e5da55ce6eedc4eb0be3d66190d4), [`4b590cf`](https://github.com/JSPrismarine/JSPrismarine/commit/4b590cf6c529d17d8df20d8eab9b2157dc213a19), [`349a814`](https://github.com/JSPrismarine/JSPrismarine/commit/349a81448bfc8be2f901efe14527b8c9334f11eb), [`56200a6`](https://github.com/JSPrismarine/JSPrismarine/commit/56200a61535d916f0c41a11d077752b194e4c08b), [`c500335`](https://github.com/JSPrismarine/JSPrismarine/commit/c5003358e3a7199593c6ddcdbe4bdf63f8c29fac), [`e090dd7`](https://github.com/JSPrismarine/JSPrismarine/commit/e090dd75379edbfc415d84925e48af29aaa4864e), [`6e758f9`](https://github.com/JSPrismarine/JSPrismarine/commit/6e758f9de80c357c12d992bf473f1bdac86fb274), [`93a1b61`](https://github.com/JSPrismarine/JSPrismarine/commit/93a1b610493f401c4ac62881f70b3dee8c882f33), [`e1c982e`](https://github.com/JSPrismarine/JSPrismarine/commit/e1c982eeed0dfd682b5680c45c69159e21fd9ec0), [`9579362`](https://github.com/JSPrismarine/JSPrismarine/commit/9579362b4070e246d6300d2f4e2dca2ab4715124), [`f18ef7c`](https://github.com/JSPrismarine/JSPrismarine/commit/f18ef7c595f58a267b5371baab96390d0282616d), [`cf88d2f`](https://github.com/JSPrismarine/JSPrismarine/commit/cf88d2f8c2184bd4e116db888d4528fa27f5338d), [`d6c69e4`](https://github.com/JSPrismarine/JSPrismarine/commit/d6c69e43051eb091f0b4a17c0f33799f5944caf3), [`0792e2a`](https://github.com/JSPrismarine/JSPrismarine/commit/0792e2a7e6e5e98729b80df412262fd549ea3cb9), [`1c3be54`](https://github.com/JSPrismarine/JSPrismarine/commit/1c3be5465a2865072ac0f16b4848ee0cd9b6b13a), [`db04d85`](https://github.com/JSPrismarine/JSPrismarine/commit/db04d8520c1d43b88196c14229f36f5c8e71f3c1)]:
|
|
17
|
+
- @jsprismarine/errors@0.23.0
|
|
18
18
|
|
|
19
19
|
## 0.22.0
|
|
20
20
|
|
package/dist/kernel.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ export declare class Kernel<Events extends EventMap = EventMap> {
|
|
|
84
84
|
* not stopped, because its start never finished.
|
|
85
85
|
*
|
|
86
86
|
* A `stop()` while this is still running wins: no further module starts,
|
|
87
|
-
* and this rejects with a
|
|
87
|
+
* and this rejects with a `KernelError` once the module it was
|
|
88
88
|
* waiting on returns.
|
|
89
89
|
*
|
|
90
90
|
* @throws KernelError when the kernel is already starting or started, when
|
package/dist/kernel.js
CHANGED
|
@@ -106,7 +106,7 @@ var Kernel = class {
|
|
|
106
106
|
* not stopped, because its start never finished.
|
|
107
107
|
*
|
|
108
108
|
* A `stop()` while this is still running wins: no further module starts,
|
|
109
|
-
* and this rejects with a
|
|
109
|
+
* and this rejects with a `KernelError` once the module it was
|
|
110
110
|
* waiting on returns.
|
|
111
111
|
*
|
|
112
112
|
* @throws KernelError when the kernel is already starting or started, when
|
package/dist/kernel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.js","names":[],"sources":["../src/kernel.ts"],"sourcesContent":["import type { EventBus, EventMap } from './events';\nimport { KernelEventBus } from './events';\nimport type { KernelLogger } from './logger';\nimport { consoleLogger, scopedLogger } from './logger';\nimport type { Module, ModuleContext } from './module';\nimport type { ServiceToken } from './token';\nimport { KernelErrors } from '@jsprismarine/errors/kernel';\n\n/**\n * A thrown value as a log line can carry it. A value whose `toString` or `stack` throws is named\n * by its tag, so formatting the failure cannot fail too.\n */\nconst describeFailure = (error: unknown): string => {\n try {\n return error instanceof Error ? (error.stack ?? error.message) : String(error);\n } catch {\n return Object.prototype.toString.call(error);\n }\n};\n\n/**\n * Options for constructing a kernel.\n */\nexport interface KernelOptions {\n /** Per-module configuration, keyed by module id. */\n readonly config?: Readonly<Record<string, unknown>>;\n /** Base logger; module loggers are scoped from it. Defaults to the console. */\n readonly logger?: KernelLogger;\n /**\n * Called as each module's `start()` begins and once it has finished, in start order, so a\n * host can show how far a start has got. A module whose start throws reports no `started`.\n */\n readonly onStart?: (progress: KernelStartProgress) => void;\n}\n\n/** One step of {@link Kernel.start}, as {@link KernelOptions.onStart} receives it. */\nexport interface KernelStartProgress {\n /** The module's id. */\n readonly id: string;\n readonly state: 'starting' | 'started';\n}\n\ntype KernelPhase = 'created' | 'registered' | 'starting' | 'started';\n\ninterface ModuleEntry<Events extends EventMap> {\n readonly module: Module<unknown, Events>;\n readonly context: ModuleContext<unknown, Events>;\n readonly dependencyIds: ReadonlySet<string>;\n}\n\n/**\n * The module kernel. It owns lifecycle, a token-keyed service registry, and the\n * event bus; everything else — worlds, sessions, commands, networking, the tick\n * loop — is a module.\n *\n * Lifecycle: construct the kernel once, `register()` modules, then drive it\n * through `registerAll()`, `start()`, and `stop()`. `registerAll()` runs every\n * module's `register()` phase exactly once and validates providers and the\n * dependency graph; after it, `get()` resolves provided services. `start()`\n * runs `registerAll()` first when it has not run, then runs the `start()`\n * phases in dependency order. `stop()` runs `stop()` phases in reverse order,\n * logging failures instead of throwing, and returns the kernel to the\n * registered state, so the same kernel — and the services its modules\n * constructed — can be started again. Event listeners a module attaches are\n * detached when it stops; a module that must survive a restart attaches its\n * listeners in `start()`, not `register()`.\n */\nexport class Kernel<Events extends EventMap = EventMap> {\n private readonly entries: ModuleEntry<Events>[] = [];\n private readonly services = new Map<string, unknown>();\n private readonly providerOf = new Map<string, string>();\n private readonly bus: KernelEventBus<Events>;\n private readonly config: Readonly<Record<string, unknown>>;\n private readonly logger: KernelLogger;\n private readonly onStart: ((progress: KernelStartProgress) => void) | undefined;\n private phase: KernelPhase = 'created';\n private registering: string | undefined;\n private startOrder: ModuleEntry<Events>[] = [];\n /** The modules the current run has called `start()` on, including one still starting. */\n private launched: ModuleEntry<Events>[] = [];\n /** Bumped by every `start()` and `stop()`, so a start loop can tell it was stopped under it. */\n private run = 0;\n\n public constructor(options: KernelOptions = {}) {\n this.config = options.config ?? {};\n this.logger = options.logger ?? consoleLogger;\n this.onStart = options.onStart;\n const logger = this.logger;\n this.bus = new KernelEventBus<Events>({\n onListenerError: (error, event) => logger.error(`A \"${event}\" listener failed: ${describeFailure(error)}`)\n });\n }\n\n /** The kernel-owned event bus, unscoped. Module code should use its context's scoped handle. */\n public get events(): EventBus<Events> {\n return this.bus;\n }\n\n /**\n * Adds a module. Legal only before `registerAll()` (or the first `start()`,\n * which runs it).\n *\n * @throws KernelError after `registerAll()` or when a module with the same id is already registered.\n */\n public register<Config>(module: Module<Config, Events>): void {\n if (this.phase !== 'created') {\n throw new KernelErrors.LateModuleRegistration({ id: module.id });\n }\n if (this.entries.some((entry) => entry.module.id === module.id)) {\n throw new KernelErrors.DuplicateModule({ id: module.id });\n }\n const dependencyIds = new Set((module.dependencies ?? []).map((token) => token.id));\n const entry: ModuleEntry<Events> = {\n module,\n dependencyIds,\n context: this.createContext(module.id, dependencyIds)\n };\n this.entries.push(entry);\n }\n\n /**\n * Runs all `register()` phases, validates providers and the dependency\n * graph, and computes the start order. After it resolves, `get()` resolves\n * every provided service even though `start()` has not run. Runs at most\n * once per kernel; later calls are no-ops.\n *\n * @throws KernelError when a declared dependency has no provider or the dependency graph has a cycle.\n */\n public async registerAll(): Promise<void> {\n if (this.phase !== 'created') return;\n for (const entry of this.entries) {\n this.registering = entry.module.id;\n try {\n await entry.module.register(entry.context);\n } finally {\n this.registering = undefined;\n }\n }\n this.assertProvidersExist();\n this.startOrder = this.sortByDependencies();\n this.phase = 'registered';\n }\n\n /**\n * Runs `registerAll()` when it has not run, then runs `start()` phases in\n * dependency order. Legal again after `stop()`: the `register()` phases do\n * not rerun, so the modules' services carry over into the next start.\n *\n * A module whose `start()` throws leaves nothing running: the modules that\n * had already started are stopped in reverse order, the kernel goes back\n * to registered, and the error is rethrown. The failing module itself is\n * not stopped, because its start never finished.\n *\n * A `stop()` while this is still running wins: no further module starts,\n * and this rejects with a {@link KernelError} once the module it was\n * waiting on returns.\n *\n * @throws KernelError when the kernel is already starting or started, when\n * a declared dependency has no provider, or when the dependency graph has a\n * cycle.\n * @throws Whatever a module's `start()` throws, after the rollback.\n */\n public async start(): Promise<void> {\n if (this.phase === 'starting' || this.phase === 'started') {\n throw new KernelErrors.AlreadyStarted({ phase: this.phase });\n }\n await this.registerAll();\n this.phase = 'starting';\n const run = ++this.run;\n this.launched = [];\n for (const entry of this.startOrder) {\n // The report comes first, so a stop() from inside it does not stop a module whose\n // start never ran.\n this.report({ id: entry.module.id, state: 'starting' });\n if (this.run !== run) throw new KernelErrors.StoppedDuringStart();\n this.launched.push(entry);\n try {\n await entry.module.start?.(entry.context);\n } catch (error) {\n // A stop() during this start has already torn everything down.\n if (this.run !== run) throw error;\n this.launched.pop();\n this.bus.removeScope(entry.module.id);\n await this.stopLaunched();\n throw error;\n }\n if (this.run !== run) throw new KernelErrors.StoppedDuringStart();\n this.report({ id: entry.module.id, state: 'started' });\n if (this.run !== run) throw new KernelErrors.StoppedDuringStart();\n }\n this.phase = 'started';\n }\n\n /**\n * Hands one step of the start to {@link KernelOptions.onStart}. The callback only watches the\n * start, so its failure is logged and the start goes on rather than leaving modules running\n * with the kernel stuck in `starting`.\n */\n private report(progress: KernelStartProgress): void {\n try {\n this.onStart?.(progress);\n } catch (error) {\n this.logger.error(`The start progress callback failed: ${describeFailure(error)}`);\n }\n }\n\n /**\n * Runs `stop()` phases in reverse start order and detaches each module's\n * event listeners. Failures are logged, not thrown, so one module cannot\n * block the others' teardown. Leaves the kernel registered, so `start()`\n * may run it again.\n *\n * Called while `start()` is still running, it stops the modules started so\n * far and the one still starting, which is how a long start such as a\n * world preload is cancelled. A no-op when nothing has started.\n */\n public async stop(): Promise<void> {\n if (this.phase !== 'started' && this.phase !== 'starting') return;\n this.run++;\n await this.stopLaunched();\n }\n\n /** Stops the launched modules in reverse order, logging rather than throwing each failure. */\n private async stopLaunched(): Promise<void> {\n const entries = this.launched;\n this.launched = [];\n this.phase = 'registered';\n for (const entry of [...entries].reverse()) {\n try {\n await entry.module.stop?.(entry.context);\n } catch (error) {\n this.logger.error(`Module \"${entry.module.id}\" failed to stop: ${error}`);\n } finally {\n this.bus.removeScope(entry.module.id);\n }\n }\n }\n\n /**\n * Resolves a service for the host or for tests. Module code should resolve\n * through its context instead.\n *\n * @throws KernelError when no module has provided the token.\n */\n public get<T>(token: ServiceToken<T>): T {\n if (!this.services.has(token.id)) {\n throw new KernelErrors.NoProviderForService({ id: token.id });\n }\n // The registry stores services untyped; the token's phantom type is the\n // contract that the provider stored a matching value.\n return this.services.get(token.id) as T;\n }\n\n private createContext(moduleId: string, dependencyIds: ReadonlySet<string>): ModuleContext<unknown, Events> {\n return {\n use: <T>(token: ServiceToken<T>): T => {\n if (!dependencyIds.has(token.id)) {\n throw new KernelErrors.UndeclaredServiceUse({ moduleId, id: token.id });\n }\n if (!this.services.has(token.id)) {\n throw new KernelErrors.ServiceNotProvidedYet({ id: token.id });\n }\n return this.get(token);\n },\n provide: <T>(token: ServiceToken<T>, service: T, options?: { override?: boolean }): void => {\n if (this.registering !== moduleId) {\n throw new KernelErrors.ProvideOutsideRegister({ moduleId, id: token.id });\n }\n const existing = this.providerOf.get(token.id);\n if (existing !== undefined && !options?.override) {\n throw new KernelErrors.DuplicateServiceProvider({ id: token.id, existing });\n }\n this.services.set(token.id, service);\n this.providerOf.set(token.id, moduleId);\n },\n events: this.bus.scoped(moduleId),\n logger: scopedLogger(this.logger, moduleId),\n config: this.config[moduleId]\n };\n }\n\n private assertProvidersExist(): void {\n for (const entry of this.entries) {\n for (const tokenId of entry.dependencyIds) {\n if (!this.providerOf.has(tokenId)) {\n throw new KernelErrors.MissingServiceProvider({ id: entry.module.id, tokenId });\n }\n }\n }\n }\n\n /**\n * Topologically sorts modules so providers start before their dependents,\n * preserving registration order among independent modules.\n */\n private sortByDependencies(): ModuleEntry<Events>[] {\n const byId = new Map(this.entries.map((entry) => [entry.module.id, entry]));\n const order: ModuleEntry<Events>[] = [];\n const state = new Map<string, 'visiting' | 'done'>();\n const visit = (entry: ModuleEntry<Events>, path: string[]): void => {\n const status = state.get(entry.module.id);\n if (status === 'done') return;\n if (status === 'visiting') {\n const cycle = [...path.slice(path.indexOf(entry.module.id)), entry.module.id];\n throw new KernelErrors.DependencyCycle({ cycle: cycle.join(' -> ') });\n }\n state.set(entry.module.id, 'visiting');\n path.push(entry.module.id);\n for (const tokenId of entry.dependencyIds) {\n const providerId = this.providerOf.get(tokenId);\n if (providerId === undefined || providerId === entry.module.id) continue;\n const provider = byId.get(providerId);\n if (provider) visit(provider, path);\n }\n path.pop();\n state.set(entry.module.id, 'done');\n order.push(entry);\n };\n for (const entry of this.entries) {\n visit(entry, []);\n }\n return order;\n }\n}\n"],"mappings":";;;;;;;;AAYA,IAAM,mBAAmB,UAA2B;CAChD,IAAI;EACA,OAAO,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK;CACjF,QAAQ;EACJ,OAAO,OAAO,UAAU,SAAS,KAAK,KAAK;CAC/C;AACJ;;;;;;;;;;;;;;;;;;AAiDA,IAAa,SAAb,MAAwD;CACpD,UAAkD,CAAC;CACnD,2BAA4B,IAAI,IAAqB;CACrD,6BAA8B,IAAI,IAAoB;CACtD;CACA;CACA;CACA;CACA,QAA6B;CAC7B;CACA,aAA4C,CAAC;;CAE7C,WAA0C,CAAC;;CAE3C,MAAc;CAEd,YAAmB,UAAyB,CAAC,GAAG;EAC5C,KAAK,SAAS,QAAQ,UAAU,CAAC;EACjC,KAAK,SAAS,QAAQ,UAAU;EAChC,KAAK,UAAU,QAAQ;EACvB,MAAM,SAAS,KAAK;EACpB,KAAK,MAAM,IAAI,eAAuB,EAClC,kBAAkB,OAAO,UAAU,OAAO,MAAM,MAAM,MAAM,qBAAqB,gBAAgB,KAAK,GAAG,EAC7G,CAAC;CACL;;CAGA,IAAW,SAA2B;EAClC,OAAO,KAAK;CAChB;;;;;;;CAQA,SAAwB,QAAsC;EAC1D,IAAI,KAAK,UAAU,WAC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AAW,YAAY;IACvB,MAAM,QAAQ,CAAC,GAAG,KAAK,MAAM,KAAK,QAAQ,MAAM,OAAO,EAAE,CAAC,GAAG,MAAM,OAAO,EAAE;IAC5E,MAAM,IAAI,aAAa,gBAAgB,EAAE,OAAO,MAAM,KAAK,MAAM,EAAE,CAAC;GACxE;GACA,MAAM,IAAI,MAAM,OAAO,IAAI,UAAU;GACrC,KAAK,KAAK,MAAM,OAAO,EAAE;GACzB,KAAK,MAAM,WAAW,MAAM,eAAe;IACvC,MAAM,aAAa,KAAK,WAAW,IAAI,OAAO;IAC9C,IAAI,eAAe,KAAA,KAAa,eAAe,MAAM,OAAO,IAAI;IAChE,MAAM,WAAW,KAAK,IAAI,UAAU;IACpC,IAAI,UAAU,MAAM,UAAU,IAAI;GACtC;GACA,KAAK,IAAI;GACT,MAAM,IAAI,MAAM,OAAO,IAAI,MAAM;GACjC,MAAM,KAAK,KAAK;EACpB;EACA,KAAK,MAAM,SAAS,KAAK,SACrB,MAAM,OAAO,CAAC,CAAC;EAEnB,OAAO;CACX;AACJ"}
|
|
1
|
+
{"version":3,"file":"kernel.js","names":[],"sources":["../src/kernel.ts"],"sourcesContent":["import type { EventBus, EventMap } from './events';\nimport { KernelEventBus } from './events';\nimport type { KernelLogger } from './logger';\nimport { consoleLogger, scopedLogger } from './logger';\nimport type { Module, ModuleContext } from './module';\nimport type { ServiceToken } from './token';\nimport { KernelErrors } from '@jsprismarine/errors/kernel';\n\n/**\n * A thrown value as a log line can carry it. A value whose `toString` or `stack` throws is named\n * by its tag, so formatting the failure cannot fail too.\n */\nconst describeFailure = (error: unknown): string => {\n try {\n return error instanceof Error ? (error.stack ?? error.message) : String(error);\n } catch {\n return Object.prototype.toString.call(error);\n }\n};\n\n/**\n * Options for constructing a kernel.\n */\nexport interface KernelOptions {\n /** Per-module configuration, keyed by module id. */\n readonly config?: Readonly<Record<string, unknown>>;\n /** Base logger; module loggers are scoped from it. Defaults to the console. */\n readonly logger?: KernelLogger;\n /**\n * Called as each module's `start()` begins and once it has finished, in start order, so a\n * host can show how far a start has got. A module whose start throws reports no `started`.\n */\n readonly onStart?: (progress: KernelStartProgress) => void;\n}\n\n/** One step of {@link Kernel.start}, as {@link KernelOptions.onStart} receives it. */\nexport interface KernelStartProgress {\n /** The module's id. */\n readonly id: string;\n readonly state: 'starting' | 'started';\n}\n\ntype KernelPhase = 'created' | 'registered' | 'starting' | 'started';\n\ninterface ModuleEntry<Events extends EventMap> {\n readonly module: Module<unknown, Events>;\n readonly context: ModuleContext<unknown, Events>;\n readonly dependencyIds: ReadonlySet<string>;\n}\n\n/**\n * The module kernel. It owns lifecycle, a token-keyed service registry, and the\n * event bus; everything else — worlds, sessions, commands, networking, the tick\n * loop — is a module.\n *\n * Lifecycle: construct the kernel once, `register()` modules, then drive it\n * through `registerAll()`, `start()`, and `stop()`. `registerAll()` runs every\n * module's `register()` phase exactly once and validates providers and the\n * dependency graph; after it, `get()` resolves provided services. `start()`\n * runs `registerAll()` first when it has not run, then runs the `start()`\n * phases in dependency order. `stop()` runs `stop()` phases in reverse order,\n * logging failures instead of throwing, and returns the kernel to the\n * registered state, so the same kernel — and the services its modules\n * constructed — can be started again. Event listeners a module attaches are\n * detached when it stops; a module that must survive a restart attaches its\n * listeners in `start()`, not `register()`.\n */\nexport class Kernel<Events extends EventMap = EventMap> {\n private readonly entries: ModuleEntry<Events>[] = [];\n private readonly services = new Map<string, unknown>();\n private readonly providerOf = new Map<string, string>();\n private readonly bus: KernelEventBus<Events>;\n private readonly config: Readonly<Record<string, unknown>>;\n private readonly logger: KernelLogger;\n private readonly onStart: ((progress: KernelStartProgress) => void) | undefined;\n private phase: KernelPhase = 'created';\n private registering: string | undefined;\n private startOrder: ModuleEntry<Events>[] = [];\n /** The modules the current run has called `start()` on, including one still starting. */\n private launched: ModuleEntry<Events>[] = [];\n /** Bumped by every `start()` and `stop()`, so a start loop can tell it was stopped under it. */\n private run = 0;\n\n public constructor(options: KernelOptions = {}) {\n this.config = options.config ?? {};\n this.logger = options.logger ?? consoleLogger;\n this.onStart = options.onStart;\n const logger = this.logger;\n this.bus = new KernelEventBus<Events>({\n onListenerError: (error, event) => logger.error(`A \"${event}\" listener failed: ${describeFailure(error)}`)\n });\n }\n\n /** The kernel-owned event bus, unscoped. Module code should use its context's scoped handle. */\n public get events(): EventBus<Events> {\n return this.bus;\n }\n\n /**\n * Adds a module. Legal only before `registerAll()` (or the first `start()`,\n * which runs it).\n *\n * @throws KernelError after `registerAll()` or when a module with the same id is already registered.\n */\n public register<Config>(module: Module<Config, Events>): void {\n if (this.phase !== 'created') {\n throw new KernelErrors.LateModuleRegistration({ id: module.id });\n }\n if (this.entries.some((entry) => entry.module.id === module.id)) {\n throw new KernelErrors.DuplicateModule({ id: module.id });\n }\n const dependencyIds = new Set((module.dependencies ?? []).map((token) => token.id));\n const entry: ModuleEntry<Events> = {\n module,\n dependencyIds,\n context: this.createContext(module.id, dependencyIds)\n };\n this.entries.push(entry);\n }\n\n /**\n * Runs all `register()` phases, validates providers and the dependency\n * graph, and computes the start order. After it resolves, `get()` resolves\n * every provided service even though `start()` has not run. Runs at most\n * once per kernel; later calls are no-ops.\n *\n * @throws KernelError when a declared dependency has no provider or the dependency graph has a cycle.\n */\n public async registerAll(): Promise<void> {\n if (this.phase !== 'created') return;\n for (const entry of this.entries) {\n this.registering = entry.module.id;\n try {\n await entry.module.register(entry.context);\n } finally {\n this.registering = undefined;\n }\n }\n this.assertProvidersExist();\n this.startOrder = this.sortByDependencies();\n this.phase = 'registered';\n }\n\n /**\n * Runs `registerAll()` when it has not run, then runs `start()` phases in\n * dependency order. Legal again after `stop()`: the `register()` phases do\n * not rerun, so the modules' services carry over into the next start.\n *\n * A module whose `start()` throws leaves nothing running: the modules that\n * had already started are stopped in reverse order, the kernel goes back\n * to registered, and the error is rethrown. The failing module itself is\n * not stopped, because its start never finished.\n *\n * A `stop()` while this is still running wins: no further module starts,\n * and this rejects with a `KernelError` once the module it was\n * waiting on returns.\n *\n * @throws KernelError when the kernel is already starting or started, when\n * a declared dependency has no provider, or when the dependency graph has a\n * cycle.\n * @throws Whatever a module's `start()` throws, after the rollback.\n */\n public async start(): Promise<void> {\n if (this.phase === 'starting' || this.phase === 'started') {\n throw new KernelErrors.AlreadyStarted({ phase: this.phase });\n }\n await this.registerAll();\n this.phase = 'starting';\n const run = ++this.run;\n this.launched = [];\n for (const entry of this.startOrder) {\n // The report comes first, so a stop() from inside it does not stop a module whose\n // start never ran.\n this.report({ id: entry.module.id, state: 'starting' });\n if (this.run !== run) throw new KernelErrors.StoppedDuringStart();\n this.launched.push(entry);\n try {\n await entry.module.start?.(entry.context);\n } catch (error) {\n // A stop() during this start has already torn everything down.\n if (this.run !== run) throw error;\n this.launched.pop();\n this.bus.removeScope(entry.module.id);\n await this.stopLaunched();\n throw error;\n }\n if (this.run !== run) throw new KernelErrors.StoppedDuringStart();\n this.report({ id: entry.module.id, state: 'started' });\n if (this.run !== run) throw new KernelErrors.StoppedDuringStart();\n }\n this.phase = 'started';\n }\n\n /**\n * Hands one step of the start to {@link KernelOptions.onStart}. The callback only watches the\n * start, so its failure is logged and the start goes on rather than leaving modules running\n * with the kernel stuck in `starting`.\n */\n private report(progress: KernelStartProgress): void {\n try {\n this.onStart?.(progress);\n } catch (error) {\n this.logger.error(`The start progress callback failed: ${describeFailure(error)}`);\n }\n }\n\n /**\n * Runs `stop()` phases in reverse start order and detaches each module's\n * event listeners. Failures are logged, not thrown, so one module cannot\n * block the others' teardown. Leaves the kernel registered, so `start()`\n * may run it again.\n *\n * Called while `start()` is still running, it stops the modules started so\n * far and the one still starting, which is how a long start such as a\n * world preload is cancelled. A no-op when nothing has started.\n */\n public async stop(): Promise<void> {\n if (this.phase !== 'started' && this.phase !== 'starting') return;\n this.run++;\n await this.stopLaunched();\n }\n\n /** Stops the launched modules in reverse order, logging rather than throwing each failure. */\n private async stopLaunched(): Promise<void> {\n const entries = this.launched;\n this.launched = [];\n this.phase = 'registered';\n for (const entry of [...entries].reverse()) {\n try {\n await entry.module.stop?.(entry.context);\n } catch (error) {\n this.logger.error(`Module \"${entry.module.id}\" failed to stop: ${error}`);\n } finally {\n this.bus.removeScope(entry.module.id);\n }\n }\n }\n\n /**\n * Resolves a service for the host or for tests. Module code should resolve\n * through its context instead.\n *\n * @throws KernelError when no module has provided the token.\n */\n public get<T>(token: ServiceToken<T>): T {\n if (!this.services.has(token.id)) {\n throw new KernelErrors.NoProviderForService({ id: token.id });\n }\n // The registry stores services untyped; the token's phantom type is the\n // contract that the provider stored a matching value.\n return this.services.get(token.id) as T;\n }\n\n private createContext(moduleId: string, dependencyIds: ReadonlySet<string>): ModuleContext<unknown, Events> {\n return {\n use: <T>(token: ServiceToken<T>): T => {\n if (!dependencyIds.has(token.id)) {\n throw new KernelErrors.UndeclaredServiceUse({ moduleId, id: token.id });\n }\n if (!this.services.has(token.id)) {\n throw new KernelErrors.ServiceNotProvidedYet({ id: token.id });\n }\n return this.get(token);\n },\n provide: <T>(token: ServiceToken<T>, service: T, options?: { override?: boolean }): void => {\n if (this.registering !== moduleId) {\n throw new KernelErrors.ProvideOutsideRegister({ moduleId, id: token.id });\n }\n const existing = this.providerOf.get(token.id);\n if (existing !== undefined && !options?.override) {\n throw new KernelErrors.DuplicateServiceProvider({ id: token.id, existing });\n }\n this.services.set(token.id, service);\n this.providerOf.set(token.id, moduleId);\n },\n events: this.bus.scoped(moduleId),\n logger: scopedLogger(this.logger, moduleId),\n config: this.config[moduleId]\n };\n }\n\n private assertProvidersExist(): void {\n for (const entry of this.entries) {\n for (const tokenId of entry.dependencyIds) {\n if (!this.providerOf.has(tokenId)) {\n throw new KernelErrors.MissingServiceProvider({ id: entry.module.id, tokenId });\n }\n }\n }\n }\n\n /**\n * Topologically sorts modules so providers start before their dependents,\n * preserving registration order among independent modules.\n */\n private sortByDependencies(): ModuleEntry<Events>[] {\n const byId = new Map(this.entries.map((entry) => [entry.module.id, entry]));\n const order: ModuleEntry<Events>[] = [];\n const state = new Map<string, 'visiting' | 'done'>();\n const visit = (entry: ModuleEntry<Events>, path: string[]): void => {\n const status = state.get(entry.module.id);\n if (status === 'done') return;\n if (status === 'visiting') {\n const cycle = [...path.slice(path.indexOf(entry.module.id)), entry.module.id];\n throw new KernelErrors.DependencyCycle({ cycle: cycle.join(' -> ') });\n }\n state.set(entry.module.id, 'visiting');\n path.push(entry.module.id);\n for (const tokenId of entry.dependencyIds) {\n const providerId = this.providerOf.get(tokenId);\n if (providerId === undefined || providerId === entry.module.id) continue;\n const provider = byId.get(providerId);\n if (provider) visit(provider, path);\n }\n path.pop();\n state.set(entry.module.id, 'done');\n order.push(entry);\n };\n for (const entry of this.entries) {\n visit(entry, []);\n }\n return order;\n }\n}\n"],"mappings":";;;;;;;;AAYA,IAAM,mBAAmB,UAA2B;CAChD,IAAI;EACA,OAAO,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK;CACjF,QAAQ;EACJ,OAAO,OAAO,UAAU,SAAS,KAAK,KAAK;CAC/C;AACJ;;;;;;;;;;;;;;;;;;AAiDA,IAAa,SAAb,MAAwD;CACpD,UAAkD,CAAC;CACnD,2BAA4B,IAAI,IAAqB;CACrD,6BAA8B,IAAI,IAAoB;CACtD;CACA;CACA;CACA;CACA,QAA6B;CAC7B;CACA,aAA4C,CAAC;;CAE7C,WAA0C,CAAC;;CAE3C,MAAc;CAEd,YAAmB,UAAyB,CAAC,GAAG;EAC5C,KAAK,SAAS,QAAQ,UAAU,CAAC;EACjC,KAAK,SAAS,QAAQ,UAAU;EAChC,KAAK,UAAU,QAAQ;EACvB,MAAM,SAAS,KAAK;EACpB,KAAK,MAAM,IAAI,eAAuB,EAClC,kBAAkB,OAAO,UAAU,OAAO,MAAM,MAAM,MAAM,qBAAqB,gBAAgB,KAAK,GAAG,EAC7G,CAAC;CACL;;CAGA,IAAW,SAA2B;EAClC,OAAO,KAAK;CAChB;;;;;;;CAQA,SAAwB,QAAsC;EAC1D,IAAI,KAAK,UAAU,WACf,MAAM,IAAI,aAA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AAM,QAAQ,CAAC,GAAG,KAAK,MAAM,KAAK,QAAQ,MAAM,OAAO,EAAE,CAAC,GAAG,MAAM,OAAO,EAAE;IAC5E,MAAM,IAAI,aAAa,gBAAgB,EAAE,OAAO,MAAM,KAAK,MAAM,EAAE,CAAC;GACxE;GACA,MAAM,IAAI,MAAM,OAAO,IAAI,UAAU;GACrC,KAAK,KAAK,MAAM,OAAO,EAAE;GACzB,KAAK,MAAM,WAAW,MAAM,eAAe;IACvC,MAAM,aAAa,KAAK,WAAW,IAAI,OAAO;IAC9C,IAAI,eAAe,KAAA,KAAa,eAAe,MAAM,OAAO,IAAI;IAChE,MAAM,WAAW,KAAK,IAAI,UAAU;IACpC,IAAI,UAAU,MAAM,UAAU,IAAI;GACtC;GACA,KAAK,IAAI;GACT,MAAM,IAAI,MAAM,OAAO,IAAI,MAAM;GACjC,MAAM,KAAK,KAAK;EACpB;EACA,KAAK,MAAM,SAAS,KAAK,SACrB,MAAM,OAAO,CAAC,CAAC;EAEnB,OAAO;CACX;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsprismarine/kernel",
|
|
3
|
-
"version": "0.23.0
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Module kernel: lifecycle, a token-keyed service registry, and the event bus that modules plug into",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"vitest": "5.1.1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@jsprismarine/errors": "0.23.0
|
|
51
|
+
"@jsprismarine/errors": "0.23.0"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"clean": "rimraf dist jsp *.tsbuildinfo vite.config.ts.timestamp-* .tsup .turbo",
|