@yeaft/webchat-agent 1.0.10 → 1.0.12
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 +1 -1
- package/yeaft/tasks/manager.js +7 -2
package/package.json
CHANGED
package/yeaft/tasks/manager.js
CHANGED
|
@@ -11,6 +11,11 @@ import { startShellProcess } from './shell-runner.js';
|
|
|
11
11
|
import { getRuntimePlatformInfo } from '../runtime-platform.js';
|
|
12
12
|
|
|
13
13
|
const LOG_PREVIEW_BYTES = 4096;
|
|
14
|
+
const SUB_AGENT_LOG_PREVIEW_BYTES = 1024 * 1024;
|
|
15
|
+
|
|
16
|
+
function logPreviewBytesFor(task) {
|
|
17
|
+
return task?.kind === 'sub_agent' ? SUB_AGENT_LOG_PREVIEW_BYTES : LOG_PREVIEW_BYTES;
|
|
18
|
+
}
|
|
14
19
|
|
|
15
20
|
function nowIso() {
|
|
16
21
|
return new Date().toISOString();
|
|
@@ -187,7 +192,7 @@ export class TaskManager {
|
|
|
187
192
|
const task = this.active.get(key) || this.store.readTask(sessionId, taskId);
|
|
188
193
|
if (!task || isTerminalTaskStatus(task.status)) return publicSnapshot(task);
|
|
189
194
|
const logPath = task.log?.path || this.store.logPath(sessionId, taskId);
|
|
190
|
-
const tail = this.store.readLogFile(logPath, { tail: true, maxBytes:
|
|
195
|
+
const tail = this.store.readLogFile(logPath, { tail: true, maxBytes: logPreviewBytesFor(task) });
|
|
191
196
|
task.status = status || TASK_STATUS.FAILED;
|
|
192
197
|
task.updatedAt = nowIso();
|
|
193
198
|
task.endedAt = nowIso();
|
|
@@ -254,7 +259,7 @@ export class TaskManager {
|
|
|
254
259
|
const task = this.active.get(key) || this.store.readTask(sessionId, taskId);
|
|
255
260
|
if (!task) return null;
|
|
256
261
|
const logPath = task.log?.path || this.store.logPath(sessionId, taskId);
|
|
257
|
-
const tail = this.store.readLogFile(logPath, { tail: true, maxBytes:
|
|
262
|
+
const tail = this.store.readLogFile(logPath, { tail: true, maxBytes: logPreviewBytesFor(task) });
|
|
258
263
|
task.log = { ...(task.log || {}), path: tail.path, bytes: tail.bytes, preview: tail.text };
|
|
259
264
|
task.updatedAt = nowIso();
|
|
260
265
|
this.store.writeTask(task);
|