/** * defineMemory — the single factory the consumer uses to register a * memory subsystem on an Agent. * * defineMemory({ id, type, strategy, store }) → MemoryDefinition * * The factory's job: * 1. Switch on `type` (Episodic / Semantic / Narrative / Causal) * to pick the right family of pipelines. * 2. Switch on `strategy.kind` within that family to wire stage * configs (loadCount / topK / threshold / extractor / ...). * 3. Return an opaque `MemoryDefinition` that step-4's * `Agent.memory()` builder method consumes. * * Pattern: Factory + Strategy (GoF). One factory, N strategies, four * types — all reduce to two compiled FlowCharts (`read`, * `write?`) that mount as subflows. * * Role: Layer-2 of the memory stack. Sits between the const-objects * contract (Layer 1) and the Agent builder method (Layer 4). * * Emits: Indirectly — the compiled subflows emit * `agentfootprint.context.injected` with `source: 'memory'` * when their formatter writes to the messages slot. * * @see ./define.types.ts for the const-objects + types * @see ./pipeline/*.ts for the existing pipeline factories this dispatches to */ import { type DefineMemoryOptions } from './define.types.js'; import type { MemoryDefinition, ReadonlyMemoryFlowChart } from './define.types.js'; /** * Build a `MemoryDefinition` from a high-level `{ type, strategy, store }` * config. Internally dispatches to one of the existing pipeline factories * (defaultPipeline / semanticPipeline / factPipeline / narrativePipeline / * autoPipeline / ephemeralPipeline) and wires the compiled flowcharts * into the opaque definition that `Agent.memory()` consumes. * * Supported combinations: * * | type | strategy.kind | underlying pipeline | * | --------- | ------------- | ------------------------ | * | EPISODIC | WINDOW | defaultPipeline | * | EPISODIC | BUDGET | defaultPipeline | * | EPISODIC | SUMMARIZE | defaultPipeline + summarize stage | * | SEMANTIC | TOP_K | semanticPipeline | * | SEMANTIC | EXTRACT | factPipeline | * | SEMANTIC | WINDOW | factPipeline (recency-load) | * | NARRATIVE | EXTRACT | narrativePipeline | * | NARRATIVE | WINDOW | narrativePipeline (recency-load) | * | (any) | HYBRID | autoPipeline (when sub-strategies map cleanly) | * * Unsupported combinations throw with a remediation hint pointing to a * working alternative or to the raw `mountMemoryRead`/`mountMemoryWrite` * helpers for power users. */ export declare function defineMemory(options: DefineMemoryOptions): MemoryDefinition; /** * Internal — unwrap the brand. Used by `Agent.memory()` (step 4) * to mount the pipeline. NOT exported. * * @internal */ export declare function unwrapMemoryFlowChart(branded: ReadonlyMemoryFlowChart): unknown;