skeleton-crew-runtime 0.1.3 → 0.1.5

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.
Files changed (42) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/action-engine.d.ts +0 -75
  3. package/dist/action-engine.d.ts.map +1 -1
  4. package/dist/action-engine.js +13 -96
  5. package/dist/action-engine.js.map +1 -1
  6. package/dist/event-bus.d.ts +0 -44
  7. package/dist/event-bus.d.ts.map +1 -1
  8. package/dist/event-bus.js +13 -59
  9. package/dist/event-bus.js.map +1 -1
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/performance.d.ts +18 -0
  15. package/dist/performance.d.ts.map +1 -0
  16. package/dist/performance.js +31 -0
  17. package/dist/performance.js.map +1 -0
  18. package/dist/plugin-registry.d.ts +0 -8
  19. package/dist/plugin-registry.d.ts.map +1 -1
  20. package/dist/plugin-registry.js +2 -23
  21. package/dist/plugin-registry.js.map +1 -1
  22. package/dist/runtime-context.d.ts +17 -68
  23. package/dist/runtime-context.d.ts.map +1 -1
  24. package/dist/runtime-context.js +26 -99
  25. package/dist/runtime-context.js.map +1 -1
  26. package/dist/runtime.d.ts +3 -100
  27. package/dist/runtime.d.ts.map +1 -1
  28. package/dist/runtime.js +7 -136
  29. package/dist/runtime.js.map +1 -1
  30. package/dist/screen-registry.d.ts +0 -40
  31. package/dist/screen-registry.d.ts.map +1 -1
  32. package/dist/screen-registry.js +0 -44
  33. package/dist/screen-registry.js.map +1 -1
  34. package/dist/types.d.ts +2 -70
  35. package/dist/types.d.ts.map +1 -1
  36. package/dist/types.js +0 -27
  37. package/dist/types.js.map +1 -1
  38. package/dist/ui-bridge.d.ts +0 -27
  39. package/dist/ui-bridge.d.ts.map +1 -1
  40. package/dist/ui-bridge.js +0 -29
  41. package/dist/ui-bridge.js.map +1 -1
  42. package/package.json +1 -1
package/dist/runtime.d.ts CHANGED
@@ -1,11 +1,5 @@
1
- import type { RuntimeContext, UIProvider, PluginDefinition, RuntimeOptions } from './types.js';
1
+ import type { RuntimeContext, UIProvider, PluginDefinition, RuntimeOptions, Logger } from './types.js';
2
2
  import { RuntimeState } from './types.js';
3
- /**
4
- * Runtime is the main orchestrator that coordinates all subsystems.
5
- * Handles initialization, shutdown, and lifecycle state tracking.
6
- *
7
- * 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
8
- */
9
3
  export declare class Runtime {
10
4
  private plugins;
11
5
  private screens;
@@ -15,111 +9,20 @@ export declare class Runtime {
15
9
  private context;
16
10
  private initialized;
17
11
  private pendingPlugins;
18
- private logger;
12
+ readonly logger: Logger;
19
13
  private state;
20
14
  private hostContext;
21
- /**
22
- * Creates a new Runtime instance with optional configuration.
23
- *
24
- * @param options - Optional configuration object
25
- * @param options.logger - Custom logger implementation (defaults to ConsoleLogger)
26
- * @param options.hostContext - Host application services to inject (defaults to empty object)
27
- *
28
- * Requirements: 1.1, 1.5, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6
29
- */
15
+ private performanceMonitor;
30
16
  constructor(options?: RuntimeOptions);
31
- /**
32
- * Validates host context and logs warnings for common mistakes.
33
- * Does not throw errors or modify the context.
34
- *
35
- * @param context - The host context to validate
36
- *
37
- * Requirements: 2.1, 2.2, 2.3, 2.4
38
- */
39
17
  private validateHostContext;
40
- /**
41
- * Registers a plugin before initialization.
42
- * Plugins registered this way will have their setup callbacks executed during initialize().
43
- *
44
- * @param plugin - The plugin definition to register
45
- * @throws Error if runtime is already initialized
46
- */
47
18
  registerPlugin(plugin: PluginDefinition): void;
48
- /**
49
- * Initializes the runtime following the strict initialization sequence.
50
- * Creates all subsystems in order, then executes plugin setup callbacks.
51
- * Emits runtime:initialized event after successful initialization.
52
- *
53
- * @throws Error if initialize is called twice
54
- * @throws Error if any plugin setup fails
55
- *
56
- * 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
57
- */
58
19
  initialize(): Promise<void>;
59
- /**
60
- * Shuts down the runtime following the strict shutdown sequence.
61
- * Emits runtime:shutdown event at start of shutdown.
62
- * Disposes initialized plugins, shuts down UI provider, clears all registries, and releases resources.
63
- * Safe to call multiple times (idempotent).
64
- *
65
- * 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
66
- */
67
20
  shutdown(): Promise<void>;
68
- /**
69
- * Returns the RuntimeContext for this runtime instance.
70
- *
71
- * @returns The RuntimeContext
72
- * @throws Error if runtime is not initialized
73
- *
74
- * Requirement: 9.1
75
- */
76
21
  getContext(): RuntimeContext;
77
- /**
78
- * Returns whether the runtime has been initialized.
79
- *
80
- * @returns true if runtime is initialized, false otherwise
81
- *
82
- * Requirements: 16.1, 16.2, 16.3
83
- */
84
22
  isInitialized(): boolean;
85
- /**
86
- * Returns the current lifecycle state of the runtime.
87
- *
88
- * @returns The current RuntimeState
89
- *
90
- * Requirements: 16.1, 16.2, 16.3, 16.4, 16.5
91
- */
92
23
  getState(): RuntimeState;
93
- /**
94
- * Registers a UI provider with the runtime.
95
- * Delegates to UIBridge subsystem.
96
- * Can be called after initialization completes.
97
- *
98
- * @param provider - The UI provider implementation
99
- * @throws Error if provider is invalid or already registered
100
- *
101
- * Requirements: 10.3, 10.9
102
- */
103
24
  setUIProvider(provider: UIProvider): void;
104
- /**
105
- * Returns the registered UI provider.
106
- * Delegates to UIBridge subsystem.
107
- *
108
- * @returns The registered UIProvider or null if none registered
109
- *
110
- * Requirement: 10.4
111
- */
112
25
  getUIProvider(): UIProvider | null;
113
- /**
114
- * Renders a screen by looking it up in the ScreenRegistry and delegating to UIBridge.
115
- *
116
- * @param screenId - The screen identifier to render
117
- * @returns The result from the UI provider's render method
118
- * @throws Error if screen is not found
119
- * @throws Error if no UI provider is registered
120
- *
121
- * Requirement: 10.5
122
- */
123
26
  renderScreen(screenId: string): unknown;
124
27
  }
125
28
  //# sourceMappingURL=runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,EAAU,MAAM,YAAY,CAAC;AACvG,OAAO,EAAiB,YAAY,EAAE,MAAM,YAAY,CAAC;AAQzD;;;;;GAKG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,EAAE,CAAY;IACtB,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,cAAc,CAA0B;IAChD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAA4C;IACzD,OAAO,CAAC,WAAW,CAA0B;IAE7C;;;;;;;;OAQG;gBACS,OAAO,CAAC,EAAE,cAAc;IAMpC;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IA2B3B;;;;;;OAMG;IACH,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAO9C;;;;;;;;;OASG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAiEjC;;;;;;;OAOG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAwC/B;;;;;;;OAOG;IACH,UAAU,IAAI,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EAAE,UAAU,GAAG,IAAI;IAYzC,aAAa,IAAI,UAAU,GAAG,IAAI;IAclC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAYxC"}
package/dist/runtime.js CHANGED
@@ -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
- this.context = new RuntimeContextImpl(this.screens, this.actions, this.plugins, this.events, this, this.hostContext);
122
- // 7. Pass RuntimeContext to ActionEngine (Requirement 9.9)
69
+ this.context = new RuntimeContextImpl(this.screens, this.actions, this.plugins, this.events, this, this.hostContext, this.logger);
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
  }
@@ -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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} 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 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;AAG3D;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IAK1B;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,IAAI;IA2BpD;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAI9C;;;;;;;OAOG;IACH,aAAa,IAAI,gBAAgB,EAAE;IAInC;;;;;OAKG;IACH,KAAK,IAAI,IAAI;CAGd"}
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"}
@@ -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;AAEzE;;;;;GAKG;AACH,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;IAED;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,MAAwB;QACrC,+FAA+F;QAC/F,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,OAAO,MAAM,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;YAChD,MAAM,IAAI,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC5C,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,IAAI,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1D,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC9D,MAAM,IAAI,eAAe,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,qEAAqE;QACrE,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,0BAA0B,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CA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