ai-helper-agent 1.5.0 → 1.5.2

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": "ai-helper-agent",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "AI Helper 代理服务 - 为 Chrome 扩展提供本地文件读写和系统命令执行能力",
5
5
  "type": "module",
6
6
  "main": "./src/server.js",
package/src/server.js CHANGED
@@ -5,7 +5,7 @@ import { readFileSync, writeFileSync, readdirSync, statSync, unlinkSync, rmdirSy
5
5
  import { join, dirname } from 'path';
6
6
  import { fileURLToPath } from 'url';
7
7
  import { homedir } from 'os';
8
- import { exec } from 'child_process';
8
+ import { spawn } from 'child_process';
9
9
  import os from 'os';
10
10
  import { loadConfig } from './config.js';
11
11
  import { verifyToken, getCurrentPairCode, startPairCodeRotation, stopPairCodeRotation, handlePairRequest } from './auth.js';
@@ -379,23 +379,23 @@ export function startServer() {
379
379
  }
380
380
 
381
381
  const fileUrl = `file://${check.resolved}`;
382
- let openCmd;
383
382
  const platform = os.platform();
383
+ let cmd, args, spawnOpts;
384
384
  if (platform === 'darwin') {
385
- openCmd = `open "${fileUrl}"`;
385
+ cmd = 'open';
386
+ args = [fileUrl];
387
+ spawnOpts = { detached: true, stdio: 'ignore' };
386
388
  } else if (platform === 'win32') {
387
- openCmd = `start "" "${fileUrl}"`;
389
+ cmd = 'start';
390
+ args = ['""', `"${fileUrl}"`];
391
+ spawnOpts = { detached: true, stdio: 'ignore', shell: true, windowsHide: true };
388
392
  } else {
389
- openCmd = `xdg-open "${fileUrl}"`;
393
+ cmd = 'xdg-open';
394
+ args = [fileUrl];
395
+ spawnOpts = { detached: true, stdio: 'ignore' };
390
396
  }
391
397
 
392
- exec(openCmd, (err) => {
393
- if (err) {
394
- logError('browser_open', { path: check.resolved, error: err.message });
395
- // exec 是异步回调,这里无法直接在回调中响应
396
- // 但实际上如果能执行命令,浏览器大概率会成功打开
397
- }
398
- });
398
+ spawn(cmd, args, spawnOpts).unref();
399
399
 
400
400
  logFs('browser_open', { path: check.resolved, platform });
401
401
  return jsonResponse(res, 200, { success: true, path: check.resolved, platform });
@@ -66,7 +66,15 @@ export function initializeSkillRegistry() {
66
66
  }
67
67
  }
68
68
 
69
- // 3. 恢复内置技能的启用状态(用户通过停止/启用的状态)
69
+ // 3. 标记内置技能的特殊属性(skill-creator 是内置技能,不可编辑、不可删除)
70
+ const skillCreator = skills.get('skill-creator');
71
+ if (skillCreator) {
72
+ skillCreator.builtin = true;
73
+ skillCreator.editable = false;
74
+ skillCreator.deletable = false;
75
+ }
76
+
77
+ // 4. 恢复内置技能的启用状态(用户通过停止/启用的状态)
70
78
  const builtinState = loadBuiltinState();
71
79
  for (const [name, enabled] of Object.entries(builtinState)) {
72
80
  const skill = skills.get(name);