/** * Pi Extension Entry Point — `src/pi-extension.ts` * * This file is the entry point for Pi's extension system. Pi loads it as a * TypeScript module (via jiti) and calls the default export with its * ExtensionAPI object. * * It initializes rolebox on the Pi platform by: discovering roles, resolving * them, creating platform adapters, syncing agents in-memory, wiring events, * injecting agent context, surfacing skill resources, and wiring dispatch * and loop tools for multi-round iteration and background task execution. * * @module */ import { PiEventBridge } from "../platform/adapters/pi/event-bridge.ts"; import type { ResolvedRole } from "../types.ts"; import { NotificationManager } from "../notifications/manager.ts"; import type { ISessionClient } from "../platform/ports/session-client.ts"; import { listPendingApprovals } from "../graph/tools/status-queries.ts"; export declare const PI_SUBAGENT_TOOLS: string[]; /** * Get the currently wired Pi NotificationManager instance, if any. * Returns `undefined` before `wirePiNotifications()` has run. */ export declare function getPiNotificationManager(): NotificationManager | undefined; /** * Scan the on-disk persisted engine store and enumerate every graph gate still * awaiting a human approval decision (a `blocked` node with `needsApproval`). * This is the authoritative cross-session source at startup — it holds gates * persisted by earlier sessions and every graph recovered this boot. The pure * `listPendingApprovals` helper (subtask 1) does the enumeration; this wrapper * owns only the `scanPersistedStates` read. Returns an empty array when the * store is empty or no gate is blocked (never an invented row). */ export declare function collectStartupPendingApprovals(stateDir: string): ReturnType; /** * Build the single aggregated `[PENDING APPROVALS]` system-reminder body for a * non-empty set of pending-approval entries. Each gate is listed with its graph * id, node id, agent, and a paste-ready `graph_approve` call. Empty input yields * an empty string (caller treats it as a silent no-op). */ export declare function buildPendingApprovalsReminder(pending: ReturnType): string; /** Extract session ID from canonical event properties with fallback chain. */ export declare function extractSessionId(props: Record): string | undefined; /** * Extract the acting role/agent id from canonical event properties. * Used to select the per-role notification config for a session. */ export declare function extractEventAgent(props: Record): string | undefined; export interface PiNotificationWireOptions { eventBridge: PiEventBridge; resolvedRoles: ResolvedRole[]; client: ISessionClient; dir: string; } export interface PiNotificationWireResult { /** The wired NotificationManager instance. */ manager: NotificationManager; /** * Remove all bridge subscriptions owned by this wiring. Does NOT dispose * the manager — call `manager.dispose()` separately (the extension * shutdown handler does both). */ unsubscribe: () => void; } export declare function wirePiNotifications(options: PiNotificationWireOptions): PiNotificationWireResult; export interface PiStatusWireOptions { pi: any; eventBridge: PiEventBridge; /** Retained for signature compatibility — the pipeline owns routing now. */ dispatchManager: { handleSessionStatus(sessionId: string, statusType: string): Promise | void; }; } export interface PiStatusWireResult { /** * Remove the bridge subscription owned by this wiring. With the S6 * pipeline architecture this is a no-op (there is no subscription to * remove); the pi.on handlers have no Pi-side unsubscribe API and the * synthesis events they emit become inert once the pipeline's bridge * subscription is torn down. */ unsubscribe: () => void; } export declare function wirePiSessionStatusEvents(options: PiStatusWireOptions): PiStatusWireResult; /** * Pi Extension entry point. * * Called by Pi's extension loader with the ExtensionAPI object. Performs * one-time initialization at load time: discovers the rolebox directory, * resolves all roles into their final compiled form, creates platform * adapters, wires Pi events into the canonical event system, injects * agent system prompts, and surfaces skill resources. * * @param pi - Pi ExtensionAPI instance (loosely typed since it is an * optional peer dependency). */ export default function (pi: any): Promise; //# sourceMappingURL=pi.d.ts.map