@jsprismarine/kernel 0.19.2 → 0.20.0-unstable-20261110035837
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 +8 -0
- package/README.md +2 -1
- package/dist/kernel.d.ts +21 -1
- package/dist/kernel.d.ts.map +1 -1
- package/dist/kernel.js +43 -4
- package/dist/kernel.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @jsprismarine/kernel
|
|
2
2
|
|
|
3
|
+
## 0.20.0-unstable-20261110035837
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2945](https://github.com/JSPrismarine/JSPrismarine/pull/2945) [`e65baae`](https://github.com/JSPrismarine/JSPrismarine/commit/e65baae41fad94186ed958d224c01592d9847eb0) Thanks [@filiphsps](https://github.com/filiphsps)! - `Kernel.start()` no longer leaves modules running when one fails to start. The modules that had started are stopped in reverse order, the kernel returns to registered so `start()` can run again, and the error is rethrown.
|
|
8
|
+
|
|
9
|
+
- [#2945](https://github.com/JSPrismarine/JSPrismarine/pull/2945) [`bbcb98e`](https://github.com/JSPrismarine/JSPrismarine/commit/bbcb98ec61ebf0a5deb2c48d64b20cfd13b39321) Thanks [@filiphsps](https://github.com/filiphsps)! - `Kernel.stop()` called while `start()` is still running now stops the modules started so far and the one still starting, so a long start such as a world preload can be cancelled. The pending `start()` rejects with a `KernelError` and starts nothing further. It used to be a no-op until the start finished.
|
|
10
|
+
|
|
3
11
|
## 0.19.2
|
|
4
12
|
|
|
5
13
|
No changes in this release.
|
package/README.md
CHANGED
|
@@ -7,7 +7,8 @@ use the same API.
|
|
|
7
7
|
|
|
8
8
|
A module declares the service tokens it depends on, provides its own services during `register()`,
|
|
9
9
|
and does its I/O in `start()`. The kernel validates the dependency graph, starts modules in
|
|
10
|
-
dependency order, and stops them in reverse. A module
|
|
10
|
+
dependency order, and stops them in reverse. A module whose start throws rolls back the ones already
|
|
11
|
+
started, and a `stop()` during a start cancels it. A module can only `use()` tokens it declared, so the
|
|
11
12
|
declared list is the real dependency graph, not documentation.
|
|
12
13
|
|
|
13
14
|
A kernel is built once and restarted freely: `registerAll()` runs every `register()` phase exactly
|
package/dist/kernel.d.ts
CHANGED
|
@@ -45,6 +45,10 @@ export declare class Kernel<Events extends EventMap = EventMap> {
|
|
|
45
45
|
private phase;
|
|
46
46
|
private registering;
|
|
47
47
|
private startOrder;
|
|
48
|
+
/** The modules the current run has called `start()` on, including one still starting. */
|
|
49
|
+
private launched;
|
|
50
|
+
/** Bumped by every `start()` and `stop()`, so a start loop can tell it was stopped under it. */
|
|
51
|
+
private run;
|
|
48
52
|
constructor(options?: KernelOptions);
|
|
49
53
|
/** The kernel-owned event bus, unscoped. Module code should use its context's scoped handle. */
|
|
50
54
|
get events(): EventBus<Events>;
|
|
@@ -69,18 +73,34 @@ export declare class Kernel<Events extends EventMap = EventMap> {
|
|
|
69
73
|
* dependency order. Legal again after `stop()`: the `register()` phases do
|
|
70
74
|
* not rerun, so the modules' services carry over into the next start.
|
|
71
75
|
*
|
|
76
|
+
* A module whose `start()` throws leaves nothing running: the modules that
|
|
77
|
+
* had already started are stopped in reverse order, the kernel goes back
|
|
78
|
+
* to registered, and the error is rethrown. The failing module itself is
|
|
79
|
+
* not stopped, because its start never finished.
|
|
80
|
+
*
|
|
81
|
+
* A `stop()` while this is still running wins: no further module starts,
|
|
82
|
+
* and this rejects with a {@link KernelError} once the module it was
|
|
83
|
+
* waiting on returns.
|
|
84
|
+
*
|
|
72
85
|
* @throws KernelError when the kernel is already starting or started, when
|
|
73
86
|
* a declared dependency has no provider, or when the dependency graph has a
|
|
74
87
|
* cycle.
|
|
88
|
+
* @throws Whatever a module's `start()` throws, after the rollback.
|
|
75
89
|
*/
|
|
76
90
|
start(): Promise<void>;
|
|
77
91
|
/**
|
|
78
92
|
* Runs `stop()` phases in reverse start order and detaches each module's
|
|
79
93
|
* event listeners. Failures are logged, not thrown, so one module cannot
|
|
80
94
|
* block the others' teardown. Leaves the kernel registered, so `start()`
|
|
81
|
-
* may run it again
|
|
95
|
+
* may run it again.
|
|
96
|
+
*
|
|
97
|
+
* Called while `start()` is still running, it stops the modules started so
|
|
98
|
+
* far and the one still starting, which is how a long start such as a
|
|
99
|
+
* world preload is cancelled. A no-op when nothing has started.
|
|
82
100
|
*/
|
|
83
101
|
stop(): Promise<void>;
|
|
102
|
+
/** Stops the launched modules in reverse order, logging rather than throwing each failure. */
|
|
103
|
+
private stopLaunched;
|
|
84
104
|
/**
|
|
85
105
|
* Resolves a service for the host or for tests. Module code should resolve
|
|
86
106
|
* through its context instead.
|
package/dist/kernel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sources":["../src/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;GAGG;AACH,qBAAa,WAAY,SAAQ,KAAK;IAClC,SAAyB,IAAI,iBAAiB;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAClC;AAUD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,MAAM,CAAC,MAAM,SAAS,QAAQ,GAAG,QAAQ;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CA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AAC,QAAQ,CAAC,MAAM,CAAe;IACtC,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,UAAU,CAA6B;IAC/C,yFAAyF;IACzF,OAAO,CAAC,QAAQ,CAA6B;IAC7C,gGAAgG;IAChG,OAAO,CAAC,GAAG,CAAK;IAEhB,YAAmB,OAAO,GAAE,aAAkB,EAG7C;IAED,gGAAgG;IAChG,IAAW,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,CAEpC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAc5D;IAED;;;;;;;OAOG;IACU,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAaxC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAuBlC;IAED;;;;;;;;;OASG;IACU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAIjC;IAED,8FAA8F;YAChF,YAAY;IAe1B;;;;;OAKG;IACI,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAOvC;IAED,OAAO,CAAC,aAAa;IAoCrB,OAAO,CAAC,oBAAoB;IAY5B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;CA4B7B"}
|
package/dist/kernel.js
CHANGED
|
@@ -35,6 +35,10 @@ var Kernel = class {
|
|
|
35
35
|
phase = "created";
|
|
36
36
|
registering;
|
|
37
37
|
startOrder = [];
|
|
38
|
+
/** The modules the current run has called `start()` on, including one still starting. */
|
|
39
|
+
launched = [];
|
|
40
|
+
/** Bumped by every `start()` and `stop()`, so a start loop can tell it was stopped under it. */
|
|
41
|
+
run = 0;
|
|
38
42
|
constructor(options = {}) {
|
|
39
43
|
this.config = options.config ?? {};
|
|
40
44
|
this.logger = options.logger ?? consoleLogger;
|
|
@@ -87,27 +91,62 @@ var Kernel = class {
|
|
|
87
91
|
* dependency order. Legal again after `stop()`: the `register()` phases do
|
|
88
92
|
* not rerun, so the modules' services carry over into the next start.
|
|
89
93
|
*
|
|
94
|
+
* A module whose `start()` throws leaves nothing running: the modules that
|
|
95
|
+
* had already started are stopped in reverse order, the kernel goes back
|
|
96
|
+
* to registered, and the error is rethrown. The failing module itself is
|
|
97
|
+
* not stopped, because its start never finished.
|
|
98
|
+
*
|
|
99
|
+
* A `stop()` while this is still running wins: no further module starts,
|
|
100
|
+
* and this rejects with a {@link KernelError} once the module it was
|
|
101
|
+
* waiting on returns.
|
|
102
|
+
*
|
|
90
103
|
* @throws KernelError when the kernel is already starting or started, when
|
|
91
104
|
* a declared dependency has no provider, or when the dependency graph has a
|
|
92
105
|
* cycle.
|
|
106
|
+
* @throws Whatever a module's `start()` throws, after the rollback.
|
|
93
107
|
*/
|
|
94
108
|
async start() {
|
|
95
109
|
if (this.phase === "starting" || this.phase === "started") throw new KernelError(`Kernel is already ${this.phase}; stop() it before starting again`);
|
|
96
110
|
await this.registerAll();
|
|
97
111
|
this.phase = "starting";
|
|
98
|
-
|
|
112
|
+
const run = ++this.run;
|
|
113
|
+
this.launched = [];
|
|
114
|
+
for (const entry of this.startOrder) {
|
|
115
|
+
this.launched.push(entry);
|
|
116
|
+
try {
|
|
117
|
+
await entry.module.start?.(entry.context);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
if (this.run !== run) throw error;
|
|
120
|
+
this.launched.pop();
|
|
121
|
+
this.bus.removeScope(entry.module.id);
|
|
122
|
+
await this.stopLaunched();
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
if (this.run !== run) throw new KernelError("Kernel was stopped before start() finished");
|
|
126
|
+
}
|
|
99
127
|
this.phase = "started";
|
|
100
128
|
}
|
|
101
129
|
/**
|
|
102
130
|
* Runs `stop()` phases in reverse start order and detaches each module's
|
|
103
131
|
* event listeners. Failures are logged, not thrown, so one module cannot
|
|
104
132
|
* block the others' teardown. Leaves the kernel registered, so `start()`
|
|
105
|
-
* may run it again
|
|
133
|
+
* may run it again.
|
|
134
|
+
*
|
|
135
|
+
* Called while `start()` is still running, it stops the modules started so
|
|
136
|
+
* far and the one still starting, which is how a long start such as a
|
|
137
|
+
* world preload is cancelled. A no-op when nothing has started.
|
|
106
138
|
*/
|
|
107
139
|
async stop() {
|
|
108
|
-
if (this.phase !== "started") return;
|
|
140
|
+
if (this.phase !== "started" && this.phase !== "starting") return;
|
|
141
|
+
this.run++;
|
|
142
|
+
await this.stopLaunched();
|
|
143
|
+
}
|
|
144
|
+
/** Stops the launched modules in reverse order, logging rather than throwing each failure. */
|
|
145
|
+
async stopLaunched() {
|
|
146
|
+
const entries = this.launched;
|
|
147
|
+
this.launched = [];
|
|
109
148
|
this.phase = "registered";
|
|
110
|
-
for (const entry of [...
|
|
149
|
+
for (const entry of [...entries].reverse()) try {
|
|
111
150
|
await entry.module.stop?.(entry.context);
|
|
112
151
|
} catch (error) {
|
|
113
152
|
this.logger.error(`Module "${entry.module.id}" failed to stop: ${error}`);
|
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';\n\n/**\n * Error raised for kernel contract violations: missing providers, dependency\n * cycles, duplicate providers, out-of-phase calls, and undeclared `use()`.\n */\nexport class KernelError extends Error {\n public override readonly name = 'KernelError';\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\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 = new KernelEventBus<Events>();\n private readonly config: Readonly<Record<string, unknown>>;\n private readonly logger: KernelLogger;\n private phase: KernelPhase = 'created';\n private registering: string | undefined;\n private startOrder: ModuleEntry<Events>[] = [];\n\n public constructor(options: KernelOptions = {}) {\n this.config = options.config ?? {};\n this.logger = options.logger ?? consoleLogger;\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 KernelError(`Cannot register module \"${module.id}\" after the kernel has run registerAll()`);\n }\n if (this.entries.some((entry) => entry.module.id === module.id)) {\n throw new KernelError(`A module with id \"${module.id}\" is already registered`);\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 * @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 */\n public async start(): Promise<void> {\n if (this.phase === 'starting' || this.phase === 'started') {\n throw new KernelError(`Kernel is already ${this.phase}; stop() it before starting again`);\n }\n await this.registerAll();\n this.phase = 'starting';\n for (const entry of this.startOrder) {\n await entry.module.start?.(entry.context);\n }\n this.phase = 'started';\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; a no-op unless the kernel is started.\n */\n public async stop(): Promise<void> {\n if (this.phase !== 'started') return;\n this.phase = 'registered';\n for (const entry of [...this.startOrder].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 KernelError(`No provider for service \"${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 KernelError(\n `Module \"${moduleId}\" used service \"${token.id}\" without declaring it as a dependency`\n );\n }\n if (!this.services.has(token.id)) {\n throw new KernelError(\n `Service \"${token.id}\" is not provided yet; resolve dependencies in start(), not register()`\n );\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 KernelError(\n `Module \"${moduleId}\" may only provide \"${token.id}\" during its register() phase`\n );\n }\n const existing = this.providerOf.get(token.id);\n if (existing !== undefined && !options?.override) {\n throw new KernelError(\n `Service \"${token.id}\" is already provided by module \"${existing}\"; pass override: true to replace it`\n );\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 KernelError(\n `Module \"${entry.module.id}\" depends on service \"${tokenId}\" but no registered module provides it`\n );\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 KernelError(`Dependency cycle between modules: ${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":";;;;;;;AAWA,IAAa,cAAb,cAAiC,MAAM;CACnC,OAAgC;AACpC;;;;;;;;;;;;;;;;;;AAqCA,IAAa,SAAb,MAAwD;CACpD,UAAkD,CAAC;CACnD,2BAA4B,IAAI,IAAqB;CACrD,6BAA8B,IAAI,IAAoB;CACtD,MAAuB,IAAI,eAAuB;CAClD;CACA;CACA,QAA6B;CAC7B;CACA,aAA4C,CAAC;CAE7C,YAAmB,UAAyB,CAAC,GAAG;EAC5C,KAAK,SAAS,QAAQ,UAAU,CAAC;EACjC,KAAK,SAAS,QAAQ,UAAU;CACpC;;CAGA,IAAW,SAA2B;EAClC,OAAO,KAAK;CAChB;;;;;;;CAQA,SAAwB,QAAsC;EAC1D,IAAI,KAAK,UAAU,WACf,MAAM,IAAI,YAAY,2BAA2B,OAAO,GAAG,yCAAyC;EAExG,IAAI,KAAK,QAAQ,MAAM,UAAU,MAAM,OAAO,OAAO,OAAO,EAAE,GAC1D,MAAM,IAAI,YAAY,qBAAqB,OAAO,GAAG,wBAAwB;EAEjF,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB,CAAC,EAAA,CAAG,KAAK,UAAU,MAAM,EAAE,CAAC;EAClF,MAAM,QAA6B;GAC/B;GACA;GACA,SAAS,KAAK,cAAc,OAAO,IAAI,aAAa;EACxD;EACA,KAAK,QAAQ,KAAK,KAAK;CAC3B;;;;;;;;;CAUA,MAAa,cAA6B;EACtC,IAAI,KAAK,UAAU,WAAW;EAC9B,KAAK,M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AM,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';\n\n/**\n * Error raised for kernel contract violations: missing providers, dependency\n * cycles, duplicate providers, out-of-phase calls, and undeclared `use()`.\n */\nexport class KernelError extends Error {\n public override readonly name = 'KernelError';\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\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 = new KernelEventBus<Events>();\n private readonly config: Readonly<Record<string, unknown>>;\n private readonly logger: KernelLogger;\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 }\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 KernelError(`Cannot register module \"${module.id}\" after the kernel has run registerAll()`);\n }\n if (this.entries.some((entry) => entry.module.id === module.id)) {\n throw new KernelError(`A module with id \"${module.id}\" is already registered`);\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 KernelError(`Kernel is already ${this.phase}; stop() it before starting again`);\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 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 KernelError('Kernel was stopped before start() finished');\n }\n this.phase = 'started';\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 KernelError(`No provider for service \"${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 KernelError(\n `Module \"${moduleId}\" used service \"${token.id}\" without declaring it as a dependency`\n );\n }\n if (!this.services.has(token.id)) {\n throw new KernelError(\n `Service \"${token.id}\" is not provided yet; resolve dependencies in start(), not register()`\n );\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 KernelError(\n `Module \"${moduleId}\" may only provide \"${token.id}\" during its register() phase`\n );\n }\n const existing = this.providerOf.get(token.id);\n if (existing !== undefined && !options?.override) {\n throw new KernelError(\n `Service \"${token.id}\" is already provided by module \"${existing}\"; pass override: true to replace it`\n );\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 KernelError(\n `Module \"${entry.module.id}\" depends on service \"${tokenId}\" but no registered module provides it`\n );\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 KernelError(`Dependency cycle between modules: ${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":";;;;;;;AAWA,IAAa,cAAb,cAAiC,MAAM;CACnC,OAAgC;AACpC;;;;;;;;;;;;;;;;;;AAqCA,IAAa,SAAb,MAAwD;CACpD,UAAkD,CAAC;CACnD,2BAA4B,IAAI,IAAqB;CACrD,6BAA8B,IAAI,IAAoB;CACtD,MAAuB,IAAI,eAAuB;CAClD;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;CACpC;;CAGA,IAAW,SAA2B;EAClC,OAAO,KAAK;CAChB;;;;;;;CAQA,SAAwB,QAAsC;EAC1D,IAA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,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.
|
|
3
|
+
"version": "0.20.0-unstable-20261110035837",
|
|
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": {
|