Skip to content

@codesoul-co/hypha-memory / provider-governance

Using this module

Use the Provider governance module for binding external or local providers to Hypha ports. It exports 1 class, 2 functions, 5 interfaces.

Import from the package entrypoint

ts
import {
  InMemoryMemoryProviderQuota,
  createMemoryDeletionEvidence,
  verifyMemoryDeletionEvidence,
} from '@codesoul-co/hypha-memory';

import type {
  MemoryDeletionEvidence,
  MemoryProviderBackupRestoreCapabilities,
  MemoryProviderQuotaDecision,
  MemoryProviderQuotaPolicy,
  MemoryProviderUsage,
} from '@codesoul-co/hypha-memory';

Usage patterns

  • Use the 5 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 1 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
  • The module exposes 2 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports

SymbolKindSignatureDescription
InMemoryMemoryProviderQuotaclassnew InMemoryMemoryProviderQuota(policies: MemoryProviderQuotaPolicy[], now?: () => Date): InMemoryMemoryProviderQuotaIn Memory Memory Provider Quota class with 4 public constructor or member entries; its exact declarations are listed below.
createMemoryDeletionEvidencefunctioncreateMemoryDeletionEvidence(input: { operationId: string; providerId: string; scope: ManagedMemoryScope; requestedMemoryIds: string[]; deletedMemoryIds: string[]; mode: MemoryDeletionEvidence["mode"]; completedAt?: string; providerReceiptRef?: string; }): MemoryDeletionEvidenceCreate Memory Deletion Evidence function with 1 public call signature; parameters and return types are listed below.
verifyMemoryDeletionEvidencefunctionverifyMemoryDeletionEvidence(evidence: MemoryDeletionEvidence): booleanVerify Memory Deletion Evidence function with 1 public call signature; parameters and return types are listed below.
MemoryDeletionEvidenceinterfaceinterface MemoryDeletionEvidenceMemory Deletion Evidence interface with 12 public fields or methods.
MemoryProviderBackupRestoreCapabilitiesinterfaceinterface MemoryProviderBackupRestoreCapabilitiesMemory Provider Backup Restore Capabilities interface with 7 public fields or methods.
MemoryProviderQuotaDecisioninterfaceinterface MemoryProviderQuotaDecisionMemory Provider Quota Decision interface with 4 public fields or methods.
MemoryProviderQuotaPolicyinterfaceinterface MemoryProviderQuotaPolicyMemory Provider Quota Policy interface with 5 public fields or methods.
MemoryProviderUsageinterfaceinterface MemoryProviderUsageMemory Provider Usage interface with 5 public fields or methods.

InMemoryMemoryProviderQuota

In Memory Memory Provider Quota class with 4 public constructor or member entries; its exact declarations are listed below.

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

Declaration

text
export declare class InMemoryMemoryProviderQuota {
    constructor(policies: MemoryProviderQuotaPolicy[], now?: () => Date);
    check(providerId: string, requestedCostUnits?: number, requestedBytes?: number): MemoryProviderQuotaDecision;
    record(providerId: string, costUnits?: number, storedBytesDelta?: number): MemoryProviderUsage;
    snapshot(providerId: string): MemoryProviderUsage;
}

Public members

MemberKindSignatureDescription
checkmethodcheck(providerId: string, requestedCostUnits?: number, requestedBytes?: number): MemoryProviderQuotaDecisionPublic method; parameters and return type are shown in the signature.
constructorconstructor(policies: MemoryProviderQuotaPolicy[], now?: () => Date): InMemoryMemoryProviderQuotaCreates an instance of this class.
recordmethodrecord(providerId: string, costUnits?: number, storedBytesDelta?: number): MemoryProviderUsagePublic method; parameters and return type are shown in the signature.
snapshotmethodsnapshot(providerId: string): MemoryProviderUsagePublic method; parameters and return type are shown in the signature.

createMemoryDeletionEvidence

Create Memory Deletion Evidence function with 1 public call signature; parameters and return types are listed below.

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

Declaration

text
export declare function createMemoryDeletionEvidence(input: {
    operationId: string;
    providerId: string;
    scope: ManagedMemoryScope;
    requestedMemoryIds: string[];
    deletedMemoryIds: string[];
    mode: MemoryDeletionEvidence['mode'];
    completedAt?: string;
    providerReceiptRef?: string;
}): MemoryDeletionEvidence;

Call signature

text
createMemoryDeletionEvidence(input: { operationId: string; providerId: string; scope: ManagedMemoryScope; requestedMemoryIds: string[]; deletedMemoryIds: string[]; mode: MemoryDeletionEvidence["mode"]; completedAt?: string; providerReceiptRef?: string; }): MemoryDeletionEvidence

Parameters

ParameterTypeRequiredDescription
input{ operationId: string; providerId: string; scope: ManagedMemoryScope; requestedMemoryIds: string[]; deletedMemoryIds: string[]; mode: MemoryDeletionEvidence["mode"]; completedAt?: string; providerReceiptRef?: string; }YesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: MemoryDeletionEvidence
  • Description: The return contract is defined by the type shown above.

verifyMemoryDeletionEvidence

Verify Memory Deletion Evidence function with 1 public call signature; parameters and return types are listed below.

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

Declaration

text
export declare function verifyMemoryDeletionEvidence(evidence: MemoryDeletionEvidence): boolean;

Call signature

text
verifyMemoryDeletionEvidence(evidence: MemoryDeletionEvidence): boolean

Parameters

ParameterTypeRequiredDescription
evidenceMemoryDeletionEvidenceYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: boolean
  • Description: The return contract is defined by the type shown above.

MemoryDeletionEvidence

Memory Deletion Evidence interface with 12 public fields or methods.

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

Declaration

text
export interface MemoryDeletionEvidence {
    schemaVersion: '1.0';
    receiptId: string;
    operationId: string;
    providerId: string;
    scopeHash: string;
    requestedMemoryIds: string[];
    deletedMemoryIds: string[];
    pendingMemoryIds: string[];
    mode: 'soft' | 'hard' | 'compliance';
    completedAt: string;
    providerReceiptRef?: string;
    proofHash: string;
}

Contract members

MemberKindSignatureDescription
completedAtpropertycompletedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
deletedMemoryIdspropertydeletedMemoryIds: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
modepropertymode: "soft" | "hard" | "compliance"Public property; its type, readonly modifier and optionality are shown in the signature.
operationIdpropertyoperationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
pendingMemoryIdspropertypendingMemoryIds: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
proofHashpropertyproofHash: 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.
providerReceiptRefpropertyproviderReceiptRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
receiptIdpropertyreceiptId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requestedMemoryIdspropertyrequestedMemoryIds: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
schemaVersionpropertyschemaVersion: "1.0"Public property; its type, readonly modifier and optionality are shown in the signature.
scopeHashpropertyscopeHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryProviderBackupRestoreCapabilities

Memory Provider Backup Restore Capabilities interface with 7 public fields or methods.

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

Declaration

text
export interface MemoryProviderBackupRestoreCapabilities {
    exportRecords: boolean;
    importRecords: boolean;
    exportVersions: boolean;
    preserveStableIds: boolean;
    preserveScopeHashes: boolean;
    pointInTimeRestore: boolean;
    providerReceiptExport: boolean;
}

Contract members

MemberKindSignatureDescription
exportRecordspropertyexportRecords: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
exportVersionspropertyexportVersions: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
importRecordspropertyimportRecords: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
pointInTimeRestorepropertypointInTimeRestore: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
preserveScopeHashespropertypreserveScopeHashes: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
preserveStableIdspropertypreserveStableIds: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
providerReceiptExportpropertyproviderReceiptExport: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryProviderQuotaDecision

Memory Provider Quota Decision interface with 4 public fields or methods.

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

Declaration

text
export interface MemoryProviderQuotaDecision {
    allowed: boolean;
    reason?: 'operation_quota' | 'cost_quota' | 'storage_quota';
    remainingOperations: number;
    remainingCostUnits?: number;
}

Contract members

MemberKindSignatureDescription
allowedpropertyallowed: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason?: "operation_quota" | "cost_quota" | "storage_quota"Public property; its type, readonly modifier and optionality are shown in the signature.
remainingCostUnitspropertyremainingCostUnits?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
remainingOperationspropertyremainingOperations: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryProviderQuotaPolicy

Memory Provider Quota Policy interface with 5 public fields or methods.

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

Declaration

text
export interface MemoryProviderQuotaPolicy {
    providerId: string;
    windowMs: number;
    maxOperations: number;
    maxCostUnits?: number;
    maxStoredBytes?: number;
}

Contract members

MemberKindSignatureDescription
maxCostUnitspropertymaxCostUnits?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxOperationspropertymaxOperations: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxStoredBytespropertymaxStoredBytes?: numberPublic 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.
windowMspropertywindowMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryProviderUsage

Memory Provider Usage interface with 5 public fields or methods.

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

Declaration

text
export interface MemoryProviderUsage {
    providerId: string;
    windowStartedAt: string;
    operations: number;
    costUnits: number;
    storedBytes?: number;
}

Contract members

MemberKindSignatureDescription
costUnitspropertycostUnits: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
operationspropertyoperations: numberPublic 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.
storedBytespropertystoredBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
windowStartedAtpropertywindowStartedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.