ai-helper-agent 1.2.0 → 1.3.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/server.js +11 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-helper-agent",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "AI Helper 本地代理服务 - 为 Chrome 扩展提供本地文件读写和系统命令执行能力",
5
5
  "type": "module",
6
6
  "main": "./src/server.js",
package/src/server.js CHANGED
@@ -2,7 +2,8 @@
2
2
  import http from 'http';
3
3
  import { WebSocketServer } from 'ws';
4
4
  import { readFileSync, writeFileSync, readdirSync, statSync, unlinkSync, rmdirSync, existsSync, chmodSync } from 'fs';
5
- import { join } from 'path';
5
+ import { join, dirname } from 'path';
6
+ import { fileURLToPath } from 'url';
6
7
  import { homedir } from 'os';
7
8
  import os from 'os';
8
9
  import { loadConfig } from './config.js';
@@ -12,6 +13,9 @@ import { executeCommand, executeCommandSync, addWsClient, killProcess, getRunnin
12
13
  import { setConsoleOutput, logAuth, logFs, logExec, logSecurity, logSystem, logError, queryLogs, getLogDates } from './logger.js';
13
14
  import { initSearchTools, getSearchToolsAvailable, searchFiles, searchContent } from './search.js';
14
15
 
16
+ const __dirname = dirname(fileURLToPath(import.meta.url));
17
+ const AGENT_VERSION = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8')).version;
18
+
15
19
  const MAX_BODY_SIZE = 10 * 1024 * 1024; // 10MB
16
20
  const MAX_SEARCH_RESULTS = 5000; // 单次搜索最大结果数
17
21
  const MAX_LOG_QUERY_LIMIT = 1000; // 日志查询最大条数
@@ -145,7 +149,7 @@ export function startServer() {
145
149
  if (req.method === 'GET' && pathname === '/api/status') {
146
150
  return jsonResponse(res, 200, {
147
151
  success: true,
148
- version: '1.0.0',
152
+ version: AGENT_VERSION,
149
153
  running: true,
150
154
  ...PLATFORM_INFO,
151
155
  searchTools: getSearchToolsAvailable()
@@ -179,9 +183,13 @@ export function startServer() {
179
183
  if (req.method === 'GET' && pathname === '/api/status/detail') {
180
184
  return jsonResponse(res, 200, {
181
185
  success: true,
182
- version: '1.0.0',
186
+ version: AGENT_VERSION,
183
187
  pairCode: getCurrentPairCode(),
188
+ pairCodeTTL: config.pairCodeTTL,
184
189
  workdir: config.workdir,
190
+ allowedPaths: config.allowedPaths,
191
+ commandTimeout: config.commandTimeout,
192
+ fileMaxSize: config.fileMaxSize,
185
193
  runningProcesses: getRunningProcesses(),
186
194
  ...PLATFORM_INFO,
187
195
  searchTools: getSearchToolsAvailable()