skeleton-crew-runtime 0.1.1

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.
@@ -0,0 +1,257 @@
1
+ import { ConsoleLogger, RuntimeState } from './types.js';
2
+ import { PluginRegistry } from './plugin-registry.js';
3
+ import { ScreenRegistry } from './screen-registry.js';
4
+ import { ActionEngine } from './action-engine.js';
5
+ import { EventBus } from './event-bus.js';
6
+ import { UIBridge } from './ui-bridge.js';
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
+ */
14
+ export class Runtime {
15
+ plugins;
16
+ screens;
17
+ actions;
18
+ events;
19
+ ui;
20
+ context;
21
+ initialized = false;
22
+ pendingPlugins = [];
23
+ logger;
24
+ state = RuntimeState.Uninitialized;
25
+ 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
+ */
35
+ constructor(options) {
36
+ this.logger = options?.logger ?? new ConsoleLogger();
37
+ this.hostContext = options?.hostContext ?? {};
38
+ this.validateHostContext(this.hostContext);
39
+ }
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
+ validateHostContext(context) {
49
+ // Fast path for empty context
50
+ if (Object.keys(context).length === 0) {
51
+ return;
52
+ }
53
+ // Check each key in the context
54
+ Object.entries(context).forEach(([key, value]) => {
55
+ // Check for large objects (> 1MB)
56
+ try {
57
+ const size = JSON.stringify(value).length;
58
+ if (size > 1024 * 1024) {
59
+ this.logger.warn(`Host context key "${key}" is large (${size} bytes)`);
60
+ }
61
+ }
62
+ catch (error) {
63
+ // JSON.stringify can fail for circular references or other issues
64
+ // Log but don't fail validation
65
+ this.logger.warn(`Host context key "${key}" could not be serialized for size check`);
66
+ }
67
+ // Check for function values
68
+ if (typeof value === 'function') {
69
+ this.logger.warn(`Host context key "${key}" is a function. Consider wrapping it in an object.`);
70
+ }
71
+ });
72
+ }
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
+ registerPlugin(plugin) {
81
+ if (this.initialized) {
82
+ throw new Error('Cannot register plugins after initialization. Use context.plugins.registerPlugin() instead.');
83
+ }
84
+ this.pendingPlugins.push(plugin);
85
+ }
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
+ async initialize() {
97
+ // Throw error if initialize called twice (Requirement 15.1)
98
+ if (this.initialized) {
99
+ throw new Error('Runtime already initialized');
100
+ }
101
+ // Set state to Initializing (Requirement 16.2)
102
+ this.state = RuntimeState.Initializing;
103
+ try {
104
+ // Strict initialization sequence (Requirements 2.1, 2.2, 2.3, 2.4)
105
+ // 1. Create PluginRegistry (Requirement 2.1)
106
+ this.plugins = new PluginRegistry(this.logger);
107
+ // Register pending plugins
108
+ for (const plugin of this.pendingPlugins) {
109
+ this.plugins.registerPlugin(plugin);
110
+ }
111
+ this.pendingPlugins = [];
112
+ // 2. Create ScreenRegistry (Requirement 2.2)
113
+ this.screens = new ScreenRegistry(this.logger);
114
+ // 3. Create ActionEngine (Requirement 2.3)
115
+ this.actions = new ActionEngine(this.logger);
116
+ // 4. Create EventBus (Requirement 2.4)
117
+ this.events = new EventBus(this.logger);
118
+ // 5. Create UIBridge
119
+ 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)
123
+ 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
+ await this.plugins.executeSetup(this.context);
127
+ // Mark as initialized
128
+ this.initialized = true;
129
+ // Set state to Initialized (Requirement 16.2)
130
+ this.state = RuntimeState.Initialized;
131
+ // Emit runtime:initialized event (Requirements 17.1, 17.2, 17.3)
132
+ this.events.emit('runtime:initialized', { context: this.context });
133
+ }
134
+ catch (error) {
135
+ // Reset state to Uninitialized on failure (Requirement 16.5)
136
+ this.state = RuntimeState.Uninitialized;
137
+ throw error;
138
+ }
139
+ }
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
+ async shutdown() {
149
+ // Make shutdown idempotent - safe to call multiple times (Requirement 4.5)
150
+ if (!this.initialized) {
151
+ return;
152
+ }
153
+ // Set state to ShuttingDown (Requirement 16.4)
154
+ this.state = RuntimeState.ShuttingDown;
155
+ // Emit runtime:shutdown event (Requirements 17.4, 17.5)
156
+ 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
+ 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
+ try {
163
+ await this.ui.shutdown();
164
+ }
165
+ catch (error) {
166
+ this.logger.error('UIBridge shutdown failed', error);
167
+ }
168
+ // 3. Clear all registries (Requirement 4.5)
169
+ this.screens.clear();
170
+ this.actions.clear();
171
+ this.events.clear();
172
+ this.plugins.clear();
173
+ // 4. Set initialized flag to false (Requirement 4.5)
174
+ this.initialized = false;
175
+ // Set state to Shutdown (Requirement 16.4)
176
+ this.state = RuntimeState.Shutdown;
177
+ }
178
+ /**
179
+ * Returns the RuntimeContext for this runtime instance.
180
+ *
181
+ * @returns The RuntimeContext
182
+ * @throws Error if runtime is not initialized
183
+ *
184
+ * Requirement: 9.1
185
+ */
186
+ getContext() {
187
+ if (!this.initialized) {
188
+ throw new Error('Runtime not initialized');
189
+ }
190
+ return this.context;
191
+ }
192
+ /**
193
+ * Returns whether the runtime has been initialized.
194
+ *
195
+ * @returns true if runtime is initialized, false otherwise
196
+ *
197
+ * Requirements: 16.1, 16.2, 16.3
198
+ */
199
+ isInitialized() {
200
+ return this.state === RuntimeState.Initialized;
201
+ }
202
+ /**
203
+ * Returns the current lifecycle state of the runtime.
204
+ *
205
+ * @returns The current RuntimeState
206
+ *
207
+ * Requirements: 16.1, 16.2, 16.3, 16.4, 16.5
208
+ */
209
+ getState() {
210
+ return this.state;
211
+ }
212
+ /**
213
+ * Registers a UI provider with the runtime.
214
+ * Delegates to UIBridge subsystem.
215
+ * Can be called after initialization completes.
216
+ *
217
+ * @param provider - The UI provider implementation
218
+ * @throws Error if provider is invalid or already registered
219
+ *
220
+ * Requirements: 10.3, 10.9
221
+ */
222
+ setUIProvider(provider) {
223
+ this.ui.setProvider(provider);
224
+ }
225
+ /**
226
+ * Returns the registered UI provider.
227
+ * Delegates to UIBridge subsystem.
228
+ *
229
+ * @returns The registered UIProvider or null if none registered
230
+ *
231
+ * Requirement: 10.4
232
+ */
233
+ getUIProvider() {
234
+ return this.ui.getProvider();
235
+ }
236
+ /**
237
+ * Renders a screen by looking it up in the ScreenRegistry and delegating to UIBridge.
238
+ *
239
+ * @param screenId - The screen identifier to render
240
+ * @returns The result from the UI provider's render method
241
+ * @throws Error if screen is not found
242
+ * @throws Error if no UI provider is registered
243
+ *
244
+ * Requirement: 10.5
245
+ */
246
+ renderScreen(screenId) {
247
+ // Look up the screen in the registry
248
+ const screen = this.screens.getScreen(screenId);
249
+ // Throw if screen not found
250
+ if (screen === null) {
251
+ throw new Error(`Screen with id "${screenId}" not found`);
252
+ }
253
+ // Delegate to UIBridge to render the screen
254
+ return this.ui.renderScreen(screen);
255
+ }
256
+ }
257
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +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,EA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AC;IAChC,CAAC;IAED;;;;;;;OAOG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC;IAED;;;;;;;;;OASG;IACH,YAAY,CAAC,QAAgB;QAC3B,qCAAqC;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAEhD,4BAA4B;QAC5B,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,aAAa,CAAC,CAAC;QAC5D,CAAC;QAED,4CAA4C;QAC5C,OAAO,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -0,0 +1,51 @@
1
+ import type { ScreenDefinition, Logger } 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
+ export declare class ScreenRegistry {
9
+ private screens;
10
+ private logger;
11
+ 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
+ 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
+ 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
+ getAllScreens(): ScreenDefinition[];
43
+ /**
44
+ * Clears all registered screens.
45
+ * Used during shutdown to release resources.
46
+ *
47
+ * Requirement: 13.5
48
+ */
49
+ clear(): void;
50
+ }
51
+ //# sourceMappingURL=screen-registry.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,82 @@
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
+ export class ScreenRegistry {
9
+ screens;
10
+ logger;
11
+ constructor(logger) {
12
+ this.screens = new Map();
13
+ this.logger = logger;
14
+ }
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
+ registerScreen(screen) {
28
+ // Validate required fields before any state modification (Requirements 18.1, 18.2, 18.3, 18.5)
29
+ if (!screen.id || typeof screen.id !== 'string') {
30
+ throw new ValidationError('Screen', 'id');
31
+ }
32
+ if (!screen.title || typeof screen.title !== 'string') {
33
+ throw new ValidationError('Screen', 'title', screen.id);
34
+ }
35
+ if (!screen.component || typeof screen.component !== 'string') {
36
+ throw new ValidationError('Screen', 'component', screen.id);
37
+ }
38
+ // Check for duplicate ID (Requirements 15.1, 15.2, 15.3, 15.4, 15.5)
39
+ if (this.screens.has(screen.id)) {
40
+ throw new DuplicateRegistrationError('Screen', screen.id);
41
+ }
42
+ // Register the screen
43
+ this.screens.set(screen.id, screen);
44
+ 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
+ return () => {
47
+ this.screens.delete(screen.id);
48
+ };
49
+ }
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
+ getScreen(id) {
59
+ return this.screens.get(id) ?? null;
60
+ }
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
+ getAllScreens() {
70
+ return Array.from(this.screens.values());
71
+ }
72
+ /**
73
+ * Clears all registered screens.
74
+ * Used during shutdown to release resources.
75
+ *
76
+ * Requirement: 13.5
77
+ */
78
+ clear() {
79
+ this.screens.clear();
80
+ }
81
+ }
82
+ //# sourceMappingURL=screen-registry.js.map
@@ -0,0 +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,CAAC,CAAC;QAC5D,CAAC;QAED,sBAAsB;QACtB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,MAAM,CAAC,EAAE,2BAA2B,CAAC,CAAC;QAEnE,+EAA+E;QAC/E,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACjC,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,SAAS,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;IACtC,CAAC;IAED;;;;;;;OAOG;IACH,aAAa;QACX,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACH,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,189 @@
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
+ export declare class ValidationError extends Error {
6
+ resourceType: string;
7
+ field: string;
8
+ resourceId?: string | undefined;
9
+ constructor(resourceType: string, field: string, resourceId?: string | undefined);
10
+ }
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
+ export declare class DuplicateRegistrationError extends Error {
16
+ resourceType: string;
17
+ identifier: string;
18
+ constructor(resourceType: string, identifier: string);
19
+ }
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
+ export declare class ActionTimeoutError extends Error {
25
+ actionId: string;
26
+ timeoutMs: number;
27
+ constructor(actionId: string, timeoutMs: number);
28
+ }
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
+ export declare class ActionExecutionError extends Error {
34
+ actionId: string;
35
+ cause: Error;
36
+ constructor(actionId: string, cause: Error);
37
+ }
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
+ export interface Logger {
43
+ debug(message: string, ...args: unknown[]): void;
44
+ info(message: string, ...args: unknown[]): void;
45
+ warn(message: string, ...args: unknown[]): void;
46
+ error(message: string, ...args: unknown[]): void;
47
+ }
48
+ /**
49
+ * Default console-based logger implementation
50
+ * @see Requirements 7.1, 7.2, 7.3, 7.4, 7.5, 7.6
51
+ */
52
+ export declare class ConsoleLogger implements Logger {
53
+ debug(message: string, ...args: unknown[]): void;
54
+ info(message: string, ...args: unknown[]): void;
55
+ warn(message: string, ...args: unknown[]): void;
56
+ error(message: string, ...args: unknown[]): void;
57
+ }
58
+ /**
59
+ * Runtime lifecycle states
60
+ * @see Requirements 16.1, 16.2, 16.3, 16.4, 16.5
61
+ */
62
+ export declare enum RuntimeState {
63
+ Uninitialized = "uninitialized",
64
+ Initializing = "initializing",
65
+ Initialized = "initialized",
66
+ ShuttingDown = "shutting_down",
67
+ Shutdown = "shutdown"
68
+ }
69
+ export interface PluginDefinition {
70
+ name: string;
71
+ version: string;
72
+ setup: (context: RuntimeContext) => void | Promise<void>;
73
+ dispose?: (context: RuntimeContext) => void | Promise<void>;
74
+ }
75
+ export interface ScreenDefinition {
76
+ id: string;
77
+ title: string;
78
+ component: string;
79
+ }
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
+ export interface ActionDefinition<P = unknown, R = unknown> {
87
+ id: string;
88
+ handler: (params: P, context: RuntimeContext) => Promise<R> | R;
89
+ timeout?: number;
90
+ }
91
+ /**
92
+ * UIProvider interface with enhanced lifecycle methods
93
+ * @see Requirements 9.1, 9.2, 9.3, 9.4, 9.5
94
+ */
95
+ export interface UIProvider {
96
+ mount(target: unknown, context: RuntimeContext): void | Promise<void>;
97
+ renderScreen(screen: ScreenDefinition): unknown | Promise<unknown>;
98
+ unmount?(): void | Promise<void>;
99
+ }
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
+ export interface RuntimeContext {
105
+ screens: {
106
+ registerScreen(screen: ScreenDefinition): () => void;
107
+ getScreen(id: string): ScreenDefinition | null;
108
+ getAllScreens(): ScreenDefinition[];
109
+ };
110
+ actions: {
111
+ registerAction<P = unknown, R = unknown>(action: ActionDefinition<P, R>): () => void;
112
+ runAction<P = unknown, R = unknown>(id: string, params?: P): Promise<R>;
113
+ };
114
+ plugins: {
115
+ registerPlugin(plugin: PluginDefinition): void;
116
+ getPlugin(name: string): PluginDefinition | null;
117
+ getAllPlugins(): PluginDefinition[];
118
+ getInitializedPlugins(): string[];
119
+ };
120
+ events: {
121
+ emit(event: string, data?: unknown): void;
122
+ emitAsync(event: string, data?: unknown): Promise<void>;
123
+ on(event: string, handler: (data: unknown) => void): () => void;
124
+ };
125
+ getRuntime(): Runtime;
126
+ /**
127
+ * Readonly access to host context injected at runtime initialization
128
+ * @see Requirements 1.3, 1.4, 9.2
129
+ */
130
+ 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
+ readonly introspect: IntrospectionAPI;
136
+ }
137
+ export interface Runtime {
138
+ initialize(): Promise<void>;
139
+ shutdown(): Promise<void>;
140
+ getContext(): RuntimeContext;
141
+ }
142
+ /**
143
+ * Runtime initialization options
144
+ * @see Requirements 1.1, 9.1
145
+ */
146
+ export interface RuntimeOptions {
147
+ logger?: Logger;
148
+ hostContext?: Record<string, unknown>;
149
+ }
150
+ /**
151
+ * Action metadata returned by introspection (excludes handler function)
152
+ * @see Requirements 3.2, 3.4, 3.5, 9.3
153
+ */
154
+ export interface ActionMetadata {
155
+ id: string;
156
+ timeout?: number;
157
+ }
158
+ /**
159
+ * Plugin metadata returned by introspection (excludes setup/dispose functions)
160
+ * @see Requirements 4.2, 4.4, 4.5, 9.4
161
+ */
162
+ export interface PluginMetadata {
163
+ name: string;
164
+ version: string;
165
+ }
166
+ /**
167
+ * Runtime metadata with overall statistics
168
+ * @see Requirements 6.1, 6.2, 6.3, 6.4, 6.5, 9.5
169
+ */
170
+ export interface IntrospectionMetadata {
171
+ runtimeVersion: string;
172
+ totalActions: number;
173
+ totalPlugins: number;
174
+ totalScreens: number;
175
+ }
176
+ /**
177
+ * Introspection API for querying runtime metadata
178
+ * @see Requirements 3.1, 4.1, 5.1, 6.1, 9.2
179
+ */
180
+ export interface IntrospectionAPI {
181
+ listActions(): string[];
182
+ getActionDefinition(id: string): ActionMetadata | null;
183
+ listPlugins(): string[];
184
+ getPluginDefinition(name: string): PluginMetadata | null;
185
+ listScreens(): string[];
186
+ getScreenDefinition(id: string): ScreenDefinition | null;
187
+ getMetadata(): IntrospectionMetadata;
188
+ }
189
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@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