@springfield/ham-radio-registry 1.0.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ ## [1.0.1](https://gitlab.com/springfield-ham-radio/app/ham-radio-registry/compare/v1.0.0...v1.0.1) (2025-06-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add publishConfig to package.json for public access ([e8203b0](https://gitlab.com/springfield-ham-radio/app/ham-radio-registry/commit/e8203b0945144ef6c20ec5f945f507b1df3eb326))
7
+
8
+ ## 1.0.0 (2025-06-24)
9
+
10
+
11
+ ### Features
12
+
13
+ * add GitLab CI configuration and update dependencies ([399f533](https://gitlab.com/springfield-ham-radio/app/ham-radio-registry/commit/399f5332bb5b4e89482ef1a348a28c5f24051c9f))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * update @springfield/ham-radio-api dependency to version 16.0.0 ([dfced1c](https://gitlab.com/springfield-ham-radio/app/ham-radio-registry/commit/dfced1c7a3fc09b359c9295eeca2b29324c4a391))
19
+ * update @springfield/ham-radio-api dependency to version 16.1.0 and refactor type imports ([4253a24](https://gitlab.com/springfield-ham-radio/app/ham-radio-registry/commit/4253a24688ad45815763eb9cccd4de1e19d3c10d))
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # ham-radio-registry
2
+
3
+
4
+
5
+ ## Getting started
6
+
7
+ To make it easy for you to get started with GitLab, here's a list of recommended next steps.
8
+
9
+ Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
10
+
11
+ ## Add your files
12
+
13
+ - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
14
+ - [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
15
+
16
+ ```
17
+ cd existing_repo
18
+ git remote add origin https://gitlab.com/springfield-ham-radio/app/ham-radio-registry.git
19
+ git branch -M main
20
+ git push -uf origin main
21
+ ```
22
+
23
+ ## Integrate with your tools
24
+
25
+ - [ ] [Set up project integrations](https://gitlab.com/springfield-ham-radio/app/ham-radio-registry/-/settings/integrations)
26
+
27
+ ## Collaborate with your team
28
+
29
+ - [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
30
+ - [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
31
+ - [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
32
+ - [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
33
+ - [ ] [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
34
+
35
+ ## Test and Deploy
36
+
37
+ Use the built-in continuous integration in GitLab.
38
+
39
+ - [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/)
40
+ - [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
41
+ - [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
42
+ - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
43
+ - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
44
+
45
+ ***
46
+
47
+ # Editing this README
48
+
49
+ When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
50
+
51
+ ## Suggestions for a good README
52
+
53
+ Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
54
+
55
+ ## Name
56
+ Choose a self-explaining name for your project.
57
+
58
+ ## Description
59
+ Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
60
+
61
+ ## Badges
62
+ On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
63
+
64
+ ## Visuals
65
+ Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
66
+
67
+ ## Installation
68
+ Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
69
+
70
+ ## Usage
71
+ Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
72
+
73
+ ## Support
74
+ Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
75
+
76
+ ## Roadmap
77
+ If you have ideas for releases in the future, it is a good idea to list them in the README.
78
+
79
+ ## Contributing
80
+ State if you are open to contributions and what your requirements are for accepting them.
81
+
82
+ For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
83
+
84
+ You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
85
+
86
+ ## Authors and acknowledgment
87
+ Show your appreciation to those who have contributed to the project.
88
+
89
+ ## License
90
+ For open source projects, say how it is licensed.
91
+
92
+ ## Project status
93
+ If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
@@ -0,0 +1,10 @@
1
+ export type { RadioConfigMetadata, RadioCapabilities, CodecConfig, } from './types/radio-config.js';
2
+ export type { ValidationResult } from '@springfield/ham-radio-api';
3
+ export type { PluginModule, PluginCapabilities, SpringfieldPluginConfig, NpmPluginInfo, PluginManifest, PluginManifestConfiguration, PluginSharedComponents, PluginSecurity, } from './types/plugin-module.js';
4
+ import type { RadioConfigRegistry } from './registry/config-registry.js';
5
+ export type { SharedComponentManager } from '@springfield/ham-radio-api';
6
+ export { DefaultSharedComponentManager } from './registry/shared-components.js';
7
+ export type { NpmClient } from './utils/npm-client.js';
8
+ export { DefaultNpmClient } from './utils/npm-client.js';
9
+ export declare function createRegistry(logger: any): RadioConfigRegistry;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,GACZ,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACb,cAAc,EACd,2BAA2B,EAC3B,sBAAsB,EACtB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAIzE,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAGhF,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,wBAAgB,cAAc,CAAC,MAAM,EAAE,GAAG,GAAG,mBAAmB,CAE/D"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ import { NpmBasedConfigRegistry } from './registry/config-registry.js';
2
+ export { DefaultSharedComponentManager } from './registry/shared-components.js';
3
+ export { DefaultNpmClient } from './utils/npm-client.js';
4
+ // Factory function for creating registry instances
5
+ export function createRegistry(logger) {
6
+ return new NpmBasedConfigRegistry(logger);
7
+ }
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAIvE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAIhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,mDAAmD;AACnD,MAAM,UAAU,cAAc,CAAC,MAAW;IACxC,OAAO,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { ILogLayer } from 'loglayer';
2
+ import type { RadioModelId, RadioCodec, ValidationResult } from '@springfield/ham-radio-api';
3
+ import type { RegistryRadio } from '../types/radio-config.js';
4
+ import type { PluginModule } from '../types/plugin-module.js';
5
+ /**
6
+ * Radio configuration registry interface
7
+ */
8
+ export interface RadioConfigRegistry {
9
+ discoverConfigurations(): Promise<RegistryRadio[]>;
10
+ getConfiguration(configId: string): Promise<RegistryRadio | null>;
11
+ getConfigurationsByManufacturer(manufacturer: string): Promise<RegistryRadio[]>;
12
+ getConfigurationsByModule(moduleId: string): Promise<RegistryRadio[]>;
13
+ validateConfiguration(config: RegistryRadio): ValidationResult;
14
+ registerConfiguration(config: RegistryRadio): Promise<void>;
15
+ installPlugin(moduleId: string): Promise<void>;
16
+ listInstalledPlugins(): Promise<PluginModule[]>;
17
+ getCodec(modelId: RadioModelId): Promise<RadioCodec | null>;
18
+ }
19
+ /**
20
+ * NPM-based configuration registry implementation
21
+ */
22
+ export declare class NpmBasedConfigRegistry implements RadioConfigRegistry {
23
+ private configCache;
24
+ private pluginCache;
25
+ private codecCache;
26
+ private sharedComponentManager;
27
+ private npmClient;
28
+ private logger;
29
+ constructor(logger: ILogLayer);
30
+ discoverConfigurations(): Promise<RegistryRadio[]>;
31
+ getConfiguration(configId: string): Promise<RegistryRadio | null>;
32
+ getConfigurationsByManufacturer(manufacturer: string): Promise<RegistryRadio[]>;
33
+ getConfigurationsByModule(moduleId: string): Promise<RegistryRadio[]>;
34
+ validateConfiguration(config: RegistryRadio): ValidationResult;
35
+ registerConfiguration(config: RegistryRadio): Promise<void>;
36
+ installPlugin(moduleId: string): Promise<void>;
37
+ listInstalledPlugins(): Promise<PluginModule[]>;
38
+ getCodec(modelId: RadioModelId): Promise<RadioCodec | null>;
39
+ private discoverPluginModules;
40
+ private isRadioModule;
41
+ private loadPluginModule;
42
+ private loadConfigurationsFromPlugin;
43
+ private findConfigFiles;
44
+ private loadConfiguration;
45
+ private resolveSharedComponents;
46
+ private loadCodecFromConfig;
47
+ private validatePlugin;
48
+ private isVersionCompatible;
49
+ private runPackageManager;
50
+ }
51
+ //# sourceMappingURL=config-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-registry.d.ts","sourceRoot":"","sources":["../../src/registry/config-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAS9D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAElC,sBAAsB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAGnD,gBAAgB,CAAC,QAAQ,EAAE,MAA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O,CAAC,IAAI,CAAC;IAU3D,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB9C,oBAAoB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAI/C,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;YAqBnD,qBAAqB;IAmCnC,OAAO,CAAC,aAAa;YAeP,gBAAgB;YAgBhB,4BAA4B;YAoC5B,eAAe;YASf,iBAAiB;YAKjB,uBAAuB;YAavB,mBAAmB;YAanB,cAAc;IA4B5B,OAAO,CAAC,mBAAmB;YAMb,iBAAiB;CAWhC"}
@@ -0,0 +1,280 @@
1
+ import { DefaultSharedComponentManager } from './shared-components.js';
2
+ import { DefaultNpmClient } from '../utils/npm-client.js';
3
+ import { readdir, readFile } from 'fs/promises';
4
+ import { join } from 'path';
5
+ import { existsSync } from 'fs';
6
+ /**
7
+ * NPM-based configuration registry implementation
8
+ */
9
+ export class NpmBasedConfigRegistry {
10
+ configCache = new Map();
11
+ pluginCache = new Map();
12
+ codecCache = new Map();
13
+ sharedComponentManager;
14
+ npmClient;
15
+ logger;
16
+ constructor(logger) {
17
+ this.logger = logger;
18
+ this.sharedComponentManager = new DefaultSharedComponentManager(logger);
19
+ this.npmClient = new DefaultNpmClient(logger);
20
+ }
21
+ async discoverConfigurations() {
22
+ const configs = [];
23
+ // Discover plugin modules from node_modules
24
+ const pluginModules = await this.discoverPluginModules();
25
+ for (const plugin of pluginModules) {
26
+ try {
27
+ const pluginConfigs = await this.loadConfigurationsFromPlugin(plugin);
28
+ configs.push(...pluginConfigs);
29
+ }
30
+ catch (error) {
31
+ this.logger.withError(error).warn('Failed to load configurations from plugin ' + plugin.name);
32
+ }
33
+ }
34
+ return configs;
35
+ }
36
+ async getConfiguration(configId) {
37
+ // Check cache first
38
+ if (this.configCache.has(configId)) {
39
+ return this.configCache.get(configId);
40
+ }
41
+ // Discover configurations if cache is empty
42
+ if (this.configCache.size === 0) {
43
+ await this.discoverConfigurations();
44
+ }
45
+ return this.configCache.get(configId) || null;
46
+ }
47
+ async getConfigurationsByManufacturer(manufacturer) {
48
+ const configs = await this.discoverConfigurations();
49
+ return configs.filter((config) => config.id.manufacturer.toLowerCase() === manufacturer.toLowerCase());
50
+ }
51
+ async getConfigurationsByModule(moduleId) {
52
+ const configs = await this.discoverConfigurations();
53
+ return configs.filter((config) => config.metadata.moduleId === moduleId);
54
+ }
55
+ validateConfiguration(config) {
56
+ const errors = [];
57
+ const warnings = [];
58
+ // Basic validation
59
+ if (!config.id?.model) {
60
+ errors.push('Configuration must have a valid model ID');
61
+ }
62
+ if (!config.serialConfig) {
63
+ errors.push('Configuration must have serial configuration');
64
+ }
65
+ if (!config.memoryConfig) {
66
+ errors.push('Configuration must have memory configuration');
67
+ }
68
+ if (!config.readMemory || config.readMemory.length === 0) {
69
+ errors.push('Configuration must have read memory protocol');
70
+ }
71
+ if (!config.writeMemory || config.writeMemory.length === 0) {
72
+ errors.push('Configuration must have write memory protocol');
73
+ }
74
+ // Schema validation
75
+ if (!config.settingsSchema) {
76
+ errors.push('Configuration must have settings schema');
77
+ }
78
+ return {
79
+ isValid: errors.length === 0,
80
+ errors,
81
+ warnings,
82
+ };
83
+ }
84
+ async registerConfiguration(config) {
85
+ const validation = this.validateConfiguration(config);
86
+ if (!validation.isValid) {
87
+ throw new Error(`Invalid configuration: ${validation.errors.join(', ')}`);
88
+ }
89
+ this.configCache.set(config.id.model, config);
90
+ this.logger.withMetadata({ modelId: config.id.model }).info('Registered configuration');
91
+ }
92
+ async installPlugin(moduleId) {
93
+ // Validate plugin before installation
94
+ const validation = await this.validatePlugin(moduleId);
95
+ if (!validation.isValid) {
96
+ throw new Error(`Plugin validation failed: ${validation.errors.join(', ')}`);
97
+ }
98
+ // Install using yarn
99
+ await this.runPackageManager(['add', moduleId]);
100
+ // Refresh configuration registry
101
+ await this.discoverConfigurations();
102
+ this.logger.withMetadata({ moduleId }).info('Installed plugin');
103
+ }
104
+ async listInstalledPlugins() {
105
+ return Array.from(this.pluginCache.values());
106
+ }
107
+ async getCodec(modelId) {
108
+ // Check cache first
109
+ if (this.codecCache.has(modelId)) {
110
+ return this.codecCache.get(modelId);
111
+ }
112
+ // Find configuration for this model
113
+ const config = await this.getConfiguration(modelId);
114
+ if (!config || !config.codec) {
115
+ return null;
116
+ }
117
+ // Load codec based on configuration
118
+ const codec = await this.loadCodecFromConfig(config);
119
+ if (codec) {
120
+ this.codecCache.set(modelId, codec);
121
+ }
122
+ return codec;
123
+ }
124
+ async discoverPluginModules() {
125
+ const plugins = [];
126
+ // Scan node_modules for radio modules
127
+ const nodeModulesPath = join(process.cwd(), 'node_modules');
128
+ if (!existsSync(nodeModulesPath)) {
129
+ return plugins;
130
+ }
131
+ const entries = await readdir(nodeModulesPath, { withFileTypes: true });
132
+ for (const entry of entries) {
133
+ if (entry.isDirectory()) {
134
+ const packageJsonPath = join(nodeModulesPath, entry.name, 'package.json');
135
+ try {
136
+ const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf8'));
137
+ // Check if this is a radio module
138
+ if (this.isRadioModule(packageJson)) {
139
+ const plugin = await this.loadPluginModule(entry.name, packageJson);
140
+ plugins.push(plugin);
141
+ this.pluginCache.set(entry.name, plugin);
142
+ }
143
+ }
144
+ catch (error) {
145
+ // Skip invalid packages
146
+ this.logger.withMetadata({ name: entry.name, error }).debug('Skipped invalid package');
147
+ }
148
+ }
149
+ }
150
+ return plugins;
151
+ }
152
+ isRadioModule(packageJson) {
153
+ const name = packageJson.name || '';
154
+ // Check naming convention
155
+ const isNamedCorrectly = name.includes('radio-module') || name.startsWith('@springfield/radio-module-');
156
+ // Check springfield plugin field
157
+ const hasSpringfieldField = packageJson.springfield?.pluginType === 'radio-module';
158
+ // Check keywords
159
+ const hasKeywords = packageJson.keywords?.includes('radio-module');
160
+ return isNamedCorrectly || hasSpringfieldField || hasKeywords;
161
+ }
162
+ async loadPluginModule(moduleName, packageJson) {
163
+ const modulePath = join(process.cwd(), 'node_modules', moduleName);
164
+ const springfieldConfig = packageJson.springfield || {};
165
+ return {
166
+ name: moduleName,
167
+ version: packageJson.version,
168
+ manufacturer: springfieldConfig.manufacturer,
169
+ configPath: join(modulePath, springfieldConfig.configPath || 'configs'),
170
+ sharedPath: join(modulePath, springfieldConfig.sharedPath || 'shared'),
171
+ codecFactoryPath: springfieldConfig.codecFactory ? join(modulePath, springfieldConfig.codecFactory) : undefined,
172
+ capabilities: springfieldConfig.capabilities || {},
173
+ packageJson,
174
+ };
175
+ }
176
+ async loadConfigurationsFromPlugin(plugin) {
177
+ const configs = [];
178
+ try {
179
+ const configFiles = await this.findConfigFiles(plugin.configPath);
180
+ for (const configFile of configFiles) {
181
+ try {
182
+ const config = await this.loadConfiguration(configFile);
183
+ // Resolve shared component references
184
+ await this.resolveSharedComponents(config, plugin);
185
+ // Add plugin metadata
186
+ config.metadata = {
187
+ ...config.metadata,
188
+ moduleId: plugin.name,
189
+ moduleVersion: plugin.version,
190
+ pluginPath: plugin.configPath,
191
+ };
192
+ if (this.validateConfiguration(config).isValid) {
193
+ configs.push(config);
194
+ this.configCache.set(config.id.model, config);
195
+ }
196
+ }
197
+ catch (error) {
198
+ this.logger.withError(error).warn(`Failed to load configuration from ${configFile}:`);
199
+ }
200
+ }
201
+ }
202
+ catch (error) {
203
+ this.logger.withError(error).warn(`Failed to access plugin directory ${plugin.configPath}:`);
204
+ }
205
+ return configs;
206
+ }
207
+ async findConfigFiles(configPath) {
208
+ if (!existsSync(configPath)) {
209
+ return [];
210
+ }
211
+ const files = await readdir(configPath);
212
+ return files.filter((file) => file.endsWith('.json')).map((file) => join(configPath, file));
213
+ }
214
+ async loadConfiguration(configFile) {
215
+ const content = await readFile(configFile, 'utf8');
216
+ return JSON.parse(content);
217
+ }
218
+ async resolveSharedComponents(config, plugin) {
219
+ // Resolve schema references
220
+ if (config.settingsSchema.settingsSchema && typeof config.settingsSchema.settingsSchema === 'object' && '$ref' in config.settingsSchema.settingsSchema) {
221
+ const schemaPath = this.sharedComponentManager.resolveReference(config.settingsSchema.settingsSchema.$ref, plugin.configPath);
222
+ config.settingsSchema.settingsSchema = await this.sharedComponentManager.loadSchema(schemaPath);
223
+ }
224
+ if (config.settingsSchema.channelSchema && typeof config.settingsSchema.channelSchema === 'object' && '$ref' in config.settingsSchema.channelSchema) {
225
+ const schemaPath = this.sharedComponentManager.resolveReference(config.settingsSchema.channelSchema.$ref, plugin.configPath);
226
+ config.settingsSchema.channelSchema = await this.sharedComponentManager.loadSchema(schemaPath);
227
+ }
228
+ }
229
+ async loadCodecFromConfig(config) {
230
+ if (!config.codec || config.codec.type !== 'shared' || !config.codec.reference) {
231
+ return null;
232
+ }
233
+ const codecPath = this.sharedComponentManager.resolveReference(config.codec.reference, config.metadata.pluginPath || '');
234
+ return this.sharedComponentManager.loadCodec(codecPath, {
235
+ modelId: config.id.model,
236
+ ...config.codec.config,
237
+ });
238
+ }
239
+ async validatePlugin(moduleId) {
240
+ const errors = [];
241
+ const warnings = [];
242
+ try {
243
+ // Get package info from npm registry
244
+ const packageInfo = await this.npmClient.getPackageInfo(moduleId);
245
+ // Check if it's a radio module
246
+ if (!this.isRadioModule(packageInfo)) {
247
+ errors.push('Package is not a radio module');
248
+ }
249
+ // Check version compatibility
250
+ if (!this.isVersionCompatible()) {
251
+ errors.push('Module version is not compatible with current system');
252
+ }
253
+ }
254
+ catch (error) {
255
+ errors.push(`Failed to validate plugin: ${error}`);
256
+ }
257
+ return {
258
+ isValid: errors.length === 0,
259
+ errors,
260
+ warnings,
261
+ };
262
+ }
263
+ isVersionCompatible() {
264
+ // Basic version compatibility check
265
+ // Could be enhanced with semver validation
266
+ return true;
267
+ }
268
+ async runPackageManager(args) {
269
+ const { exec } = await import('child_process');
270
+ const { promisify } = await import('util');
271
+ const execAsync = promisify(exec);
272
+ try {
273
+ await execAsync(`yarn ${args.join(' ')}`);
274
+ }
275
+ catch (error) {
276
+ throw new Error(`Package manager error: ${error}`);
277
+ }
278
+ }
279
+ }
280
+ //# sourceMappingURL=config-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-registry.js","sourceRoot":"","sources":["../../src/registry/config-registry.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAkChC;;GAEG;AACH,MAAM,OAAO,sBAAsB;IACzB,WAAW,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC/C,WAAW,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC9C,UAAU,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC3C,sBAAsB,CAAyB;IAC/C,SAAS,CAAY;IACrB,MAAM,CAAY;IAE1B,YAAY,MAAiB;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,sBAAsB,GAAG,IAAI,6BAA6B,CAAC,MAAM,CAAC,CAAC;QACxE,IAAI,CAAC,SAAS,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,sBAAsB;QAC1B,MAAM,OAAO,GAAoB,EAAE,CAAC;QAEpC,4CAA4C;QAC5C,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAEzD,KAAK,MAAM,MAAM,IAAI,aAAa,EAAE,CAAC;YACnC,IAAI,CAAC;gBACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,4BAA4B,CAAC,MAAM,CAAC,CAAC;gBACtE,OAAO,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;YACjC,CAAC;YAAC,OAAO,KAAK,EAA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 /**
4
+ * Default implementation of the shared component manager
5
+ */
6
+ export declare class DefaultSharedComponentManager implements SharedComponentManager {
7
+ private logger;
8
+ constructor(logger: ILogLayer);
9
+ loadSchema(schemaPath: string): Promise<Record<string, unknown>>;
10
+ loadProtocol(protocolPath: string): Promise<Record<string, unknown>>;
11
+ loadCodec(codecPath: string, config: Record<string, unknown>): Promise<RadioCodec>;
12
+ resolveReference(reference: string, basePath: string): string;
13
+ }
14
+ //# sourceMappingURL=shared-components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-components.d.ts","sourceRoot":"","sources":["../../src/registry/shared-components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,OAAO,KAAK,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAErF;;GAEG;AACH,qBAAa,6BAA8B,YAAW,sBAAsB;IAC1E,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,EAAE,SAAS;IAIvB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAahE,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAapE,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAwBxF,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;CAc9D"}
@@ -0,0 +1,68 @@
1
+ import { readFile } from 'fs/promises';
2
+ import { join } from 'path';
3
+ /**
4
+ * Default implementation of the shared component manager
5
+ */
6
+ export class DefaultSharedComponentManager {
7
+ logger;
8
+ constructor(logger) {
9
+ this.logger = logger;
10
+ }
11
+ async loadSchema(schemaPath) {
12
+ try {
13
+ const content = await readFile(schemaPath, 'utf8');
14
+ const schema = JSON.parse(content);
15
+ this.logger.withMetadata({ schemaPath }).debug('Loaded shared schema');
16
+ return schema;
17
+ }
18
+ catch (error) {
19
+ this.logger.withError(error).error('Failed to load shared schema');
20
+ throw error;
21
+ }
22
+ }
23
+ async loadProtocol(protocolPath) {
24
+ try {
25
+ const content = await readFile(protocolPath, 'utf8');
26
+ const protocol = JSON.parse(content);
27
+ this.logger.withMetadata({ protocolPath }).debug('Loaded shared protocol');
28
+ return protocol;
29
+ }
30
+ catch (error) {
31
+ this.logger.withError(error).error('Failed to load shared protocol');
32
+ throw error;
33
+ }
34
+ }
35
+ async loadCodec(codecPath, config) {
36
+ try {
37
+ // Dynamically load codec module
38
+ const codecModule = await import(codecPath);
39
+ // Check for CodecFactory export
40
+ if (!codecModule.CodecFactory) {
41
+ throw new Error(`Codec module does not export CodecFactory: ${codecPath}`);
42
+ }
43
+ const CodecFactory = codecModule.CodecFactory;
44
+ const factory = new CodecFactory();
45
+ // Create codec with configuration
46
+ const codec = await factory.createCodec(config.modelId, config, this.logger);
47
+ this.logger.withMetadata({ codecPath, modelId: config.modelId }).info('Loaded shared codec');
48
+ return codec;
49
+ }
50
+ catch (error) {
51
+ this.logger.withError(error).error('Failed to load shared codec');
52
+ throw error;
53
+ }
54
+ }
55
+ resolveReference(reference, basePath) {
56
+ // Handle relative paths
57
+ if (reference.startsWith('./') || reference.startsWith('../')) {
58
+ return join(basePath, reference);
59
+ }
60
+ // Handle absolute paths
61
+ if (reference.startsWith('/')) {
62
+ return reference;
63
+ }
64
+ // Default to relative path
65
+ return join(basePath, reference);
66
+ }
67
+ }
68
+ //# sourceMappingURL=shared-components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-components.js","sourceRoot":"","sources":["../../src/registry/shared-components.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,M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