Heartbeat: inject cron-style current time into prompts (#13733)

* Heartbeat: inject cron-style current time into prompts

* Tests: fix type for web heartbeat timestamp test

* Infra: inline heartbeat current-time injection
This commit is contained in:
Tak Hoffman
2026-02-10 18:58:45 -06:00
committed by GitHub
parent a853ded782
commit d2c2f4185b
6 changed files with 98 additions and 17 deletions

View File

@@ -493,13 +493,11 @@ describe("runHeartbeatOnce", () => {
2,
),
);
replySpy.mockResolvedValue([{ text: "Final alert" }]);
const sendWhatsApp = vi.fn().mockResolvedValue({
messageId: "m1",
toJid: "jid",
});
await runHeartbeatOnce({
cfg,
agentId: "ops",
@@ -511,11 +509,13 @@ describe("runHeartbeatOnce", () => {
hasActiveWebListener: () => true,
},
});
expect(sendWhatsApp).toHaveBeenCalledTimes(1);
expect(sendWhatsApp).toHaveBeenCalledWith("+1555", "Final alert", expect.any(Object));
expect(replySpy).toHaveBeenCalledWith(
expect.objectContaining({ Body: "Ops check", SessionKey: sessionKey }),
expect.objectContaining({
Body: expect.stringMatching(/Ops check[\s\S]*Current time: /),
SessionKey: sessionKey,
}),
{ isHeartbeat: true },
cfg,
);