MCPcopy Create free account
hub / github.com/getagentseal/codeburn / extractLargeAddedNamesBuffer

Function extractLargeAddedNamesBuffer

src/parser.ts:740–768  ·  view source on GitHub ↗
(source: Buffer, attachmentBounds: BufferJsonValueBounds | null)

Source from the content-addressed store, hash-verified

738}
739
740function extractLargeAddedNamesBuffer(source: Buffer, attachmentBounds: BufferJsonValueBounds | null): string[] {
741 if (!attachmentBounds || attachmentBounds.kind !== 'object') return []
742 const attachmentType = readJsonStringBuffer(
743 source,
744 findObjectFieldValueBuffer(source, attachmentBounds.start, attachmentBounds.end, 'type'),
745 )
746 if (attachmentType !== 'deferred_tools_delta') return []
747 const addedNames = findObjectFieldValueBuffer(source, attachmentBounds.start, attachmentBounds.end, 'addedNames')
748 if (!addedNames || addedNames.kind !== 'array') return []
749 const names: string[] = []
750 let i = addedNames.start + 1
751 while (i < addedNames.end - 1 && names.length < MAX_ADDED_NAMES) {
752 while (i < addedNames.end && isJsonWhitespaceByte(source[i])) i++
753 if (source[i] === 0x2c) {
754 i++
755 continue
756 }
757 if (source[i] !== 0x22) {
758 i++
759 continue
760 }
761 const end = findJsonStringEndBuffer(source, i, addedNames.end)
762 if (end === -1) break
763 const name = readJsonStringBuffer(source, { start: i, end: end + 1, kind: 'string' }, 500)
764 if (name) names.push(name)
765 i = end + 1
766 }
767 return names
768}
769
770function parseLargeJsonlBuffer(line: Buffer): JournalEntry | null {
771 let rootStart = 0

Callers 1

parseLargeJsonlBufferFunction · 0.85

Calls 4

readJsonStringBufferFunction · 0.85
isJsonWhitespaceByteFunction · 0.85
findJsonStringEndBufferFunction · 0.85

Tested by

no test coverage detected