MCPcopy Create free account
hub / github.com/agent-tower/core / withTaskPreviews

Function withTaskPreviews

packages/server/src/services/task.service.ts:190–215  ·  view source on GitHub ↗
(
  task: T,
  options: { omitDescription?: boolean } = {}
)

Source from the content-addressed store, hash-verified

188 for (const character of value) {
189 sourceOffset += character.length;
190 if (/\s/u.test(character)) {
191 if (compacted.length > 0) {
192 hasPendingWhitespace = true;
193 pendingWhitespaceEnd = sourceOffset;
194 }
195 continue;
196 }
197
198 if (hasPendingWhitespace) {
199 compacted += ' ';
200 sourceEndOffsets.push(pendingWhitespaceEnd);
201 hasPendingWhitespace = false;
202 }
203 compacted += character;
204 for (let index = 0; index < character.length; index += 1) {
205 sourceEndOffsets.push(sourceOffset);
206 }
207 }
208
209 return { value: compacted, sourceEndOffsets };
210}
211
212function getTitleSeparatorLength(remainder: string): number {
213 const lineSeparator = remainder.match(/^[ \t]*(?:\r\n|\r|\n)/u);
214 if (lineSeparator) {
215 return lineSeparator[0].length;
216 }
217 return /^[ \t]/u.test(remainder) ? 1 : 0;
218}

Callers 2

findByProjectIdMethod · 0.85
findByIdMethod · 0.85

Calls 1

buildTextPreviewFunction · 0.85

Tested by

no test coverage detected