@ferricstore/ferricstore
    Preparing search index...

    Interface SessionHistoryTransactionAwareSession

    Optional session capability for atomic, idempotent history changes.

    Implementations must persist the operation identifier and history change atomically. Repeating an operation identifier with the same transaction must succeed without applying the transaction again. Reusing an operation identifier with a different transaction, or attempting to replace a suffix that does not match, must fail without changing history.

    Implementations may reject item metadata that cannot be snapshotted and compared deterministically, but must do so before changing history or recording the operation identifier.

    interface SessionHistoryTransactionAwareSession {
        addItems(items: AgentInputItem[]): Promise<void>;
        applyHistoryTransaction(
            args: SessionHistoryTransactionArgs,
            runContext?: RunContext<any>,
        ): void | Promise<void>;
        clearSession(): Promise<void>;
        getItems(limit?: number): Promise<AgentInputItem[]>;
        getSessionId(): Promise<string>;
        popItem(): Promise<AgentInputItem | undefined>;
        prepareHistoryItemForModelInput?(item: AgentInputItem): AgentInputItem;
        prepareHistoryItemsForPersistenceComparison?(
            items: AgentInputItem[],
        ): AgentInputItem[];
        preserveReasoningItemIdsForPersistence?(): boolean;
        replaceHistoryWithCompaction?(items: AgentInputItem[]): Promise<void>;
    }

    Hierarchy (View Summary)

    • Session
      • SessionHistoryTransactionAwareSession

    Implemented by

    Index
    • Optionally replace the logical session history with a compaction marker and its retained suffix without resetting the session identity.

      Implementations may append the replacement when their backend treats the leading compaction item as the authoritative replay boundary. If this method is absent, the runner falls back to clearing and rebuilding the session with rollback protection.

      Parameters

      Returns Promise<void>