(
annotationId: string,
role: "human" | "agent",
content: string
)
| 195 | }, |
| 196 | |
| 197 | addThreadMessage( |
| 198 | annotationId: string, |
| 199 | role: "human" | "agent", |
| 200 | content: string |
| 201 | ): Annotation | undefined { |
| 202 | const annotation = annotations.get(annotationId); |
| 203 | if (!annotation) return undefined; |
| 204 | |
| 205 | const message: ThreadMessage = { |
| 206 | id: generateId(), |
| 207 | role, |
| 208 | content, |
| 209 | timestamp: Date.now(), |
| 210 | }; |
| 211 | |
| 212 | if (!annotation.thread) { |
| 213 | annotation.thread = []; |
| 214 | } |
| 215 | annotation.thread.push(message); |
| 216 | annotation.updatedAt = new Date().toISOString(); |
| 217 | |
| 218 | if (annotation.sessionId) { |
| 219 | const event = eventBus.emit("thread.message", annotation.sessionId, message); |
| 220 | events.push(event); |
| 221 | } |
| 222 | |
| 223 | return annotation; |
| 224 | }, |
| 225 | |
| 226 | getPendingAnnotations(sessionId: string): Annotation[] { |
| 227 | return Array.from(annotations.values()).filter( |
no test coverage detected
searching dependent graphs…