mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-08-22 02:48:00 +02:00
Merge streaming tool outputs by CallID with ConcatMessages, pair same-name historical results, and FIFO-match duplicate IDs so concurrent nmap 1/2 and 2/2 stay distinct. Co-authored-by: Cursor <cursoragent@cursor.com>
26 lines
1.3 KiB
JavaScript
26 lines
1.3 KiB
JavaScript
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
|
|
test('tool_result 合并回工具调用卡时会回填空参数', () => {
|
|
const source = fs.readFileSync('web/static/js/monitor.js', 'utf8');
|
|
assert.match(source, /function toolCallArgsEmpty\(args\)/);
|
|
assert.match(source, /const resultArgs = parseToolCallArgsFromData\(data\);/);
|
|
assert.match(source, /toolCallArgsEmpty\(state\.args\) && !toolCallArgsEmpty\(resultArgs\)/);
|
|
assert.match(source, /state\.args = resultArgs;/);
|
|
});
|
|
|
|
test('历史 process_details 合并时也会从 tool_result 补齐 tool_call 参数', () => {
|
|
const source = fs.readFileSync('web/static/js/monitor.js', 'utf8');
|
|
assert.match(source, /function absorbResult\(targetDetail, resultDetail\)/);
|
|
assert.match(source, /targetDetail\.data\.argumentsObj = resultArgs;/);
|
|
assert.match(source, /targetDetail\.data\.arguments = JSON\.stringify\(resultArgs\);/);
|
|
});
|
|
|
|
test('同一 toolCallId 的多次调用按 FIFO 合并结果,避免后一次覆盖导致结果记录缺失', () => {
|
|
const source = fs.readFileSync('web/static/js/monitor.js', 'utf8');
|
|
assert.match(source, /list\.push\(copy\)/);
|
|
assert.match(source, /const candidate = list\.shift\(\)/);
|
|
assert.match(source, /callName === resultName/);
|
|
});
|