@tx5dr/contracts 1.7.8 → 1.7.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tx5dr/contracts",
3
- "version": "1.7.8",
3
+ "version": "1.7.10",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -3,7 +3,10 @@ import {
3
3
  AudioDevicesResponseSchema,
4
4
  AudioDeviceResolutionSchema,
5
5
  AudioDeviceResolutionStatusSchema,
6
+ AudioDeviceSettingsSchema,
6
7
  AudioDeviceSettingsResponseSchema,
8
+ AudioOutputChannelModeSchema,
9
+ AudioOutputSampleFormatSchema,
7
10
  AudioSettingsResolveResponseSchema,
8
11
  } from '../audio.schema.js';
9
12
 
@@ -122,6 +125,21 @@ describe('audio device resolution schemas', () => {
122
125
  }).currentSettings.outputBufferSize).toBe(1024);
123
126
  });
124
127
 
128
+ it('accepts and validates output diagnostic audio settings', () => {
129
+ expect(AudioOutputSampleFormatSchema.parse('int16')).toBe('int16');
130
+ expect(AudioOutputChannelModeSchema.parse('both')).toBe('both');
131
+ expect(AudioDeviceSettingsSchema.parse({
132
+ outputSampleFormat: 'int16',
133
+ outputChannelMode: 'right',
134
+ })).toMatchObject({
135
+ outputSampleFormat: 'int16',
136
+ outputChannelMode: 'right',
137
+ });
138
+
139
+ expect(() => AudioDeviceSettingsSchema.parse({ outputSampleFormat: 'int24' })).toThrow();
140
+ expect(() => AudioDeviceSettingsSchema.parse({ outputChannelMode: 'stereo' })).toThrow();
141
+ });
142
+
125
143
  it('accepts resolve responses with every supported status', () => {
126
144
  for (const status of ['selected', 'default', 'virtual-selected', 'missing'] as const) {
127
145
  expect(AudioSettingsResolveResponseSchema.parse({
@@ -34,6 +34,9 @@ export const AudioDeviceResolutionSetSchema = z.object({
34
34
  output: AudioDeviceResolutionSchema,
35
35
  });
36
36
 
37
+ export const AudioOutputSampleFormatSchema = z.enum(['float32', 'int16']);
38
+ export const AudioOutputChannelModeSchema = z.enum(['mono', 'left', 'right', 'both']);
39
+
37
40
  // 音频设备列表响应
38
41
  export const AudioDevicesResponseSchema = z.object({
39
42
  inputDevices: z.array(AudioDeviceSchema),
@@ -50,6 +53,8 @@ export const AudioDeviceSettingsSchema = z.object({
50
53
  outputSampleRate: z.number().optional(),
51
54
  inputBufferSize: z.number().optional(),
52
55
  outputBufferSize: z.number().optional(),
56
+ outputSampleFormat: AudioOutputSampleFormatSchema.optional(),
57
+ outputChannelMode: AudioOutputChannelModeSchema.optional(),
53
58
  sampleRate: z.number().optional(),
54
59
  bufferSize: z.number().optional(),
55
60
  });
@@ -108,6 +113,8 @@ export type AudioDevice = z.infer<typeof AudioDeviceSchema>;
108
113
  export type AudioDeviceResolutionStatus = z.infer<typeof AudioDeviceResolutionStatusSchema>;
109
114
  export type AudioDeviceResolution = z.infer<typeof AudioDeviceResolutionSchema>;
110
115
  export type AudioDeviceResolutionSet = z.infer<typeof AudioDeviceResolutionSetSchema>;
116
+ export type AudioOutputSampleFormat = z.infer<typeof AudioOutputSampleFormatSchema>;
117
+ export type AudioOutputChannelMode = z.infer<typeof AudioOutputChannelModeSchema>;
111
118
  export type AudioDevicesResponse = z.infer<typeof AudioDevicesResponseSchema>;
112
119
  export type AudioDeviceSettings = z.infer<typeof AudioDeviceSettingsSchema>;
113
120
  export type AudioDeviceSettingsResponse = z.infer<typeof AudioDeviceSettingsResponseSchema>;
@@ -250,6 +250,8 @@ export type PluginCapability = z.infer<typeof PluginCapabilitySchema>;
250
250
  * - `main-right`: shown in the optional main layout plugin pane on the far right.
251
251
  * - `voice-left-top`: shown above the voice frequency control card.
252
252
  * - `voice-right-top`: shown in the tabbed top area of the voice right panel.
253
+ * - `cw-left-top`: shown above the CW frequency control card.
254
+ * - `cw-right-top`: shown in the tabbed top area of the CW right panel.
253
255
  */
254
256
  export const PluginPanelSlotSchema = z.enum([
255
257
  'operator',
@@ -257,6 +259,7 @@ export const PluginPanelSlotSchema = z.enum([
257
259
  'main-right',
258
260
  'voice-left-top',
259
261
  'voice-right-top',
262
+ 'cw-left-top',
260
263
  'cw-right-top',
261
264
  'radio-control-toolbar',
262
265
  ]);
@@ -575,6 +578,7 @@ export type PluginSystemSnapshot = z.infer<typeof PluginSystemSnapshotSchema>;
575
578
  export const PluginDistributionSchema = z.enum([
576
579
  'electron',
577
580
  'docker',
581
+ 'android-bridge',
578
582
  'linux-service',
579
583
  'generic-server',
580
584
  'web-dev',
@@ -5,6 +5,7 @@ export const SystemUpdateTargetSchema = z.enum([
5
5
  'electron-app',
6
6
  'linux-server',
7
7
  'docker',
8
+ 'android-runtime',
8
9
  ]);
9
10
  export type SystemUpdateTarget = z.infer<typeof SystemUpdateTargetSchema>;
10
11
 
@@ -8,6 +8,7 @@ describe('PluginPanelSlotSchema', () => {
8
8
  expect(PluginPanelSlotSchema.parse('main-right')).toBe('main-right');
9
9
  expect(PluginPanelSlotSchema.parse('voice-left-top')).toBe('voice-left-top');
10
10
  expect(PluginPanelSlotSchema.parse('voice-right-top')).toBe('voice-right-top');
11
+ expect(PluginPanelSlotSchema.parse('cw-left-top')).toBe('cw-left-top');
11
12
  expect(PluginPanelSlotSchema.parse('cw-right-top')).toBe('cw-right-top');
12
13
  expect(PluginPanelSlotSchema.parse('radio-control-toolbar')).toBe('radio-control-toolbar');
13
14
  });
@@ -28,6 +29,14 @@ describe('PluginPanelSlotSchema', () => {
28
29
  pageId: 'voice-top',
29
30
  slot: 'voice-right-top',
30
31
  })).not.toThrow();
32
+
33
+ expect(() => PluginPanelDescriptorSchema.parse({
34
+ id: 'cw-left-top',
35
+ title: 'cwLeftTopTitle',
36
+ component: 'iframe',
37
+ pageId: 'cw-left-top',
38
+ slot: 'cw-left-top',
39
+ })).not.toThrow();
31
40
  });
32
41
 
33
42
  it('validates radio control toolbar iframe panel metadata', () => {