/** * PiLightweightServiceStack — Minimal PluginCore-equivalent service stack * for the Pi (plugin) platform. * * Pi cannot run the full PluginCore because PluginCore depends on the * `@opencode-ai/plugin` SDK's client object. This stack provides a * lightweight replacement that: * * 1. Initializes PiSessionAdapter for filesystem-backed session reading * 2. Constructs all standalone tools (hashline, memory, web, signal, etc.) * 3. Constructs session tools backed by PiSessionAdapter * 4. Constructs asset/metadata tools from resolved roles * 5. Creates stub dispatch tools returning "Not available on Pi" * 6. Compiles all tools into Pi's native format via PiToolFactory * 7. Registers them with pi.registerTool() * * Must NOT import from @opencode-ai/plugin. * * @module */ import type { IHookProvider } from "../../ports/hook-provider.ts"; import { PiToolFactory } from "./tool-factory.ts"; import type { ToolInterceptorHooks } from "./tool-interceptor.ts"; import { PiSessionAdapter } from "./session.ts"; import type { DispatchManager } from "../../../dispatch/core/manager.ts"; import type { ISessionClient } from "../../ports/session-client.ts"; import { type GraphToolSet } from "../../../graph/tools/index.ts"; import type { NodeLivenessFeed } from "../../../graph/engine/index.ts"; import type { ResolvedRole } from "../../../types.ts"; import type { CanonicalToolDef } from "../../types.ts"; /** * Lightweight service stack for the Pi platform. * * Orchestrates the creation, compilation, and registration of all rolebox * tools with the Pi extension API. Does not use PluginCore or any * @opencode-ai/plugin imports. */ export declare class PiLightweightServiceStack implements IHookProvider { private _toolFactory; private _sessionAdapter; private _resolvedRoles; private _pi; private _dispatchTools?; private _loopTools?; private _taskTools?; private _extraTools?; private _dispatchManager?; private _graphNotifyClient?; private _stateDir; /** Hook wiring consumed by the tool-execution interceptor (subtask S9). */ private _interceptorHooks; /** * The single GraphToolSet instance (subtask 2) backing BOTH the `graph_*` * tools (threaded into buildCanonicalTools via the `graphTools` option) and * the HookDeps `graphTools` in-flight query (consumed by the Pi hook * pipeline through {@link getGraphToolSet}). Constructed eagerly with the * SAME deps the graph_* tools receive inside buildCanonicalTools — manager, * directory (process.cwd()), stateDir and graphNotify — so both surfaces * observe the same in-memory graph registry. Absent (undefined) when no * dispatch manager is supplied, mirroring the graph_* gating in * buildCanonicalTools. */ private _graphToolSet; /** * Shared node-liveness feed (subtask 6). Threaded into every graph engine * the stack's toolset builds so the engine records dispatch heartbeats, * registers its sessions with the feed, and maintains the `sessionId → * nodeId` reverse index the Pi liveness relay resolves through. Absent → * engines run without liveness recording (backward compatible). */ private _livenessFeed?; /** * Optional platform-provided acting-agent resolver (Pi/DSH parity). On Pi * `context.agent` is never populated, so the graph tools (wired via * buildCanonicalTools → createGraphTools) fall back to this resolver so the * injected `` still forwards the orchestrator's real role * instead of falling back to `default_agent`. Reads the role switcher's * shared `ActiveAgentRef` (global, session-agnostic on Pi). */ private _getEffectiveAgent?; /** Pi-compiled tools stored after init() for getHandlers(). */ private _compiledTools; constructor(pi: any, resolvedRoles: ResolvedRole[], sessionDir?: string, dispatchTools?: Record, loopTools?: Record, taskTools?: Record, extraTools?: Record, dispatchManager?: DispatchManager, graphNotifyClient?: ISessionClient, stateDir?: string, interceptorHooks?: ToolInterceptorHooks, livenessFeed?: NodeLivenessFeed, getEffectiveAgent?: (sessionID?: string) => string); /** The PiSessionAdapter instance for external access. */ get sessionAdapter(): PiSessionAdapter; /** The PiToolFactory instance for external access. */ get toolFactory(): PiToolFactory; /** * The single GraphToolSet instance (subtask 2) backing the graph_* tools and * the HookDeps `graphTools` in-flight query. `undefined` when no dispatch * manager was supplied (no graph tools are registered either). The Pi hook * pipeline reads this when assembling HookDeps. */ getGraphToolSet(): GraphToolSet | undefined; /** * Initialize the service stack: build all tools, compile them to Pi's * native format, and register each with pi.registerTool(). * * Returns the count of registered tools. */ init(): Promise; /** * Return the assembled hook handlers. * * Implements IHookProvider.getHandlers(). Returns a handler map whose * `tool` key carries the Pi-compiled tool definitions. Because Pi does * not consume hooks through the same opencode handler pattern, only * the `tool` key is populated. Additional keys (`event`, `config`, etc.) * would be populated if Pi ever adopts the PluginCore pipeline. */ getHandlers(): Record; } //# sourceMappingURL=service-stack.d.ts.map