MCPcopy Create free account
hub / github.com/tiann/hapi / handleIncomingMessage

Method handleIncomingMessage

cli/src/api/apiSession.ts:358–370  ·  view source on GitHub ↗
(message: { id?: string; seq?: number; localId?: string | null; content: unknown })

Source from the content-addressed store, hash-verified

356 }
357
358 private handleIncomingMessage(message: { id?: string; seq?: number; localId?: string | null; content: unknown }): void {
359 if (!this.incomingFilter.accept({ id: message.id, seq: message.seq })) {
360 return
361 }
362
363 const userResult = UserMessageSchema.safeParse(message.content)
364 if (userResult.success) {
365 this.enqueueUserMessage(userResult.data, message.localId ?? undefined)
366 return
367 }
368
369 this.emit('message', message.content)
370 }
371
372 private async backfillIfNeeded(): Promise<void> {
373 if (!this.needsBackfill) {

Callers 2

constructorMethod · 0.95
runMethod · 0.95

Calls 3

enqueueUserMessageMethod · 0.95
acceptMethod · 0.80
emitMethod · 0.45

Tested by

no test coverage detected