import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; import type { SecretRefV1, StableId } from "../core/config/types.js"; import { ConfigStore } from "../core/config/store.js"; import { HealthStore } from "../core/health/index.js"; import { type PoolId, type PoolRouteCandidate, type PoolView as CorePoolView } from "../core/pools/index.js"; import { type CatalogRow, type ProviderProjection } from "../core/ninerouter/index.js"; import { type SubagentExecutor } from "../core/workers/index.js"; import type { MissionStoreAdapter } from "../core/mission/types.js"; import { ContextBroker } from "../core/context/index.js"; import { QualityService, type QualityPersistence } from "../core/quality/index.js"; import { type AnalyticsStoreAdapter } from "../core/analytics/index.js"; import { TrustStore } from "../core/security/index.js"; import { SmartRoutingSettingsStore, type TriageClient } from "../core/smart-routing/index.js"; import { RoutingMemoryStore } from "../core/routing-memory/index.js"; export declare const NINEROUTER_PROVIDER_ID: "9router"; type MaybePromise = T | Promise; export interface PoolManagerContract { listPools(): MaybePromise; getPool(poolId: PoolId): MaybePromise; getAvailableCandidatesToAdd(poolId: PoolId, filter?: string): MaybePromise; addRoute(poolId: PoolId, routeId: StableId): MaybePromise; removeRoute(poolId: PoolId, routeId: StableId): MaybePromise; moveRouteUp(poolId: PoolId, routeId: StableId): MaybePromise; moveRouteDown(poolId: PoolId, routeId: StableId): MaybePromise; moveRoute(poolId: PoolId, routeId: StableId, targetIndex: number): MaybePromise; setPoolEntryEnabled(poolId: PoolId, routeId: StableId, enabled: boolean): MaybePromise; } export type RecommendationAnalystMode = "deterministic" | "ai-assisted"; export interface RecommendationAnalystSettings { readonly mode: RecommendationAnalystMode; readonly routeId?: string; } export interface RecommendationAnalystRoute { readonly routeId: string; readonly displayName?: string; readonly remoteModelId?: string; readonly enabled?: boolean; readonly available?: boolean; } export interface RecommendationAnalystStatus { readonly state: "idle" | "running" | "completed" | "failed"; readonly mode?: RecommendationAnalystMode; readonly routeId?: string; readonly lastAnalysisAt?: string; readonly recommendationCount?: number; readonly message?: string; } /** * Optional host adapter for the M8.5 analyst. The host only invokes `analyze` * after an explicit user action; it never schedules analysis or applies a * recommendation. The domain owns persistence and deterministic/AI policy. */ export interface RecommendationAnalystContract { getSettings(): MaybePromise; getStatus(): MaybePromise; listVerificationRoutes(): MaybePromise; analyze(request: { readonly mode: RecommendationAnalystMode; readonly routeId: string; }): MaybePromise; } export interface ModelManagerEntry { readonly remoteModelId: string; readonly routeId?: string; readonly displayName?: string; readonly enabled?: boolean; readonly available?: boolean; readonly stale?: boolean; readonly missing?: boolean; readonly sourceLabel?: string; readonly capability?: string; readonly status?: string; readonly warning?: string; } /** The narrow manager surface consumed by the host. Keep domain details out of Pi callbacks. */ export interface PiManagerContract { list(filter?: string): MaybePromise; loadStatus(): MaybePromise; refresh(signal?: AbortSignal): MaybePromise; configure(baseUrl: string, credentialRef?: SecretRefV1 | string): MaybePromise; setEnabled(remoteModelId: string, enabled: boolean, options?: { readonly activeRemoteModelId?: string; }): MaybePromise; providerProjection(): MaybePromise; } export interface PiHostOptions { readonly manager: PiManagerContract; readonly poolManager?: PoolManagerContract; readonly configStore?: ConfigStore; readonly healthStore?: HealthStore; /** Optional canonical mission store. The host never mirrors canonical state in Pi history. */ readonly missionStore?: MissionStoreAdapter; readonly contextBroker?: ContextBroker; /** Optional quality persistence/service. Defaults to the mission store when present. */ readonly qualityStore?: QualityPersistence; readonly qualityService?: QualityService; readonly qualityExecutor?: SubagentExecutor; readonly providerId?: string; readonly subagentExecutor?: SubagentExecutor; readonly analyticsStore?: AnalyticsStoreAdapter; readonly recommendationAnalyst?: RecommendationAnalystContract; readonly smartRoutingStore?: SmartRoutingSettingsStore; readonly routingMemoryStore?: RoutingMemoryStore; readonly triageClient?: TriageClient; /** Local-only project trust state; never part of portable ConfigStore data. */ readonly trustStore?: TrustStore; } export interface ReconcileResult { readonly changed: boolean; readonly registered: boolean; readonly modelCount: number; readonly error?: Error; } export interface PiHost { readonly manager: PiManagerContract; readonly poolManager: PoolManagerContract; readonly healthStore?: HealthStore; readonly missionStore?: MissionStoreAdapter; readonly contextBroker?: ContextBroker; readonly qualityStore?: QualityPersistence; readonly qualityService?: QualityService; readonly analyticsStore?: AnalyticsStoreAdapter; readonly recommendationAnalyst?: RecommendationAnalystContract; readonly smartRoutingStore?: SmartRoutingSettingsStore; readonly routingMemoryStore?: RoutingMemoryStore; readonly trustStore?: TrustStore; readonly qualityExecutor?: SubagentExecutor; reconcile(): Promise; registerCommands(): void; dispose(): void; } export declare const parseOrchestratorInvocation: (text: string) => { readonly goal: string; } | undefined; /** * Build the Pi-facing adapter around a domain manager. The adapter owns no * catalog/configuration state; it only projects the manager's current enabled * routes into Pi's dynamic provider registry and forwards user intents. */ export declare function createPiHost(pi: ExtensionAPI, options: PiHostOptions): PiHost; export default function piMultiOrchestratorExtension(pi: ExtensionAPI): Promise; export {};