import type { SpawnSessionInput, SpawnSessionOutcome } from "../../gateway/spawn-session.js"; import type { WorkflowService } from "../../workflows/service.js"; import type { PluginHostVerb } from "./permissions.js"; /** * What a plugin's backend needs from a *running* gateway, registered once at * boot — the same shape `work-items/live-events.ts` uses, and for the same * reason: a plugin's server module is loaded by the plugin loader, which has no * request and no `ApiContext` to thread through it. * * Null is the honest state in tests and in CLI runs with no server. The members * answer it differently on purpose: a notice that nobody can show is dropped, * because a plugin should not fall over for want of a toast, while a spawn, a * Workflow run or a connector send that cannot happen throws, because silently * not doing the thing is the failure a caller must never have to discover for * itself. */ export type PluginNoticeLevel = "info" | "warning" | "error"; /** Mirrors `SpawnSessionOutcome`: a refusal a caller must read, not an exception * the registration seam decides the wording of. */ export type PluginConnectorSendOutcome = { ok: true; } | { ok: false; error: string; }; export interface PluginHostGateway { spawnSession: (input: SpawnSessionInput) => Promise; emitNotice: (pluginId: string, message: string, level: PluginNoticeLevel) => void; /** Absent when the gateway runs without the Workflow engine, which `ApiContext` * allows; `requireWorkflowService` is what says so out loud. */ workflowService?: WorkflowService; sendConnectorMessage: (connector: string, message: { channel: string; thread?: string; text: string; }) => Promise; } export declare function setPluginHostGateway(next: PluginHostGateway | null): void; /** Throws rather than returning null, so every caller that needs the gateway * says why it could not act instead of returning an empty success. */ export declare function requirePluginHostGateway(verb: PluginHostVerb): PluginHostGateway; export declare function requireWorkflowService(verb: PluginHostVerb): WorkflowService; export declare function emitPluginNotice(pluginId: string, message: string, level: PluginNoticeLevel): void; //# sourceMappingURL=gateway-link.d.ts.map