import type { PluginService, ServiceHealth } from "../service.ts"; import type { PluginContext } from "../context.ts"; import type { ToolContributor } from "../tool-registry.ts"; import type { ISessionClient } from "../../platform/ports/session-client.ts"; import { DispatchManager } from "../../dispatch/core/manager.ts"; import type { CanonicalToolDef } from "../../platform/types.ts"; /** * Extracts the DispatchManager lifecycle from plugin-hooks.ts into its own * PluginService. Owns the resolvedSubagents and subagentModelKey maps that * were previously local to createPluginHooks. * * Init order: no dependencies (empty dependencies list). * Tool registration is deferred to ToolService (S8). * * Graceful degradation: when capabilities indicate the platform does not * support session creation (hasSessionCreate=false, as on Pi), the service * skips DispatchManager construction, registers stub tools that return * clear "not available" messages, and reports degraded health. */ export declare class DispatchService implements PluginService, ToolContributor { readonly name = "dispatch-service"; readonly dependencies: string[]; readonly critical = true; private dispatchManager; private resolvedSubagents; private subagentModelKey; private recoverFailed; /** managerMap key published by the last init() — used to evict this core's manager on dispose(). */ private managerMapKey?; /** Optional session client override. When set, used in place of ctx.session. */ private readonly sessionClient; constructor(options?: { sessionClient?: ISessionClient; }); /** True when the service is permanently degraded (e.g., on Pi). */ private degraded; private degradedDetail; init(ctx: PluginContext): Promise; dispose(): Promise; /** * Synchronous crash-safe flush for process exit/SIGINT/SIGTERM. No-op before * init or when degraded. */ flushPersistSync(): void; /** * Returns real compatibility `dispatch_*` tools (CanonicalToolDefs) when the * service is healthy, or PI_UNAVAILABLE stub tools when degraded. * * These tools are the restored Phase-C compatibility shims backed by the * DispatchManager (see src/dispatch/tools.ts). They are consumed on the * opencode path via `dispatchToolsOverride` in buildCanonicalTools, which is * how the five dispatch_* tools appear in ToolService.getTools() output. */ getTools(): Record; getDispatchManager(): DispatchManager; getResolvedSubagents(): Map; getSubagentModelKey(): Map; /** Whether the service is permanently degraded (e.g., on Pi). */ isDegraded(): boolean; /** The reason for degradation, if any. */ getDegradedDetail(): string; health(): ServiceHealth; } //# sourceMappingURL=dispatch-service.d.ts.map