From 40e5c6a18df40d490062219755880d8777ea981c Mon Sep 17 00:00:00 2001 From: Austin Eral Date: Tue, 17 Feb 2026 20:23:26 +0000 Subject: [PATCH] feat(plugins): expose requestHeartbeatNow on plugin runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add requestHeartbeatNow to PluginRuntime.system so extensions can trigger an immediate heartbeat wake without importing internal modules. This enables extensions to inject a system event and wake the agent in one step — useful for inbound message handlers that use the heartbeat model (e.g. agent-to-agent DMs via Nostr). Changes: - src/plugins/runtime/types.ts: add RequestHeartbeatNow type alias and requestHeartbeatNow to PluginRuntime.system - src/plugins/runtime/index.ts: import and wire requestHeartbeatNow into createPluginRuntime() --- src/plugins/runtime/index.ts | 2 ++ src/plugins/runtime/types.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/runtime/index.ts b/src/plugins/runtime/index.ts index f4a875c2432..d39d3766d21 100644 --- a/src/plugins/runtime/index.ts +++ b/src/plugins/runtime/index.ts @@ -73,6 +73,7 @@ import { probeIMessage } from "../../imessage/probe.js"; import { sendMessageIMessage } from "../../imessage/send.js"; import { onAgentEvent } from "../../infra/agent-events.js"; import { getChannelActivity, recordChannelActivity } from "../../infra/channel-activity.js"; +import { requestHeartbeatNow } from "../../infra/heartbeat-wake.js"; import { enqueueSystemEvent } from "../../infra/system-events.js"; import { listLineAccountIds, @@ -269,6 +270,7 @@ function createRuntimeConfig(): PluginRuntime["config"] { function createRuntimeSystem(): PluginRuntime["system"] { return { enqueueSystemEvent, + requestHeartbeatNow, runCommandWithTimeout, formatNativeDependencyHint, }; diff --git a/src/plugins/runtime/types.ts b/src/plugins/runtime/types.ts index 3cf439b12c5..c4561341d43 100644 --- a/src/plugins/runtime/types.ts +++ b/src/plugins/runtime/types.ts @@ -84,6 +84,7 @@ type WriteConfigFile = typeof import("../../config/config.js").writeConfigFile; type RecordChannelActivity = typeof import("../../infra/channel-activity.js").recordChannelActivity; type GetChannelActivity = typeof import("../../infra/channel-activity.js").getChannelActivity; type EnqueueSystemEvent = typeof import("../../infra/system-events.js").enqueueSystemEvent; +type RequestHeartbeatNow = typeof import("../../infra/heartbeat-wake.js").requestHeartbeatNow; type RunCommandWithTimeout = typeof import("../../process/exec.js").runCommandWithTimeout; type FormatNativeDependencyHint = typeof import("./native-deps.js").formatNativeDependencyHint; type LoadWebMedia = typeof import("../../web/media.js").loadWebMedia; @@ -198,6 +199,7 @@ export type PluginRuntime = { }; system: { enqueueSystemEvent: EnqueueSystemEvent; + requestHeartbeatNow: RequestHeartbeatNow; runCommandWithTimeout: RunCommandWithTimeout; formatNativeDependencyHint: FormatNativeDependencyHint; };