import type { OrchestratorConfig } from "./config.js"; import type { CandidateLifecycleState, CorrectionCandidate, CorrectionInput, CorrectionReviewQueue } from "./correction.js"; import { type SynthesisStrategy } from "./synthesizer.js"; import type { MemoryContext, EmbeddingModel, MemoryInjection, MemoryProvider, MemoryTrace, RememLogger } from "./types.js"; export interface ManualSearchResult { text: string; trace: MemoryTrace; } export interface OrchestratorDependencies { embeddingModel?: EmbeddingModel; synthesizer?: SynthesisStrategy; /** * Owns the correction-candidate review lifecycle. Deliberately not exposed * with its mutating approve/reject/requestChanges methods anywhere in this * class -- only read-only status/diagnostics are surfaced here, so no * agent-facing host tool can grant approval by wiring against the * orchestrator. */ reviewQueue?: CorrectionReviewQueue; } export declare class RememOrchestrator { private readonly config; private readonly logger; private readonly catalog; private readonly planner; private readonly semantic; private readonly recall; private readonly synthesizer; private readonly fallbackSynthesizer; private readonly diagnostics; private readonly providerIds; private readonly providers; private readonly reviewQueue?; constructor(providers: MemoryProvider[], config: OrchestratorConfig, logger?: RememLogger, dependencies?: OrchestratorDependencies); private renderActiveCatalog; /** * `turnId`, when supplied by the host, identifies the user turn this * dispatch belongs to -- see `MemoryDiagnostics.priorDispatch`. Opaque to * this method beyond being forwarded to `diagnostics.record`. */ processPrompt(prompt: string, context: MemoryContext, turnId?: string): Promise; search(query: string, context: MemoryContext, providerId?: string, signal?: AbortSignal): Promise; compactionContext(context: MemoryContext): Promise; status(context: MemoryContext): Promise>; explain(sessionId?: string): MemoryTrace | { status: "no-trace"; }; /** * The dispatch trace for the turn before the current one, for callers * (e.g. `memory_submit_correction`) that need the retrieval decision * behind an already-delivered response, not whatever the current turn's * own message happens to be. A single "latest trace" per session cannot * disambiguate these: when the current turn's message is itself a * correction ("that answer was wrong; X is required"), the "context" hook * running for that turn records a fresh dispatch trace for the * correction message before any tool call in that same turn can run, so * `explain()`'s "latest" would return the trace for the correction text, * not for the disputed response. See `MemoryDiagnostics.priorDispatch`. */ explainPreviousTurn(sessionId: string): MemoryTrace | { status: "no-trace"; }; /** * Submits a correction to the review queue, then immediately runs * diagnosis/mutation-proposal/structural-validation/replay -- validation * is a deterministic, fully automatic pipeline with no human judgment * involved, unlike approve/reject/requestChanges, so running it here * (rather than requiring a second call nothing in this codebase's shipped * surfaces would ever make) is what gets a candidate to "validated" or * "needs_changes" at all. Read/write access to approve, reject, or * request changes on the resulting candidate is intentionally not * available through the orchestrator -- see * `OrchestratorDependencies.reviewQueue`. */ submitCorrection(correction: CorrectionInput): Promise; /** * Re-runs validation for a candidate already in "pending_validation" or * "needs_changes" -- e.g. after a human fixes whatever caused * "needs_changes" the first time, or as an explicit retry. Not needed * after a plain `submitCorrection` call, which already validates once. */ runCorrectionValidation(candidateId: string): Promise; reviewCandidates(filter?: { state?: CandidateLifecycleState; }): Promise; explainCorrectionCandidate(candidateId: string): Promise; private synthesize; private logTrace; }