claw-subagent-service 0.0.173 → 0.0.175
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": "claw-subagent-service",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.175",
|
|
4
4
|
"description": "虾说智能助手",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"publish:patch": "npm version patch && npm publish",
|
|
16
16
|
"publish:minor": "npm version minor && npm publish",
|
|
17
17
|
"publish:major": "npm version major && npm publish",
|
|
18
|
+
"unpublish:last": "node scripts/unpublish.js",
|
|
19
|
+
"unpublish:version": "node scripts/unpublish.js",
|
|
20
|
+
"deprecate:last": "npm deprecate $(node -p \"require('./package.json').name\")@$(node -p \"require('./package.json').version\") \"This version is deprecated. Please upgrade.\"",
|
|
21
|
+
"deprecate:version": "npm deprecate",
|
|
18
22
|
"sync": "node scripts/sync-local.js"
|
|
19
23
|
},
|
|
20
24
|
"files": [
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// scripts/unpublish.js
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
const pkg = require('../package.json');
|
|
5
|
+
|
|
6
|
+
const name = pkg.name;
|
|
7
|
+
const version = process.argv[2] || pkg.version;
|
|
8
|
+
const tag = `v${version}`;
|
|
9
|
+
|
|
10
|
+
console.log(`\n🗑️ Unpublishing ${name}@${version}...\n`);
|
|
11
|
+
|
|
12
|
+
// 1. 撤销 npm 包
|
|
13
|
+
try {
|
|
14
|
+
execSync(`npm unpublish ${name}@${version} --force`, { stdio: 'inherit' });
|
|
15
|
+
console.log(`✅ npm 撤销成功\n`);
|
|
16
|
+
} catch (e) {
|
|
17
|
+
console.log(`⚠️ npm 撤销失败(可能已撤销或超时)\n`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 2. 删除 git tag
|
|
21
|
+
try { execSync(`git tag -d ${tag}`, { stdio: 'pipe' }); console.log(`✅ 本地 tag ${tag} 已删除`); }
|
|
22
|
+
catch (e) { console.log(`⚠️ 本地 tag ${tag} 不存在`); }
|
|
23
|
+
|
|
24
|
+
try { execSync(`git push origin :refs/tags/${tag}`, { stdio: 'pipe' }); console.log(`✅ 远程 tag ${tag} 已删除`); }
|
|
25
|
+
catch (e) { console.log(`⚠️ 远程 tag ${tag} 不存在或无权限`); }
|
|
26
|
+
|
|
27
|
+
// 3. ⭐ 回退 package.json 版本(patch 级别减 1)
|
|
28
|
+
const parts = version.split('.').map(Number);
|
|
29
|
+
parts[2] = Math.max(0, parts[2] - 1); // patch - 1,最低为 0
|
|
30
|
+
const newVersion = parts.join('.');
|
|
31
|
+
|
|
32
|
+
pkg.version = newVersion;
|
|
33
|
+
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2) + '\n');
|
|
34
|
+
|
|
35
|
+
console.log(`\n📦 package.json 版本已回退: ${version} → ${newVersion}`);
|
|
36
|
+
console.log(`🎉 清理完成!现在可以重新 publish:patch 了\n`);
|
|
@@ -720,14 +720,30 @@ class MessageHandler {
|
|
|
720
720
|
let remoteUrl = '';
|
|
721
721
|
let duration = 0;
|
|
722
722
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
723
|
+
// 先尝试解析 content(可能是 JSON 字符串)
|
|
724
|
+
let parsedContent = content;
|
|
725
|
+
if (typeof content === 'string' && content.startsWith('{')) {
|
|
726
|
+
try {
|
|
727
|
+
parsedContent = JSON.parse(content);
|
|
728
|
+
} catch (e) {
|
|
729
|
+
// 解析失败,保持原样
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
if (typeof parsedContent === 'object' && parsedContent !== null) {
|
|
734
|
+
remoteUrl = parsedContent.remoteUrl || parsedContent.url || '';
|
|
735
|
+
duration = parsedContent.duration || 0;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
// 兜底:从 msg 根对象查找
|
|
739
|
+
if (!remoteUrl) {
|
|
727
740
|
remoteUrl = msg.remoteUrl || msg.url || msg.localPath || '';
|
|
728
741
|
}
|
|
742
|
+
if (!duration) {
|
|
743
|
+
duration = msg.duration || 0;
|
|
744
|
+
}
|
|
729
745
|
|
|
730
|
-
this.log?.info(`[_extractMessageContent] 语音消息: remoteUrl=${remoteUrl}`);
|
|
746
|
+
this.log?.info(`[_extractMessageContent] 语音消息: remoteUrl=${remoteUrl}, duration=${duration}`);
|
|
731
747
|
return `[语音] ${remoteUrl} ${duration}秒`;
|
|
732
748
|
}
|
|
733
749
|
|