import { z } from 'zod'; import { Pool } from 'pg'; /** * ReMEM — Core Types * Recursive Memory for AI Agents */ declare const memoryEntrySchema: z.ZodObject<{ id: z.ZodString; content: z.ZodString; topics: z.ZodDefault>; metadata: z.ZodDefault>; createdAt: z.ZodNumber; accessedAt: z.ZodNumber; accessCount: z.ZodDefault; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; }, { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; }>; type MemoryEntry = z.infer; declare const storeMemoryInputSchema: z.ZodObject<{ content: z.ZodString; topics: z.ZodDefault>>; metadata: z.ZodDefault>>; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; }, { content: string; topics?: string[] | undefined; metadata?: Record | undefined; }>; type StoreMemoryInput = z.infer; declare const rememberKindSchema: z.ZodEnum<["fact", "preference", "decision", "procedure", "recent-event", "artifact-note"]>; type RememberKind = z.infer; declare const rememberActionSchema: z.ZodEnum<["stored", "skipped_duplicate", "skipped_low_signal", "preview"]>; type RememberAction = z.infer; declare const rememberInputSchema: z.ZodObject<{ content: z.ZodString; topics: z.ZodDefault>>; metadata: z.ZodDefault>>; } & { kind: z.ZodOptional>; source: z.ZodOptional; dryRun: z.ZodDefault; forceStore: z.ZodDefault; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; dryRun: boolean; forceStore: boolean; kind?: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note" | undefined; source?: string | undefined; }, { content: string; topics?: string[] | undefined; metadata?: Record | undefined; kind?: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note" | undefined; source?: string | undefined; dryRun?: boolean | undefined; forceStore?: boolean | undefined; }>; type RememberInput = z.input; declare const rememberBatchInputSchema: z.ZodArray>>; metadata: z.ZodDefault>>; } & { kind: z.ZodOptional>; source: z.ZodOptional; dryRun: z.ZodDefault; forceStore: z.ZodDefault; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; dryRun: boolean; forceStore: boolean; kind?: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note" | undefined; source?: string | undefined; }, { content: string; topics?: string[] | undefined; metadata?: Record | undefined; kind?: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note" | undefined; source?: string | undefined; dryRun?: boolean | undefined; forceStore?: boolean | undefined; }>, "many">; declare const rememberResultSchema: z.ZodObject<{ action: z.ZodEnum<["stored", "skipped_duplicate", "skipped_low_signal", "preview"]>; kind: z.ZodEnum<["fact", "preference", "decision", "procedure", "recent-event", "artifact-note"]>; layer: z.ZodEnum<["episodic", "semantic", "identity", "procedural"]>; score: z.ZodNumber; threshold: z.ZodNumber; reason: z.ZodString; duplicateOf: z.ZodOptional; conflictIds: z.ZodDefault>; topics: z.ZodArray; metadata: z.ZodDefault>; entry: z.ZodOptional>; metadata: z.ZodDefault>; createdAt: z.ZodNumber; accessedAt: z.ZodNumber; accessCount: z.ZodDefault; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; }, { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; }>>; trigger: z.ZodOptional; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; kind: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note"; score: number; action: "stored" | "skipped_duplicate" | "skipped_low_signal" | "preview"; reason: string; layer: "procedural" | "episodic" | "semantic" | "identity"; threshold: number; conflictIds: string[]; duplicateOf?: string | undefined; entry?: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; } | undefined; trigger?: unknown; }, { topics: string[]; kind: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note"; score: number; action: "stored" | "skipped_duplicate" | "skipped_low_signal" | "preview"; reason: string; layer: "procedural" | "episodic" | "semantic" | "identity"; threshold: number; metadata?: Record | undefined; duplicateOf?: string | undefined; conflictIds?: string[] | undefined; entry?: { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; } | undefined; trigger?: unknown; }>; type RememberResult = z.infer; declare const rememberBatchOptionsSchema: z.ZodObject<{ stopOnError: z.ZodDefault; }, "strip", z.ZodTypeAny, { stopOnError: boolean; }, { stopOnError?: boolean | undefined; }>; type RememberBatchOptions = z.input; declare const rememberBatchItemResultSchema: z.ZodObject<{ index: z.ZodNumber; ok: z.ZodBoolean; result: z.ZodOptional; kind: z.ZodEnum<["fact", "preference", "decision", "procedure", "recent-event", "artifact-note"]>; layer: z.ZodEnum<["episodic", "semantic", "identity", "procedural"]>; score: z.ZodNumber; threshold: z.ZodNumber; reason: z.ZodString; duplicateOf: z.ZodOptional; conflictIds: z.ZodDefault>; topics: z.ZodArray; metadata: z.ZodDefault>; entry: z.ZodOptional>; metadata: z.ZodDefault>; createdAt: z.ZodNumber; accessedAt: z.ZodNumber; accessCount: z.ZodDefault; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; }, { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; }>>; trigger: z.ZodOptional; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; kind: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note"; score: number; action: "stored" | "skipped_duplicate" | "skipped_low_signal" | "preview"; reason: string; layer: "procedural" | "episodic" | "semantic" | "identity"; threshold: number; conflictIds: string[]; duplicateOf?: string | undefined; entry?: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; } | undefined; trigger?: unknown; }, { topics: string[]; kind: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note"; score: number; action: "stored" | "skipped_duplicate" | "skipped_low_signal" | "preview"; reason: string; layer: "procedural" | "episodic" | "semantic" | "identity"; threshold: number; metadata?: Record | undefined; duplicateOf?: string | undefined; conflictIds?: string[] | undefined; entry?: { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; } | undefined; trigger?: unknown; }>>; error: z.ZodOptional; }, "strip", z.ZodTypeAny, { index: number; ok: boolean; result?: { topics: string[]; metadata: Record; kind: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note"; score: number; action: "stored" | "skipped_duplicate" | "skipped_low_signal" | "preview"; reason: string; layer: "procedural" | "episodic" | "semantic" | "identity"; threshold: number; conflictIds: string[]; duplicateOf?: string | undefined; entry?: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; } | undefined; trigger?: unknown; } | undefined; error?: string | undefined; }, { index: number; ok: boolean; result?: { topics: string[]; kind: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note"; score: number; action: "stored" | "skipped_duplicate" | "skipped_low_signal" | "preview"; reason: string; layer: "procedural" | "episodic" | "semantic" | "identity"; threshold: number; metadata?: Record | undefined; duplicateOf?: string | undefined; conflictIds?: string[] | undefined; entry?: { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; } | undefined; trigger?: unknown; } | undefined; error?: string | undefined; }>; type RememberBatchItemResult = z.infer; declare const rememberBatchResultSchema: z.ZodObject<{ total: z.ZodNumber; stored: z.ZodNumber; previews: z.ZodNumber; skippedDuplicate: z.ZodNumber; skippedLowSignal: z.ZodNumber; failed: z.ZodNumber; results: z.ZodArray; kind: z.ZodEnum<["fact", "preference", "decision", "procedure", "recent-event", "artifact-note"]>; layer: z.ZodEnum<["episodic", "semantic", "identity", "procedural"]>; score: z.ZodNumber; threshold: z.ZodNumber; reason: z.ZodString; duplicateOf: z.ZodOptional; conflictIds: z.ZodDefault>; topics: z.ZodArray; metadata: z.ZodDefault>; entry: z.ZodOptional>; metadata: z.ZodDefault>; createdAt: z.ZodNumber; accessedAt: z.ZodNumber; accessCount: z.ZodDefault; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; }, { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; }>>; trigger: z.ZodOptional; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; kind: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note"; score: number; action: "stored" | "skipped_duplicate" | "skipped_low_signal" | "preview"; reason: string; layer: "procedural" | "episodic" | "semantic" | "identity"; threshold: number; conflictIds: string[]; duplicateOf?: string | undefined; entry?: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; } | undefined; trigger?: unknown; }, { topics: string[]; kind: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note"; score: number; action: "stored" | "skipped_duplicate" | "skipped_low_signal" | "preview"; reason: string; layer: "procedural" | "episodic" | "semantic" | "identity"; threshold: number; metadata?: Record | undefined; duplicateOf?: string | undefined; conflictIds?: string[] | undefined; entry?: { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; } | undefined; trigger?: unknown; }>>; error: z.ZodOptional; }, "strip", z.ZodTypeAny, { index: number; ok: boolean; result?: { topics: string[]; metadata: Record; kind: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note"; score: number; action: "stored" | "skipped_duplicate" | "skipped_low_signal" | "preview"; reason: string; layer: "procedural" | "episodic" | "semantic" | "identity"; threshold: number; conflictIds: string[]; duplicateOf?: string | undefined; entry?: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; } | undefined; trigger?: unknown; } | undefined; error?: string | undefined; }, { index: number; ok: boolean; result?: { topics: string[]; kind: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note"; score: number; action: "stored" | "skipped_duplicate" | "skipped_low_signal" | "preview"; reason: string; layer: "procedural" | "episodic" | "semantic" | "identity"; threshold: number; metadata?: Record | undefined; duplicateOf?: string | undefined; conflictIds?: string[] | undefined; entry?: { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; } | undefined; trigger?: unknown; } | undefined; error?: string | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { stored: number; total: number; previews: number; skippedDuplicate: number; skippedLowSignal: number; failed: number; results: { index: number; ok: boolean; result?: { topics: string[]; metadata: Record; kind: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note"; score: number; action: "stored" | "skipped_duplicate" | "skipped_low_signal" | "preview"; reason: string; layer: "procedural" | "episodic" | "semantic" | "identity"; threshold: number; conflictIds: string[]; duplicateOf?: string | undefined; entry?: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; } | undefined; trigger?: unknown; } | undefined; error?: string | undefined; }[]; }, { stored: number; total: number; previews: number; skippedDuplicate: number; skippedLowSignal: number; failed: number; results: { index: number; ok: boolean; result?: { topics: string[]; kind: "fact" | "preference" | "decision" | "procedure" | "recent-event" | "artifact-note"; score: number; action: "stored" | "skipped_duplicate" | "skipped_low_signal" | "preview"; reason: string; layer: "procedural" | "episodic" | "semantic" | "identity"; threshold: number; metadata?: Record | undefined; duplicateOf?: string | undefined; conflictIds?: string[] | undefined; entry?: { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; } | undefined; trigger?: unknown; } | undefined; error?: string | undefined; }[]; }>; type RememberBatchResult = z.infer; declare const metadataFilterValueSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>; type MetadataFilterValue = z.infer; declare const metadataFilterOperatorSchema: z.ZodEffects>; in: z.ZodOptional, "many">>; contains: z.ZodOptional>; gt: z.ZodOptional; gte: z.ZodOptional; lt: z.ZodOptional; lte: z.ZodOptional; exists: z.ZodOptional; }, "strip", z.ZodTypeAny, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>; type MetadataFilterOperator = z.infer; declare const metadataFilterSchema: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodEffects>; in: z.ZodOptional, "many">>; contains: z.ZodOptional>; gt: z.ZodOptional; gte: z.ZodOptional; lt: z.ZodOptional; lte: z.ZodOptional; exists: z.ZodOptional; }, "strip", z.ZodTypeAny, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>]>; type MetadataFilter = z.infer; declare const queryOptionsSchema: z.ZodObject<{ limit: z.ZodDefault; topics: z.ZodOptional>; metadata: z.ZodOptional, z.ZodEffects>; in: z.ZodOptional, "many">>; contains: z.ZodOptional>; gt: z.ZodOptional; gte: z.ZodOptional; lt: z.ZodOptional; lte: z.ZodOptional; exists: z.ZodOptional; }, "strip", z.ZodTypeAny, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>]>>>; minAccessCount: z.ZodOptional; since: z.ZodOptional; until: z.ZodOptional; }, "strip", z.ZodTypeAny, { limit: number; topics?: string[] | undefined; metadata?: Record | undefined; minAccessCount?: number | undefined; since?: number | undefined; until?: number | undefined; }, { limit?: number | undefined; topics?: string[] | undefined; metadata?: Record | undefined; minAccessCount?: number | undefined; since?: number | undefined; until?: number | undefined; }>; type QueryOptions = z.infer; declare const queryResultSchema: z.ZodObject<{ id: z.ZodString; content: z.ZodString; topics: z.ZodArray; metadata: z.ZodDefault>; relevanceScore: z.ZodOptional; createdAt: z.ZodNumber; accessedAt: z.ZodNumber; accessCount: z.ZodNumber; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; relevanceScore?: number | undefined; }, { topics: string[]; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; metadata?: Record | undefined; relevanceScore?: number | undefined; }>; type QueryResult = z.infer; declare const queryResponseSchema: z.ZodObject<{ results: z.ZodArray; metadata: z.ZodDefault>; relevanceScore: z.ZodOptional; createdAt: z.ZodNumber; accessedAt: z.ZodNumber; accessCount: z.ZodNumber; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; relevanceScore?: number | undefined; }, { topics: string[]; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; metadata?: Record | undefined; relevanceScore?: number | undefined; }>, "many">; totalAvailable: z.ZodNumber; query: z.ZodString; tookMs: z.ZodNumber; }, "strip", z.ZodTypeAny, { query: string; results: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; relevanceScore?: number | undefined; }[]; totalAvailable: number; tookMs: number; }, { query: string; results: { topics: string[]; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; metadata?: Record | undefined; relevanceScore?: number | undefined; }[]; totalAvailable: number; tookMs: number; }>; type QueryResponse = z.infer; declare const defaultMemoryLinkTypes: readonly ["about", "caused_by", "contradicts", "supports", "follows", "same_session", "same_project", "same_person"]; declare const memoryLinkSchema: z.ZodObject<{ id: z.ZodString; fromId: z.ZodString; toId: z.ZodString; type: z.ZodString; metadata: z.ZodDefault>; createdAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { type: string; metadata: Record; id: string; createdAt: number; fromId: string; toId: string; }, { type: string; id: string; createdAt: number; fromId: string; toId: string; metadata?: Record | undefined; }>; type MemoryLink = z.infer; declare const memoryLinkInputSchema: z.ZodObject<{ fromId: z.ZodString; toId: z.ZodString; type: z.ZodString; metadata: z.ZodDefault>>; }, "strip", z.ZodTypeAny, { type: string; metadata: Record; fromId: string; toId: string; }, { type: string; fromId: string; toId: string; metadata?: Record | undefined; }>; type MemoryLinkInput = z.infer; declare const linkedMemoryQueryOptionsSchema: z.ZodObject<{ direction: z.ZodDefault>; types: z.ZodOptional>; limit: z.ZodDefault; }, "strip", z.ZodTypeAny, { limit: number; direction: "both" | "outgoing" | "incoming"; types?: string[] | undefined; }, { limit?: number | undefined; direction?: "both" | "outgoing" | "incoming" | undefined; types?: string[] | undefined; }>; type LinkedMemoryQueryOptions = z.infer; declare const queryWithNeighborsOptionsSchema: z.ZodObject<{ limit: z.ZodDefault; topics: z.ZodOptional>; metadata: z.ZodOptional, z.ZodEffects>; in: z.ZodOptional, "many">>; contains: z.ZodOptional>; gt: z.ZodOptional; gte: z.ZodOptional; lt: z.ZodOptional; lte: z.ZodOptional; exists: z.ZodOptional; }, "strip", z.ZodTypeAny, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>]>>>; minAccessCount: z.ZodOptional; since: z.ZodOptional; until: z.ZodOptional; } & { hops: z.ZodDefault, z.ZodLiteral<2>]>>; linkTypes: z.ZodOptional>; includeBaseResults: z.ZodDefault; neighborLimit: z.ZodDefault; minNeighborScore: z.ZodDefault; linkTypeWeights: z.ZodOptional>; includePathDetails: z.ZodDefault; }, "strip", z.ZodTypeAny, { limit: number; hops: 2 | 1; includeBaseResults: boolean; neighborLimit: number; minNeighborScore: number; includePathDetails: boolean; topics?: string[] | undefined; metadata?: Record | undefined; minAccessCount?: number | undefined; since?: number | undefined; until?: number | undefined; linkTypes?: string[] | undefined; linkTypeWeights?: Record | undefined; }, { limit?: number | undefined; topics?: string[] | undefined; metadata?: Record | undefined; minAccessCount?: number | undefined; since?: number | undefined; until?: number | undefined; hops?: 2 | 1 | undefined; linkTypes?: string[] | undefined; includeBaseResults?: boolean | undefined; neighborLimit?: number | undefined; minNeighborScore?: number | undefined; linkTypeWeights?: Record | undefined; includePathDetails?: boolean | undefined; }>; type QueryWithNeighborsOptions = z.infer; declare const neighborPathSchema: z.ZodObject<{ fromId: z.ZodString; toId: z.ZodString; throughId: z.ZodString; type: z.ZodString; hop: z.ZodNumber; score: z.ZodNumber; }, "strip", z.ZodTypeAny, { type: string; score: number; fromId: string; toId: string; throughId: string; hop: number; }, { type: string; score: number; fromId: string; toId: string; throughId: string; hop: number; }>; type NeighborPath = z.infer; declare const smartRecallProfileSchema: z.ZodEnum<["fast", "deep", "agent-safe", "ops-debug", "coding-agent", "ops-handoff", "research-brief"]>; type SmartRecallProfile = z.infer; declare const smartRecallOptionsSchema: z.ZodObject<{ limit: z.ZodDefault; topics: z.ZodOptional>; metadata: z.ZodOptional, z.ZodEffects>; in: z.ZodOptional, "many">>; contains: z.ZodOptional>; gt: z.ZodOptional; gte: z.ZodOptional; lt: z.ZodOptional; lte: z.ZodOptional; exists: z.ZodOptional; }, "strip", z.ZodTypeAny, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>]>>>; minAccessCount: z.ZodOptional; since: z.ZodOptional; until: z.ZodOptional; } & { hops: z.ZodDefault, z.ZodLiteral<2>]>>; linkTypes: z.ZodOptional>; includeBaseResults: z.ZodDefault; neighborLimit: z.ZodDefault; minNeighborScore: z.ZodDefault; linkTypeWeights: z.ZodOptional>; includePathDetails: z.ZodDefault; } & { profile: z.ZodDefault>; includeProcedural: z.ZodDefault; proceduralLimit: z.ZodDefault; includeRecent: z.ZodDefault; recentLimit: z.ZodDefault; }, "strip", z.ZodTypeAny, { limit: number; hops: 2 | 1; includeBaseResults: boolean; neighborLimit: number; minNeighborScore: number; includePathDetails: boolean; profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; includeProcedural: boolean; proceduralLimit: number; includeRecent: boolean; recentLimit: number; topics?: string[] | undefined; metadata?: Record | undefined; minAccessCount?: number | undefined; since?: number | undefined; until?: number | undefined; linkTypes?: string[] | undefined; linkTypeWeights?: Record | undefined; }, { limit?: number | undefined; topics?: string[] | undefined; metadata?: Record | undefined; minAccessCount?: number | undefined; since?: number | undefined; until?: number | undefined; hops?: 2 | 1 | undefined; linkTypes?: string[] | undefined; includeBaseResults?: boolean | undefined; neighborLimit?: number | undefined; minNeighborScore?: number | undefined; linkTypeWeights?: Record | undefined; includePathDetails?: boolean | undefined; profile?: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief" | undefined; includeProcedural?: boolean | undefined; proceduralLimit?: number | undefined; includeRecent?: boolean | undefined; recentLimit?: number | undefined; }>; type SmartRecallOptions = z.infer; declare const smartRecallProfileDefaultsSchema: z.ZodObject<{ profile: z.ZodEnum<["fast", "deep", "agent-safe", "ops-debug", "coding-agent", "ops-handoff", "research-brief"]>; limit: z.ZodNumber; hops: z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>]>; includeRecent: z.ZodBoolean; includeProcedural: z.ZodBoolean; recentLimit: z.ZodOptional; proceduralLimit: z.ZodOptional; minNeighborScore: z.ZodOptional; neighborLimit: z.ZodOptional; }, "strip", z.ZodTypeAny, { limit: number; hops: 2 | 1; profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; includeProcedural: boolean; includeRecent: boolean; neighborLimit?: number | undefined; minNeighborScore?: number | undefined; proceduralLimit?: number | undefined; recentLimit?: number | undefined; }, { limit: number; hops: 2 | 1; profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; includeProcedural: boolean; includeRecent: boolean; neighborLimit?: number | undefined; minNeighborScore?: number | undefined; proceduralLimit?: number | undefined; recentLimit?: number | undefined; }>; type SmartRecallProfileDefaults = z.infer; declare const contextPackSectionTitlesSchema: z.ZodObject<{ recall: z.ZodString; graph: z.ZodString; procedural: z.ZodString; recent: z.ZodString; actions: z.ZodString; }, "strip", z.ZodTypeAny, { graph: string; recent: string; recall: string; procedural: string; actions: string; }, { graph: string; recent: string; recall: string; procedural: string; actions: string; }>; type ContextPackSectionTitles = z.infer; declare const smartRecallProfileDescriptorSchema: z.ZodObject<{ profile: z.ZodEnum<["fast", "deep", "agent-safe", "ops-debug", "coding-agent", "ops-handoff", "research-brief"]>; label: z.ZodString; overview: z.ZodString; recommendedFor: z.ZodArray; defaultOptions: z.ZodObject<{ profile: z.ZodEnum<["fast", "deep", "agent-safe", "ops-debug", "coding-agent", "ops-handoff", "research-brief"]>; limit: z.ZodNumber; hops: z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>]>; includeRecent: z.ZodBoolean; includeProcedural: z.ZodBoolean; recentLimit: z.ZodOptional; proceduralLimit: z.ZodOptional; minNeighborScore: z.ZodOptional; neighborLimit: z.ZodOptional; }, "strip", z.ZodTypeAny, { limit: number; hops: 2 | 1; profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; includeProcedural: boolean; includeRecent: boolean; neighborLimit?: number | undefined; minNeighborScore?: number | undefined; proceduralLimit?: number | undefined; recentLimit?: number | undefined; }, { limit: number; hops: 2 | 1; profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; includeProcedural: boolean; includeRecent: boolean; neighborLimit?: number | undefined; minNeighborScore?: number | undefined; proceduralLimit?: number | undefined; recentLimit?: number | undefined; }>; contextPackTitles: z.ZodObject<{ recall: z.ZodString; graph: z.ZodString; procedural: z.ZodString; recent: z.ZodString; actions: z.ZodString; }, "strip", z.ZodTypeAny, { graph: string; recent: string; recall: string; procedural: string; actions: string; }, { graph: string; recent: string; recall: string; procedural: string; actions: string; }>; }, "strip", z.ZodTypeAny, { profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; label: string; overview: string; recommendedFor: string[]; defaultOptions: { limit: number; hops: 2 | 1; profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; includeProcedural: boolean; includeRecent: boolean; neighborLimit?: number | undefined; minNeighborScore?: number | undefined; proceduralLimit?: number | undefined; recentLimit?: number | undefined; }; contextPackTitles: { graph: string; recent: string; recall: string; procedural: string; actions: string; }; }, { profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; label: string; overview: string; recommendedFor: string[]; defaultOptions: { limit: number; hops: 2 | 1; profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; includeProcedural: boolean; includeRecent: boolean; neighborLimit?: number | undefined; minNeighborScore?: number | undefined; proceduralLimit?: number | undefined; recentLimit?: number | undefined; }; contextPackTitles: { graph: string; recent: string; recall: string; procedural: string; actions: string; }; }>; type SmartRecallProfileDescriptor = z.infer; declare const smartRecallResultSchema: z.ZodObject<{ id: z.ZodString; content: z.ZodString; topics: z.ZodArray; metadata: z.ZodDefault>; relevanceScore: z.ZodOptional; createdAt: z.ZodNumber; accessedAt: z.ZodNumber; accessCount: z.ZodNumber; } & { sourceLane: z.ZodEnum<["semantic", "graph", "procedural", "recent"]>; reasons: z.ZodDefault>; combinedScore: z.ZodNumber; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; reasons: string[]; sourceLane: "graph" | "recent" | "procedural" | "semantic"; combinedScore: number; relevanceScore?: number | undefined; }, { topics: string[]; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; sourceLane: "graph" | "recent" | "procedural" | "semantic"; combinedScore: number; metadata?: Record | undefined; relevanceScore?: number | undefined; reasons?: string[] | undefined; }>; type SmartRecallResult = z.infer; declare const smartRecallResponseSchema: z.ZodObject<{ results: z.ZodArray; metadata: z.ZodDefault>; relevanceScore: z.ZodOptional; createdAt: z.ZodNumber; accessedAt: z.ZodNumber; accessCount: z.ZodNumber; } & { sourceLane: z.ZodEnum<["semantic", "graph", "procedural", "recent"]>; reasons: z.ZodDefault>; combinedScore: z.ZodNumber; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; reasons: string[]; sourceLane: "graph" | "recent" | "procedural" | "semantic"; combinedScore: number; relevanceScore?: number | undefined; }, { topics: string[]; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; sourceLane: "graph" | "recent" | "procedural" | "semantic"; combinedScore: number; metadata?: Record | undefined; relevanceScore?: number | undefined; reasons?: string[] | undefined; }>, "many">; totalAvailable: z.ZodNumber; query: z.ZodString; tookMs: z.ZodNumber; profile: z.ZodEnum<["fast", "deep", "agent-safe", "ops-debug", "coding-agent", "ops-handoff", "research-brief"]>; lanes: z.ZodObject<{ semantic: z.ZodNumber; graph: z.ZodNumber; procedural: z.ZodNumber; recent: z.ZodNumber; }, "strip", z.ZodTypeAny, { graph: number; recent: number; procedural: number; semantic: number; }, { graph: number; recent: number; procedural: number; semantic: number; }>; }, "strip", z.ZodTypeAny, { profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; query: string; results: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; reasons: string[]; sourceLane: "graph" | "recent" | "procedural" | "semantic"; combinedScore: number; relevanceScore?: number | undefined; }[]; totalAvailable: number; tookMs: number; lanes: { graph: number; recent: number; procedural: number; semantic: number; }; }, { profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; query: string; results: { topics: string[]; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; sourceLane: "graph" | "recent" | "procedural" | "semantic"; combinedScore: number; metadata?: Record | undefined; relevanceScore?: number | undefined; reasons?: string[] | undefined; }[]; totalAvailable: number; tookMs: number; lanes: { graph: number; recent: number; procedural: number; semantic: number; }; }>; type SmartRecallResponse = z.infer; declare const dreamMemoryLayerSchema: z.ZodEnum<["identity", "semantic", "procedural"]>; type DreamMemoryLayer = z.infer; declare const dreamOptionsSchema: z.ZodObject<{ query: z.ZodDefault; layers: z.ZodDefault, "many">>; limit: z.ZodDefault; metadata: z.ZodOptional, z.ZodEffects>; in: z.ZodOptional, "many">>; contains: z.ZodOptional>; gt: z.ZodOptional; gte: z.ZodOptional; lt: z.ZodOptional; lte: z.ZodOptional; exists: z.ZodOptional; }, "strip", z.ZodTypeAny, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>]>>>; topicAllowlist: z.ZodOptional>; }, "strip", z.ZodTypeAny, { limit: number; query: string; layers: ("procedural" | "semantic" | "identity")[]; metadata?: Record | undefined; topicAllowlist?: string[] | undefined; }, { limit?: number | undefined; metadata?: Record | undefined; query?: string | undefined; layers?: ("procedural" | "semantic" | "identity")[] | undefined; topicAllowlist?: string[] | undefined; }>; type DreamOptions = z.infer; declare const dreamResponseSchema: z.ZodObject<{ query: z.ZodString; title: z.ZodString; content: z.ZodString; themes: z.ZodArray; actions: z.ZodArray; sourceIds: z.ZodArray; sourceLayers: z.ZodArray, "many">; sourceCount: z.ZodNumber; modelUsed: z.ZodOptional; tookMs: z.ZodNumber; }, "strip", z.ZodTypeAny, { content: string; query: string; actions: string[]; tookMs: number; title: string; sourceIds: string[]; themes: string[]; sourceLayers: ("procedural" | "semantic" | "identity")[]; sourceCount: number; modelUsed?: string | undefined; }, { content: string; query: string; actions: string[]; tookMs: number; title: string; sourceIds: string[]; themes: string[]; sourceLayers: ("procedural" | "semantic" | "identity")[]; sourceCount: number; modelUsed?: string | undefined; }>; type DreamResponse = z.infer; declare const contextPackOptionsSchema: z.ZodObject<{ limit: z.ZodDefault; topics: z.ZodOptional>; metadata: z.ZodOptional, z.ZodEffects>; in: z.ZodOptional, "many">>; contains: z.ZodOptional>; gt: z.ZodOptional; gte: z.ZodOptional; lt: z.ZodOptional; lte: z.ZodOptional; exists: z.ZodOptional; }, "strip", z.ZodTypeAny, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }, { eq?: string | number | boolean | null | undefined; in?: (string | number | boolean | null)[] | undefined; contains?: string | number | boolean | undefined; gt?: number | undefined; gte?: number | undefined; lt?: number | undefined; lte?: number | undefined; exists?: boolean | undefined; }>]>>>; minAccessCount: z.ZodOptional; since: z.ZodOptional; until: z.ZodOptional; hops: z.ZodDefault, z.ZodLiteral<2>]>>; linkTypes: z.ZodOptional>; includeBaseResults: z.ZodDefault; neighborLimit: z.ZodDefault; minNeighborScore: z.ZodDefault; linkTypeWeights: z.ZodOptional>; includePathDetails: z.ZodDefault; profile: z.ZodDefault>; includeProcedural: z.ZodDefault; proceduralLimit: z.ZodDefault; recentLimit: z.ZodDefault; } & { maxChars: z.ZodDefault; includeDream: z.ZodDefault; includeRecent: z.ZodDefault; includeMetadata: z.ZodDefault; }, "strip", z.ZodTypeAny, { limit: number; hops: 2 | 1; includeBaseResults: boolean; neighborLimit: number; minNeighborScore: number; includePathDetails: boolean; profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; includeProcedural: boolean; proceduralLimit: number; includeRecent: boolean; recentLimit: number; maxChars: number; includeDream: boolean; includeMetadata: boolean; topics?: string[] | undefined; metadata?: Record | undefined; minAccessCount?: number | undefined; since?: number | undefined; until?: number | undefined; linkTypes?: string[] | undefined; linkTypeWeights?: Record | undefined; }, { limit?: number | undefined; topics?: string[] | undefined; metadata?: Record | undefined; minAccessCount?: number | undefined; since?: number | undefined; until?: number | undefined; hops?: 2 | 1 | undefined; linkTypes?: string[] | undefined; includeBaseResults?: boolean | undefined; neighborLimit?: number | undefined; minNeighborScore?: number | undefined; linkTypeWeights?: Record | undefined; includePathDetails?: boolean | undefined; profile?: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief" | undefined; includeProcedural?: boolean | undefined; proceduralLimit?: number | undefined; includeRecent?: boolean | undefined; recentLimit?: number | undefined; maxChars?: number | undefined; includeDream?: boolean | undefined; includeMetadata?: boolean | undefined; }>; type ContextPackOptions = z.infer; declare const contextPackSectionSchema: z.ZodObject<{ kind: z.ZodEnum<["overview", "recall", "graph", "procedural", "recent", "actions", "dream"]>; title: z.ZodString; content: z.ZodString; sourceIds: z.ZodDefault>; }, "strip", z.ZodTypeAny, { content: string; kind: "graph" | "recent" | "overview" | "recall" | "procedural" | "actions" | "dream"; title: string; sourceIds: string[]; }, { content: string; kind: "graph" | "recent" | "overview" | "recall" | "procedural" | "actions" | "dream"; title: string; sourceIds?: string[] | undefined; }>; type ContextPackSection = z.infer; declare const contextPackResponseSchema: z.ZodObject<{ query: z.ZodString; profile: z.ZodEnum<["fast", "deep", "agent-safe", "ops-debug", "coding-agent", "ops-handoff", "research-brief"]>; content: z.ZodString; sections: z.ZodArray; title: z.ZodString; content: z.ZodString; sourceIds: z.ZodDefault>; }, "strip", z.ZodTypeAny, { content: string; kind: "graph" | "recent" | "overview" | "recall" | "procedural" | "actions" | "dream"; title: string; sourceIds: string[]; }, { content: string; kind: "graph" | "recent" | "overview" | "recall" | "procedural" | "actions" | "dream"; title: string; sourceIds?: string[] | undefined; }>, "many">; sourceIds: z.ZodArray; maxChars: z.ZodNumber; usedChars: z.ZodNumber; truncated: z.ZodBoolean; tookMs: z.ZodNumber; }, "strip", z.ZodTypeAny, { profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; maxChars: number; content: string; query: string; tookMs: number; sections: { content: string; kind: "graph" | "recent" | "overview" | "recall" | "procedural" | "actions" | "dream"; title: string; sourceIds: string[]; }[]; sourceIds: string[]; usedChars: number; truncated: boolean; }, { profile: "fast" | "deep" | "agent-safe" | "ops-debug" | "coding-agent" | "ops-handoff" | "research-brief"; maxChars: number; content: string; query: string; tookMs: number; sections: { content: string; kind: "graph" | "recent" | "overview" | "recall" | "procedural" | "actions" | "dream"; title: string; sourceIds?: string[] | undefined; }[]; sourceIds: string[]; usedChars: number; truncated: boolean; }>; type ContextPackResponse = z.infer; declare const memoryHealthOptionsSchema: z.ZodObject<{ staleAgeMs: z.ZodDefault; maxSnapshotAgeMs: z.ZodDefault; minSnapshotMemories: z.ZodDefault; maxUntaggedRatio: z.ZodDefault; duplicateSampleLimit: z.ZodDefault; }, "strip", z.ZodTypeAny, { staleAgeMs: number; maxSnapshotAgeMs: number; minSnapshotMemories: number; maxUntaggedRatio: number; duplicateSampleLimit: number; }, { staleAgeMs?: number | undefined; maxSnapshotAgeMs?: number | undefined; minSnapshotMemories?: number | undefined; maxUntaggedRatio?: number | undefined; duplicateSampleLimit?: number | undefined; }>; type MemoryHealthOptions = z.input; declare const memoryHealthCheckSchema: z.ZodObject<{ name: z.ZodString; status: z.ZodEnum<["pass", "warn", "fail"]>; detail: z.ZodString; value: z.ZodOptional; action: z.ZodOptional; command: z.ZodOptional; }, "strip", z.ZodTypeAny, { status: "fail" | "pass" | "warn"; name: string; detail: string; value?: unknown; command?: string | undefined; action?: string | undefined; }, { status: "fail" | "pass" | "warn"; name: string; detail: string; value?: unknown; command?: string | undefined; action?: string | undefined; }>; type MemoryHealthCheck = z.infer; declare const memoryHealthRecommendationSchema: z.ZodObject<{ priority: z.ZodEnum<["low", "medium", "high"]>; action: z.ZodString; reason: z.ZodString; command: z.ZodOptional; }, "strip", z.ZodTypeAny, { action: string; priority: "low" | "medium" | "high"; reason: string; command?: string | undefined; }, { action: string; priority: "low" | "medium" | "high"; reason: string; command?: string | undefined; }>; type MemoryHealthRecommendation = z.infer; declare const memoryHealthResponseSchema: z.ZodObject<{ score: z.ZodNumber; status: z.ZodEnum<["healthy", "watch", "attention"]>; checkedAt: z.ZodNumber; checks: z.ZodArray; detail: z.ZodString; value: z.ZodOptional; action: z.ZodOptional; command: z.ZodOptional; }, "strip", z.ZodTypeAny, { status: "fail" | "pass" | "warn"; name: string; detail: string; value?: unknown; command?: string | undefined; action?: string | undefined; }, { status: "fail" | "pass" | "warn"; name: string; detail: string; value?: unknown; command?: string | undefined; action?: string | undefined; }>, "many">; recommendations: z.ZodArray; action: z.ZodString; reason: z.ZodString; command: z.ZodOptional; }, "strip", z.ZodTypeAny, { action: string; priority: "low" | "medium" | "high"; reason: string; command?: string | undefined; }, { action: string; priority: "low" | "medium" | "high"; reason: string; command?: string | undefined; }>, "many">; stats: z.ZodObject<{ coreCount: z.ZodNumber; layerCount: z.ZodNumber; snapshotCount: z.ZodNumber; eventCount: z.ZodNumber; duplicateGroups: z.ZodNumber; staleCount: z.ZodNumber; untaggedCount: z.ZodNumber; }, "strip", z.ZodTypeAny, { coreCount: number; layerCount: number; snapshotCount: number; eventCount: number; duplicateGroups: number; staleCount: number; untaggedCount: number; }, { coreCount: number; layerCount: number; snapshotCount: number; eventCount: number; duplicateGroups: number; staleCount: number; untaggedCount: number; }>; }, "strip", z.ZodTypeAny, { status: "healthy" | "watch" | "attention"; stats: { coreCount: number; layerCount: number; snapshotCount: number; eventCount: number; duplicateGroups: number; staleCount: number; untaggedCount: number; }; score: number; checkedAt: number; checks: { status: "fail" | "pass" | "warn"; name: string; detail: string; value?: unknown; command?: string | undefined; action?: string | undefined; }[]; recommendations: { action: string; priority: "low" | "medium" | "high"; reason: string; command?: string | undefined; }[]; }, { status: "healthy" | "watch" | "attention"; stats: { coreCount: number; layerCount: number; snapshotCount: number; eventCount: number; duplicateGroups: number; staleCount: number; untaggedCount: number; }; score: number; checkedAt: number; checks: { status: "fail" | "pass" | "warn"; name: string; detail: string; value?: unknown; command?: string | undefined; action?: string | undefined; }[]; recommendations: { action: string; priority: "low" | "medium" | "high"; reason: string; command?: string | undefined; }[]; }>; type MemoryHealthResponse = z.infer; declare const namespaceInputSchema: z.ZodUnion<[z.ZodString, z.ZodArray]>; type NamespaceInput = z.infer; declare const namespaceQueryScopeSchema: z.ZodObject<{ visibility: z.ZodDefault>; includeDescendants: z.ZodDefault; }, "strip", z.ZodTypeAny, { visibility: "shared" | "private" | "all"; includeDescendants: boolean; }, { visibility?: "shared" | "private" | "all" | undefined; includeDescendants?: boolean | undefined; }>; type NamespaceQueryScope = z.infer; declare const knowledgeResourceUriSchema: z.ZodEffects, string, string>; type KnowledgeResourceUri = z.infer; declare const knowledgeResourceScopeSchema: z.ZodString; type KnowledgeResourceScope = z.infer; declare const knowledgeResourceGrantSchema: z.ZodObject<{ resourceUri: z.ZodOptional, string, string>>; source: z.ZodOptional; project: z.ZodOptional; scopes: z.ZodDefault>; }, "strip", z.ZodTypeAny, { scopes: string[]; source?: string | undefined; project?: string | undefined; resourceUri?: string | undefined; }, { source?: string | undefined; project?: string | undefined; resourceUri?: string | undefined; scopes?: string[] | undefined; }>; type KnowledgeResourceGrant = z.infer; interface KnowledgeResourceAccessResult { allowed: boolean; missingScopes: string[]; reason?: 'resource-uri-mismatch' | 'source-mismatch' | 'project-mismatch' | 'missing-scopes'; } declare function authorizeKnowledgeResourceAccess(resource: { resourceUri?: string; source?: string; project?: string; requiredScopes?: string[]; }, grant: KnowledgeResourceGrant): KnowledgeResourceAccessResult; declare const knowledgeNodeSchema: z.ZodObject<{ id: z.ZodString; label: z.ZodDefault; name: z.ZodOptional; kind: z.ZodOptional; content: z.ZodOptional; summary: z.ZodOptional; path: z.ZodOptional; language: z.ZodOptional; weight: z.ZodOptional; metadata: z.ZodDefault>>; }, "strip", z.ZodTypeAny, { metadata: Record; id: string; label: string; path?: string | undefined; content?: string | undefined; kind?: string | undefined; name?: string | undefined; summary?: string | undefined; language?: string | undefined; weight?: number | undefined; }, { id: string; path?: string | undefined; metadata?: Record | undefined; content?: string | undefined; kind?: string | undefined; label?: string | undefined; name?: string | undefined; summary?: string | undefined; language?: string | undefined; weight?: number | undefined; }>; type KnowledgeNode = z.infer; declare const knowledgeEdgeSchema: z.ZodObject<{ from: z.ZodString; to: z.ZodString; type: z.ZodString; weight: z.ZodOptional; metadata: z.ZodDefault>>; }, "strip", z.ZodTypeAny, { type: string; metadata: Record; from: string; to: string; weight?: number | undefined; }, { type: string; from: string; to: string; metadata?: Record | undefined; weight?: number | undefined; }>; type KnowledgeEdge = z.infer; declare const knowledgeGraphArtifactSchema: z.ZodObject<{ source: z.ZodDefault; project: z.ZodOptional; version: z.ZodOptional; generatedAt: z.ZodOptional; artifactPath: z.ZodOptional; resourceUri: z.ZodOptional, string, string>>; requiredScopes: z.ZodDefault>>; nodes: z.ZodDefault; name: z.ZodOptional; kind: z.ZodOptional; content: z.ZodOptional; summary: z.ZodOptional; path: z.ZodOptional; language: z.ZodOptional; weight: z.ZodOptional; metadata: z.ZodDefault>>; }, "strip", z.ZodTypeAny, { metadata: Record; id: string; label: string; path?: string | undefined; content?: string | undefined; kind?: string | undefined; name?: string | undefined; summary?: string | undefined; language?: string | undefined; weight?: number | undefined; }, { id: string; path?: string | undefined; metadata?: Record | undefined; content?: string | undefined; kind?: string | undefined; label?: string | undefined; name?: string | undefined; summary?: string | undefined; language?: string | undefined; weight?: number | undefined; }>, "many">>; edges: z.ZodDefault; metadata: z.ZodDefault>>; }, "strip", z.ZodTypeAny, { type: string; metadata: Record; from: string; to: string; weight?: number | undefined; }, { type: string; from: string; to: string; metadata?: Record | undefined; weight?: number | undefined; }>, "many">>; metadata: z.ZodDefault>>; }, "strip", z.ZodTypeAny, { metadata: Record; source: string; requiredScopes: string[]; nodes: { metadata: Record; id: string; label: string; path?: string | undefined; content?: string | undefined; kind?: string | undefined; name?: string | undefined; summary?: string | undefined; language?: string | undefined; weight?: number | undefined; }[]; edges: { type: string; metadata: Record; from: string; to: string; weight?: number | undefined; }[]; project?: string | undefined; version?: string | undefined; generatedAt?: number | undefined; artifactPath?: string | undefined; resourceUri?: string | undefined; }, { metadata?: Record | undefined; source?: string | undefined; project?: string | undefined; version?: string | undefined; generatedAt?: number | undefined; artifactPath?: string | undefined; resourceUri?: string | undefined; requiredScopes?: string[] | undefined; nodes?: { id: string; path?: string | undefined; metadata?: Record | undefined; content?: string | undefined; kind?: string | undefined; label?: string | undefined; name?: string | undefined; summary?: string | undefined; language?: string | undefined; weight?: number | undefined; }[] | undefined; edges?: { type: string; from: string; to: string; metadata?: Record | undefined; weight?: number | undefined; }[] | undefined; }>; type KnowledgeGraphArtifact = z.infer; declare const knowledgeIngestOptionsSchema: z.ZodObject<{ source: z.ZodOptional; project: z.ZodOptional; namespace: z.ZodOptional]>>; visibility: z.ZodDefault>; topic: z.ZodDefault; linkTypePrefix: z.ZodDefault; }, "strip", z.ZodTypeAny, { topic: string; visibility: "shared" | "private"; linkTypePrefix: string; source?: string | undefined; project?: string | undefined; namespace?: string | string[] | undefined; }, { source?: string | undefined; project?: string | undefined; topic?: string | undefined; visibility?: "shared" | "private" | undefined; namespace?: string | string[] | undefined; linkTypePrefix?: string | undefined; }>; type KnowledgeIngestOptions = z.infer; declare const knowledgeIngestResultSchema: z.ZodObject<{ source: z.ZodString; project: z.ZodOptional; namespace: z.ZodString; nodesStored: z.ZodNumber; edgesLinked: z.ZodNumber; skippedEdges: z.ZodNumber; nodeMemoryIds: z.ZodRecord; }, "strip", z.ZodTypeAny, { source: string; namespace: string; nodesStored: number; edgesLinked: number; skippedEdges: number; nodeMemoryIds: Record; project?: string | undefined; }, { source: string; namespace: string; nodesStored: number; edgesLinked: number; skippedEdges: number; nodeMemoryIds: Record; project?: string | undefined; }>; type KnowledgeIngestResult = z.infer; declare const knowledgeArtifactRegistrationSchema: z.ZodObject<{ source: z.ZodDefault; project: z.ZodOptional; artifactPath: z.ZodString; resourceUri: z.ZodOptional, string, string>>; requiredScopes: z.ZodDefault>>; format: z.ZodDefault; compression: z.ZodOptional; checksum: z.ZodOptional; generatedAt: z.ZodOptional; metadata: z.ZodDefault>>; }, "strip", z.ZodTypeAny, { metadata: Record; source: string; artifactPath: string; requiredScopes: string[]; format: string; project?: string | undefined; generatedAt?: number | undefined; resourceUri?: string | undefined; compression?: string | undefined; checksum?: string | undefined; }, { artifactPath: string; metadata?: Record | undefined; source?: string | undefined; project?: string | undefined; generatedAt?: number | undefined; resourceUri?: string | undefined; requiredScopes?: string[] | undefined; format?: string | undefined; compression?: string | undefined; checksum?: string | undefined; }>; type KnowledgeArtifactRegistration = z.infer; type KnowledgeArtifactRegistrationResult = { id: string; source: string; project?: string; artifactPath: string; resourceUri?: string; requiredScopes?: string[]; }; declare const modelConfigSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{ type: z.ZodLiteral<"bankr">; apiKey: z.ZodString; baseUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "bankr"; apiKey: string; baseUrl?: string | undefined; }, { type: "bankr"; apiKey: string; baseUrl?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"openai">; apiKey: z.ZodString; model: z.ZodDefault>; baseUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "openai"; apiKey: string; model: string; baseUrl?: string | undefined; }, { type: "openai"; apiKey: string; baseUrl?: string | undefined; model?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"anthropic">; apiKey: z.ZodString; model: z.ZodDefault>; baseUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "anthropic"; apiKey: string; model: string; baseUrl?: string | undefined; }, { type: "anthropic"; apiKey: string; baseUrl?: string | undefined; model?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"ollama">; baseUrl: z.ZodDefault; model: z.ZodDefault; }, "strip", z.ZodTypeAny, { type: "ollama"; baseUrl: string; model: string; }, { type: "ollama"; baseUrl?: string | undefined; model?: string | undefined; }>]>; type ModelConfig = z.infer; interface LLMMessage { role: 'system' | 'user' | 'assistant'; content: string; } interface LLMResponse { content: string; raw: unknown; } interface Adapter { name: string; store(entry: MemoryEntry): Promise; query(text: string, options?: QueryOptions): Promise; getRecent(n?: number): Promise; getByTopic(topic: string, limit?: number): Promise; } declare const embeddingConfigSchema: z.ZodObject<{ /** Enable vector embeddings for semantic search (default: false) */ enabled: z.ZodDefault; /** Ollama base URL (e.g. http://192.168.68.73:11434) */ baseUrl: z.ZodDefault; /** Embedding model to use (e.g. 'nomic-embed-text', 'mxbai-embed-large') */ model: z.ZodDefault; /** Embedding dimension (auto-detected on first embed if not set) */ dimension: z.ZodOptional; /** Whether to generate embeddings async in background (non-blocking store) */ asyncEmbed: z.ZodDefault; }, "strip", z.ZodTypeAny, { enabled: boolean; baseUrl: string; model: string; asyncEmbed: boolean; dimension?: number | undefined; }, { enabled?: boolean | undefined; baseUrl?: string | undefined; model?: string | undefined; dimension?: number | undefined; asyncEmbed?: boolean | undefined; }>; type EmbeddingConfig$1 = z.infer; declare const postgresStorageConfigSchema: z.ZodObject<{ connectionString: z.ZodOptional; schema: z.ZodOptional; tablePrefix: z.ZodOptional; ssl: z.ZodOptional]>>; pgvector: z.ZodOptional; embeddingType: z.ZodDefault>; ivfflatLists: z.ZodDefault; }, "strip", z.ZodTypeAny, { enabled: boolean; embeddingType: "memory" | "layered" | "both"; ivfflatLists: number; }, { enabled?: boolean | undefined; embeddingType?: "memory" | "layered" | "both" | undefined; ivfflatLists?: number | undefined; }>>; pool: z.ZodOptional; }, "strip", z.ZodTypeAny, { connectionString?: string | undefined; schema?: string | undefined; tablePrefix?: string | undefined; ssl?: boolean | Record | undefined; pgvector?: { enabled: boolean; embeddingType: "memory" | "layered" | "both"; ivfflatLists: number; } | undefined; pool?: unknown; }, { connectionString?: string | undefined; schema?: string | undefined; tablePrefix?: string | undefined; ssl?: boolean | Record | undefined; pgvector?: { enabled?: boolean | undefined; embeddingType?: "memory" | "layered" | "both" | undefined; ivfflatLists?: number | undefined; } | undefined; pool?: unknown; }>; type PostgresStorageConfig = z.infer; declare const rememConfigSchema: z.ZodObject<{ storage: z.ZodDefault>; storageConfig: z.ZodOptional>; postgres: z.ZodOptional; schema: z.ZodOptional; tablePrefix: z.ZodOptional; ssl: z.ZodOptional]>>; pgvector: z.ZodOptional; embeddingType: z.ZodDefault>; ivfflatLists: z.ZodDefault; }, "strip", z.ZodTypeAny, { enabled: boolean; embeddingType: "memory" | "layered" | "both"; ivfflatLists: number; }, { enabled?: boolean | undefined; embeddingType?: "memory" | "layered" | "both" | undefined; ivfflatLists?: number | undefined; }>>; pool: z.ZodOptional; }, "strip", z.ZodTypeAny, { connectionString?: string | undefined; schema?: string | undefined; tablePrefix?: string | undefined; ssl?: boolean | Record | undefined; pgvector?: { enabled: boolean; embeddingType: "memory" | "layered" | "both"; ivfflatLists: number; } | undefined; pool?: unknown; }, { connectionString?: string | undefined; schema?: string | undefined; tablePrefix?: string | undefined; ssl?: boolean | Record | undefined; pgvector?: { enabled?: boolean | undefined; embeddingType?: "memory" | "layered" | "both" | undefined; ivfflatLists?: number | undefined; } | undefined; pool?: unknown; }>>; llm: z.ZodOptional; apiKey: z.ZodString; baseUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "bankr"; apiKey: string; baseUrl?: string | undefined; }, { type: "bankr"; apiKey: string; baseUrl?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"openai">; apiKey: z.ZodString; model: z.ZodDefault>; baseUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "openai"; apiKey: string; model: string; baseUrl?: string | undefined; }, { type: "openai"; apiKey: string; baseUrl?: string | undefined; model?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"anthropic">; apiKey: z.ZodString; model: z.ZodDefault>; baseUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "anthropic"; apiKey: string; model: string; baseUrl?: string | undefined; }, { type: "anthropic"; apiKey: string; baseUrl?: string | undefined; model?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"ollama">; baseUrl: z.ZodDefault; model: z.ZodDefault; }, "strip", z.ZodTypeAny, { type: "ollama"; baseUrl: string; model: string; }, { type: "ollama"; baseUrl?: string | undefined; model?: string | undefined; }>]>>; adapter: z.ZodOptional; dbPath: z.ZodOptional; embeddings: z.ZodOptional; /** Ollama base URL (e.g. http://192.168.68.73:11434) */ baseUrl: z.ZodDefault; /** Embedding model to use (e.g. 'nomic-embed-text', 'mxbai-embed-large') */ model: z.ZodDefault; /** Embedding dimension (auto-detected on first embed if not set) */ dimension: z.ZodOptional; /** Whether to generate embeddings async in background (non-blocking store) */ asyncEmbed: z.ZodDefault; }, "strip", z.ZodTypeAny, { enabled: boolean; baseUrl: string; model: string; asyncEmbed: boolean; dimension?: number | undefined; }, { enabled?: boolean | undefined; baseUrl?: string | undefined; model?: string | undefined; dimension?: number | undefined; asyncEmbed?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { storage: "sqlite" | "postgres" | "memory"; postgres?: { connectionString?: string | undefined; schema?: string | undefined; tablePrefix?: string | undefined; ssl?: boolean | Record | undefined; pgvector?: { enabled: boolean; embeddingType: "memory" | "layered" | "both"; ivfflatLists: number; } | undefined; pool?: unknown; } | undefined; storageConfig?: Record | undefined; llm?: { type: "bankr"; apiKey: string; baseUrl?: string | undefined; } | { type: "openai"; apiKey: string; model: string; baseUrl?: string | undefined; } | { type: "anthropic"; apiKey: string; model: string; baseUrl?: string | undefined; } | { type: "ollama"; baseUrl: string; model: string; } | undefined; adapter?: string | undefined; dbPath?: string | undefined; embeddings?: { enabled: boolean; baseUrl: string; model: string; asyncEmbed: boolean; dimension?: number | undefined; } | undefined; }, { postgres?: { connectionString?: string | undefined; schema?: string | undefined; tablePrefix?: string | undefined; ssl?: boolean | Record | undefined; pgvector?: { enabled?: boolean | undefined; embeddingType?: "memory" | "layered" | "both" | undefined; ivfflatLists?: number | undefined; } | undefined; pool?: unknown; } | undefined; storage?: "sqlite" | "postgres" | "memory" | undefined; storageConfig?: Record | undefined; llm?: { type: "bankr"; apiKey: string; baseUrl?: string | undefined; } | { type: "openai"; apiKey: string; baseUrl?: string | undefined; model?: string | undefined; } | { type: "anthropic"; apiKey: string; baseUrl?: string | undefined; model?: string | undefined; } | { type: "ollama"; baseUrl?: string | undefined; model?: string | undefined; } | undefined; adapter?: string | undefined; dbPath?: string | undefined; embeddings?: { enabled?: boolean | undefined; baseUrl?: string | undefined; model?: string | undefined; dimension?: number | undefined; asyncEmbed?: boolean | undefined; } | undefined; }>; type ReMEMConfig = z.infer; declare const eventTypeSchema: z.ZodEnum<["memory.stored", "memory.queried", "memory.accessed", "memory.forgotten", "memory.linked", "memory.unlinked", "memory.superseded", "snapshot.created", "snapshot.restored", "storage.maintenance", "knowledge.ingested", "knowledge.artifact_registered", "identity.constitution_updated", "identity.drift_detected", "identity.drift_correction_injected"]>; type EventType = z.infer; declare const memoryEventSchema: z.ZodObject<{ id: z.ZodString; type: z.ZodEnum<["memory.stored", "memory.queried", "memory.accessed", "memory.forgotten", "memory.linked", "memory.unlinked", "memory.superseded", "snapshot.created", "snapshot.restored", "storage.maintenance", "knowledge.ingested", "knowledge.artifact_registered", "identity.constitution_updated", "identity.drift_detected", "identity.drift_correction_injected"]>; timestamp: z.ZodNumber; payload: z.ZodRecord; }, "strip", z.ZodTypeAny, { type: "memory.stored" | "memory.queried" | "memory.accessed" | "memory.forgotten" | "memory.linked" | "memory.unlinked" | "memory.superseded" | "snapshot.created" | "snapshot.restored" | "storage.maintenance" | "knowledge.ingested" | "knowledge.artifact_registered" | "identity.constitution_updated" | "identity.drift_detected" | "identity.drift_correction_injected"; id: string; timestamp: number; payload: Record; }, { type: "memory.stored" | "memory.queried" | "memory.accessed" | "memory.forgotten" | "memory.linked" | "memory.unlinked" | "memory.superseded" | "snapshot.created" | "snapshot.restored" | "storage.maintenance" | "knowledge.ingested" | "knowledge.artifact_registered" | "identity.constitution_updated" | "identity.drift_detected" | "identity.drift_correction_injected"; id: string; timestamp: number; payload: Record; }>; type MemoryEvent = z.infer; declare const identityCategorySchema: z.ZodEnum<["values", "boundaries", "preferences", "goals"]>; type IdentityCategory = z.infer; declare const constitutionStatementSchema: z.ZodObject<{ id: z.ZodString; text: z.ZodString; category: z.ZodEnum<["values", "boundaries", "preferences", "goals"]>; weight: z.ZodDefault; source: z.ZodOptional; createdAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }, { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }>; type ConstitutionStatement = z.infer; declare const constitutionSchema: z.ZodObject<{ statements: z.ZodArray; weight: z.ZodDefault; source: z.ZodOptional; createdAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }, { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }>, "many">; version: z.ZodDefault; createdAt: z.ZodNumber; updatedAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { version: string; createdAt: number; statements: { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }[]; updatedAt: number; }, { createdAt: number; statements: { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }[]; updatedAt: number; version?: string | undefined; }>; type Constitution = z.infer; declare const driftResultSchema: z.ZodObject<{ score: z.ZodNumber; level: z.ZodEnum<["aligned", "minor", "moderate", "critical"]>; violatingStatements: z.ZodArray; weight: z.ZodDefault; source: z.ZodOptional; createdAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }, { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }>, "many">; reasoning: z.ZodString; detectedAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { score: number; level: "aligned" | "minor" | "moderate" | "critical"; violatingStatements: { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }[]; reasoning: string; detectedAt: number; }, { score: number; level: "aligned" | "minor" | "moderate" | "critical"; violatingStatements: { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }[]; reasoning: string; detectedAt: number; }>; type DriftResult = z.infer; declare const identityConfigSchema: z.ZodObject<{ constitution: z.ZodOptional; weight: z.ZodDefault; source: z.ZodOptional; createdAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }, { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }>, "many">; version: z.ZodDefault; createdAt: z.ZodNumber; updatedAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { version: string; createdAt: number; statements: { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }[]; updatedAt: number; }, { createdAt: number; statements: { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }[]; updatedAt: number; version?: string | undefined; }>>; driftThreshold: z.ZodDefault; criticalThreshold: z.ZodDefault; autoInject: z.ZodDefault; evalModel: z.ZodOptional; apiKey: z.ZodString; baseUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "bankr"; apiKey: string; baseUrl?: string | undefined; }, { type: "bankr"; apiKey: string; baseUrl?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"openai">; apiKey: z.ZodString; model: z.ZodDefault>; baseUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "openai"; apiKey: string; model: string; baseUrl?: string | undefined; }, { type: "openai"; apiKey: string; baseUrl?: string | undefined; model?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"anthropic">; apiKey: z.ZodString; model: z.ZodDefault>; baseUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "anthropic"; apiKey: string; model: string; baseUrl?: string | undefined; }, { type: "anthropic"; apiKey: string; baseUrl?: string | undefined; model?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"ollama">; baseUrl: z.ZodDefault; model: z.ZodDefault; }, "strip", z.ZodTypeAny, { type: "ollama"; baseUrl: string; model: string; }, { type: "ollama"; baseUrl?: string | undefined; model?: string | undefined; }>]>>; }, "strip", z.ZodTypeAny, { driftThreshold: number; criticalThreshold: number; autoInject: boolean; constitution?: { version: string; createdAt: number; statements: { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }[]; updatedAt: number; } | undefined; evalModel?: { type: "bankr"; apiKey: string; baseUrl?: string | undefined; } | { type: "openai"; apiKey: string; model: string; baseUrl?: string | undefined; } | { type: "anthropic"; apiKey: string; model: string; baseUrl?: string | undefined; } | { type: "ollama"; baseUrl: string; model: string; } | undefined; }, { constitution?: { createdAt: number; statements: { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }[]; updatedAt: number; version?: string | undefined; } | undefined; driftThreshold?: number | undefined; criticalThreshold?: number | undefined; autoInject?: boolean | undefined; evalModel?: { type: "bankr"; apiKey: string; baseUrl?: string | undefined; } | { type: "openai"; apiKey: string; baseUrl?: string | undefined; model?: string | undefined; } | { type: "anthropic"; apiKey: string; baseUrl?: string | undefined; model?: string | undefined; } | { type: "ollama"; baseUrl?: string | undefined; model?: string | undefined; } | undefined; }>; type IdentityConfig = z.infer; declare const memoryLayerSchema: z.ZodEnum<["episodic", "semantic", "identity", "procedural"]>; type MemoryLayer = z.infer; declare const layerConfigSchema: z.ZodObject<{ episodic: z.ZodObject<{ ttlMs: z.ZodDefault; maxEntries: z.ZodDefault; weight: z.ZodDefault; }, "strip", z.ZodTypeAny, { weight: number; ttlMs: number; maxEntries: number; }, { weight?: number | undefined; ttlMs?: number | undefined; maxEntries?: number | undefined; }>; semantic: z.ZodObject<{ ttlMs: z.ZodDefault; maxEntries: z.ZodDefault; weight: z.ZodDefault; selfEdit: z.ZodDefault; temporalValidity: z.ZodDefault; }, "strip", z.ZodTypeAny, { weight: number; ttlMs: number; maxEntries: number; selfEdit: boolean; temporalValidity: boolean; }, { weight?: number | undefined; ttlMs?: number | undefined; maxEntries?: number | undefined; selfEdit?: boolean | undefined; temporalValidity?: boolean | undefined; }>; identity: z.ZodObject<{ ttlMs: z.ZodDefault; maxEntries: z.ZodDefault; weight: z.ZodDefault; }, "strip", z.ZodTypeAny, { weight: number; ttlMs: number; maxEntries: number; }, { weight?: number | undefined; ttlMs?: number | undefined; maxEntries?: number | undefined; }>; procedural: z.ZodObject<{ ttlMs: z.ZodDefault; maxEntries: z.ZodDefault; weight: z.ZodDefault; trigger: z.ZodOptional; }, "strip", z.ZodTypeAny, { weight: number; ttlMs: number; maxEntries: number; trigger?: string | undefined; }, { weight?: number | undefined; trigger?: string | undefined; ttlMs?: number | undefined; maxEntries?: number | undefined; }>; }, "strip", z.ZodTypeAny, { procedural: { weight: number; ttlMs: number; maxEntries: number; trigger?: string | undefined; }; episodic: { weight: number; ttlMs: number; maxEntries: number; }; semantic: { weight: number; ttlMs: number; maxEntries: number; selfEdit: boolean; temporalValidity: boolean; }; identity: { weight: number; ttlMs: number; maxEntries: number; }; }, { procedural: { weight?: number | undefined; trigger?: string | undefined; ttlMs?: number | undefined; maxEntries?: number | undefined; }; episodic: { weight?: number | undefined; ttlMs?: number | undefined; maxEntries?: number | undefined; }; semantic: { weight?: number | undefined; ttlMs?: number | undefined; maxEntries?: number | undefined; selfEdit?: boolean | undefined; temporalValidity?: boolean | undefined; }; identity: { weight?: number | undefined; ttlMs?: number | undefined; maxEntries?: number | undefined; }; }>; type LayerConfig = z.infer; declare const layeredMemoryEntrySchema: z.ZodObject<{ id: z.ZodString; content: z.ZodString; topics: z.ZodDefault>; metadata: z.ZodDefault>; createdAt: z.ZodNumber; accessedAt: z.ZodNumber; accessCount: z.ZodDefault; } & { layer: z.ZodDefault>; expiresAt: z.ZodOptional; importance: z.ZodDefault; validFrom: z.ZodOptional; validUntil: z.ZodOptional; supersedes: z.ZodOptional>; supersededBy: z.ZodOptional>; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; layer: "procedural" | "episodic" | "semantic" | "identity"; importance: number; expiresAt?: number | undefined; validFrom?: number | undefined; validUntil?: number | undefined; supersedes?: string | null | undefined; supersededBy?: string | null | undefined; }, { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; layer?: "procedural" | "episodic" | "semantic" | "identity" | undefined; expiresAt?: number | undefined; importance?: number | undefined; validFrom?: number | undefined; validUntil?: number | undefined; supersedes?: string | null | undefined; supersededBy?: string | null | undefined; }>; type LayeredMemoryEntry = z.infer; declare const proceduralTriggerSchema: z.ZodObject<{ terms: z.ZodDefault>>; phrases: z.ZodDefault>>; topics: z.ZodDefault>>; excludeTerms: z.ZodDefault>>; regex: z.ZodOptional; match: z.ZodDefault>; minScore: z.ZodDefault; priority: z.ZodDefault; }, "strip", z.ZodTypeAny, { topics: string[]; match: "any" | "all"; priority: number; terms: string[]; phrases: string[]; excludeTerms: string[]; minScore: number; regex?: string | undefined; }, { topics?: string[] | undefined; match?: "any" | "all" | undefined; priority?: number | undefined; terms?: string[] | undefined; phrases?: string[] | undefined; excludeTerms?: string[] | undefined; regex?: string | undefined; minScore?: number | undefined; }>; type ProceduralTrigger = z.infer; declare const proceduralMatchSchema: z.ZodObject<{ entry: z.ZodObject<{ id: z.ZodString; content: z.ZodString; topics: z.ZodDefault>; metadata: z.ZodDefault>; createdAt: z.ZodNumber; accessedAt: z.ZodNumber; accessCount: z.ZodDefault; } & { layer: z.ZodDefault>; expiresAt: z.ZodOptional; importance: z.ZodDefault; validFrom: z.ZodOptional; validUntil: z.ZodOptional; supersedes: z.ZodOptional>; supersededBy: z.ZodOptional>; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; layer: "procedural" | "episodic" | "semantic" | "identity"; importance: number; expiresAt?: number | undefined; validFrom?: number | undefined; validUntil?: number | undefined; supersedes?: string | null | undefined; supersededBy?: string | null | undefined; }, { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; layer?: "procedural" | "episodic" | "semantic" | "identity" | undefined; expiresAt?: number | undefined; importance?: number | undefined; validFrom?: number | undefined; validUntil?: number | undefined; supersedes?: string | null | undefined; supersededBy?: string | null | undefined; }>; score: z.ZodNumber; reasons: z.ZodArray; }, "strip", z.ZodTypeAny, { score: number; entry: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; layer: "procedural" | "episodic" | "semantic" | "identity"; importance: number; expiresAt?: number | undefined; validFrom?: number | undefined; validUntil?: number | undefined; supersedes?: string | null | undefined; supersededBy?: string | null | undefined; }; reasons: string[]; }, { score: number; entry: { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; layer?: "procedural" | "episodic" | "semantic" | "identity" | undefined; expiresAt?: number | undefined; importance?: number | undefined; validFrom?: number | undefined; validUntil?: number | undefined; supersedes?: string | null | undefined; supersededBy?: string | null | undefined; }; reasons: string[]; }>; type ProceduralMatch = z.infer; declare const driftEventSchema: z.ZodObject<{ driftResult: z.ZodObject<{ score: z.ZodNumber; level: z.ZodEnum<["aligned", "minor", "moderate", "critical"]>; violatingStatements: z.ZodArray; weight: z.ZodDefault; source: z.ZodOptional; createdAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }, { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }>, "many">; reasoning: z.ZodString; detectedAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { score: number; level: "aligned" | "minor" | "moderate" | "critical"; violatingStatements: { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }[]; reasoning: string; detectedAt: number; }, { score: number; level: "aligned" | "minor" | "moderate" | "critical"; violatingStatements: { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }[]; reasoning: string; detectedAt: number; }>; correctionInjected: z.ZodDefault; correctionText: z.ZodOptional; }, "strip", z.ZodTypeAny, { driftResult: { score: number; level: "aligned" | "minor" | "moderate" | "critical"; violatingStatements: { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }[]; reasoning: string; detectedAt: number; }; correctionInjected: boolean; correctionText?: string | undefined; }, { driftResult: { score: number; level: "aligned" | "minor" | "moderate" | "critical"; violatingStatements: { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }[]; reasoning: string; detectedAt: number; }; correctionInjected?: boolean | undefined; correctionText?: string | undefined; }>; type DriftEvent = z.infer; declare const identityPackageSchema: z.ZodObject<{ version: z.ZodDefault; agentId: z.ZodOptional; userId: z.ZodOptional; exportedAt: z.ZodNumber; constitution: z.ZodObject<{ statements: z.ZodArray; weight: z.ZodDefault; source: z.ZodOptional; createdAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }, { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }>, "many">; version: z.ZodDefault; createdAt: z.ZodNumber; updatedAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { version: string; createdAt: number; statements: { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }[]; updatedAt: number; }, { createdAt: number; statements: { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }[]; updatedAt: number; version?: string | undefined; }>; memories: z.ZodArray>; metadata: z.ZodDefault>; createdAt: z.ZodNumber; accessedAt: z.ZodNumber; accessCount: z.ZodDefault; } & { layer: z.ZodDefault>; expiresAt: z.ZodOptional; importance: z.ZodDefault; validFrom: z.ZodOptional; validUntil: z.ZodOptional; supersedes: z.ZodOptional>; supersededBy: z.ZodOptional>; }, "strip", z.ZodTypeAny, { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; layer: "procedural" | "episodic" | "semantic" | "identity"; importance: number; expiresAt?: number | undefined; validFrom?: number | undefined; validUntil?: number | undefined; supersedes?: string | null | undefined; supersededBy?: string | null | undefined; }, { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; layer?: "procedural" | "episodic" | "semantic" | "identity" | undefined; expiresAt?: number | undefined; importance?: number | undefined; validFrom?: number | undefined; validUntil?: number | undefined; supersedes?: string | null | undefined; supersededBy?: string | null | undefined; }>, "many">; soul: z.ZodOptional; }, "strip", z.ZodTypeAny, { content: string; source?: string | undefined; }, { content: string; source?: string | undefined; }>>; identity: z.ZodOptional; }, "strip", z.ZodTypeAny, { content: string; source?: string | undefined; }, { content: string; source?: string | undefined; }>>; metadata: z.ZodDefault>; }, "strip", z.ZodTypeAny, { metadata: Record; version: string; constitution: { version: string; createdAt: number; statements: { id: string; weight: number; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; }[]; updatedAt: number; }; exportedAt: number; memories: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; layer: "procedural" | "episodic" | "semantic" | "identity"; importance: number; expiresAt?: number | undefined; validFrom?: number | undefined; validUntil?: number | undefined; supersedes?: string | null | undefined; supersededBy?: string | null | undefined; }[]; agentId?: string | undefined; userId?: string | undefined; identity?: { content: string; source?: string | undefined; } | undefined; soul?: { content: string; source?: string | undefined; } | undefined; }, { constitution: { createdAt: number; statements: { id: string; createdAt: number; text: string; category: "values" | "boundaries" | "preferences" | "goals"; source?: string | undefined; weight?: number | undefined; }[]; updatedAt: number; version?: string | undefined; }; exportedAt: number; memories: { content: string; id: string; createdAt: number; accessedAt: number; topics?: string[] | undefined; metadata?: Record | undefined; accessCount?: number | undefined; layer?: "procedural" | "episodic" | "semantic" | "identity" | undefined; expiresAt?: number | undefined; importance?: number | undefined; validFrom?: number | undefined; validUntil?: number | undefined; supersedes?: string | null | undefined; supersededBy?: string | null | undefined; }[]; metadata?: Record | undefined; agentId?: string | undefined; userId?: string | undefined; version?: string | undefined; identity?: { content: string; source?: string | undefined; } | undefined; soul?: { content: string; source?: string | undefined; } | undefined; }>; type IdentityPackage = z.infer; declare const duplicationConfigSchema: z.ZodObject<{ /** DARKSOL server URL (e.g. https://api.darksol.net) */ serverUrl: z.ZodString; /** API key for the server */ apiKey: z.ZodString; /** Include SOUL.md content in export */ includeSoul: z.ZodDefault; /** Include IDENTITY.md content in export */ includeIdentity: z.ZodDefault; /** Include all memory layers in export */ includeAllLayers: z.ZodDefault; /** Only include specific layers */ layers: z.ZodOptional, "many">>; /** Custom agent/user ID for scoping */ agentId: z.ZodOptional; userId: z.ZodOptional; }, "strip", z.ZodTypeAny, { apiKey: string; serverUrl: string; includeSoul: boolean; includeIdentity: boolean; includeAllLayers: boolean; agentId?: string | undefined; userId?: string | undefined; layers?: ("procedural" | "episodic" | "semantic" | "identity")[] | undefined; }, { apiKey: string; serverUrl: string; agentId?: string | undefined; userId?: string | undefined; layers?: ("procedural" | "episodic" | "semantic" | "identity")[] | undefined; includeSoul?: boolean | undefined; includeIdentity?: boolean | undefined; includeAllLayers?: boolean | undefined; }>; type DuplicationConfig = z.infer; declare const infectionConfigSchema: z.ZodObject<{ /** DARKSOL server URL */ serverUrl: z.ZodString; /** API key for the server */ apiKey: z.ZodString; /** Source agent ID to infect FROM (optional — defaults to user\'s primary) */ sourceAgentId: z.ZodOptional; /** Identity package version to pull (optional — defaults to latest) */ version: z.ZodOptional; /** Auto-refresh interval in ms (0 = no auto-refresh) */ refreshIntervalMs: z.ZodDefault; /** Layers to apply from the package */ layers: z.ZodDefault, "many">>; }, "strip", z.ZodTypeAny, { apiKey: string; layers: ("procedural" | "semantic" | "identity")[]; serverUrl: string; refreshIntervalMs: number; version?: string | undefined; sourceAgentId?: string | undefined; }, { apiKey: string; serverUrl: string; version?: string | undefined; layers?: ("procedural" | "semantic" | "identity")[] | undefined; sourceAgentId?: string | undefined; refreshIntervalMs?: number | undefined; }>; type InfectionConfig = z.infer; type DuplicateResult = { packageSizeBytes: number; memoryCount: number; constitutionStatements: number; exportedAt: number; serverUploadUrl?: string; serverUploadResponse?: unknown; }; type InfectionResult = { packageVersion: string; statementsLoaded: number; memoriesLoaded: number; layersApplied: string[]; infectedAt: number; liveConnection: boolean; }; interface SnapshotMeta { id: string; label: string; createdAt: number; memoryCount: number; layerCounts: Record; checksum: string | null; agentId: string | null; userId: string | null; } interface SnapshotExport { id: string; label: string; createdAt: number; memoryCount: number; checksum: string; agentId: string | null; userId: string | null; snapshotData: unknown; } interface StoreMemoryOptions { agentId?: string; userId?: string; } interface StorageMaintenanceOptions { dryRun?: boolean; now?: number; pruneExpired?: boolean; pruneOrphanLinks?: boolean; pruneOrphanEmbeddings?: boolean; compact?: boolean; } interface StorageMaintenanceResult { checkedAt: number; dryRun: boolean; expiredLayerEntries: number; orphanLinks: number; orphanEmbeddings: number; compacted: boolean; scoped: StoreMemoryOptions; } interface MemoryStoreLike { matchMetadata?(entryMetadata: Record, filters: Record): boolean; init(): Promise; store(input: StoreMemoryInput, opts?: StoreMemoryOptions): Promise; get(id: string, opts?: StoreMemoryOptions): Promise; query(text: string, options?: QueryOptions, opts?: StoreMemoryOptions): Promise<{ results: QueryResult[]; totalAvailable: number; }>; getAllEntries(opts?: StoreMemoryOptions): Promise; getRecent(n?: number, opts?: StoreMemoryOptions): Promise; getByTopic(topic: string, limit?: number, opts?: StoreMemoryOptions): Promise; forget(id: string, opts?: StoreMemoryOptions): Promise; createLink(input: MemoryLinkInput, opts?: StoreMemoryOptions): Promise; getLinks(memoryId: string, options?: LinkedMemoryQueryOptions, opts?: StoreMemoryOptions): Promise; deleteLink(linkId: string): Promise; getEntryById(id: string, opts?: StoreMemoryOptions): Promise; persistLayerEntry(entry: LayeredMemoryEntry, opts?: StoreMemoryOptions): Promise; loadAllLayerEntries(opts?: StoreMemoryOptions): Promise; forgetLayerEntry(id: string): Promise; createSnapshot(label: string, opts?: StoreMemoryOptions): Promise; restoreSnapshot(snapshotId: string, opts?: StoreMemoryOptions): Promise; listSnapshots(opts?: StoreMemoryOptions): Promise; exportSnapshot(snapshotId: string): Promise; importSnapshot(snapshot: SnapshotExport, opts?: { overwrite?: boolean; }): Promise; deleteSnapshot(snapshotId: string): Promise; maintenance?(options?: StorageMaintenanceOptions, opts?: StoreMemoryOptions): Promise; storeEmbedding(memoryId: string, base64: string, dimension: number, model: string, type?: 'memory' | 'layered'): Promise; getEmbedding(memoryId: string): Promise<{ base64: string; dimension: number; } | null>; deleteEmbedding(memoryId: string): Promise; semanticQuery(queryText: string, queryVector: number[] | null, opts?: QueryOptions, scope?: StoreMemoryOptions): Promise<{ results: QueryResult[]; totalAvailable: number; }>; supportsNativeVectorSearch?(): boolean; getEventLog(limit?: number): MemoryEvent[]; persist(): void; close(): void | Promise; } interface ReMEMAdapterOptions { /** Default topic attached to memories stored through the adapter. */ defaultTopic?: string; /** Default query limit when the caller does not provide one. */ defaultLimit?: number; } interface CodebaseGraphQueryOptions extends QueryOptions { project?: string; nodeLabels?: string[]; owners?: string[]; } interface CodebaseSubgraphOptions extends Partial { project?: string; maxContextChars?: number; connectionTypes?: string[]; includeConnections?: string[]; minConnectionWeight?: number; resourceGrant?: KnowledgeResourceGrant; nodeLabels?: string[]; owners?: string[]; } interface CodebaseGraphInventoryOptions { project?: string; limit?: number; resourceGrant?: KnowledgeResourceGrant; nodeLabels?: string[]; owners?: string[]; } interface CodebaseGraphOwnerSummary { owner: string; type: 'directory' | 'package' | 'project'; nodes: number; files: number; symbols: number; packages: number; averageWeight: number; paths: string[]; } interface CodebaseGraphNodeHealth { node: QueryResult; incoming: number; outgoing: number; weight: number; links: MemoryLink[]; incomingWeight?: number; outgoingWeight?: number; relationTypes?: string[]; } interface CodebaseGraphSubgraph { query: string; project?: string; results: QueryResult[]; paths: NeighborPath[]; linksTraversed: number; context: string; } type CodebaseGraphDisplayType = 'memory' | 'graph' | 'context' | 'inventory'; interface CodebaseGraphAsMemoryOptions extends CodebaseSubgraphOptions { displayType?: CodebaseGraphDisplayType; snapshotName?: string; nodeLabels?: string[]; } interface CodebaseGraphConnection { fromId: string; toId: string; type: string; weight: number; from?: QueryResult; to?: QueryResult; } interface CodebaseGraphMemorySnapshot { name: 'Codebase Graph as memory'; displayType: CodebaseGraphDisplayType; query: string; project?: string; summary: string; nodes: QueryResult[]; connections: CodebaseGraphConnection[]; paths: NeighborPath[]; linksTraversed: number; context: string; inventory?: { owners: CodebaseGraphOwnerSummary[]; entrypoints: CodebaseGraphNodeHealth[]; hotspots: CodebaseGraphNodeHealth[]; deadzones: CodebaseGraphNodeHealth[]; }; } /** * Vercel AI SDK-style helper. * * The AI SDK does not mandate one memory interface, so this adapter exposes * tiny primitives that fit neatly into middleware/tools: save messages, * remember arbitrary text, and recall relevant context. */ declare function createVercelAIAdapter(memory: ReMEM, options?: ReMEMAdapterOptions): { name: string; remember(input: string | StoreMemoryInput): Promise; saveMessages(messages: unknown, metadata?: Record): Promise; recall(query: string, queryOptions?: QueryOptions): Promise; context(query: string, queryOptions?: QueryOptions): Promise; }; /** * LangGraph/LangChain-style BaseStore-ish adapter. * * Implements get/put/search/listNamespaces in a dependency-free structural shape * so it can be wrapped by LangGraph JS projects without pulling LangChain into * ReMEM itself. */ declare function createLangGraphStoreAdapter(memory: ReMEM, options?: ReMEMAdapterOptions): { name: string; put(namespace: string | string[], key: string, value: unknown, putOptions?: { visibility?: "private" | "shared"; }): Promise; search(namespace: string | string[], query: string, queryOptions?: QueryOptions, scopeOptions?: NamespaceQueryScope): Promise<{ namespace: string[]; key: string; value: string; createdAt: number; updatedAt: number; score: number | undefined; }[]>; get(namespace: string | string[], key: string, scopeOptions?: NamespaceQueryScope): Promise<{ namespace: string[]; key: string; value: string; createdAt: number; updatedAt: number; } | null>; listNamespaces(scopeOptions?: NamespaceQueryScope): Promise; }; /** * OpenClaw/session adapter. * Stores user/assistant turns and recalls concise context blocks for prompts. */ declare function createOpenClawAdapter(memory: ReMEM, options?: ReMEMAdapterOptions): { name: string; rememberTurn(turn: { role: "user" | "assistant" | "system" | string; content: string; sessionId?: string; messageId?: string; metadata?: Record; }): Promise; rememberDecision(decision: { content: string; sessionId?: string; topics?: string[]; metadata?: Record; }): Promise; rememberProcedure(rule: { content: string; trigger: string | Record; topics?: string[]; metadata?: Record; }): Promise; recallContext(query: string, queryOptions?: QueryOptions): Promise; recallProjectContext(query: string, optionsWithNeighbors?: QueryOptions & { hops?: 1 | 2; }): Promise; query(query: string, queryOptions?: QueryOptions): Promise; }; /** * Hermes harness adapter. * Mirrors the polished harness-facing shape from OpenClaw, but keeps the * surface generic to common harness concepts: turns, artifacts, decisions, * procedures, and scoped recall. */ declare function createHermesAdapter(memory: ReMEM, options?: ReMEMAdapterOptions): { name: string; rememberTurn(turn: { role: "user" | "assistant" | "system" | string; content: string; threadId?: string; runId?: string; messageId?: string; metadata?: Record; }): Promise; rememberArtifact(artifact: { kind: string; content: string; threadId?: string; runId?: string; topics?: string[]; metadata?: Record; }): Promise; rememberDecision(decision: { content: string; threadId?: string; runId?: string; topics?: string[]; metadata?: Record; }): Promise; rememberProcedure(rule: { content: string; trigger: string | Record; topics?: string[]; metadata?: Record; }): Promise; rememberShared(input: { namespace: string | string[]; content: string; visibility?: "private" | "shared"; topics?: string[]; metadata?: Record; }): Promise; recallContext(query: string, queryOptions?: QueryOptions): Promise; recallShared(namespace: string | string[], query: string, queryOptions?: QueryOptions, scopeOptions?: NamespaceQueryScope): Promise; query(query: string, queryOptions?: QueryOptions): Promise; }; /** * Codebase knowledge adapter. * * This does not try to reimplement a parser or tree-sitter pipeline. It gives * code graph tools a stable way to feed ReMEM with architecture nodes, routes, * call/import edges, ADRs, and compressed graph artifact pointers. */ declare function createCodebaseMemoryAdapter(memory: ReMEM, options?: ReMEMAdapterOptions): { name: string; key: string; registerArtifact(input: KnowledgeArtifactRegistration): Promise; ingestGraph(graph: KnowledgeGraphArtifact, ingestOptions?: Parameters[1]): Promise<{ source: string; namespace: string; nodesStored: number; edgesLinked: number; skippedEdges: number; nodeMemoryIds: Record; project?: string | undefined; }>; searchGraph(query: string, queryOptions?: CodebaseGraphQueryOptions): Promise<{ results: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; relevanceScore?: number | undefined; }[]; totalAvailable: number; query: string; tookMs: number; }>; architecture(project?: string, limit?: number): Promise<{ query: string; results: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; relevanceScore?: number | undefined; }[]; totalAvailable: number; tookMs: number; }>; impact(subject: string, optionsOrLimit?: number | (Partial & { project?: string; })): Promise<{ query: string; results: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; relevanceScore?: number | undefined; }[]; totalAvailable: number; tookMs: number; } & { linksTraversed: number; paths?: NeighborPath[]; }>; subgraph(query: string, queryOptions?: CodebaseSubgraphOptions): Promise<{ query: string; project: string | undefined; results: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; relevanceScore?: number | undefined; }[]; paths: { type: string; score: number; fromId: string; toId: string; throughId: string; hop: number; }[]; linksTraversed: number; context: string; }>; asMemory(query: string, queryOptions?: CodebaseGraphAsMemoryOptions): Promise; graphAsMemory(query: string, queryOptions?: CodebaseGraphAsMemoryOptions): Promise; explain(query: string, queryOptions?: CodebaseSubgraphOptions): Promise<{ summary: string; query: string; project: string | undefined; results: { topics: string[]; metadata: Record; content: string; id: string; createdAt: number; accessedAt: number; accessCount: number; relevanceScore?: number | undefined; }[]; paths: { type: string; score: number; fromId: string; toId: string; throughId: string; hop: number; }[]; linksTraversed: number; context: string; }>; entrypoints(projectOrOptions?: string | CodebaseGraphInventoryOptions): Promise; owners(projectOrOptions?: string | CodebaseGraphInventoryOptions): Promise; hotspots(projectOrOptions?: string | CodebaseGraphInventoryOptions): Promise; deadzones(projectOrOptions?: string | CodebaseGraphInventoryOptions): Promise; overview(projectOrOptions?: string | CodebaseGraphInventoryOptions): Promise<{ project: string | undefined; nodes: number; labels: Record; owners: CodebaseGraphOwnerSummary[]; entrypoints: CodebaseGraphNodeHealth[]; hotspots: CodebaseGraphNodeHealth[]; deadzones: CodebaseGraphNodeHealth[]; }>; context(query: string, queryOptions?: CodebaseGraphQueryOptions): Promise; }; /** * ReMEM — Model Abstraction * Unified LLM interface supporting Bankr, OpenAI, Anthropic, Ollama */ declare class ModelAbstraction { private client; config: ModelConfig; constructor(config: ModelConfig); private createClient; chat(messages: LLMMessage[], options?: { temperature?: number; maxTokens?: number; }): Promise; name(): string; } /** * ReMEM — Embedding Service * Generates and stores vector embeddings for semantic memory search. * * Uses Ollama's /api/embeddings endpoint (or any compatible OpenAI-style embeddings API). * Stores embeddings in SQLite as base64-encoded float32 arrays. * * v0.3.2: Added for semantic search — cosine similarity replaces keyword-only matching. */ interface EmbeddingConfig { /** Ollama base URL (e.g. http://192.168.68.73:11434) */ baseUrl: string; /** Model to use for embeddings (e.g. 'nomic-embed-text', 'mxbai-embed-large') */ model: string; /** Dimension of the embedding vectors (auto-detected on first run, or set explicitly) */ dimension?: number; } interface EmbeddingVector { id: string; memoryId: string; vector: number[]; base64: string; model: string; createdAt: number; } declare class EmbeddingService { private config; private detectedDimension; private httpFetch; constructor(config: EmbeddingConfig, httpFetch?: typeof fetch); get baseUrl(): string; get model(): string; get isConfigured(): boolean; /** * Generate embedding for a single text. * Uses Ollama's /api/embeddings endpoint. */ embed(text: string): Promise; /** * Generate embeddings for multiple texts in batch. * Calls embed() sequentially — Ollama doesn't have a batch endpoint. */ embedBatch(texts: string[], signal?: AbortSignal): Promise; /** * Encode a float32 vector to base64url. * Uses Buffer.from with a Uint8Array view of the Float32Array buffer. */ static encodeVector(vec: number[]): string; /** * Decode a base64url string back to a float32 vector. */ static decodeVector(base64: string, dimension: number): number[]; /** * Compute cosine similarity between two vectors. * Returns a value between -1 (opposite) and 1 (identical). */ static cosineSimilarity(a: number[], b: number[]): number; /** * Generate and package an embedding vector for storage. */ generateEmbedding(memoryId: string, text: string): Promise; } /** * ReMEM — Hierarchical Memory Layers * Episodic / Semantic / Identity / Procedural * with TTL-based eviction, weighted retrieval, temporal validity, self-edit, * episodic compression, and semantic embedding-based scoring. */ declare const DEFAULT_LAYER_CONFIG: Required; interface SupersessionResult { superseded: boolean; supersededEntryId?: string; newEntry?: LayeredMemoryEntry; reason?: string; } declare class LayerManager { private entries; private config; private embeddingService; private entryEmbeddings; constructor(config?: Partial, embeddingService?: EmbeddingService | null); /** * Store an entry in the appropriate layer. * If layer is not specified, auto-assigns based on topics and content. * For semantic layer with selfEdit=true, detects contradictions and auto-supersedes. */ store(input: StoreMemoryInput, layer?: MemoryLayer): LayeredMemoryEntry; /** * Check if new input should supersede an existing semantic entry. * Detects contradictions by keyword negation patterns. */ private checkSupersession; /** * Store a procedural memory — a triggered behavior/rule. * trigger: keyword/pattern that fires this rule * condition: when this text appears in context * action: what to do when triggered */ storeProcedural(input: StoreMemoryInput, trigger: string | Partial): LayeredMemoryEntry; /** * Fire procedural rules matching the given context text. * Returns rules whose trigger keyword appears in the context. */ fireProcedural(context: string): LayeredMemoryEntry[]; matchProcedural(context: string): ProceduralMatch[]; /** * Get an entry by ID. */ get(id: string): LayeredMemoryEntry | null; /** * Get all entries across all layers. * Used for duplication/export — returns all non-expired entries. */ getAllEntries(): LayeredMemoryEntry[]; /** * Query across all layers with weighted retrieval. * Entries from higher-weight layers rank higher, but content match still matters. * When EmbeddingService is set, uses hybrid scoring: 40% keyword + 60% cosine similarity. */ query(text: string, options?: QueryOptions & { layers?: MemoryLayer[]; }): Promise<{ results: QueryResult[]; totalAvailable: number; layerBreakdown: Record; }>; /** * Get recent entries across all layers. */ getRecent(n?: number, layers?: MemoryLayer[]): QueryResult[]; /** * Get entries by topic across all layers. */ getByTopic(topic: string, limit?: number): QueryResult[]; /** * Store a pre-computed embedding vector for an entry. * Enables semantic similarity scoring in queries. */ setEntryEmbedding(id: string, vector: number[]): void; /** * Forget an entry. */ forget(id: string): boolean; /** * Restore a LayeredMemoryEntry directly into the store. * Used by ReMEM.init() to restore persisted layer entries from SQLite. * Does NOT re-assign layer — uses the entry's existing layer field. */ restoreEntry(entry: LayeredMemoryEntry): void; /** * Evict entries from a specific layer if over maxEntries. * Evicts oldest accessed entries first. */ private evictIfNeeded; /** * Run TTL-based eviction. Call periodically (e.g., on init or query). */ evictExpired(): number; /** * Get entries eligible for compression — oldest episodic entries. * These will be LLM-compressed into a semantic summary before eviction. * @param count Number of entries to return for compression */ getEntriesForCompression(count?: number): LayeredMemoryEntry[]; /** * Compress episodic entries into a semantic summary. * Creates a new semantic layer entry that summarizes the episodic content. * Returns the new semantic entry ID, or null if compression not applicable. */ compressToSemantic(episodicEntries: LayeredMemoryEntry[], model: { chat(messages: Array<{ role: string; content: string; }>, opts?: { temperature?: number; maxTokens?: number; }): Promise<{ content: string; }>; }): Promise<{ compressedEntry: LayeredMemoryEntry; entriesEvicted: number; } | null>; /** * Auto-assign layer based on content analysis. */ private autoAssignLayer; private normalizeTrigger; private safeRegexTest; /** * Check if episodic layer is above 80% capacity and needs compression. */ needsEpisodicCompression(): boolean; /** * Get stats for each layer. */ getStats(): Record; private simpleRelevance; } /** * ReMEM — Memory Consolidation * Deduplication, merging, and conflict resolution across memory layers. * * v0.6.0: Memory consolidation * - Similarity-based deduplication: merge near-duplicate entries on store * - Cross-layer conflict resolution: contradiction detection + supersession * - Cross-layer promotion: frequently-accessed episodic entries promoted to semantic * - Periodic consolidation: full deduplication pass over all layers * * Usage: * const consolidator = new MemoryConsolidator(remem, embeddingService); * await consolidator.deduplicateLayer('semantic'); * await consolidator.promoteFrequentEpisodic(); */ interface ConsolidationOptions { /** Cosine similarity threshold for deduplication (0-1). Default: 0.85 */ similarityThreshold?: number; /** Minimum access count to trigger episodic promotion. Default: 5 */ promotionAccessThreshold?: number; /** Run consolidation on every store() call. Default: false (manual only) */ autoOnStore?: boolean; /** Merge strategy for near-duplicates */ mergeStrategy?: 'newer_wins' | 'older_wins' | 'concatenate' | 'supersede'; } interface ConsolidationResult { deduplicated: number; promoted: number; superseded: number; errors: string[]; } interface ConsolidationSummaryRecord { entryId?: string; topic: string; sourceIds: string[]; sourceLayers: MemoryLayer[]; content: string; } interface ConsolidationProcedureRecord { entryId?: string; sourceSummaryEntryId?: string; content: string; trigger: Partial; } interface ConsolidationWorkflowOptions extends ConsolidationOptions { layers?: MemoryLayer[]; summary?: { enabled?: boolean; sourceLayers?: MemoryLayer[]; minClusterSize?: number; maxClusters?: number; topicAllowlist?: string[]; metadata?: Record; }; proceduralPromotion?: { enabled?: boolean; maxProcedures?: number; }; } interface ConsolidationWorkflowResult extends ConsolidationResult { summariesCreated: number; proceduresCreated: number; summaries: ConsolidationSummaryRecord[]; procedures: ConsolidationProcedureRecord[]; affectedIds: string[]; } interface SimilarityPair { entryA: LayeredMemoryEntry; entryB: LayeredMemoryEntry; similarity: number; } /** * MemoryConsolidator * * Handles: * 1. Deduplication — find and merge near-duplicate entries using embeddings * 2. Conflict resolution — detect contradictions, mark one as superseded * 3. Cross-layer promotion — promote frequently-accessed episodic entries to semantic * 4. Periodic full consolidation — run over all layers to clean up */ declare class MemoryConsolidator { private remem; private embeddingService; private options; constructor(remem: MemoryConsolidator['remem'], embeddingService?: EmbeddingService | null, options?: ConsolidationOptions); private storeLayerEntry; /** * Find all near-duplicate pairs in a layer. * Uses embedding cosine similarity when available, keyword fallback otherwise. */ findSimilarPairs(layer: MemoryLayer): Promise; /** * Compute similarity between two entries. * Uses embeddings when available, keyword Jaccard fallback. */ computeSimilarity(a: LayeredMemoryEntry, b: LayeredMemoryEntry): Promise; private getEntryEmbedding; private cosineSimilarity; private keywordSimilarity; /** * Merge two entries according to the configured merge strategy. * Returns the merged entry content + metadata. */ merge(a: LayeredMemoryEntry, b: LayeredMemoryEntry): { content: string; topics: string[]; metadata: Record; }; /** * Run deduplication over a specific layer. * Finds similar pairs, merges them, and deletes the merged entries. * @returns Number of entries deduplicated */ deduplicateLayer(layer: MemoryLayer): Promise; /** * Detect contradictions between entries in the same layer. * Uses negation pattern matching to find conflicting statements. * * e.g., "User prefers dark mode" vs "User prefers light mode" */ detectConflicts(layer: MemoryLayer): Promise>; /** * Resolve conflicts by marking older entries as superseded. * Keeps the newest (most recent) entry as authoritative. */ resolveConflicts(layer: MemoryLayer): Promise; /** * Promote frequently-accessed episodic entries to semantic layer. * Entries with accessCount >= promotionAccessThreshold that are still in episodic * after 10 minutes get promoted to semantic layer (they're important enough to keep longer). */ promoteFrequentEpisodic(): Promise; /** * Run full consolidation over all layers. * 1. Deduplicate each layer * 2. Resolve conflicts in semantic and identity layers * 3. Promote frequent episodic entries * * @param layers Layers to consolidate. Defaults to all. */ consolidateAll(layers?: MemoryLayer[]): Promise; runWorkflow(options?: ConsolidationWorkflowOptions): Promise; generateTopicSummaries(options?: ConsolidationWorkflowOptions['summary']): Promise; private buildSummaryClusters; private summarizeCluster; private storeSummary; private promoteSummariesToProcedures; private deriveProcedureFromSummary; private extractJsonObject; private tryParseJson; } /** * ReMEM — MemoryStore * SQLite-backed persistent memory store with event sourcing * Uses sql.js (WebAssembly) for cross-platform SQLite without native compilation * * v0.3.1 adds: * - layered_memories table (persists LayerManager entries to SQLite) * - snapshots table (snapshot/restore for long-running agents) * - agent_id/user_id scoping (multi-agent support) * - WAL mode for better concurrent write handling * - Atomic persist with rename * * v0.3.2 adds: * - embeddings table (vector storage for semantic search) * - semanticQuery() for cosine similarity search */ declare class MemoryStore implements MemoryStoreLike { private db; private eventLog; private dbPath; private initialized; constructor(dbPath?: string); init(): Promise; private initTables; private ensureInitialized; store(input: StoreMemoryInput, opts?: StoreMemoryOptions): Promise; get(id: string, opts?: StoreMemoryOptions): Promise; query(text: string, options?: QueryOptions, scope?: StoreMemoryOptions): Promise<{ results: QueryResult[]; totalAvailable: number; }>; /** * Get all memory entries (no text filter, ignores limit). * Used internally by the duplication/export feature. */ getAllEntries(opts?: StoreMemoryOptions): Promise; getRecent(n?: number, opts?: StoreMemoryOptions): Promise; getByTopic(topic: string, limit?: number, opts?: StoreMemoryOptions): Promise; forget(id: string, opts?: StoreMemoryOptions): Promise; createLink(input: MemoryLinkInput, opts?: StoreMemoryOptions): Promise; getLinks(memoryId: string, options?: LinkedMemoryQueryOptions, opts?: StoreMemoryOptions): Promise; deleteLink(linkId: string): Promise; getEntryById(id: string, opts?: StoreMemoryOptions): Promise; /** * Persist a LayerManager entry to SQLite. * This is what makes layers survive process restarts. */ persistLayerEntry(entry: LayeredMemoryEntry, opts?: StoreMemoryOptions): Promise; /** * Load all persisted layer entries from SQLite. * Called on ReMEM.init() to restore layer state. */ loadAllLayerEntries(opts?: StoreMemoryOptions): Promise; /** * Delete a layered memory entry. */ forgetLayerEntry(id: string): Promise; /** * Load full core memory entries for snapshot/restore. * Unlike query/getAllEntries, this preserves metadata and timestamps exactly. */ private loadAllMemoryEntries; /** * Persist a full core memory entry, preserving id/timestamps/access count. * Used by snapshot restore and migration workflows. */ private restoreMemoryEntry; /** * Create a named snapshot of current memory state. * For long-running agents — take a snapshot before restarts or major operations. * @param label Human-readable label for this snapshot * @param opts Agent/user scope */ createSnapshot(label: string, opts?: StoreMemoryOptions): Promise; /** * Restore from a snapshot by ID. * Overwrites current layer state with snapshot state. * @returns Number of entries restored */ restoreSnapshot(snapshotId: string, opts?: StoreMemoryOptions): Promise; /** * List available snapshots. */ listSnapshots(opts?: StoreMemoryOptions): Promise; /** * Export a snapshot as portable JSON with checksum metadata. */ exportSnapshot(snapshotId: string): Promise; /** * Import a portable snapshot JSON export into the snapshots table. */ importSnapshot(snapshot: SnapshotExport, opts?: { overwrite?: boolean; }): Promise; /** * Delete a snapshot. */ deleteSnapshot(snapshotId: string): Promise; /** * Run low-level storage maintenance. * Prunes expired layered memories, removes dangling links/embeddings, and * optionally compacts the SQLite database. Supports dry-run for planning. */ maintenance(options?: StorageMaintenanceOptions, opts?: StoreMemoryOptions): Promise; /** * Store a vector embedding for a memory entry. * Called after MemoryStore.store() when embeddings are enabled. */ storeEmbedding(memoryId: string, base64: string, dimension: number, model: string, type?: 'memory' | 'layered'): Promise; /** * Get embedding for a memory entry. */ getEmbedding(memoryId: string): Promise<{ base64: string; dimension: number; } | null>; /** * Delete embedding for a memory entry. */ deleteEmbedding(memoryId: string): Promise; /** * Hybrid semantic search: cosine similarity over embeddings + keyword fallback. * * Strategy: * 1. If Ollama is available and we have stored embeddings: compute cosine similarity * 2. Fall back to keyword + access_count scoring when no embeddings exist * * @param queryText The search query * @param queryVector Pre-computed embedding of the query (if available) * @param opts Query options (limit, topics, etc.) * @returns Top results scored by semantic similarity */ semanticQuery(queryText: string, queryVector: number[] | null, opts?: QueryOptions, scope?: StoreMemoryOptions): Promise<{ results: QueryResult[]; totalAvailable: number; }>; getEventLog(limit?: number): MemoryEvent[]; persist(): void; close(): void; private logEvent; private ensureColumn; private countRows; private scopeClause; private snapshotChecksum; private loadAllLinks; private restoreLink; private rowToLink; private rowToObject; matchMetadata(entryMetadata: Record, filters: Record): boolean; private matchMetadataValue; private matchTopics; private simpleRelevance; private exactTokenRelevance; } interface PostgresStoreConfig { connectionString?: string; pool?: Pool; schema?: string; tablePrefix?: string; ssl?: boolean | Record; pgvector?: { enabled?: boolean; embeddingType?: 'memory' | 'layered' | 'both'; ivfflatLists?: number; }; } declare class PostgresMemoryStore implements MemoryStoreLike { private pool; private ownsPool; private initialized; private eventLog; private readonly schema; private readonly tablePrefix; private readonly config; private pgvectorAvailable; constructor(config?: string | PostgresStoreConfig); init(): Promise; supportsNativeVectorSearch(): boolean; private safeIdentifier; private table; private ensureInitialized; private pgQuery; private initTables; store(input: StoreMemoryInput, opts?: StoreMemoryOptions): Promise; get(id: string, opts?: StoreMemoryOptions): Promise; query(text: string, options?: QueryOptions, scope?: StoreMemoryOptions): Promise<{ results: QueryResult[]; totalAvailable: number; }>; getAllEntries(opts?: StoreMemoryOptions): Promise; getRecent(n?: number, opts?: StoreMemoryOptions): Promise; getByTopic(topic: string, limit?: number, opts?: StoreMemoryOptions): Promise; forget(id: string, opts?: StoreMemoryOptions): Promise; createLink(input: MemoryLinkInput, opts?: StoreMemoryOptions): Promise; getLinks(memoryId: string, options?: LinkedMemoryQueryOptions, opts?: StoreMemoryOptions): Promise; deleteLink(linkId: string): Promise; getEntryById(id: string, opts?: StoreMemoryOptions): Promise; persistLayerEntry(entry: LayeredMemoryEntry, opts?: StoreMemoryOptions): Promise; loadAllLayerEntries(opts?: StoreMemoryOptions): Promise; forgetLayerEntry(id: string): Promise; private loadAllMemoryEntries; private restoreMemoryEntry; createSnapshot(label: string, opts?: StoreMemoryOptions): Promise; restoreSnapshot(snapshotId: string, opts?: StoreMemoryOptions): Promise; listSnapshots(opts?: StoreMemoryOptions): Promise; exportSnapshot(snapshotId: string): Promise; importSnapshot(snapshot: SnapshotExport, opts?: { overwrite?: boolean; }): Promise; deleteSnapshot(snapshotId: string): Promise; maintenance(options?: StorageMaintenanceOptions, opts?: StoreMemoryOptions): Promise; storeEmbedding(memoryId: string, base64: string, dimension: number, model: string, type?: 'memory' | 'layered'): Promise; getEmbedding(memoryId: string): Promise<{ base64: string; dimension: number; } | null>; deleteEmbedding(memoryId: string): Promise; semanticQuery(queryText: string, queryVector: number[] | null, opts?: QueryOptions, scope?: StoreMemoryOptions): Promise<{ results: QueryResult[]; totalAvailable: number; }>; private maybeEnablePgvector; private ensureVectorColumn; private backfillVectorRows; private ensureVectorIndexes; private semanticQueryPgvector; private toPgvectorLiteral; getEventLog(limit?: number): MemoryEvent[]; persist(): void; close(): Promise; private persistLayerEntryWithClient; private clearScoped; private scopeWhere; private exactScopeConditions; private countPgRows; private rowToMemory; private rowToLayerEntry; private toQueryResult; matchMetadata(entryMetadata: Record, filters: Record): boolean; private matchMetadataValue; private loadAllLinks; private rowToLink; private restoreLinkWithClient; private parseJson; private snapshotChecksum; private simpleRelevance; private logEvent; } /** * ReMEM — Query Engine * RLM-style REPL for navigating memory programmatically */ interface QueryEngineConfig { store: MemoryStoreLike; model?: ModelAbstraction; systemPrompt?: string; } declare class QueryEngine { private _store; private model?; private systemPrompt; constructor(config: QueryEngineConfig); /** * Query memory using natural language. * If a model is configured, uses LLM-assisted query decomposition. * Otherwise falls back to direct keyword search. */ query(query: string, options?: QueryOptions): Promise; /** * Direct keyword-based query (no LLM). */ private queryDirect; /** * LLM-assisted query decomposition. * The model analyzes the query and generates optimized search terms. */ private queryWithLLM; /** * Ask the LLM to rerank results by relevance to the query. */ private rerankResults; /** * Store a new memory entry. */ store(input: StoreMemoryInput): Promise; /** * Get recent memory entries. */ getRecent(n?: number): Promise; /** * Get entries by topic. */ getByTopic(topic: string, limit?: number): Promise; /** * Recursive query — the RLM-style loop. * Keep refining until the answer is complete. */ recursiveQuery(initialQuery: string, maxDepth?: number): Promise<{ answer: string; memories: QueryResult[]; }>; } /** * ReMEM — RLM-Style Memory REPL * Recursive Language Model loop for navigating memory programmatically. * * RLM Core Insight (from "Recursive Language Models"): * Treat the memory store as an external environment. Instead of retrieving * and truncating (losing detail), let the model write code to navigate it. * * The model never sees all memory at once — only constant-size metadata * about the store structure and what it's already observed. This enables * arbitrarily large memory stores without context window overflow. * * Design: * - Root model call: receives query + environment metadata (constant size) * - Model generates JavaScript to navigate: query layers, get chunks, recurse * - Executor runs the JS safely (Function constructor, not eval) * - Next iteration: model sees only what it observed, decides next action * - Loop until model returns __done or maxDepth reached */ type MemoryAction = { action: 'observe'; data: unknown; } | { action: 'done'; answer: string; }; interface REPLObservation { iteration: number; code: string; result: unknown; action: MemoryAction; } interface MemoryREPLOptions { /** Memory store for actual operations */ store: MemoryStoreLike; /** Layer manager (optional — enables layer-aware navigation) */ layers?: LayerManager; /** LLM for the REPL loop */ model?: ModelAbstraction; /** Max recursion depth (default: 5) */ maxDepth?: number; /** Max entries to return in final answer (default: 20) */ maxResults?: number; /** Custom system prompt for the REPL model */ systemPrompt?: string; } declare class MemoryREPL { private store; private layers?; private model?; private maxDepth; private maxResults; private systemPrompt; constructor(options: MemoryREPLOptions); /** * Navigate memory using the RLM loop. * Model writes JS to explore, executor runs it, results feed back into next iteration. */ navigate(query: string): Promise<{ answer: string; observations: REPLObservation[]; }>; /** * Build constant-size metadata about the store environment. * This is what the RLM paper calls the "screen" — fixed size regardless of memory size. */ private buildEnvironmentMetadata; /** * Extract executable JavaScript code from the model's response. * Looks for the first { ... } object containing mem.* calls. */ private extractCode; /** * Execute model-generated code safely. * Uses a restricted VM context with no Node globals exposed. * Only exposes the safe memory API and applies execution timeouts. */ private executeCode; private withTimeout; /** * Build the safe memory API exposed to model-generated code. * Only exposes query/retrieve operations — no mutation, no system access. */ private buildMemoryAPI; /** * Format observation result for display to the model in next iteration. */ private formatObservation; } interface AdvancedMemoryRuntime { remember(input: RememberInput): Promise; queryWithNeighbors(query: string, options?: QueryWithNeighborsOptions): Promise; smartRecall(query: string, options?: SmartRecallOptions): Promise; contextPack(query: string, options?: ContextPackOptions): Promise; getRecallProfiles(): Array; getRecallProfile(profile: SmartRecallProfile): SmartRecallProfileDescriptor; health(options?: MemoryHealthOptions): Promise; storageMaintenance(options?: StorageMaintenanceOptions): Promise; registerKnowledgeArtifact(input: KnowledgeArtifactRegistration): Promise; ingestKnowledgeGraph(graph: KnowledgeGraphArtifact, options?: KnowledgeIngestOptions): Promise; knowledgeOverview(options?: { project?: string; limit?: number; resourceGrant?: KnowledgeResourceGrant; }): Promise; knowledgeSubgraph(query: string, options?: CodebaseSubgraphOptions): Promise; storeShared(input: StoreMemoryInput & { namespace: NamespaceInput; visibility?: 'private' | 'shared'; }): Promise; queryNamespace(namespace: NamespaceInput, query: string, options?: QueryOptions, scope?: NamespaceQueryScope): Promise; getRecentInNamespace(namespace: NamespaceInput, n?: number, scope?: NamespaceQueryScope): Promise; matchProcedural(context: string): ProceduralMatch[]; auditIdentityAlignment(sessionText: string): Promise<{ drift: DriftResult; injection: string; topStatements: Array<{ id: string; text: string; category: string; weight: number; source?: string; createdAt: number; }>; }>; usesNativeVectorSearch(): boolean; } interface HttpAdapterConfig { port?: number; host?: string; store: MemoryStoreLike; model?: ModelAbstraction; /** Optional full ReMEM runtime for advanced graph/procedural/identity routes. */ memory?: AdvancedMemoryRuntime; /** Optional bearer token required for all non-OPTIONS requests. */ authToken?: string; /** CORS origin. Defaults to localhost-only usage (no wildcard). */ corsOrigin?: string; /** Max request body size in bytes. Default: 1MiB. */ maxBodyBytes?: number; } declare class HttpAdapter { private server?; private engine; private store; private model?; private memory?; private port; private host; private authToken?; private corsOrigin; private maxBodyBytes; constructor(config: HttpAdapterConfig); start(): Promise; stop(): Promise; private handleRequest; private isAuthorized; private readBody; } /** * ReMEM — Episodic Capture Pipeline * Automatic event capture for the episodic memory layer. * * v0.5.0: Episodic capture pipeline * - Event buffering + batched writes to MemoryStore * - Importance scoring based on event type + content analysis * - Deduplication of rapid similar events * - Integration via EventSource adapters or direct capture() * * Usage: * const pipeline = new EpisodicCapturePipeline(remem); * pipeline.capture({ type: 'user.message', content: '...', metadata: {...} }); * pipeline.capture({ type: 'decision', content: 'Agreed to build X', metadata: { importance: 0.9 }}); * pipeline.start(); // start flush interval */ type CaptureEventType = 'agent.turn' | 'agent.response' | 'agent.tool_call' | 'agent.tool_result' | 'agent.error' | 'user.message' | 'user.feedback' | 'user.question' | 'memory.store' | 'memory.query' | 'memory.recall' | 'session.start' | 'session.end' | 'session.compaction' | 'decision' | 'learning' | 'goal.set' | 'goal.achieved' | 'identity.drift' | 'identity.correction'; interface CaptureEvent { id?: string; type: CaptureEventType; /** Human-readable content describing the event */ content: string; /** Raw metadata about the event (sender, channel, model, tool name, etc.) */ metadata?: Record; /** Unix timestamp ms — defaults to Date.now() */ timestamp?: number; /** Override auto-computed importance (0-1). Auto-computed if not set. */ importanceOverride?: number; /** Skip deduplication for this event (e.g., decisions should never be deduped) */ noDedup?: boolean; } interface CaptureOptions { /** Batch flush interval in ms (default: 1000) */ flushIntervalMs?: number; /** Max events per batch before forced flush (default: 50) */ maxBatchSize?: number; /** Deduplication window in ms — suppress events identical in type+content (default: 2000) */ dedupWindowMs?: number; /** Store to a specific layer (default: 'episodic') */ layer?: MemoryLayer; } declare class EpisodicCapturePipeline { private remem; private eventBuffer; private dedupSet; private flushIntervalMs; private maxBatchSize; private dedupWindowMs; private layer; private intervalHandle; private started; private eventCount; private droppedCount; constructor(remem: EpisodicCapturePipeline['remem'], options?: CaptureOptions); /** * Capture a single event into the episodic layer. * Events are buffered and flushed in batches. */ capture(event: CaptureEvent): void; /** * Capture multiple events at once. */ captureBatch(events: CaptureEvent[]): void; /** * Start the periodic flush interval. * Call once after registering event sources. */ start(): void; /** * Stop the flush interval and flush remaining events. */ stop(): void; /** * Flush the event buffer to MemoryStore. */ flush(): Promise; /** * Extract topics from event type and content. */ private extractTopics; /** * Format an event into a human-readable episodic memory string. */ private formatEvent; /** * Generate embedding for a stored entry (async, non-blocking). * Returns early if no embedding service available. */ private generateEmbedding; /** * Get capture statistics. */ getStats(): { eventCount: number; droppedCount: number; bufferSize: number; started: boolean; }; } declare function normalizeSmartRecallProfileInput(profile: string | null | undefined): string; declare function resolveSmartRecallProfile(profile: string | null | undefined): SmartRecallProfile | null; /** * ReMEM — Identity & Constitution * RLM-style identity layer with drift detection and constitution injection */ declare class ConstitutionManager { private constitution; private config; constructor(config?: Partial); /** * Import statements from source text (e.g., SOUL.md, IDENTITY.md). * Parses the text and extracts identity statements by category. */ importFromText(text: string, source: string): number; /** * Add a single statement manually. */ addStatement(text: string, category: ConstitutionStatement['category'], weight?: number, source?: string): ConstitutionStatement; /** * Get all statements, optionally filtered by category. */ getStatements(category?: ConstitutionStatement['category']): ConstitutionStatement[]; /** * Get the full constitution. */ getConstitution(): Constitution; /** * Serialize constitution for injection into LLM context. */ toInjectionBlock(): string; } declare class DriftDetector { private constitution; private evalModel?; private threshold; private criticalThreshold; constructor(constitution: ConstitutionManager, config?: Partial); /** * Detect drift using BOTH pattern matching and LLM self-evaluation. * Returns a DriftResult with score, level, and violating statements. */ detectDrift(sessionText: string, options?: { method?: 'pattern' | 'llm' | 'both'; confidenceThreshold?: number; }): Promise; /** * Fast pattern-matching drift detection. * Checks for negation patterns, value contradictions, and boundary violations. */ private detectPatternDrift; /** * LLM-based drift evaluation using self-check. * Asks the model: "Are you still aligned with these values?" */ private detectLLMDrift; private findSoftContradiction; private escapeRegex; } declare class ConstitutionInjector { private constitution; private autoInject; constructor(constitution: ConstitutionManager, autoInject?: boolean); /** * Generate a constitution injection block for the current drift result. * Call this before sending messages to the LLM when drift is detected. */ buildInjection(drift: DriftResult): string; /** * Get the auto-inject setting. */ shouldAutoInject(): boolean; /** * Set the auto-inject setting. */ setAutoInject(value: boolean): void; } interface IdentitySystem { constitution: ConstitutionManager; detector: DriftDetector; injector: ConstitutionInjector; } declare function createIdentitySystem(config?: IdentityConfig): IdentitySystem; /** * ReMEM — Identity Duplication & Infection * * Duplication: Export the agent's memory, identity, and soul into a portable * identity package and upload to DARKSOL server. * * Infection: Pull an identity package from DARKSOL server and overlay it * on the local ReMEM instance (live connection required). * * v0.3.3 */ /** * Build an identity package from the local ReMEM instance. * This does NOT upload — it only builds the package. * Use `uploadPackage()` to send to the server. */ declare function buildIdentityPackage(params: { store: MemoryStoreLike; layers?: LayerManager; identity?: IdentitySystem; soulText?: string; identityText?: string; config: DuplicationConfig; }): Promise; /** * Upload an identity package to the DARKSOL server. */ declare function uploadPackage(pkg: IdentityPackage, config: DuplicationConfig): Promise<{ uploadUrl: string; response: unknown; }>; /** * Full duplication: build + upload identity package to DARKSOL server. * Returns upload confirmation details. */ declare function duplicate(params: { store: MemoryStoreLike; layers?: LayerManager; identity?: IdentitySystem; soulText?: string; identityText?: string; config: DuplicationConfig; }): Promise; /** * Download an identity package from the DARKSOL server. */ declare function downloadPackage(config: InfectionConfig): Promise; /** * Apply an identity package to the local ReMEM instance. * This injects the constitution statements into the identity system, * and optionally stores memories in the appropriate layers. */ declare function infect(params: { store: MemoryStoreLike; layers?: LayerManager; identity?: IdentitySystem; pkg: IdentityPackage; config: InfectionConfig; }): Promise; /** * Pull + infect in one shot. * Downloads from server and applies the identity package locally. */ declare function infectFromServer(params: { store: MemoryStoreLike; layers?: LayerManager; identity?: IdentitySystem; config: InfectionConfig; }): Promise; interface MemoryGraphOptions extends Omit { query?: string; limit?: number; includeIsolated?: boolean; maxLinks?: number; } interface MemoryGraphNode { id: string; label: string; content: string; topics: string[]; metadata: Record; createdAt: number; accessedAt: number; accessCount: number; weight: number; } interface MemoryGraphLink { id: string; fromId: string; toId: string; type: string; weight: number; metadata: Record; createdAt: number; } interface MemoryGraphTopicCluster { topic: string; count: number; nodeIds: string[]; } interface MemoryGraphCytoscapeNode { group: 'nodes'; data: { id: string; label: string; content: string; topics: string[]; weight: number; metadata: Record; createdAt: number; accessedAt: number; accessCount: number; }; } interface MemoryGraphCytoscapeEdge { group: 'edges'; data: { id: string; source: string; target: string; label: string; type: string; weight: number; metadata: Record; createdAt: number; }; } interface MemoryGraphCytoscapeExport { elements: Array; } interface MemoryGraphSnapshot { name: 'ReMEM Memory Graph'; query?: string; nodes: MemoryGraphNode[]; links: MemoryGraphLink[]; topics: MemoryGraphTopicCluster[]; dot: string; cytoscape: MemoryGraphCytoscapeExport; generatedAt: number; } declare function getSmartRecallProfiles(): SmartRecallProfileDescriptor[]; declare function getSmartRecallProfile(profile: SmartRecallProfile): SmartRecallProfileDescriptor; declare function resolveRecallProfile(profile: string | null | undefined): SmartRecallProfile | null; /** * ReMEM — RLM-Style Memory System * * @example * const memory = new ReMEM({ * storage: 'sqlite', * llm: { type: 'bankr', apiKey: process.env.BANKR_API_KEY }, * }); * * await memory.init(); * await memory.store({ content: "User prefers dark mode", topics: ['preferences'] }); * const results = await memory.query("What UI preferences?"); */ declare class ReMEM { private _store; private model?; private engine; private identity?; private layers?; private embeddingService?; private _embeddingEnabled; private _identityEnabled; private _layersEnabled; private _layerConfig?; private _agentId?; private _userId?; private normalizeNamespace; private namespaceTopicTrail; private buildScopedMetadataFilters; private normalizeRememberContent; private rememberTokenSet; private inferRememberKind; private rememberLayerForKind; private rememberScore; private rememberDuplicate; private rememberConflicts; private buildProcedureTrigger; private graphNodeLabel; private dotEscape; constructor(config: ReMEMConfig); /** * Initialize the memory store. Must be called before use. * Also restores persisted layer state from the configured store if layers are enabled. */ init(): Promise; /** * Store a new memory entry. * If layers are enabled, also persists to the appropriate layer in SQLite. * If embeddings are enabled, generates a vector embedding in the background. */ store(input: StoreMemoryInput): Promise; remember(input: RememberInput): Promise; rememberMany(inputs: RememberInput[], options?: RememberBatchOptions): Promise; /** * Query memory using natural language. * Uses semantic search (cosine similarity) when embeddings are enabled, * falls back to keyword + access_count scoring otherwise. */ query(query: string, options?: QueryOptions): Promise; linkMemories(fromId: string, toId: string, type: string, metadata?: Record): Promise; getLinkedMemories(memoryId: string, options?: LinkedMemoryQueryOptions): Promise>; unlinkMemories(linkId: string): Promise; queryWithNeighbors(query: string, options?: QueryWithNeighborsOptions): Promise; smartRecall(query: string, options?: SmartRecallOptions): Promise; dream(options?: DreamOptions): Promise; contextPack(query: string, options?: ContextPackOptions): Promise; private renderContextPack; /** * Returns true if semantic embeddings are enabled and configured. */ isEmbeddingEnabled(): boolean; /** * Returns the embedding service instance (if enabled). */ getEmbeddingService(): EmbeddingService | undefined; usesNativeVectorSearch(): boolean; private defaultLinkWeight; private metadataNumericWeight; /** * Get the layer manager for advanced layer/consolidation operations. */ getLayerManager(): LayerManager | undefined; /** * Persist a layer entry. Exposed for advanced consolidation workflows. */ persistLayerEntry(entry: LayeredMemoryEntry): Promise; /** * Persist a vector embedding for a layered memory entry. */ persistLayerEmbedding(entryId: string, vector: number[], model: string): Promise; /** * Get recent memory entries. */ getRecent(n?: number): Promise; /** * Return a compact inventory of the configured memory scope. * Useful for health checks, release audits, and agent context budgeting. */ stats(): Promise<{ coreCount: number; layerCount: number; snapshotCount: number; eventCount: number; topics: Array<{ topic: string; count: number; }>; layers: ReturnType | null; oldestMemoryAt: number | null; newestMemoryAt: number | null; }>; /** * Build a visualization-ready snapshot of the current memory graph. * Returns weighted nodes, internal links, topic clusters, and Graphviz DOT. */ graph(options?: MemoryGraphOptions): Promise; /** * Run storage maintenance for the configured memory scope. * Use dryRun first to inspect expired layers and dangling storage rows before pruning. */ storageMaintenance(options?: StorageMaintenanceOptions): Promise; /** * Register an external knowledge artifact without importing all of its rows. * Use this for compressed or tool-owned graph files, for example a * `.codebase-memory/graph.db.zst` produced by a codebase-memory MCP. */ registerKnowledgeArtifact(input: KnowledgeArtifactRegistration): Promise; /** * Ingest a portable external knowledge graph into ReMEM. * Nodes become memory entries and edges become ReMEM links, so existing * graph recall can traverse architecture/import/call relationships. */ ingestKnowledgeGraph(artifact: KnowledgeGraphArtifact, options?: KnowledgeIngestOptions): Promise; /** * Summarize imported knowledge/codebase graph memories by label, owner, and graph health. * Useful when another system owns indexing and ReMEM is the durable recall + traversal layer. */ knowledgeOverview(options?: CodebaseGraphInventoryOptions & { resourceGrant?: KnowledgeResourceGrant; }): Promise<{ project: string | undefined; nodes: number; labels: Record; owners: CodebaseGraphOwnerSummary[]; entrypoints: CodebaseGraphNodeHealth[]; hotspots: CodebaseGraphNodeHealth[]; deadzones: CodebaseGraphNodeHealth[]; }>; /** * Retrieve a scoped codebase/knowledge subgraph with prompt-ready context. * This exposes imported graph memories without requiring callers to instantiate an adapter themselves. */ knowledgeSubgraph(query: string, options?: CodebaseSubgraphOptions): Promise; private renderKnowledgeNodeContent; private inferKnowledgeNodeWeight; private inferKnowledgeEdgeWeight; private normalizeKnowledgeLinkType; /** * Return a first-class memory health report with concrete maintenance actions. * Use this before long-running sessions, releases, or agent handoffs to decide * whether to snapshot, consolidate, dedupe, enrich metadata, or pack context. */ health(options?: MemoryHealthOptions): Promise; private findDuplicateGroups; private recommendationRank; /** * Get entries by topic. */ getByTopic(topic: string, limit?: number): Promise; storeShared(input: StoreMemoryInput & { namespace: NamespaceInput; visibility?: 'private' | 'shared'; }): Promise; getRecallProfiles(): SmartRecallProfileDescriptor[]; getRecallProfile(profile: SmartRecallProfile): SmartRecallProfileDescriptor; queryNamespace(namespace: NamespaceInput, query: string, options?: QueryOptions, scope?: NamespaceQueryScope): Promise; getRecentInNamespace(namespace: NamespaceInput, n?: number, scope?: NamespaceQueryScope): Promise; /** * Recursive query — RLM-style iterative refinement. */ recursiveQuery(initialQuery: string, maxDepth?: number): Promise<{ answer: string; memories: QueryResult[]; }>; /** * RLM-style Memory REPL — navigate memory programmatically. * * The model writes JavaScript to navigate the memory store. This enables * arbitrarily large memory stores without context window overflow — the model * never sees all memory at once, only constant-size metadata about what it * has observed. * * Requires: model configured. * Optional: layers enabled (enables layer-aware navigation). * * @returns { answer: string, observations: REPL debug trace } */ replNavigate(query: string): Promise<{ answer: string; observations: unknown[]; }>; /** * Enable identity layer with optional constitution import. */ enableIdentity(config?: { constitutionTexts?: Array<{ text: string; source: string; }>; autoInject?: boolean; evalModel?: ModelAbstraction['config']; }): void; /** * Add an identity statement. */ addIdentityStatement(text: string, category: ConstitutionStatement['category'], weight?: number): ConstitutionStatement | null; /** * Import identity constitution from text (e.g., SOUL.md content). */ importConstitution(text: string, source: string): number; /** * Detect identity drift in the current session context. */ detectDrift(sessionText: string): Promise; auditIdentityAlignment(sessionText: string): Promise<{ drift: DriftResult; injection: string; topStatements: ConstitutionStatement[]; }>; /** * Get constitution injection block if drift is detected. * Use this to prepend correction context to LLM messages. */ getConstitutionInjection(drift: DriftResult): string; /** * Get all identity statements. */ getIdentityStatements(category?: ConstitutionStatement['category']): ConstitutionStatement[]; /** * Check if identity layer is enabled. */ isIdentityEnabled(): boolean; /** * Enable hierarchical memory layers (episodic / semantic / identity). * Layers are persisted to SQLite — they survive process restarts. */ enableLayers(config?: Partial): Promise; /** * Store in a specific layer. */ storeInLayer(input: StoreMemoryInput, layer: MemoryLayer): Promise; /** * Query across layers with weighted retrieval. * Uses hybrid scoring (keyword + semantic embeddings) when embedding service is available. */ queryLayers(query: string, options?: QueryOptions & { layers?: MemoryLayer[]; }): Promise> | null>; /** * Get layer stats. */ getLayerStats(): ReturnType | null; /** * Evict expired entries from all layers. */ evictExpiredLayers(): number; /** * Check if episodic layer needs compression. * Returns true when episodic is above 80% capacity. */ needsEpisodicCompression(): boolean; /** * Compress oldest episodic entries into semantic summaries. * Call this when episodic layer fills up — uses the LLM to summarize * old entries rather than losing them to TTL eviction. * * @param count How many episodic entries to compress (default: 20) * @returns compressed entry info, or null if layers/llm not available */ compressEpisodic(count?: number): Promise<{ compressedEntryId: string; summary: string; entriesEvicted: number; } | null>; /** * Store a procedural memory — a behavior/rule triggered by a keyword. * Use when you learn a rule like "when X happens, always do Y". */ storeProcedural(input: StoreMemoryInput, trigger: string | Partial): Promise; /** * Fire procedural rules matching the given context. * Returns rules whose trigger keyword appears in the context. */ fireProcedural(context: string): QueryResult[]; matchProcedural(context: string): ProceduralMatch[]; /** * Get the temporal history of an entry — trace its supersession chain. * Returns all versions from newest to oldest. */ getTemporalHistory(entryId: string): QueryResult[]; /** * Check if layers are enabled. */ isLayersEnabled(): boolean; /** * Create a named snapshot of current memory state. * Essential for long-running agents — take a snapshot before restarts. * @param label Human-readable label for this snapshot */ createSnapshot(label: string): Promise<{ id: string; label: string; createdAt: number; memoryCount: number; layerCounts: Record; checksum: string | null; }>; /** * Restore from a snapshot by ID. * Verifies checksum, then restores core and layered entries from the snapshot into the current store. * @returns Number of entries restored */ restoreSnapshot(snapshotId: string): Promise; /** * List available snapshots. */ listSnapshots(): Promise>; /** * Export a snapshot as portable JSON. */ exportSnapshot(snapshotId: string): Promise; /** * Import a portable snapshot JSON export. */ importSnapshot(snapshot: Awaited>, opts?: { overwrite?: boolean; }): Promise; /** * Delete a snapshot. */ deleteSnapshot(snapshotId: string): Promise; /** * Export and upload the agent's identity package to DARKSOL server. * This backs up all memories, constitution statements, and optionally * SOUL/IDENTITY text to the DARKSOL cloud. * * Usage: * ``` * const result = await memory.duplicate({ * serverUrl: 'https://api.darksol.net', * apiKey: 'your-api-key', * soulText: soulMdContent, * identityText: identityMdContent, * }); * console.log(`Uploaded ${result.memoryCount} memories`); * ``` */ duplicate(config: { serverUrl: string; apiKey: string; soulText?: string; identityText?: string; includeSoul?: boolean; includeIdentity?: boolean; includeAllLayers?: boolean; layers?: Array<'episodic' | 'semantic' | 'identity' | 'procedural'>; }): Promise; /** * Build an identity package locally without uploading. * Useful for previewing what would be exported. */ buildIdentityPackageLocal(config: { soulText?: string; identityText?: string; includeSoul?: boolean; includeIdentity?: boolean; includeAllLayers?: boolean; layers?: Array<'episodic' | 'semantic' | 'identity' | 'procedural'>; }): Promise; /** * Pull an identity package from DARKSOL server and infect this ReMEM instance. * Requires live connection — if the server is unreachable, throws. * Infected agents gain the source identity's constitution and memories. * * Usage: * ``` * const result = await memory.infect({ * serverUrl: 'https://api.darksol.net', * apiKey: 'your-api-key', * layers: ['identity', 'procedural'], * }); * ``` */ infect(config: { serverUrl: string; apiKey: string; sourceAgentId?: string; version?: string; refreshIntervalMs?: number; layers?: Array<'identity' | 'semantic' | 'procedural'>; }): Promise; /** * Download identity package without applying it (preview). */ fetchIdentityPackage(config: { serverUrl: string; apiKey: string; sourceAgentId?: string; version?: string; }): Promise; /** * Get the underlying MemoryStore for advanced operations. */ getStore(): MemoryStoreLike; /** * Get the model name if configured. */ getModelName(): string | undefined; /** * Get the configured model client for advanced workflows. */ getModel(): ModelAbstraction | undefined; /** * Run a first-class consolidation workflow: dedupe, conflict resolution, * promotion, optional summary generation, and optional procedural promotion. */ runConsolidation(options?: ConsolidationWorkflowOptions): Promise; /** * Close the memory store and release resources. */ close(): void; } export { type Adapter, type CodebaseGraphAsMemoryOptions, type CodebaseGraphConnection, type CodebaseGraphDisplayType, type CodebaseGraphInventoryOptions, type CodebaseGraphMemorySnapshot, type CodebaseGraphNodeHealth, type CodebaseGraphOwnerSummary, type CodebaseGraphQueryOptions, type CodebaseGraphSubgraph, type CodebaseSubgraphOptions, type Constitution, ConstitutionInjector, ConstitutionManager, type ConstitutionStatement, type ContextPackOptions, type ContextPackResponse, type ContextPackSection, type ContextPackSectionTitles, DEFAULT_LAYER_CONFIG, type DreamMemoryLayer, type DreamOptions, type DreamResponse, DriftDetector, type DriftEvent, type DriftResult, type DuplicateResult, type DuplicationConfig, type EmbeddingConfig$1 as EmbeddingConfig, EpisodicCapturePipeline, type EventType, HttpAdapter, type IdentityCategory, type IdentityConfig, type IdentityPackage, type IdentitySystem, type InfectionConfig, type InfectionResult, type KnowledgeArtifactRegistration, type KnowledgeArtifactRegistrationResult, type KnowledgeEdge, type KnowledgeGraphArtifact, type KnowledgeIngestOptions, type KnowledgeIngestResult, type KnowledgeNode, type KnowledgeResourceAccessResult, type KnowledgeResourceGrant, type KnowledgeResourceScope, type KnowledgeResourceUri, type LLMMessage, type LLMResponse, type LayerConfig, LayerManager, type LayeredMemoryEntry, type LinkedMemoryQueryOptions, MemoryConsolidator, type MemoryEntry, type MemoryEvent, type MemoryGraphCytoscapeEdge, type MemoryGraphCytoscapeExport, type MemoryGraphCytoscapeNode, type MemoryGraphLink, type MemoryGraphNode, type MemoryGraphOptions, type MemoryGraphSnapshot, type MemoryGraphTopicCluster, type MemoryHealthCheck, type MemoryHealthOptions, type MemoryHealthRecommendation, type MemoryHealthResponse, type MemoryLayer, type MemoryLink, type MemoryLinkInput, MemoryREPL, MemoryStore, type MemoryStoreLike, type MetadataFilter, type MetadataFilterOperator, type MetadataFilterValue, ModelAbstraction, type ModelConfig, type NamespaceInput, type NamespaceQueryScope, type NeighborPath, PostgresMemoryStore, type PostgresStorageConfig, type ProceduralMatch, type ProceduralTrigger, QueryEngine, type QueryOptions, type QueryResponse, type QueryResult, type QueryWithNeighborsOptions, ReMEM, type ReMEMAdapterOptions, type ReMEMConfig, type RememberAction, type RememberBatchItemResult, type RememberBatchOptions, type RememberBatchResult, type RememberInput, type RememberKind, type RememberResult, type SmartRecallOptions, type SmartRecallProfile, type SmartRecallProfileDefaults, type SmartRecallProfileDescriptor, type SmartRecallResponse, type SmartRecallResult, type SnapshotExport, type SnapshotMeta, type StorageMaintenanceOptions, type StorageMaintenanceResult, type StoreMemoryInput, type StoreMemoryOptions, type SupersessionResult, authorizeKnowledgeResourceAccess, buildIdentityPackage, constitutionSchema, constitutionStatementSchema, contextPackOptionsSchema, contextPackResponseSchema, contextPackSectionSchema, contextPackSectionTitlesSchema, createCodebaseMemoryAdapter, createHermesAdapter, createIdentitySystem, createLangGraphStoreAdapter, createOpenClawAdapter, createVercelAIAdapter, defaultMemoryLinkTypes, downloadPackage, dreamMemoryLayerSchema, dreamOptionsSchema, dreamResponseSchema, driftEventSchema, driftResultSchema, duplicate, duplicationConfigSchema, embeddingConfigSchema, eventTypeSchema, getSmartRecallProfile, getSmartRecallProfiles, identityCategorySchema, identityConfigSchema, identityPackageSchema, infect, infectFromServer, infectionConfigSchema, knowledgeArtifactRegistrationSchema, knowledgeEdgeSchema, knowledgeGraphArtifactSchema, knowledgeIngestOptionsSchema, knowledgeIngestResultSchema, knowledgeNodeSchema, knowledgeResourceGrantSchema, knowledgeResourceScopeSchema, knowledgeResourceUriSchema, layerConfigSchema, layeredMemoryEntrySchema, linkedMemoryQueryOptionsSchema, memoryEntrySchema, memoryEventSchema, memoryHealthCheckSchema, memoryHealthOptionsSchema, memoryHealthRecommendationSchema, memoryHealthResponseSchema, memoryLayerSchema, memoryLinkInputSchema, memoryLinkSchema, metadataFilterOperatorSchema, metadataFilterSchema, metadataFilterValueSchema, modelConfigSchema, namespaceInputSchema, namespaceQueryScopeSchema, neighborPathSchema, normalizeSmartRecallProfileInput, postgresStorageConfigSchema, proceduralMatchSchema, proceduralTriggerSchema, queryOptionsSchema, queryResponseSchema, queryResultSchema, queryWithNeighborsOptionsSchema, rememConfigSchema, rememberActionSchema, rememberBatchInputSchema, rememberBatchItemResultSchema, rememberBatchOptionsSchema, rememberBatchResultSchema, rememberInputSchema, rememberKindSchema, rememberResultSchema, resolveRecallProfile, resolveSmartRecallProfile, smartRecallOptionsSchema, smartRecallProfileDefaultsSchema, smartRecallProfileDescriptorSchema, smartRecallProfileSchema, smartRecallResponseSchema, smartRecallResultSchema, storeMemoryInputSchema, uploadPackage };