made-market 0.4.2 → 0.4.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/lib/plugin.mjs CHANGED
@@ -19,16 +19,30 @@ 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 仓库 AGENTS.md,板侧事件与命令). */
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
- /** Events the device currently publishes. */
31
- export const BOARD_EVENTS = Object.freeze(['boot.click', 'boot.double', 'boot.triple', 'boot.long']);
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
47
  /** Event and command names share one shape, mirroring the bridge validator. */
34
48
  const NAME = /^[a-z][a-z0-9_]{0,15}(?:\.[a-z][a-z0-9_]{0,15}){0,2}$/;
@@ -162,7 +176,7 @@ export function checkNames(list, label, known, fail, warn) {
162
176
  }
163
177
  if (new Set(list).size !== list.length) fail(`${label} 有重复项`);
164
178
  for (const name of list) {
165
- if (known && !known.includes(name)) fail(`${label} 中的 ${name} 不在板侧公开清单里,设备不会执行`);
179
+ if (known && !isKnownCommand(name, known)) fail(`${label} 中的 ${name} 不在板侧公开清单里,设备不会执行`);
166
180
  }
167
181
  if (!list.length) warn(`${label} 为空`);
168
182
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "made-market",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "码得(made)公开插件市场的命令行工具:列出、搜索、安装主题/管控/agent 包,以及登录后发布新包。市场服务端在 github.com/jobop/made-market 仓库内,不随本包分发。",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -45,4 +45,4 @@
45
45
  "prepublishOnly": "cd .. && node tools/validate.mjs && node tools/build.mjs && node --test",
46
46
  "prepack": "mkdir -p registry && cp ../registry/index.json registry/index.json"
47
47
  }
48
- }
48
+ }
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
- if (import.meta.url === `file://${process.argv[1]}`) main();
193
+ // 入口判断必须走 pathToFileURL:argv[1] 未编码,路径含空格(如 "My project")
194
+ // 时与 import.meta.url 永不相等,CLI 会静默退出(exit 0 无任何输出)。
195
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) main();