made-market 0.4.2 → 0.4.4
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/lib/plugin.mjs +23 -7
- package/package.json +1 -1
- package/registry/index.json +11 -11
- package/src/install.mjs +4 -1
package/lib/plugin.mjs
CHANGED
|
@@ -19,19 +19,35 @@ const MAX_VALUE = 500;
|
|
|
19
19
|
const MAX_PATTERN = 200;
|
|
20
20
|
const MAX_FILE = 16 * 1024;
|
|
21
21
|
|
|
22
|
-
/** Commands the device currently executes (made 仓库
|
|
22
|
+
/** Commands the device currently executes (made 仓库 docs/standards/03-plugin-capabilities.md). */
|
|
23
23
|
export const BOARD_COMMANDS = Object.freeze([
|
|
24
24
|
'caption.show', 'audio.play', 'theme.apply', 'volume.set', 'agent.select',
|
|
25
25
|
'session.create', 'session.select', 'session.delete', 'voice.start',
|
|
26
26
|
'task.confirm', 'task.cancel',
|
|
27
|
-
'ui.swipe', 'ui.tap', 'debug.screenshot',
|
|
27
|
+
'ui.swipe', 'ui.tap', 'ui.back', 'debug.screenshot',
|
|
28
28
|
]);
|
|
29
29
|
|
|
30
|
-
/**
|
|
31
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Events the device currently publishes. motion.shake 仅在带 IMU 的板子上上报;
|
|
32
|
+
* touch.double 是无 IMU 板子的等价触发源(2026-10-18 新增)。
|
|
33
|
+
*/
|
|
34
|
+
export const BOARD_EVENTS = Object.freeze([
|
|
35
|
+
'boot.click', 'boot.double', 'boot.triple', 'boot.long',
|
|
36
|
+
'motion.shake', 'touch.double',
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 行动系统:动作作为 action.<名> 并入命令清单,名单由素材 manifest 决定、
|
|
41
|
+
* 设备动态上报——静态清单穷举不了,按前缀放行(设备端对未知动作静默降级)。
|
|
42
|
+
*/
|
|
43
|
+
export function isKnownCommand(name, known) {
|
|
44
|
+
return name.startsWith('action.') || known.includes(name);
|
|
45
|
+
}
|
|
32
46
|
|
|
33
|
-
/** Event and command names share one shape, mirroring the bridge validator.
|
|
34
|
-
|
|
47
|
+
/** Event and command names share one shape, mirroring the bridge validator.
|
|
48
|
+
* Uppercase segments carry the abstract action slots (`action.A1`–`A9`, the
|
|
49
|
+
* two-level binding model in docs/SPRITES.md); legacy names stay lowercase. */
|
|
50
|
+
const NAME = /^[a-zA-Z][a-zA-Z0-9_]{0,15}(?:\.[a-zA-Z][a-zA-Z0-9_]{0,15}){0,2}$/;
|
|
35
51
|
|
|
36
52
|
const visible = (value, max) => typeof value === 'string' && value.trim()
|
|
37
53
|
&& Buffer.byteLength(value) <= max && !/[\p{Cc}\p{Cf}]/u.test(value);
|
|
@@ -162,7 +178,7 @@ export function checkNames(list, label, known, fail, warn) {
|
|
|
162
178
|
}
|
|
163
179
|
if (new Set(list).size !== list.length) fail(`${label} 有重复项`);
|
|
164
180
|
for (const name of list) {
|
|
165
|
-
if (known && !
|
|
181
|
+
if (known && !isKnownCommand(name, known)) fail(`${label} 中的 ${name} 不在板侧公开清单里,设备不会执行`);
|
|
166
182
|
}
|
|
167
183
|
if (!list.length) warn(`${label} 为空`);
|
|
168
184
|
}
|
package/package.json
CHANGED
package/registry/index.json
CHANGED
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
],
|
|
81
81
|
"payloadBytes": 209717,
|
|
82
82
|
"archiveBytes": 39822,
|
|
83
|
-
"sha256": "
|
|
83
|
+
"sha256": "b656724a6be3466c0ad52010bfa9f2a3b043595b6b7b6bed90a01bdfcca3ba95",
|
|
84
84
|
"download": "packages/sunset-1.0.0.tar.gz",
|
|
85
85
|
"swatch": [
|
|
86
86
|
"#e0834a",
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
],
|
|
154
154
|
"payloadBytes": 212917,
|
|
155
155
|
"archiveBytes": 44910,
|
|
156
|
-
"sha256": "
|
|
156
|
+
"sha256": "3894aadcfdba77eb351abc4381d3b76141ed0d6a15d8b75a982a64092e1300fa",
|
|
157
157
|
"download": "packages/ocean-1.0.0.tar.gz",
|
|
158
158
|
"swatch": [
|
|
159
159
|
"#2fa3b8",
|
|
@@ -226,7 +226,7 @@
|
|
|
226
226
|
],
|
|
227
227
|
"payloadBytes": 198517,
|
|
228
228
|
"archiveBytes": 31125,
|
|
229
|
-
"sha256": "
|
|
229
|
+
"sha256": "ff66fd400882e4ce3017b32782825aca59e60e5a407c793b175d2c4500c1cb97",
|
|
230
230
|
"download": "packages/graphite-1.0.0.tar.gz",
|
|
231
231
|
"swatch": [
|
|
232
232
|
"#8e9aa6",
|
|
@@ -299,7 +299,7 @@
|
|
|
299
299
|
],
|
|
300
300
|
"payloadBytes": 206517,
|
|
301
301
|
"archiveBytes": 34163,
|
|
302
|
-
"sha256": "
|
|
302
|
+
"sha256": "24dbf64bb96520a16efbfbb553ccff91190ae4fde5b18444f3c6a7ee97b0993f",
|
|
303
303
|
"download": "packages/bamboo-1.0.0.tar.gz",
|
|
304
304
|
"swatch": [
|
|
305
305
|
"#5aa85e",
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
],
|
|
368
368
|
"payloadBytes": 1576,
|
|
369
369
|
"archiveBytes": 1067,
|
|
370
|
-
"sha256": "
|
|
370
|
+
"sha256": "c3f6afae9ef5f47b622c74c2faf7174ba2ba38a9db2d19651a992874fd6f5f9a",
|
|
371
371
|
"download": "packages/theme-cycler-1.0.0.tar.gz",
|
|
372
372
|
"sourcePath": "packages/control/theme-cycler"
|
|
373
373
|
},
|
|
@@ -430,7 +430,7 @@
|
|
|
430
430
|
],
|
|
431
431
|
"payloadBytes": 3023,
|
|
432
432
|
"archiveBytes": 1808,
|
|
433
|
-
"sha256": "
|
|
433
|
+
"sha256": "ab7acdc88895a391596182fa9425e1e81d0b7ec5de73c035b9fe0ee2a7a3a123",
|
|
434
434
|
"download": "packages/webhook-notify-1.0.0.tar.gz",
|
|
435
435
|
"sourcePath": "packages/control/webhook-notify"
|
|
436
436
|
},
|
|
@@ -492,7 +492,7 @@
|
|
|
492
492
|
],
|
|
493
493
|
"payloadBytes": 2370,
|
|
494
494
|
"archiveBytes": 1450,
|
|
495
|
-
"sha256": "
|
|
495
|
+
"sha256": "43512f16e9559f5984ab9cf827b9b8e0e7c5671bc1cd1cf211adc0b0344e9f37",
|
|
496
496
|
"download": "packages/key-chime-1.0.0.tar.gz",
|
|
497
497
|
"sourcePath": "packages/control/key-chime"
|
|
498
498
|
},
|
|
@@ -554,7 +554,7 @@
|
|
|
554
554
|
],
|
|
555
555
|
"payloadBytes": 3940,
|
|
556
556
|
"archiveBytes": 1959,
|
|
557
|
-
"sha256": "
|
|
557
|
+
"sha256": "c131b7a0e67a9e0a1e4ab23b9dcf5ec05f7bb73c8b43621fe849c6762009c4e0",
|
|
558
558
|
"download": "packages/alarm-clock-1.0.0.tar.gz",
|
|
559
559
|
"sourcePath": "packages/control/alarm-clock"
|
|
560
560
|
},
|
|
@@ -621,7 +621,7 @@
|
|
|
621
621
|
],
|
|
622
622
|
"payloadBytes": 3793,
|
|
623
623
|
"archiveBytes": 1612,
|
|
624
|
-
"sha256": "
|
|
624
|
+
"sha256": "7f3d1045be427b2d4cbe0b070cb63ca0fc1fe127c63201f9423f23970d37f736",
|
|
625
625
|
"download": "packages/demo-echo-1.0.0.tar.gz",
|
|
626
626
|
"icon": {
|
|
627
627
|
"format": "indexed4",
|
|
@@ -702,7 +702,7 @@
|
|
|
702
702
|
],
|
|
703
703
|
"payloadBytes": 6098,
|
|
704
704
|
"archiveBytes": 2672,
|
|
705
|
-
"sha256": "
|
|
705
|
+
"sha256": "0a33b62f6f186a80d370012ddd146f9c504daf182503cc23cb4c13bd9c7e35d3",
|
|
706
706
|
"download": "packages/ollama-agent-1.0.0.tar.gz",
|
|
707
707
|
"icon": {
|
|
708
708
|
"format": "indexed4",
|
|
@@ -786,7 +786,7 @@
|
|
|
786
786
|
],
|
|
787
787
|
"payloadBytes": 5814,
|
|
788
788
|
"archiveBytes": 2456,
|
|
789
|
-
"sha256": "
|
|
789
|
+
"sha256": "541eef0c992b636cfe5d0b8f1f03dffa15a58b414f061ed392971bd3723a6c0f",
|
|
790
790
|
"download": "packages/shell-agent-1.0.0.tar.gz",
|
|
791
791
|
"icon": {
|
|
792
792
|
"format": "indexed4",
|
package/src/install.mjs
CHANGED
|
@@ -15,6 +15,7 @@ import fs from 'node:fs';
|
|
|
15
15
|
import os from 'node:os';
|
|
16
16
|
import path from 'node:path';
|
|
17
17
|
import zlib from 'node:zlib';
|
|
18
|
+
import { pathToFileURL } from 'node:url';
|
|
18
19
|
import { KINDS, PKG_ROOT, ROOT, sha256 } from '../lib/market.mjs';
|
|
19
20
|
import { extractTar } from '../lib/tar.mjs';
|
|
20
21
|
|
|
@@ -189,4 +190,6 @@ function main() {
|
|
|
189
190
|
});
|
|
190
191
|
}
|
|
191
192
|
|
|
192
|
-
|
|
193
|
+
// 入口判断必须走 pathToFileURL:argv[1] 未编码,路径含空格(如 "My project")
|
|
194
|
+
// 时与 import.meta.url 永不相等,CLI 会静默退出(exit 0 无任何输出)。
|
|
195
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) main();
|