mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-07 18:05:30 +08:00
refactor: remove JSON-based tool call parsing from sieve and delete associated compatibility tests
This commit is contained in:
@@ -129,7 +129,7 @@ test('parseChunkForContent keeps split response/content fragments inside respons
|
||||
assert.equal(combined, '{"tool_calls":[{"name":"read_file","input":{"path":"README.MD"}}]}');
|
||||
});
|
||||
|
||||
test('parseChunkForContent + sieve does not leak suspicious prefix in split tool json case', () => {
|
||||
test('parseChunkForContent + sieve passes JSON tool payload through as text (XML-only)', () => {
|
||||
const chunk = {
|
||||
p: 'response',
|
||||
v: [
|
||||
@@ -146,15 +146,14 @@ test('parseChunkForContent + sieve does not leak suspicious prefix in split tool
|
||||
events.push(...flushToolSieve(state, ['read_file']));
|
||||
|
||||
const hasToolCalls = events.some((evt) => evt.type === 'tool_calls' && evt.calls && evt.calls.length > 0);
|
||||
const hasToolDeltas = events.some((evt) => evt.type === 'tool_call_deltas' && evt.deltas && evt.deltas.length > 0);
|
||||
const leakedText = events
|
||||
.filter((evt) => evt.type === 'text' && evt.text)
|
||||
.map((evt) => evt.text)
|
||||
.join('');
|
||||
|
||||
assert.equal(hasToolCalls || hasToolDeltas, true);
|
||||
assert.equal(leakedText.includes('{'), false);
|
||||
assert.equal(leakedText.toLowerCase().includes('tool_calls'), false);
|
||||
// JSON payloads are no longer intercepted — they pass through as text.
|
||||
assert.equal(hasToolCalls, false);
|
||||
assert.equal(leakedText.includes('tool_calls'), true);
|
||||
});
|
||||
|
||||
test('parseChunkForContent consumes nested item.v array payloads', () => {
|
||||
|
||||
Reference in New Issue
Block a user