import type { PluginService } from "../service.ts"; import type { PluginContext } from "../context.ts"; export declare class HookService implements PluginService { readonly name = "hook-service"; readonly dependencies: string[]; private customHookRegistry?; private deps?; private handlers?; /** * Per-session throttle stamps for the liveness relay * (`sessionId → lastHeartbeatEmittedAt`). Bounded — entries older than the * throttle interval are pruned lazily when the map grows, so completed * sessions do not accumulate forever. */ private readonly livenessHeartbeatAt; /** * Stable reference wrapper returned to opencode. On hot-reload, init() * replaces the methods in-place so the external reference stays valid. */ private handlersWrapper; init(ctx: PluginContext): Promise; dispose(): Promise; getHandlers(): ReturnType; /** * Extract the session id from a canonical event's properties bag, following * the opencode SDK property shapes: direct `sessionID` / `sessionId`, then * the `info` object's `sessionID` / `sessionId` / `id`. */ private static extractEventSessionId; /** * Relay genuine session activity into the graph engine's node-liveness * machinery (false-positive regression fix for the opencode platform). * * A graph node dispatches its subagent through the opencode SDK * (`session.create`), and that subagent's events — `part.created` / * `part.updated` / `message.updated` / `session.idle` — arrive here through * the plugin's `event` hook. For each, resolve the owning graph node via * the GraphToolSet's `sessionId → nodeId` reverse index (populated at * launch when a liveness feed is wired onto the engine — see tool-service) * and refresh its heartbeat through the public EngineRuntime surface. * * Without this relay, `lastActivityAt` freezes at the launch-time * `dispatch` heartbeat, so the engine's NodeLivenessMonitor hard-stalls * (escalate/timeout) every node whose subagent works longer than the * warn+grace deadline (~90 s default) — the confirmed false positive this * fixes. * * The relay is throttled per session (1 s) and fully contained: an unknown * session, a detached node, an absent toolset, or a throwing runtime all * no-op / log at debug — the hook pipeline must never break on a relay * defect. */ private relayLivenessHeartbeat; private buildHandlers; } //# sourceMappingURL=hook-service.d.ts.map