Problem
Plugins (like Hermes event bridge) need to trigger a heartbeat on a specific session after enqueuing a system event. The function requestHeartbeatNow exists in core (src/infra/heartbeat-wake.ts) and already accepts { reason, sessionKey, agentId, coalesceMs }, but it is not exposed in the plugin runtime API (PluginRuntime.system).
Current Workaround
Plugins must POST to /hooks/wake via HTTP loopback, which:
- Only wakes the main session (no sessionKey support)
- Adds unnecessary HTTP round-trip for an in-process call
- Cannot target a specific session
Proposed Change
Add requestHeartbeatNow to createRuntimeSystem() in src/plugins/runtime/index.ts:
function createRuntimeSystem(): PluginRuntime["system"] {
return {
enqueueSystemEvent,
runCommandWithTimeout,
formatNativeDependencyHint,
requestHeartbeatNow, // <-- add this
};
}
And add the type to PluginRuntime in src/plugins/runtime/types.ts:
system: {
enqueueSystemEvent: EnqueueSystemEvent;
runCommandWithTimeout: RunCommandWithTimeout;
formatNativeDependencyHint: FormatNativeDependencyHint;
requestHeartbeatNow: typeof import("../../infra/heartbeat-wake.js").requestHeartbeatNow;
};
Use Case
Hermes event bridge plugin receives webhooks (Hive task completion, CI results) and needs to wake a specific agent session to process the event. The flow:
enqueueSystemEvent(text, { sessionKey }) — already works via plugin API
requestHeartbeatNow({ reason: "hook:hermes", sessionKey }) — needs this addition
- Heartbeat runner routes to the correct session, agent processes the event with full context
Without this, plugins either create orphan sessions (via hooks action: agent) or can only wake the main session (via /hooks/wake).
Problem
Plugins (like Hermes event bridge) need to trigger a heartbeat on a specific session after enqueuing a system event. The function
requestHeartbeatNowexists in core (src/infra/heartbeat-wake.ts) and already accepts{ reason, sessionKey, agentId, coalesceMs }, but it is not exposed in the plugin runtime API (PluginRuntime.system).Current Workaround
Plugins must POST to
/hooks/wakevia HTTP loopback, which:Proposed Change
Add
requestHeartbeatNowtocreateRuntimeSystem()insrc/plugins/runtime/index.ts:And add the type to
PluginRuntimeinsrc/plugins/runtime/types.ts:Use Case
Hermes event bridge plugin receives webhooks (Hive task completion, CI results) and needs to wake a specific agent session to process the event. The flow:
enqueueSystemEvent(text, { sessionKey })— already works via plugin APIrequestHeartbeatNow({ reason: "hook:hermes", sessionKey })— needs this additionWithout this, plugins either create orphan sessions (via hooks
action: agent) or can only wake the main session (via/hooks/wake).