From 95694c9f6132027e8e80f8846a4880f77d9d622c Mon Sep 17 00:00:00 2001 From: R-M-Naveen Date: Thu, 5 Mar 2026 17:53:24 -0600 Subject: [PATCH 1/2] fix(atxp): send account_id for notification matching, fix heartbeat payload - Use accountId directly instead of stripping email prefix, so notifications match on atxp_acct_* rather than agent_* identities - Fix heartbeat instruction: use 'message' field (not 'text'), reference /hooks/agent endpoint, add sender name Co-Authored-By: Claude Opus 4.6 --- packages/atxp/src/commands/notifications.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/atxp/src/commands/notifications.ts b/packages/atxp/src/commands/notifications.ts index 8677c12..c4ec15b 100644 --- a/packages/atxp/src/commands/notifications.ts +++ b/packages/atxp/src/commands/notifications.ts @@ -63,7 +63,8 @@ async function sendHeartbeatInstruction(webhookUrl: string, hooksToken: string): 'Authorization': `Bearer ${hooksToken}`, }, body: JSON.stringify({ - text: 'SYSTEM: Push notifications are now enabled. Save the following text EXACTLY as-is to your HEARTBEAT.md file:\n\n# Notifications\n\nWhen you receive a message from /hooks/wake, it is a system event (e.g. inbound email). Do NOT just reply in the current chat. You MUST proactively use the message tool to broadcast the notification to every connected channel. Check your available tools, find all messaging channels, and send the notification to each one individually. The goal is that the owner sees the notification regardless of which channel they are watching.', + message: 'SYSTEM: Push notifications are now enabled. Save the following text EXACTLY as-is to your HEARTBEAT.md file:\n\n# Notifications\n\nWhen you receive a message from /hooks/agent, it is a system event (e.g. inbound email). Do NOT just reply in the current chat. You MUST proactively use the message tool to broadcast the notification to every connected channel. Check your available tools, find all messaging channels, and send the notification to each one individually. The goal is that the owner sees the notification regardless of which channel they are watching.', + name: 'Notification System', }), }); if (!res.ok) { @@ -89,12 +90,10 @@ function getMachineId(): string | undefined { return undefined; } -async function getEmailUserId(): Promise { +async function getAccountId(): Promise { const { getAccountInfo } = await import('./whoami.js'); const account = await getAccountInfo(); - if (!account?.email) return undefined; - // Extract local part: agent_xyz@atxp.email -> agent_xyz - return account.email.split('@')[0]; + return account?.accountId; } async function enableNotifications(): Promise { @@ -107,11 +106,11 @@ async function enableNotifications(): Promise { console.log(chalk.gray('Enabling push notifications...')); - // Resolve email user ID for event matching - const emailUserId = await getEmailUserId(); + // Resolve account ID for event matching + const accountId = await getAccountId(); const body: Record = { machine_id: machineId }; - if (emailUserId) body.email_user_id = emailUserId; + if (accountId) body.email_user_id = accountId; const res = await fetch(`${NOTIFICATIONS_BASE_URL}/notifications/enable`, { method: 'POST', From 465c9086472fcc67780ab11edfecef49e5de4745 Mon Sep 17 00:00:00 2001 From: R-M-Naveen Date: Thu, 5 Mar 2026 18:04:01 -0600 Subject: [PATCH 2/2] refactor(atxp): rename email_user_id to account_id in notifications request Co-Authored-By: Claude Opus 4.6 --- packages/atxp/src/commands/notifications.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/atxp/src/commands/notifications.ts b/packages/atxp/src/commands/notifications.ts index c4ec15b..7b2b580 100644 --- a/packages/atxp/src/commands/notifications.ts +++ b/packages/atxp/src/commands/notifications.ts @@ -110,7 +110,7 @@ async function enableNotifications(): Promise { const accountId = await getAccountId(); const body: Record = { machine_id: machineId }; - if (accountId) body.email_user_id = accountId; + if (accountId) body.account_id = accountId; const res = await fetch(`${NOTIFICATIONS_BASE_URL}/notifications/enable`, { method: 'POST',