MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / parseQueueSnapshot

Function parseQueueSnapshot

apps/cli/src/commands/cli/stdin-stream.ts:180–210  ·  view source on GitHub ↗
(rawQueue: unknown)

Source from the content-addressed store, hash-verified

178}
179
180function parseQueueSnapshot(rawQueue: unknown): StreamQueueItem[] | undefined {
181 if (!Array.isArray(rawQueue)) {
182 return undefined
183 }
184
185 const snapshot: StreamQueueItem[] = []
186
187 for (const entry of rawQueue) {
188 if (!isRecord(entry)) {
189 continue
190 }
191
192 const idRaw = entry.id
193 if (typeof idRaw !== "string" || idRaw.trim().length === 0) {
194 continue
195 }
196
197 const imagesRaw = entry.images
198 const timestampRaw = entry.timestamp
199 const imageCount = Array.isArray(imagesRaw) ? imagesRaw.length : 0
200
201 snapshot.push({
202 id: idRaw,
203 text: normalizeQueueText(typeof entry.text === "string" ? entry.text : undefined),
204 imageCount,
205 timestamp: typeof timestampRaw === "number" ? timestampRaw : undefined,
206 })
207 }
208
209 return snapshot
210}
211
212function areStringArraysEqual(a: string[], b: string[]): boolean {
213 if (a.length !== b.length) {

Callers 1

onExtensionMessageFunction · 0.85

Calls 2

normalizeQueueTextFunction · 0.85
isRecordFunction · 0.50

Tested by

no test coverage detected