@yixinkj/priority-buyer-alert-cli 0.1.41 → 0.1.43

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/index.js CHANGED
@@ -755,11 +755,42 @@ function pruneOldRuntimeVersions(
755
755
  * 放在「已安装」的快路径上也要跑:只在新装时清理的话,一台停止升级的机器会把
756
756
  * 历史版本永远留着。
757
757
  */
758
- function reportPrunedRuntimeVersions() {
759
- const removed = pruneOldRuntimeVersions();
758
+ function reportPrunedRuntimeVersions(...args) {
759
+ const removed = pruneOldRuntimeVersions(...args);
760
760
  if (removed.length > 0) {
761
761
  console.error(`[${SKILL_ID}] 已清理旧版本运行时:${removed.join('、')}`);
762
762
  }
763
+ return removed;
764
+ }
765
+
766
+ /**
767
+ * 把校验完毕的 staging 目录提交为当前版本运行时。
768
+ *
769
+ * 同一 Skill 的两个实例可能同时首次安装同一版本,各自下载到自己的 staging。
770
+ * 版本目录按版本号钉死,内容又逐个核对过大小与 sha256,谁装出来的字节都一样,
771
+ * 因此没有必要抢:对方已经装好就直接用他那份。
772
+ *
773
+ * 抢的代价是真的。原来的写法是无条件 `rmSync` 再 `renameSync`,会删掉对方刚
774
+ * 装好、正准备执行的目录:POSIX 上对方若已 spawn 还能活下来,但两步之间那一瞬
775
+ * 版本目录是不存在的;Windows 上更直接——删正在运行的 exe 会抛错,把这次启动
776
+ * 整个带崩。
777
+ *
778
+ * @param {string} stagingRoot 已校验完毕、等待就位的临时目录。
779
+ * @param {string} versionRoot 版本目录。
780
+ * @param {() => boolean} isVersionReady 版本目录里是否已经是一份可用的同版本运行时。
781
+ * @returns {'installed' | 'kept_existing'} 就位的是本进程这份还是别人那份。
782
+ */
783
+ function commitRuntimeInstall(stagingRoot, versionRoot, isVersionReady) {
784
+ if (isVersionReady()) return 'kept_existing';
785
+ fs.rmSync(versionRoot, { recursive: true, force: true });
786
+ try {
787
+ fs.renameSync(stagingRoot, versionRoot);
788
+ } catch (error) {
789
+ // 对方恰好在这两步之间把同版本装好了。抢输不该让本次启动失败。
790
+ if (!isVersionReady()) throw error;
791
+ return 'kept_existing';
792
+ }
793
+ return 'installed';
763
794
  }
764
795
 
765
796
  async function ensureInstalled(target) {
@@ -789,8 +820,7 @@ async function ensureInstalled(target) {
789
820
  `${JSON.stringify({ version: RUNTIME_VERSION, platform: target.id, files }, null, 2)}\n`
790
821
  );
791
822
 
792
- fs.rmSync(VERSION_ROOT, { recursive: true, force: true });
793
- fs.renameSync(stagingRoot, VERSION_ROOT);
823
+ commitRuntimeInstall(stagingRoot, VERSION_ROOT, () => isInstalled(target));
794
824
  prepareMacBinaries(target);
795
825
  reportPrunedRuntimeVersions();
796
826
  } finally {
@@ -998,6 +1028,7 @@ export {
998
1028
  SKILL_VERSION,
999
1029
  VERSION_ROOT,
1000
1030
  browserExtensionNotice,
1031
+ commitRuntimeInstall,
1001
1032
  compareVersions,
1002
1033
  detectTarget,
1003
1034
  discoverLegacySkillPaths,
@@ -1007,6 +1038,7 @@ export {
1007
1038
  isInstalled,
1008
1039
  parseSkillMetadata,
1009
1040
  pruneOldRuntimeVersions,
1041
+ reportPrunedRuntimeVersions,
1010
1042
  releaseUrls,
1011
1043
  resolveSkillGate,
1012
1044
  runtimeManifestUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yixinkj/priority-buyer-alert-cli",
3
- "version": "0.1.41",
3
+ "version": "0.1.43",
4
4
  "description": "重点买家未回复预警独立启动器,只读扫描询盘并提醒,不发送任何消息。",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  "node": ">=18"
21
21
  },
22
22
  "dependencies": {
23
- "@yixinkj/yixin-bridge-cli": "^1.0.6"
23
+ "@yixinkj/yixin-bridge-cli": "^1.0.7"
24
24
  },
25
25
  "license": "UNLICENSED",
26
26
  "publishConfig": {
package/skill/SKILL.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: 哨兵预警-0812
3
3
  description: 重点买家未回复预警。只读扫描阿里国际站询盘列表,挑出重点买家(金品店铺为 L2 及以上真实档;出口通店铺只有 L1+ 一个值,它是 L1–L4 的合集,必然包含 L1),判断买家最后一句是否超过 SLA 仍没有真人业务员回复,并输出中文预警清单;机器人自动接待不算人工回复。Use when 用户要求检查重点买家有没有超时未回复、查询盘超时提醒、看 L3/L4 有没有快凉的,或要求运行重点买家预警。
4
- version: "0.1.41"
4
+ version: "0.1.43"
5
5
  ---
6
6
 
7
7
  # 重点买家预警
@@ -19,7 +19,7 @@ version: "0.1.41"
19
19
  ## 运行入口
20
20
 
21
21
  ```bash
22
- npx -y @yixinkj/priority-buyer-alert-cli@latest \
22
+ npx -y @yixinkj/priority-buyer-alert-cli@beta \
23
23
  --skill-path "本次实际读取的 SKILL.md 绝对路径" \
24
24
  --start
25
25
  ```
@@ -68,7 +68,7 @@ npx -y @yixinkj/priority-buyer-alert-cli@latest \
68
68
  按返回的 `poll_after_seconds` 静默轮询,不逐条播报进度:
69
69
 
70
70
  ```bash
71
- npx -y @yixinkj/priority-buyer-alert-cli@latest \
71
+ npx -y @yixinkj/priority-buyer-alert-cli@beta \
72
72
  --skill-path "本次实际读取的 SKILL.md 绝对路径" \
73
73
  --poll-run "run_id"
74
74
  ```
@@ -98,7 +98,7 @@ npx -y @yixinkj/priority-buyer-alert-cli@latest \
98
98
  Skill 起草第一次回复。
99
99
 
100
100
  ```bash
101
- npx -y @yixinkj/priority-buyer-alert-cli@latest \
101
+ npx -y @yixinkj/priority-buyer-alert-cli@beta \
102
102
  --skill-path "本次实际读取的 SKILL.md 绝对路径" \
103
103
  --first-response-scan --since 24
104
104
  ```
@@ -161,12 +161,12 @@ npx -y @yixinkj/priority-buyer-alert-cli@latest \
161
161
 
162
162
  ```bash
163
163
  # 排查预警判定
164
- npx -y @yixinkj/priority-buyer-alert-cli@latest \
164
+ npx -y @yixinkj/priority-buyer-alert-cli@beta \
165
165
  --skill-path "本次实际读取的 SKILL.md 绝对路径" \
166
166
  --start --explain 10
167
167
 
168
168
  # 排查新询盘判定
169
- npx -y @yixinkj/priority-buyer-alert-cli@latest \
169
+ npx -y @yixinkj/priority-buyer-alert-cli@beta \
170
170
  --skill-path "本次实际读取的 SKILL.md 绝对路径" \
171
171
  --first-response-scan --since 24 --explain 10
172
172
  ```
@@ -194,7 +194,7 @@ npx -y @yixinkj/priority-buyer-alert-cli@latest \
194
194
  ```
195
195
 
196
196
  ```bash
197
- npx -y @yixinkj/priority-buyer-alert-cli@latest \
197
+ npx -y @yixinkj/priority-buyer-alert-cli@beta \
198
198
  --skill-path "本次实际读取的 SKILL.md 绝对路径" \
199
199
  --start --minutes 30 --re-alert 30 --mark
200
200
  ```
package/skills.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.33",
2
+ "runtimeVersion": "0.1.34",
3
3
  "platforms": {
4
4
  "darwin-arm64": {
5
5
  "id": "mac-arm64",
@@ -24,7 +24,7 @@
24
24
  "skill": {
25
25
  "name": "哨兵预警-0812",
26
26
  "id": "priority-buyer-alert",
27
- "version": "0.1.41",
27
+ "version": "0.1.43",
28
28
  "bin": "priority-buyer-alert-cli"
29
29
  }
30
30
  }