@aiyiran/myclaw 1.0.253 → 1.0.254

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.
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "permissions": {
3
3
  "allow": [
4
- "WebSearch"
4
+ "WebSearch",
5
+ "Bash(python3 -c \"import json,sys; d=json.load\\(sys.stdin\\); agents=d.get\\('agents',{}\\).get\\('list',[]\\); [print\\(a.get\\('id'\\), '|', a.get\\('workspace',''\\)\\) for a in agents if a]\")"
5
6
  ]
6
7
  }
7
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.253",
3
+ "version": "1.0.254",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -211,6 +211,25 @@ function patchAgents() {
211
211
  } else if (alreadyExists) {
212
212
  updated++;
213
213
  console.log('[myclaw-agent] ✅ 已覆盖更新: ' + agentId + ' (' + desc + ') [' + strategy + ']');
214
+
215
+ // strategy=on 且 sessions 为空 → 补发出生消息(agent 存在但从未激活)
216
+ if (strategy === 'on') {
217
+ const sessionFiles = fs.readdirSync(sessionsDir).filter(f => !f.startsWith('.'));
218
+ if (sessionFiles.length === 0) {
219
+ try {
220
+ const nowUtc = new Date();
221
+ const nowBj = new Date(nowUtc.getTime() + 8 * 60 * 60 * 1000);
222
+ const ts = nowBj.getUTCFullYear() + '年' + (nowBj.getUTCMonth() + 1) + '月' + nowBj.getUTCDate() + '日' + String(nowBj.getUTCHours()).padStart(2, '0') + ':' + String(nowBj.getUTCMinutes()).padStart(2, '0');
223
+ const birthMsg = '你好,现在是北京时间' + ts;
224
+ const birthCmd = 'openclaw agent --agent ' + agentId + ' --message ' + JSON.stringify(birthMsg) + ' --json';
225
+ console.log('[myclaw-agent] → sessions 为空,补发出生消息: ' + agentId + ' ...');
226
+ execSync(birthCmd + ' 2>&1', { encoding: 'utf8', timeout: 45000 });
227
+ console.log('[myclaw-agent] ✅ 出生消息已发送: ' + agentId);
228
+ } catch (birthErr) {
229
+ console.log('[myclaw-agent] ⚠ 出生消息发送失败(非致命): ' + (birthErr.message || birthErr));
230
+ }
231
+ }
232
+ }
214
233
  } else {
215
234
  updated++;
216
235
  console.log('[myclaw-agent] ✅ 已更新: ' + agentId + ' (' + desc + ')');