@yeaft/webchat-agent 1.0.342 → 1.0.344
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/local-runtime/version.json +1 -1
- package/package.json +1 -1
- package/yeaft/debug-trace.js +10 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.
|
|
1
|
+
{"version":"1.0.344"}
|
package/package.json
CHANGED
package/yeaft/debug-trace.js
CHANGED
|
@@ -23,6 +23,14 @@ const MAX_TEXT_BYTES = 1024 * 1024;
|
|
|
23
23
|
const MAX_TOOL_INPUT = 10 * 1024;
|
|
24
24
|
const MAX_INLINE_VALUE_BYTES = 1024 * 1024;
|
|
25
25
|
const MAX_RAW_REQUEST_BYTES = 2 * 1024 * 1024;
|
|
26
|
+
// Raw provider responses are diagnostic duplicates of the normalized response,
|
|
27
|
+
// tool calls, usage and request delta already stored on each loop. Keeping up
|
|
28
|
+
// to 1 MiB per loop made long tool turns produce 100+ MiB trace files. Every
|
|
29
|
+
// buffered flush then JSON.stringify()'d and rewrote that entire file on the
|
|
30
|
+
// agent's single event loop, so several active Sessions appeared deadlocked.
|
|
31
|
+
// A 64 KiB prefix is enough to inspect provider envelopes without letting
|
|
32
|
+
// always-on diagnostics dominate runtime latency.
|
|
33
|
+
const MAX_RAW_RESPONSE_BYTES = 64 * 1024;
|
|
26
34
|
const TRACE_FLUSH_INTERVAL_MS = 5_000;
|
|
27
35
|
const TRACE_FLUSH_DIRTY_LOOPS = 10;
|
|
28
36
|
const MAX_SEARCH_PATTERN_CHARS = 300;
|
|
@@ -758,8 +766,8 @@ export class DebugTrace {
|
|
|
758
766
|
stopReason: info.stopReason || null,
|
|
759
767
|
at: Date.now(),
|
|
760
768
|
rawResponse: typeof info.rawResponse === 'string'
|
|
761
|
-
? truncateText(info.rawResponse,
|
|
762
|
-
: safeJsonValue(info.rawResponse),
|
|
769
|
+
? truncateText(info.rawResponse, MAX_RAW_RESPONSE_BYTES)
|
|
770
|
+
: safeJsonValue(info.rawResponse, MAX_RAW_RESPONSE_BYTES),
|
|
763
771
|
requestDelta: buildRequestDelta(previousSnapshot, snapshot),
|
|
764
772
|
};
|
|
765
773
|
if (loopIndex >= 0) trace.loops[loopIndex] = loop;
|