skeleton-crew-runtime 0.1.2 → 0.1.4
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/dist/.tsbuildinfo +1 -0
- package/dist/action-engine.d.ts +0 -75
- package/dist/action-engine.d.ts.map +1 -1
- package/dist/action-engine.js +13 -96
- package/dist/action-engine.js.map +1 -1
- package/dist/event-bus.d.ts +0 -44
- package/dist/event-bus.d.ts.map +1 -1
- package/dist/event-bus.js +13 -59
- package/dist/event-bus.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/performance.d.ts +18 -0
- package/dist/performance.d.ts.map +1 -0
- package/dist/performance.js +31 -0
- package/dist/performance.js.map +1 -0
- package/dist/plugin-registry.d.ts +0 -8
- package/dist/plugin-registry.d.ts.map +1 -1
- package/dist/plugin-registry.js +2 -23
- package/dist/plugin-registry.js.map +1 -1
- package/dist/runtime-context.d.ts +13 -66
- package/dist/runtime-context.d.ts.map +1 -1
- package/dist/runtime-context.js +20 -98
- package/dist/runtime-context.js.map +1 -1
- package/dist/runtime.d.ts +1 -98
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +6 -135
- package/dist/runtime.js.map +1 -1
- package/dist/screen-registry.d.ts +0 -40
- package/dist/screen-registry.d.ts.map +1 -1
- package/dist/screen-registry.js +0 -44
- package/dist/screen-registry.js.map +1 -1
- package/dist/types.d.ts +1 -70
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -27
- package/dist/types.js.map +1 -1
- package/dist/ui-bridge.d.ts +0 -27
- package/dist/ui-bridge.d.ts.map +1 -1
- package/dist/ui-bridge.js +0 -29
- package/dist/ui-bridge.js.map +1 -1
- package/package.json +9 -2
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.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-5,12 +5,7 @@ import { ActionEngine } from './action-engine.js';
|
|
|
5
5
|
import { EventBus } from './event-bus.js';
|
|
6
6
|
import { UIBridge } from './ui-bridge.js';
|
|
7
7
|
import { RuntimeContextImpl } from './runtime-context.js';
|
|
8
|
-
|
|
9
|
-
* Runtime is the main orchestrator that coordinates all subsystems.
|
|
10
|
-
* Handles initialization, shutdown, and lifecycle state tracking.
|
|
11
|
-
*
|
|
12
|
-
* Requirements: 1.1, 1.2, 1.3, 1.4, 1.5, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 3.1, 3.5, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 9.7, 9.9, 15.1, 15.3, 15.5, 16.1, 16.2, 16.3, 16.4, 16.5
|
|
13
|
-
*/
|
|
8
|
+
import { createPerformanceMonitor } from './performance.js';
|
|
14
9
|
export class Runtime {
|
|
15
10
|
plugins;
|
|
16
11
|
screens;
|
|
@@ -23,36 +18,18 @@ export class Runtime {
|
|
|
23
18
|
logger;
|
|
24
19
|
state = RuntimeState.Uninitialized;
|
|
25
20
|
hostContext;
|
|
26
|
-
|
|
27
|
-
* Creates a new Runtime instance with optional configuration.
|
|
28
|
-
*
|
|
29
|
-
* @param options - Optional configuration object
|
|
30
|
-
* @param options.logger - Custom logger implementation (defaults to ConsoleLogger)
|
|
31
|
-
* @param options.hostContext - Host application services to inject (defaults to empty object)
|
|
32
|
-
*
|
|
33
|
-
* Requirements: 1.1, 1.5, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6
|
|
34
|
-
*/
|
|
21
|
+
performanceMonitor;
|
|
35
22
|
constructor(options) {
|
|
36
23
|
this.logger = options?.logger ?? new ConsoleLogger();
|
|
37
24
|
this.hostContext = options?.hostContext ?? {};
|
|
25
|
+
this.performanceMonitor = createPerformanceMonitor(options?.enablePerformanceMonitoring ?? false);
|
|
38
26
|
this.validateHostContext(this.hostContext);
|
|
39
27
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Validates host context and logs warnings for common mistakes.
|
|
42
|
-
* Does not throw errors or modify the context.
|
|
43
|
-
*
|
|
44
|
-
* @param context - The host context to validate
|
|
45
|
-
*
|
|
46
|
-
* Requirements: 2.1, 2.2, 2.3, 2.4
|
|
47
|
-
*/
|
|
48
28
|
validateHostContext(context) {
|
|
49
|
-
// Fast path for empty context
|
|
50
29
|
if (Object.keys(context).length === 0) {
|
|
51
30
|
return;
|
|
52
31
|
}
|
|
53
|
-
// Check each key in the context
|
|
54
32
|
Object.entries(context).forEach(([key, value]) => {
|
|
55
|
-
// Check for large objects (> 1MB)
|
|
56
33
|
try {
|
|
57
34
|
const size = JSON.stringify(value).length;
|
|
58
35
|
if (size > 1024 * 1024) {
|
|
@@ -60,199 +37,93 @@ export class Runtime {
|
|
|
60
37
|
}
|
|
61
38
|
}
|
|
62
39
|
catch (error) {
|
|
63
|
-
// JSON.stringify can fail for circular references or other issues
|
|
64
|
-
// Log but don't fail validation
|
|
65
40
|
this.logger.warn(`Host context key "${key}" could not be serialized for size check`);
|
|
66
41
|
}
|
|
67
|
-
// Check for function values
|
|
68
42
|
if (typeof value === 'function') {
|
|
69
43
|
this.logger.warn(`Host context key "${key}" is a function. Consider wrapping it in an object.`);
|
|
70
44
|
}
|
|
71
45
|
});
|
|
72
46
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Registers a plugin before initialization.
|
|
75
|
-
* Plugins registered this way will have their setup callbacks executed during initialize().
|
|
76
|
-
*
|
|
77
|
-
* @param plugin - The plugin definition to register
|
|
78
|
-
* @throws Error if runtime is already initialized
|
|
79
|
-
*/
|
|
80
47
|
registerPlugin(plugin) {
|
|
81
48
|
if (this.initialized) {
|
|
82
49
|
throw new Error('Cannot register plugins after initialization. Use context.plugins.registerPlugin() instead.');
|
|
83
50
|
}
|
|
84
51
|
this.pendingPlugins.push(plugin);
|
|
85
52
|
}
|
|
86
|
-
/**
|
|
87
|
-
* Initializes the runtime following the strict initialization sequence.
|
|
88
|
-
* Creates all subsystems in order, then executes plugin setup callbacks.
|
|
89
|
-
* Emits runtime:initialized event after successful initialization.
|
|
90
|
-
*
|
|
91
|
-
* @throws Error if initialize is called twice
|
|
92
|
-
* @throws Error if any plugin setup fails
|
|
93
|
-
*
|
|
94
|
-
* Requirements: 1.1, 1.2, 1.3, 1.4, 1.5, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 3.1, 3.5, 15.1, 15.3, 15.5, 16.1, 16.2, 16.3, 16.4, 16.5, 17.1, 17.2, 17.3
|
|
95
|
-
*/
|
|
96
53
|
async initialize() {
|
|
97
|
-
// Throw error if initialize called twice (Requirement 15.1)
|
|
98
54
|
if (this.initialized) {
|
|
99
55
|
throw new Error('Runtime already initialized');
|
|
100
56
|
}
|
|
101
|
-
// Set state to Initializing (Requirement 16.2)
|
|
102
57
|
this.state = RuntimeState.Initializing;
|
|
58
|
+
const timer = this.performanceMonitor.startTimer('runtime:initialize');
|
|
103
59
|
try {
|
|
104
|
-
// Strict initialization sequence (Requirements 2.1, 2.2, 2.3, 2.4)
|
|
105
|
-
// 1. Create PluginRegistry (Requirement 2.1)
|
|
106
60
|
this.plugins = new PluginRegistry(this.logger);
|
|
107
|
-
// Register pending plugins
|
|
108
61
|
for (const plugin of this.pendingPlugins) {
|
|
109
62
|
this.plugins.registerPlugin(plugin);
|
|
110
63
|
}
|
|
111
64
|
this.pendingPlugins = [];
|
|
112
|
-
// 2. Create ScreenRegistry (Requirement 2.2)
|
|
113
65
|
this.screens = new ScreenRegistry(this.logger);
|
|
114
|
-
// 3. Create ActionEngine (Requirement 2.3)
|
|
115
66
|
this.actions = new ActionEngine(this.logger);
|
|
116
|
-
// 4. Create EventBus (Requirement 2.4)
|
|
117
67
|
this.events = new EventBus(this.logger);
|
|
118
|
-
// 5. Create UIBridge
|
|
119
68
|
this.ui = new UIBridge(this.logger);
|
|
120
|
-
// 6. Create RuntimeContext after all subsystems (Requirements 1.2, 2.4, 9.7)
|
|
121
69
|
this.context = new RuntimeContextImpl(this.screens, this.actions, this.plugins, this.events, this, this.hostContext);
|
|
122
|
-
// 7. Pass RuntimeContext to ActionEngine (Requirement 9.9)
|
|
123
70
|
this.actions.setContext(this.context);
|
|
124
|
-
// 8. Execute plugin setup callbacks in registration order (Requirements 2.5, 2.6, 3.1)
|
|
125
|
-
// This will abort on first plugin setup failure (Requirement 3.1)
|
|
126
71
|
await this.plugins.executeSetup(this.context);
|
|
127
|
-
// Mark as initialized
|
|
128
72
|
this.initialized = true;
|
|
129
|
-
// Set state to Initialized (Requirement 16.2)
|
|
130
73
|
this.state = RuntimeState.Initialized;
|
|
131
|
-
// Emit runtime:initialized event (Requirements 17.1, 17.2, 17.3)
|
|
132
74
|
this.events.emit('runtime:initialized', { context: this.context });
|
|
75
|
+
timer();
|
|
133
76
|
}
|
|
134
77
|
catch (error) {
|
|
135
|
-
// Reset state to Uninitialized on failure (Requirement 16.5)
|
|
136
78
|
this.state = RuntimeState.Uninitialized;
|
|
79
|
+
timer();
|
|
137
80
|
throw error;
|
|
138
81
|
}
|
|
139
82
|
}
|
|
140
|
-
/**
|
|
141
|
-
* Shuts down the runtime following the strict shutdown sequence.
|
|
142
|
-
* Emits runtime:shutdown event at start of shutdown.
|
|
143
|
-
* Disposes initialized plugins, shuts down UI provider, clears all registries, and releases resources.
|
|
144
|
-
* Safe to call multiple times (idempotent).
|
|
145
|
-
*
|
|
146
|
-
* Requirements: 4.1, 4.2, 4.3, 4.4, 4.5, 9.5, 15.2, 15.4, 15.6, 16.1, 16.2, 16.3, 16.4, 16.5, 17.4, 17.5
|
|
147
|
-
*/
|
|
148
83
|
async shutdown() {
|
|
149
|
-
// Make shutdown idempotent - safe to call multiple times (Requirement 4.5)
|
|
150
84
|
if (!this.initialized) {
|
|
151
85
|
return;
|
|
152
86
|
}
|
|
153
|
-
// Set state to ShuttingDown (Requirement 16.4)
|
|
154
87
|
this.state = RuntimeState.ShuttingDown;
|
|
155
|
-
// Emit runtime:shutdown event (Requirements 17.4, 17.5)
|
|
156
88
|
this.events.emit('runtime:shutdown', { context: this.context });
|
|
157
|
-
// 1. Execute dispose callbacks only for initialized plugins (Requirements 4.2, 4.3)
|
|
158
|
-
// Dispose errors are logged but do not prevent cleanup (Requirement 4.4)
|
|
159
89
|
await this.plugins.executeDispose(this.context);
|
|
160
|
-
// 2. Shutdown UI provider before clearing registries (Requirement 9.5)
|
|
161
|
-
// Handle shutdown errors gracefully - errors are logged but do not prevent cleanup
|
|
162
90
|
try {
|
|
163
91
|
await this.ui.shutdown();
|
|
164
92
|
}
|
|
165
93
|
catch (error) {
|
|
166
94
|
this.logger.error('UIBridge shutdown failed', error);
|
|
167
95
|
}
|
|
168
|
-
// 3. Clear all registries (Requirement 4.5)
|
|
169
96
|
this.screens.clear();
|
|
170
97
|
this.actions.clear();
|
|
171
98
|
this.events.clear();
|
|
172
99
|
this.plugins.clear();
|
|
173
|
-
// 4. Clear context reference in ActionEngine to break circular reference
|
|
174
100
|
this.actions.setContext(null);
|
|
175
|
-
// 5. Set initialized flag to false (Requirement 4.5)
|
|
176
101
|
this.initialized = false;
|
|
177
|
-
// Set state to Shutdown (Requirement 16.4)
|
|
178
102
|
this.state = RuntimeState.Shutdown;
|
|
179
103
|
}
|
|
180
|
-
/**
|
|
181
|
-
* Returns the RuntimeContext for this runtime instance.
|
|
182
|
-
*
|
|
183
|
-
* @returns The RuntimeContext
|
|
184
|
-
* @throws Error if runtime is not initialized
|
|
185
|
-
*
|
|
186
|
-
* Requirement: 9.1
|
|
187
|
-
*/
|
|
188
104
|
getContext() {
|
|
189
105
|
if (!this.initialized) {
|
|
190
106
|
throw new Error('Runtime not initialized');
|
|
191
107
|
}
|
|
192
108
|
return this.context;
|
|
193
109
|
}
|
|
194
|
-
/**
|
|
195
|
-
* Returns whether the runtime has been initialized.
|
|
196
|
-
*
|
|
197
|
-
* @returns true if runtime is initialized, false otherwise
|
|
198
|
-
*
|
|
199
|
-
* Requirements: 16.1, 16.2, 16.3
|
|
200
|
-
*/
|
|
201
110
|
isInitialized() {
|
|
202
111
|
return this.state === RuntimeState.Initialized;
|
|
203
112
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Returns the current lifecycle state of the runtime.
|
|
206
|
-
*
|
|
207
|
-
* @returns The current RuntimeState
|
|
208
|
-
*
|
|
209
|
-
* Requirements: 16.1, 16.2, 16.3, 16.4, 16.5
|
|
210
|
-
*/
|
|
211
113
|
getState() {
|
|
212
114
|
return this.state;
|
|
213
115
|
}
|
|
214
|
-
/**
|
|
215
|
-
* Registers a UI provider with the runtime.
|
|
216
|
-
* Delegates to UIBridge subsystem.
|
|
217
|
-
* Can be called after initialization completes.
|
|
218
|
-
*
|
|
219
|
-
* @param provider - The UI provider implementation
|
|
220
|
-
* @throws Error if provider is invalid or already registered
|
|
221
|
-
*
|
|
222
|
-
* Requirements: 10.3, 10.9
|
|
223
|
-
*/
|
|
224
116
|
setUIProvider(provider) {
|
|
225
117
|
this.ui.setProvider(provider);
|
|
226
118
|
}
|
|
227
|
-
/**
|
|
228
|
-
* Returns the registered UI provider.
|
|
229
|
-
* Delegates to UIBridge subsystem.
|
|
230
|
-
*
|
|
231
|
-
* @returns The registered UIProvider or null if none registered
|
|
232
|
-
*
|
|
233
|
-
* Requirement: 10.4
|
|
234
|
-
*/
|
|
235
119
|
getUIProvider() {
|
|
236
120
|
return this.ui.getProvider();
|
|
237
121
|
}
|
|
238
|
-
/**
|
|
239
|
-
* Renders a screen by looking it up in the ScreenRegistry and delegating to UIBridge.
|
|
240
|
-
*
|
|
241
|
-
* @param screenId - The screen identifier to render
|
|
242
|
-
* @returns The result from the UI provider's render method
|
|
243
|
-
* @throws Error if screen is not found
|
|
244
|
-
* @throws Error if no UI provider is registered
|
|
245
|
-
*
|
|
246
|
-
* Requirement: 10.5
|
|
247
|
-
*/
|
|
248
122
|
renderScreen(screenId) {
|
|
249
|
-
// Look up the screen in the registry
|
|
250
123
|
const screen = this.screens.getScreen(screenId);
|
|
251
|
-
// Throw if screen not found
|
|
252
124
|
if (screen === null) {
|
|
253
125
|
throw new Error(`Screen with id "${screenId}" not found`);
|
|
254
126
|
}
|
|
255
|
-
// Delegate to UIBridge to render the screen
|
|
256
127
|
return this.ui.renderScreen(screen);
|
|
257
128
|
}
|
|
258
129
|
}
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAA2B,MAAM,kBAAkB,CAAC;AAQrF,MAAM,OAAO,OAAO;IACV,OAAO,CAAkB;IACzB,OAAO,CAAkB;IACzB,OAAO,CAAgB;IACvB,MAAM,CAAY;IAClB,EAAE,CAAY;I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ry subsystem for managing screen definitions.
|
|
4
|
-
* Provides O(1) lookup performance using Map-based storage.
|
|
5
|
-
*
|
|
6
|
-
* Requirements: 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 13.1, 13.5, 16.1
|
|
7
|
-
*/
|
|
8
2
|
export declare class ScreenRegistry {
|
|
9
3
|
private screens;
|
|
10
4
|
private logger;
|
|
11
5
|
constructor(logger: Logger);
|
|
12
|
-
/**
|
|
13
|
-
* Registers a screen definition.
|
|
14
|
-
* Validates required fields and rejects duplicate IDs.
|
|
15
|
-
* Returns an unregister function that removes the screen when called.
|
|
16
|
-
*
|
|
17
|
-
* @param screen - The screen definition to register
|
|
18
|
-
* @returns A function that unregisters the screen when called
|
|
19
|
-
* @throws ValidationError if screen is missing required fields (id, title, component)
|
|
20
|
-
* @throws DuplicateRegistrationError if a screen with the same ID is already registered
|
|
21
|
-
*
|
|
22
|
-
* Requirements: 4.1, 4.2, 4.3, 4.4, 4.5, 5.2, 5.5, 5.7, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 15.1, 15.2, 15.3, 15.4, 15.5, 16.1, 18.1, 18.2, 18.3, 18.4, 18.5
|
|
23
|
-
*/
|
|
24
6
|
registerScreen(screen: ScreenDefinition): () => void;
|
|
25
|
-
/**
|
|
26
|
-
* Retrieves a screen definition by ID.
|
|
27
|
-
*
|
|
28
|
-
* @param id - The screen identifier
|
|
29
|
-
* @returns The screen definition or null if not found
|
|
30
|
-
*
|
|
31
|
-
* Requirements: 5.3, 5.6, 13.1
|
|
32
|
-
*/
|
|
33
7
|
getScreen(id: string): ScreenDefinition | null;
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves all registered screen definitions.
|
|
36
|
-
* Returns a copy to ensure data isolation.
|
|
37
|
-
*
|
|
38
|
-
* @returns Array copy of all registered screen definitions
|
|
39
|
-
*
|
|
40
|
-
* Requirements: 5.4, 10.1, 10.2, 10.3, 10.4, 10.5
|
|
41
|
-
*/
|
|
42
8
|
getAllScreens(): ScreenDefinition[];
|
|
43
|
-
/**
|
|
44
|
-
* Clears all registered screens.
|
|
45
|
-
* Used during shutdown to release resources.
|
|
46
|
-
*
|
|
47
|
-
* Requirement: 13.5
|
|
48
|
-
*/
|
|
49
9
|
clear(): void;
|
|
50
10
|
}
|
|
51
11
|
//# sourceMappingURL=screen-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen-registry.d.ts","sourceRoot":"","sources":["../src/screen-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"screen-registry.d.ts","sourceRoot":"","sources":["../src/screen-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAS3D,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IAiB1B,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,IAAI;IAmCpD,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAY9C,aAAa,IAAI,gBAAgB,EAAE;IAUnC,KAAK,IAAI,IAAI;CAGd"}
|
package/dist/screen-registry.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { ValidationError, DuplicateRegistrationError } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* ScreenRegistry subsystem for managing screen definitions.
|
|
4
|
-
* Provides O(1) lookup performance using Map-based storage.
|
|
5
|
-
*
|
|
6
|
-
* Requirements: 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 13.1, 13.5, 16.1
|
|
7
|
-
*/
|
|
8
2
|
export class ScreenRegistry {
|
|
9
3
|
screens;
|
|
10
4
|
logger;
|
|
@@ -12,20 +6,7 @@ export class ScreenRegistry {
|
|
|
12
6
|
this.screens = new Map();
|
|
13
7
|
this.logger = logger;
|
|
14
8
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Registers a screen definition.
|
|
17
|
-
* Validates required fields and rejects duplicate IDs.
|
|
18
|
-
* Returns an unregister function that removes the screen when called.
|
|
19
|
-
*
|
|
20
|
-
* @param screen - The screen definition to register
|
|
21
|
-
* @returns A function that unregisters the screen when called
|
|
22
|
-
* @throws ValidationError if screen is missing required fields (id, title, component)
|
|
23
|
-
* @throws DuplicateRegistrationError if a screen with the same ID is already registered
|
|
24
|
-
*
|
|
25
|
-
* Requirements: 4.1, 4.2, 4.3, 4.4, 4.5, 5.2, 5.5, 5.7, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 15.1, 15.2, 15.3, 15.4, 15.5, 16.1, 18.1, 18.2, 18.3, 18.4, 18.5
|
|
26
|
-
*/
|
|
27
9
|
registerScreen(screen) {
|
|
28
|
-
// Validate required fields before any state modification (Requirements 18.1, 18.2, 18.3, 18.5)
|
|
29
10
|
if (!screen.id || typeof screen.id !== 'string') {
|
|
30
11
|
throw new ValidationError('Screen', 'id');
|
|
31
12
|
}
|
|
@@ -35,46 +16,21 @@ export class ScreenRegistry {
|
|
|
35
16
|
if (!screen.component || typeof screen.component !== 'string') {
|
|
36
17
|
throw new ValidationError('Screen', 'component', screen.id);
|
|
37
18
|
}
|
|
38
|
-
// Check for duplicate ID (Requirements 15.1, 15.2, 15.3, 15.4, 15.5)
|
|
39
19
|
if (this.screens.has(screen.id)) {
|
|
40
20
|
throw new DuplicateRegistrationError('Screen', screen.id);
|
|
41
21
|
}
|
|
42
|
-
// Register the screen
|
|
43
22
|
this.screens.set(screen.id, screen);
|
|
44
23
|
this.logger.debug(`Screen "${screen.id}" registered successfully`);
|
|
45
|
-
// Return idempotent unregister function (Requirements 4.1, 4.2, 4.3, 4.4, 4.5)
|
|
46
24
|
return () => {
|
|
47
25
|
this.screens.delete(screen.id);
|
|
48
26
|
};
|
|
49
27
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Retrieves a screen definition by ID.
|
|
52
|
-
*
|
|
53
|
-
* @param id - The screen identifier
|
|
54
|
-
* @returns The screen definition or null if not found
|
|
55
|
-
*
|
|
56
|
-
* Requirements: 5.3, 5.6, 13.1
|
|
57
|
-
*/
|
|
58
28
|
getScreen(id) {
|
|
59
29
|
return this.screens.get(id) ?? null;
|
|
60
30
|
}
|
|
61
|
-
/**
|
|
62
|
-
* Retrieves all registered screen definitions.
|
|
63
|
-
* Returns a copy to ensure data isolation.
|
|
64
|
-
*
|
|
65
|
-
* @returns Array copy of all registered screen definitions
|
|
66
|
-
*
|
|
67
|
-
* Requirements: 5.4, 10.1, 10.2, 10.3, 10.4, 10.5
|
|
68
|
-
*/
|
|
69
31
|
getAllScreens() {
|
|
70
32
|
return Array.from(this.screens.values());
|
|
71
33
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Clears all registered screens.
|
|
74
|
-
* Used during shutdown to release resources.
|
|
75
|
-
*
|
|
76
|
-
* Requirement: 13.5
|
|
77
|
-
*/
|
|
78
34
|
clear() {
|
|
79
35
|
this.screens.clear();
|
|
80
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen-registry.js","sourceRoot":"","sources":["../src/screen-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"screen-registry.js","sourceRoot":"","sources":["../src/screen-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAQzE,MAAM,OAAO,cAAc;IACjB,OAAO,CAAgC;IACvC,MAAM,CAAS;IAEvB,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAcD,cAAc,CAAC,MAAwB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,CAAC;IAQD,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,64 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error thrown when validation fails for a resource
|
|
3
|
-
* @see Requirements 14.1, 14.2, 14.3, 14.4, 14.5, 14.6
|
|
4
|
-
*/
|
|
5
1
|
export declare class ValidationError extends Error {
|
|
6
2
|
resourceType: string;
|
|
7
3
|
field: string;
|
|
8
4
|
resourceId?: string | undefined;
|
|
9
5
|
constructor(resourceType: string, field: string, resourceId?: string | undefined);
|
|
10
6
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Error thrown when attempting to register a duplicate resource
|
|
13
|
-
* @see Requirements 15.1, 15.2, 15.3, 15.4, 15.5
|
|
14
|
-
*/
|
|
15
7
|
export declare class DuplicateRegistrationError extends Error {
|
|
16
8
|
resourceType: string;
|
|
17
9
|
identifier: string;
|
|
18
10
|
constructor(resourceType: string, identifier: string);
|
|
19
11
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Error thrown when an action execution exceeds its timeout
|
|
22
|
-
* @see Requirements 11.1, 11.2, 11.3, 11.4, 11.5
|
|
23
|
-
*/
|
|
24
12
|
export declare class ActionTimeoutError extends Error {
|
|
25
13
|
actionId: string;
|
|
26
14
|
timeoutMs: number;
|
|
27
15
|
constructor(actionId: string, timeoutMs: number);
|
|
28
16
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Error thrown when an action handler throws an error
|
|
31
|
-
* @see Requirements 3.1, 3.2, 3.3, 3.4, 3.5
|
|
32
|
-
*/
|
|
33
17
|
export declare class ActionExecutionError extends Error {
|
|
34
18
|
actionId: string;
|
|
35
19
|
cause: Error;
|
|
36
20
|
constructor(actionId: string, cause: Error);
|
|
37
21
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Logger interface for pluggable logging implementations
|
|
40
|
-
* @see Requirements 7.1, 7.2, 7.3, 7.4, 7.5, 7.6
|
|
41
|
-
*/
|
|
42
22
|
export interface Logger {
|
|
43
23
|
debug(message: string, ...args: unknown[]): void;
|
|
44
24
|
info(message: string, ...args: unknown[]): void;
|
|
45
25
|
warn(message: string, ...args: unknown[]): void;
|
|
46
26
|
error(message: string, ...args: unknown[]): void;
|
|
47
27
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Default console-based logger implementation
|
|
50
|
-
* @see Requirements 7.1, 7.2, 7.3, 7.4, 7.5, 7.6
|
|
51
|
-
*/
|
|
52
28
|
export declare class ConsoleLogger implements Logger {
|
|
53
29
|
debug(message: string, ...args: unknown[]): void;
|
|
54
30
|
info(message: string, ...args: unknown[]): void;
|
|
55
31
|
warn(message: string, ...args: unknown[]): void;
|
|
56
32
|
error(message: string, ...args: unknown[]): void;
|
|
57
33
|
}
|
|
58
|
-
/**
|
|
59
|
-
* Runtime lifecycle states
|
|
60
|
-
* @see Requirements 16.1, 16.2, 16.3, 16.4, 16.5
|
|
61
|
-
*/
|
|
62
34
|
export declare enum RuntimeState {
|
|
63
35
|
Uninitialized = "uninitialized",
|
|
64
36
|
Initializing = "initializing",
|
|
@@ -77,30 +49,16 @@ export interface ScreenDefinition {
|
|
|
77
49
|
title: string;
|
|
78
50
|
component: string;
|
|
79
51
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Action definition with generic type parameters for type-safe action handling
|
|
82
|
-
* @template P - Payload type (defaults to unknown for backward compatibility)
|
|
83
|
-
* @template R - Return type (defaults to unknown for backward compatibility)
|
|
84
|
-
* @see Requirements 6.1, 6.2, 6.3, 6.4, 6.5, 11.1, 11.2, 11.3, 11.4, 11.5
|
|
85
|
-
*/
|
|
86
52
|
export interface ActionDefinition<P = unknown, R = unknown> {
|
|
87
53
|
id: string;
|
|
88
54
|
handler: (params: P, context: RuntimeContext) => Promise<R> | R;
|
|
89
55
|
timeout?: number;
|
|
90
56
|
}
|
|
91
|
-
/**
|
|
92
|
-
* UIProvider interface with enhanced lifecycle methods
|
|
93
|
-
* @see Requirements 9.1, 9.2, 9.3, 9.4, 9.5
|
|
94
|
-
*/
|
|
95
57
|
export interface UIProvider {
|
|
96
58
|
mount(target: unknown, context: RuntimeContext): void | Promise<void>;
|
|
97
59
|
renderScreen(screen: ScreenDefinition): unknown | Promise<unknown>;
|
|
98
60
|
unmount?(): void | Promise<void>;
|
|
99
61
|
}
|
|
100
|
-
/**
|
|
101
|
-
* RuntimeContext provides a safe API facade for subsystems.
|
|
102
|
-
* @see Requirements 4.1, 4.2, 4.3, 4.4, 4.5, 10.1, 10.2, 10.3, 10.4, 10.5, 12.1, 12.2, 12.3, 12.4, 12.5, 13.1, 13.2, 13.3, 13.4, 13.5
|
|
103
|
-
*/
|
|
104
62
|
export interface RuntimeContext {
|
|
105
63
|
screens: {
|
|
106
64
|
registerScreen(screen: ScreenDefinition): () => void;
|
|
@@ -123,15 +81,7 @@ export interface RuntimeContext {
|
|
|
123
81
|
on(event: string, handler: (data: unknown) => void): () => void;
|
|
124
82
|
};
|
|
125
83
|
getRuntime(): Runtime;
|
|
126
|
-
/**
|
|
127
|
-
* Readonly access to host context injected at runtime initialization
|
|
128
|
-
* @see Requirements 1.3, 1.4, 9.2
|
|
129
|
-
*/
|
|
130
84
|
readonly host: Readonly<Record<string, unknown>>;
|
|
131
|
-
/**
|
|
132
|
-
* Introspection API for querying runtime metadata
|
|
133
|
-
* @see Requirements 3.1, 4.1, 5.1, 6.1, 9.2
|
|
134
|
-
*/
|
|
135
85
|
readonly introspect: IntrospectionAPI;
|
|
136
86
|
}
|
|
137
87
|
export interface Runtime {
|
|
@@ -139,44 +89,25 @@ export interface Runtime {
|
|
|
139
89
|
shutdown(): Promise<void>;
|
|
140
90
|
getContext(): RuntimeContext;
|
|
141
91
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Runtime initialization options
|
|
144
|
-
* @see Requirements 1.1, 9.1
|
|
145
|
-
*/
|
|
146
92
|
export interface RuntimeOptions {
|
|
147
93
|
logger?: Logger;
|
|
148
94
|
hostContext?: Record<string, unknown>;
|
|
95
|
+
enablePerformanceMonitoring?: boolean;
|
|
149
96
|
}
|
|
150
|
-
/**
|
|
151
|
-
* Action metadata returned by introspection (excludes handler function)
|
|
152
|
-
* @see Requirements 3.2, 3.4, 3.5, 9.3
|
|
153
|
-
*/
|
|
154
97
|
export interface ActionMetadata {
|
|
155
98
|
id: string;
|
|
156
99
|
timeout?: number;
|
|
157
100
|
}
|
|
158
|
-
/**
|
|
159
|
-
* Plugin metadata returned by introspection (excludes setup/dispose functions)
|
|
160
|
-
* @see Requirements 4.2, 4.4, 4.5, 9.4
|
|
161
|
-
*/
|
|
162
101
|
export interface PluginMetadata {
|
|
163
102
|
name: string;
|
|
164
103
|
version: string;
|
|
165
104
|
}
|
|
166
|
-
/**
|
|
167
|
-
* Runtime metadata with overall statistics
|
|
168
|
-
* @see Requirements 6.1, 6.2, 6.3, 6.4, 6.5, 9.5
|
|
169
|
-
*/
|
|
170
105
|
export interface IntrospectionMetadata {
|
|
171
106
|
runtimeVersion: string;
|
|
172
107
|
totalActions: number;
|
|
173
108
|
totalPlugins: number;
|
|
174
109
|
totalScreens: number;
|
|
175
110
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Introspection API for querying runtime metadata
|
|
178
|
-
* @see Requirements 3.1, 4.1, 5.1, 6.1, 9.2
|
|
179
|
-
*/
|
|
180
111
|
export interface IntrospectionAPI {
|
|
181
112
|
listActions(): string[];
|
|
182
113
|
getActionDefinition(id: string): ActionMetadata | null;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAQA,qBAAa,eAAgB,SAAQ,KAAK;IAE/B,YAAY,EAAE,MAAM;IACpB,KAAK,EAAE,MAAM;IACb,UAAU,CAAC,EAAE,MAAM;gBAF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