(session: Session)
| 55 | } |
| 56 | |
| 57 | async sendReady(session: Session): Promise<void> { |
| 58 | if (!session.active) { |
| 59 | return |
| 60 | } |
| 61 | |
| 62 | const agentName = getAgentName(session) |
| 63 | const name = getSessionName(session) |
| 64 | |
| 65 | const payload: PushPayload = { |
| 66 | title: 'Ready for input', |
| 67 | body: `${agentName} is waiting in ${name}`, |
| 68 | tag: `ready-${session.id}`, |
| 69 | data: { |
| 70 | type: 'ready', |
| 71 | sessionId: session.id, |
| 72 | url: this.buildSessionPath(session.id) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | const url = payload.data?.url ?? this.buildSessionPath(session.id) |
| 77 | if (this.visibilityTracker.hasVisibleConnection(session.namespace)) { |
| 78 | const delivered = await this.sseManager.sendToast(session.namespace, { |
| 79 | type: 'toast', |
| 80 | data: { |
| 81 | title: payload.title, |
| 82 | body: payload.body, |
| 83 | sessionId: session.id, |
| 84 | url |
| 85 | } |
| 86 | }) |
| 87 | if (delivered > 0) { |
| 88 | return |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | await this.pushService.sendToNamespace(session.namespace, payload) |
| 93 | } |
| 94 | |
| 95 | async sendTaskNotification(session: Session, notification: TaskNotification): Promise<void> { |
| 96 | if (!session.active) { |
nothing calls this directly
no test coverage detected