fix(esmole): truncate all tool responses; guard normalizes leading slash

This commit is contained in:
admin committed 2026-06-16 21:21:20 +05:00
1 parent ab5416f443
commit dd6ca2deff
10 files changed
+94 -16

No files matched your search

@@ -28,4 +28,26 @@ describe('runGetMapping', () => {
expect(out.body).toEqual({ error: 'not_found' })
expect(out.fields).toBeUndefined()
})
it('truncates an over-budget flattened-fields response', async () => {
const properties: Record<string, { type: string }> = {}
for (let i = 0; i < 50; i++) {
properties['field_with_a_long_name_' + i] = { type: 'keyword' }
}
const out = await runGetMapping(
managed(200, { idx: { mappings: { properties } } }),
'idx',
false,
100
)
expect(out.truncated).toBe(true)
})
it('truncates an over-budget raw response', async () => {
const big: Record<string, string> = {}
for (let i = 0; i < 50; i++) {
big['key_with_a_fairly_long_name_' + i] = 'some value here ' + i
}
const out = await runGetMapping(managed(200, big), 'idx', true, 100)
expect(out.truncated).toBe(true)
expect(out.fields).toBeUndefined()
})
})