MCPcopy
hub / github.com/benjitaylor/agentation / addThreadMessage

Function addThreadMessage

mcp/src/server/sqlite.ts:498–522  ·  view source on GitHub ↗
(
      annotationId: string,
      role: "human" | "agent",
      content: string
    )

Source from the content-addressed store, hash-verified

496 },
497
498 addThreadMessage(
499 annotationId: string,
500 role: "human" | "agent",
501 content: string
502 ): Annotation | undefined {
503 const existing = this.getAnnotation(annotationId);
504 if (!existing) return undefined;
505
506 const message: ThreadMessage = {
507 id: generateId(),
508 role,
509 content,
510 timestamp: Date.now(),
511 };
512
513 const thread = [...(existing.thread || []), message];
514 const updated = this.updateAnnotation(annotationId, { thread });
515
516 if (updated && existing.sessionId) {
517 const event = eventBus.emit("thread.message", existing.sessionId, message);
518 persistEvent(event);
519 }
520
521 return updated;
522 },
523
524 getPendingAnnotations(sessionId: string): Annotation[] {
525 const rows = stmts.getPendingAnnotations.all(sessionId) as Record<string, unknown>[];

Callers

nothing calls this directly

Calls 5

persistEventFunction · 0.85
getAnnotationMethod · 0.80
updateAnnotationMethod · 0.80
emitMethod · 0.80
generateIdFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…