Skip to content

@codesoul-co/hypha-memory / extraction

Using this module

Use the Extraction module for using the public contracts and operations for this capability boundary. It exports 4 classes, 4 functions, 2 interfaces, 1 type.

Import from the package entrypoint

ts
import {
  BasicMemoryExtractionSourceAdapter,
  DeterministicMemoryExtractor,
  InMemoryMemoryExtractionStateStore,
  MemoryExtractionCoordinator,
  createConversationExtractionAdapter,
  createEpisodicRecordExtractionAdapter,
  createRuntimeEventExtractionAdapter,
  createTruthExtractionAdapter,
} from '@codesoul-co/hypha-memory';

import type {
  MemoryExtractionCoordinatorOptions,
  MemoryExtractionStateStore,
  ExtractionSourceLoader,
} from '@codesoul-co/hypha-memory';

Usage patterns

  • Use the 3 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 4 classes as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
  • The module exposes 4 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports

SymbolKindSignatureDescription
BasicMemoryExtractionSourceAdapterclassnew BasicMemoryExtractionSourceAdapter<T = unknown>(type: MemoryExtractionSourceType, loader: ExtractionSourceLoader<T>, normalizer: (value: T, ref: MemoryExtractionSourceRef) => NormalizedExtractionInput): BasicMemoryExtractionSourceAdapter<T>Basic Memory Extraction Source Adapter class with 5 public constructor or member entries; its exact declarations are listed below.
DeterministicMemoryExtractorclassnew DeterministicMemoryExtractor(): DeterministicMemoryExtractorDeterministic Memory Extractor class with 4 public constructor or member entries; its exact declarations are listed below.
InMemoryMemoryExtractionStateStoreclassnew InMemoryMemoryExtractionStateStore(): InMemoryMemoryExtractionStateStoreIn Memory Memory Extraction State Store class with 7 public constructor or member entries; its exact declarations are listed below.
MemoryExtractionCoordinatorclassnew MemoryExtractionCoordinator(options: MemoryExtractionCoordinatorOptions): MemoryExtractionCoordinatorMemory Extraction Coordinator class with 4 public constructor or member entries; its exact declarations are listed below.
createConversationExtractionAdapterfunctioncreateConversationExtractionAdapter(loader: ExtractionSourceLoader<unknown>): BasicMemoryExtractionSourceAdapterCreate Conversation Extraction Adapter function with 1 public call signature; parameters and return types are listed below.
createEpisodicRecordExtractionAdapterfunctioncreateEpisodicRecordExtractionAdapter(loader: ExtractionSourceLoader<unknown>): BasicMemoryExtractionSourceAdapterCreate Episodic Record Extraction Adapter function with 1 public call signature; parameters and return types are listed below.
createRuntimeEventExtractionAdapterfunctioncreateRuntimeEventExtractionAdapter(loader: ExtractionSourceLoader<unknown>): BasicMemoryExtractionSourceAdapterCreate Runtime Event Extraction Adapter function with 1 public call signature; parameters and return types are listed below.
createTruthExtractionAdapterfunctioncreateTruthExtractionAdapter(loader: ExtractionSourceLoader<unknown>): BasicMemoryExtractionSourceAdapterCreate Truth Extraction Adapter function with 1 public call signature; parameters and return types are listed below.
MemoryExtractionCoordinatorOptionsinterfaceinterface MemoryExtractionCoordinatorOptionsMemory Extraction Coordinator Options interface with 4 public fields or methods.
MemoryExtractionStateStoreinterfaceinterface MemoryExtractionStateStoreMemory Extraction State Store interface with 6 public fields or methods.
ExtractionSourceLoadertypetype ExtractionSourceLoader = (ref: MemoryExtractionSourceRef) => Promise<T>Public type alias for Extraction Source Loader; the declaration contains its complete type expression.

BasicMemoryExtractionSourceAdapter

Basic Memory Extraction Source Adapter class with 5 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { BasicMemoryExtractionSourceAdapter } from '@codesoul-co/hypha-memory';
  • Source module: extraction

Declaration

text
export declare class BasicMemoryExtractionSourceAdapter<T = unknown> implements MemoryExtractionSourceAdapter<T> {
    readonly type: MemoryExtractionSourceType;
    constructor(type: MemoryExtractionSourceType, loader: ExtractionSourceLoader<T>, normalizer: (value: T, ref: MemoryExtractionSourceRef) => NormalizedExtractionInput);
    load(refs: MemoryExtractionSourceRef[], cursor?: MemoryExtractionCursor): Promise<MemoryExtractionSourceBatch<T>>;
    normalize(batch: MemoryExtractionSourceBatch<T>): Promise<NormalizedExtractionInput[]>;
    health(): Promise<ProviderHealth>;
}

Public members

MemberKindSignatureDescription
constructorconstructor<T = unknown>(type: MemoryExtractionSourceType, loader: ExtractionSourceLoader<T>, normalizer: (value: T, ref: MemoryExtractionSourceRef) => NormalizedExtractionInput): BasicMemoryExtractionSourceAdapter<T>Creates an instance of this class.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
loadmethodload(refs: MemoryExtractionSourceRef[], cursor?: MemoryExtractionCursor): Promise<MemoryExtractionSourceBatch<T>>Public method; parameters and return type are shown in the signature.
normalizemethodnormalize(batch: MemoryExtractionSourceBatch<T>): Promise<NormalizedExtractionInput[]>Public method; parameters and return type are shown in the signature.
typepropertyreadonly type: MemoryExtractionSourceTypePublic property; its type, readonly modifier and optionality are shown in the signature.

DeterministicMemoryExtractor

Deterministic Memory Extractor class with 4 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { DeterministicMemoryExtractor } from '@codesoul-co/hypha-memory';
  • Source module: extraction

Declaration

text
export declare class DeterministicMemoryExtractor implements MemoryExtractor {
    readonly id = "memory.extractor.deterministic";
    extract(inputs: NormalizedExtractionInput[], profile: MemoryExtractionProfileSpec): Promise<ExtractedMemoryCandidate[]>;
    health(): Promise<ProviderHealth>;
}

Public members

MemberKindSignatureDescription
constructorconstructor(): DeterministicMemoryExtractorCreates an instance of this class.
extractmethodextract(inputs: NormalizedExtractionInput[], profile: MemoryExtractionProfileSpec): Promise<ExtractedMemoryCandidate[]>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: "memory.extractor.deterministic"Public property; its type, readonly modifier and optionality are shown in the signature.

InMemoryMemoryExtractionStateStore

In Memory Memory Extraction State Store class with 7 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { InMemoryMemoryExtractionStateStore } from '@codesoul-co/hypha-memory';
  • Source module: extraction

Declaration

text
export declare class InMemoryMemoryExtractionStateStore implements MemoryExtractionStateStore {
    getJob(id: string): Promise<MemoryExtractionJob | null>;
    saveJob(job: MemoryExtractionJob): Promise<void>;
    getBatch(id: string): Promise<MemoryExtractionBatch | null>;
    saveBatch(batch: MemoryExtractionBatch): Promise<void>;
    getCursor(sourceType: MemoryExtractionSourceType, sourceId: string): Promise<MemoryExtractionCursor | null>;
    saveCursor(cursor: MemoryExtractionCursor, expectedSequence?: number): Promise<void>;
}

Public members

MemberKindSignatureDescription
constructorconstructor(): InMemoryMemoryExtractionStateStoreCreates an instance of this class.
getBatchmethodgetBatch(id: string): Promise<MemoryExtractionBatch | null>Public method; parameters and return type are shown in the signature.
getCursormethodgetCursor(sourceType: MemoryExtractionSourceType, sourceId: string): Promise<MemoryExtractionCursor | null>Public method; parameters and return type are shown in the signature.
getJobmethodgetJob(id: string): Promise<MemoryExtractionJob | null>Public method; parameters and return type are shown in the signature.
saveBatchmethodsaveBatch(batch: MemoryExtractionBatch): Promise<void>Public method; parameters and return type are shown in the signature.
saveCursormethodsaveCursor(cursor: MemoryExtractionCursor, expectedSequence?: number): Promise<void>Public method; parameters and return type are shown in the signature.
saveJobmethodsaveJob(job: MemoryExtractionJob): Promise<void>Public method; parameters and return type are shown in the signature.

MemoryExtractionCoordinator

Memory Extraction Coordinator class with 4 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { MemoryExtractionCoordinator } from '@codesoul-co/hypha-memory';
  • Source module: extraction

Declaration

text
export declare class MemoryExtractionCoordinator {
    readonly stateStore: MemoryExtractionStateStore;
    constructor(options: MemoryExtractionCoordinatorOptions);
    run(request: MemoryExtractionRequest, profile: MemoryExtractionProfileSpec): Promise<{
            job: MemoryExtractionJob;
            batch: MemoryExtractionBatch;
        }>;
    getJob(id: string): Promise<MemoryExtractionJob | null>;
}

Public members

MemberKindSignatureDescription
constructorconstructor(options: MemoryExtractionCoordinatorOptions): MemoryExtractionCoordinatorCreates an instance of this class.
getJobmethodgetJob(id: string): Promise<MemoryExtractionJob | null>Public method; parameters and return type are shown in the signature.
runmethodrun(request: MemoryExtractionRequest, profile: MemoryExtractionProfileSpec): Promise<{ job: MemoryExtractionJob; batch: MemoryExtractionBatch; }>Public method; parameters and return type are shown in the signature.
stateStorepropertyreadonly stateStore: MemoryExtractionStateStorePublic property; its type, readonly modifier and optionality are shown in the signature.

createConversationExtractionAdapter

Create Conversation Extraction Adapter function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { createConversationExtractionAdapter } from '@codesoul-co/hypha-memory';
  • Source module: extraction

Declaration

text
export declare function createConversationExtractionAdapter(loader: ExtractionSourceLoader<unknown>): BasicMemoryExtractionSourceAdapter;

Call signature

text
createConversationExtractionAdapter(loader: ExtractionSourceLoader<unknown>): BasicMemoryExtractionSourceAdapter

Parameters

ParameterTypeRequiredDescription
loaderExtractionSourceLoader<unknown>YesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: BasicMemoryExtractionSourceAdapter<unknown>
  • Description: The return contract is defined by the type shown above.

createEpisodicRecordExtractionAdapter

Create Episodic Record Extraction Adapter function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { createEpisodicRecordExtractionAdapter } from '@codesoul-co/hypha-memory';
  • Source module: extraction

Declaration

text
export declare function createEpisodicRecordExtractionAdapter(loader: ExtractionSourceLoader<unknown>): BasicMemoryExtractionSourceAdapter;

Call signature

text
createEpisodicRecordExtractionAdapter(loader: ExtractionSourceLoader<unknown>): BasicMemoryExtractionSourceAdapter

Parameters

ParameterTypeRequiredDescription
loaderExtractionSourceLoader<unknown>YesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: BasicMemoryExtractionSourceAdapter<unknown>
  • Description: The return contract is defined by the type shown above.

createRuntimeEventExtractionAdapter

Create Runtime Event Extraction Adapter function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { createRuntimeEventExtractionAdapter } from '@codesoul-co/hypha-memory';
  • Source module: extraction

Declaration

text
export declare function createRuntimeEventExtractionAdapter(loader: ExtractionSourceLoader<unknown>): BasicMemoryExtractionSourceAdapter;

Call signature

text
createRuntimeEventExtractionAdapter(loader: ExtractionSourceLoader<unknown>): BasicMemoryExtractionSourceAdapter

Parameters

ParameterTypeRequiredDescription
loaderExtractionSourceLoader<unknown>YesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: BasicMemoryExtractionSourceAdapter<unknown>
  • Description: The return contract is defined by the type shown above.

createTruthExtractionAdapter

Create Truth Extraction Adapter function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { createTruthExtractionAdapter } from '@codesoul-co/hypha-memory';
  • Source module: extraction

Declaration

text
export declare function createTruthExtractionAdapter(loader: ExtractionSourceLoader<unknown>): BasicMemoryExtractionSourceAdapter;

Call signature

text
createTruthExtractionAdapter(loader: ExtractionSourceLoader<unknown>): BasicMemoryExtractionSourceAdapter

Parameters

ParameterTypeRequiredDescription
loaderExtractionSourceLoader<unknown>YesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: BasicMemoryExtractionSourceAdapter<unknown>
  • Description: The return contract is defined by the type shown above.

MemoryExtractionCoordinatorOptions

Memory Extraction Coordinator Options interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryExtractionCoordinatorOptions } from '@codesoul-co/hypha-memory';
  • Source module: extraction

Declaration

text
export interface MemoryExtractionCoordinatorOptions {
    adapters: MemoryExtractionSourceAdapter[];
    extractor: MemoryExtractor;
    stateStore?: MemoryExtractionStateStore;
    now?: () => string;
}

Contract members

MemberKindSignatureDescription
adapterspropertyadapters: MemoryExtractionSourceAdapter<unknown>[]Public property; its type, readonly modifier and optionality are shown in the signature.
extractorpropertyextractor: MemoryExtractorPublic property; its type, readonly modifier and optionality are shown in the signature.
nowmethodnow?(): stringPublic method; parameters and return type are shown in the signature.
stateStorepropertystateStore?: MemoryExtractionStateStorePublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryExtractionStateStore

Memory Extraction State Store interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryExtractionStateStore } from '@codesoul-co/hypha-memory';
  • Source module: extraction

Declaration

text
export interface MemoryExtractionStateStore {
    getJob(id: string): Promise<MemoryExtractionJob | null>;
    saveJob(job: MemoryExtractionJob): Promise<void>;
    getBatch(id: string): Promise<MemoryExtractionBatch | null>;
    saveBatch(batch: MemoryExtractionBatch): Promise<void>;
    getCursor(sourceType: MemoryExtractionSourceType, sourceId: string): Promise<MemoryExtractionCursor | null>;
    saveCursor(cursor: MemoryExtractionCursor, expectedSequence?: number): Promise<void>;
}

Contract members

MemberKindSignatureDescription
getBatchmethodgetBatch(id: string): Promise<MemoryExtractionBatch | null>Public method; parameters and return type are shown in the signature.
getCursormethodgetCursor(sourceType: MemoryExtractionSourceType, sourceId: string): Promise<MemoryExtractionCursor | null>Public method; parameters and return type are shown in the signature.
getJobmethodgetJob(id: string): Promise<MemoryExtractionJob | null>Public method; parameters and return type are shown in the signature.
saveBatchmethodsaveBatch(batch: MemoryExtractionBatch): Promise<void>Public method; parameters and return type are shown in the signature.
saveCursormethodsaveCursor(cursor: MemoryExtractionCursor, expectedSequence?: number): Promise<void>Public method; parameters and return type are shown in the signature.
saveJobmethodsaveJob(job: MemoryExtractionJob): Promise<void>Public method; parameters and return type are shown in the signature.

ExtractionSourceLoader

Public type alias for Extraction Source Loader; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ExtractionSourceLoader } from '@codesoul-co/hypha-memory';
  • Source module: extraction

Declaration

text
export type ExtractionSourceLoader<T> = (ref: MemoryExtractionSourceRef) => Promise<T>;