@yeaft/webchat-agent 1.0.477 → 1.0.479
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/server/context.js +25 -0
- package/local-runtime/server/handlers/agent-output.js +29 -1
- package/local-runtime/version.json +1 -1
- package/local-runtime/web/app.bundle.js +115 -148
- package/local-runtime/web/app.bundle.js.gz +0 -0
- package/local-runtime/web/index.html +2 -2
- package/local-runtime/web/style.bundle.css +1 -1
- package/local-runtime/web/style.bundle.css.gz +0 -0
- package/package.json +1 -1
- package/yeaft/debug-trace.js +39 -362
- package/yeaft/engine.js +16 -9
- package/yeaft/web-bridge.js +39 -2
package/yeaft/web-bridge.js
CHANGED
|
@@ -35,6 +35,43 @@ import { buildPluginCatalog, createPluginSkillManager, resolveMcpPluginPolicy }
|
|
|
35
35
|
import { MCPManager } from './mcp.js';
|
|
36
36
|
import { sendToServer } from '../connection/buffer.js';
|
|
37
37
|
import ctx from '../context.js';
|
|
38
|
+
|
|
39
|
+
const DEBUG_HISTORY_CHUNK_BYTES = 512 * 1024;
|
|
40
|
+
|
|
41
|
+
function splitUtf8Json(text, maxBytes = DEBUG_HISTORY_CHUNK_BYTES) {
|
|
42
|
+
const source = Buffer.from(text, 'utf8');
|
|
43
|
+
const chunks = [];
|
|
44
|
+
for (let start = 0; start < source.length;) {
|
|
45
|
+
let end = Math.min(source.length, start + maxBytes);
|
|
46
|
+
if (end < source.length) {
|
|
47
|
+
while (end > start && (source[end] & 0xc0) === 0x80) end -= 1;
|
|
48
|
+
if (end === start) throw new Error('Unable to split debug history UTF-8 payload');
|
|
49
|
+
}
|
|
50
|
+
chunks.push(source.subarray(start, end).toString('utf8'));
|
|
51
|
+
start = end;
|
|
52
|
+
}
|
|
53
|
+
return chunks;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function sendDebugHistory(payload) {
|
|
57
|
+
const encoded = JSON.stringify(payload);
|
|
58
|
+
if (Buffer.byteLength(encoded, 'utf8') <= DEBUG_HISTORY_CHUNK_BYTES) {
|
|
59
|
+
await sendToServer(payload); // Legacy single-frame wire remains valid.
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const chunks = splitUtf8Json(encoded);
|
|
63
|
+
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex += 1) {
|
|
64
|
+
await sendToServer({
|
|
65
|
+
type: 'yeaft_debug_history_chunk',
|
|
66
|
+
requestId: payload.requestId,
|
|
67
|
+
sessionId: payload.sessionId,
|
|
68
|
+
chunkIndex,
|
|
69
|
+
chunkCount: chunks.length,
|
|
70
|
+
data: chunks[chunkIndex],
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
38
75
|
import { hydrateYeaftStatusFromSession } from './status-cache.js';
|
|
39
76
|
import { handleVpSubscribe } from './vp/vp-bridge.js';
|
|
40
77
|
import { createVp, updateVp, deleteVp, readVp, VpCrudError } from './vp/vp-crud.js';
|
|
@@ -6694,7 +6731,7 @@ export async function handleYeaftFetchDebugHistory(msg = {}) {
|
|
|
6694
6731
|
hasMore = !!out?.hasMore;
|
|
6695
6732
|
}
|
|
6696
6733
|
} catch (err) {
|
|
6697
|
-
|
|
6734
|
+
await sendDebugHistory({
|
|
6698
6735
|
type: 'yeaft_debug_history',
|
|
6699
6736
|
loops: [],
|
|
6700
6737
|
turns: [],
|
|
@@ -6712,7 +6749,7 @@ export async function handleYeaftFetchDebugHistory(msg = {}) {
|
|
|
6712
6749
|
});
|
|
6713
6750
|
return;
|
|
6714
6751
|
}
|
|
6715
|
-
|
|
6752
|
+
await sendDebugHistory({
|
|
6716
6753
|
type: 'yeaft_debug_history',
|
|
6717
6754
|
loops,
|
|
6718
6755
|
turns,
|