Skip to content

@codesoul-co/hypha-memory / memory-utils

Using this module

Use the Memory utils module for using the public contracts and operations for this capability boundary. It exports 7 functions.

Import from the package entrypoint

ts
import {
  hashMemoryContent,
  hashMemoryScope,
  isNormalizedMemoryError,
  memoryError,
  normalizeMemoryError,
  sha256,
  stableStringify,
} from '@codesoul-co/hypha-memory';

Usage patterns

  • The module exposes 7 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports

SymbolKindSignatureDescription
hashMemoryContentfunctionhashMemoryContent(content: unknown): stringHash Memory Content function with 1 public call signature; parameters and return types are listed below.
hashMemoryScopefunctionhashMemoryScope(scope: ManagedMemoryScope): stringHash Memory Scope function with 1 public call signature; parameters and return types are listed below.
isNormalizedMemoryErrorfunctionisNormalizedMemoryError(value: unknown): value is NormalizedMemoryErrorIs Normalized Memory Error function with 1 public call signature; parameters and return types are listed below.
memoryErrorfunctionmemoryError(code: NormalizedMemoryError["code"], message: string, retryable?: boolean, details?: Record<string, unknown>): NormalizedMemoryErrorMemory Error function with 1 public call signature; parameters and return types are listed below.
normalizeMemoryErrorfunctionnormalizeMemoryError(error: unknown, fallbackCode?: NormalizedMemoryError["code"]): NormalizedMemoryErrorNormalize Memory Error function with 1 public call signature; parameters and return types are listed below.
sha256functionsha256(value: unknown): stringSha256 function with 1 public call signature; parameters and return types are listed below.
stableStringifyfunctionstableStringify(value: unknown): stringStable Stringify function with 1 public call signature; parameters and return types are listed below.

hashMemoryContent

Hash Memory Content function with 1 public call signature; parameters and return types are listed below.

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

Declaration

text
export declare function hashMemoryContent(content: unknown): string;

Call signature

text
hashMemoryContent(content: unknown): string

Parameters

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

Returns

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

hashMemoryScope

Hash Memory Scope function with 1 public call signature; parameters and return types are listed below.

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

Declaration

text
export declare function hashMemoryScope(scope: ManagedMemoryScope): string;

Call signature

text
hashMemoryScope(scope: ManagedMemoryScope): string

Parameters

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

Returns

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

isNormalizedMemoryError

Is Normalized Memory Error function with 1 public call signature; parameters and return types are listed below.

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

Declaration

text
export declare function isNormalizedMemoryError(value: unknown): value is NormalizedMemoryError;

Call signature

text
isNormalizedMemoryError(value: unknown): value is NormalizedMemoryError

Parameters

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

Returns

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

memoryError

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

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

Declaration

text
export declare function memoryError(code: NormalizedMemoryError['code'], message: string, retryable?: boolean, details?: Record<string, unknown>): NormalizedMemoryError;

Call signature

text
memoryError(code: NormalizedMemoryError["code"], message: string, retryable?: boolean, details?: Record<string, unknown>): NormalizedMemoryError

Parameters

ParameterTypeRequiredDescription
code"MEMORY_INVALID_INPUT" | "MEMORY_EXTRACTION_SOURCE_UNAVAILABLE" | "MEMORY_EXTRACTION_FAILED" | "MEMORY_EXTRACTION_CURSOR_CONFLICT" | "MEMORY_MAINTENANCE_CONFLICT" | "MEMORY_RANKING_FAILED" | "MEMORY_IDEMPOTENCY_CONFLICT" | "MEMORY_SCOPE_DENIED" | "MEMORY_PERMISSION_DENIED" | "MEMORY_NOT_FOUND" | "MEMORY_REVISION_CONFLICT" | "MEMORY_PROVIDER_NOT_INSTALLED" | "MEMORY_PROVIDER_UNAVAILABLE" | "MEMORY_PROVIDER_TIMEOUT"...YesRequired parameter; accepted values are defined by the type column.
messagestringYesRequired parameter; accepted values are defined by the type column.
retryablebooleanNoOptional parameter; accepted values are defined by the type column.
detailsRecord<string, unknown>NoOptional parameter; accepted values are defined by the type column.

Returns

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

normalizeMemoryError

Normalize Memory Error function with 1 public call signature; parameters and return types are listed below.

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

Declaration

text
export declare function normalizeMemoryError(error: unknown, fallbackCode?: NormalizedMemoryError['code']): NormalizedMemoryError;

Call signature

text
normalizeMemoryError(error: unknown, fallbackCode?: NormalizedMemoryError["code"]): NormalizedMemoryError

Parameters

ParameterTypeRequiredDescription
errorunknownYesRequired parameter; accepted values are defined by the type column.
fallbackCode"MEMORY_INVALID_INPUT" | "MEMORY_EXTRACTION_SOURCE_UNAVAILABLE" | "MEMORY_EXTRACTION_FAILED" | "MEMORY_EXTRACTION_CURSOR_CONFLICT" | "MEMORY_MAINTENANCE_CONFLICT" | "MEMORY_RANKING_FAILED" | "MEMORY_IDEMPOTENCY_CONFLICT" | "MEMORY_SCOPE_DENIED" | "MEMORY_PERMISSION_DENIED" | "MEMORY_NOT_FOUND" | "MEMORY_REVISION_CONFLICT" | "MEMORY_PROVIDER_NOT_INSTALLED" | "MEMORY_PROVIDER_UNAVAILABLE" | "MEMORY_PROVIDER_TIMEOUT"...NoOptional parameter; accepted values are defined by the type column.

Returns

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

sha256

Sha256 function with 1 public call signature; parameters and return types are listed below.

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

Declaration

text
export declare function sha256(value: unknown): string;

Call signature

text
sha256(value: unknown): string

Parameters

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

Returns

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

stableStringify

Stable Stringify function with 1 public call signature; parameters and return types are listed below.

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

Declaration

text
export declare function stableStringify(value: unknown): string;

Call signature

text
stableStringify(value: unknown): string

Parameters

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

Returns

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