@tx5dr/contracts 1.7.0 → 1.7.2

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 (56) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/schema/__tests__/audio.schema.test.d.ts +2 -0
  6. package/dist/schema/__tests__/audio.schema.test.d.ts.map +1 -0
  7. package/dist/schema/__tests__/audio.schema.test.js +126 -0
  8. package/dist/schema/__tests__/audio.schema.test.js.map +1 -0
  9. package/dist/schema/__tests__/plugin-runtime-log.schema.test.js +13 -1
  10. package/dist/schema/__tests__/plugin-runtime-log.schema.test.js.map +1 -1
  11. package/dist/schema/api-response.schema.d.ts +30 -30
  12. package/dist/schema/audio.schema.d.ts +1292 -0
  13. package/dist/schema/audio.schema.d.ts.map +1 -1
  14. package/dist/schema/audio.schema.js +33 -0
  15. package/dist/schema/audio.schema.js.map +1 -1
  16. package/dist/schema/cpu-profile.schema.d.ts +4 -4
  17. package/dist/schema/ft8.schema.d.ts +4 -4
  18. package/dist/schema/logbook.schema.d.ts +22 -0
  19. package/dist/schema/logbook.schema.d.ts.map +1 -1
  20. package/dist/schema/logbook.schema.js +8 -0
  21. package/dist/schema/logbook.schema.js.map +1 -1
  22. package/dist/schema/plugin.schema.d.ts +99 -22
  23. package/dist/schema/plugin.schema.d.ts.map +1 -1
  24. package/dist/schema/plugin.schema.js +5 -1
  25. package/dist/schema/plugin.schema.js.map +1 -1
  26. package/dist/schema/qso.schema.d.ts +2 -2
  27. package/dist/schema/radio-power.schema.d.ts +6 -6
  28. package/dist/schema/radio-profile.schema.d.ts +280 -108
  29. package/dist/schema/radio-profile.schema.d.ts.map +1 -1
  30. package/dist/schema/radio.schema.d.ts +18 -18
  31. package/dist/schema/realtime.schema.d.ts +22 -22
  32. package/dist/schema/slot-info.schema.d.ts +18 -18
  33. package/dist/schema/spectrum.schema.d.ts +6 -6
  34. package/dist/schema/system.schema.d.ts +11 -0
  35. package/dist/schema/system.schema.d.ts.map +1 -1
  36. package/dist/schema/system.schema.js +4 -0
  37. package/dist/schema/system.schema.js.map +1 -1
  38. package/dist/schema/transmission.schema.d.ts +8 -8
  39. package/dist/schema/update.schema.d.ts +62 -0
  40. package/dist/schema/update.schema.d.ts.map +1 -0
  41. package/dist/schema/update.schema.js +28 -0
  42. package/dist/schema/update.schema.js.map +1 -0
  43. package/dist/schema/websocket.schema.d.ts +468 -148
  44. package/dist/schema/websocket.schema.d.ts.map +1 -1
  45. package/dist/schema/websocket.schema.js +38 -0
  46. package/dist/schema/websocket.schema.js.map +1 -1
  47. package/package.json +1 -1
  48. package/src/index.ts +1 -0
  49. package/src/schema/__tests__/audio.schema.test.ts +142 -0
  50. package/src/schema/__tests__/plugin-runtime-log.schema.test.ts +13 -1
  51. package/src/schema/audio.schema.ts +44 -1
  52. package/src/schema/logbook.schema.ts +8 -0
  53. package/src/schema/plugin.schema.ts +7 -1
  54. package/src/schema/system.schema.ts +6 -0
  55. package/src/schema/update.schema.ts +33 -0
  56. package/src/schema/websocket.schema.ts +52 -0
@@ -7,19 +7,46 @@ export const AudioDeviceSchema = z.object({
7
7
  isDefault: z.boolean(),
8
8
  channels: z.number(),
9
9
  sampleRate: z.number(),
10
+ sampleRates: z.array(z.number().int().positive()).optional(),
10
11
  type: z.enum(['input', 'output']),
11
12
  });
12
13
 
14
+ export const AudioDeviceResolutionStatusSchema = z.enum([
15
+ 'selected',
16
+ 'default',
17
+ 'virtual-selected',
18
+ 'missing',
19
+ ]);
20
+
21
+ export const AudioDeviceResolutionSchema = z.object({
22
+ configuredDeviceName: z.string().nullable(),
23
+ configuredDevice: AudioDeviceSchema.nullable(),
24
+ effectiveDevice: AudioDeviceSchema.nullable(),
25
+ status: AudioDeviceResolutionStatusSchema,
26
+ reason: z.string().nullable().optional(),
27
+ });
28
+
29
+ export const AudioDeviceResolutionSetSchema = z.object({
30
+ input: AudioDeviceResolutionSchema,
31
+ output: AudioDeviceResolutionSchema,
32
+ });
33
+
13
34
  // 音频设备列表响应
14
35
  export const AudioDevicesResponseSchema = z.object({
15
36
  inputDevices: z.array(AudioDeviceSchema),
16
37
  outputDevices: z.array(AudioDeviceSchema),
38
+ inputBufferSizes: z.array(z.number().int().positive()),
39
+ outputBufferSizes: z.array(z.number().int().positive()),
17
40
  });
18
41
 
19
42
  // 音频设备设置请求
20
43
  export const AudioDeviceSettingsSchema = z.object({
21
44
  inputDeviceName: z.string().optional(), // 使用设备名称而非ID
22
45
  outputDeviceName: z.string().optional(), // 使用设备名称而非ID
46
+ inputSampleRate: z.number().optional(),
47
+ outputSampleRate: z.number().optional(),
48
+ inputBufferSize: z.number().optional(),
49
+ outputBufferSize: z.number().optional(),
23
50
  sampleRate: z.number().optional(),
24
51
  bufferSize: z.number().optional(),
25
52
  });
@@ -29,6 +56,17 @@ export const AudioDeviceSettingsResponseSchema = z.object({
29
56
  success: z.boolean(),
30
57
  message: z.string().optional(),
31
58
  currentSettings: AudioDeviceSettingsSchema,
59
+ deviceResolution: AudioDeviceResolutionSetSchema,
60
+ });
61
+
62
+ export const AudioSettingsResolveRequestSchema = z.object({
63
+ audio: AudioDeviceSettingsSchema,
64
+ radioType: z.enum(['none', 'network', 'serial', 'icom-wlan']).optional(),
65
+ });
66
+
67
+ export const AudioSettingsResolveResponseSchema = z.object({
68
+ success: z.boolean(),
69
+ deviceResolution: AudioDeviceResolutionSetSchema,
32
70
  });
33
71
 
34
72
  // 音频流配置参数 (用于 Audify/RtAudio)
@@ -64,10 +102,15 @@ export const VolumeGainSchema = z.object({
64
102
 
65
103
  // 导出类型
66
104
  export type AudioDevice = z.infer<typeof AudioDeviceSchema>;
105
+ export type AudioDeviceResolutionStatus = z.infer<typeof AudioDeviceResolutionStatusSchema>;
106
+ export type AudioDeviceResolution = z.infer<typeof AudioDeviceResolutionSchema>;
107
+ export type AudioDeviceResolutionSet = z.infer<typeof AudioDeviceResolutionSetSchema>;
67
108
  export type AudioDevicesResponse = z.infer<typeof AudioDevicesResponseSchema>;
68
109
  export type AudioDeviceSettings = z.infer<typeof AudioDeviceSettingsSchema>;
69
110
  export type AudioDeviceSettingsResponse = z.infer<typeof AudioDeviceSettingsResponseSchema>;
111
+ export type AudioSettingsResolveRequest = z.infer<typeof AudioSettingsResolveRequestSchema>;
112
+ export type AudioSettingsResolveResponse = z.infer<typeof AudioSettingsResolveResponseSchema>;
70
113
  export type AudioStreamConfig = z.infer<typeof AudioStreamConfigSchema>;
71
114
  export type AudioStreamEventData = z.infer<typeof AudioStreamEventDataSchema>;
72
115
  export type AudioMixerConfig = z.infer<typeof AudioMixerConfigSchema>;
73
- export type VolumeGain = z.infer<typeof VolumeGainSchema>;
116
+ export type VolumeGain = z.infer<typeof VolumeGainSchema>;
@@ -191,6 +191,14 @@ export const LogBookExportOptionsSchema = z.object({
191
191
  startDate: z.string().optional(),
192
192
  endDate: z.string().optional(),
193
193
  callsign: z.string().optional(),
194
+ grid: z.string().optional(),
195
+ band: z.string().optional(),
196
+ mode: z.string().optional(),
197
+ dxccStatus: z.enum(['deleted']).optional(),
198
+ qslFlow: z.enum(['two_way_confirmed', 'not_two_way_confirmed']).optional(),
199
+ /** 排除的模式列表,逗号分隔,如 "FT8,FT4" */
200
+ excludeModes: z.string().optional(),
201
+ qslStatus: z.enum(['confirmed', 'uploaded', 'none']).optional(),
194
202
  });
195
203
 
196
204
  export const LogBookImportFormatSchema = z.enum(['adif', 'csv']);
@@ -643,11 +643,17 @@ export const PluginRuntimeLogEntrySchema = z.object({
643
643
  });
644
644
  export type PluginRuntimeLogEntry = z.infer<typeof PluginRuntimeLogEntrySchema>;
645
645
 
646
+ export const PluginLogHistoryEntrySchema = z.union([
647
+ PluginRuntimeLogEntrySchema,
648
+ PluginLogEntrySchema,
649
+ ]);
650
+ export type PluginLogHistoryEntry = z.infer<typeof PluginLogHistoryEntrySchema>;
651
+
646
652
  /**
647
653
  * 宿主级插件运行日志历史响应载荷
648
654
  */
649
655
  export const PluginRuntimeLogHistoryPayloadSchema = z.object({
650
- entries: z.array(PluginRuntimeLogEntrySchema),
656
+ entries: z.array(PluginLogHistoryEntrySchema),
651
657
  });
652
658
  export type PluginRuntimeLogHistoryPayload = z.infer<typeof PluginRuntimeLogHistoryPayloadSchema>;
653
659
 
@@ -37,6 +37,7 @@ export const ClockStatusDetailSchema = ClockStatusSummarySchema.extend({
37
37
  syncState: ClockSyncStateSchema,
38
38
  serverUsed: z.string().nullable(),
39
39
  errorMessage: z.string().nullable(),
40
+ autoApplyOffset: z.boolean(),
40
41
  });
41
42
  export type ClockStatusDetail = z.infer<typeof ClockStatusDetailSchema>;
42
43
 
@@ -45,6 +46,11 @@ export const SetClockOffsetRequestSchema = z.object({
45
46
  });
46
47
  export type SetClockOffsetRequest = z.infer<typeof SetClockOffsetRequestSchema>;
47
48
 
49
+ export const SetClockAutoApplyRequestSchema = z.object({
50
+ enabled: z.boolean(),
51
+ });
52
+ export type SetClockAutoApplyRequest = z.infer<typeof SetClockAutoApplyRequestSchema>;
53
+
48
54
  // ===== NTP server list settings =====
49
55
 
50
56
  function isValidIPv4Address(value: string): boolean {
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { PluginDistributionSchema } from './plugin.schema.js';
3
+
4
+ export const SystemUpdateTargetSchema = z.enum([
5
+ 'electron-app',
6
+ 'linux-server',
7
+ 'docker',
8
+ ]);
9
+ export type SystemUpdateTarget = z.infer<typeof SystemUpdateTargetSchema>;
10
+
11
+ export const SystemUpdateChannelSchema = z.enum(['release', 'nightly']);
12
+ export type SystemUpdateChannel = z.infer<typeof SystemUpdateChannelSchema>;
13
+
14
+ export const SystemUpdateStatusSchema = z.object({
15
+ target: SystemUpdateTargetSchema,
16
+ distribution: PluginDistributionSchema,
17
+ channel: SystemUpdateChannelSchema,
18
+ currentVersion: z.string(),
19
+ currentCommit: z.string().nullable(),
20
+ currentDigest: z.string().nullable().optional(),
21
+ latestVersion: z.string().nullable(),
22
+ latestCommit: z.string().nullable(),
23
+ latestDigest: z.string().nullable().optional(),
24
+ latestCommitTitle: z.string().nullable(),
25
+ publishedAt: z.string().nullable(),
26
+ releaseNotes: z.string().nullable(),
27
+ updateAvailable: z.boolean(),
28
+ identity: z.string().nullable(),
29
+ websiteUrl: z.string().url(),
30
+ metadataSource: z.enum(['oss', 'github']).nullable(),
31
+ errorMessage: z.string().nullable(),
32
+ });
33
+ export type SystemUpdateStatus = z.infer<typeof SystemUpdateStatusSchema>;
@@ -113,6 +113,9 @@ export enum WSMessageType {
113
113
  PTT_STATUS_CHANGED = 'pttStatusChanged',
114
114
  FORCE_STOP_TRANSMISSION = 'forceStopTransmission',
115
115
  REMOVE_OPERATOR_FROM_TRANSMISSION = 'removeOperatorFromTransmission',
116
+ START_TUNE_TONE = 'startTuneTone',
117
+ STOP_TUNE_TONE = 'stopTuneTone',
118
+ TUNE_TONE_STATUS_CHANGED = 'tuneToneStatusChanged',
116
119
 
117
120
  // ===== 电台数值表 =====
118
121
  METER_DATA = 'meterData',
@@ -267,6 +270,21 @@ export const PTTStatusSchema = z.object({
267
270
  operatorIds: z.array(z.string()),
268
271
  });
269
272
 
273
+ export const TuneToneStartPayloadSchema = z.object({
274
+ operatorId: z.string().optional(),
275
+ toneHz: z.number().min(100).max(3000).optional(),
276
+ });
277
+ export type TuneToneStartPayload = z.infer<typeof TuneToneStartPayloadSchema>;
278
+
279
+ export const TuneToneStatusSchema = z.object({
280
+ active: z.boolean(),
281
+ toneHz: z.number().nullable(),
282
+ startedAt: z.number().nullable(),
283
+ maxDurationMs: z.number(),
284
+ error: z.string().optional(),
285
+ });
286
+ export type TuneToneStatus = z.infer<typeof TuneToneStatusSchema>;
287
+
270
288
  export const SquelchStatusSchema = z.object({
271
289
  supported: z.boolean(),
272
290
  open: z.boolean().nullable(),
@@ -1022,6 +1040,36 @@ export const WSRemoveOperatorFromTransmissionMessageSchema = WSBaseMessageSchema
1022
1040
 
1023
1041
  export type WSRemoveOperatorFromTransmissionMessage = z.infer<typeof WSRemoveOperatorFromTransmissionMessageSchema>;
1024
1042
 
1043
+ /**
1044
+ * 启动外接天调单音调谐(客户端到服务端)
1045
+ */
1046
+ export const WSStartTuneToneMessageSchema = WSBaseMessageSchema.extend({
1047
+ type: z.literal(WSMessageType.START_TUNE_TONE),
1048
+ data: TuneToneStartPayloadSchema.optional(),
1049
+ });
1050
+
1051
+ export type WSStartTuneToneMessage = z.infer<typeof WSStartTuneToneMessageSchema>;
1052
+
1053
+ /**
1054
+ * 停止外接天调单音调谐(客户端到服务端)
1055
+ */
1056
+ export const WSStopTuneToneMessageSchema = WSBaseMessageSchema.extend({
1057
+ type: z.literal(WSMessageType.STOP_TUNE_TONE),
1058
+ data: z.object({}).optional(),
1059
+ });
1060
+
1061
+ export type WSStopTuneToneMessage = z.infer<typeof WSStopTuneToneMessageSchema>;
1062
+
1063
+ /**
1064
+ * 外接天调单音调谐状态(服务端到客户端)
1065
+ */
1066
+ export const WSTuneToneStatusChangedMessageSchema = WSBaseMessageSchema.extend({
1067
+ type: z.literal(WSMessageType.TUNE_TONE_STATUS_CHANGED),
1068
+ data: TuneToneStatusSchema,
1069
+ });
1070
+
1071
+ export type WSTuneToneStatusChangedMessage = z.infer<typeof WSTuneToneStatusChangedMessageSchema>;
1072
+
1025
1073
  /**
1026
1074
  * 电台数值表数据消息(服务端到客户端)
1027
1075
  */
@@ -1286,6 +1334,9 @@ export const WSMessageSchema = z.discriminatedUnion('type', [
1286
1334
  WSPTTStatusChangedMessageSchema,
1287
1335
  WSForceStopTransmissionMessageSchema,
1288
1336
  WSRemoveOperatorFromTransmissionMessageSchema,
1337
+ WSStartTuneToneMessageSchema,
1338
+ WSStopTuneToneMessageSchema,
1339
+ WSTuneToneStatusChangedMessageSchema,
1289
1340
 
1290
1341
  // 电台数值表消息
1291
1342
  WSMeterDataMessageSchema,
@@ -1420,6 +1471,7 @@ export interface DigitalRadioEngineEvents {
1420
1471
 
1421
1472
  // PTT状态控制事件
1422
1473
  pttStatusChanged: (data: PTTStatus) => void;
1474
+ tuneToneStatusChanged: (data: TuneToneStatus) => void;
1423
1475
 
1424
1476
  // 电台数值表事件
1425
1477
  meterData: (data: MeterData) => void;