import { type MaybeProcessMemoryResult, type ProcessMemoryResult } from "./processor.js"; import { selectMemoryRecordsForContext, type RankedMemoryRecord } from "./retrieval.js"; import { type MemoryQualityReport } from "./quality.js"; import { type GlobalMemorySource } from "./global-memory.js"; import type { BrainAction } from "./brain.js"; import { type EvaluationReport, type ExpectedMemoryInput } from "./evaluation.js"; import { type ContextInjection } from "./injection.js"; import type { BrainInspection, MemoryRecord, MemoryRecordInput, MemoryStatus, MemoryType, PeonEvent, PeonRole, PeonSession, ProcessedMemory, ProjectContext } from "./types.js"; export interface CreatePeonToolsOptions { daemonUrl?: string; globalMemoryDir?: string; /** Path to the durable sessionId → project index. Defaults to the global Peon dir. */ sessionIndexPath?: string; } export interface StartSessionToolInput { projectPath: string; client: string; cwd?: string; } export interface StartSessionToolResult { sessionId: string; projectPath: string; } export interface RecordMessageToolInput { sessionId: string; role: PeonRole; content: string; } export interface RecordEventToolInput { sessionId: string; type: string; content: string; } export interface EndSessionToolInput { sessionId: string; } export interface GetContextToolInput { projectPath: string; query?: string; maxChars?: number; } export interface InspectBrainToolInput { projectPath: string; query?: string; maxChars?: number; } export interface ProcessMemoryToolInput { projectPath: string; reason?: string; aiResult?: ProcessedMemory; } export interface MaybeProcessMemoryToolInput { projectPath: string; trigger: string; force?: boolean; aiResult?: ProcessedMemory; } export interface SearchMemoryToolInput { projectPath: string; query: string; limit?: number; maxChars?: number; } export interface SearchMemoryToolResult { projectPath: string; query: string; records: RankedMemoryRecord[]; selected: ReturnType; injectionPreview: string; } export interface QualityReportToolInput { projectPath: string; staleAfterDays?: number; } export interface GlobalMemoryToolInput { memory: MemoryRecordInput; source?: GlobalMemorySource; } export interface SearchGlobalMemoryToolInput { query?: string; type?: MemoryType; status?: MemoryStatus; } export interface ImportGlobalMemoryToolInput { projectPath: string; } export interface PromoteToGlobalToolInput { projectPath: string; } export interface BrainActivityItem { at: string; scope: "project" | "global"; projectName: string; type: string; detail: string; } export interface GlobalDashboard { totalBeliefs: number; byType: Record; topEntities: Array<{ entity: string; count: number; }>; recentActions: BrainActivityItem[]; records: Array<{ id: string; type: string; content: string; entities: string[]; }>; } export interface PromoteToGlobalToolResult { projectPath: string; promoted: MemoryRecord[]; } export interface UpdateMemoryToolInput { projectPath: string; id: string; content?: string; importance?: number; confidence?: number; status?: MemoryStatus; pinned?: boolean; } export interface DeleteMemoryToolInput { projectPath: string; id: string; } export interface MergeMemoryToolInput { projectPath: string; keepId: string; dropId: string; } export interface EvaluateProjectToolInput { projectPath: string; expectedMemories?: Array; } export interface BuildInjectionToolInput { projectPath: string; query?: string; maxChars?: number; includeInactive?: boolean; } export interface CrossProjectSearchToolInput { query: string; /** Projects to search. When omitted, the daemon fills this with all known projects. */ projectPaths?: string[]; /** Usually the current project — excluded so you only get OTHER projects' beliefs. */ excludeProjectPath?: string; limit?: number; perProjectLimit?: number; /** Cap on how many projects to FULLY (semantically) rank after the cheap pre-filter. */ maxProjects?: number; } export interface CrossProjectHit { projectPath: string; projectName: string; record: MemoryRecord; score: number; explanation: string; } export interface CrossProjectSearchToolResult { query: string; projectsSearched: string[]; results: CrossProjectHit[]; } export interface PeonTools { startSession(input: StartSessionToolInput): Promise; recordMessage(input: RecordMessageToolInput): Promise; recordEvent(input: RecordEventToolInput): Promise; endSession(input: EndSessionToolInput): Promise; getContext(input: GetContextToolInput): Promise; inspectBrain(input: InspectBrainToolInput): Promise; searchMemory(input: SearchMemoryToolInput): Promise; qualityReport(input: QualityReportToolInput): Promise; rememberGlobal(input: GlobalMemoryToolInput): Promise; searchGlobalMemory(input: SearchGlobalMemoryToolInput): Promise; importGlobalMemory(input: ImportGlobalMemoryToolInput): Promise; promoteToGlobal(input: PromoteToGlobalToolInput): Promise; extractGlobal(input: { projectPath: string; }): Promise<{ promoted: MemoryRecord[]; }>; recurateProject(input: { projectPath: string; }): Promise<{ archived: number; considered: number; capped?: boolean; }>; brainPass(input: { projectPath: string; recalledIds?: string[]; compress?: boolean; }): Promise<{ actions: BrainAction[]; }>; globalBrainPass(input: { compress?: boolean; }): Promise<{ actions: BrainAction[]; }>; brainActivity(input: { projectPaths: string[]; limit?: number; }): Promise; globalDashboard(): Promise; brainActions(input: { projectPath: string; limit?: number; }): Promise>; restoreBackup(input: { projectPath: string; }): Promise<{ restored: boolean; }>; updateMemory(input: UpdateMemoryToolInput): Promise; deleteMemory(input: DeleteMemoryToolInput): Promise<{ deleted: boolean; }>; mergeMemory(input: MergeMemoryToolInput): Promise; evaluateProject(input: EvaluateProjectToolInput): Promise; buildInjection(input: BuildInjectionToolInput): Promise; crossProjectSearch(input: CrossProjectSearchToolInput): Promise; processMemory(input: ProcessMemoryToolInput): Promise; maybeProcessMemory(input: MaybeProcessMemoryToolInput): Promise; } /** How many project stores are currently held open. */ export declare function openStoreCacheStats(): { openStores: number; }; /** * PEON_DAEMON_URL as an http(s) base URL, or undefined to run the tools in-process. * * The variable is optional, and registry listings render it with a placeholder value * ("your-peon-daemon-url-here"). A copied placeholder must not turn a working in-process * server into one where every call fails, so anything that is not an http(s) URL is * dropped with a warning on stderr (stdout carries the MCP protocol). */ export declare function resolveDaemonUrl(raw: string | undefined, warn?: (message: string) => void): string | undefined; export declare function createPeonTools(options?: CreatePeonToolsOptions): PeonTools;