made-bridge 0.2.2 → 0.2.3

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": "made-bridge",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "码得(made)独立语音编程设备的电脑侧桥接器:工作台 API、设备接口、任务调度与插件运行时。一条命令启动,配合 ESP32 固件使用,源码在 github.com/jobop/made。",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -141,7 +141,10 @@ export function createBoardLink() {
141
141
  const queues = new Map();
142
142
  const audios = new Map();
143
143
  const hits = new Map();
144
- const seq = { n: 0 };
144
+ // 命令 id 用启动时间戳起算(固件 validCommandId 允许 ≤16 位纯数字):
145
+ // 板子的 delivered_command_ids_ 去重表跨重启持久,若桥接器重启后 id 从 1 重新
146
+ // 计数,会撞上表内旧 id 被当重复静默跳过(但照样 ack)。时间戳起点保证跨重启唯一。
147
+ const seq = { n: Math.floor(Date.now() / 1000) };
145
148
  const dropAudio = (deviceId, id) => audios.delete(`${deviceId}\n${id}`);
146
149
  const enqueue = (deviceId, command, allowed, audio) => enqueueCommand(queues, audios, catalogs, seq, deviceId, command, allowed, audio);
147
150
  return {