trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
56 lines • 2.55 kB
TypeScript
/**
* Integration materialization cache + lane overlay (W4 lazy replay).
*
* ADR 0001: do not replay all lane journals on every open — cache integration
* state and overlay only the active lane journal.
*/
import { EAVStore } from '../core/store/eav-store.js';
import type { VcsOp } from './types.js';
export interface MaterializeIntegrationOptions {
/** Path to `.trellis/integration-snapshot.json` for cold-start acceleration. */
snapshotPath?: string;
}
export interface MaterializationStats {
/** Integration ops replayed in the last materialize call (0 = cache hit). */
integrationOpsReplayed: number;
/** Lane ops replayed in the last overlay call. */
laneOpsReplayed: number;
/** True when integration cache tail matched the journal tail. */
integrationCacheHit: boolean;
/** True when integration state was restored from a persisted snapshot with no tail replay. */
integrationSnapshotHit: boolean;
/** Integration journal tail hash after last materialize. */
integrationTailHash?: string;
}
export interface IntegrationCache {
tailHash: string | undefined;
store: EAVStore;
}
export declare function emptyMaterializationStats(): MaterializationStats;
export declare function replayOpIntoStore(store: EAVStore, op: VcsOp): void;
/** Clone an EAV store via snapshot/restore (lane overlay fork point). */
export declare function cloneStore(source: EAVStore): EAVStore;
export declare function materializeIntegrationOps(ops: VcsOp[], cache: IntegrationCache | null, tailHash: string | undefined, opts?: MaterializeIntegrationOptions): {
store: EAVStore;
cache: IntegrationCache;
stats: MaterializationStats;
};
/** Apply lane journal ops on a fork of the integration store. */
export declare function overlayLaneOps(integrationStore: EAVStore, laneOps: VcsOp[]): {
store: EAVStore;
laneOpsReplayed: number;
};
/**
* After lane overlay, restore integration criterion status (passed/failed).
* Lane-local criterionAdd may re-emit status=pending; integration updates win.
*/
export declare function reapplyIntegrationCriterionUpdates(store: EAVStore, integrationOps: VcsOp[]): void;
/**
* Materialize a child-fork lane entry (ADR 0007).
* Integration through baseOpHash, then parent journal, then child journal.
*/
export declare function materializeChildForkEntry(integrationOps: VcsOp[], baseOpHash: string, parentLaneOps: VcsOp[], childLaneOps: VcsOp[]): {
store: EAVStore;
stats: MaterializationStats;
};
//# sourceMappingURL=lane-materialize.d.ts.map