@yeaft/webchat-agent 0.0.43 → 0.0.44

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/history.js +5 -23
  2. package/package.json +1 -1
package/history.js CHANGED
@@ -227,7 +227,7 @@ export async function handleListFolders(msg) {
227
227
  // 从 session 文件读取真实的工作目录路径
228
228
  const originalPath = getWorkDirFromProjectFolder(entryPath, entry);
229
229
 
230
- // 获取该目录下的会话数量(只计算有实际用户消息的会话)
230
+ // 快速计数:只数 .jsonl 文件数量,不读取文件内容
231
231
  let sessionCount = 0;
232
232
  let lastModified = stats.mtime.getTime();
233
233
 
@@ -236,29 +236,11 @@ export async function handleListFolders(msg) {
236
236
 
237
237
  for (const file of files) {
238
238
  if (file.endsWith('.jsonl')) {
239
- const filePath = join(entryPath, file);
240
- const fileStats = statSync(filePath);
241
- if (fileStats.mtime.getTime() > lastModified) {
242
- lastModified = fileStats.mtime.getTime();
243
- }
244
-
245
- // 检查文件是否包含用户消息(与 getHistorySessions 保持一致)
239
+ sessionCount++;
246
240
  try {
247
- const content = readFileSync(filePath, 'utf-8');
248
- const lines = content.split('\n').filter(l => l.trim()).slice(0, 30);
249
- for (const line of lines) {
250
- try {
251
- const data = JSON.parse(line);
252
- if (data.type === 'user' && data.message?.content) {
253
- const text = typeof data.message.content === 'string'
254
- ? data.message.content
255
- : data.message.content[0]?.text || '';
256
- if (text.trim()) {
257
- sessionCount++;
258
- break;
259
- }
260
- }
261
- } catch {}
241
+ const fileStats = statSync(join(entryPath, file));
242
+ if (fileStats.mtime.getTime() > lastModified) {
243
+ lastModified = fileStats.mtime.getTime();
262
244
  }
263
245
  } catch {}
264
246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",