import type { ExtensionContext } from "@earendil-works/pi-coding-agent"; import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; import { FabricActivityStore } from "./activity/store.js"; import { CapturedToolCatalog } from "./capture/catalog.js"; import type { FabricOwnedModelGuidance } from "./components/model-guidance.js"; import type { FabricComponentGraph } from "./components/types.js"; import { type FabricConfig, type FabricResultFormat, type FabricSchemaMode } from "./config.js"; import { FabricSessionApprovals } from "./core/approval-controller.js"; import { FabricActionPolicyHooks } from "./core/action-policy-hooks.js"; import { type FabricForegroundResolution } from "./core/foreground-tools.js"; import { PrewalkController } from "./prewalk/controller.js"; import { PrewalkDriftTracker } from "./prewalk/fs-drift.js"; import type { FabricThinkingController } from "./thinking-control.js"; import type { PendingFabricHandoff } from "./prewalk/handoff.js"; import type { AgentToolResultMessage } from "./agents/types.js"; import type { FabricExecutionResult } from "./execution-service.js"; import type { FabricParticipantInfo, FabricParticipantListOptions, FabricPeerInfo } from "./topology/types.js"; import { type FabricAgentMessageDelivery, type FabricAgentMessageResult, type FabricMainAgentInfo } from "./main-agent.js"; import type { FabricActorHostEvent } from "./actors/types.js"; import type { FabricLifecycleEventType } from "./lifecycle/types.js"; import type { FabricComponentDefinition, FabricProvider, FabricQuestionRendererV1 } from "./protocol.js"; import type { FabricRuntimeState } from "./fabric-runtime-state.js"; import type { DecisionStore } from "./decisions/store.js"; import type { FabricRuntimePaths } from "./runtime-paths.js"; import type { FabricLoadedFileIdentity } from "./build-identity.js"; import type { ActiveCompactionOwner } from "./compaction/claim.js"; import { type FabricManagedHostOptions } from "./managed-host.js"; import { FabricProgramTasks } from "./core/program-tasks.js"; import type { FabricHostPolicy } from "./core/host-policy.js"; export interface FabricStateOptions { managedHost?: FabricManagedHostOptions; paths?: FabricRuntimePaths; runtimeLoader?: () => Promise; entryIdentity?: FabricLoadedFileIdentity; /** The extension holding the compaction owner claim; compact.* routes there. */ compactionOwner?: () => ActiveCompactionOwner | undefined; hostPolicy?: FabricHostPolicy; } type ActivationHook = (context: ExtensionContext) => void | Promise; type ActivationFailureHook = () => void | Promise; export declare class FabricState { #private; readonly pi: ExtensionAPI; readonly capturedTools: CapturedToolCatalog; readonly activity: FabricActivityStore; readonly prewalk: PrewalkController; readonly prewalkDrift: PrewalkDriftTracker; readonly sessionApprovals: FabricSessionApprovals; /** Extension hooks registered over pi.events; consulted only when approvals.policyHooks is true. */ readonly actionPolicyHooks: FabricActionPolicyHooks; /** Question renderers registered over pi.events; consulted only when ui.questionRenderers is true. */ readonly questionRenderers: FabricQuestionRenderers; /** Foreground `fabric_exec` programs the Ctrl+B chord can move to the background. */ readonly programTasks: FabricProgramTasks; readonly thinking: FabricThinkingHost; constructor(pi: ExtensionAPI, capturedTools: CapturedToolCatalog, options?: FabricStateOptions); get kernelReloadRequired(): boolean; get initialized(): boolean; get bootstrapped(): boolean; get activated(): boolean; get config(): FabricConfig; get managedHostOptions(): Readonly | undefined; get cwd(): string | undefined; /** Foreground tools declared beside fabric_exec. prepareLoadout passes its pending active set. */ foregroundTools(active?: readonly string[]): FabricForegroundResolution; get widgetDismissedAt(): number; set widgetDismissedAt(value: number); get registry(): FabricRuntimeState["registry"]; get execution(): FabricRuntimeState["execution"]; /** Speculative-PTC stream tap; undefined pre-init or when speculation is disabled. */ get speculationTap(): FabricRuntimeState["speculationTap"]; /** Turn-boundary backstop for the speculation store; safe before initialization. */ resetSpeculation(): void; get agents(): FabricRuntimeState["agents"]; get actors(): FabricRuntimeState["actors"]; get shellJobs(): FabricRuntimeState["shellJobs"] | undefined; get globalActors(): FabricRuntimeState["globalActors"]; get mesh(): FabricRuntimeState["mesh"]; get compact(): FabricRuntimeState["compact"]; get repairs(): FabricRuntimeState["repairs"]; get components(): FabricRuntimeState["components"]; setActivationHook(hook: ActivationHook, onFailure?: ActivationFailureHook): void; bootstrap(context: ExtensionContext): Promise; initialize(context: ExtensionContext): Promise; ensure(context: ExtensionContext): Promise; shouldEagerlyActivate(context: ExtensionContext): boolean; mainAgentInfo(context?: ExtensionContext): FabricMainAgentInfo; peerInfos(): FabricPeerInfo[]; sessionLabel(): string | undefined; sessionLabelPending(): boolean; /** Managed hosts do not expose decisions, matching the `decisions.*` provider. */ decisionStore(): DecisionStore | undefined; componentGraph(): FabricComponentGraph; modelGuidance(): FabricOwnedModelGuidance[]; participantInfos(options?: FabricParticipantListOptions): FabricParticipantInfo[]; residentAgentForUi(id: string): ReturnType; queueUserMessage(targetId: string, message: string, delivery: FabricAgentMessageDelivery): Promise; stopParticipant(targetId: string): Promise; claimHandoff(execution: FabricExecutionResult, sessionId: string, resultFormat: FabricResultFormat, outerToolCallId: string): Promise; runHandoffAtBoundary(pending: PendingFabricHandoff, result: AgentToolResultMessage, context: ExtensionContext): Promise>; get advisorsHalted(): boolean; haltAdvisors(): number; noteMainActivity(context: ExtensionContext): void; dispatchHostEvent(event: FabricActorHostEvent, payload: unknown, context: ExtensionContext): number; publishHostLifecycle(event: FabricLifecycleEventType, payload: unknown): Promise; registerExternal(provider: FabricProvider, options?: { overwrite?: boolean; }): void; /** False when the name is unknown, managed, or the generation pin does not match. */ withdrawExternal(name: string, generation?: number | string): boolean; registerExternalComponent(component: FabricComponentDefinition, options?: { overwrite?: boolean; }): void; /** Apply only the decision selector; existing program snapshots and policy stay intact. */ setDecisionProfile(profile: string | null | undefined): void; reloadConfig(context: ExtensionContext): void; setSchemaMode(context: ExtensionContext, mode: FabricSchemaMode): void; schemaStatus(context: ExtensionContext): { mode: FabricSchemaMode; source: "config" | "session override"; executorRuntime: string; }; shutdown(): Promise; } /** * Question renderers registered over pi.events * (`pi-fabric:question-renderer:register:v1`). Registration is always * accepted; Fabric consults renderers only when `ui.questionRenderers` is true. */ export declare class FabricQuestionRenderers { #private; get size(): number; /** * Register `render` under `name`; the same name replaces an earlier * renderer in its original position, so a reloaded extension does not stack * copies. The returned function removes only this registration. */ register(name: string, render: FabricQuestionRendererV1): () => void; clear(): void; /** A snapshot in registration order. */ list(): Array<{ name: string; render: FabricQuestionRendererV1; }>; /** This registry when `ui.questionRenderers` is true and a renderer is registered; otherwise undefined. */ active(enabled: boolean | undefined): FabricQuestionRenderers | undefined; } type ThinkingHookContext = Pick; /** * Lazy front for the host thinking controller. Before first use an override * can only come from a persisted session entry, so lifecycle hooks scan the * branch instead of loading the controller module. */ export declare class FabricThinkingHost { #private; private readonly create; constructor(create: () => Promise); load(): Promise; invalidate(): void; agentEnded(context: ThinkingHookContext): Promise; enforceBounds(context: ThinkingHookContext): Promise; } export {}; //# sourceMappingURL=fabric-state.d.ts.map