fix: block malformed structured silent envelope leaks

This commit is contained in:
Eyejoker
2026-03-28 06:04:26 +09:00
parent 0eb2270030
commit 47dda19ded
3 changed files with 82 additions and 1 deletions

View File

@@ -51,6 +51,21 @@ describe('classifySuppressTokenOutput', () => {
),
).toBe('exact');
});
it('treats a truncated structured silent envelope as mixed', () => {
expect(
classifySuppressTokenOutput('{"ejclaw":{"visibility":"silent"', undefined),
).toBe('mixed');
});
it('treats a structured silent envelope mixed with extra text as mixed', () => {
expect(
classifySuppressTokenOutput(
'{"ejclaw":{"visibility":"silent"}} extra',
undefined,
),
).toBe('mixed');
});
});
describe('parseStructuredOutputEnvelope', () => {