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

Method sendReady

hub/src/push/pushNotificationChannel.ts:57–93  ·  view source on GitHub ↗
(session: Session)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 6

buildSessionPathMethod · 0.95
getAgentNameFunction · 0.90
getSessionNameFunction · 0.90
hasVisibleConnectionMethod · 0.80
sendToastMethod · 0.80
sendToNamespaceMethod · 0.80

Tested by

no test coverage detected