import { type FabricThinkingBounds } from "../thinking.js"; import type { FabricKernel } from "../runtime/kernel.js"; import { type FabricModelMatch } from "../core/model-resolution.js"; import { type FabricAgentRunner, type FabricAgentConfig, type FabricRetentionConfig, type FabricPythonRuntime } from "../config.js"; import { type ClaudeModelInfo } from "./claude-cli.js"; import { type InheritedSessionPin } from "./session-pins.js"; import { type FabricChildTraceContextLaunch, type FabricTraceContextV1 } from "./trace-context.js"; import type { AgentActivity, AgentChildQuestionRequest, AgentChildQuestionResponse, FabricSteeringMode, FabricAgentLog, AgentHandleInfo, AgentRunRecord, AgentRunRequest, AgentRunResult, AgentSteerResult } from "./types.js"; import type { FabricCompactionBudget } from "../compaction/hook.js"; import { type FabricLifecyclePublishRequest } from "../lifecycle/types.js"; export declare const effectiveAgentTimeoutMs: (configuredTimeoutMs: number, requestedTimeoutMs?: number) => number; interface AgentParticipantGuidanceRequest { model?: string; runner: FabricAgentRunner; } type AgentParticipantGuidanceResolver = (request: AgentParticipantGuidanceRequest) => string | undefined; /** Resolve and validate a one-shot agent's filesystem execution directory. */ export declare const resolveAgentCwd: (parentCwd: string, requestedCwd?: string) => string; export declare class AgentManager { #private; readonly cwd: string; readonly config: FabricAgentConfig; constructor(cwd: string, config: FabricAgentConfig, options?: { workerPath?: string; fabricExtensionPath?: string; piBinary?: string; claudeBinary?: string; vedaBinary?: string; runRoot?: string; fullCodeMode?: boolean; kernel?: () => FabricKernel; pythonRuntime?: () => FabricPythonRuntime; mainAgentId?: string; fabricSessionId?: string; meshRoot?: string; projectRoot?: string; hostId?: string; identityId?: string; retention?: FabricRetentionConfig; onBackgroundComplete?: (result: AgentRunResult) => void; onResultConsumed?: (id: string) => void; onLifecycle?: (event: FabricLifecyclePublishRequest) => void; /** agents.childQuestions "route": answer a child dialog via parent UI or a decision. */ onChildQuestion?: (request: AgentChildQuestionRequest) => Promise; preparePiModel?: (model: string | undefined, options?: { modelMatch?: FabricModelMatch; }) => Promise; resolveHandoffCompactionBudget?: (model: string | undefined, cwd: string) => Promise; resolveParticipantGuidance?: AgentParticipantGuidanceResolver; resolveInheritedSessionPins?: () => InheritedSessionPin[] | undefined; /** Caller's effective thinking bounds (config narrowed by inherited env). */ thinkingBounds?: () => FabricThinkingBounds; /** Caller Pi session id recorded as lineage parentSessionId. */ sessionId?: () => string | undefined; /** Asks the session's extensions for a child's W3C trace context before each launch and relaunch. */ resolveChildTraceContext?: (launch: FabricChildTraceContextLaunch) => FabricTraceContextV1 | undefined; /** Caller TypeScript executor runtime; native runtimes escape write confinement. */ executorRuntime?: () => string | undefined; }); subscribeUi(listener: () => void): () => void; resolveCwd(requestedCwd?: string): string; /** The project root Fabric already uses for the mesh; named agent files live under its .pi folder. */ get projectRoot(): string; /** Resolve once at the caller boundary, before launch or resident/trajectory handoff. */ resolveKernel(request: Pick): FabricKernel | undefined; /** Internal backend policy snapshot; public agent calls select a language, not a backend. */ resolvePythonRuntime(inherited?: FabricPythonRuntime): FabricPythonRuntime; /** * The trace context for a run this session hands to a host without its * extensions. That host mints the run id, so listeners see none. */ forwardedTraceContext(request: AgentRunRequest): FabricTraceContextV1 | undefined; spawn(request: AgentRunRequest, signal?: AbortSignal): Promise; /** Effective bounds for a child; requested bounds outside the caller's throw. */ childThinkingBounds(requested?: FabricThinkingBounds): FabricThinkingBounds; /** * Re-attach hosted runs persisted under this run root, as after a resident * host restart. Recovery calls `attach`, never `start`: a run the adapter * cannot vouch for settles failed with outcome "indeterminate". */ recoverHostedRuns(): Promise; /** * Re-attach opted-in pi-durable worker runs (agents.durableWorkerRecovery) * left unfinished under this run root by an earlier host. A verified live * worker is adopted; a dead one is relaunched on its own durable journal * with its progress carried over; a run whose deadline passed, or whose * worker Fabric cannot verify either way, settles failed with outcome * "indeterminate" instead of being guessed at. */ recoverWorkerRuns(): Promise; /** Park or resume a hosted run whose runner declares `sleep`. */ sleep(id: string): Promise; wake(id: string): Promise; run(request: AgentRunRequest, signal?: AbortSignal): Promise; wait(id: string): Promise; markForeground(id: string): void; detachSignal(id: string): void; status(id: string): AgentRunRecord | AgentHandleInfo; list(): Array; /** Unsettled runs, each with the title of a child question it waits on. */ activity(): AgentActivity[]; listForUi(): Array; runDirectory(id: string): string | undefined; worktreeGitRoot(id: string): string | undefined; claudeModels(refresh?: boolean): Promise; stop(id: string): Promise; cleanup(id: string, deleteBranch?: boolean): Promise<{ cleaned: boolean; }>; readLog(id: string, opts?: { lines?: number; before?: number; }): FabricAgentLog; steer(id: string, message: string, data?: unknown): AgentSteerResult; followUp(id: string, message: string, data?: unknown): AgentSteerResult; setSteeringMode(id: string, mode: FabricSteeringMode): AgentSteerResult; setFollowUpMode(id: string, mode: FabricSteeringMode): AgentSteerResult; compact(id: string, instructions?: string): AgentSteerResult; close(): Promise; } export {}; //# sourceMappingURL=manager.d.ts.map