Skip to content

@codesoul-co/hypha-memory / memory-runtime-coordinator

Using this module

Use the Memory runtime coordinator module for executing runtime behavior at this boundary. It exports 3 classes, 8 interfaces, 1 type.

Import from the package entrypoint

ts
import {
  InMemoryMemoryRuntimeControlStore,
  MemoryRuntimeCoordinator,
  StructuredMemoryRuntimeControlStore,
} from '@codesoul-co/hypha-memory';

import type {
  MemoryRuntimeActiveState,
  MemoryRuntimeControlStore,
  MemoryRuntimeCoordinatorOptions,
  MemoryRuntimeCreator,
  MemoryRuntimeGeneration,
  MemoryRuntimeRevisionState,
  MemoryRuntimeSwitchResult,
  StructuredMemoryRuntimeControlStoreOptions,
} from '@codesoul-co/hypha-memory';

// The complete export list is documented below.

Usage patterns

  • Use the 9 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 3 classes as constructable runtime implementations. Each symbol entry lists its constructor and public methods.

Public exports

SymbolKindSignatureDescription
InMemoryMemoryRuntimeControlStoreclassnew InMemoryMemoryRuntimeControlStore(): InMemoryMemoryRuntimeControlStoreIn Memory Memory Runtime Control Store class with 7 public constructor or member entries; its exact declarations are listed below.
MemoryRuntimeCoordinatorclassnew MemoryRuntimeCoordinator(options: MemoryRuntimeCoordinatorOptions): MemoryRuntimeCoordinatorMemory Runtime Coordinator class with 8 public constructor or member entries; its exact declarations are listed below.
StructuredMemoryRuntimeControlStoreclassnew StructuredMemoryRuntimeControlStore(options: StructuredMemoryRuntimeControlStoreOptions): StructuredMemoryRuntimeControlStoreStructured Memory Runtime Control Store class with 7 public constructor or member entries; its exact declarations are listed below.
MemoryRuntimeActiveStateinterfaceinterface MemoryRuntimeActiveState extends MemoryRuntimeRevisionStateMemory Runtime Active State interface with 14 public fields or methods.
MemoryRuntimeControlStoreinterfaceinterface MemoryRuntimeControlStoreMemory Runtime Control Store interface with 6 public fields or methods.
MemoryRuntimeCoordinatorOptionsinterfaceinterface MemoryRuntimeCoordinatorOptionsMemory Runtime Coordinator Options interface with 6 public fields or methods.
MemoryRuntimeCreatorinterfaceinterface MemoryRuntimeCreatorMemory Runtime Creator interface with 1 public fields or methods.
MemoryRuntimeGenerationinterfaceinterface MemoryRuntimeGenerationMemory Runtime Generation interface with 6 public fields or methods.
MemoryRuntimeRevisionStateinterfaceinterface MemoryRuntimeRevisionStateMemory Runtime Revision State interface with 14 public fields or methods.
MemoryRuntimeSwitchResultinterfaceinterface MemoryRuntimeSwitchResult extends MemoryRuntimeGenerationMemory Runtime Switch Result interface with 7 public fields or methods.
StructuredMemoryRuntimeControlStoreOptionsinterfaceinterface StructuredMemoryRuntimeControlStoreOptionsStructured Memory Runtime Control Store Options interface with 3 public fields or methods.
MemoryRuntimeRevisionStatustypetype MemoryRuntimeRevisionStatus = 'active' | 'draining' | 'retired' | 'quarantined'Public type alias for Memory Runtime Revision Status; the declaration contains its complete type expression.

InMemoryMemoryRuntimeControlStore

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

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

Declaration

text
export declare class InMemoryMemoryRuntimeControlStore implements MemoryRuntimeControlStore {
    readonly durability: "ephemeral";
    getActive(coordinatorId: string): Promise<MemoryRuntimeActiveState | null>;
    activate(coordinatorId: string, expectedGeneration: number | null, next: MemoryRuntimeActiveState, previous?: MemoryRuntimeRevisionState): Promise<boolean>;
    getRevision(coordinatorId: string, profileRevision: string): Promise<MemoryRuntimeRevisionState | null>;
    setRevision(state: MemoryRuntimeRevisionState): Promise<void>;
    listRevisions(coordinatorId: string): Promise<MemoryRuntimeRevisionState[]>;
}

Public members

MemberKindSignatureDescription
activatemethodactivate(coordinatorId: string, expectedGeneration: number | null, next: MemoryRuntimeActiveState, previous?: MemoryRuntimeRevisionState): Promise<boolean>Public method; parameters and return type are shown in the signature.
constructorconstructor(): InMemoryMemoryRuntimeControlStoreCreates an instance of this class.
durabilitypropertyreadonly durability: "ephemeral"Public property; its type, readonly modifier and optionality are shown in the signature.
getActivemethodgetActive(coordinatorId: string): Promise<MemoryRuntimeActiveState | null>Public method; parameters and return type are shown in the signature.
getRevisionmethodgetRevision(coordinatorId: string, profileRevision: string): Promise<MemoryRuntimeRevisionState | null>Public method; parameters and return type are shown in the signature.
listRevisionsmethodlistRevisions(coordinatorId: string): Promise<MemoryRuntimeRevisionState[]>Public method; parameters and return type are shown in the signature.
setRevisionmethodsetRevision(state: MemoryRuntimeRevisionState): Promise<void>Public method; parameters and return type are shown in the signature.

MemoryRuntimeCoordinator

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

Declaration

text
export declare class MemoryRuntimeCoordinator {
    constructor(options: MemoryRuntimeCoordinatorOptions);
    initialize(input: unknown, references?: ReadonlyMap<string, unknown>): Promise<MemoryRuntimeSwitchResult>;
    switchRevision(input: unknown, references?: ReadonlyMap<string, unknown>, expectedProfileRevision?: string): Promise<MemoryRuntimeSwitchResult>;
    withRuntime<T>(operation: (runtime: MemoryRuntime, generation: MemoryRuntimeGeneration) => Promise<T>): Promise<T>;
    probeActive(): Promise<MemoryRuntimeRevisionState>;
    current(): MemoryRuntimeGeneration | null;
    drain(): Promise<void>;
    close(): Promise<void>;
}

Public members

MemberKindSignatureDescription
closemethodclose(): Promise<void>Public method; parameters and return type are shown in the signature.
constructorconstructor(options: MemoryRuntimeCoordinatorOptions): MemoryRuntimeCoordinatorCreates an instance of this class.
currentmethodcurrent(): MemoryRuntimeGeneration | nullPublic method; parameters and return type are shown in the signature.
drainmethoddrain(): Promise<void>Public method; parameters and return type are shown in the signature.
initializemethodinitialize(input: unknown, references?: ReadonlyMap<string, unknown>): Promise<MemoryRuntimeSwitchResult>Public method; parameters and return type are shown in the signature.
probeActivemethodprobeActive(): Promise<MemoryRuntimeRevisionState>Public method; parameters and return type are shown in the signature.
switchRevisionmethodswitchRevision(input: unknown, references?: ReadonlyMap<string, unknown>, expectedProfileRevision?: string): Promise<MemoryRuntimeSwitchResult>Public method; parameters and return type are shown in the signature.
withRuntimemethodwithRuntime<T>(operation: (runtime: MemoryRuntime, generation: MemoryRuntimeGeneration) => Promise<T>): Promise<T>Public method; parameters and return type are shown in the signature.

StructuredMemoryRuntimeControlStore

Structured Memory Runtime Control Store class with 7 public constructor or member entries; its exact declarations are listed below.

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

Declaration

text
export declare class StructuredMemoryRuntimeControlStore implements MemoryRuntimeControlStore {
    readonly durability: "durable";
    constructor(options: StructuredMemoryRuntimeControlStoreOptions);
    getActive(coordinatorId: string): Promise<MemoryRuntimeActiveState | null>;
    activate(coordinatorId: string, expectedGeneration: number | null, next: MemoryRuntimeActiveState, previous?: MemoryRuntimeRevisionState): Promise<boolean>;
    getRevision(coordinatorId: string, profileRevision: string): Promise<MemoryRuntimeRevisionState | null>;
    setRevision(state: MemoryRuntimeRevisionState): Promise<void>;
    listRevisions(coordinatorId: string): Promise<MemoryRuntimeRevisionState[]>;
}

Public members

MemberKindSignatureDescription
activatemethodactivate(coordinatorId: string, expectedGeneration: number | null, next: MemoryRuntimeActiveState, previous?: MemoryRuntimeRevisionState): Promise<boolean>Public method; parameters and return type are shown in the signature.
constructorconstructor(options: StructuredMemoryRuntimeControlStoreOptions): StructuredMemoryRuntimeControlStoreCreates an instance of this class.
durabilitypropertyreadonly durability: "durable"Public property; its type, readonly modifier and optionality are shown in the signature.
getActivemethodgetActive(coordinatorId: string): Promise<MemoryRuntimeActiveState | null>Public method; parameters and return type are shown in the signature.
getRevisionmethodgetRevision(coordinatorId: string, profileRevision: string): Promise<MemoryRuntimeRevisionState | null>Public method; parameters and return type are shown in the signature.
listRevisionsmethodlistRevisions(coordinatorId: string): Promise<MemoryRuntimeRevisionState[]>Public method; parameters and return type are shown in the signature.
setRevisionmethodsetRevision(state: MemoryRuntimeRevisionState): Promise<void>Public method; parameters and return type are shown in the signature.

MemoryRuntimeActiveState

Memory Runtime Active State interface with 14 public fields or methods.

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

Declaration

text
export interface MemoryRuntimeActiveState extends MemoryRuntimeRevisionState {
    id: string;
}

Contract members

MemberKindSignatureDescription
capabilityHashpropertycapabilityHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
capabilitySnapshotpropertycapabilitySnapshot: MemoryManagementCapabilitiesPublic property; its type, readonly modifier and optionality are shown in the signature.
coordinatorIdpropertycoordinatorId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
generationpropertygeneration: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
observedAtpropertyobservedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileHashpropertyprofileHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileIdpropertyprofileId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileRevisionpropertyprofileRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerIdpropertyproviderId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerRevisionpropertyproviderRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
quarantineErrorpropertyquarantineError?: NormalizedMemoryErrorPublic property; its type, readonly modifier and optionality are shown in the signature.
runtimeIdpropertyruntimeId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus: MemoryRuntimeRevisionStatusPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryRuntimeControlStore

Memory Runtime Control Store interface with 6 public fields or methods.

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

Declaration

text
export interface MemoryRuntimeControlStore {
    readonly durability: 'ephemeral' | 'durable';
    getActive(coordinatorId: string): Promise<MemoryRuntimeActiveState | null>;
    activate(coordinatorId: string, expectedGeneration: number | null, next: MemoryRuntimeActiveState, previous?: MemoryRuntimeRevisionState): Promise<boolean>;
    getRevision(coordinatorId: string, profileRevision: string): Promise<MemoryRuntimeRevisionState | null>;
    setRevision(state: MemoryRuntimeRevisionState): Promise<void>;
    listRevisions(coordinatorId: string): Promise<MemoryRuntimeRevisionState[]>;
}

Contract members

MemberKindSignatureDescription
activatemethodactivate(coordinatorId: string, expectedGeneration: number | null, next: MemoryRuntimeActiveState, previous?: MemoryRuntimeRevisionState): Promise<boolean>Public method; parameters and return type are shown in the signature.
durabilitypropertyreadonly durability: "ephemeral" | "durable"Public property; its type, readonly modifier and optionality are shown in the signature.
getActivemethodgetActive(coordinatorId: string): Promise<MemoryRuntimeActiveState | null>Public method; parameters and return type are shown in the signature.
getRevisionmethodgetRevision(coordinatorId: string, profileRevision: string): Promise<MemoryRuntimeRevisionState | null>Public method; parameters and return type are shown in the signature.
listRevisionsmethodlistRevisions(coordinatorId: string): Promise<MemoryRuntimeRevisionState[]>Public method; parameters and return type are shown in the signature.
setRevisionmethodsetRevision(state: MemoryRuntimeRevisionState): Promise<void>Public method; parameters and return type are shown in the signature.

MemoryRuntimeCoordinatorOptions

Memory Runtime Coordinator Options interface with 6 public fields or methods.

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

Declaration

text
export interface MemoryRuntimeCoordinatorOptions {
    id: string;
    factory: MemoryRuntimeFactory | MemoryRuntimeCreator;
    store: MemoryRuntimeControlStore;
    requireDurableStore?: boolean;
    now?: () => Date;
    capabilityProbeIntervalMs?: number;
}

Contract members

MemberKindSignatureDescription
capabilityProbeIntervalMspropertycapabilityProbeIntervalMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
factorypropertyfactory: MemoryRuntimeFactory | MemoryRuntimeCreatorPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
nowmethodnow?(): DatePublic method; parameters and return type are shown in the signature.
requireDurableStorepropertyrequireDurableStore?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
storepropertystore: MemoryRuntimeControlStorePublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryRuntimeCreator

Memory Runtime Creator interface with 1 public fields or methods.

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

Declaration

text
export interface MemoryRuntimeCreator {
    create(input: unknown, references?: ReadonlyMap<string, unknown>): Promise<MemoryRuntime>;
}

Contract members

MemberKindSignatureDescription
createmethodcreate(input: unknown, references?: ReadonlyMap<string, unknown>): Promise<MemoryRuntime>Public method; parameters and return type are shown in the signature.

MemoryRuntimeGeneration

Memory Runtime Generation interface with 6 public fields or methods.

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

Declaration

text
export interface MemoryRuntimeGeneration {
    generation: number;
    profileId: string;
    profileRevision: string;
    providerId: string;
    providerRevision: string;
    runtimeId: string;
}

Contract members

MemberKindSignatureDescription
generationpropertygeneration: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
profileIdpropertyprofileId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileRevisionpropertyprofileRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerIdpropertyproviderId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerRevisionpropertyproviderRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runtimeIdpropertyruntimeId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryRuntimeRevisionState

Memory Runtime Revision State interface with 14 public fields or methods.

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

Declaration

text
export interface MemoryRuntimeRevisionState {
    id: string;
    coordinatorId: string;
    profileId: string;
    profileRevision: string;
    providerId: string;
    providerRevision: string;
    runtimeId: string;
    profileHash: string;
    capabilityHash: string;
    capabilitySnapshot: MemoryManagementCapabilities;
    status: MemoryRuntimeRevisionStatus;
    generation: number;
    observedAt: string;
    quarantineError?: NormalizedMemoryError;
}

Contract members

MemberKindSignatureDescription
capabilityHashpropertycapabilityHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
capabilitySnapshotpropertycapabilitySnapshot: MemoryManagementCapabilitiesPublic property; its type, readonly modifier and optionality are shown in the signature.
coordinatorIdpropertycoordinatorId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
generationpropertygeneration: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
observedAtpropertyobservedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileHashpropertyprofileHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileIdpropertyprofileId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileRevisionpropertyprofileRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerIdpropertyproviderId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerRevisionpropertyproviderRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
quarantineErrorpropertyquarantineError?: NormalizedMemoryErrorPublic property; its type, readonly modifier and optionality are shown in the signature.
runtimeIdpropertyruntimeId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus: MemoryRuntimeRevisionStatusPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryRuntimeSwitchResult

Memory Runtime Switch Result interface with 7 public fields or methods.

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

Declaration

text
export interface MemoryRuntimeSwitchResult extends MemoryRuntimeGeneration {
    previousProfileRevision?: string;
}

Contract members

MemberKindSignatureDescription
generationpropertygeneration: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
previousProfileRevisionpropertypreviousProfileRevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileIdpropertyprofileId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileRevisionpropertyprofileRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerIdpropertyproviderId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerRevisionpropertyproviderRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runtimeIdpropertyruntimeId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

StructuredMemoryRuntimeControlStoreOptions

Structured Memory Runtime Control Store Options interface with 3 public fields or methods.

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

Declaration

text
export interface StructuredMemoryRuntimeControlStoreOptions {
    provider: StructuredStoreProvider;
    activeTable?: string;
    revisionTable?: string;
}

Contract members

MemberKindSignatureDescription
activeTablepropertyactiveTable?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerpropertyprovider: StructuredStoreProviderPublic property; its type, readonly modifier and optionality are shown in the signature.
revisionTablepropertyrevisionTable?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryRuntimeRevisionStatus

Public type alias for Memory Runtime Revision Status; the declaration contains its complete type expression.

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

Declaration

text
export type MemoryRuntimeRevisionStatus = 'active' | 'draining' | 'retired' | 'quarantined';